diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-09 17:59:06 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-03-22 08:12:59 +0100 |
commit | 5cc98341ad5fbafd3d8f83c65767f604b0e5a5e4 (patch) | |
tree | e5eec079c857b8b11ecaf2b5bb57a56a5dcc22af /src/mm-iface-modem-cdma.c | |
parent | 240dc12fd268b2fed4c14e303779d779d9c39490 (diff) |
iface-modem-cdma: load initial activation state during init
Diffstat (limited to 'src/mm-iface-modem-cdma.c')
-rw-r--r-- | src/mm-iface-modem-cdma.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c index f79b17d1..8bbd42e5 100644 --- a/src/mm-iface-modem-cdma.c +++ b/src/mm-iface-modem-cdma.c @@ -1604,6 +1604,7 @@ typedef enum { INITIALIZATION_STEP_FIRST, INITIALIZATION_STEP_MEID, INITIALIZATION_STEP_ESN, + INITIALIZATION_STEP_ACTIVATION_STATE, INITIALIZATION_STEP_LAST } InitializationStep; @@ -1668,6 +1669,27 @@ STR_REPLY_READY_FN (meid, "MEID") STR_REPLY_READY_FN (esn, "ESN") static void +load_activation_state_ready (MMIfaceModemCdma *self, + GAsyncResult *res, + InitializationContext *ctx) +{ + GError *error = NULL; + MMModemCdmaActivationState state; + + state = MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_activation_state_finish (self, res, &error); + mm_gdbus_modem_cdma_set_activation_state (ctx->skeleton, state); + + if (error) { + mm_warn ("couldn't load activation state: '%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) { /* Don't run new steps if we're cancelled */ @@ -1711,6 +1733,22 @@ interface_initialization_step (InitializationContext *ctx) /* Fall down to next step */ ctx->step++; + case INITIALIZATION_STEP_ACTIVATION_STATE: + /* Initial activation state 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_modem_cdma_get_activation_state (ctx->skeleton) == MM_MODEM_CDMA_ACTIVATION_STATE_UNKNOWN && + MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_activation_state && + MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_activation_state_finish) { + MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_activation_state ( + ctx->self, + (GAsyncReadyCallback)load_activation_state_ready, + ctx); + return; + } + /* Fall down to next step */ + ctx->step++; + case INITIALIZATION_STEP_LAST: /* We are done without errors! */ |