static void Main(string[] args) { try { HIDFinder finder = new HIDFinder(); IHIDDevice deviceFound = finder.FindDevice(0x8d8, 0x101); if (deviceFound == null) { Console.WriteLine("Device not found..."); } else { Console.WriteLine("Device Found!"); DateTime startTime = DateTime.Now; for (int i = 0; i < 1024; i++) { bool written = deviceFound.WriteReportViaInterruptTransfer(new byte[] { 0x37, 00 }); //Console.WriteLine("Data written: " + written); byte[] dataRead = deviceFound.ReadReportViaInterruptTransfer(); int value = dataRead[1] | dataRead[2] << 8; //Console.WriteLine("Data Read: " + value); } DateTime endTime = DateTime.Now; Console.WriteLine("Time consumed: " + (endTime - startTime)); } } catch (Exception ex) { Console.WriteLine("Exception: " + ex.Message); } Console.ReadKey(); }
protected byte[] ExecuteCommandOnDevice(byte[] commandPacket) { if (!Connected) { throw new InvalidOperationException("No matching MiniLab device connected with the computer."); } _hidDevice.WriteReportViaInterruptTransfer(commandPacket); return(_hidDevice.ReadReportViaInterruptTransfer()); }