use hci_can_send_command_packet_now instead of hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)

This commit is contained in:
matthias.ringwald@gmail.com 2014-08-11 21:20:07 +00:00
parent ac928cc29a
commit d94d3caf6b
7 changed files with 12 additions and 12 deletions

View File

@ -856,7 +856,7 @@ static void sm_pdu_received_in_wrong_state(){
static void sm_run(void){ static void sm_run(void){
// assert that we can send either one // 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; if (!l2cap_can_send_connectionless_packet_now()) return;
sm_key_t plaintext; sm_key_t plaintext;

View File

@ -200,7 +200,7 @@ static void sm_event_packet_handler (void * connection, uint8_t packet_type, uin
static void sm_run(void){ static void sm_run(void){
// assert that we can send either one // 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; if (!l2cap_can_send_connectionless_packet_now()) return;
switch (sm_state_responding){ switch (sm_state_responding){

View File

@ -301,7 +301,7 @@ void handle_gatt_client_event(le_event_t * event){
static void app_run(){ 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){ if (todos & SET_ADVERTISEMENT_DATA){
printf("app_run: set advertisement data\n"); printf("app_run: set advertisement data\n");

View File

@ -476,7 +476,7 @@ static uint8_t gap_adv_type(){
} }
static void gap_run(){ 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){ if (todos & DISABLE_ADVERTISEMENTS){
todos &= ~DISABLE_ADVERTISEMENTS; todos &= ~DISABLE_ADVERTISEMENTS;

View File

@ -62,7 +62,7 @@ static todo_t todos = 0;
static void gap_run(){ 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){ if (todos & SET_ADVERTISEMENT_DATA){
printf("GAP_RUN: set advertisement data\n"); printf("GAP_RUN: set advertisement data\n");

View File

@ -1604,7 +1604,7 @@ void hci_run(){
hci_connection_t * connection; hci_connection_t * connection;
linked_item_t * it; 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 // global/non-connection oriented commands
@ -1800,7 +1800,7 @@ void hci_run(){
if (connection){ if (connection){
// send disconnect // 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); 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 hci_send_cmd(&hci_disconnect, connection->con_handle, 0x13); // remote closed connection
@ -1835,7 +1835,7 @@ void hci_run(){
if (connection){ if (connection){
// send disconnect // 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); 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 hci_send_cmd(&hci_disconnect, connection->con_handle, 0x13); // remote closed connection
@ -1847,7 +1847,7 @@ void hci_run(){
if (hci_classic_supported()){ if (hci_classic_supported()){
// disable page and inquiry scan // 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"); 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 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, ...){ 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"); log_error("hci_send_cmd called but cannot send packet now");
return 0; return 0;
} }

View File

@ -569,7 +569,7 @@ void l2cap_run(void){
while (linked_list_iterator_has_next(&it)){ while (linked_list_iterator_has_next(&it)){
l2cap_channel_t * channel = (l2cap_channel_t *) linked_list_iterator_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; 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); // 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; break;
} }
if (hci_con_used) 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 hci_send_cmd(&hci_disconnect, handle, 0x13); // remote closed connection
break; break;