- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
CN 50 Does Not Report Battery Status Correctly
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
November 12 2009 03:57 PM - last edited on November 12 2009 04:23 PM
I have noticed and confirmed that some battery statuses are misreported on CN 50 terminals. For example: On Charge status is never reported. If terminal is on charge, batterry strength is reported as VeryLow. I have done an .NET application (attached) to prove it. Everything works ok on CN3 (Windows Mobile 6.1) but is funny on CN50
Terminal = CN 50
Firmware = 1.40.1.6
IVA = 5.6.72.3187
OS = 5.2.20774 (Build 20774.1.4.8)
I am attaching source file in C#
Solved! Go to Solution.
Re: CN 50 Does Not Report Battery Status Correctly
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
November 13 2009 03:54 AM
If, as you say, this code works on the CN3 WM6.1 but not the CN50, then you should open a case with our product support folks. You can do so by following the link below.
Re: CN 50 Does Not Report Battery Status Correctly
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 10 2009 01:08 AM
Why you don't use the Microsoft.SmartDevice.Connectivity ?
SystemInfo info = device.GetSystemInfo();
if (info.ACLineStatus == 1)
{
Console.WriteLine("AC Line plugged in.");
}
else if(info.ACLineStatus == 0)
{
Console.WriteLine("AC Line unplugged.");
}
Console.WriteLine("Main Battery Flag: " + info.BatteryFlag.ToString());
Console.WriteLine(" Capacity: " + nfo.BatteryFullLifetime.ToString());
Console.WriteLine(" Percent: " + info.BatteryLifePercent.ToString());
Console.WriteLine(" Life: " + info.BatteryLifetime.ToString());
More Infos here:
http://msdn.microsoft.com/de-de/library/microsoft.
Re: CN 50 Does Not Report Battery Status Correctly
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 10 2009 05:04 AM
Although it is a nice approach to try to get more informations remotely, it does not give usefull informations:
Device Properties:
OS_Version: 5010
Total Page File: 0
Available Page File: 0
Page Size: 4096
Total RAM: 71106560
Available RAM: 28221440
Total Virtual Memory: 33554432
Available Virtual Memory: 30212096
AC Line unplugged.
Main Battery Flag: 0
Capacity: 0
Percent: 0
Life: 0
Device Time: 10.12.2009 13:40:28
Processor Architecture: Arm
Instruction Set: Armv4i
Number of CPU: 1
OS: 5.2.20774
Locale ID: 1033
I have been informed that the Battery APIs have not implemented in the battery driver to save costs. So there ist actually no way to get better Battery infos.
~Josef
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp
Re: CN 50 Does Not Report Battery Status Correctly
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 11 2009 06:51 AM - last edited on December 11 2009 06:58 AM
And what happend when you use the coredll.dll?
You can use the GetSystemPowerStatusEx()...
Add Reference:
- Microsoft.WindowsMobile
- Microsoft.WindowsMobile.Status
Here is my Codesnippet...
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;
using Microsoft.WindowsMobile.Status;
namespace SYSTEM_POWER_STATUS_EX
{
public partial class Form1 : Form
{
[DllImport("coredll")]
private static extern uint GetSystemPowerStatusEx(SYSTEM_POWER_STATUS_EX lpSystemPowerStatus, bool fUpdate);
public class SYSTEM_POWER_STATUS_EX
{
public byte ACLineStatus;
public byte BatteryFlag;
public byte BatteryLifePercent;
public byte Reserved1;
public uint BatteryLifeTime;
public uint BatteryFullLifeTime;
public byte Reserved2;
public byte BackupBatteryFlag;
public byte BackupBatteryLifePercent;
public byte Reserved3;
public uint BackupBatteryLifeTime;
public uint BackupBatteryFullLifeTime;
}
SYSTEM_POWER_STATUS_EX status = new SYSTEM_POWER_STATUS_EX();
public Form1()
{
InitializeComponent();
UpdateProgressMessage("");
UpdateACLineMsg("");
UpdateStatusMessage("");
}
public void UpdateProgressMessage(string Message)
{
lblProgress.Text = Message + "%";
lblProgress.Refresh();
}
public void UpdateStatusMessage(string Statusmsg)
{
lblStatus.Text = Statusmsg;
lblStatus.Refresh();
}
public void UpdateACLineMsg(string aclinemsg)
{
lblACLine.Text = aclinemsg;
lblACLine.Refresh();
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
this.Close();
}
private void batteryflag(uint i)
{
switch(i)
{
case 1:UpdateStatusMessage("High");
break;
case 2:UpdateStatusMessage("Low");
break;
case 4: UpdateStatusMessage("Critical");
break;
case 8: UpdateStatusMessage("Charging");
break;
case 128: UpdateStatusMessage("No system battery");
break;
case 255: UpdateStatusMessage("Unknown status");
break;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (GetSystemPowerStatusEx(status, true) == 1)
{
UpdateProgressMessage(status.BatteryLifePercent.ToString());
batteryflag(status.BatteryFlag);
if (status.ACLineStatus == 1)
{
UpdateACLineMsg("charging...");
}
else if (status.ACLineStatus == 0)
{
UpdateACLineMsg("on battery");
}
else
{
UpdateACLineMsg("undefiniert - "+status.ACLineStatus.ToString());
}
}
}
}
}
I don't can test it, because i haven't CN50 here.... but i think the coredll.dll is already in it...
greetz
stephan
i attached my sample....
Re: CN 50 Does Not Report Battery Status Correctly
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 11 2009 07:45 AM
Hello
thanks for the c# code, but I already tested GetSystemPowerStatusEx on a CN50, there are no usefull returned data.
As already metioned the API is not implemented, it always returns dummy data (zeros and FF).
Believe me
~Josef
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp
Re: CN 50 Does Not Report Battery Status Correctly
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 11 2009 07:47 AM - last edited on December 11 2009 07:48 AM
mhh but the function is in the coredll.dll...
Why it doesn't works?
Can you explain?
Re: CN 50 Does Not Report Battery Status Correctly
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 11 2009 08:01 AM
See my post on 10. of december, 2:04
"I have been informed that the Battery APIs have not implemented in the battery driver to save costs. So there ist actually no way to get better Battery infos."
An OEM of windows mobile can decide more or less, which APIs to implement and which will be just fakes. This is especially true for hardware related API functions or the SIM toolkit API calls.
Sorry
Josef
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp
Re: CN 50 Does Not Report Battery Status Correctly
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 11 2009 10:34 AM - last edited on December 11 2009 10:34 AM
Okay i have read some thing about APIs ![]()
BUT...
there was a way to read the level from registry in WM5..
Maybe this key is allready there....
Reading battery level
You can read the remaining battery charge from this key. In my system it shows 5308416 when fully charged.
HKLM\System\State\Battery\Main (DWORD value)
greetz Stephan
Re: CN 50 Does Not Report Battery Status Correctly
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
December 12 2009 11:00 PM
Hello again
just to report:
The CN50 reports always the same value at HKLM\System\State\Battery\Main
I let go the battery of a cn50 down to 70 %. Interestingly the power applet shows a bar of about 70% and the number at the right of the bar always is 100! Only in SmartSystems or by using an xml query I got the 70% reported.
There is some work to do for the engineers.
~josef
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp

