From 7dd97f73d8466760bc9f80b3e399f259a8f56350 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 22 Sep 2023 11:24:17 +0200 Subject: [PATCH] hci: track more cis connection info --- src/hci.c | 21 +++++++++++++++++---- src/hci.h | 6 ++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/hci.c b/src/hci.c index 9f4f39811..5bd9b9229 100644 --- a/src/hci.c +++ b/src/hci.c @@ -4274,9 +4274,15 @@ static void event_handler(uint8_t *packet, uint16_t size){ uint8_t status = hci_subevent_le_cis_established_get_status(packet); iso_stream = hci_iso_stream_for_con_handle(handle); btstack_assert(iso_stream != NULL); - // track SDU - iso_stream->max_sdu_c_to_p = hci_subevent_le_cis_established_get_max_pdu_c_to_p(packet); - iso_stream->max_sdu_p_to_c = hci_subevent_le_cis_established_get_max_pdu_p_to_c(packet); + // track connection info + iso_stream->number_of_subevents = hci_subevent_le_cis_established_get_nse(packet); + iso_stream->burst_number_c_to_p = hci_subevent_le_cis_established_get_bn_c_to_p(packet); + iso_stream->burst_number_p_to_c = hci_subevent_le_cis_established_get_bn_p_to_c(packet); + iso_stream->flush_timeout_c_to_p = hci_subevent_le_cis_established_get_ft_c_to_p(packet); + iso_stream->flush_timeout_p_to_c = hci_subevent_le_cis_established_get_ft_p_to_c(packet); + iso_stream->max_sdu_c_to_p = hci_subevent_le_cis_established_get_max_pdu_c_to_p(packet); + iso_stream->max_sdu_p_to_c = hci_subevent_le_cis_established_get_max_pdu_p_to_c(packet); + iso_stream->iso_interval_1250us = hci_subevent_le_cis_established_get_iso_interval(packet); if (hci_stack->iso_active_operation_group_id == HCI_ISO_GROUP_ID_SINGLE_CIS){ // CIS Accept by Peripheral if (status == ERROR_CODE_SUCCESS){ @@ -9898,13 +9904,20 @@ static uint16_t hci_setup_cis_created(uint8_t * event, hci_iso_stream_t * iso_st pos += 2; little_endian_store_16(event, pos, iso_stream->acl_handle); pos += 2; + little_endian_store_16(event, pos, iso_stream->iso_interval_1250us); + pos += 2; + event[pos++] = iso_stream->number_of_subevents; + event[pos++] = iso_stream->burst_number_c_to_p; + event[pos++] = iso_stream->burst_number_p_to_c; + event[pos++] = iso_stream->flush_timeout_c_to_p; + event[pos++] = iso_stream->flush_timeout_p_to_c; return pos; } // emits GAP_SUBEVENT_CIS_CREATED after calling hci_iso_finalize static void hci_cis_handle_created(hci_iso_stream_t * iso_stream, uint8_t status){ // cache data before finalizing struct - uint8_t event [10]; + uint8_t event [17]; uint16_t pos = hci_setup_cis_created(event, iso_stream, status); btstack_assert(pos <= sizeof(event)); if (status != ERROR_CODE_SUCCESS){ diff --git a/src/hci.h b/src/hci.h index 3b35b5eb0..92ce2beec 100644 --- a/src/hci.h +++ b/src/hci.h @@ -743,8 +743,14 @@ typedef struct { hci_con_handle_t acl_handle; // connection info + uint8_t number_of_subevents; + uint8_t burst_number_c_to_p; + uint8_t burst_number_p_to_c; + uint8_t flush_timeout_c_to_p; + uint8_t flush_timeout_p_to_c; uint16_t max_sdu_c_to_p; uint16_t max_sdu_p_to_c; + uint16_t iso_interval_1250us; // re-assembly buffer uint16_t reassembly_pos;