mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-06 21:40:04 +00:00
gap: use bool for gap_reconnect_security_setup_active
This commit is contained in:
parent
bc6a318f21
commit
c7ceba5914
14
src/ble/sm.c
14
src/ble/sm.c
@ -5472,26 +5472,26 @@ void gap_advertisements_set_params(uint16_t adv_int_min, uint16_t adv_int_max, u
|
||||
}
|
||||
#endif
|
||||
|
||||
int gap_reconnect_security_setup_active(hci_con_handle_t con_handle){
|
||||
bool gap_reconnect_security_setup_active(hci_con_handle_t con_handle){
|
||||
sm_connection_t * sm_conn = sm_get_connection_for_handle(con_handle);
|
||||
// wrong connection
|
||||
if (!sm_conn) return 0;
|
||||
if (!sm_conn) return false;
|
||||
// already encrypted
|
||||
if (sm_conn->sm_connection_encrypted) return 0;
|
||||
if (sm_conn->sm_connection_encrypted) return false;
|
||||
// irk status?
|
||||
switch(sm_conn->sm_irk_lookup_state){
|
||||
case IRK_LOOKUP_FAILED:
|
||||
// done, cannot setup encryption
|
||||
return 0;
|
||||
return false;
|
||||
case IRK_LOOKUP_SUCCEEDED:
|
||||
break;
|
||||
default:
|
||||
// IR Lookup pending
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
// IRK Lookup Succeeded, re-encryption should be initiated. When done, state gets reset or indicates failure
|
||||
if (sm_conn->sm_engine_state == SM_GENERAL_REENCRYPTION_FAILED) return 0;
|
||||
if (sm_conn->sm_role){
|
||||
if (sm_conn->sm_engine_state == SM_GENERAL_REENCRYPTION_FAILED) return false;
|
||||
if (sm_conn->sm_role != 0){
|
||||
return sm_conn->sm_engine_state != SM_RESPONDER_IDLE;
|
||||
} else {
|
||||
return sm_conn->sm_engine_state != SM_INITIATOR_CONNECTED;
|
||||
|
@ -1409,7 +1409,7 @@ void gap_le_get_own_connection_address(uint8_t * addr_type, bd_addr_t addr);
|
||||
* @param con_handle
|
||||
* @return 1 if security setup is active
|
||||
*/
|
||||
int gap_reconnect_security_setup_active(hci_con_handle_t con_handle);
|
||||
bool gap_reconnect_security_setup_active(hci_con_handle_t con_handle);
|
||||
|
||||
/**
|
||||
* @brief Delete bonding information for remote device
|
||||
|
Loading…
x
Reference in New Issue
Block a user