[PATCH 7/9] shared/hfp_at: Add function to close container

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It will look for ")" parenthesis and skip it if found.
---
 src/shared/hfp_at.c | 13 +++++++++++++
 src/shared/hfp_at.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/src/shared/hfp_at.c b/src/shared/hfp_at.c
index 3bf1fd6..2db40b2 100644
--- a/src/shared/hfp_at.c
+++ b/src/shared/hfp_at.c
@@ -259,6 +259,19 @@ bool hfp_at_open_container(struct hfp_at *hfp_at, const char *data)
 	return true;
 }
 
+bool hfp_at_close_container(struct hfp_at *hfp_at, const char *data)
+{
+	hfp_at_skip_whitespace(hfp_at, data);
+
+	/* The list shall be followed by a right parenthesis (")" V250 5.7.3.1*/
+	if (data[hfp_at->offset] != ')')
+		return false;
+
+	hfp_at->offset++;
+
+	return true;
+}
+
 struct hfp_at *hfp_at_new(const struct hfp_at_handler *handlers)
 {
 	struct hfp_at *hfp_at;
diff --git a/src/shared/hfp_at.h b/src/shared/hfp_at.h
index d5dcf9d..e709acb 100644
--- a/src/shared/hfp_at.h
+++ b/src/shared/hfp_at.h
@@ -44,6 +44,7 @@ bool hfp_at_process_data(struct hfp_at *hfp_at, const char *data,
 
 bool hfp_at_get_number(struct hfp_at *hfp_at, const char *data, int *val);
 bool hfp_at_open_container(struct hfp_at *hfp_at, const char *data);
+bool hfp_at_close_container(struct hfp_at *hfp_at, const char *data);
 
 struct hfp_at *hfp_at_new(const struct hfp_at_handler *handlers);
 void hfp_at_free(struct hfp_at *hfp_at);
-- 
1.8.5.3

--
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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux