private IntPtr OpenDriver()
{
IntPtr hDrvHandle = UUIRTOpen();
// hDrvHandle = (IntPtr)INVALID_HANDLE_VALUE;
if (hDrvHandle.ToInt32() == INVALID_HANDLE_VALUE) {
switch (Marshal.GetLastWin32Error()) {
case (int) UuirtDriverError.NoDll:
throw new ApplicationException("Unable to find USB-UIRT Driver. Please make sure driver is Installed");
case (int) UuirtDriverError.NoDeviceFound:
throw new ApplicationException("Unable to connect to USB-UIRT device! Please ensure device is connected to the computer");
case (int) UuirtDriverError.NoResponse:
throw new ApplicationException("Unable to communicate with USB-UIRT device! Please check connections and try again. If you still have problems, try unplugging and reconnecting your USB-UIRT. If problem persists, contact Technical Support");
case (int) UuirtDriverError.WrongVersion:
throw new ApplicationException("Your USB-UIRT's firmware is not compatible with this API DLL. Please verify you are running the latest API DLL and that you're using the latest version of USB-UIRT firmware! If problem persists, contact Technical Support");
}
throw new ApplicationException("Unable to initialize USB-UIRT (unknown error)");
}
return hDrvHandle;
}