From ced597c07c2ba855589a13db5c3015da7788ff71 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Sat, 26 May 2018 23:07:04 +0200 Subject: [PATCH] Log and handle discoverServices() returning false --- .../openscale/core/bluetooth/BluetoothCommunication.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 7e759c84..777bb64d 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 @@ -553,7 +553,11 @@ public abstract class BluetoothCommunication { catch (Exception e) { // Empty } - gatt.discoverServices(); + if (!gatt.discoverServices()) { + Timber.e("Could not start service discovery"); + setBtStatus(BT_STATUS_CODE.BT_CONNECTION_LOST); + disconnect(false); + } } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { setBtStatus(connectionEstablished