All Forums
 Microsoft Windows CE
 .NET Application Development
 Getting battery status
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

mflynn91

1 Posts

Posted - 21 Jul 2005 :  14:05:04  Show Profile  Email Poster
I can't seem to retrieve the power status of our BitsyX board using GetSystemPowerStatusEx2. Is this possible?


[DllImport("coredll")]
private static extern uint GetSystemPowerStatusEx2(SYSTEM_POWER_STATUS_EX2 lpSystemPowerStatus, uint dwLen, bool fUpdate);

public class SYSTEM_POWER_STATUS_EX2
{
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;
public uint BatteryVoltage;
public uint BatteryCurrent;
public uint BatteryAverageCurrent;
public uint BatteryAverageInterval;
public uint BatterymAHourConsumed;
public uint BatteryTemperature;
public uint BackupBatteryVoltage;
public byte BatteryChemistry;
}


private void BatteryUpdate()
{
SYSTEM_POWER_STATUS_EX2 status2 = new SYSTEM_POWER_STATUS_EX2();
BatteryStatusLbl.Text = "Power status check failed.";
if (GetSystemPowerStatusEx2(status2, (uint)Marshal.SizeOf(status2), false) == (uint)Marshal.SizeOf(status2))
{
BatteryStatusLbl.Text = String.Format("{0}%", status2.BackupBatteryLifePercent);
}
}

ctacke

877 Posts

Posted - 21 Jul 2005 :  16:14:04  Show Profile  Email Poster
The off the shelf BitsyX has no battery or backup battery, and therefore it has only a stub battery driver that returns no useful battery information. If you need it to return information, a battery driver that matches your battery controller is required.
Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.02 seconds. Snitz Forums 2000