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; }