From 367f900ba5c49e4c405eef0348dcf6e946c96f37 Mon Sep 17 00:00:00 2001 From: Philip Peitsch Date: Tue, 19 Jul 2022 15:20:24 +1000 Subject: [PATCH] Clean up callbacks when reporting service discovery failure and disconnecting peripheralDisconnected better handles callback cleanups and autoconnect behaviours. --- src/android/Peripheral.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/android/Peripheral.java b/src/android/Peripheral.java index cf56bca8..64cb2ca8 100644 --- a/src/android/Peripheral.java +++ b/src/android/Peripheral.java @@ -387,10 +387,9 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) { if (refreshCallback != null) { refreshCallback.error(this.asJSONObject("Service discovery failed")); refreshCallback = null; - } else { - connectCallback.error(this.asJSONObject("Service discovery failed")); - disconnect(); } + + peripheralDisconnected("Service discovery failed"); } }