Android Question Bluetooth AStream Problem

GaNdAlF89

Active Member
Licensed User
Longtime User
Hi, I have a strange case during the reading of a qrcode. The string correspondig to the qrcode is

B4X:
0990000001100200150092015091520150915001001151511192382

But when I read the qrcode, the string is broken in two parts (as follows in the code), and the AStreamReader_NewData is raised two times. Why this?

B4X:
'Declarations
Dim BTAdminReader As BluetoothAdmin
Dim BTSerialReader As Serial
Dim AStreamReader As AsyncStreams
Dim BlueMacReader As String
Dim BluePortReader As Int

'Connection
BTSerialReader.ConnectInsecure(BTAdminReader,BlueMacReader,BluePortReader)
'Connect, Connect2 and Connect3 doesn't work

Sub BTSerialReader_Connected (Success As Boolean)

  If Success = True Then 'Succes is correctly True
    AStreamReader.Initialize(BTSerialReader.InputStream,Null,"BluetoothAStreamReader")
  End if

End Sub

Sub BluetoothAStreamReader_NewData (Buffer() As Byte)

    Dim bConv As ByteConverter

    Dim BluetoothReaderResponse As String
    BluetoothReaderResponse = bConv.StringFromBytes(Buffer,"UTF8")

    Log(BluetoothReaderResponse) '(***)

End Sub

'This is the result of (***)
099000
0001100200150092015091520150915001001151511192382

OR

09900000
01100200150092015091520150915001001151511192382
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…