diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-F85B6D62-AD3B-5D18-990C-0884BF834EA1.dita --- a/Symbian3/PDK/Source/GUID-F85B6D62-AD3B-5D18-990C-0884BF834EA1.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-F85B6D62-AD3B-5D18-990C-0884BF834EA1.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,26 +1,26 @@ - - - - - -Phone Power Status TutorialThis section describes how to retrieve the power status using multimode phone sub-sessions. Test if the power information can be obtained using RMobilePhone::GetBatteryCaps(). Power information capabilities are described in an RMobilePhone::TMobilePhoneBatteryCaps. Get the power information using RMobilePhone::GetBatteryInfo(). Power status and charge level is returned in an RMobilePhone::TMobilePhoneBatteryInfoV1 object. Use RMobilePhone::NotifyBatteryInfoChange() to get the notification of any changes to the power information.

The function should return the battery power level status.

Power status example

The following code checks if the power information can be obtained, and if so, gets the charge level in a percentage value of the battery, if the phone is currently being powered by batteries.

The code assumes iMobilePhone is an RMobilePhone object.

TUint32 batteryCaps; -User::LeaveIfError(iMobilePhone.GetBatteryCaps(batteryCaps)); - -TInt charge = -1; -if (batteryCaps & RMobilePhone::KCapsGetBatteryInfo) - { - RMobilePhone::TMobilePhoneBatteryInfoV1 mobilePhoneBatteryInfo; - TRequestStatus status; - iMobilePhone.GetBatteryInfo(status, mobilePhoneBatteryInfo); - User::WaitForRequest(status); - User::LeaveIfError(status.Int()); - if (mobilePhoneBatteryInfo.iStatus == RMobilePhone::EPoweredByBattery) - charge = mobilePhoneBatteryInfo.iChargeLevel; - } + + + + + +Phone Power Status TutorialThis section describes how to retrieve the power status using multimode phone sub-sessions. Test if the power information can be obtained using RMobilePhone::GetBatteryCaps(). Power information capabilities are described in an RMobilePhone::TMobilePhoneBatteryCaps. Get the power information using RMobilePhone::GetBatteryInfo(). Power status and charge level is returned in an RMobilePhone::TMobilePhoneBatteryInfoV1 object. Use RMobilePhone::NotifyBatteryInfoChange() to get the notification of any changes to the power information.

The function should return the battery power level status.

Power status example

The following code checks if the power information can be obtained, and if so, gets the charge level in a percentage value of the battery, if the phone is currently being powered by batteries.

The code assumes iMobilePhone is an RMobilePhone object.

TUint32 batteryCaps; +User::LeaveIfError(iMobilePhone.GetBatteryCaps(batteryCaps)); + +TInt charge = -1; +if (batteryCaps & RMobilePhone::KCapsGetBatteryInfo) + { + RMobilePhone::TMobilePhoneBatteryInfoV1 mobilePhoneBatteryInfo; + TRequestStatus status; + iMobilePhone.GetBatteryInfo(status, mobilePhoneBatteryInfo); + User::WaitForRequest(status); + User::LeaveIfError(status.Int()); + if (mobilePhoneBatteryInfo.iStatus == RMobilePhone::EPoweredByBattery) + charge = mobilePhoneBatteryInfo.iChargeLevel; + }
\ No newline at end of file