Adding upstream version 0.9.0.
[debian/lxpanel.git] / plugins / batt / batt_sys.h
1 /*
2 * batt_sys.h
3 *
4 * Copyright 2009 Juergen Hötzel <juergen@archlinux.org>
5 * 2015 Stanislav Kozina, Ersin <xersin@users.sf.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
21 */
22
23
24 #ifndef BATT_SYS_H
25 #define BATT_SYS_H
26
27
28 #define BUF_SIZE 1024
29 #define ACPI_PATH_SYS_POWER_SUPPLY "/sys/class/power_supply"
30 #define ACPI_BATTERY_DEVICE_NAME "BAT"
31 #define MIN_CAPACITY 0.01
32 #define MIN_PRESENT_RATE 0.01
33 #define BATTERY_DESC "Battery"
34
35 #include <glib.h>
36
37 typedef struct battery {
38 int battery_num;
39 /* path to battery dir */
40 gchar *path;
41 /* sysfs file contents */
42 int charge_now;
43 int energy_now;
44 int current_now;
45 int power_now;
46 int voltage_now;
47 int charge_full_design;
48 int energy_full_design;
49 int charge_full;
50 int energy_full;
51 /* extra info */
52 int seconds;
53 int percentage;
54 char *state;
55 //const char *poststr;
56 //const char *capacity_unit;
57 int type_battery;
58 } battery;
59
60 battery *battery_get(int);
61 battery *battery_update( battery *b );
62 //void battery_print(battery *b, int show_capacity);
63 gboolean battery_is_charging( battery *b );
64 gint battery_get_remaining( battery *b );
65 void battery_free(battery* bat);
66
67 #endif