#include <hwrmpower.h>
class MHWRMBatteryPowerObserver |
Public Member Functions | |
---|---|
pure virtual void | PowerMeasurement(TInt, CHWRMPower::TBatteryPowerMeasurementData &) |
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); } }
void | PowerMeasurement | ( | TInt | aErr, |
CHWRMPower::TBatteryPowerMeasurementData & | aMeasurement | |||
) | [pure virtual] |
Called when a Power(Voltage and Current) consumption measurement value is received.
Parameters | |
---|---|
aErr | Error code. |
aMeasurement | The Average Power value calculated by the plugin. Valid only when aErr == KErrNone. |