Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Handle data transfers on the control channel.  This method places data on the control channel for devices
 /// that do not support the interupt transfers
 /// </summary>
 /// <param name="report">The outbound HID report</param>
 /// <returns>The result of the tranfer request: true if successful otherwise false</returns>
 ///
 public bool WriteReportSync(HidReport report)
 {
     if (null != report)
     {
         byte[] buffer = report.GetBytes();
         return(NativeMethods.HidD_SetOutputReport(Handle, buffer, buffer.Length));
     }
     else
     {
         throw new ArgumentException("The output report is null, it must be allocated before you call this method", "report");
     }
 }
Ejemplo n.º 3
0
        public async Task <bool> WriteReportAsync(HidReport report, int timeout = 0)
        {
            var writeReportDelegate = new WriteReportDelegate(WriteReport);

            return(await Task <bool> .Factory.FromAsync(writeReportDelegate.BeginInvoke, writeReportDelegate.EndInvoke, report, timeout, null));
        }
Ejemplo n.º 4
0
 public void WriteReport(HidReport report, WriteCallback callback)
 {
     WriteReport(report, callback, 0);
 }
Ejemplo n.º 5
0
 public bool WriteReport(HidReport report, int timeout)
 {
     return(Write(report.GetBytes(), timeout));
 }
Ejemplo n.º 6
0
 public bool WriteReport(HidReport report)
 {
     return(WriteReport(report, 0));
 }