diff options
Diffstat (limited to 'src/mm-iface-modem-3gpp.c')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index f6a19b18..6b7cde2a 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -30,6 +30,7 @@ static void interface_initialization_step (InitializationContext *ctx); typedef enum { INITIALIZATION_STEP_FIRST, + INITIALIZATION_STEP_IMEI, INITIALIZATION_STEP_LAST } InitializationStep; @@ -75,6 +76,28 @@ initialization_context_free (InitializationContext *ctx) } static void +load_imei_ready (MMIfaceModem3gpp *self, + GAsyncResult *res, + InitializationContext *ctx) +{ + GError *error = NULL; + gchar *imei; + + imei = MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_imei_finish (self, res, &error); + mm_gdbus_modem3gpp_set_imei (ctx->skeleton, imei); + g_free (imei); + + if (error) { + mm_warn ("couldn't load IMEI: '%s'", error->message); + g_error_free (error); + } + + /* Go on to next step */ + ctx->step++; + interface_initialization_step (ctx); +} + +static void interface_initialization_step (InitializationContext *ctx) { switch (ctx->step) { @@ -82,6 +105,22 @@ interface_initialization_step (InitializationContext *ctx) /* Fall down to next step */ ctx->step++; + case INITIALIZATION_STEP_IMEI: + /* IMEI value is meant to be loaded only once during the whole + * lifetime of the modem. Therefore, if we already have it loaded, + * don't try to load it again. */ + if (!mm_gdbus_modem3gpp_get_imei (ctx->skeleton) && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->load_imei && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->load_imei_finish) { + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->load_imei ( + ctx->self, + (GAsyncReadyCallback)load_imei_ready, + ctx); + return; + } + /* Fall down to next step */ + ctx->step++; + case INITIALIZATION_STEP_LAST: /* We are done without errors! */ g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); |