Esempio n. 1
0
        public void Write(byte[] data, WriteCallback callback)
        {
            WriteDelegate writeDelegate = Write;
            HidAsyncState @object       = new HidAsyncState(writeDelegate, callback);

            writeDelegate.BeginInvoke(data, EndWrite, @object);
        }
Esempio n. 2
0
        public void WriteReport(HidReport report, WriteCallback callback)
        {
            WriteReportDelegate writeReportDelegate = WriteReport;
            HidAsyncState       @object             = new HidAsyncState(writeReportDelegate, callback);

            writeReportDelegate.BeginInvoke(report, EndWriteReport, @object);
        }
Esempio n. 3
0
        public void ReadReport(ReadReportCallback callback)
        {
            ReadReportDelegate readReportDelegate = ReadReport;
            HidAsyncState      @object            = new HidAsyncState(readReportDelegate, callback);

            readReportDelegate.BeginInvoke(EndReadReport, @object);
        }
Esempio n. 4
0
        public void ReadReport(ReadReportCallback callback)
        {
            var readReportDelegate = new ReadReportDelegate(ReadReport);
            var asyncState         = new HidAsyncState(readReportDelegate, callback);

            readReportDelegate.BeginInvoke(EndReadReport, asyncState);
        }
        public void FastReadReport(ReadReportCallback callback, int timeout)
        {
            var readReportDelegate = new ReadReportDelegate(FastReadReport);
            var asyncState         = new HidAsyncState(readReportDelegate, callback);

            readReportDelegate.BeginInvoke(timeout, EndReadReport, asyncState);
        }
Esempio n. 6
0
        public void Write(byte[] data, WriteCallback callback, int timeout)
        {
            var writeDelegate = new WriteDelegate(Write);
            var asyncState    = new HidAsyncState(writeDelegate, callback);

            writeDelegate.BeginInvoke(data, timeout, EndWrite, asyncState);
        }
Esempio n. 7
0
        public void WriteReport(HidReport report, WriteCallback callback, int timeout)
        {
            var writeReportDelegate = new WriteReportDelegate(WriteReport);
            var asyncState          = new HidAsyncState(writeReportDelegate, callback);

            writeReportDelegate.BeginInvoke(report, timeout, EndWriteReport, asyncState);
        }
Esempio n. 8
0
        public void Read(ReadCallback callback)
        {
            ReadDelegate  readDelegate = Read;
            HidAsyncState @object      = new HidAsyncState(readDelegate, callback);

            readDelegate.BeginInvoke(EndRead, @object);
        }
Esempio n. 9
0
        public void Read(ReadCallback callback, int timeout)
        {
            var readDelegate = new ReadDelegate(Read);
            var asyncState   = new HidAsyncState(readDelegate, callback);

            readDelegate.BeginInvoke(timeout, EndRead, asyncState);
        }
Esempio n. 10
0
        private static void EndWriteReport(IAsyncResult ar)
        {
            HidAsyncState       hidAsyncState       = (HidAsyncState)ar.AsyncState;
            WriteReportDelegate writeReportDelegate = (WriteReportDelegate)hidAsyncState.CallerDelegate;
            WriteCallback       writeCallback       = (WriteCallback)hidAsyncState.CallbackDelegate;
            bool success = writeReportDelegate.EndInvoke(ar);

            writeCallback?.Invoke(success);
        }
Esempio n. 11
0
        protected static void EndReadReport(IAsyncResult ar)
        {
            HidAsyncState      hidAsyncState      = (HidAsyncState)ar.AsyncState;
            ReadReportDelegate readReportDelegate = (ReadReportDelegate)hidAsyncState.CallerDelegate;
            ReadReportCallback readReportCallback = (ReadReportCallback)hidAsyncState.CallbackDelegate;
            HidReport          report             = readReportDelegate.EndInvoke(ar);

            readReportCallback?.Invoke(report);
        }
Esempio n. 12
0
        protected static void EndRead(IAsyncResult ar)
        {
            HidAsyncState hidAsyncState = (HidAsyncState)ar.AsyncState;
            ReadDelegate  readDelegate  = (ReadDelegate)hidAsyncState.CallerDelegate;
            ReadCallback  readCallback  = (ReadCallback)hidAsyncState.CallbackDelegate;
            HidDeviceData data          = readDelegate.EndInvoke(ar);

            readCallback?.Invoke(data);
        }
Esempio n. 13
0
 public void FastReadReport(ReadReportCallback callback, int timeout)
 {
     var readReportDelegate = new ReadReportDelegate(FastReadReport);
     var asyncState = new HidAsyncState(readReportDelegate, callback);
     readReportDelegate.BeginInvoke(timeout, EndReadReport, asyncState);
 }
Esempio n. 14
0
 public void WriteReport(HidReport report, WriteCallback callback)
 {
     var writeReportDelegate = new WriteReportDelegate(WriteReport);
     var asyncState = new HidAsyncState(writeReportDelegate, callback);
     writeReportDelegate.BeginInvoke(report, EndWriteReport, asyncState);
 }
Esempio n. 15
0
 public void Write(byte[] data, WriteCallback callback)
 {
     var writeDelegate = new WriteDelegate(Write);
     var asyncState = new HidAsyncState(writeDelegate, callback);
     writeDelegate.BeginInvoke(data, EndWrite, asyncState);
 }
Esempio n. 16
0
 public void ReadReport(ReadReportCallback callback)
 {
     var readReportDelegate = new ReadReportDelegate(ReadReport);
     var asyncState = new HidAsyncState(readReportDelegate, callback);
     readReportDelegate.BeginInvoke(EndReadReport, asyncState);
 }
Esempio n. 17
0
 public void Read(ReadCallback callback)
 {
     var readDelegate = new ReadDelegate(Read);
     var asyncState = new HidAsyncState(readDelegate, callback);
     readDelegate.BeginInvoke(EndRead, asyncState);
 }