BATTERY_STATUS

This structure specifies information about the power status of the system.

Syntax

typedef struct {
BYTE
ACLineStatus;
BYTE
BatteryFlag;
BYTE
BatteryLifePercent;
BYTE
Reserved1;
DWORD
BatteryLifeTime;
DWORD
BatteryFullLifeTime;
BYTE
Reserved2;
BYTE
BackupBatteryFlag;
BYTE
BackupBatteryLifePercent;
BYTE
fBatteriesChangedSinceLastCall;
DWORD
BackupBatteryLifeTime;
DWORD
BackupBatteryFullLifeTime;
} BATTERY_STATUS;

Members

ACLineStatus
Indicates whether the device is running on AC power; one of the following values:
AC_LINE_OFFLINE
Offline.
AC_LINE_ONLINE
Online.
AC_LINE_BACKUP_POWER
Backup power.
AC_LINE_UNKNOWN
Unknown status.

All other values are reserved.

BatteryFlag
Battery charge status; one of the following values:
BATTERY_FLAG_HIGH
High.
BATTERY_FLAG_LOW
Low.
BATTERY_FLAG_CRITICAL
Critical.
BATTERY_FLAG_CHARGING
Charging.
BATTERY_FLAG_NO_BATTERY
No system battery.
BATTERY_FLAG_UNKNOWN
Unknown status.

All other values are reserved.

BatteryLifePercent
Percentage of battery charge remaining. Must be in the range from 0 through 100 or BATTERY_PERCENTAGE_UNKNOWN.
Reserved1
Must be 0.
BatteryLifeTime
Number of seconds of battery life remaining or BATTERY_LIFE_UNKNOWN if remaining lifetime is unknown.
BatteryFullLifeTime
Number of seconds of battery life when at full charge or BATTERY_LIFE_UNKNOWN if full lifetime is unknown.
Reserved2
Must be 0.
BackupBatteryFlag
Backup battery charge status; one of the following values:
BATTERY_FLAG_HIGH
High.
BATTERY_FLAG_LOW
Low.
BATTERY_FLAG_CRITICAL
Critical.
BATTERY_FLAG_CHARGING
Charging.
BATTERY_FLAG_NO_BATTERY
No system battery.
BATTERY_FLAG_UNKNOWN
Unknown status.

All other values are reserved.

BackupBatteryLifePercent
Percentage of full backup battery charge remaining. Must be in the range from 0 through 100 or BATTERY_PERCENTAGE_UNKNOWN.
fBatteriesChangedSinceLastCall
One of the following values:
TRUE (1)
Indicates that the batteries have been changed since the last time BatteryDrvrGetStatus was called.
FALSE (0)
Indicates that the batteries have not been changed.

Usually, the driver determines this bit during an interrupt process. When a Battery Cover Opened interrupt occurs, the interrupt service routine (ISR) sets a global variable to indicate that the cover has been opened. The next time BatteryDrvrGetStatus is called, the driver sets fBatteriesChangedSinceLastCall to TRUE and resets variable. If the global variable was not set, fBatteriesChangedSinceLastCall is set to FALSE.

BackupBatteryLifeTime
Number of seconds of backup battery life remaining or BATTERY_LIFE_UNKNOWN if remaining lifetime is unknown.
BackupBatteryFullLifeTime
Number of seconds of backup battery life when at full charge or BATTERY_LIFE_UNKNOWN if full lifetime is unknown.

Remarks

This GWES data structure is implemented as part of porting native device drivers.

This structure is declared in the Battery.h header file.