Battery Drivers
The battery driver provides other components of the operating system (OS) with information about the power level of the main battery, backup battery, and AC power supply of a hardware platform. The following list shows the functions that the battery driver enables:
- GetSystemPowerStatusEx
- GetSystemPowerStatusEx2
- BatteryDrvrGetLevels
- BatteryDrvrSupportsChangeNotification
- BatteryGetLifeTimeInfo
- BatteryNotifyOfTimeChange
The battery driver, which is loaded by the Device Manager, exposes a stream interface. The exposed stream interface provides headless, or hlbase-based, configurations that do not include GWES access to the battery functions. The interface also provides battery information earlier in the boot process and enables you to support batteries that report more, or different, information than the standard functions permit.
For information on porting your battery driver to Microsoft® Windows® CE .NET 4.2, see Changes to Device Drivers.
Battery PDD Interface
Battery functions are translated into Battery Driver IOCTLs and passed to the battery driver. The battery driver model device driver (MDD) then invokes internal functions that may result in platform-dependent driver (PDD) calls.
The following list shows the battery driver PDD functions:
- BatteryPDDInitialize
- BatteryPDDDeinitialize
- BatteryPDDResume
- BatteryPDDPowerHandler
- BatteryPDDGetStatus
- BatteryPDDGetLevels
- BatteryPDDSupportsChangeNotification
In addition to these functions, you can have the battery PDD receive custom IOCTLs. To enable this, you must have the PDD declare a function to process the IOCTL codes and pass its pointer to the MDD. You must set the function pointer to have a signature compatible with PFN_BATTERY_PDD_IOCONTROL.
The following code example shows how you should register the custom IOCTL handler in the PDD's BatteryPddInitialize function. The BatteryPDDIoControl function name in the code example below is a placeholder and is invoked through a function pointer.
DWORD BatteryPddIOControl(
DWORD dwContext,
DWORD dwIoctl,
PUCHAR pInBuf,
DWORD InBufLen,
PUCHAR pOutBuf,
DWORD OutBufLen,
PDWORD pdwBytesTransferred)
{
DWORD dwStatus = ERROR_SUCCESS;
// additional code
return dwStatus;
}
BOOL BatteryPddInitialize(LPCTSTR pszRegistryContext)
{
// additional code
gpfnBatteryPddIOControl = BatteryPddIOControl;
// additional code
}
See Also
Battery Driver Samples | Battery Driver Global Variables | Battery Driver Registry Settings | Stream Interface Drivers
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.