diff --git a/android/bluetooth.c b/android/bluetooth.c
index 3a44dea..2093730 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
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)