mirror of git://git.sysmocom.de/ofono
call-settings: Add support for +COLR in atmodem
This commit is contained in:
parent
d1de85e5a4
commit
7cde43b4b6
|
@ -44,6 +44,7 @@ static const char *clir_prefix[] = { "+CLIR:", NULL };
|
|||
static const char *colp_prefix[] = { "+COLP:", NULL };
|
||||
static const char *clip_prefix[] = { "+CLIP:", NULL };
|
||||
static const char *ccwa_prefix[] = { "+CCWA:", NULL };
|
||||
static const char *colr_prefix[] = { "+COLR:", NULL };
|
||||
|
||||
static void ccwa_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||
{
|
||||
|
@ -319,6 +320,57 @@ error:
|
|||
CALLBACK_WITH_FAILURE(cb, data);
|
||||
}
|
||||
|
||||
static void colr_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||
{
|
||||
struct cb_data *cbd = user_data;
|
||||
ofono_call_settings_status_cb_t cb = cbd->cb;
|
||||
struct ofono_error error;
|
||||
GAtResultIter iter;
|
||||
int status;
|
||||
|
||||
decode_at_error(&error, g_at_result_final_response(result));
|
||||
|
||||
if (!ok) {
|
||||
cb(&error, -1, cbd->data);
|
||||
return;
|
||||
}
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
||||
if (g_at_result_iter_next(&iter, "+COLR:") == FALSE)
|
||||
goto error;
|
||||
|
||||
if (g_at_result_iter_next_number(&iter, &status) == FALSE)
|
||||
goto error;
|
||||
|
||||
DBG("colr_query_cb: network: %d", status);
|
||||
|
||||
cb(&error, status, cbd->data);
|
||||
return;
|
||||
|
||||
error:
|
||||
CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
|
||||
}
|
||||
|
||||
static void at_colr_query(struct ofono_call_settings *cs,
|
||||
ofono_call_settings_status_cb_t cb, void *data)
|
||||
{
|
||||
GAtChat *chat = ofono_call_settings_get_data(cs);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(chat, "AT+COLR", colr_prefix,
|
||||
colr_query_cb, cbd, g_free) > 0)
|
||||
return;
|
||||
|
||||
error:
|
||||
g_free(cbd);
|
||||
|
||||
CALLBACK_WITH_FAILURE(cb, -1, data);
|
||||
}
|
||||
|
||||
static gboolean at_call_settings_register(gpointer user)
|
||||
{
|
||||
struct ofono_call_settings *cs = user;
|
||||
|
@ -355,7 +407,7 @@ static struct ofono_call_settings_driver driver = {
|
|||
.colp_query = at_colp_query,
|
||||
.clir_query = at_clir_query,
|
||||
.clir_set = at_clir_set,
|
||||
.colr_query = NULL,
|
||||
.colr_query = at_colr_query,
|
||||
.cw_query = at_ccwa_query,
|
||||
.cw_set = at_ccwa_set,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue