/// <summary> /// Write an output report to the device. /// </summary> /// <param name="oOutRep">Output report to write</param> protected void Write(OutputReport oOutRep, int trytime) { try { m_oFile.Flush(); m_oFile.Write(oOutRep.Buffer, 0, oOutRep.BufferLength); } catch (IOException ex) { //Console.WriteLine(ex.ToString()); // The device was removed! throw new HIDDeviceException("Probbaly the device was removed"); } catch (Exception exx) { if (trytime > 0) { try { m_oFile.Close(); Initialise(DevicePath); Write(oOutRep, --trytime); } catch (Exception exxx) { Console.WriteLine(exxx.ToString()); } } Console.WriteLine(exx.ToString()); } }
protected void sendReport(OutputReport oOutRep) { try { // Call SetOutputReport to send this report buffer over the control pipe HidD_SetOutputReport(m_hHandle, oOutRep.Buffer, oOutRep.BufferLength); } catch (Exception exx) { Console.WriteLine(exx.ToString()); } }
protected void Write(OutputReport oOutRep) { try { this.m_oFile.Write(oOutRep.Buffer, 0, oOutRep.BufferLength); } catch (IOException) { throw new HIDDeviceException("Probbaly the device was removed"); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } }
/// <summary> /// Write an output report to the device. /// </summary> /// <param name="oOutRep">Output report to write</param> protected void Write(OutputReport oOutRep) { if (m_oFile == null) { return; } try { m_oFile.Write(oOutRep.Buffer, 0, oOutRep.BufferLength); } catch (IOException) { // The device was removed! throw new HIDDeviceException("Probbaly the device was removed"); } }
protected void Write(OutputReport oOutRep) { try { int bufferLength = oOutRep.BufferLength; this.m_oFile.BeginWrite(oOutRep.Buffer, 0, oOutRep.BufferLength, null, null); } catch (IOException ex) { Console.WriteLine(ex.ToString()); throw new GException0("Probaly the device was removed"); } catch (Exception ex2) { Console.WriteLine(ex2.ToString()); } }
/// <summary> /// Send an OutputReport /// </summary> /// <param name="oRep">The OutputReport to send</param> /// <remarks>Will raise the DataSent event</remarks> public void SendReport(OutputReport oRep) { try { Write(oRep); // write the output report if (DataSent != null) { DataSent(this, new DataSentEventArgs(oRep)); } } catch (HIDDeviceException ex) { Console.WriteLine(ex.ToString()); // Device may have been removed! } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
protected void Write(OutputReport oOutRep) { try { if (!IsDisposing) { m_oFile.Write(oOutRep.Buffer, 0, oOutRep.BufferLength); } } catch (IOException ex) { throw new HIDDeviceException("Probbaly the device was removed"); } catch (Exception exx) { Console.WriteLine(exx.ToString()); } }
public DataSentEventArgs(OutputReport data) { this.data = data; }
/// <summary> /// Write an output report to the device. /// </summary> /// <param name="oOutRep">Output report to write</param> protected void Write(OutputReport oOutRep) { try { m_oFile.Write(oOutRep.Buffer, 0, oOutRep.BufferLength); m_oFile.Flush(); } catch (IOException ex) { //Console.WriteLine(ex.ToString()); // The device was removed! throw new HIDDeviceException("Probbaly the device was removed"); } catch(Exception exx) { Console.WriteLine(exx.ToString()); } }
/// <summary> /// Write an output report to the device. /// </summary> /// <param name="oOutRep">Output report to write</param> protected void Write(OutputReport oOutRep) { //int size = Marshal.SizeOf(oOutRep.Buffer); try { //m_oFile.Write(oOutRep.Buffer, 0, (int)oOutRep.BufferLength); oOutRep.Buffer[0] = 1; m_oFile.Write(oOutRep.Buffer, 0, 2); } catch (IOException ex) { //Console.WriteLine(ex.ToString()); // The device was removed! throw new HIDDeviceException("Probbaly the device was removed"); } catch(Exception exx) { Console.WriteLine(exx.ToString()); } }