diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-22 00:21:07 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-22 13:39:35 +0200 |
commit | 79fbe274e92605f7d31de3e4588dd4848bc6e797 (patch) | |
tree | e9c009c4131124e4a4111a55b09d7b89e9251784 /src | |
parent | 2aceb907f4b1bc892874627f94586deff6c6808e (diff) |
iface-modem: new async method to be run just after the successful SIM unlock
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem.c | 33 | ||||
-rw-r--r-- | src/mm-iface-modem.h | 9 |
2 files changed, 40 insertions, 2 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 3373b5ba..f9266a4c 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -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; } diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h index cad763ee..4a3d75b3 100644 --- a/src/mm-iface-modem.h +++ b/src/mm-iface-modem.h @@ -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, |