fix build with ENABLE_BLE and without ENABLE_CENTRAL

This commit is contained in:
Matthias Ringwald 2021-09-15 09:52:05 +02:00
parent 8cc1507e0f
commit b892db1cf5
2 changed files with 8 additions and 3 deletions

View File

@ -3722,15 +3722,20 @@ static void sm_event_packet_handler (uint8_t packet_type, uint16_t channel, uint
sm_conn->sm_cid = L2CAP_CID_SECURITY_MANAGER_PROTOCOL;
// track our addr used for this connection and set state
if (hci_subevent_le_connection_complete_get_role(packet)){
#ifdef ENABLE_LE_CENTRAL
if (hci_subevent_le_connection_complete_get_role(packet) != 0){
// responder - use own address from advertisements
gap_le_get_own_advertisements_address(&sm_conn->sm_own_addr_type, sm_conn->sm_own_address);
sm_conn->sm_engine_state = SM_RESPONDER_IDLE;
} else {
}
#endif
#ifdef ENABLE_LE_CENTRAL
if (hci_subevent_le_connection_complete_get_role(packet) == 0){
// initiator - use own address from create connection
gap_le_get_own_connection_address(&sm_conn->sm_own_addr_type, sm_conn->sm_own_address);
sm_conn->sm_engine_state = SM_INITIATOR_CONNECTED;
}
#endif
break;
case HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST:

View File

@ -4591,7 +4591,7 @@ static bool hci_run_general_gap_le(void){
if (hci_stack->le_advertisements_enabled_for_current_roles && !hci_stack->le_advertisements_active){
// check if advertisements should be enabled given
hci_stack->le_advertisements_active = true;
hci_get_own_address_for_addr_type(hci_stack->le_connection_own_addr_type, hci_stack->le_advertisements_own_address);
hci_get_own_address_for_addr_type(hci_stack->le_advertisements_own_addr_type, hci_stack->le_advertisements_own_address);
hci_send_cmd(&hci_le_set_advertise_enable, 1);
return true;
}