#include <stdio.h>
#include <syslog.h>
#include <stdint.h>
Go to the source code of this file.
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 |