Bluetooth: SDP: Add API to get ProfileDescriptorList attribute
Adds API enabling retrieve remote profile version. Jira: ZEP-1112 Change-Id: I9b1a9a15848d5c485ec3dd2b405a6d51ce9b020e Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
75421e0f53
commit
a7e4eaafaa
2 changed files with 38 additions and 0 deletions
|
@ -541,6 +541,21 @@ 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 profile version.
|
||||
*
|
||||
* Helper API extracting remote profile version number. To get it proper
|
||||
* generic profile parameter needs to be selected usually listed in SDP
|
||||
* Interoperability Requirements section for given profile specification.
|
||||
*
|
||||
* @param buf Original buffered raw record data.
|
||||
* @param profile Profile family identifier the profile belongs.
|
||||
* @param version On success populated by found version number.
|
||||
*
|
||||
* @return 0 on success, negative value if error occurred during processing.
|
||||
*/
|
||||
int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile,
|
||||
uint16_t *version);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1319,3 +1319,26 @@ int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto,
|
|||
|
||||
return sdp_get_param_item(&pd, param);
|
||||
}
|
||||
|
||||
int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile,
|
||||
uint16_t *version)
|
||||
{
|
||||
struct bt_sdp_attr_item attr;
|
||||
struct bt_sdp_uuid_desc pd;
|
||||
int res;
|
||||
|
||||
res = bt_sdp_get_attr(buf, &attr, BT_SDP_ATTR_PROFILE_DESC_LIST);
|
||||
if (res < 0) {
|
||||
BT_WARN("Attribute 0x%04x not found, err %d",
|
||||
BT_SDP_ATTR_PROFILE_DESC_LIST, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = sdp_get_uuid_data(&attr, &pd, profile);
|
||||
if (res < 0) {
|
||||
BT_WARN("Profile 0x%04x not found, err %d", profile, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
return sdp_get_param_item(&pd, version);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue