MHWRMBatteryPowerObserver Class Reference

#include <hwrmpower.h>

class MHWRMBatteryPowerObserver
Public Member Functions
pure virtual voidPowerMeasurement(TInt, CHWRMPower::TBatteryPowerMeasurementData &)

Detailed Description

A callback interface for power measurements reporting.

If the client requires periodical measurements of the Average Power, it needs to derive a class from the MHWRMBatteryPowerObserver interface and implement the PowerMeasurement() method.

A callback object header example:

 #include <hwrmpower.h> // Link against HWRMPowerClient.lib.

 class CTest : public CBase, 
               public MHWRMBatteryPowerObserver    
        void ConstructL();
        static CTest* NewL();
        // from MHWRMBatteryPowerObserver
        virtual void PowerMeasurement(TInt aErr, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement);

        CHWRMPower* iPower;

A callback method implementation example:

 void CTest::PowerMeasurement(TInt aErr, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement);
  	 if (aErrorCode == KErrNone)
		INFO_PRINTF2(_L("INFO: Power Measurement Received, averageVolatge=%d, averageCurrent=%d"),aMeasurement.iAverageVoltage, aMeasurement.iAverageCurrent);
		INFO_PRINTF2(_L("INFO: Power Measurement Measurement Error, error=%d"),aErr);

Member Function Documentation

PowerMeasurement ( TInt, CHWRMPower::TBatteryPowerMeasurementData & )

CHWRMPower::TBatteryPowerMeasurementData &aMeasurement
)[pure virtual]

Called when a Power(Voltage and Current) consumption measurement value is received.

aErrError code.
aMeasurementThe Average Power value calculated by the plugin. Valid only when aErr == KErrNone.