Thursday, January 18, 2007

Retrieving battery strength on S60 2nd Edition

below is the code to Get the battery info on Device.

/*

Location: saclient.h
Link against: sysagt.lib

const TInt KUidBatteryBarsValue = 0x100052D3;
const TUid KUidBatteryBars ={KUidBatteryBarsValue};

enum TSABatteryBars
{
ESABBars_0,
ESABBars_1,
ESABBars_2,
ESABBars_3,
ESABBars_4,
ESABBars_5,
ESABBars_6,
ESABBars_7
};
*/

RSystemAgent systemAgent;
User::LeaveIfError(systemAgent.Connect());
TInt strength = systemAgent.GetState(KUidBatteryBarsValue);

// strength will be of type TSABatteryBars;

No comments:

stats counter