From 64f0b431f7ea55cc0807d0ad84a1592430665ebd Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Thu, 3 Apr 2014 15:27:03 +0000 Subject: [PATCH] more use of hci_can_send_packet_now_using_packet_buffer --- ble/sm.c | 4 ++-- ble/sm_minimal.c | 4 ++-- example/libusb/ble_client.c | 6 +++--- example/libusb/ble_peripheral.c | 2 +- src/hci.c | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ble/sm.c b/ble/sm.c index 30170919c..f1937928a 100644 --- a/ble/sm.c +++ b/ble/sm.c @@ -737,8 +737,8 @@ static void sm_pdu_received_in_wrong_state(){ static void sm_run(void){ // assert that we can send either one - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; - if (!hci_can_send_packet_now(HCI_ACL_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_ACL_DATA_PACKET)) return; // distributed key generation switch (dkg_state){ diff --git a/ble/sm_minimal.c b/ble/sm_minimal.c index 06c86712e..7fef8a7a9 100644 --- a/ble/sm_minimal.c +++ b/ble/sm_minimal.c @@ -200,8 +200,8 @@ static void sm_event_packet_handler (void * connection, uint8_t packet_type, uin static void sm_run(void){ // assert that we can send either one - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; - if (!hci_can_send_packet_now(HCI_ACL_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_ACL_DATA_PACKET)) return; switch (sm_state_responding){ case SM_STATE_SEND_LTK_REQUESTED_NEGATIVE_REPLY: diff --git a/example/libusb/ble_client.c b/example/libusb/ble_client.c index 0a2995b7e..b7bb246b8 100644 --- a/example/libusb/ble_client.c +++ b/example/libusb/ble_client.c @@ -120,7 +120,7 @@ static void gatt_client_run(); // START Helper Functions - to be sorted static int l2cap_can_send_conectionless_packet_now(){ - return hci_can_send_packet_now(HCI_ACL_DATA_PACKET); + return hci_can_send_packet_now_using_packet_buffer(HCI_ACL_DATA_PACKET); } static uint16_t l2cap_max_mtu_for_handle(uint16_t handle){ @@ -412,7 +412,7 @@ static void handle_peripheral_list(){ if (get_peripheral_w4_connect_cancelled()) return; // printf("handle_peripheral_list 3\n"); - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; // printf("handle_peripheral_list 4\n"); if (!l2cap_can_send_conectionless_packet_now()) return; // printf("handle_peripheral_list 5\n"); @@ -845,7 +845,7 @@ static void gatt_client_run(){ handle_peripheral_list(); // check if command is send - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; if (!l2cap_can_send_conectionless_packet_now()) return; switch(state){ diff --git a/example/libusb/ble_peripheral.c b/example/libusb/ble_peripheral.c index b2f0f1887..7b359fdc4 100644 --- a/example/libusb/ble_peripheral.c +++ b/example/libusb/ble_peripheral.c @@ -467,7 +467,7 @@ static uint8_t gap_adv_type(){ } static void gap_run(){ - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; if (todos & DISABLE_ADVERTISEMENTS){ todos &= ~DISABLE_ADVERTISEMENTS; diff --git a/src/hci.c b/src/hci.c index 0d4cf0082..ae1084f60 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1298,7 +1298,7 @@ void hci_run(){ hci_connection_t * connection; linked_item_t * it; - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; // global/non-connection oriented commands @@ -1553,7 +1553,7 @@ void hci_run(){ if (connection){ // send disconnect - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; log_info("HCI_STATE_HALTING, connection %p, handle %u\n", connection, (uint16_t)connection->con_handle); hci_send_cmd(&hci_disconnect, connection->con_handle, 0x13); // remote closed connection @@ -1600,7 +1600,7 @@ void hci_run(){ if (hci_classic_supported()){ // disable page and inquiry scan - if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; log_info("HCI_STATE_HALTING, disabling inq scans\n"); hci_send_cmd(&hci_write_scan_enable, hci_stack->connectable << 1); // drop inquiry scan but keep page scan