/// <summary> /// Prepares the HE853 device for usage. /// </summary> private void OpenUnlocked() { this.CloseUnlocked(); // "\\\\?\\hid#vid_04d9&pid_1357#6&37b1e0bf&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\0" string devicePath = NativeMethodsHelper.GetHE853DevicePath(); if (devicePath.Length != 0) { NativeMethodsHelper.FlushHIDQueue(devicePath); this.writeHandle = NativeMethodsHelper.CreateFileForWrite(devicePath); } if (this.writeHandle == IntPtr.Zero) { throw new FileNotFoundException("HE853 device is not connected or in use."); } }
/// <summary> /// Shuts down the HE853 device. /// </summary> private void CloseUnlocked() { NativeMethodsHelper.CloseHandle(ref this.writeHandle); }