System Power State Setting (Windows CE 5.0)
In some situations applications may want to change the system power state. Applications are not assumed to know which power states are available on a given Windows CE-based device, nor are they expected to know the characteristics of the system power states that are available. Rather than calling SetSystemPowerState with an explicit state name, applications can invoke it with a bitmask describing the characteristics of the power state into which they want to transition. The Power Manager will translate this bitmask into a specific power state. For example, an application might request a system power status change with the POWER_STATE_SUSPEND bit set. The Power Manager would then transition into Suspend or SuspendCradle, depending on whether or not the system is in a cradle at the time of the request. If the device were removed from the cradle while in the SuspendCradle state, the Power Manager would transition the system into a suspend state.
The Power Manager may restrict applications from entering certain system power states. For example, if the Power Manager is actively controlling system power states based on external inputs, it may not allow you to explicitly enter an ACRun power state when the unit is running on battery power. The default Power Manager implementation permits only applications to suspend the system.
The following table shows predefined power state bits and their suggested interpretations.
Bit | Description |
---|---|
POWER_STATE_ON | Highest functional level and highest power consumption. |
POWER_STATE_OFF | All devices are off. Resuming from this state results in a cold boot. You can use this state to prepare a device for shipping without depleting the battery. |
POWER_STATE_CRITICAL | Battery is critically low. Carry out required system maintenance, then dump power to devices and put DRAM into a self-refresh state. Resuming from this state results in a cold boot. |
POWER_STATE_BOOT | System is in the process of booting. |
POWER_STATE_IDLE | No devices are in use and there is no user interaction. All devices should enter a low-power state as well as a low-power system mode. You can use this as an alternative to suspending the system if the power saved from the low-power mode is satisfactory. |
POWER_STATE_RESET | Flush files, shut down devices and call KernelIoControl. |
POWER_STATE_SUSPEND | Suspend the OS and ultimately call OEMPowerOff. |
The sample Power Manager implementation does not use all of the states listed in the above table. You can define state flags that are specific to your Windows CE-based device.
If an application requests a new power state using SetSystemPowerState the Power Manager will do the following:
- Broadcast a PBT_TRANSITION notification.
- Update the device power state, if necessary, for all drivers. If a device is already at an acceptable power state for the new system power state the Power Manager does not need to issue an IOCTL_POWER_SET.
- If the Windows CE-based device is resuming from a suspend state, broadcast a PBT_RESUME notification.
See Also
Application Interface | SetSystemPowerState | KernelIoControl | OEMPowerOff | IOCTL_POWER_SET
Send Feedback on this topic to the authors