OK, after a good night's sleep, I've got a solution, although I still don't know why the strings are out of sequence in the BLECentral textbox, I can now extract the whole 52-byte string in the correct order with just a small tweak of Erel's original code.
B4X:
Private Sub Manager_DataAvailable (SId As String, Characteristics As Map)
If firstRead Then
manager.SetNotify(ServiceId, ReadChar, True)
firstRead = False
Return
End If
Dim b() As Byte = Characteristics.Get(ReadChar)
NewMessage(b)
End Sub
Sub NewMessage (Data() As Byte)
Basket = Basket & BytesToString(Data, 0, Data.Length, "utf8")
Log(Basket) 'Hooray!
txtLogs.Text = Basket & CRLF 'Hooray!
End Sub
Unfortunately, this will not work as is, because the string "Basket" will continue to grow as the new data gets concatenated onto the end, I need to find a way to parse the string as soon as the 0x0D0A (CRLF) bytes that are in the transmitted string are received, then clear the "Basket" string ready for more data.
There should be 2 new rules added to the Forum rules - "Sleep before posting", and "Test your 'solution' before posting".
Update: Now works by testing for a line feed. If one is found, the parsing subroutine is called to process the buffer string "Basket" which then clears the buffer, ready to build the next message string.
B4X:
Sub NewMessage (Data() As Byte)
Basket= Basket & BytesToString(Data, 0, Data.Length, "utf8")
For Pos = 0 To Data.Length - 1
If Data(Pos) = 10 Then
If Basket.Length > 2 Then
Parse
End If
End If
Next
End Sub