Rediger

Del via


Setting and Canceling Battery Notification

A miniclass driver provides a BatteryMiniSetStatusNotify routine so that the class driver can request notification of specific conditions. The routine is declared as follows:

typedef
NTSTATUS
(*BCLASS_SET_STATUS_NOTIFY)(
    IN PVOID Context,
    IN ULONG BatteryTag,
    IN PBATTERY_NOTIFY BatteryNotify
    );

The Context parameter is a pointer to the context area that is allocated by the miniclass driver and passed to the class driver in the BATTERY_MINIPORT_INFO structure at device initialization. The BatteryTag parameter is a value previously returned by BatteryMiniQueryTag.

The BatteryNotify parameter contains a set of flags indicating the battery power condition, and a pair of ULONG values that define a range of acceptable battery capacities. When the battery no longer satisfies the specified power conditions or its capacity goes above or below the specified range, the miniclass driver should call BatteryClassStatusNotify.

BatteryMiniSetStatusNotify should return STATUS_NOT_SUPPORTED for any conditions or trigger values that cannot be determined for this battery.

The class driver calls the BatteryMiniDisableStatusNotify routine to cancel notification of battery status changes previously requested by BatteryMiniSetStatusNotify. This routine is declared as follows:

typedef
NTSTATUS
(*BCLASS_DISABLE_STATUS_NOTIFY)(
    IN PVOID Context
    );

The Context parameter is a pointer to the context area allocated by the miniclass driver and passed to the class driver in the BATTERY_MINIPORT_INFO structure at device initialization.

Miniclass drivers can omit functionality for both routines and return STATUS_NOT_SUPPORTED. However, a miniclass driver that provides a BatteryMiniSetStatusNotify routine must provide a corresponding BatteryMiniDisableStatusNotify routine, and vice versa.