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:

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

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

    private:
        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);
		}
	 else
		{
		INFO_PRINTF2(_L("INFO: Power Measurement Measurement Error, error=%d"),aErr);
		}
    }

Member Function Documentation

PowerMeasurement ( TInt, CHWRMPower::TBatteryPowerMeasurementData & )

voidPowerMeasurement(TIntaErr,
CHWRMPower::TBatteryPowerMeasurementData &aMeasurement
)[pure virtual]

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

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