Beispiel #1
0
 private void ws4000HidPort_OnDataReceived(object sender, UsbLibrary.DataReceivedEventArgs args)
 {
     //if (InvokeRequired)
     //{
     //    try
     //    {
     //        Invoke(new DataReceivedEventHandler(ws4000HidPort_OnDataReceived), new object[] { sender, args });
     //    }
     //    catch (Exception ex)
     //    {
     //        Console.WriteLine(ex.ToString());
     //    }
     //}
     //else
     //{
     //    String value = "";
     //    for (int i = 1; i < 9; i++)
     //    {
     //        value += args.data.Buffer[i].ToString("X2") + " ";
     //    }
     //    lbRead.Items.Add(value);
     //}
 }
Beispiel #2
0
 void handleInputReport(object sender, DataReceivedEventArgs args)
 {
     if (Buffer != null)
     {
         Buffer.add(args.data.Buffer);
         if (Buffer.Full)
         {
             WS4000Buffer buffer = Buffer;
             Buffer = null;
             OnBufferReceived(buffer);
         }
         else if (Buffer.Cursor % 0x20 == 0)
         {
             RequestBuffer request = new RequestBuffer(this);
             request.Offset = Buffer.Cursor;
             request.Send();
         }
     }
 }