2009-05-15 20:48:55 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* Copyright (C) 2009 Sebastian Reichel <elektranox@gmail.com>
|
|
|
|
*
|
|
|
|
* Battery with functional data (percentage, time to life) and drawing data
|
|
|
|
* (area, font, ...). Each panel use his own drawing data.
|
2009-05-31 12:40:40 +00:00
|
|
|
* Need kernel > 2.6.23.
|
2009-05-15 20:48:55 +00:00
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef BATTERY_H
|
|
|
|
#define BATTERY_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "area.h"
|
|
|
|
|
2009-10-18 17:54:09 +00:00
|
|
|
|
2009-10-28 23:01:32 +00:00
|
|
|
// battery drawing parameter (per panel)
|
2009-05-15 20:48:55 +00:00
|
|
|
typedef struct Battery {
|
2009-09-20 20:48:00 +00:00
|
|
|
// always start with area
|
|
|
|
Area area;
|
2009-05-15 20:48:55 +00:00
|
|
|
|
2010-01-09 00:11:01 +00:00
|
|
|
Color font;
|
2009-09-20 20:48:00 +00:00
|
|
|
int bat1_posy;
|
|
|
|
int bat2_posy;
|
2009-05-15 20:48:55 +00:00
|
|
|
} Battery;
|
|
|
|
|
|
|
|
enum chargestate {
|
|
|
|
BATTERY_UNKNOWN,
|
|
|
|
BATTERY_CHARGING,
|
2009-10-28 10:58:12 +00:00
|
|
|
BATTERY_DISCHARGING,
|
|
|
|
BATTERY_FULL
|
2009-05-15 20:48:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct battime {
|
|
|
|
int16_t hours;
|
|
|
|
int8_t minutes;
|
|
|
|
int8_t seconds;
|
|
|
|
} battime;
|
|
|
|
|
|
|
|
typedef struct batstate {
|
|
|
|
int percentage;
|
|
|
|
struct battime time;
|
|
|
|
enum chargestate state;
|
|
|
|
} batstate;
|
|
|
|
|
|
|
|
extern struct batstate battery_state;
|
|
|
|
extern PangoFontDescription *bat1_font_desc;
|
|
|
|
extern PangoFontDescription *bat2_font_desc;
|
2009-10-28 23:01:32 +00:00
|
|
|
extern int battery_enabled;
|
2010-01-19 19:29:28 +00:00
|
|
|
extern int percentage_hide;
|
2009-05-15 20:48:55 +00:00
|
|
|
|
|
|
|
extern int8_t battery_low_status;
|
2009-05-31 12:40:40 +00:00
|
|
|
extern char *battery_low_cmd;
|
|
|
|
extern char *path_energy_now, *path_energy_full, *path_current_now, *path_status;
|
|
|
|
|
2009-05-15 20:48:55 +00:00
|
|
|
|
|
|
|
// initialize clock : y position, ...
|
2009-06-18 20:26:40 +00:00
|
|
|
void update_battery();
|
2009-05-15 20:48:55 +00:00
|
|
|
|
|
|
|
void init_battery();
|
2009-10-18 17:54:09 +00:00
|
|
|
void init_battery_panel(void *panel);
|
2010-04-16 18:50:03 +00:00
|
|
|
|
|
|
|
// freed memory and set default values
|
2009-10-30 17:18:44 +00:00
|
|
|
void cleanup_battery();
|
2009-05-15 20:48:55 +00:00
|
|
|
|
2010-01-09 00:11:01 +00:00
|
|
|
void draw_battery(void *obj, cairo_t *c);
|
2009-05-15 20:48:55 +00:00
|
|
|
|
|
|
|
void resize_battery(void *obj);
|
|
|
|
|
|
|
|
#endif
|