I'm getting some inconsistent behavior in after a Serial.Disconnect call on Bluetooth connections.
Here is the tipical sequence of events:
- Call Serial.Connect(macaddress) with success
- Data exchange happens with no errors using AsyncStreams.Write
- Call Serial.Disconnect
- after a while call again Serial.Connect(macaddress)
after the last step, the outcome may be either one of these, with no apparent condition causing one or the other:
a) connection successful and the previous cycle runs again with no problems
b) java.io.IOException: read failed, socket might closed or timeout, read ret: -1
if the exception in case b) occurs, a power cycle of the remote Bluetooth device will cause the next Connect attempt to succeed, otherwise, no other connections will be established.
note that even if I kill and restart the app, the Connect will fail until the remote device is also reset, so I think the loose end, is at the remote device, not at the phone side.
am I missing some connection closing detail?
Here is the tipical sequence of events:
- Call Serial.Connect(macaddress) with success
- Data exchange happens with no errors using AsyncStreams.Write
- Call Serial.Disconnect
- after a while call again Serial.Connect(macaddress)
after the last step, the outcome may be either one of these, with no apparent condition causing one or the other:
a) connection successful and the previous cycle runs again with no problems
b) java.io.IOException: read failed, socket might closed or timeout, read ret: -1
if the exception in case b) occurs, a power cycle of the remote Bluetooth device will cause the next Connect attempt to succeed, otherwise, no other connections will be established.
note that even if I kill and restart the app, the Connect will fail until the remote device is also reset, so I think the loose end, is at the remote device, not at the phone side.
am I missing some connection closing detail?