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 | |
parent | 240dc12fd268b2fed4c14e303779d779d9c39490 (diff) |
iface-modem-cdma: load initial activation state during init
-rw-r--r-- | src/mm-iface-modem-cdma.c | 38 | ||||
-rw-r--r-- | src/mm-iface-modem-cdma.h | 8 |
2 files changed, 46 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! */ diff --git a/src/mm-iface-modem-cdma.h b/src/mm-iface-modem-cdma.h index 6806f6b4..e6a6cddd 100644 --- a/src/mm-iface-modem-cdma.h +++ b/src/mm-iface-modem-cdma.h @@ -68,6 +68,14 @@ struct _MMIfaceModemCdma { GAsyncResult *res, GError **error); + /* Loading of the initial activation state */ + void (* load_activation_state) (MMIfaceModemCdma *self, + GAsyncReadyCallback callback, + gpointer user_data); + MMModemCdmaActivationState (* load_activation_state_finish) (MMIfaceModemCdma *self, + GAsyncResult *res, + GError **error); + /* Asynchronous setting up unsolicited events */ void (* setup_unsolicited_events) (MMIfaceModemCdma *self, GAsyncReadyCallback callback, |