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 [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]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 [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]CHWRMPower and provide it with pointers to observers.

Interface Notification Method to override

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]MHWRMBatteryPowerObserver

Average battery voltage and current consumption

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]PowerMeasurement

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]MHWRMBatteryChargingStatusObserver

Charging status

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]ChargingStatusChange

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]MHWRMBatteryChargingCurrentObserver

Average charging current

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]AverageChargingCurrentChange

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]MHWRMBatteryFullChargingTimeObserver

Remaining charging time

[[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]BatteryFullChargingTimeChange

For example, if the application requires periodic measurements of average battery voltage and current consumption, it must implement [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]MHWRMBatteryPowerObserver and instantiate a [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]CHWRMPower object using the [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]CHWRMPower::NewL(NULL, MHWRMBatteryPowerObserver *) method.

Note: The battery charging observers cannot be passed to [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]CHWRMPower using a [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]NewL() function. Call the dedicated function, [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CHWRMPower']]]CHRMPower::SetBatteryChargingObserver().

Related concepts