Share via


Battery Driver Development Concepts

Other versions of this page are also available for the following:

Windows Mobile SupportedWindows Embedded CE Supported

8/28/2008

The battery driver, which is loaded by the Device Manager, exposes a stream interface. The exposed stream interface provides OS designs 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 All Platforms

Note

Ensure that the device never wakes up for the sole purpose of displaying a low-battery warning.

The following list shows the functions that the battery driver enables:

For Windows Embedded CE

Aa927972.collapse(en-US,WinEmbedded.60).gifBattery 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:

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
}

For Windows Mobile

Aa927972.collapse(en-US,WinEmbedded.60).gifBattery Driver Considerations for Windows Mobile Powered Devices

The following list shows the issues to consider when developing a battery driver for a Windows Mobile powered device:

See Also

Concepts

Stream Interface Driver Development Concepts