Bluetooth: SDP: add one API bt_sdp_get_add_proto_param

The bt_sdp_get_add_proto_param is used to get the protocol
parameter from Additional Protocol Descriptor List.
In order to implement it, one parameter
(proto_profile_index) is added to sdp_get_uuid_data_index
to get the indexed item.
Fix one bug in sdp_get_uuid_data because there may be more
than 2 consequent "seq len item".

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
This commit is contained in:
Mark Wang 2021-07-12 15:24:44 +08:00 committed by Johan Hedberg
commit c11ef74605
2 changed files with 113 additions and 30 deletions

View file

@ -575,6 +575,25 @@ enum bt_sdp_proto {
int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto,
uint16_t *param);
/** @brief Get additional parameter value related to given stacked protocol UUID.
*
* API extracts specific parameter associated with given protocol UUID
* available in Additional Protocol Descriptor List attribute.
*
* @param buf Original buffered raw record data.
* @param proto Known protocol to be checked like RFCOMM or L2CAP.
* @param param_index There may be more than one parameter realted to the
* given protocol UUID. This function returns the result that is
* indexed by this parameter. It's value is from 0, 0 means the
* first matched result, 1 means the second matched result.
* @param[out] param On success populated by found parameter value.
*
* @return 0 on success when a specific parameter associated with a given protocol
* value is found, or negative if error occurred during processing.
*/
int bt_sdp_get_addl_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto,
uint8_t param_index, uint16_t *param);
/** @brief Get profile version.
*
* Helper API extracting remote profile version number. To get it proper