summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/modbluetooth.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/modbluetooth.c')
-rw-r--r--extmod/modbluetooth.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/extmod/modbluetooth.c b/extmod/modbluetooth.c
index 730c288ee7..82efe49385 100644
--- a/extmod/modbluetooth.c
+++ b/extmod/modbluetooth.c
@@ -609,6 +609,7 @@ STATIC mp_obj_t bluetooth_ble_gap_scan(size_t n_args, const mp_obj_t *args) {
mp_int_t duration_ms = 0;
mp_int_t interval_us = 1280000;
mp_int_t window_us = 11250;
+ bool active_scan = false;
if (n_args > 1) {
if (args[1] == mp_const_none) {
// scan(None) --> stop scan.
@@ -619,12 +620,15 @@ STATIC mp_obj_t bluetooth_ble_gap_scan(size_t n_args, const mp_obj_t *args) {
interval_us = mp_obj_get_int(args[2]);
if (n_args > 3) {
window_us = mp_obj_get_int(args[3]);
+ if (n_args > 4) {
+ active_scan = mp_obj_is_true(args[4]);
+ }
}
}
}
- return bluetooth_handle_errno(mp_bluetooth_gap_scan_start(duration_ms, interval_us, window_us));
+ return bluetooth_handle_errno(mp_bluetooth_gap_scan_start(duration_ms, interval_us, window_us, active_scan));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_scan_obj, 1, 4, bluetooth_ble_gap_scan);
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_scan_obj, 1, 5, bluetooth_ble_gap_scan);
#endif // MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
STATIC mp_obj_t bluetooth_ble_gap_disconnect(mp_obj_t self_in, mp_obj_t conn_handle_in) {