User's Manual

©2006 Nordic ID Oy
Nordic ID PL3000 user manual, v. 2.6, October 2006 76
LinkWatchdog Programmers Reference
The LinkWatchdog settings are stored under the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Apps\LinkWatchdog
To have the LWD service start your user interface application instead of the LinkWD_UI.exe program, create the
following value under this key:
“UIExec”=”Your application path and executable”
You can communicate with the LWD service using standard Widows CE I/O calls. Open the connection to the service
with a CreateFile call such as this:
HANDLE lwd = INVALID_HANDLE_VALUE;
lwd = CreateFile(L”LWD0:”,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
if (lwd != INVALID_HANDLE_VALUE)
{
//Service was running, you’re good to go
}
You can then query the current link state like this:
DWORD newstate = 0;
DWORD written = 0;
#de ne IOCTL_LINKWD_GETSTATE \
CTL_CODE(FILE_DEVICE_SERVICE, 3001, METHOD_BUFFERED, FILE_ANY_ACCESS)
if (lwd != INVALID_HANDLE_VALUE)
{
DeviceIoControl(lwd, IOCTL_LINKWD_GETSTATE, NULL, 0, &newstate, sizeof
(DWORD), &written, NULL);
}
The valid values of newstate after this are de ned as:
enum LWD_STATES
{
LWD_STATE_RECO = 0xBEEF0001,
LWD_STATE_LOST = 0xBEEF0002,
LWD_STATE_CONN = 0xBEEF0003,
};