My application connects an Android device via bluetooth.
The application works fine when the device is connected with the application start.
But when, in between the connectivity is lost and is reconnected... eventhough the commands are being send, I am not able to receive any response back from the Async streams. Instead Async_error is received.
Can you please help me to figure out the cause of the error.
Below is my code for connecting with the device :
Below is my code for Sending commands :
The application works fine when the device is connected with the application start.
But when, in between the connectivity is lost and is reconnected... eventhough the commands are being send, I am not able to receive any response back from the Async streams. Instead Async_error is received.
Can you please help me to figure out the cause of the error.
Below is my code for connecting with the device :
B4X:
Sub Reader_Connected (Success As Boolean)
If Success Then
ReaderStatus.IsConnected = True
BStream.Initialize(BTConnection.InputStream, BTConnection.OutputStream, "BStreams")
Else
ReaderStatus.IsConnected = False
End If
End Sub
Below is my code for Sending commands :
B4X:
Public Sub SendCommand(Cmd As String)
Starter.RBuffer = ""
Dim buf As String = Cmd & CRLF
Dim by() As Byte = buf.GetBytes("UTF7" )
Starter.BStream.Write(by)
End Sub
Last edited: