Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor kalgi's Avatar
    Join Date
    Jan 2009
    Posts
    224
    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
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    search in wiki you will get the code. http://wiki.forum.nokia.com/index.ph...ith_CTelephony

  3. #3
    Nokia Developer Moderator A.A.M.'s Avatar
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,308

  4. #4
    Registered User microsoft2's Avatar
    Join Date
    Jan 2006
    Posts
    279
    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
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    not sure about pre v9.x devices. But yes it works in all 3.x devices.

  6. #6
    Registered User ashraf fawzy's Avatar
    Join Date
    May 2010
    Location
    Egypt
    Posts
    416
    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
    Nokia Developer Champion pavarang's Avatar
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    576
    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
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    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
    Nokia Developer Champion pavarang's Avatar
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    576
    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 wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    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 ashraf fawzy's Avatar
    Join Date
    May 2010
    Location
    Egypt
    Posts
    416
    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
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    AFAIK no public API's are available to get that much accurate battery status.

  13. #13
    Registered User ashraf fawzy's Avatar
    Join Date
    May 2010
    Location
    Egypt
    Posts
    416
    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
    How to protect application copyright information on Symbian: http://www.developer.nokia.com/Community/Wiki/How_to_protect_application_copyright_information_on_Symbian

  14. #14
    Nokia Developer Champion pavarang's Avatar
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    576
    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
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    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 C++
    Replies: 5
    Last Post: 2008-09-02, 07:09
  2. Battery Status Protocol
    By giuseppeottelli in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2007-12-07, 17:50
  3. Monitoring battery status
    By patrickfrei in forum Symbian C++
    Replies: 6
    Last Post: 2007-11-19, 14:29
  4. How can i solve this error?
    By symbian-newbie in forum Symbian C++
    Replies: 6
    Last Post: 2006-05-23, 05:33
  5. 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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved