Some fields in AT commands are not used by HFP spec. When parsing such commands it is convinient to just skip it without looking what is inside there --- src/shared/hfp.c | 12 ++++++++++++ src/shared/hfp.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/shared/hfp.c b/src/shared/hfp.c index 6c804f5..a35cb7b 100644 --- a/src/shared/hfp.c +++ b/src/shared/hfp.c @@ -415,6 +415,18 @@ bool hfp_context_has_next(struct hfp_context *context) return context->data[context->offset] != '\0'; } +void hfp_context_skip_field(struct hfp_context *context) +{ + const char *data = context->data; + unsigned int offset = context->offset; + + while (data[offset] != '\0' && data[offset] != ',') + offset++; + + context->offset = offset; + next_field(context); +} + bool hfp_context_get_range(struct hfp_context *context, uint32_t *min, uint32_t *max) { diff --git a/src/shared/hfp.h b/src/shared/hfp.h index 5ba020d..2eb7838 100644 --- a/src/shared/hfp.h +++ b/src/shared/hfp.h @@ -130,6 +130,7 @@ bool hfp_context_get_unquoted_string(struct hfp_context *context, bool hfp_context_get_range(struct hfp_context *context, unsigned int *min, unsigned int *max); bool hfp_context_has_next(struct hfp_context *context); +void hfp_context_skip_field(struct hfp_context *context); typedef void (*hfp_hf_result_func_t)(struct hfp_context *context, void *user_data); -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html