Platform SDK: Hardware

BATTERY_INFORMATION

The BATTERY_INFORMATION structure is returned by the IOCTL_BATTERY_QUERY_INFORMATION operation when the BatteryInformation information level is requested.

typedef struct _BATTERY_INFORMATION {
  ULONG       Capabilities;
  UCHAR       Technology;
  UCHAR       Reserved[3];
  UCHAR       Chemistry[4];
  ULONG       DesignedCapacity;
  ULONG       FullChargedCapacity;
  ULONG       DefaultAlert1;
  ULONG       DefaultAlert2;
  ULONG       CriticalBias;
  ULONG       CycleCount;
} BATTERY_INFORMATION, *PBATTERY_INFORMATION;

Members

Capabilities
A bitmask with one or more of the following bits:
Bits Meaning
BATTERY_CAPACITY_RELATIVE Indicates that the battery capacity and rate information are relative and not in any specific units. If this bit is not set the reporting units are milliwatt hours (mWh) or milliwatts (mW), as appropriate.
BATTERY_FORCE_CHARGE_SUPPORTED Indicates that Battery Set Information requests of the type BatteryCharge are supported by this battery device.
BATTERY_FORCE_DISCHARGE_SUPPORTED Indicates that Battery Set Information requests of the type BatteryDischarge are supported by this battery device.
BATTERY_IS_SHORT_TERM Indicates that the normal operation is for a fail-safe function. If this bit is not set the battery is expected to be used during normal system usage.
BATTERY_SYSTEM_BATTERY Indicates that the battery can provide general power to run the system.

Technology
0 is a nonrechargeable battery, for example, alkaline.

1 is a rechargeable battery, for example, lead acid.

Chemistry
An abbreviated character string that indicates the battery's chemistry. This Unicode string is not necessarily zero-terminated. The following is a partial list of abbreviations that can be returned and the associated chemistries.
Unicode string Meaning
PbAc Lead Acid
LION Lithium Ion
NiCd Nickel Cadmium
NiMH Nickel Metal Hydride
NiZn Nickel Zinc
RAM Rechargeable Alkaline-Manganese

Other chemistries may appear in the future and your code should be able to handle them.

DesignedCapacity
The theoretical capacity of the battery when new, in mWh unless BATTERY_CAPACITY_RELATIVE is set. In that case the units are undefined.
FullChargedCapacity
The battery's current fully charged capacity in mWh (or relative). Compare this value to DesignedCapacity to estimate the battery's wear.
DefaultAlert1
The manufacturer's suggestion of when a "low battery" battery alert should occur. Definitions of "low" vary from manufacturer to manufacturer. In general, a "warning" state will occur before a "low" state, but you should not assume that it always will.
DefaultAlert2
The manufacturer's suggestion of when a "warning" battery alert should occur. Definitions of "warning" vary from manufacturer to manufacturer. In general, a "warning" state will occur before a "low" state, but you should not assume that it always will.
CriticalBias
A bias from 0 applied to battery reporting. Some batteries reserve a small charge that is biased out of the battery's FullChargedCapacity and CurrentCapacity values to show "0" as the critical battery level. Critical bias is analogous to setting a fuel gauge to show "empty" when there are several liters of fuel left.
CycleCount
The count of the number of charge/discharge cycles the battery has experienced. This provides a means to determine the battery's wear. If the battery does not support a cycle counter, this value returns 0.

Remarks

In general, a "warning" state will occur before a "low" state, but you should not assume that it always will. It is possible to poll a battery and find that neither alert level has occurred, and poll the battery again and find it discharged to the extent that both levels have been achieved. This may indicate that you are not polling often enough. It may also indicate that the battery is unable to hold a charge for very long and is discharging more rapidly than you expected. Such a battery may be nearing the end of its useful life, or it may be damaged.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Batclass.h.

See Also

Device Input and Output Overview, Device Input and Output Structures, DeviceIoControl, IOCTL_BATTERY_QUERY_INFORMATION