sim: update unlock retry counts after PIN change/enable operations

This commit is contained in:
Aleksander Morgado
2012-03-01 17:17:30 +01:00
parent cd63df938f
commit 41fe01b217

View File

@@ -158,6 +158,19 @@ handle_change_pin_context_free (HandleChangePinContext *ctx)
g_free (ctx); g_free (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 static void
handle_change_pin_ready (MMSim *self, handle_change_pin_ready (MMSim *self,
GAsyncResult *res, GAsyncResult *res,
@@ -166,12 +179,17 @@ handle_change_pin_ready (MMSim *self,
GError *error = NULL; GError *error = NULL;
MM_SIM_GET_CLASS (self)->change_pin_finish (self, res, &error); MM_SIM_GET_CLASS (self)->change_pin_finish (self, res, &error);
if (error) if (error) {
g_dbus_method_invocation_take_error (ctx->invocation, 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); handle_change_pin_context_free (ctx);
return;
}
/* 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 static void
@@ -308,6 +326,19 @@ handle_enable_pin_context_free (HandleEnablePinContext *ctx)
g_free (ctx); g_free (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 static void
handle_enable_pin_ready (MMSim *self, handle_enable_pin_ready (MMSim *self,
GAsyncResult *res, GAsyncResult *res,
@@ -316,16 +347,20 @@ handle_enable_pin_ready (MMSim *self,
GError *error = NULL; GError *error = NULL;
MM_SIM_GET_CLASS (self)->enable_pin_finish (self, res, &error); MM_SIM_GET_CLASS (self)->enable_pin_finish (self, res, &error);
if (error) if (error) {
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
else { handle_enable_pin_context_free (ctx);
mm_gdbus_sim_complete_enable_pin (MM_GDBUS_SIM (self), ctx->invocation); return;
}
/* Signal about the new lock state */ /* Signal about the new lock state */
g_signal_emit (self, signals[SIGNAL_PIN_LOCK_ENABLED], 0, ctx->enabled); g_signal_emit (self, signals[SIGNAL_PIN_LOCK_ENABLED], 0, ctx->enabled);
}
handle_enable_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_enable_unlock_retries_ready,
ctx);
} }
static void static void