diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-047E3462-F806-4C54-9DC5-6B78907CA949.dita --- a/Symbian3/PDK/Source/GUID-047E3462-F806-4C54-9DC5-6B78907CA949.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-047E3462-F806-4C54-9DC5-6B78907CA949.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,55 +1,55 @@ - - - - - -Derive -a class and implement the appropriate observer functions -

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 ); - } - }
+ + + + + +Derive +a class and implement the appropriate observer functions +

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 ); + } + }
\ No newline at end of file