BatteryStatus
From Pointui
Provides access to battery information. Each instance of BatteryStatus that is declared will automatically fetch the latest battery information at the time it’s created, so an initial call to Refresh() is not required.
Contents |
Methods
int GetPercent()
Returns an integer between 0 and 100 representing the percentage of charge available in the main battery.
EXAMPLE
BatteryStatus status; int percent; percent = status.GetPercent();
String GetACLineStatus()
Returns a String containing the status of the AC Line (is the device plugged into a cradle or power).
RETURN VALUES
- “Offline” – the device is not running on AC Power
- “Online” – the device is running on AC Power
- “BackupPower” – the device is running on it’s backup battery
- “Unknown” – well, I guess it just doesn’t know
EXAMPLE
BatteryStatus status; String acStatus; acStatus = status.GetACLineStatus();
void Refresh()
void Refresh(bool force)
Fetches the latest battery status information from the device. A single instance of a BatteryStatus object can be reused by calling Refresh() each time up-to-date information is required. If the force parameter is supplied then the device driver is contacted to ensure the very latest information is fetched from the hardware, otherwise a cached value that may be a few seconds out of date is returned.
