From fd43c0e0286250c784db42f57c9b5cf842ee4e81 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 5 Sep 2018 15:43:15 +0200 Subject: [PATCH] hci: extract hci_emit_transport_packet_sent() --- src/hci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/hci.c b/src/hci.c index b0a5d5c3a..faf880838 100644 --- a/src/hci.c +++ b/src/hci.c @@ -143,6 +143,7 @@ static void gap_inquiry_explode(uint8_t * packet); static int hci_power_control_on(void); static void hci_power_control_off(void); static void hci_state_reset(void); +static void hci_emit_transport_packet_sent(void); static void hci_emit_disconnection_complete(hci_con_handle_t con_handle, uint8_t reason); static void hci_emit_nr_connections_changed(void); static void hci_emit_hci_open_failed(void); @@ -681,9 +682,7 @@ static int hci_send_acl_packet_fragments(hci_connection_t *connection){ // release buffer now for synchronous transport if (hci_transport_synchronous()){ hci_release_packet_buffer(); - // notify upper stack that it might be possible to send again - uint8_t event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0}; - hci_emit_event(&event[0], sizeof(event), 0); // don't dump + hci_emit_transport_packet_sent(); } return err; @@ -768,9 +767,7 @@ int hci_send_sco_packet_buffer(int size){ if (hci_transport_synchronous()){ hci_release_packet_buffer(); - // notify upper stack that it might be possible to send again - uint8_t event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0}; - hci_emit_event(&event[0], sizeof(event), 0); // don't dump + hci_emit_transport_packet_sent(); } return err; @@ -3908,6 +3905,12 @@ static void hci_emit_le_connection_complete(uint8_t address_type, bd_addr_t addr #endif #endif +static void hci_emit_transport_packet_sent(void){ + // notify upper stack that it might be possible to send again + uint8_t event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0}; + hci_emit_event(&event[0], sizeof(event), 0); // don't dump +} + static void hci_emit_disconnection_complete(hci_con_handle_t con_handle, uint8_t reason){ uint8_t event[6]; event[0] = HCI_EVENT_DISCONNECTION_COMPLETE;