iface-modem-simple: try to skip initial steps in the Simple Connect sequence

This commit is contained in:
Aleksander Morgado
2012-03-16 15:38:09 +01:00
parent 295272196d
commit 6bb90d92e4

View File

@@ -577,6 +577,7 @@ connect_auth_ready (MMBaseModem *self,
ConnectionContext *ctx) ConnectionContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
MMModemState current = MM_MODEM_STATE_UNKNOWN;
if (!mm_base_modem_authorize_finish (self, res, &error)) { if (!mm_base_modem_authorize_finish (self, res, &error)) {
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
@@ -591,8 +592,18 @@ connect_auth_ready (MMBaseModem *self,
return; return;
} }
/* Start */ /* We may be able to skip some steps, so check that before doing anything */
g_object_get (self,
MM_IFACE_MODEM_STATE, &current,
NULL);
if (current >= MM_MODEM_STATE_ENABLED)
ctx->step = CONNECTION_STEP_ENABLE + 1;
else if (current >= MM_MODEM_STATE_DISABLED)
ctx->step = CONNECTION_STEP_UNLOCK_CHECK + 1;
else
ctx->step = CONNECTION_STEP_FIRST; ctx->step = CONNECTION_STEP_FIRST;
connection_step (ctx); connection_step (ctx);
} }