CHWRMPower Class Reference
class CHWRMPower : public CBase |
HW Resource Manager Power API is a library API providing the ability to request detailed information regarding the battery capacity, voltage and current consumption.
The API consists of the classes CHWRMPower, MHWRMBatteryConsumptionObserver and MHWRMBatteryVoltageObserver. If the client requires periodical measurements of the Average Voltage and/or Average Consumption, it should also provide callback pointer of the MHWRMBatteryConsumptionObserver and/or MHWRMBatteryVoltageObserver implementing class for the NewL() method.
Usage:
#include <hwrmpower.h>
// A CHWRMPower instance can be created by using NewL() or NewLC() methods.
// Periodical measurements are required so callbacks are provided. Assume
// the calling object implements both interfaces.
CHWRMPower* power = CHWRMPower::NewL(this, this);
// Get battery info.
TRequestStatus& status;
TBatteryConsumptionData batteryConsumptionData;
power->GetBatteryInfo(status, batteryConsumptionData);
User::WaitForRequest(status);
User::LeaveIfError(status.Int());
// Start receiving periodical voltage measurements.
TRequestStatus& statusStart;
TIntervalMultiple intervalMultiple = EThreeTimesBaseTimeInterval;
power->StartAverageVoltageReporting(statusStart, intervalMultiple);
User::WaitForRequest(statusStart);
User::LeaveIfError(statusStart.Int());
// Measurements are being when the ProcessVoltageMeasurement() method
// of the MHWRMBatteryVoltageObserver interface is called.
// Stop receiving measurements when done
power->StopAverageVoltageReportingL();
// To clean up, delete the created object:
delete power;
Nested Classes and Structures
Constructor & Destructor Documentation
Member Functions Documentation
ConstructL()
void | ConstructL | ( | ) | [private] |
Symbian 2nd phase constructor can leave.
GetBaseTimeIntervalL(TInt &)
IMPORT_C void | GetBaseTimeIntervalL | ( | TInt & | aBaseTimeInterval | ) | |
Get the Base Time interval used by the plugin
Parameters
TInt & aBaseTimeInterval | The Base Time Interval is returned in this parameter. |
GetBatteryInfo(TRequestStatus &, TBatteryConsumptionData &)
Parameters
TRequestStatus & aStatus | This will be completed when the data are ready or an error occurs. |
TBatteryConsumptionData & aBatteryConsumptionData | The nominal battery info is returned in this parameter. Valid only when aStatus.Int() == KErrNone |
GetBatteryVoltageInfo(TRequestStatus &, TBatteryVoltageData &)
Parameters
TRequestStatus & aStatus | This will be completed when the data are ready or an error occurs. |
TBatteryVoltageData & aBatteryVoltageData | The nominal battery info is returned in this parameter. Valid only when aStatus.Int() == KErrNone |
NewL()
Two-phased constructor for creating a CHWRMPower client.
SetPowerReportObserver(MHWRMBatteryPowerObserver *)
StartAveragePowerReporting(TRequestStatus &, const TUint &)
Post Start request to HWRM Server to start battery Power measurements
Parameters
TRequestStatus & aStatus | This will be completed when measurements start or an error occurs. |
const TUint & aInterval | |
StopAveragePowerReportingL()
IMPORT_C void | StopAveragePowerReportingL | ( | ) | |
Synchronous
Post stop request to HWRM Server to stop battery power measurements
success/failure for stopping measurements.
Member Data Documentation
CHWRMPowerImpl * iPowerImpl
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.