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 );
         }
    }