extmod/nimble: Clarify active state and check for active in all methods.
This commit ensures that the BLE stack is active before allowing operations that may otherwise crash if it's not active. It also clarifies the state better (adding the "stopping" state) and renames mp_bluetooth_is_enabled to the more self-explanatory mp_bluetooth_is_active.
This commit is contained in:
committed by
Damien George
parent
a017576706
commit
1937fb22ab
@@ -275,7 +275,7 @@ STATIC mp_obj_t bluetooth_ble_active(size_t n_args, const mp_obj_t *args) {
|
||||
}
|
||||
}
|
||||
// Return current state.
|
||||
return mp_obj_new_bool(mp_bluetooth_is_enabled());
|
||||
return mp_obj_new_bool(mp_bluetooth_is_active());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_active_obj, 1, 2, bluetooth_ble_active);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user