-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Bluetooth: SDP: Add helper functions to parse discovered record #97998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Bluetooth: SDP: Add helper functions to parse discovered record #97998
Conversation
Add all protocol identifier codes defined in Assigned Numbers specification. Signed-off-by: Lyle Zhu <[email protected]>
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]>
714600b
to
4c57019
Compare
|
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.