EPOC   SDK Home Glossary Indexes Previous Next Up

MBasicGsmPhoneBatteryAndPower class


Contents


MBasicGsmPhoneBatteryAndPower class — Protocol for accessing battery and power capabilities

Section Contents


Overview

Derivation

MBasicGsmPhoneBatteryAndPower

Mixin: interface for accessing a phone’s battery and power information.

Defined in

etelbgsm.h

Link against

gsmbas.lib

Description

This class defines the protocol for accessing phone battery and power information.


Construction and destruction


MBasicGsmPhoneBatteryAndPower() — Protected default C++ constructor

protected: MBasicGsmPhoneBatteryAndPower()

Description

The default C++ constructor is protected, which prevents objects of this class from being constructed. This class is intended only as an abstract base for other classes.


Battery information functions


GetBatteryPowerCaps() — Get phone’s battery and power capabilities

virtual TInt GetBatteryPowerCaps(TBatteryAndPowerCapsFlags& aCaps) const=0;

Description

This function allows clients to determine whether a phone has the ability to retrieve battery and power information.

Arguments

TBatteryAndPowerCapsFlags& aCaps

On return, contains the phone’s power information retrieval capabilities.

Return value

TInt

An error code: see System error codes.


GetBatteryInfo() — Get battery information — synchronous

virtual TInt GetBatteryInfo(TBatteryInfo& aBatteryInfo) const=0;

Description

This synchronous function retrieves information about the phone’s current power supply and charge level.

Arguments

TBatteryInfo& aBatteryInfo

On return, contains the current status of the phone power supply and battery charge.

Return value

TInt

An error code: see System error codes.


GetBatteryInfo() — Get battery information — asynchronous

virtual void GetBatteryInfo(TRequestStatus& aStatus, TBatteryInfo& aBatteryInfo)=0;

Description

This asynchronous function retrieves information about the phone’s current power supply and charge level.

Arguments

TRequestStatus& aStatus

A variable that indicates the completion status of the request.

TBatteryInfo& aBatteryInfo

On request completion, contains the current status of the phone power supply and battery charge.


GetBatteryInfoCancel() — Cancel request for battery information

virtual void GetBatteryInfoCancel() const=0;

Description

This function cancels an outstanding “Get battery information” request, placed using the asynchronous variant of the GetBatteryInfo() function.


BatteryInfoNotification() — Notification of a change to battery information

virtual void BatteryInfoNotification(TRequestStatus& aStatus,TBatteryInfo& aBatteryInfo)=0;

Description

This function requests notification of a change in the phone’s current power supply or charge level.

Arguments

TRequestStatus& aStatus

A variable that indicates the completion status of the request.

TBatteryInfo& aBatteryInfo

On request completion, contains the new power supply and charge level information.


BatteryInfoNotificationCancel() — Cancel notification of a change to battery information

virtual void BatteryInfoNotificationCancel() const=0;

Description

This function cancels an outstanding notification request to receive battery change information, placed with the BatteryInfoNotification() function.


Enumerations


TBatteryPowerCaps enum — Battery capabilities flags

KCapsBatteryInfoAvailable

Indicates that battery information is available.

KCapsBatteryInfoUpdatesAvailable

Indicates that asynchronous battery change notifications are supported.


TBatteryStatus enum — Battery status flags

EPoweredByBattery

The phone is currently powered by a battery.

EBatteryConnectedButExternallyPowered

A battery is connected, but the phone is externally powered.

ENoBatteryConnected

No battery is connected.

EPowerFault

Power fault.


Struct


TBatteryAndPowerCapsFlags struct — Battery and power capabilities

TUint iBatteryInfoCaps

A bitmask of the TBatteryPowerCaps constants.


TBatteryInfo struct — Battery information

TBatteryStatus iStatus

The power and battery status.

TUint iChargeLevel

The battery charge level (as a percentage).

EPOC       SDK Home Glossary Indexes Previous Next Up