Hello everyone
Read USB serial met with some questions to ask you
We must get to the data
This data is a hexadecimal
Two numbers for a group
Such as for the first set of data (F8, 71, 80, 81, 6E, 66, 74, 80, 78)?
How do I have to take the data and the data is effectively separated Such as
F87180816E66748078→(F8, 71, 80, 81, 6E, 66, 74, 80, 78)?
Dim usb As UsbSerial
Dim astreams As AsyncStreams
Private bc As ByteConverter
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
btnClose.Enabled = False
btnSend.Enabled = False
End Sub
Sub btnOpen_Click
If usb.UsbPresent = usb.USB_NONE Then
Log("Msgbox - no device")
Msgbox("No USB device or accessory detected!", "Error")
Log("Msgbox - returned")
Return
End If
Log("Checking permission")
If (usb.HasPermission) Then
Msgbox(usb.DeviceInfo, "Device Information")
Dim dev As Int
dev = usb.Open(19200)
If dev <> usb.USB_NONE Then
Log("Connected successfully!")
btnOpen.Enabled = False
btnClose.Enabled = True
btnSend.Enabled = True
astreams.Initialize(usb.GetInputStream, usb.GetOutputStream, "astreams")
Else
Log("Error opening USB port")
End If
Else
usb.RequestPermission
End If
End Sub
You have two options:
1. Use a List and add all the bytes to a list.
2. Use ByteConverter.ArrayCopy. This means that you create a large array and then copy the two arrays to the large one.