wmbattery: Restore BSD support.
[dockapps.git] / wmbattery / apm.h
blob381b7f7c3ff2a298f436ca7d88b7143129b9b361
1 #include "config.h"
3 #ifdef HAVE_MACHINE_APM_BIOS_H /* for FreeBSD */
4 #include <machine/apm_bios.h>
5 #endif
7 #ifdef HAVE_I386_APMVAR_H /* for NetBSD and OpenBSD */
8 #include <i386/apmvar.h>
9 #endif
11 #ifdef HAVE_APM_H
12 #include <apm.h>
13 #endif
15 /* Symbolic constants for apm may be in system apm.h, or may not. */
16 #ifndef AC_LINE_STATUS_ON
17 #define AC_LINE_STATUS_OFF (0)
18 #define AC_LINE_STATUS_ON (1)
19 #define AC_LINE_STATUS_BACKUP (2)
20 #define AC_LINE_STATUS_UNKNOWN (0xff)
22 #define BATTERY_STATUS_HIGH (0)
23 #define BATTERY_STATUS_LOW (1)
24 #define BATTERY_STATUS_CRITICAL (2)
25 #define BATTERY_STATUS_CHARGING (3)
26 #define BATTERY_STATUS_ABSENT (4)
27 #define BATTERY_STATUS_UNKNOWN (0xff)
29 #define BATTERY_FLAGS_HIGH (0x1)
30 #define BATTERY_FLAGS_LOW (0x2)
31 #define BATTERY_FLAGS_CRITICAL (0x4)
32 #define BATTERY_FLAGS_CHARGING (0x8)
33 #define BATTERY_FLAGS_ABSENT (0x80)
35 #define BATTERY_PERCENTAGE_UNKNOWN (-1)
37 #define BATTERY_TIME_UNKNOWN (-1)
38 #endif /* AC_LINE_STATUS_ON */
40 #if defined (HAVE_MACHINE_APM_BIOS_H) || defined (HAVE_I386_APMVAR_H) /* BSD */
41 typedef struct {
42 const char driver_version[10];
43 int apm_version_major;
44 int apm_version_minor;
45 int apm_flags;
46 int ac_line_status;
47 int battery_status;
48 int battery_flags;
49 int battery_percentage;
50 int battery_time;
51 int using_minutes;
52 } apm_info;
54 int apm_read(apm_info *i);
55 int apm_exists(void);
56 #endif