Diff between 5437569d899b2de454eb6af3fe5739fab77403cc and d1f4727b778c24b9fcc257d4404144f04c7af66d

Changed Files

File Additions Deletions Status
android/bluetooth.c +10 -5 modified

Full Patch

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 3a44dea..2093730 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2956,18 +2956,23 @@ bool bt_le_set_advertising(bool advertising, bt_le_set_advertising_done cb,
 
 bool bt_le_discovery_stop(bt_le_discovery_stopped cb)
 {
-	if (!adapter.cur_discovery_type) {
+	if (adapter.cur_discovery_type != SCAN_TYPE_LE) {
 		if (cb)
 			cb();
+
+		gatt_device_found_cb = NULL;
+
 		return true;
 	}
 
-	gatt_discovery_stopped_cb = cb;
-	/* Remove device found callback */
+	if (!stop_discovery(SCAN_TYPE_LE))
+		return false;
+
 	gatt_device_found_cb = NULL;
-	adapter.exp_discovery_type &= ~SCAN_TYPE_LE;
+	gatt_discovery_stopped_cb = cb;
+	adapter.exp_discovery_type = SCAN_TYPE_NONE;
 
-	return stop_discovery(adapter.cur_discovery_type);
+	return true;
 }
 
 bool bt_le_discovery_start(bt_le_device_found cb)