diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-09-26 22:16:29 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-09-26 22:16:29 -0500 |
commit | 9d1aac47e7ab60b72dbfe5909784c089d903ff0c (patch) | |
tree | 12979725884f54b27bde003522480d54d7862dd8 /drivers/huaweimodem | |
parent | a9aac83e33d88aa95da4a300148fbee6fdcfe8a6 (diff) | |
download | ofono-9d1aac47e7ab60b72dbfe5909784c089d903ff0c.tar.bz2 |
huawei: Notify the core on connect and end call
Diffstat (limited to 'drivers/huaweimodem')
-rw-r--r-- | drivers/huaweimodem/voicecall.c | 37 |
1 files changed, 37 insertions, 0 deletions
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, |