diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-11-28 18:47:32 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:29 +0100 |
commit | 8f6018d9c60e318d6593c576e1ba804730785604 (patch) | |
tree | 1735368cd043c2c08594b2d0101f703b97a495bd /src | |
parent | 04f10820f38a57d8f3e13ced25274c2fbdee518d (diff) |
iface-modem-3gpp: setup CS and PS registrations during enable
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 50 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.h | 16 |
2 files changed, 66 insertions, 0 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index f3e8ef59..4b57f303 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -49,6 +49,8 @@ static void interface_enabling_step (EnablingContext *ctx); typedef enum { ENABLING_STEP_FIRST, + ENABLING_STEP_SETUP_CS_REGISTRATION, + ENABLING_STEP_SETUP_PS_REGISTRATION, ENABLING_STEP_LAST } EnablingStep; @@ -102,6 +104,30 @@ mm_iface_modem_3gpp_enable_finish (MMIfaceModem3gpp *self, return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); } +#undef VOID_REPLY_READY_FN +#define VOID_REPLY_READY_FN(NAME) \ + static void \ + NAME##_ready (MMIfaceModem3gpp *self, \ + GAsyncResult *res, \ + EnablingContext *ctx) \ + { \ + GError *error = NULL; \ + \ + MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->NAME##_finish (self, res, &error); \ + if (error) { \ + g_simple_async_result_take_error (ctx->result, error); \ + enabling_context_complete_and_free (ctx); \ + return; \ + } \ + \ + /* Go on to next step */ \ + ctx->step++; \ + interface_enabling_step (ctx); \ + } + +VOID_REPLY_READY_FN (setup_cs_registration) +VOID_REPLY_READY_FN (setup_ps_registration) + static void interface_enabling_step (EnablingContext *ctx) { @@ -110,6 +136,30 @@ interface_enabling_step (EnablingContext *ctx) /* Fall down to next step */ ctx->step++; + case ENABLING_STEP_SETUP_CS_REGISTRATION: + if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_cs_registration && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_cs_registration_finish) { + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_cs_registration ( + ctx->self, + (GAsyncReadyCallback)setup_cs_registration_ready, + ctx); + return; + } + /* Fall down to next step */ + ctx->step++; + + case ENABLING_STEP_SETUP_PS_REGISTRATION: + if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_ps_registration && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_ps_registration_finish) { + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_ps_registration ( + ctx->self, + (GAsyncReadyCallback)setup_ps_registration_ready, + ctx); + return; + } + /* Fall down to next step */ + ctx->step++; + case ENABLING_STEP_LAST: /* We are done without errors! */ g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h index b00c74d3..0f2ea43e 100644 --- a/src/mm-iface-modem-3gpp.h +++ b/src/mm-iface-modem-3gpp.h @@ -40,6 +40,22 @@ struct _MMIfaceModem3gpp { gchar * (*load_imei_finish) (MMIfaceModem3gpp *self, GAsyncResult *res, GError **error); + + /* Setup CS Registration */ + void (* setup_cs_registration) (MMIfaceModem3gpp *self, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*setup_cs_registration_finish) (MMIfaceModem3gpp *self, + GAsyncResult *res, + GError **error); + + /* Setup PS Registration */ + void (* setup_ps_registration) (MMIfaceModem3gpp *self, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*setup_ps_registration_finish) (MMIfaceModem3gpp *self, + GAsyncResult *res, + GError **error); }; GType mm_iface_modem_3gpp_get_type (void); |