summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-12-06 18:12:36 -0200
committerDenis Kenzior <denkenz@gmail.com>2010-12-16 18:40:18 -0600
commitf28f0b3deac7f26e6f8e026f2eebd3e5e0a2c3fd (patch)
tree2275e3fb528cd525c7f13364c1117427751165e5 /drivers
parentf490b4b9fafee28cc94bd768013a9c6bfc20f55b (diff)
downloadofono-f28f0b3deac7f26e6f8e026f2eebd3e5e0a2c3fd.tar.bz2
atmodem: Add CNAP parsing to voicecall
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atmodem/voicecall.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index a2ee49d8..41fd901a 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -746,6 +746,51 @@ static void clip_notify(GAtResult *result, gpointer user_data)
}
}
+static void cnap_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_voicecall *vc = user_data;
+ struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+ GAtResultIter iter;
+ const char *name;
+ int validity;
+ GSList *l;
+ struct ofono_call *call;
+
+ l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(4),
+ at_util_call_compare_by_status);
+ if (l == NULL) {
+ ofono_error("CNAP for unknown call");
+ return;
+ }
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CNAP:"))
+ return;
+
+ if (!g_at_result_iter_next_string(&iter, &name))
+ return;
+
+ if (strlen(name) > 0)
+ validity = CNAP_VALIDITY_VALID;
+ else
+ validity = CNAP_VALIDITY_NOT_AVAILABLE;
+
+ /* If we have CNI validity field, override our guessed value */
+ g_at_result_iter_next_number(&iter, &validity);
+
+ DBG("%s %d", name, validity);
+
+ call = l->data;
+
+ strncpy(call->name, name,
+ OFONO_MAX_CALLER_NAME_LENGTH);
+ call->name[OFONO_MAX_CALLER_NAME_LENGTH] = '\0';
+ call->cnap_validity = validity;
+
+ ofono_voicecall_notify(vc, call);
+}
+
static void ccwa_notify(GAtResult *result, gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
@@ -864,6 +909,7 @@ static void at_voicecall_initialized(gboolean ok, GAtResult *result,
g_at_chat_register(vd->chat, "RING", ring_notify, FALSE, vc, NULL);
g_at_chat_register(vd->chat, "+CRING:", cring_notify, FALSE, vc, NULL);
g_at_chat_register(vd->chat, "+CLIP:", clip_notify, FALSE, vc, NULL);
+ g_at_chat_register(vd->chat, "+CNAP:", cnap_notify, FALSE, vc, NULL);
g_at_chat_register(vd->chat, "+CCWA:", ccwa_notify, FALSE, vc, NULL);
/* Modems with 'better' call progress indicators should
@@ -899,6 +945,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
g_at_chat_send(vd->chat, "AT+CRC=1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT+CLIP=1", NULL, NULL, NULL, NULL);
+ g_at_chat_send(vd->chat, "AT+CNAP=1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT+COLP=1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT+VTD?", NULL,
vtd_query_cb, vc, NULL);