diff options
author | Andras Domokos <Andras.Domokos@nokia.com> | 2011-03-04 19:12:48 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-03-11 13:50:31 -0600 |
commit | 3370b454777a9fa4c94c9932f0907e4aa8d87c35 (patch) | |
tree | 8e4ff47f1250f6e1598a80e517202bb9182c0bbf | |
parent | 4dd654ddf4550ab9fe35e757fff20919eedf475c (diff) | |
download | ofono-3370b454777a9fa4c94c9932f0907e4aa8d87c35.tar.bz2 |
atmodem: implement SSN handling
-rw-r--r-- | drivers/atmodem/voicecall.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c index ee055dad..7d70c850 100644 --- a/drivers/atmodem/voicecall.c +++ b/drivers/atmodem/voicecall.c @@ -967,6 +967,63 @@ static void busy_notify(GAtResult *result, gpointer user_data) clcc_poll_cb, vc, NULL); } +static void cssi_notify(GAtResult *result, gpointer user_data) +{ + struct ofono_voicecall *vc = user_data; + GAtResultIter iter; + int code, index; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "+CSSI:")) + return; + + if (!g_at_result_iter_next_number(&iter, &code)) + return; + + if (!g_at_result_iter_next_number(&iter, &index)) + index = 0; + + ofono_voicecall_ssn_mo_notify(vc, 0, code, index); +} + +static void cssu_notify(GAtResult *result, gpointer user_data) +{ + struct ofono_voicecall *vc = user_data; + GAtResultIter iter; + int code; + int index = -1; + const char *num; + struct ofono_phone_number ph; + + ph.number[0] = '\0'; + ph.type = 129; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "+CSSU:")) + return; + + if (!g_at_result_iter_next_number(&iter, &code)) + return; + + /* This field is optional, if we can't read it, try to skip it */ + if (!g_at_result_iter_next_number(&iter, &index) && + !g_at_result_iter_skip_next(&iter)) + goto out; + + if (!g_at_result_iter_next_string(&iter, &num)) + goto out; + + strncpy(ph.number, num, OFONO_MAX_PHONE_NUMBER_LENGTH); + + if (!g_at_result_iter_next_number(&iter, &ph.type)) + return; + +out: + ofono_voicecall_ssn_mt_notify(vc, 0, code, index, &ph); +} + static void vtd_query_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_voicecall *vc = user_data; @@ -1015,6 +1072,9 @@ static void at_voicecall_initialized(gboolean ok, GAtResult *result, /* Populate the call list */ g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix, clcc_cb, vc, NULL); + + g_at_chat_register(vd->chat, "+CSSI:", cssi_notify, FALSE, vc, NULL); + g_at_chat_register(vd->chat, "+CSSU:", cssu_notify, FALSE, vc, NULL); } static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor, @@ -1038,6 +1098,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor, g_at_chat_send(vd->chat, "AT+CDIP=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+CSSN=1,1", NULL, NULL, NULL, NULL); g_at_chat_send(vd->chat, "AT+VTD?", NULL, vtd_query_cb, vc, NULL); g_at_chat_send(vd->chat, "AT+CCWA=1", NULL, |