--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/PDK/Source/GUID-047E3462-F806-4C54-9DC5-6B78907CA949.dita Fri Jan 22 18:26:19 2010 +0000
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License
+"Eclipse Public License v1.0" which accompanies this distribution,
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+ Nokia Corporation - initial contribution.
+Contributors:
+-->
+<!DOCTYPE task
+ PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
+<task id="GUID-047E3462-F806-4C54-9DC5-6B78907CA949" xml:lang="en"><title>Derive
+a class and implement the appropriate observer functions</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
+<context> <p>Derive a class from one or more of the observer interfaces
+above, and implement the appropriate observer functions.</p><p>The following
+code snippet demonstrates how to derive a class and implement the appropriate
+functions.</p><codeblock id="GUID-FF4BD289-9ECC-5E01-A38C-3E428817883E" xml:space="preserve">#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 );
+ }
+ }</codeblock></context>
+</taskbody></task>
\ No newline at end of file