×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    224

    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.
    Last edited by kalgi; 2009-01-29 at 07:30.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Want to know about Battery Status

    search in wiki you will get the code. http://wiki.forum.nokia.com/index.ph...ith_CTelephony

  3. #3
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: Want to know about Battery Status


  4. #4
    Registered User
    Join Date
    Jan 2006
    Posts
    279

    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;
    }
    Is this compatible with all devices?

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Want to know about Battery Status

    not sure about pre v9.x devices. But yes it works in all 3.x devices.

  6. #6
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    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 Percentage ??

    Many thanks in advance

  7. #7
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Want to know about Battery Status

    Quote Originally Posted by ashraf fawzy View Post
    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 Percentage ??

    Many thanks in advance
    Sure there is, and A.A.M already gave the link in his post, it's the first one, pointing to CTelephony::GetBatteryInfo()

  8. #8
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Want to know about Battery Status

    Quote Originally Posted by pavarang View Post
    Sure there is, and A.A.M already gave the link in his post, it's the first one, pointing to CTelephony::GetBatteryInfo()
    no that also give you levels.

  9. #9
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Want to know about Battery Status

    Quote Originally Posted by skumar_rao View Post
    no that also give you levels.
    It gives you levels, but in percentage, as asked: 14,28,42,57,71,85,100....
    look also at this post:
    http://discussion.forum.nokia.com/fo...on-on-Symbians

    regards,
    pg

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    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.

  11. #11
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    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.

  12. #12
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Want to know about Battery Status

    AFAIK no public API's are available to get that much accurate battery status.

  13. #13
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    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
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  14. #14
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Want to know about Battery Status

    Someone else posed the same question on the russian forum:
    http://www.developer.nokia.com/Commu...9-%D0%B2-Nokia
    and the answer was CHWRMPower for newer devices (no 3rd, see #7)
    regards
    pg
    Last edited by pavarang; 2011-10-29 at 21:02. Reason: typo error on CHWRMPower

  15. #15
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    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;
    Last edited by wizard_hu_; 2011-10-31 at 10:41. Reason: TRequestStatus& status, '&' removed

Similar Threads

  1. Battery status as events
    By ManiInn in forum Symbian
    Replies: 5
    Last Post: 2008-09-02, 07:09
  2. Monitoring battery status
    By patrickfrei in forum Symbian
    Replies: 6
    Last Post: 2007-11-19, 14:29
  3. How can i solve this error?
    By symbian-newbie in forum Symbian
    Replies: 6
    Last Post: 2006-05-23, 05:33
  4. Getting started with Carbide.vs -- running the app
    By ET3D in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2005-11-23, 17:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×