Bluetooth: Add bt_conn_lookup_by_addr_le
bt_conn_lookup_by_addr looks up for existing BLE connection by address. Change-Id: If24516511b7d07cd99bbe095a737b38b0adaabad Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
1c65da5ed7
commit
c151b84832
2 changed files with 20 additions and 0 deletions
|
@ -309,6 +309,23 @@ struct bt_conn *bt_conn_lookup(uint16_t handle)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct bt_conn *bt_conn_lookup_by_addr_le(const bt_addr_le_t *peer)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(conns); i++) {
|
||||
if (conns[i].state != BT_CONN_CONNECTED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!bt_addr_le_cmp(peer, &conns[i].dst)) {
|
||||
return &conns[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct bt_conn *bt_conn_get(struct bt_conn *conn)
|
||||
{
|
||||
conn->ref++;
|
||||
|
|
|
@ -85,6 +85,9 @@ void bt_conn_del(struct bt_conn *conn);
|
|||
/* Look up an existing connection */
|
||||
struct bt_conn *bt_conn_lookup(uint16_t handle);
|
||||
|
||||
/* Look up an existing connection by address */
|
||||
struct bt_conn *bt_conn_lookup_by_addr_le(const bt_addr_le_t *peer);
|
||||
|
||||
/* Increment conn reference count */
|
||||
struct bt_conn *bt_conn_get(struct bt_conn *conn);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue