iface-modem: new async method to be run just after the successful SIM unlock

This commit is contained in:
Aleksander Morgado
2012-07-22 13:39:35 +02:00
parent 2aceb907f4
commit 79fbe274e9
2 changed files with 40 additions and 2 deletions
+31 -2
View File
@@ -1972,12 +1972,41 @@ reinitialize_ready (MMBaseModem *self,
}
}
static gboolean
restart_initialize_idle (MMIfaceModem *self)
static void
modem_after_sim_unlock_ready (MMIfaceModem *self,
GAsyncResult *res)
{
GError *error = NULL;
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock_finish (self, res, &error)) {
mm_warn ("After SIM unlock failed setup: '%s'", error->message);
g_error_free (error);
}
/* Go on */
mm_base_modem_initialize (MM_BASE_MODEM (self),
(GAsyncReadyCallback) reinitialize_ready,
NULL);
}
static gboolean
restart_initialize_idle (MMIfaceModem *self)
{
/* If we were asked to run something after having sent the PIN unlock,
* do it now. This may be just a timeout or some other command that gives us
* the real SIM state */
if (MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock != NULL &&
MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock_finish != NULL) {
MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock(
self,
(GAsyncReadyCallback)modem_after_sim_unlock_ready,
NULL);
} else {
/* If no wait needed, just go on */
mm_base_modem_initialize (MM_BASE_MODEM (self),
(GAsyncReadyCallback) reinitialize_ready,
NULL);
}
return FALSE;
}
+9
View File
@@ -227,6 +227,15 @@ struct _MMIfaceModem {
GAsyncResult *res,
GError **error);
/* Asynchronous method to wait for the SIM to be ready after having
* unlocked it. */
void (*modem_after_sim_unlock) (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*modem_after_sim_unlock_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
/* Asynchronous modem power-up operation */
void (*modem_power_up) (MMIfaceModem *self,
GAsyncReadyCallback callback,