Derive a class from one or more of the observer interfaces above, and implement the appropriate observer functions.
The following code snippet demonstrates how to derive a class and implement the appropriate functions.
#include HWRMPower.h Class CPowerApp : public CBase, public MHWRMBatteryPowerObserver, public MHWRMBatteryChargingStatusObserver { public: CPowerApp(); //constructor ~CPowerApp(); //destructor void ConstructL(); static CPowerApp* NewL(); // from MHWRMBatteryPowerObserver virtual void PowerMeasurement( TInt aErr, TInt aMeasurement ); // from MHWRMBatteryChargingStatusObserver virtual void ChargingStatusChange( Tint aErrCode, CHWRMPower::TBatteryChargingStatus aChrgStatus ); private: CHWRMPower* iPower; }; //Implementation of MHWRMBatteryPowerObserver::PowerMeasurement() void CPowerApp::PowerMeasurement( TInt aErr, TInt aMeasurement ) { if( aErrorCode == KErrNone ) { INFO_PRINTF2( _L( "INFO: Power Consumption Measurement Received, measurement=%d" ), aMeasurement ); } else { INFO_PRINTF2( _L( "INFO: Power Consumption Measurement Error, error=%d" ), aErr ); } }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.