mirror of git://git.sysmocom.de/ofono
atmodem: Add CNAP parsing to voicecall
This commit is contained in:
parent
f490b4b9fa
commit
f28f0b3dea
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue