Explicit disconnect during recovery.
BT connection might still be there, but no menu updates coming in. Thus, explicitely close the connection before attempting to reconnect.
This commit is contained in:
parent
a85da1d9ec
commit
5f4a90d068
1 changed files with 6 additions and 0 deletions
|
@ -282,8 +282,14 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
// on connection loss try to reconnect, confirm warning alerts caused by
|
// on connection loss try to reconnect, confirm warning alerts caused by
|
||||||
// the disconnected and then return the command as failed (the caller
|
// the disconnected and then return the command as failed (the caller
|
||||||
// can retry if needed).
|
// can retry if needed).
|
||||||
|
log.debug("Connection unusable, aborting command and attempting reconnect ...");
|
||||||
cmdThread.interrupt();
|
cmdThread.interrupt();
|
||||||
activeCmd.getResult().success = false;
|
activeCmd.getResult().success = false;
|
||||||
|
|
||||||
|
// the BT connection might be still there, but we might not be receiving
|
||||||
|
// menu updates, so force a disconnect before connecting again
|
||||||
|
disconnect();
|
||||||
|
SystemClock.sleep(500);
|
||||||
for (int attempts = 2; attempts > 0; attempts--) {
|
for (int attempts = 2; attempts > 0; attempts--) {
|
||||||
boolean reconnected = recoverFromConnectionLoss();
|
boolean reconnected = recoverFromConnectionLoss();
|
||||||
if (reconnected) {
|
if (reconnected) {
|
||||||
|
|
Loading…
Reference in a new issue