summaryrefslogtreecommitdiffstats
path: root/drivers/ifxmodem/voicecall.c
diff options
context:
space:
mode:
authorJeevaka Badrappan <jeevaka.badrappan@elektrobit.com>2011-02-10 18:16:16 +0200
committerDenis Kenzior <denkenz@gmail.com>2011-02-11 11:21:12 -0600
commit0930de931967e0c7a739fd9c7a86c2290c73f1af (patch)
tree1975fe82c9c589229cda69d681be3d17d2391733 /drivers/ifxmodem/voicecall.c
parent61b94cbc8e246d6991315e33be649ad68e5a8a4b (diff)
downloadofono-0930de931967e0c7a739fd9c7a86c2290c73f1af.tar.bz2
ifxmodem: add CNAP support
Diffstat (limited to 'drivers/ifxmodem/voicecall.c')
-rw-r--r--drivers/ifxmodem/voicecall.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index 30e69917..87a48e66 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -630,6 +630,56 @@ static void clip_notify(GAtResult *result, gpointer user_data)
ofono_voicecall_notify(vc, call);
}
+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;
+
+ /*
+ * Currently, its not clear which URC will contain the
+ * calling party name for the waiting call.
+ */
+ l = g_slist_find_custom(vd->calls,
+ GINT_TO_POINTER(CALL_STATUS_INCOMING),
+ 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;
+
+ if (call->type == 0)
+ ofono_voicecall_notify(vc, call);
+}
+
static void ccwa_notify(GAtResult *result, gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
@@ -746,6 +796,7 @@ static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
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);
g_at_chat_register(vd->chat, "+XEM:", xem_notify, FALSE, vc, NULL);
g_at_chat_register(vd->chat, "+XCALLSTAT:", xcallstat_notify,