api,sim: new 'Emergency Numbers' property
This commit is contained in:
@@ -1341,6 +1341,7 @@ typedef enum {
|
||||
INITIALIZATION_STEP_IMSI,
|
||||
INITIALIZATION_STEP_OPERATOR_ID,
|
||||
INITIALIZATION_STEP_OPERATOR_NAME,
|
||||
INITIALIZATION_STEP_EMERGENCY_NUMBERS,
|
||||
INITIALIZATION_STEP_LAST
|
||||
} InitializationStep;
|
||||
|
||||
@@ -1414,6 +1415,32 @@ init_load_sim_identifier_ready (MMBaseSim *self,
|
||||
interface_initialization_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
init_load_emergency_numbers_ready (MMBaseSim *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
InitAsyncContext *ctx;
|
||||
GError *error = NULL;
|
||||
GStrv str_list;
|
||||
|
||||
str_list = MM_BASE_SIM_GET_CLASS (self)->load_emergency_numbers_finish (self, res, &error);
|
||||
if (error) {
|
||||
mm_warn ("couldn't load list of Emergency Numbers: '%s'", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (str_list) {
|
||||
mm_gdbus_sim_set_emergency_numbers (MM_GDBUS_SIM (self), (const gchar *const *) str_list);
|
||||
g_strfreev (str_list);
|
||||
}
|
||||
|
||||
/* Go on to next step */
|
||||
ctx = g_task_get_task_data (task);
|
||||
ctx->step++;
|
||||
interface_initialization_step (task);
|
||||
}
|
||||
|
||||
#undef STR_REPLY_READY_FN
|
||||
#define STR_REPLY_READY_FN(NAME,DISPLAY) \
|
||||
static void \
|
||||
@@ -1527,6 +1554,22 @@ interface_initialization_step (GTask *task)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case INITIALIZATION_STEP_EMERGENCY_NUMBERS:
|
||||
/* Emergency Numbers are meant to be loaded only once during the whole
|
||||
* lifetime of the modem. Therefore, if we already have them loaded,
|
||||
* don't try to load them again. */
|
||||
if (mm_gdbus_sim_get_emergency_numbers (MM_GDBUS_SIM (self)) == NULL &&
|
||||
MM_BASE_SIM_GET_CLASS (self)->load_emergency_numbers &&
|
||||
MM_BASE_SIM_GET_CLASS (self)->load_emergency_numbers_finish) {
|
||||
MM_BASE_SIM_GET_CLASS (self)->load_emergency_numbers (
|
||||
self,
|
||||
(GAsyncReadyCallback)init_load_emergency_numbers_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case INITIALIZATION_STEP_LAST:
|
||||
/* We are done without errors! */
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
||||
@@ -83,6 +83,14 @@ struct _MMBaseSimClass {
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Load emergency numbers (async) */
|
||||
void (* load_emergency_numbers) (MMBaseSim *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GStrv (* load_emergency_numbers_finish) (MMBaseSim *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Change PIN (async) */
|
||||
void (* change_pin) (MMBaseSim *self,
|
||||
const gchar *old_pin,
|
||||
|
||||
Reference in New Issue
Block a user