Hi,
I am coding an application that keeps track of the battery level (KHWRMBatteryLevel) and logs every event for the change in the battery level using P&S API.
The problem is... the application is getting notified when the battery level goes down(e.g from 5 to 4). But when the charger is plugged in and the battery level increases(e.g. from 4 to 5), there is no notification(i.e. no logs). Interestingly, the app gets notification immediately after the charger is disconnected.
How to get notification while charging?
Kindly clarify.
The code is as follows:
---------------------------------------------------------
RProperty batProp;
TInt batLevel;
batProp.Attach(KPSUidHWRMPowerState, KHWRMBatteryLevel, batLevel);
batProp.Get(batLevel);
batProp.Subscribe(myStatus);
...
...
//The intention is to capture and log every "battery level change" event.
void MyClass::RunL()
{
batProp.Get(batLevel);
WRITELOG("battery level changed: %d", batLevel);
batProp.Subscribe(myStatus); // resubscribe
}
------------------
Logs:
battery level changed: 3
//after a while
battery level changed: 2
//after a while
battery level changed: 1
//charger plugged in
// no notification for a long time when the battery is charging and the level is actually increasing...
//once the charger is disconnected
battery level changed: 4

Reply With Quote



