Hi,
i want to receive a string every second form a bluetooth device.
The string looks like this:
#231;30895;21440;1837;1685;49;252;1;28;28;28;28;126;3242*
I use this to initialize Astrem
AStreams Buffer
i want to use the variable "received_data" to store the received string.
and than i want to split the received string #231;30895;21440;1837;1685;49;252;1;28;28;28;28;126;3242*
in variable1 = 231, varialble2 = 30895 and so on....
But the problem is:
i receive the string splitted. First i receive # then 231;30895;21440; and then 1837;1685;49;252;1;28;28;28;28;126;3242*.
i don't now why it is splitted.
so I have to put the strings together but how?
or is it possible to receive the string complete?
Maybe someone has an idea??????
thanks
i want to receive a string every second form a bluetooth device.
The string looks like this:
#231;30895;21440;1837;1685;49;252;1;28;28;28;28;126;3242*
I use this to initialize Astrem
B4X:
Sub Serial1_Connected (Success As Boolean)
If Success Then
ToastMessageShow("Connected successfully", False)
ListView1.AddSingleLine("verbunden")
'StartActivity(bluetooth)
If AStream.IsInitialized = False Then
AStream.Initialize(serial1.InputStream, serial1.OutputStream, "AStreams")
End If
Else
Msgbox(LastException.Message, "Error connecting.")
End If
End Sub
AStreams Buffer
B4X:
Sub AStreams_NewData (Buffer() As Byte)
LogMessage("", BytesToString(Buffer, 0, Buffer.Length, "ASCII"))
End Sub
B4X:
Sub LogMessage(From As String, Msg As String)
'txtLog.Text = txtLog.Text & From & ": " & Msg & CRLF
'txtLog.SelectionStart = txtLog.Text.Length
txtLog.Text = txtLog.Text & Msg & CRLF
txtLog.SelectionStart = txtLog.Text.Length
received_data = Msg
End Sub
i want to use the variable "received_data" to store the received string.
and than i want to split the received string #231;30895;21440;1837;1685;49;252;1;28;28;28;28;126;3242*
in variable1 = 231, varialble2 = 30895 and so on....
But the problem is:
i receive the string splitted. First i receive # then 231;30895;21440; and then 1837;1685;49;252;1;28;28;28;28;126;3242*.
i don't now why it is splitted.
so I have to put the strings together but how?
or is it possible to receive the string complete?
Maybe someone has an idea??????
thanks