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