aboutsummaryrefslogtreecommitdiff
path: root/src/mm-sim.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-03-01 17:17:30 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-16 14:53:20 +0100
commit41fe01b2179f080bf62d52acf2e6d1b8fa45ed90 (patch)
tree195f6f3098bc4b8945ddfb0de2a4b3e030324b16 /src/mm-sim.c
parentcd63df938f4fdf3fb656f715745608a9318d1c74 (diff)
sim: update unlock retry counts after PIN change/enable operations
Diffstat (limited to 'src/mm-sim.c')
-rw-r--r--src/mm-sim.c57
1 files changed, 46 insertions, 11 deletions
diff --git a/src/mm-sim.c b/src/mm-sim.c
index b7624854..95a1eec5 100644
--- a/src/mm-sim.c
+++ b/src/mm-sim.c
@@ -159,6 +159,19 @@ handle_change_pin_context_free (HandleChangePinContext *ctx)
}
static void
+after_change_unlock_retries_ready (MMIfaceModem *self,
+ GAsyncResult *res,
+ HandleChangePinContext *ctx)
+{
+ /* We just want to ensure that we tried to update the unlock
+ * retries, no big issue if it failed */
+ mm_iface_modem_update_unlock_retries_finish (self, res, NULL);
+
+ mm_gdbus_sim_complete_change_pin (MM_GDBUS_SIM (ctx->self), ctx->invocation);
+ handle_change_pin_context_free (ctx);
+}
+
+static void
handle_change_pin_ready (MMSim *self,
GAsyncResult *res,
HandleChangePinContext *ctx)
@@ -166,12 +179,17 @@ handle_change_pin_ready (MMSim *self,
GError *error = NULL;
MM_SIM_GET_CLASS (self)->change_pin_finish (self, res, &error);
- if (error)
+ if (error) {
g_dbus_method_invocation_take_error (ctx->invocation, error);
- else
- mm_gdbus_sim_complete_change_pin (MM_GDBUS_SIM (ctx->self), ctx->invocation);
+ handle_change_pin_context_free (ctx);
+ return;
+ }
- handle_change_pin_context_free (ctx);
+ /* Before returning success, ensure that we get the unlock retry
+ * counts updated properly. */
+ mm_iface_modem_update_unlock_retries (MM_IFACE_MODEM (self->priv->modem),
+ (GAsyncReadyCallback)after_change_unlock_retries_ready,
+ ctx);
}
static void
@@ -309,6 +327,19 @@ handle_enable_pin_context_free (HandleEnablePinContext *ctx)
}
static void
+after_enable_unlock_retries_ready (MMIfaceModem *self,
+ GAsyncResult *res,
+ HandleEnablePinContext *ctx)
+{
+ /* We just want to ensure that we tried to update the unlock
+ * retries, no big issue if it failed */
+ mm_iface_modem_update_unlock_retries_finish (self, res, NULL);
+
+ mm_gdbus_sim_complete_enable_pin (MM_GDBUS_SIM (ctx->self), ctx->invocation);
+ handle_enable_pin_context_free (ctx);
+}
+
+static void
handle_enable_pin_ready (MMSim *self,
GAsyncResult *res,
HandleEnablePinContext *ctx)
@@ -316,16 +347,20 @@ handle_enable_pin_ready (MMSim *self,
GError *error = NULL;
MM_SIM_GET_CLASS (self)->enable_pin_finish (self, res, &error);
- if (error)
+ if (error) {
g_dbus_method_invocation_take_error (ctx->invocation, error);
- else {
- mm_gdbus_sim_complete_enable_pin (MM_GDBUS_SIM (self), ctx->invocation);
-
- /* Signal about the new lock state */
- g_signal_emit (self, signals[SIGNAL_PIN_LOCK_ENABLED], 0, ctx->enabled);
+ handle_enable_pin_context_free (ctx);
+ return;
}
- handle_enable_pin_context_free (ctx);
+ /* Signal about the new lock state */
+ g_signal_emit (self, signals[SIGNAL_PIN_LOCK_ENABLED], 0, ctx->enabled);
+
+ /* Before returning success, ensure that we get the unlock retry
+ * counts updated properly. */
+ mm_iface_modem_update_unlock_retries (MM_IFACE_MODEM (self->priv->modem),
+ (GAsyncReadyCallback)after_enable_unlock_retries_ready,
+ ctx);
}
static void