Android Question Bluetooth - not receiving anything

Orly Andico

Member
Licensed User
Longtime User
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?

Code: Copy
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
 
... even for serial emulators? the controller i'm talking to requires synchronous calls, e.g. if i send a command, i had better get a response. not sure how i can implement that with asyncstreams...
 
Upvote 0
Back
Top