Open GoogleCodeExporter opened 8 years ago
Public C2 As New USBHIDDRIVER.USBInterface("vid_1781", "pid_07d0")
Public USBbuff(64) As Byte
C2.enableUsbBufferEvent(New System.EventHandler(AddressOf HIDEvent))
Public Sub HIDEvent()
Dim x As Integer
'Console.WriteLine("Event Caught")
If USBHIDDRIVER.USBInterface.usbBuffer.Count > 0 Then
Console.WriteLine("Event Caught: Buffer Count =" & USBHIDDRIVER.USBInterface.usbBuffer.Count)
While USBHIDDRIVER.USBInterface.usbBuffer.Count > 0
USBbuff = USBHIDDRIVER.USBInterface.usbBuffer(0)
USBHIDDRIVER.USBInterface.usbBuffer.RemoveAt(0)
End While
Else
Console.WriteLine("Event Caught: No Items")
End If
End Sub
Original comment by GeoffCal...@gmail.com
on 23 Jan 2013 at 10:24
Public Sub HIDEvent()
While USBHIDDRIVER.USBInterface.usbBuffer.Count > 0
USBbuff = USBHIDDRIVER.USBInterface.usbBuffer(0)
SyncLock (USBHIDDRIVER.USBInterface.usbBuffer.SyncRoot)
USBHIDDRIVER.USBInterface.usbBuffer.RemoveAt(0)
End SyncLock
DataRecieved(USBbuff)
End While
End Sub
Delegate Sub DataRecievedCallback(UsbIN() As Byte)
Private Sub DataRecieved(ByVal UsbIN() As Byte)
Dim x As Integer
If Me.TextBox_Cell.InvokeRequired Then
Dim d As New DataRecievedCallback(AddressOf DataRecieved)
Me.Invoke(d, New Object() {UsbIN})
Else
//Process your data of UsbIN here
End If
End Sub
I am still having an issue where if a lot of packets come in from the device, I
will lose some of them. Is there anyway to make sure no packets get lost.
Original comment by GeoffCal...@gmail.com
on 25 Jan 2013 at 1:58
Original issue reported on code.google.com by
rnsb...@gmail.com
on 10 May 2012 at 4:41