In power manager, the PDD has a certain set of events that it monitors. For eg:
- PM_BOOTPHASE2_EVENT
- PM_SYSTEM_API_EVENT etc
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.
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.
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;
0 comments:
Post a Comment