Classes | |
struct | BatteryGeneral |
General battery information. More... | |
struct | BatteryDetailed |
Detailed battery information. More... | |
struct | ThermalDev |
object representing a thermal device More... | |
Defines | |
#define | MAX_FILE_PATH 512 |
maximum length of a filepath | |
#define | MAX_LINE_SIZE 1024 |
maximum length of a line | |
#define | MAX_BATTERIES 4 |
maximum number of batteries we support | |
#define | MAX_BAT_CHAR_LEN 200 |
Max string length in ACPI Source Language: 200 bytes. | |
#define | MAX_THERMAL_ACTIVE 10 |
#define | NO_ACPI_ERROR -20 |
error if acpi is not supported by the system | |
#define | NO_MODULE_ERROR -10 |
error for unavailable module | |
#define | NO_DEVICE_ERROR -5 |
error for unavailable device | |
#define | MAX_SUPPORTED_CPUS 32 |
maximum number of supported cpus | |
#define | UNKNOWN -1 |
defining an unknown state | |
#define | CHARG_STATE_UNKNOWN 0 |
charging state is unknown | |
#define | CHARG_STATE_CHARGING 1 |
#define | CHARG_STATE_DISCHARGING 2 |
battery is currently discharging | |
#define | CHARG_STATE_CHARG_DISCHARG (CHARG_STATE_CHARGING | CHARG_STATE_DISCHARGING) |
defines whether charging or discharging | |
#define | ACPI_S1 1 |
acpi sleep state S1 | |
#define | ACPI_S2 2 |
acpi sleep state S2 | |
#define | ACPI_S3 4 |
acpi sleep state S3 | |
#define | ACPI_S3_BIOS 8 |
acpi sleep state S3 bios | |
#define | ACPI_S4 16 |
acpi sleep state S4 | |
#define | ACPI_S4_BIOS 32 |
acpi sleep state S4 bios | |
#define | APM_STANDBY 64 |
apm standby | |
#define | APM_SUSPEND 128 |
apm suspend | |
#define | pDebug(level, string, args...) do {} while (0); |
Enumerations | |
enum | BATTERY_PRESENT { PRESENT_YES = 0, PRESENT_NO } |
whether the battery is present More... | |
enum | CAPACITY_UNIT { WATT_H = 0, AMP } |
the unit of the battery capacity More... | |
enum | BATTERY_TECH { TECH_NON_RECHARGEABLE = 0, TECH_RECHARGEABLE } |
technologie of the battery More... | |
enum | CAPACITY_STATE { STATE_OK, STATE_CRIT, STATE_LOW, STATE_WARN } |
enum | AC_ADAPTER_STATE { AC_UNKNOWN, AC_ONLINE, AC_OFFLINE } |
ac adapter status More... | |
enum | DISK_MODE { DISK_FULL_ON, DISK_STANDBY, DISK_SLEEP } |
states a disk can be in More... | |
enum | LID_STATE { LID_OPEN, LID_CLOSED } |
current state of the lid More... | |
enum | ISACPI { NOT_SUPPORTED = -1, APM, ACPI } |
use for checkACPI function return value! More... | |
enum | THERM_MODE { OK, ACTIVE, PASSIVE, HOT, CRITICAL } |
the current thermal mode More... | |
enum | _COOLING_POLICY { COOLING_MODE_ACTIVE = 0, COOLING_MODE_PASSIVE } |
cooling policy More... | |
Functions | |
int | getBatteriesInfo (BatteryGeneral *bat) |
fills the given Battery struct with the current battery information for all found batteries | |
int | getBatteryInfo (const int no, BatteryGeneral *battery_info) |
get Information for only one battery | |
int | numBatteries (void) |
get number of present batteries | |
int | getBatteryDetailedInfo (const int no, BatteryDetailed *bd) |
use this method to get amount of batteries in the system | |
int | setBatteryAlarm (const int percent) |
sets the ACPI battery alarm for all batteries | |
int | getLidState (void) |
returns the current state of the lid | |
int | getThrottlingInfo (int *num_states, int *current_state) |
get throttling information (ACPI only) | |
int | setThrottlingPercent (const int percent) |
set throttling percent | |
int | getThrottlingInfoCPU (const int cpu, int *num_states, int *current_state) |
get throttling info for one single cpu | |
int | setThrottlingStateCPU (const int cpu, const int state) |
set throttling state on cpu | |
int | setThrottlingPercentCPU (const int cpu, const int percent) |
set throttling percent for single cpu | |
int | getThermalZonesNum (void) |
get the number of thermal zones | |
int | getThermalZoneTemp (const int zone) |
get thermal zone temp | |
int | getThermalZoneState (int zone) |
get thermal zone state | |
int | getThermalZone (const int zone, ThermalDev *td) |
get a thermal zone | |
int | setThermalTrippoints (const int zone, const ThermalDev td) |
set thermal trippoints | |
int | setCoolingMode (const int device_num, const int mode) |
set cooling mode | |
int | getFanNum (void) |
get number of fans in the system | |
int | getFanStatus (const int device_num) |
get fan status | |
int | getACAdapterStatus (void) |
returns if the machine is on ac power or not | |
float | getRealProcessorSpeed (void) |
get processor speed | |
int | calcCPULoad (const int consider_nice) |
calculate cpu load | |
int | getCPULoad (const int cpu) |
get current cpu load | |
void | freeCPULoadData (void) |
free data for calculating cpu time | |
int | getCPUCount (void) |
get number of cpus in system | |
int64_t | getSupportedSleepStates (void) |
get all supported sleeping states | |
int | checkACPI (void) |
determine whether there is apm, acpi or nothing on your Computer | |
void | setDebugLevel (const int dbg) |
set the debug level. Values: 0-31 |
IMPORTANT !!! Test all data for UNKNOWN
You never know if the kernel or the hw supports specific features!
|
acpi sleep state S1
|
|
acpi sleep state S2
|
|
acpi sleep state S3
|
|
acpi sleep state S3 bios
|
|
acpi sleep state S4
|
|
acpi sleep state S4 bios
|
|
apm standby
|
|
apm suspend
|
|
defines whether charging or discharging
|
|
|
|
battery is currently discharging
|
|
charging state is unknown
|
|
Max string length in ACPI Source Language: 200 bytes.
|
|
maximum number of batteries we support
|
|
maximum length of a filepath Hope this is only under /proc/acpi where this is correct. |
|
maximum length of a line
|
|
maximum number of supported cpus
|
|
|
|
error if acpi is not supported by the system
|
|
error for unavailable device
|
|
error for unavailable module
|
|
|
|
defining an unknown state be careful to test every variable on unknown |
|
cooling policy
|
|
ac adapter status
|
|
whether the battery is present
|
|
technologie of the battery
|
|
because of kernel implementations separated in ACPI spec this is combined to battery_state be careful this is kernel definition of batteries states ! |
|
the unit of the battery capacity
|
|
states a disk can be in
|
|
use for checkACPI function return value!
|
|
current state of the lid
|
|
the current thermal mode modes used for active/passive cooling mode and for the devices' temperature state |
|
calculate cpu load
|
|
determine whether there is apm, acpi or nothing on your Computer
|
|
free data for calculating cpu time needs to be invoked, once the getCPULoad function is called to free memory. The getCPULoad may be called multiple times, when not using the func anymore call this one |
|
returns if the machine is on ac power or not apm + acpi
|
|
fills the given Battery struct with the current battery information for all found batteries supports acpi and apm
|
|
use this method to get amount of batteries in the system ACPI only!
|
|
get Information for only one battery
|
|
get number of cpus in system
|
|
get current cpu load
|
|
get number of fans in the system ACPI only!
|
|
get fan status
|
|
returns the current state of the lid
|
|
get processor speed be careful this method waits a second ... Function only available on i686 and x86_64 machines!
|
|
get all supported sleeping states mask out return value to evaluate supported states
|
|
get a thermal zone ACPI only!
|
|
get the number of thermal zones ACPI only!
|
|
get thermal zone state ACPI only!
|
|
get thermal zone temp ACPI only!
|
|
get throttling information (ACPI only) ACPI only!
|
|
get throttling info for one single cpu ACPI only!
|
|
get number of present batteries
|
|
sets the ACPI battery alarm for all batteries
ACPI only! |
|
set cooling mode
|
|
set the debug level. Values: 0-31 if library is compiled without -DPOWERSAVE_DEBUG variable this method has no effect. Define -D USE_SYSLOG to use the syslog daemon for debugging sum up the levels you want to see: e.g.: 7 -> error + warning + diag levels:
|
|
set thermal trippoints ACPI only!
|
|
set throttling percent ACPI only!
|
|
set throttling percent for single cpu ACPI only!
|
|
set throttling state on cpu ACPI only!
|