Adding upstream version 0.9.0.
[debian/lxpanel.git] / plugins / batt / batt_sys.h
CommitLineData
2ba86315
DB
1/*
2 * batt_sys.h
6b775dbb 3 *
2ba86315 4 * Copyright 2009 Juergen Hötzel <juergen@archlinux.org>
7a1c5048 5 * 2015 Stanislav Kozina, Ersin <xersin@users.sf.net>
6b775dbb 6 *
2ba86315
DB
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.
6b775dbb 11 *
2ba86315
DB
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.
6b775dbb 16 *
2ba86315
DB
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
7a1c5048
AG
29#define ACPI_PATH_SYS_POWER_SUPPLY "/sys/class/power_supply"
30#define ACPI_BATTERY_DEVICE_NAME "BAT"
2ba86315
DB
31#define MIN_CAPACITY 0.01
32#define MIN_PRESENT_RATE 0.01
33#define BATTERY_DESC "Battery"
34
35#include <glib.h>
36
37typedef struct battery {
38 int battery_num;
39 /* path to battery dir */
6b775dbb 40 gchar *path;
514580cf
DB
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;
2ba86315 53 int percentage;
7a1c5048
AG
54 char *state;
55 //const char *poststr;
56 //const char *capacity_unit;
2ba86315
DB
57 int type_battery;
58} battery;
59
7a1c5048 60battery *battery_get(int);
6b775dbb 61battery *battery_update( battery *b );
7a1c5048 62//void battery_print(battery *b, int show_capacity);
2ba86315
DB
63gboolean battery_is_charging( battery *b );
64gint battery_get_remaining( battery *b );
6b775dbb 65void battery_free(battery* bat);
2ba86315
DB
66
67#endif