~ubuntu-branches/ubuntu/wily/lxpanel/wily-proposed

« back to all changes in this revision

Viewing changes to plugins/batt/batt_sys.h

  • Committer: Package Import Robot
  • Author(s): Julien Lavergne
  • Date: 2015-01-31 15:30:45 UTC
  • mfrom: (1.3.3)
  • mto: This revision was merged to the branch mainline in revision 45.
  • Revision ID: package-import@ubuntu.com-20150131153045-1r9i4602vrplnx3i
Import upstream version 0.7.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
35
typedef struct battery {
 
36
    int battery_num;
 
37
    /* path to battery dir */
 
38
    gchar *path;
 
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;
 
51
    int percentage;
 
52
    char *state, *poststr;
 
53
    char* capacity_unit;
 
54
    int type_battery;
 
55
} battery;
 
56
 
 
57
battery *battery_get();
 
58
battery *battery_update( battery *b );
 
59
void battery_print(battery *b, int show_capacity);
 
60
gboolean battery_is_charging( battery *b );
 
61
gint battery_get_remaining( battery *b );
 
62
void battery_free(battery* bat);
 
63
 
 
64
#endif