From 274e8591dc9dec09058edc2e84fe1ee1f09b4cf9 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Wed, 22 Apr 2015 22:50:35 +0200 Subject: [PATCH] Initialize the BTLE device after the services are discovered. This hopefully helps with the MI Band automatically disconnecting. --- .../gadgetbridge/btle/AbstractBTLEDeviceSupport.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/btle/AbstractBTLEDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/btle/AbstractBTLEDeviceSupport.java index 11c22d6d..382253d5 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/btle/AbstractBTLEDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/btle/AbstractBTLEDeviceSupport.java @@ -1,10 +1,5 @@ package nodomain.freeyourgadget.gadgetbridge.btle; -import android.bluetooth.BluetoothGatt; -import android.bluetooth.BluetoothGattCharacteristic; -import android.bluetooth.BluetoothGattService; -import android.util.Log; - import java.io.IOException; import java.util.HashMap; import java.util.HashSet; @@ -13,6 +8,11 @@ import java.util.Set; import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.AbstractDeviceSupport; +import android.bluetooth.BluetoothGatt; +import android.bluetooth.BluetoothGattCharacteristic; +import android.bluetooth.BluetoothGattService; +import android.bluetooth.BluetoothProfile; +import android.util.Log; /** * @see TransactionBuilder @@ -153,6 +153,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im @Override public void onServicesDiscovered(BluetoothGatt gatt) { gattServicesDiscovered(getQueue().getSupportedGattServices()); + initializeDevice(new TransactionBuilder("Initializing device")).queue(getQueue()); } @Override @@ -170,6 +171,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im BluetoothGattCharacteristic characteristic) { } + @Override public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) { } }