From 9d1aac47e7ab60b72dbfe5909784c089d903ff0c Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Sun, 26 Sep 2010 22:16:29 -0500 Subject: huawei: Notify the core on connect and end call --- drivers/huaweimodem/voicecall.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'drivers/huaweimodem') diff --git a/drivers/huaweimodem/voicecall.c b/drivers/huaweimodem/voicecall.c index 79a81c59..63f60312 100644 --- a/drivers/huaweimodem/voicecall.c +++ b/drivers/huaweimodem/voicecall.c @@ -322,8 +322,12 @@ static void conf_notify(GAtResult *result, gpointer user_data) static void conn_notify(GAtResult *result, gpointer user_data) { + struct ofono_voicecall *vc = user_data; + struct voicecall_data *vd = ofono_voicecall_get_data(vc); GAtResultIter iter; gint call_id, call_type; + struct ofono_call *call; + GSList *l; g_at_result_iter_init(&iter, result); @@ -337,12 +341,29 @@ static void conn_notify(GAtResult *result, gpointer user_data) return; ofono_info("Call connect: id %d type %d", call_id, call_type); + + l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id), + at_util_call_compare_by_id); + if (l == NULL) { + ofono_error("Received CONN for untracked call"); + return; + } + + /* Set call to active */ + call = l->data; + call->status = 0; + + ofono_voicecall_notify(vc, call); } static void cend_notify(GAtResult *result, gpointer user_data) { + struct ofono_voicecall *vc = user_data; + struct voicecall_data *vd = ofono_voicecall_get_data(vc); GAtResultIter iter; gint call_id, duration, end_status, cc_pause; + struct ofono_call *call; + GSList *l; g_at_result_iter_init(&iter, result); @@ -363,6 +384,22 @@ static void cend_notify(GAtResult *result, gpointer user_data) ofono_info("Call end: id %d duration %ds status %d control %d", call_id, duration, end_status, cc_pause); + + l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id), + at_util_call_compare_by_id); + if (l == NULL) { + ofono_error("Received CEND for untracked call"); + return; + } + + call = l->data; + + if (call->type == 0) + ofono_voicecall_disconnected(vc, call->id, + OFONO_DISCONNECT_REASON_UNKNOWN, NULL); + + vd->calls = g_slist_remove(vd->calls, call); + g_free(call); } static void huawei_voicecall_initialized(gboolean ok, GAtResult *result, -- cgit v1.2.3