-
September 12th, 2011, 06:32 AM
#1
unit of battery capacity
Hi,
I made a small application which gives the user information about the current state and wear of their's laptop battery. Its functionality and UI is similar to CoconutBattery in the MacOSX world.
The application works fine but I wonder whether it is possible to display the capacity in mAh instead of mWh. I could not find any information about that. But I know the hardware provides the necessary information (either capacity directly in mAh or the current battery voltage) because when I run my program under Linux (it is a cross-platform GTK app) I can read the mAh values simply from /proc/acpi/...
I use the GetSystemPowerStatus() API call to retrieve the battery state information. I could find a GetSystemPowerStatusEx() and GetSystemPowerStatusEx2() API calls but these seem to be available under WindowsCE or WindowsMobile (or whatever this is called this year). Furthermore I use IOCTL_BATTERY_QUERY_INFORMATION and IOCTL_BATTERY_QUERY_STATUS in DeviceIoControl calls.
Thanks,
Johannes
-
September 13th, 2011, 08:36 AM
#2
Re: unit of battery capacity
The capacities in mAh and mWh are related via:
mWh = mAh * voltage (in Volts, not mV)
You can get the voltage from the BATTERY_STATUS structure returned when using the IOCTL_BATTERY_QUERY_STATUS code to the DeviceIoControl call. Remember this voltage will be in mV so remember to divide by 1000 first to get volts.
-
September 19th, 2011, 05:03 AM
#3
Re: unit of battery capacity
Thanks for the hint! I already use this IO ctrl but somehow I missed the contents of the BATTERY_STATUS struct. As it turns out, the current voltage is not what I want but rather a "design voltage" value. Otherwise, if I use the current voltage to compute the mAh values from mWh the design capactiy will change (increase when the voltage drops), which is not what I intended. So I think I will stick to the mWh values in Windows.
Thanks anyway for the hint.
Johannes
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|