Cradle Detect - NO ActiveSync, no internet

A

Andrew Martin

I've read through pages of solutions for detecting the cradle, but in
my case, we are not using ActiveSync nor are we on a network with a
webserver. For this enterprise app, we have a series of Intermec
devices with ethernet cradles. What I want to do is detect when the
device is physically in the cradle to allow the application to attempt
an FTP connection to our remote file store.

I can check the IP, but it caches the connected IP for a while after I
pull it out of the cradle which is no good either.

Currently, or connection detection logic opens and closes an FTP
session which seems foolish and slow. This is the best I have so far,
but not very compelling a workaround:


private const int NOTIFICATION_EVENT_NONE = 0;
private const int NOTIFICATION_EVENT_TIME_CHANGE = 1;
private const int NOTIFICATION_EVENT_SYNC_END = 2;
private const int NOTIFICATION_EVENT_ON_AC_POWER = 3;
private const int NOTIFICATION_EVENT_OFF_AC_POWER = 4;
private const int NOTIFICATION_EVENT_NET_CONNECT = 5;
private const int NOTIFICATION_EVENT_NET_DISCONNECT = 6;
private const int NOTIFICATION_EVENT_DEVICE_CHANGE = 7;
private const int NOTIFICATION_EVENT_IR_DISCOVERED = 8;
private const int NOTIFICATION_EVENT_RS232_DETECTED = 9;
private const int NOTIFICATION_EVENT_RESTORE_END = 10;
private const int NOTIFICATION_EVENT_WAKEUP = 11;
private const int NOTIFICATION_EVENT_TZ_CHANGE = 12;

[System.Runtime.InteropServices.DllImport ("coredll.dll")]
public static extern long CeRunAppAtEvent(string AppName, int
WhichEvent);

private void SetNotification()
{
long r;

r = CeRunAppAtEvent(@"\Program Files\Temp\hack.exe",
NOTIFICATION_EVENT_NONE);
r = CeRunAppAtEvent(@"\Program Files\Temp\hack.exe",
NOTIFICATION_EVENT_RS232_DETECTED);
}
 
Top