Bluetooth: BR/EDR: Introduce bt_conn_add_br() routine

Adds routine to allow early initialization of connection object.

Change-Id: Icfa4a00732e631571a42dfd50f87b0779ea7f9a9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2015-11-25 11:51:25 +01:00 committed by Anas Nashif
commit 7422e70c37
2 changed files with 22 additions and 0 deletions

View file

@ -533,6 +533,22 @@ struct bt_conn *bt_conn_add_le(const bt_addr_le_t *peer)
return conn; return conn;
} }
#if defined(CONFIG_BLUETOOTH_BREDR)
struct bt_conn *bt_conn_add_br(const bt_addr_t *peer)
{
struct bt_conn *conn = conn_new();
if (!conn) {
return NULL;
};
bt_addr_copy(&conn->br.dst, peer);
conn->type = BT_CONN_TYPE_BREDR;
return conn;
}
#endif
static void timeout_fiber(int arg1, int arg2) static void timeout_fiber(int arg1, int arg2)
{ {
struct bt_conn *conn = (struct bt_conn *)arg1; struct bt_conn *conn = (struct bt_conn *)arg1;

View file

@ -51,6 +51,7 @@ struct bt_conn_le {
#if defined(CONFIG_BLUETOOTH_BREDR) #if defined(CONFIG_BLUETOOTH_BREDR)
struct bt_conn_br { struct bt_conn_br {
bt_addr_t dst;
}; };
#endif #endif
@ -109,6 +110,11 @@ void bt_conn_send(struct bt_conn *conn, struct net_buf *buf);
/* Add a new LE connection */ /* Add a new LE connection */
struct bt_conn *bt_conn_add_le(const bt_addr_le_t *peer); 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);
#endif
/* Look up an existing connection */ /* Look up an existing connection */
struct bt_conn *bt_conn_lookup_handle(uint16_t handle); struct bt_conn *bt_conn_lookup_handle(uint16_t handle);