mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-16 06:39:51 +00:00
added spd_get_filtered_size to get sum of attributes matching attribute list
This commit is contained in:
parent
ccf81f4c49
commit
eda56fd465
@ -125,8 +125,9 @@ int de_get_data_size(uint8_t * header);
|
||||
// MARK: SDP
|
||||
int sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startIndex, uint16_t maxBytes, uint8_t *buffer);
|
||||
uint8_t * sdp_get_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID);
|
||||
uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID, uint32_t value);
|
||||
uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID, uint32_t value);
|
||||
int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern);
|
||||
int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
|
@ -348,6 +348,28 @@ int sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attribute
|
||||
return -1;
|
||||
}
|
||||
|
||||
// MARK: Get sum of attributes matching attribute list
|
||||
struct sdp_context_get_filtered_size {
|
||||
uint8_t *attributeIDList;
|
||||
uint16_t size;
|
||||
};
|
||||
|
||||
static int sdp_traversal_get_filtered_size(uint16_t attributeID, uint8_t * attributeValue, de_type_t type, de_size_t size, void *my_context){
|
||||
struct sdp_context_get_filtered_size * context = (struct sdp_context_get_filtered_size *) my_context;
|
||||
if (sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) {
|
||||
context->size += size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList){
|
||||
struct sdp_context_get_filtered_size context;
|
||||
context.size = 0;
|
||||
context.attributeIDList = attributeIDList;
|
||||
sdp_attribute_list_traverse_sequence(record, sdp_traversal_get_filtered_size, &context);
|
||||
return context.size;
|
||||
}
|
||||
|
||||
// MARK: Get AttributeValue for AttributeID
|
||||
// find attribute (ELEMENT) by ID
|
||||
struct sdp_context_attribute_by_id {
|
||||
|
Loading…
x
Reference in New Issue
Block a user