[PATCH 3/3] Replace parse_clcc by at_util_parse_clcc in atmodem voicecall

Zhenhua Zhang zhenhua.zhang at intel.com
Thu Nov 12 08:32:19 PST 2009


Replace parse_clcc by at_util_parse_clcc in atmodem voicecall.
---
 drivers/atmodem/voicecall.c |   59
+-----------------------------------------
 1 files changed, 2 insertions(+), 57 deletions(-)

diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 9ed3696..9dae1c8 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -119,61 +119,6 @@ static struct ofono_call *create_call(struct
voicecall_data *d, int type,
 	return call;
 }
 
-static GSList *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;
-}
-
 static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer
user_data)
 {
 	struct ofono_voicecall *vc = user_data;
@@ -191,7 +136,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult
*result, gpointer user_data)
 		return;
 	}
 
-	calls = parse_clcc(result);
+	calls = at_util_parse_clcc(result);
 
 	n = calls;
 	o = vd->calls;
@@ -482,7 +427,7 @@ static void clcc_cb(gboolean ok, GAtResult *result,
gpointer user_data)
 		goto out;
 	}
 
-	calls = parse_clcc(result);
+	calls = at_util_parse_clcc(result);
 
 	if (calls == NULL) {
 		CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data);
-- 
1.6.2.5





More information about the ofono mailing list