Skip to content

Conversation

lylezhu2012
Copy link
Contributor

The current implementation does not support multiple attributes with the same attribute identifier in a discovered SDP record.

Add function bt_sdp_record_parse() to parse the received SDP record.

Add function bt_sdp_has_attribute() to check if the specified attribute identifier has been discovered.

Add function bt_sdp_get_attribute_count() to get the attribute count for specified attribute identifier.

Add function bt_sdp_get_attribute() to get the attribute of specified attribute identifier.

Add function bt_sdp_attr_value_parse() to parse the attribute value.

Add function bt_sdp_attr_has_uuid() to check if the attribute contains the specified UUID.

Add function bt_sdp_attr_read() to read the value of the attribute.

Add all protocol identifier codes defined in Assigned Numbers
specification.

Signed-off-by: Lyle Zhu <[email protected]>
Comment on lines 859 to 867
int bt_sdp_get_attribute(struct net_buf *buf, struct bt_sdp_attribute *attr, uint8_t attr_id,
uint16_t index);

/** @brief SDP attribute value for unsigned integer types
*
* Structure to hold parsed unsigned integer values from SDP attributes.
* The size field indicates the actual size of the integer value.
*/
struct bt_sdp_attr_value_uint {
Copy link
Member

@jhedberg jhedberg Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick drive-by comment: be consistent with how you spell "attribute" in the types. You have both bt_sdp_attribute and bt_sdp_attr_value_uint. I'd propose to use the short version everywhere.

Copy link
Contributor Author

@lylezhu2012 lylezhu2012 Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I will update all of them to attr.

The current implementation does not support multiple attributes with
the same attribute identifier in a discovered SDP record.

Add function `bt_sdp_record_parse()` to parse the received SDP record.

Add function `bt_sdp_has_attr()` to check if the specified attribute
identifier has been discovered.

Add function `bt_sdp_get_attr()` to get the attribute of specified
attribute identifier.

Add function `bt_sdp_attr_value_parse()` to parse the attribute value.

Add function `bt_sdp_attr_has_uuid()` to check if the attribute
contains the specified UUID.

Add function `bt_sdp_attr_read()` to read the value of the attribute.

Add function `bt_sdp_attr_addl_proto_parse()` to parse the protocol
descriptor from the additional protocol descriptor list.

Add function `bt_sdp_attr_addl_proto_count()` to get the protocol
descriptor count of the additional protocol descriptor list.

Add function `bt_sdp_attr_addl_proto_read()` to read the attribute
value from the additional protocol descriptor list for specific index
and UUID.

Signed-off-by: Lyle Zhu <[email protected]>
Update the command `sdp-find` to support attribute parsing helper.
If the argument count is 1, the general SDP discovery will be used
to discover the protocol `L2CAP`.

In the SDP record discovered callback, call attribute parsing helper
functions to parse the SDP record and SDP attributes. And print all
parsed attribute values.

Signed-off-by: Lyle Zhu <[email protected]>
Use a combination of multiple helper functions to implement the
functionality of existing interfaces starting with `bt_sdp_get_`.

Signed-off-by: Lyle Zhu <[email protected]>
@lylezhu2012 lylezhu2012 force-pushed the classic_sdp_improve_helper branch from 714600b to 4c57019 Compare October 22, 2025 10:07
@lylezhu2012 lylezhu2012 requested a review from jhedberg October 22, 2025 10:08
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants