mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
added hci_connection_for_bd_addr
This commit is contained in:
parent
30a55ec6c0
commit
62bda3fbc5
15
src/hci.c
15
src/hci.c
@ -93,6 +93,17 @@ hci_connection_t * hci_connection_for_handle(hci_con_handle_t con_handle){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hci_connection_t * hci_connection_for_bd_addr(bd_addr_t * addr){
|
||||
linked_item_t *it;
|
||||
for (it = (linked_item_t *) hci_stack->connections; it ; it = it->next){
|
||||
hci_connection_t * connection = (hci_connection_t *) it;
|
||||
if (memcmp(addr, connection->address, 6) == 0) {
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void hci_connection_timeout_handler(timer_source_t *timer){
|
||||
hci_connection_t * connection = (hci_connection_t *) linked_item_get_user(&timer->item);
|
||||
#ifdef HAVE_TIME
|
||||
@ -1610,9 +1621,9 @@ 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
|
||||
// and OPEN, emit connection complete command, don't send to controller
|
||||
hci_emit_connection_complete(conn, 0);
|
||||
break;
|
||||
return 0;
|
||||
case SEND_CREATE_CONNECTION:
|
||||
// connection created by hci, e.g. dedicated bonding
|
||||
break;
|
||||
|
@ -382,6 +382,7 @@ int hci_can_send_packet_now(uint8_t packet_type);
|
||||
|
||||
bd_addr_t * hci_local_bd_addr(void);
|
||||
hci_connection_t * hci_connection_for_handle(hci_con_handle_t con_handle);
|
||||
hci_connection_t * hci_connection_for_bd_addr(bd_addr_t *addr);
|
||||
uint8_t hci_number_outgoing_packets(hci_con_handle_t handle);
|
||||
uint8_t hci_number_free_acl_slots(void);
|
||||
int hci_authentication_active_for_handle(hci_con_handle_t handle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user