From 6d89dd897ecd6d197574af889b4ca45a1efc64de Mon Sep 17 00:00:00 2001 From: Arkadiusz Lichwa Date: Tue, 20 Dec 2016 21:12:25 +0100 Subject: [PATCH] Bluetooth: SDP: Queue user UUID to be resolved Makes possible to append user UUID to context to be able later iterate it on subsequent resolving process. Jira: ZEP-1112 Change-Id: I193ff1cee199045c9686dc4ca200adf19db377e4 Signed-off-by: Arkadiusz Lichwa --- include/bluetooth/sdp.h | 1 + subsys/bluetooth/host/sdp.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/bluetooth/sdp.h b/include/bluetooth/sdp.h index d9ca59ff172..c346778a5cd 100644 --- a/include/bluetooth/sdp.h +++ b/include/bluetooth/sdp.h @@ -487,6 +487,7 @@ typedef uint8_t (*bt_sdp_discover_func_t) /** @brief Main user structure used in SDP discovery of remote. */ struct bt_sdp_discover_params { + sys_snode_t _node; /** UUID (service) to be discovered on remote SDP entity */ const struct bt_uuid *uuid; /** Discover callback to be called on resolved SDP record */ diff --git a/subsys/bluetooth/host/sdp.c b/subsys/bluetooth/host/sdp.c index b006afdca72..6296a0cbb69 100644 --- a/subsys/bluetooth/host/sdp.c +++ b/subsys/bluetooth/host/sdp.c @@ -63,6 +63,8 @@ NET_BUF_POOL_DEFINE(sdp_pool, CONFIG_BLUETOOTH_MAX_CONN, struct bt_sdp_client { struct bt_l2cap_br_chan chan; + /* list of waiting to be resolved UUID params */ + sys_slist_t reqs; }; static struct bt_sdp_client bt_sdp_client_pool[CONFIG_BLUETOOTH_MAX_CONN]; @@ -358,6 +360,8 @@ static struct bt_sdp_client *sdp_client_new_session(struct bt_conn *conn) continue; } + sys_slist_init(&session->reqs); + session->chan.chan.ops = &sdp_client_chan_ops; session->chan.chan.conn = conn; session->chan.rx.mtu = SDP_CLIENT_MTU; @@ -404,5 +408,7 @@ int bt_sdp_discover(struct bt_conn *conn, return -ENOMEM; } + sys_slist_append(&session->reqs, (sys_snode_t *)¶ms->_node); + return 0; }