Another mega-patch for the refactoring process.

Kinda runs, but functionality from the original main loop
is still missing. Patience.
This commit is contained in:
Hisham Muhammad
2015-01-23 03:08:21 -02:00
parent 3383d8e556
commit c2108e5a48
19 changed files with 300 additions and 240 deletions

View File

@ -15,10 +15,27 @@ Linux battery readings written by Ian P. Hands (iphands@gmail.com, ihands@redhat
#define _GNU_SOURCE
#endif
ACPresence Battery_isOnAC();
#define SYS_POWERSUPPLY_DIR "/sys/class/power_supply"
double Battery_getProcBatData();
// ----------------------------------------
// READ FROM /proc
// ----------------------------------------
double Battery_getSysBatData();
// This implementation reading from from /proc/acpi is really inefficient,
// but I think this is on the way out so I did not rewrite it.
// The /sys implementation below does things the right way.
// ----------------------------------------
// READ FROM /sys
// ----------------------------------------
/**
* Returns a pointer to the suffix of `str` if its beginning matches `prefix`.
* Returns NULL if the prefix does not match.
* Examples:
* match("hello world", "hello "); -> "world"
* match("hello world", "goodbye "); -> NULL
*/
void Battery_getData(double* level, ACPresence* isOnAC);
#endif