Power API Tutorial

This tutorial explains how to use the Power API of the HWRM.

Introduction

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

MHWRMBatteryPowerObserver

Average battery voltage and current consumption

PowerMeasurement

MHWRMBatteryChargingStatusObserver

Charging status

ChargingStatusChange

MHWRMBatteryChargingCurrentObserver

Average charging current

AverageChargingCurrentChange

MHWRMBatteryFullChargingTimeObserver

Remaining charging time

BatteryFullChargingTimeChange

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().

Related concepts