Pebble: set device to reconnecting state when actively reconnecting

It makes it easier to watch connection attempts and the delay between them in control center.
here
Andreas Shimokawa 2016-05-29 23:24:16 +02:00
parent f2cbee39f1
commit b71597800a
1 changed files with 3 additions and 0 deletions

View File

@ -364,6 +364,9 @@ public class PebbleIoThread extends GBDeviceIoThread {
mIsConnected = false;
int reconnectAttempts = prefs.getInt("pebble_reconnect_attempts", 10);
if (!mQuit && GBApplication.getGBPrefs().getAutoReconnect() && reconnectAttempts > 0) {
gbDevice.setState(GBDevice.State.WAITING_FOR_RECONNECT);
gbDevice.sendDeviceUpdateIntent(getContext());
int delaySeconds = 1;
while (reconnectAttempts-- > 0 && !mQuit && !mIsConnected) {
LOG.info("Trying to reconnect (attempts left " + reconnectAttempts + ")");