示例#1
0
        public void Write(byte[] data, WriteCallback callback)
        {
            WriteDelegate writeDelegate = Write;
            HidAsyncState @object       = new HidAsyncState(writeDelegate, callback);

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

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

            readReportDelegate.BeginInvoke(EndReadReport, @object);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#8
0
        public void Read(ReadCallback callback)
        {
            ReadDelegate  readDelegate = Read;
            HidAsyncState @object      = new HidAsyncState(readDelegate, callback);

            readDelegate.BeginInvoke(EndRead, @object);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#16
0
 public void ReadReport(ReadReportCallback callback)
 {
     var readReportDelegate = new ReadReportDelegate(ReadReport);
     var asyncState = new HidAsyncState(readReportDelegate, callback);
     readReportDelegate.BeginInvoke(EndReadReport, asyncState);
 }
示例#17
0
 public void Read(ReadCallback callback)
 {
     var readDelegate = new ReadDelegate(Read);
     var asyncState = new HidAsyncState(readDelegate, callback);
     readDelegate.BeginInvoke(EndRead, asyncState);
 }