Private Sub AStream_NewData (Buffer() As Byte)
Private temp(6) As Byte
Private i As Int
Log(Buffer(1))
Log(conv.hexFromBytes(Buffer))
If Buffer.Length = 7 Then
'This is a message containing a battery charge value and sensor data
'I can display these bytes using HexFromBytes
CallSub2(ChatActivity, "NewMessage", conv.HexFromBytes(Buffer))
Else
For i = 0 To 5
temp(i) = Buffer(i)
Next
'This line displays the mac address of the device
CallSub2(ChatActivity, "NewMessage", conv.HexFromBytes(temp))
'and the next line displays the ascii part of the message (program name and version).
CallSub2(ChatActivity, "NewMessage", BytesToString(Buffer, 6, Buffer.Length-6, "UTF8"))
End If
End Sub