Want to know about Battery Status
I m work in carbide c++ 2.0
I want to know about the battery status,if battery is 10%charged then user get the alert as ringtone as he set,then 20% & so on...
will u give me the code or link to help me out of this problem is possible
i m waiting....
Thank u.
Re: Want to know about Battery Status
search in wiki you will get the code. [url]http://wiki.forum.nokia.com/index.php/Monitoring_battery_status_with_CTelephony[/url]
Re: Want to know about Battery Status
Check these links:
- [URL="http://wiki.forum.nokia.com/index.php/Monitoring_battery_status_with_CTelephony"]Monitoring battery status with CTelephony[/URL]
- [URL="http://wiki.forum.nokia.com/index.php/Check_battery_status"]Check battery status[/URL]
Re: Want to know about Battery Status
Hmm, what I do is
[CODE]
#include <hwrmpowerstatesdkpskeys.h>
static TInt GetBatteryLevel()
{
TInt batLevel = KErrNotFound;
TInt err = 0;
RProperty batProp;
err = batProp.Get( KPSUidHWRMPowerState, KHWRMBatteryLevel, batLevel );
LOG_FORMAT2( _L( "Batery: %d (%d)" ), batLevel, err );
return batLevel;
}
[/CODE]
Is this compatible with all devices?
Re: Want to know about Battery Status
not sure about pre v9.x devices. But yes it works in all 3.x devices.
Re: Want to know about Battery Status
Hi skumar_rao, this method return the battery level with using 1:7 degrees , is there such simple way to return the battery level but in [B]Percentage[/B] ??
Many thanks in advance
Re: Want to know about Battery Status
[QUOTE=ashraf fawzy;812491]Hi skumar_rao, this method return the battery level with using 1:7 degrees , is there such simple way to return the battery level but in [B]Percentage[/B] ??
Many thanks in advance[/QUOTE]
Sure there is, and A.A.M already gave the link in his post, it's the first one, pointing to CTelephony::GetBatteryInfo()
Re: Want to know about Battery Status
[QUOTE=pavarang;813002]Sure there is, and A.A.M already gave the link in his post, it's the first one, pointing to CTelephony::GetBatteryInfo()[/QUOTE] no that also give you levels.
Re: Want to know about Battery Status
[QUOTE=skumar_rao;813014]no that also give you levels.[/QUOTE]
It gives you levels, but in percentage, as asked: 14,28,42,57,71,85,100....
look also at this post:
[url]http://discussion.forum.nokia.com/forum/showthread.php?104843-Battery-Information-on-Symbians[/url]
regards,
pg
Re: Want to know about Battery Status
Read between the lines (or how to say). It is pretty sure that Ashraf Fawzy is able to divide two numbers (1/7, 2/7, ... 7/7), and multiply them by 100 to have a percentage (100/7 = ~14, 200/7 = ~28, ... 700/7=100). He needs a finer resolution, that is what this thread is about.
Re: Want to know about Battery Status
Hello Wizard_hu_,
Is there a way to get battery percentage / level after reaching (1 Bar = 14.28%)?
I noticed that Nokia Battery Monitor application in OVI Store can get the percentage down to 3%.
I'm using CTelephony but in only notify me down to 14.28%, down that it notify me, but with the same value which is 14.28
Is there any function that is used on Symbian^3 devices that achieve what I want?
Best regards.
Re: Want to know about Battery Status
AFAIK no public API's are available to get that much accurate battery status.
Re: Want to know about Battery Status
Thank you savaj for your answer,
So Nokia keeps some of juicy API's to itself to use it in its applications as Battery Monitor :(
Re: Want to know about Battery Status
Someone else posed the same question on the russian forum:
[url]http://www.developer.nokia.com/Community/Discussion/showthread.php?219716-%D0%9E%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5-%D0%B7%D0%B0%D1%80%D1%8F%D0%B4%D0%B0-%D0%B1%D0%B0%D1%82%D0%B0%D1%80%D0%B5%D0%B9-%D0%B2-Nokia[/url]
and the answer was CHWRMPower for newer devices (no 3rd, see #7)
regards
pg
Re: Want to know about Battery Status
Hmm.. CHWRMPower::GetBatteryInfo() might do your job at-least in Symbian^3.
Check how much accurate battery status will return following code.
[CODE]
TInt remainingBattery;
TRequestStatus status;
TBatteryConsuptionData batterydata;
iPower->GetBatteryInfo( status, batterydata );
User::WaitForRequest( status );
remainingBattery = batterydata.iRemainingPercentageCapacity;
[/CODE]