# Thread: Battery Information on Symbians

1. ## Battery Information on Symbians

Hello to all,

I am getting the battery information via the call to CTelephony::GetBatteryInfo()

What I get as a result is some "quantums" of the battery strength i.e.
14% , 28% , 42%, 57% etc

Is there a way to get exact battery information.??
In the examples I have tested for system management (for example
http://forum.nokia.com/info/sw.nokia..._0_en.zip.html
I have not seen something better...

Thanx to all

2. ## Re: Battery Information on Symbians

Those percentages does represent the battery charge information bars approximately.
Total 7 bars - 100%, 6 bars~85%, 5 bars~70% etc....

I think there is no other API to give the battery info in exact bars that
are displayed on the screen.

--
VVS.Naresh
--

3. ## Re: Battery Information on Symbians

hi vvsnaresh,

I was also not able to find any other API for finding exact battery information.
I was planning to make a measuring of the energy consumption of executing cryptographic operations but now I do not know how to do this.

There has to be some way...!

4. ## Re: Battery Information on Symbians

Originally Posted by evariste
hi vvsnaresh,

I was also not able to find any other API for finding exact battery information.
I was planning to make a measuring of the energy consumption of executing cryptographic operations but now I do not know how to do this.

There has to be some way...!
I think, calculating the "cycles per second"(instructions per second) for your
code will solve the problem;Becoz, cycles per second can get you the power
consumption as well.To calculate "cycles per second", you also need platform
frequency and stuff.
I guess this is what you mean to do...

But, trying to extract the battery info before and after your cryptographic operations
wont be accurate inorder to calculate its energy consumption.

--
Naresh
--

5. ## Re: Battery Information on Symbians

I think, calculating the "cycles per second"(instructions per second) for your
code will solve the problem;Becoz, cycles per second can get you the power
consumption as well.To calculate "cycles per second", you also need platform
frequency and stuff.
I guess this is what you mean to do...
Seems like a lot of work to do!!
What I intend to do is to calculate battery consumption in contrast to the types of cryptographic functions ,algorithms, length of keys used etc.

Maybe another way is to run a code in a loop until battery drops by one bar and get the number of iterations that the loop has executed..This is too restrictive of course because you should benchmark beforehand and 'plug' the information inside the application.

Nevertheless I think it is very weird that the OS cannot provide exact battery information since this is a major issue in mobile devices.

6. ## Re: Battery Information on Symbians

You can go for time consumption by your code;

do a gettimeofday before and after your process/code and
get the time consumed by your code, which is directly proportional to
the power consumption.

The thing is it gives you the exact battery info, but the consumption before
and after your code need not be only yours, it does include OS's as well as
other background apps utilization as well.So, using device battery info to know
your program's battery consumption is an incorrect way.

--
Naresh
--

7. ## Re: Battery Information on Symbians

I think it's quite difficult to measure the charge remaining in a battery accurately unless you dedicate a lot of space and circuits to doing it. As I see it, there's really only three power states that mobiles absolutely need to know about; safe power (charger is in), low battery, and using battery but sufficient charge. Anything else is bonus.

For the timing approach, ISTR seeing a function in RThread that will tell you the CPU time that that thread has had, which might get around the problems with gettimeofday including time spent on the OS. I think it depends on the kernel build, though.

8. ## Re: Battery Information on Symbians

It is a quite interesting idea to use time to measure battery consumption to measure battery consumption of the application.

But I have some doubts if this is better than using battery info. Of course, OS battery is depleted also by other OS applications running in parallel, but this is also the case for the CPU time. Now TomYork said to use a function to get the thread's execution time which is I think more accurate.

By checking the function RThread::GetCpuTime() you can get the time spent by the Cpu for your process . But does not work for OS v 8.0 or 8.1 and for later than 9.1 the kernel should be compiled with a specific MACRO defined.
But is this is really indicative of energy consumption. What if a thread has been given CPU control but just waiting there for an async call to return.

Is this comparable to a case where the CPU is used intensively for cryptographic functions.?

thank you all guys..

#### Posting Permissions

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