5 years ago
#13744 Quote
We have a program where data is coming in from a serial device, we wish to have is reboot when "inactive" As there is often no human activity, we need it to reboot ( but ideally SHUTDOWN) after 5 mins of no data coming in on the serial port.

1)What does Secure lockdown use for inactivity?

2)I have tried simulating human activity, by programmatically moving the mouse 1 pixel each time serial data comes in to try and fool a human is using, this did not help

3) I tried setting ES_SYSTEM_REQUIRED for SetThreadExecutionState (using C# program)  see below

SetThreadExecutionState function

Enables an application to inform the system that it is in use, thereby preventing the system from entering sleep or turning off the display while the application is running.


ES_SYSTEM_REQUIRED 0x00000001    Forces the system to be in the working state by resetting the system idle timer.

but this does not prevent inactivity

https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-setthreadexecutionstate


Please could you advise?

We would also like to SHUTDOWN rather than REBOOT after 5 mins of inactivity, is this a possibility?
0