You Are Here:

Community: Developer Discussion Boards

#1 Old sysinfo.battery() problem - 2008-09-22, 20:42

Join Date: Dec 2007
Posts: 1
jjgarsal
Offline
Registered User
I am trying to test a program using the battery level function. I have to do something if the battery level change, then I have to be checking the battery level.
I start the program with a while structure and I can't to detect when the sysinfo.battery() changes by 1 unit (of 100 units). Suddenly the change is by example from 100 to 85 or from 71 to 57 and the program stop.

The code looks like:

import sysinfo

batteryLevel= sysinfo.battery()

while batteryLevel > 97:
.......
if sysinfo.battery() < batteryLevel:
batteryLevel = sysinfo.battery()
print batteryLevel
doSomething()
...............

Why it is happening? or what can I do to know when the battery level change in one unit?

Thanks for your help.

PS: The code have tabs but in the message are not published.
Reply With Quote

#2 Old Re: sysinfo.battery() problem - 2008-09-22, 21:00

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Hi,

I don't think that's possible. See 100 (the battery level for full) divided by 7 (the number of bars of the battery indicator) is 14.285. Python probably rounds it off to 14 or 15. 100-15 is 85, 85-14 is 71 etc. The point is that using sysinfo you can only display the battery level on a 0-7 scale rather than a 0-100 scale.

But this is just a guess. I may be wrong.

PS. When posting code, use the code tags (the # button that you see in the buttons area when making a post). That keeps indentation.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with eglSwapBuffers and heap corruption greatape Symbian Media (Graphics & Sounds) 2 2007-05-24 04:35
netcards - Problem with opening adapter kernj Symbian Tools & SDKs 5 2007-01-10 09:56
WAP service problem on Apache bigg_o Browsing and Mark-ups 3 2005-04-17 17:05
Problem: S60 SDK for CW in PC with .NET anttij Carbide.c++ IDE and plug-ins 1 2005-02-28 12:36
wireless problem sash_mca General Browsing 0 2003-06-06 12:34

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia