hci: emit GAP_SUBEVENT_LE_CONNECTION_COMPLETE for gap_connect_cancel

This commit is contained in:
Matthias Ringwald 2023-11-22 17:48:38 +01:00
parent a921243761
commit ebd1b97964
2 changed files with 20 additions and 15 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Unreleased
### Added
- GAP: generic GAP_SUBEVENT_LE_CONNECTION_COMPLETE
- L2CAP: additional authorization_required param in l2cap_ecbm_register_service
- GATT Client: support GATT over Enhanced LE Bearer
- GATT Server: support GATT over Enhanced LE Bearer
@ -42,7 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- GATT Client: ignore notifications/indications until re-encrypted for bonded device without ENABLE_LE_PROACTIVE_AUTHENTICATION
- btstack_flash_bank: support alignment larger than 4
- windows: fix timestamps in packet logs
-
### Changed
- HCI: simplified implicit SCO flow control
- HCI: return ERROR_CODE_COMMAND_DISALLOWED for outgoing connections in gap_connect

View File

@ -7891,20 +7891,24 @@ static void hci_emit_l2cap_check_timeout(hci_connection_t *conn){
#ifdef ENABLE_BLE
#ifdef ENABLE_LE_CENTRAL
static void hci_emit_le_connection_complete(uint8_t address_type, const bd_addr_t address, hci_con_handle_t con_handle, uint8_t status){
uint8_t event[21];
event[0] = HCI_EVENT_LE_META;
event[1] = sizeof(event) - 2u;
event[2] = HCI_SUBEVENT_LE_CONNECTION_COMPLETE;
event[3] = status;
little_endian_store_16(event, 4, con_handle);
event[6] = 0; // TODO: role
event[7] = address_type;
reverse_bd_addr(address, &event[8]);
little_endian_store_16(event, 14, 0); // interval
little_endian_store_16(event, 16, 0); // latency
little_endian_store_16(event, 18, 0); // supervision timeout
event[20] = 0; // master clock accuracy
hci_emit_event(event, sizeof(event), 1);
uint8_t hci_event[21];
hci_event[0] = HCI_EVENT_LE_META;
hci_event[1] = sizeof(hci_event) - 2u;
hci_event[2] = HCI_SUBEVENT_LE_CONNECTION_COMPLETE;
hci_event[3] = status;
little_endian_store_16(hci_event, 4, con_handle);
hci_event[6] = 0; // TODO: role
hci_event[7] = address_type;
reverse_bd_addr(address, &hci_event[8]);
little_endian_store_16(hci_event, 14, 0); // interval
little_endian_store_16(hci_event, 16, 0); // latency
little_endian_store_16(hci_event, 18, 0); // supervision timeout
hci_event[20] = 0; // master clock accuracy
hci_emit_event(hci_event, sizeof(hci_event), 1);
// emit GAP event, too
uint8_t gap_event[36];
hci_create_gap_connection_complete_event(hci_event, gap_event);
hci_emit_event(gap_event, sizeof(gap_event), 1);
}
#endif
#endif