diff options
author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2020-08-14 11:49:41 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-08-26 15:00:11 +1000 |
commit | a80a146858b3c9a7fbae4030a524666ab19f7a47 (patch) | |
tree | 0de2574a6e87c825fe60212dfc5db374cdd8154f /extmod/btstack/modbluetooth_btstack.c | |
parent | 0bc2c1c1057d7f5c1e4987139062386a8f9fe5f2 (diff) | |
download | micropython-a80a146858b3c9a7fbae4030a524666ab19f7a47.tar.gz micropython-a80a146858b3c9a7fbae4030a524666ab19f7a47.zip |
extmod/bluetooth: Support active scanning in BLE.gap_scan().
This adds an additional optional parameter to gap_scan() to select active
scanning, where scan responses are returned as well as normal scan results.
This parameter is False by default which retains the existing behaviour.
Diffstat (limited to 'extmod/btstack/modbluetooth_btstack.c')
-rw-r--r-- | extmod/btstack/modbluetooth_btstack.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/extmod/btstack/modbluetooth_btstack.c b/extmod/btstack/modbluetooth_btstack.c index 89e396dfd0..8f0c82974c 100644 --- a/extmod/btstack/modbluetooth_btstack.c +++ b/extmod/btstack/modbluetooth_btstack.c @@ -894,7 +894,7 @@ STATIC void scan_duration_timeout_handler(btstack_timer_source_t *ds) { mp_bluetooth_gap_scan_stop(); } -int mp_bluetooth_gap_scan_start(int32_t duration_ms, int32_t interval_us, int32_t window_us) { +int mp_bluetooth_gap_scan_start(int32_t duration_ms, int32_t interval_us, int32_t window_us, bool active_scan) { DEBUG_EVENT_printf("mp_bluetooth_gap_scan_start\n"); if (duration_ms > 0) { @@ -903,8 +903,7 @@ int mp_bluetooth_gap_scan_start(int32_t duration_ms, int32_t interval_us, int32_ btstack_run_loop_add_timer(&scan_duration_timeout); } - // 0 = passive scan (we don't handle scan response). - gap_set_scan_parameters(0, interval_us / 625, window_us / 625); + gap_set_scan_parameters(active_scan ? 1 : 0, interval_us / 625, window_us / 625); gap_start_scan(); return 0; |