现在的位置: 首页 > 综合 > 正文

Keeping system alive

2013年01月24日 ⁄ 综合 ⁄ 共 870字 ⁄ 字号 评论关闭

In power manager, the PDD has a certain set of events that it monitors. For eg:

  • PM_BOOTPHASE2_EVENT
  • PM_SYSTEM_API_EVENT etc

For more information on events each PDD handles, check the Power manager code available in PUBLIC code (WINCE600/PUBLIC/COMMON/OAK/DRIVERS/PM/PDD).

In those events there is event PM_SYSTEM_TIMEIDLE_RESET (PowerManager/SystemIdleTimerReset), which can used to reset the system activity timer. Check out the following piece of code for doing so.


HANDLE hSysTmrReset = CreateEvent(NULL, FALSE, FALSE, _T("PowerManager/SystemIdleTimerReset"));
BOOL bExit = FALSE;
if (INVALID_HANDLE_VALUE != hSysTmrReset )
{
while (FALSE == bExit)
{
ResetEvent(hSysTmrReset);
Sleep(1000);
SetEvent(hSysTmrReset);

RETAILMSG(TRUE, (TEXT("Reset/r/n")));
Sleep(20000);
}
CloseHandle (hSysTmrReset );
}
return 0;

This system, code will keep the system alive by resetting the timer every 20 seconds. I have tested this code and seems to be working. But needs to analyze the system performance on doing so.

【上篇】
【下篇】

抱歉!评论已关闭.