|Beijer Electronics (formerly QSI Corporation)
|Quick TREQ-DX example for performing a soft power off
|Page 1 of 1|
|Author:||danieln [ Wed Mar 24, 2010 8:16 am ]|
|Post subject:||Quick TREQ-DX example for performing a soft power off|
This example is a command line utility for performing a soft power-off. It accepts one paramter, in minutes, that specifies how long the device should wait before shutting down. It checks once a minute, and starts counting once it detects the device is in user idle or system idle mode.
This app was primarily used in a situation where the TREQ-DX went into system idle when it detected the truck was powered off via the ignition signal. This is configurable via a registry setting found at [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\TreqPM\Ignition Pin Options]. More details can be found in the DX user guide http://www.qsicorp.com/engfiles/TREQ/TREQ-DX/TREQ-DX_UserGuide.pdf on page 64.
// ShutOffCE.cpp : Defines the entry point for the console application.
int _tmain(int argc, _TCHAR* argv)
hDevice = CreateFile(TEXT("PMD1:"), GENERIC_READ, 0, NULL, OPEN_EXISTING,0, NULL);
// get the current power state
DeviceIoControl(hDevice, PMD_GET_POWERSTATE, NULL, 0, &dwPowerState,sizeof(dwPowerState), NULL, NULL);
dwPowerState = POWER_OFF;
DeviceIoControl(hDevice, PMD_SET_POWERSTATE, &dwPowerState,sizeof(dwPowerState), NULL, 0, NULL, NULL);
|Page 1 of 1||All times are UTC - 7 hours|
|Powered by phpBB® Forum Software © phpBB Group