PowerPolicyNotify(PPN_UNATTENDEDMODE, 1) API is not sufficient on MPA 3.0 based devices, due to different implementation.
The platform is looking for running process; otherwise it will switched to suspend state after a time out as it identified in the device power manager menu.
To stay in unattended mode, user application must keep running process in the background i.e. call SystemIdleTimerReset() API right after calling PowerPolicyNotify() API.
This API will keep the device in current state i.e. unattended mode as long as it’s running.
In some cases it doesn't run process in background. Hence the device enters into suspend after a timeout as it identify it in its power manager.
A general solution is to call SetSystemTime() API every 20 seconds.
Add the following lines:
- In declaration: static long dwStep = 0;
- In implementation:
LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
if((dwStep % 15) == 0)
This Knowledge base article provides information for application developers about the “Unattended Mode” system power states from Microsoft that are supported in Zebra Mobile Computers.
Microsoft supports the following system power states:
||Full powered on state.
||The user has not interacted with the system for some time. And the backlight has turned off. The timeout for this to occur is set through the backlight setting in the Control Panel.
||This state is currently specific to Smartphone devices, but will be implemented on Pocket PCs once they switch to the always on power mode. In this state, the backlight and the screen are turned off.
||In this state, the user has specifically turned the screen off. This is different from the screen being ruined off due to idleness.
||This mode is specific to Pocket PCs. The screen, backlight, and the audio are all turned off, but the programs on the device are running. This enables ActiveSync to check e-mail without alerting the user. From the user's perspective, the device is sleeping.
||When a device wakes up from sleeping, it is in this mode. The backlight and the screen are still off, and programs have a 15 second window to switch the device to another power state before the device automatically goes back to the suspended state.
||The device is sleeping and the processor is halted. The device will not come out of this state until a hardware event wakes it up.
||The device is not performing any actions and is not consuming power (exception: though, in some devices, the system clock may still draw power to maintain time).
P stands for state applicable to Pocket PCs, while
S stands for state applicable to Smartphones