public static DriverVersion GetVersion(Driver driver) { uint driverVersion; var uuInfo = new UUINFO(); try { if (!UUIRTGetDrvInfo(out driverVersion)) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } if (!UUIRTGetUUIRTInfo(driver.Handle, ref uuInfo)) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } } catch (Exception ex) { throw new ApplicationException("Unable to read UsbUirt driver version", ex); } return(new DriverVersion( driverVersion, new DateTime(2000 + uuInfo.fwDateYear, uuInfo.fwDateMonth, uuInfo.fwDateDay), uuInfo.fwVersion, uuInfo.protVersion)); }
private UUINFO GetVersion() { var uuInfo = new UUINFO(); if (false == UUIRTGetUUIRTInfo(_hDrvHandle, ref uuInfo)) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } return(uuInfo); }
/// <summary> /// Creates a new UsbUirt Controller. /// </summary> /// <remarks> /// In order to ensure that the connection with the USBUirt device is closed, /// you must call Dispose() when you are done with object. /// </remarks> public Controller() { _learnStates = new Hashtable(); _hDrvHandle = OpenDriver(); UUINFO uuInfo = GetVersion(); _firmwareDate = new DateTime(2000 + uuInfo.fwDateYear, uuInfo.fwDateMonth, uuInfo.fwDateDay); _firmwareVersion = uuInfo.fwVersion; _protocolVersion = uuInfo.protVersion; #if false myCb = new ReceiveCallback(ReceiveCallbackProc); SetReceiveCallback(myCb); #endif }
private static extern bool UUIRTGetUUIRTInfo(IntPtr hHandle, ref UUINFO puuInfo);
/// <summary> /// /// </summary> /// <returns></returns> public string GetVersions() { if (IsUsbUirtLoaded) { var p = new UUINFO(); UUIRTGetUUIRTInfo(_usbUirtHandle, ref p); var firmdate = new DateTime(p.fwDateYear + 2000, p.fwDateMonth, p.fwDateDay); string firmversion = (p.fwVersion >> 8) + "." + (p.fwVersion & 0xff); return string.Format("Firmware Version: {0} ({1})", firmversion, firmdate.ToString("MMMM, dd, yyyy")); } return "USBUIRT device not detected!"; }
private UUINFO GetVersion() { UUINFO uuInfo = new UUINFO(); if (false == UUIRTGetUUIRTInfo(_hDrvHandle, ref uuInfo)) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } return uuInfo; }
private static extern bool UUIRTGetUUIRTInfo(IntPtr hDrvHandle, ref UUINFO uuInfo);
public string GetVersions() { if (isUsbUirtLoaded) { UUINFO p = new UUINFO(); UUIRTGetUUIRTInfo(UsbUirtHandle, ref p); DateTime firmdate = new DateTime(p.fwDateYear + 2000, p.fwDateMonth, p.fwDateDay); string firmversion = (p.fwVersion >> 8) + "." + (p.fwVersion & 0xff); //string plug = string.Format("Plugin Version: {0}", USBUIRT_PLUGINVER); //string firm = string.Format("Firmware Version: {0} ({1})", firmversion, firmdate.ToString("MMMM, dd, yyyy")); //return string.Format("{0}\r\n{1}", plug, firm); return string.Format("Firmware Version: {0} ({1})", firmversion, firmdate.ToString("MMMM, dd, yyyy")); } else { return "USBUIRT device not detected!"; } }
public static extern bool UUIRTGetUUIRTInfo(IntPtr hHandle, ref UUINFO puuInfo);