All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] Add parse_clcc into atutil.c
@ 2009-11-12 16:31 Zhenhua Zhang
  2009-11-12 17:25 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Zhenhua Zhang @ 2009-11-12 16:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2340 bytes --]

So that it could be shared by atmodem and hfpmodem.
---
 drivers/atmodem/atutil.c |   55
++++++++++++++++++++++++++++++++++++++++++++++
 drivers/atmodem/atutil.h |    1 +
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 687a466..3a365f4 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -110,3 +110,58 @@ void at_util_release_id(unsigned int *id_list,
unsigned int id)
 	*id_list &= ~(1 << id);
 }
 
+GSList *at_util_parse_clcc(GAtResult *result)
+{
+	GAtResultIter iter;
+	GSList *l = NULL;
+	int id, dir, status, type;
+	struct ofono_call *call;
+
+	g_at_result_iter_init(&iter, result);
+
+	while (g_at_result_iter_next(&iter, "+CLCC:")) {
+		const char *str = "";
+		int number_type = 129;
+
+		if (!g_at_result_iter_next_number(&iter, &id))
+			continue;
+
+		if (!g_at_result_iter_next_number(&iter, &dir))
+			continue;
+
+		if (!g_at_result_iter_next_number(&iter, &status))
+			continue;
+
+		if (!g_at_result_iter_next_number(&iter, &type))
+			continue;
+
+		if (!g_at_result_iter_skip_next(&iter))
+			continue;
+
+		if (g_at_result_iter_next_string(&iter, &str))
+			g_at_result_iter_next_number(&iter, &number_type);
+
+		call = g_try_new0(struct ofono_call, 1);
+
+		if (!call)
+			break;
+
+		call->id = id;
+		call->direction = dir;
+		call->status = status;
+		call->type = type;
+		strncpy(call->phone_number.number, str,
+				OFONO_MAX_PHONE_NUMBER_LENGTH);
+		call->phone_number.type = number_type;
+
+		if (strlen(call->phone_number.number) > 0)
+			call->clip_validity = 0;
+		else
+			call->clip_validity = 2;
+
+		l = g_slist_insert_sorted(l, call, at_util_call_compare);
+	}
+
+	return l;
+}
+
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 4ae1a27..82c3f3b 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -26,6 +26,7 @@ gint
at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b);
 gint at_util_call_compare(gconstpointer a, gconstpointer b);
 unsigned int at_util_alloc_next_id(unsigned int *id_list);
 void at_util_release_id(unsigned int *id_list, unsigned int id);
+GSList *at_util_parse_clcc(GAtResult *result);
 
 struct cb_data {
 	void *cb;
-- 
1.6.2.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] Add parse_clcc into atutil.c
  2009-11-12 16:31 [PATCH 2/3] Add parse_clcc into atutil.c Zhenhua Zhang
@ 2009-11-12 17:25 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2009-11-12 17:25 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 72 bytes --]

Hi Zhenhua,

Patch has been applied. Thanks.

Regards,
-Denis



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-12 17:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-12 16:31 [PATCH 2/3] Add parse_clcc into atutil.c Zhenhua Zhang
2009-11-12 17:25 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.