From 2e3de0cd0f7cc385904a1803d3c9c946b44a891c Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Fri, 14 Aug 2015 00:29:05 +0200 Subject: [PATCH] Always send out the current state of GBDevice when asking for version In a second step, request the version from the device (and send updated values then) RequestVersionInfo is either a misnomer or misused, depending on your view. It is actually used by activities to get the current state of thde device. We now provide this as quickly as possible, with the drawback of sometimes sending results twice. --- .../gadgetbridge/service/DeviceCommunicationService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java index 1189f1b59..66865a5d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java @@ -149,7 +149,7 @@ public class DeviceCommunicationService extends Service { sharedPrefs.edit().putString("last_device_address", btDeviceAddress).apply(); } - if (btDeviceAddress != null && !isConnected() && !isConnecting()) { + if (btDeviceAddress != null && !isConnecting() && !isConnected()) { if (mDeviceSupport != null) { mDeviceSupport.dispose(); mDeviceSupport = null; @@ -173,10 +173,9 @@ public class DeviceCommunicationService extends Service { } break; case ACTION_REQUEST_VERSIONINFO: + mGBDevice.sendDeviceUpdateIntent(this); if (mGBDevice.getFirmwareVersion() == null) { mDeviceSupport.onFirmwareVersionReq(); - } else { - mGBDevice.sendDeviceUpdateIntent(this); } break; case ACTION_NOTIFICATION_GENERIC: {