mirror of git://git.sysmocom.de/ofono
Use at_util_parse_clcc in atmodem
Replace parse_clcc by at_util_parse_clcc in atmodem voicecall.
This commit is contained in:
parent
20e9ff8551
commit
9b084e9656
|
@ -119,61 +119,6 @@ static struct ofono_call *create_call(struct voicecall_data *d, int type,
|
|||
return call;
|
||||
}
|
||||
|
||||
static GSList *parse_clcc(GAtResult *result)
|
||||
{
|
||||
GAtResultIter iter;
|
||||
GSList *l = NULL;
|
||||
int id, dir, status, type;
|
||||
struct ofono_call *call;
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
||||
while (g_at_result_iter_next(&iter, "+CLCC:")) {
|
||||
const char *str = "";
|
||||
int number_type = 129;
|
||||
|
||||
if (!g_at_result_iter_next_number(&iter, &id))
|
||||
continue;
|
||||
|
||||
if (!g_at_result_iter_next_number(&iter, &dir))
|
||||
continue;
|
||||
|
||||
if (!g_at_result_iter_next_number(&iter, &status))
|
||||
continue;
|
||||
|
||||
if (!g_at_result_iter_next_number(&iter, &type))
|
||||
continue;
|
||||
|
||||
if (!g_at_result_iter_skip_next(&iter))
|
||||
continue;
|
||||
|
||||
if (g_at_result_iter_next_string(&iter, &str))
|
||||
g_at_result_iter_next_number(&iter, &number_type);
|
||||
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
|
||||
if (!call)
|
||||
break;
|
||||
|
||||
call->id = id;
|
||||
call->direction = dir;
|
||||
call->status = status;
|
||||
call->type = type;
|
||||
strncpy(call->phone_number.number, str,
|
||||
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
||||
call->phone_number.type = number_type;
|
||||
|
||||
if (strlen(call->phone_number.number) > 0)
|
||||
call->clip_validity = 0;
|
||||
else
|
||||
call->clip_validity = 2;
|
||||
|
||||
l = g_slist_insert_sorted(l, call, at_util_call_compare);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||
{
|
||||
struct ofono_voicecall *vc = user_data;
|
||||
|
@ -191,7 +136,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
return;
|
||||
}
|
||||
|
||||
calls = parse_clcc(result);
|
||||
calls = at_util_parse_clcc(result);
|
||||
|
||||
n = calls;
|
||||
o = vd->calls;
|
||||
|
@ -482,7 +427,7 @@ static void clcc_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
goto out;
|
||||
}
|
||||
|
||||
calls = parse_clcc(result);
|
||||
calls = at_util_parse_clcc(result);
|
||||
|
||||
if (calls == NULL) {
|
||||
CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data);
|
||||
|
|
Loading…
Reference in New Issue