altosdroid: Deal with bluetooth connection failures better
authorKeith Packard <keithp@keithp.com>
Sat, 7 Mar 2015 18:18:57 +0000 (10:18 -0800)
committerKeith Packard <keithp@keithp.com>
Sat, 7 Mar 2015 18:18:57 +0000 (10:18 -0800)
commitcdd7ad469728fde178c69b9c99d70d6e0ab3f12d
tree71b2ddf53b89ae50c156c2414570f5a2ef17be64
parentd446c90dab0aca7e501a0228f24c210758d84a1d
altosdroid: Deal with bluetooth connection failures better

Remember when we've closed the bluetooth connection so that we stop
operations, including reporting connection status messages or even
starting a connection attempt.

Pass the AltosBluetooth object back in connection status messages so
that TelemetryService can tell when messages from closed objects get
delivered. There's a queue between the two, so the above fix catches
most of these instances, but not all of them.

Stick a delay during reconnect -- if the TeleBT device is getting
power-cycled, it will need a few seconds to reconfigure the device at
startup, if AltosDroid manages to connect during that time, the
configuration commands will be ignored.

Unlock the AltosBluetooth device while we connect so that cancel
calls will actually work.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java