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;

Inherits from

Constructor & Destructor Documentation

~CHWRMPower()

IMPORT_C~CHWRMPower()

C++ Destructor

Member Functions Documentation

ConstructL()

voidConstructL()[private]

Symbian 2nd phase constructor can leave.

GetBaseTimeIntervalL(TInt &)

IMPORT_C voidGetBaseTimeIntervalL(TInt &aBaseTimeInterval)

Get the Base Time interval used by the plugin

Parameters

TInt & aBaseTimeIntervalThe Base Time Interval is returned in this parameter.

GetBatteryInfo(TRequestStatus &, TBatteryConsumptionData &)

IMPORT_C voidGetBatteryInfo(TRequestStatus &aStatus,
TBatteryConsumptionData &aBatteryConsumptionData
)

Asynch

Get the Battery Info

CHWRMPower::TBatteryConsumptionData

Parameters

TRequestStatus & aStatusThis will be completed when the data are ready or an error occurs.
TBatteryConsumptionData & aBatteryConsumptionDataThe nominal battery info is returned in this parameter. Valid only when aStatus.Int() == KErrNone

GetBatteryVoltageInfo(TRequestStatus &, TBatteryVoltageData &)

IMPORT_C voidGetBatteryVoltageInfo(TRequestStatus &aStatus,
TBatteryVoltageData &aBatteryVoltageData
)

Asynch

Get the Battery Voltage Info

CHWRMPower::TBatteryVoltageData

Parameters

TRequestStatus & aStatusThis will be completed when the data are ready or an error occurs.
TBatteryVoltageData & aBatteryVoltageDataThe nominal battery info is returned in this parameter. Valid only when aStatus.Int() == KErrNone

NewL()

IMPORT_C CHWRMPower *NewL()[static]

Two-phased constructor for creating a CHWRMPower client.

NewLC()

IMPORT_C CHWRMPower *NewLC()[static]

Two-phased constructor for creating a CHWRMPower client. Leaves instance to CleanupStack.

SetPowerReportObserver(MHWRMBatteryPowerObserver *)

IMPORT_C TIntSetPowerReportObserver(MHWRMBatteryPowerObserver *aPowerReportCallback)

Parameters

MHWRMBatteryPowerObserver * aPowerReportCallback

StartAveragePowerReporting(TRequestStatus &, const TUint &)

IMPORT_C TIntStartAveragePowerReporting(TRequestStatus &aStatus,
const TUint &aInterval
)

Post Start request to HWRM Server to start battery Power measurements

Parameters

TRequestStatus & aStatusThis will be completed when measurements start or an error occurs.
const TUint & aInterval

StopAveragePowerReportingL()

IMPORT_C voidStopAveragePowerReportingL()

Synchronous

Post stop request to HWRM Server to stop battery power measurements

success/failure for stopping measurements.

Member Data Documentation

CHWRMPowerImpl * iPowerImpl

CHWRMPowerImpl *iPowerImpl[private]