From 262237bcbf008d09418d62693fa2c04ba4f250dc Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Thu, 3 May 2018 23:11:26 +0200 Subject: [PATCH] Revert "Stop LE scan when services have been discovered" This reverts commit d9b8c6253f975a571e3e089fc243280cb0f743e8. --- .../core/bluetooth/BluetoothCommunication.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java index f2a5f31e..fd5ce18d 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java @@ -521,6 +521,11 @@ public abstract class BluetoothCommunication { Timber.d("onConnectionStateChange: status=%d, newState=%d", status, newState); if (newState == BluetoothProfile.STATE_CONNECTED) { + if (leScanCallback != null) { + btAdapter.stopLeScan(leScanCallback); + leScanCallback = null; + } + connectionEstablished = true; setBtStatus(BT_STATUS_CODE.BT_CONNECTION_ESTABLISHED); gatt.discoverServices(); @@ -537,11 +542,6 @@ public abstract class BluetoothCommunication { public void onServicesDiscovered(final BluetoothGatt gatt, int status) { Timber.d("onServicesDiscovered: status=%d", status); - if (leScanCallback != null) { - btAdapter.stopLeScan(leScanCallback); - leScanCallback = null; - } - synchronized (lock) { cmdStepNr = 0; initStepNr = 0;