From 6c26b087476c4858600668a8fc09217a9cc8ecff Mon Sep 17 00:00:00 2001 From: "mila@ringwald.ch" Date: Thu, 9 Oct 2014 09:00:27 +0000 Subject: [PATCH] cap le acl buffer size, added hci function --- src/hci.c | 8 ++++++++ src/hci.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/hci.c b/src/hci.c index d30c3286d..a2cee5b7d 100644 --- a/src/hci.c +++ b/src/hci.c @@ -384,6 +384,10 @@ int hci_transport_synchronous(void){ return hci_stack->hci_transport->can_send_packet_now == NULL; } +uint16_t hci_max_acl_le_data_packet_length(void){ + return hci_stack->le_data_packets_length > 0 ? hci_stack->le_data_packets_length : hci_stack->acl_data_packet_length; +} + static int hci_send_acl_packet_fragments(hci_connection_t *connection){ // log_info("hci_send_acl_packet_fragments %u/%u (con 0x%04x)", hci_stack->acl_fragmentation_pos, hci_stack->acl_fragmentation_total_size, connection->con_handle); @@ -939,6 +943,10 @@ static void event_handler(uint8_t *packet, int size){ if (COMMAND_COMPLETE_EVENT(packet, hci_le_read_buffer_size)){ hci_stack->le_data_packets_length = READ_BT_16(packet, 6); hci_stack->le_acl_packets_total_num = packet[8]; + // determine usable ACL payload size + if (HCI_ACL_PAYLOAD_SIZE < hci_stack->le_data_packets_length){ + hci_stack->le_data_packets_length = HCI_ACL_PAYLOAD_SIZE; + } log_info("hci_le_read_buffer_size: size %u, count %u", hci_stack->le_data_packets_length, hci_stack->le_acl_packets_total_num); } #endif diff --git a/src/hci.h b/src/hci.h index c40c7ae02..a60ff7a02 100644 --- a/src/hci.h +++ b/src/hci.h @@ -490,6 +490,7 @@ uint8_t hci_number_outgoing_packets(hci_con_handle_t handle); uint8_t hci_number_free_acl_slots_for_handle(hci_con_handle_t con_handle); int hci_authentication_active_for_handle(hci_con_handle_t handle); uint16_t hci_max_acl_data_packet_length(void); +uint16_t hci_max_acl_le_data_packet_length(void); uint16_t hci_usable_acl_packet_types(void); int hci_non_flushable_packet_boundary_flag_supported(void);