From d94d3caf6b86100d776cd1301538f3f2bddd43bd Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Mon, 11 Aug 2014 21:20:07 +0000 Subject: [PATCH] use hci_can_send_command_packet_now instead of hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET) --- ble/sm.c | 2 +- ble/sm_minimal.c | 2 +- example/libusb/ancs_client.c | 2 +- example/libusb/ble_peripheral.c | 2 +- example/libusb/spp_and_le_counter.c | 2 +- src/hci.c | 10 +++++----- src/l2cap.c | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ble/sm.c b/ble/sm.c index dec4f50cf..bb1d505dd 100644 --- a/ble/sm.c +++ b/ble/sm.c @@ -856,7 +856,7 @@ 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_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) return; if (!l2cap_can_send_connectionless_packet_now()) return; sm_key_t plaintext; diff --git a/ble/sm_minimal.c b/ble/sm_minimal.c index 2bcb58ad9..49da7a2c0 100644 --- a/ble/sm_minimal.c +++ b/ble/sm_minimal.c @@ -200,7 +200,7 @@ 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_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) return; if (!l2cap_can_send_connectionless_packet_now()) return; switch (sm_state_responding){ diff --git a/example/libusb/ancs_client.c b/example/libusb/ancs_client.c index 17f942739..465a768f0 100644 --- a/example/libusb/ancs_client.c +++ b/example/libusb/ancs_client.c @@ -301,7 +301,7 @@ void handle_gatt_client_event(le_event_t * event){ static void app_run(){ - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) return; if (todos & SET_ADVERTISEMENT_DATA){ printf("app_run: set advertisement data\n"); diff --git a/example/libusb/ble_peripheral.c b/example/libusb/ble_peripheral.c index bbf39033b..76090bff8 100644 --- a/example/libusb/ble_peripheral.c +++ b/example/libusb/ble_peripheral.c @@ -476,7 +476,7 @@ static uint8_t gap_adv_type(){ } static void gap_run(){ - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) return; if (todos & DISABLE_ADVERTISEMENTS){ todos &= ~DISABLE_ADVERTISEMENTS; diff --git a/example/libusb/spp_and_le_counter.c b/example/libusb/spp_and_le_counter.c index 5fa6c5e66..4a857a060 100644 --- a/example/libusb/spp_and_le_counter.c +++ b/example/libusb/spp_and_le_counter.c @@ -62,7 +62,7 @@ static todo_t todos = 0; static void gap_run(){ - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) return; if (todos & SET_ADVERTISEMENT_DATA){ printf("GAP_RUN: set advertisement data\n"); diff --git a/src/hci.c b/src/hci.c index f62f0c52d..4962235d3 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1604,7 +1604,7 @@ void hci_run(){ hci_connection_t * connection; linked_item_t * it; - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) return; // global/non-connection oriented commands @@ -1800,7 +1800,7 @@ void hci_run(){ if (connection){ // send disconnect - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) 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 @@ -1835,7 +1835,7 @@ void hci_run(){ if (connection){ // send disconnect - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) return; log_info("HCI_STATE_FALLING_ASLEEP, connection %p, handle %u\n", connection, (uint16_t)connection->con_handle); hci_send_cmd(&hci_disconnect, connection->con_handle, 0x13); // remote closed connection @@ -1847,7 +1847,7 @@ void hci_run(){ if (hci_classic_supported()){ // disable page and inquiry scan - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return; + if (!hci_can_send_command_packet_now()) 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 @@ -2012,7 +2012,7 @@ void hci_ssp_set_auto_accept(int auto_accept){ */ int hci_send_cmd(const hci_cmd_t *cmd, ...){ - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)){ + if (!hci_can_send_command_packet_now()){ log_error("hci_send_cmd called but cannot send packet now"); return 0; } diff --git a/src/l2cap.c b/src/l2cap.c index 941e55e72..454e9861e 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -569,7 +569,7 @@ void l2cap_run(void){ while (linked_list_iterator_has_next(&it)){ l2cap_channel_t * channel = (l2cap_channel_t *) linked_list_iterator_next(&it); - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) break; + if (!hci_can_send_command_packet_now()) break; if (!hci_can_send_packet_now_using_packet_buffer(HCI_ACL_DATA_PACKET)) break; // log_info("l2cap_run: state %u, var 0x%02x\n", channel->state, channel->state_var); @@ -870,7 +870,7 @@ void l2cap_event_handler(uint8_t *packet, uint16_t size){ break; } if (hci_con_used) break; - if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) break; + if (!hci_can_send_command_packet_now()) break; hci_send_cmd(&hci_disconnect, handle, 0x13); // remote closed connection break;