System monitor class. More...
#include <SystemMonitor.h>
Public Member Functions | |
SystemMonitor () | |
Class constructor. | |
virtual | ~SystemMonitor () |
Class destructor. | |
virtual void | setPowerDelays (int dim, int min, int off, int save, int down) |
Set power state change delays Sets the time after which various power events should happen. | |
virtual void | getPowerCounters (int *counters) |
Get power state counters. | |
virtual void | setKeyboardBrightness (int b) |
Set keypad maximal brightness. | |
Static Public Member Functions | |
static bool | initialize () |
Start system monitor. | |
static void | shutdown () |
Stop system monitor. | |
static SystemMonitor * | getMonitor () |
Get system monitor object. | |
Protected Member Functions | |
virtual bool | init () |
Start system monitor. | |
virtual void | close () |
Stop system monitor. | |
virtual void | onTimer () |
Process system data Process system data when the timer has fired. | |
virtual void | handlePower () |
System idle monitor. | |
virtual void | handleBattery () |
Handle battery data Handle battery information when the system monitor polling timer has been fired. | |
virtual void | handleTemperature () |
Handle temperature data Handle temperature information when the system monitor polling timer has been fired. | |
virtual void | handleLighting () |
Handle lighting data Handle lighting information when the system monitor polling timer has been fired. | |
Protected Attributes | |
int | displayDimDelay |
int | displayMinDelay |
int | displayOffDelay |
int | powerSaveDelay |
int | powerDownDelay |
int | batteryPollInterval |
int | tempPollInterval |
int | lightPollInterval |
int | keypadMaxBrightness |
unsigned int | powerStateCounter [NUM_POWER_STATES] |
Static Protected Attributes | |
static SystemMonitor * | monitor = NULL |
System monitor class.
Implements system monitor functionality. System monitor periodically polls system parameters such as the remaining battery capacity, amount of detected ambient light, internal temperature, and calls registered event listeners.
System monitor detects critical conditions and notifies registered listeners. System monitor tracks the level of ambient lighting and enables or disables keypad backlight when required.
System monitors also tracks device idle time and automatically cycles through power modes when the device remains idle.
SystemMonitor::SystemMonitor | ( | ) |
Class constructor.
Initializes the system monitor object. Local variables (displayDimDelay, displayOffDelay, batteryPollInterval, tempPollInterval, lightPollInterval, keypadMaxBrightness) are set to their default values.
Instead of invoking this constructor directly, the method initialize() should be used. It creates the instance of the class which can be later retrieved by invoking the getMonitor() method.
SystemMonitor::~SystemMonitor | ( | ) | [virtual] |
Class destructor.
Terminates the system monitor object.
void SystemMonitor::close | ( | ) | [protected, virtual] |
Stop system monitor.
Shuts down the system monitor.
SystemMonitor * SystemMonitor::getMonitor | ( | ) | [static] |
Get system monitor object.
void SystemMonitor::handlePower | ( | ) | [protected, virtual] |
System idle monitor.
System idle monitor function is called by the system monitor periodically to indicate that the system state remains idle.
Default behavior is to automatically cycle through a number of power states. When the displayDimDelay is elapsed, the display is dimmed. When the displayOffDelay is elapsed, the display is disabled completely
bool SystemMonitor::init | ( | ) | [protected, virtual] |
Start system monitor.
Starts the system monitor timer.
bool SystemMonitor::initialize | ( | ) | [static] |
Start system monitor.
This function initializes and starts the system monitor.
void SystemMonitor::setPowerDelays | ( | int | dim, | |
int | min, | |||
int | off, | |||
int | save, | |||
int | down | |||
) | [virtual] |
Set power state change delays Sets the time after which various power events should happen.
dim | Time to dim the display to half power | |
min | Time to dim the display to lowest setting | |
off | Time to turn off the display | |
save | Time the system should go to low-power sleep | |
down | Time to shut down the system |
void SystemMonitor::shutdown | ( | ) | [static] |
Stop system monitor.
This function shuts down the system monitor.
int SystemMonitor::batteryPollInterval [protected] |
Specifies the time interval in which the remaining battery capacity is queried, in seconds. Registered listeners are also called every time.
int SystemMonitor::displayDimDelay [protected] |
Specifies the time delay after which the display is dimmed to half power if the device remains idle, in seconds.
int SystemMonitor::displayMinDelay [protected] |
Specifies the time delay after which the display is dimmed to lowest setting if the device remains idle, in seconds.
int SystemMonitor::displayOffDelay [protected] |
Specifies the time delay after which the display is disabled if the device remains idle, in seconds.
int SystemMonitor::keypadMaxBrightness [protected] |
Specifies the maximum keypad brightness, in relative units (0..255).
int SystemMonitor::lightPollInterval [protected] |
Specifies the time interval in which the ambient lighting sensor is queried, in seconds. Registered listeners are also called every time.
SystemMonitor * SystemMonitor::monitor = NULL [static, protected] |
Holds the instance of this class.
int SystemMonitor::powerDownDelay [protected] |
Specifies the time delay after which the system shuts down if the device remains idle, in seconds.
int SystemMonitor::powerSaveDelay [protected] |
Specifies the time delay after which the system goes to low-power sleep if the device remains idle, in seconds.
unsigned int SystemMonitor::powerStateCounter[NUM_POWER_STATES] [protected] |
Map of power state counters
int SystemMonitor::tempPollInterval [protected] |
Specifies the time interval in which the internal temperature sensor is queried, in seconds. Registered listeners are also called every time.