From 441e01ec04d88ac932f9138ce204e586be8dab5d Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 18 Jun 2015 09:36:59 +0200 Subject: [PATCH] Bluetooth: Add bt_conn_get_dst function This function allows to pick connection destination address. Change-Id: I3e4959eec00905c64de3d8b9ef810b613c2e9f91 Signed-off-by: Szymon Janc --- include/bluetooth/conn.h | 8 ++++++++ net/bluetooth/conn.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/include/bluetooth/conn.h b/include/bluetooth/conn.h index 36dc2da0308..17045479620 100644 --- a/include/bluetooth/conn.h +++ b/include/bluetooth/conn.h @@ -69,6 +69,14 @@ void bt_conn_put(struct bt_conn *conn); */ struct bt_conn *bt_conn_lookup_addr_le(const bt_addr_le_t *peer); +/*! @brief Get destination (peer) address of a connection. + * + * @param conn Connection object. + * + * @return Destination address. + */ +const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn); + /*! Connection callback structure */ struct bt_conn_cb { void (*connected)(struct bt_conn *conn); diff --git a/net/bluetooth/conn.c b/net/bluetooth/conn.c index 7dda11c3a35..4ea726d229b 100644 --- a/net/bluetooth/conn.c +++ b/net/bluetooth/conn.c @@ -351,3 +351,8 @@ void bt_conn_put(struct bt_conn *conn) conn->handle = 0; } + +const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn) +{ + return &conn->dst; +}