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.
This commit is contained in:
cpfeiffer 2015-08-14 00:29:05 +02:00
parent eec7fae288
commit 2e3de0cd0f
1 changed files with 2 additions and 3 deletions

View File

@ -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: {