gap: use bool for gap_reconnect_security_setup_active

This commit is contained in:
Matthias Ringwald 2023-12-04 18:03:21 +01:00
parent bc6a318f21
commit c7ceba5914
2 changed files with 8 additions and 8 deletions

View File

@ -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;

View File

@ -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