mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-27 03:39:56 +00:00
hci: return -1 if hci_create_connection was not sent to transport layer in hci_send_cmd_packet
This commit is contained in:
parent
bfea0222f7
commit
f5e5741d14
10
src/hci.c
10
src/hci.c
@ -3568,7 +3568,7 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
|
||||
if (!conn){
|
||||
// notify client that alloc failed
|
||||
hci_emit_connection_complete(addr, 0, BTSTACK_MEMORY_ALLOC_FAILED);
|
||||
return 0; // don't sent packet to controller
|
||||
return -1; // packet not sent to controller
|
||||
}
|
||||
conn->state = SEND_CREATE_CONNECTION;
|
||||
}
|
||||
@ -3576,15 +3576,15 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
|
||||
switch (conn->state){
|
||||
// if connection active exists
|
||||
case OPEN:
|
||||
// and OPEN, emit connection complete command, don't send to controller
|
||||
// and OPEN, emit connection complete command
|
||||
hci_emit_connection_complete(addr, conn->con_handle, 0);
|
||||
return 0;
|
||||
return -1; // packet not sent to controller
|
||||
case SEND_CREATE_CONNECTION:
|
||||
// connection created by hci, e.g. dedicated bonding
|
||||
break;
|
||||
return -1; // packet not sent to controller
|
||||
default:
|
||||
// otherwise, just ignore as it is already in the open process
|
||||
return 0;
|
||||
return -1; // packet not sent to controller
|
||||
}
|
||||
conn->state = SENT_CREATE_CONNECTION;
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ void hci_set_master_slave_policy(uint8_t policy);
|
||||
|
||||
|
||||
/**
|
||||
* va_list version of hci_send_cmd
|
||||
* va_list version of hci_send_cmd, call hci_send_cmd_packet
|
||||
*/
|
||||
int hci_send_cmd_va_arg(const hci_cmd_t *cmd, va_list argtr);
|
||||
|
||||
@ -1111,7 +1111,8 @@ int hci_remote_esco_supported(hci_con_handle_t con_handle);
|
||||
void hci_emit_state(void);
|
||||
|
||||
/**
|
||||
* Send complete CMD packet. Called by daemon
|
||||
* Send complete CMD packet. Called by daemon and hci_send_cmd_va_arg
|
||||
* @returns 0 if command was successfully sent to HCI Transport layer
|
||||
*/
|
||||
int hci_send_cmd_packet(uint8_t *packet, int size);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user