Android Question How to effectively extract the USB serial data?

Yang-Yi Chen

Member
Licensed User
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)?

How do I turn these numbers into decimal?

Trouble you help answer
 

Yang-Yi Chen

Member
Licensed User
Sub Process_Globals

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
 
Upvote 0

Yang-Yi Chen

Member
Licensed User
I want to be able to get any value of the Buffer

If converted into hexadecimal data are also linked together


I hope the data can be separated value or Array



→ 77,73,76,...................................................................... 77
and
hex to decimal

→ 119,115,118...................................................................119


Trouble you help me solve these problems
Thank you
 
Upvote 0

Yang-Yi Chen

Member
Licensed User
ThanK you

Please allow me to ask some questions
If I want to string together Buffer or Array

How do I complete?

E.g


AX=[116,113,105.......................................................................-15,30]
AY=[-8,115,122..........................................................................105,120]

I want to..

AZ=[AX,AY]
=[116,113,105.............................................................................-15,30,-8,-115,122....................................105,120]
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…