This tutorial explains how to use the Power API of the HWRM.
Power API methods can be used by constructing an instance of CHWRMPower
and calling its functions.
However, to use its full functionality write a class which implements
one or more of the observer interfaces described in the following
table. Then, construct an instance of CHWRMPower
and provide it with pointers to observers.
Interface | Notification | Method to override |
---|---|---|
Average battery voltage and current consumption |
||
MHWRMBatteryChargingStatusObserver |
Charging status |
|
MHWRMBatteryChargingCurrentObserver |
Average charging current |
|
MHWRMBatteryFullChargingTimeObserver |
Remaining charging time |
For example, if the application requires periodic measurements
of average battery voltage and current consumption, it must implement MHWRMBatteryPowerObserver
and instantiate a CHWRMPower
object using the CHWRMPower::NewL(NULL, MHWRMBatteryPowerObserver
*)
method.
Note: The battery charging observers
cannot be passed to CHWRMPower
using a NewL()
function.
Call the dedicated function, CHRMPower::SetBatteryChargingObserver()
.
Derive a class and implement the appropriate observer functions.
Create a power client
using CHWRMPower::NewL()
or NewLC()
.
You can retrieve the battery voltage or consumption information.
Call CHRMPower::SetBatteryChargingObserver()
, if necessary.
Start receiving notification using the appropriate start function(s).
Stop receiving notification using the appropriate stop function(s).
Note: If the notification period exceeds the maximum reporting period, set when the HWRM server starts, notification is cancelled.