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.
This commit is contained in:
committed by
Damien George
parent
0bc2c1c105
commit
a80a146858
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user