mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-27 14:37:12 +00:00
sm: extract sm_run_ready
This commit is contained in:
parent
e82ac897a0
commit
f99c988a5b
19
src/ble/sm.c
19
src/ble/sm.c
@ -2806,17 +2806,24 @@ static bool sm_run_non_connection_logic(void){
|
|||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm_run(void){
|
static bool sm_run_ready(void) {
|
||||||
|
// assert that stack has already booted
|
||||||
// assert that stack has already bootet
|
if (hci_get_state() != HCI_STATE_WORKING) return false;
|
||||||
if (hci_get_state() != HCI_STATE_WORKING) return;
|
|
||||||
|
|
||||||
// assert that we can send at least commands
|
// assert that we can send at least commands
|
||||||
if (!hci_can_send_command_packet_now()) return;
|
if (!hci_can_send_command_packet_now()) return false;
|
||||||
|
|
||||||
// pause until IR/ER are ready
|
// pause until IR/ER are ready
|
||||||
if (sm_persistent_keys_random_active) return;
|
if (sm_persistent_keys_random_active) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sm_run(void){
|
||||||
|
|
||||||
|
// ready
|
||||||
|
if (sm_run_ready() == false) return;
|
||||||
|
|
||||||
// non-connection related behaviour
|
// non-connection related behaviour
|
||||||
bool done = sm_run_non_connection_logic();
|
bool done = sm_run_non_connection_logic();
|
||||||
if (done) return;
|
if (done) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user