I have some code that is processing incoming strings from a bluetooth connection. Each string starts with STX chr(2) and ends with ETX chr(3) followed by a 2 byte checksum.
problem is inETX is always zero even though i can see from the logging that the string contains 1 or more STX characters. inETX gets the correct value.
I'm new to b4a though proficient with VB6 and zbasic so its probably just a newbie error - any help much appreciated.
B4X:
msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
strRCV=strRCV & msg
inSTX=strRCV.IndexOf(Chr(2))
inETX=strRCV.IndexOf(Chr(3))
Log("Got=" & msg)
Log("RCV=" & strRCV)
Log(inSTX & "," & inETX & "," & strRCV.Length)
I'm new to b4a though proficient with VB6 and zbasic so its probably just a newbie error - any help much appreciated.