IPowerAware

class

The Power Aware Abstract interface, for clases that handle power events.

Classes that implements this interface canreceive power related events in from of handler methods. This interface define the 3 handler methods:

  1. onSystemPowerOnReset : Called reset or first power on
  2. onSystemEnterSleep : Called just before system enter sleep mode
  3. onSystemWakeFromSleep : Called right after the system has woken from sleep
  4. onSystemBatteryLow : Called when battery is critically low

Inheriting this interface is not enough to active the functionality. You must remember to add your object instance to the IPowerManagement instance, that can be obtained from the static IApplicationContext class.

Public Functions

virtual void mono::power::IPowerAware::onSystemPowerOnReset()

Called when the system powers on after a reset.

You can override this method. It gets called right after the system power on for the first time, or after a reset condition.

Use this method to setup / initialize components and data structures. It is only called once for each system reset.

virtual void mono::power::IPowerAware::onSystemEnterSleep()

Called right before the MCU goes into sleep mode.

You can override this method to get sleep notifications. Before the CPU stop executing intructions and goes into low power sleep mode, this method gets called.

Use this method to prepare your data or MCU components for sleep. Help preserve battery by power down any peripheral, that is not needed during sleep.

This method can be called many times during your apps life cycle. (That is between resets.) After each sleep period, when the MCU wakes the onSystemWakeFromSleep is guaranteed to be called.

virtual void mono::power::IPowerAware::onSystemWakeFromSleep()

Override to get notified when system wakes from sleep.

You can override this method to get wake-up notifications. When the CPU starts executing intructions and the power system has powered up all peripherals - this method gets called.

Use this method to setup your app to resume after sleep mode.

This method can be called many times during your apps life cycle. (That is between resets.)

virtual void mono::power::IPowerAware::onSystemBatteryLow()

Override to get notified when the battery voltage reaches a critical level.

You can override this method to get battery low notifications. When this methods gets called, you have some time to finish critical tasks. That might writing state to file system or transfer data over the network.

Depending on the health of the battery, the time between this notification and the actual system enforced power off, might vary.

In contrast to the other power aware methods this is only called once in the application life cycle. After the enforced power off, when the battery is charged, the system will automatically reset.

Public Members

IPowerAware *mono::power::IPowerAware::_pwrawr_nextPowerAware

Next pointer in the power awareness object queue. The IPowerManagement uses this to traverse all power aware objects.

IPowerAware *mono::power::IPowerAware::_pwrawr_previousPowerAware

Previous pointer in the power awareness queue.