Allow GATT to use Core scan functionality instead doubling this functionality in GATT. --- android/bluetooth.c | 18 ++++++++++++++++++ android/bluetooth.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/android/bluetooth.c b/android/bluetooth.c index 5430c8a..7ab5184 100644 --- a/android/bluetooth.c +++ b/android/bluetooth.c @@ -2506,6 +2506,24 @@ void bt_set_le_discovering_cb(bt_le_discovering_state_cb_t cb) le_discovering_cb = cb; } +bool bt_write_le_scan(bool do_scan) +{ + if (!(adapter.current_settings & MGMT_SETTING_POWERED)) + return false; + + if (adapter.le_discovering == do_scan) + return true; + + /* if core is discovering its interleaved scan, don't bother */ + if (adapter.discovering) + return true; + + if (do_scan) + return start_discovery(SCAN_TYPE_LE); + + return stop_discovery(SCAN_TYPE_LE); +} + static uint8_t set_adapter_scan_mode(const void *buf, uint16_t len) { const uint8_t *mode = buf; diff --git a/android/bluetooth.h b/android/bluetooth.h index 127b9db..9855544 100644 --- a/android/bluetooth.h +++ b/android/bluetooth.h @@ -42,3 +42,5 @@ void bt_set_le_device_found_cb(bt_le_device_found_cb_t cb); typedef void (*bt_le_discovering_state_cb_t)(uint8_t state); void bt_set_le_discovering_cb(bt_le_discovering_state_cb_t cb); + +bool bt_write_le_scan(bool do_scan); -- 1.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html