Bluetooth: BR/EDR: Look up conn by BT address helper
Defines helper routine to look up conn pool object for existance of instance matching requested bluetooth address. Change-Id: I31e05afb2346c7dab14e7ba1bd2f4e1378876ae0 Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
db57e259a7
commit
7abddd2bdf
2 changed files with 24 additions and 0 deletions
|
@ -534,6 +534,27 @@ struct bt_conn *bt_conn_add_le(const bt_addr_le_t *peer)
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_BREDR)
|
||||
struct bt_conn *bt_conn_lookup_addr_br(const bt_addr_t *peer)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(conns); i++) {
|
||||
if (!atomic_get(&conns[i].ref)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (conns[i].type != BT_CONN_TYPE_BR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!bt_addr_cmp(peer, &conns[i].br.dst)) {
|
||||
return bt_conn_ref(&conns[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct bt_conn *bt_conn_add_br(const bt_addr_t *peer)
|
||||
{
|
||||
struct bt_conn *conn = conn_new();
|
||||
|
|
|
@ -112,6 +112,9 @@ struct bt_conn *bt_conn_add_le(const bt_addr_le_t *peer);
|
|||
#if defined(CONFIG_BLUETOOTH_BREDR)
|
||||
/* Add a new BR/EDR connection */
|
||||
struct bt_conn *bt_conn_add_br(const bt_addr_t *peer);
|
||||
|
||||
/* Look up an existing connection by BT address */
|
||||
struct bt_conn *bt_conn_lookup_addr_br(const bt_addr_t *peer);
|
||||
#endif
|
||||
|
||||
/* Look up an existing connection */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue