I'm trying to speak to a device over bluetooth serial.. this works fine using Putty from my PC, but I am not getting any response on Android. If I remove the check for Ready, the whole thing hangs. It seems I am not getting any data across at all.
Also, since the device I'm talking to is an embedded controller, I am not able to see if the commands are seen on the other side. However, a commercial Android application that also talks to this controller, works fine, so I know the bluetooth-to-serial converter is working.
Any ideas?
Also, since the device I'm talking to is an embedded controller, I am not able to see if the commands are seen on the other side. However, a commercial Android application that also talks to this controller, works fine, so I know the bluetooth-to-serial converter is working.
Any ideas?
B4X:
Sub SendCmd ( Txt As String, len As Int) As String
Dim ret As String
ret = ""
If connected = True Then
ToastMessageShow("Send: " & Txt, False)
TextWriter1.WriteLine(Txt)
TextWriter1.Flush
SleepMs(100)
' wait for response
If (len > 0) Then
If TextReader1.Ready Then
ret = TextReader1.ReadLine
' get rid of the trailing pound sign
ret = ret.Replace("#", "")
ToastMessageShow("Receive: " & ret, False)
Return ret
End If
End If
End If
End Sub