hci: use hci_le_extended_create_connection if supported for non-whitelist connections

This commit is contained in:
Matthias Ringwald 2022-04-01 16:59:47 +02:00
parent ff9f995df8
commit e90f848d38

View File

@ -5653,20 +5653,49 @@ static bool hci_run_general_pending_commands(void){
log_info("sending hci_le_create_connection");
hci_stack->le_connection_own_addr_type = hci_stack->le_own_addr_type;
hci_get_own_address_for_addr_type(hci_stack->le_connection_own_addr_type, hci_stack->le_connection_own_address);
hci_send_cmd(&hci_le_create_connection,
hci_stack->le_connection_scan_interval, // conn scan interval
hci_stack->le_connection_scan_window, // conn scan windows
0, // don't use whitelist
connection->address_type, // peer address type
connection->address, // peer bd addr
hci_stack->le_connection_own_addr_type, // our addr type:
hci_stack->le_connection_interval_min, // conn interval min
hci_stack->le_connection_interval_max, // conn interval max
hci_stack->le_connection_latency, // conn latency
hci_stack->le_supervision_timeout, // conn latency
hci_stack->le_minimum_ce_length, // min ce length
hci_stack->le_maximum_ce_length // max ce length
);
#ifdef ENABLE_LE_EXTENDED_ADVERTISING
if (hci_extended_advertising_supported()) {
uint16_t le_connection_scan_interval[1] = { hci_stack->le_connection_scan_interval };
uint16_t le_connection_scan_window[1] = { hci_stack->le_connection_scan_window };
uint16_t le_connection_interval_min[1] = { hci_stack->le_connection_interval_min };
uint16_t le_connection_interval_max[1] = { hci_stack->le_connection_interval_max };
uint16_t le_connection_latency[1] = { hci_stack->le_connection_latency };
uint16_t le_supervision_timeout[1] = { hci_stack->le_supervision_timeout };
uint16_t le_minimum_ce_length[1] = { hci_stack->le_minimum_ce_length };
uint16_t le_maximum_ce_length[1] = { hci_stack->le_maximum_ce_length };
hci_send_cmd(&hci_le_extended_create_connection,
0, // don't use whitelist
hci_stack->le_connection_own_addr_type, // our addr type:
connection->address_type, // peer address type
connection->address, // peer bd addr
1, // initiating PHY - 1M
le_connection_scan_interval, // conn scan interval
le_connection_scan_window, // conn scan windows
le_connection_interval_min, // conn interval min
le_connection_interval_max, // conn interval max
le_connection_latency, // conn latency
le_supervision_timeout, // conn latency
le_minimum_ce_length, // min ce length
le_maximum_ce_length // max ce length
); }
else
#endif
{
hci_send_cmd(&hci_le_create_connection,
hci_stack->le_connection_scan_interval, // conn scan interval
hci_stack->le_connection_scan_window, // conn scan windows
0, // don't use whitelist
connection->address_type, // peer address type
connection->address, // peer bd addr
hci_stack->le_connection_own_addr_type, // our addr type:
hci_stack->le_connection_interval_min, // conn interval min
hci_stack->le_connection_interval_max, // conn interval max
hci_stack->le_connection_latency, // conn latency
hci_stack->le_supervision_timeout, // conn latency
hci_stack->le_minimum_ce_length, // min ce length
hci_stack->le_maximum_ce_length // max ce length
);
}
connection->state = SENT_CREATE_CONNECTION;
#endif
#endif