Make ControlCenter only ask for version details after device is initialized

This allows removal of a workaround which allowed ACTION_REQUEST_VERSIONINFO
to be used in connected state (instead of initialized state)
This commit is contained in:
Andreas Shimokawa 2015-08-07 22:07:48 +02:00
parent fe11e6d306
commit 27f88e484d
2 changed files with 9 additions and 9 deletions

View File

@ -29,16 +29,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity;
import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAdapter;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class ControlCenter extends Activity {
@ -83,8 +83,8 @@ public class ControlCenter extends Activity {
refreshBusyState(dev);
if (dev.isConnected() && dev.getFirmwareVersion() == null && !dev.isInitializing()) {
LOG.info("device connected, requesting more info");
if (dev.isInitialized() && dev.getFirmwareVersion() == null) {
LOG.info("device initalized, requesting more info");
requestDeviceInfo();
}
break;

View File

@ -123,7 +123,7 @@ public class DeviceCommunicationService extends Service {
return START_NOT_STICKY;
}
if ((mDeviceSupport == null) || (!(isConnected() && action.equals(ACTION_REQUEST_VERSIONINFO)) && !isInitialized() && !mDeviceSupport.useAutoConnect())) {
if (mDeviceSupport == null || (!isInitialized() && !mDeviceSupport.useAutoConnect())) {
// trying to send notification without valid Bluetooth connection
if (mGBDevice != null) {
// at least send back the current device state