diff options
Diffstat (limited to 'src/mm-iface-modem-3gpp.c')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 155 |
1 files changed, 28 insertions, 127 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index de92f328..8d6c6ce0 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -30,13 +30,9 @@ #define SUBSYSTEM_3GPP "3gpp" -#define INDICATORS_CHECKED_TAG "3gpp-indicators-checked-tag" -#define UNSOLICITED_EVENTS_SUPPORTED_TAG "3gpp-unsolicited-events-supported-tag" #define REGISTRATION_STATE_CONTEXT_TAG "3gpp-registration-state-context-tag" #define REGISTRATION_CHECK_CONTEXT_TAG "3gpp-registration-check-context-tag" -static GQuark indicators_checked_quark; -static GQuark unsolicited_events_supported_quark; static GQuark registration_state_context_quark; static GQuark registration_check_context_quark; @@ -1113,41 +1109,25 @@ interface_disabling_step (DisablingContext *ctx) ctx->step++; case DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS: - if (G_UNLIKELY (!unsolicited_events_supported_quark)) - unsolicited_events_supported_quark = (g_quark_from_static_string ( - UNSOLICITED_EVENTS_SUPPORTED_TAG)); - - /* Only try to disable if supported */ - if (GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self), - unsolicited_events_supported_quark))) { - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events && - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events ( - ctx->self, - (GAsyncReadyCallback)cleanup_unsolicited_events_ready, - ctx); - return; - } + if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events ( + ctx->self, + (GAsyncReadyCallback)cleanup_unsolicited_events_ready, + ctx); + return; } /* Fall down to next step */ ctx->step++; case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS: - if (G_UNLIKELY (!unsolicited_events_supported_quark)) - unsolicited_events_supported_quark = (g_quark_from_static_string ( - UNSOLICITED_EVENTS_SUPPORTED_TAG)); - - /* Only try to disable if supported */ - if (GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self), - unsolicited_events_supported_quark))) { - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events && - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events ( - ctx->self, - (GAsyncReadyCallback)disable_unsolicited_events_ready, - ctx); - return; - } + if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events ( + ctx->self, + (GAsyncReadyCallback)disable_unsolicited_events_ready, + ctx); + return; } /* Fall down to next step */ ctx->step++; @@ -1179,7 +1159,6 @@ static void interface_enabling_step (EnablingContext *ctx); typedef enum { ENABLING_STEP_FIRST, - ENABLING_STEP_SETUP_INDICATORS, ENABLING_STEP_SETUP_UNSOLICITED_EVENTS, ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS, ENABLING_STEP_SETUP_UNSOLICITED_REGISTRATION, @@ -1276,36 +1255,6 @@ mm_iface_modem_3gpp_enable_finish (MMIfaceModem3gpp *self, } static void -setup_indicators_ready (MMIfaceModem3gpp *self, - GAsyncResult *res, - EnablingContext *ctx) -{ - GError *error = NULL; - - MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->setup_indicators_finish (self, res, &error); - if (error) { - /* This error shouldn't be treated as critical */ - mm_dbg ("Indicator control setup failed: '%s'", error->message); - g_error_free (error); - - /* If we get an error setting up indicators, don't even bother trying to - * enable unsolicited events. */ - ctx->step = ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS + 1; - interface_enabling_step (ctx); - return; - } - - /* Indicators setup, so assume we support unsolicited events */ - g_object_set_qdata (G_OBJECT (self), - unsolicited_events_supported_quark, - GUINT_TO_POINTER (TRUE)); - - /* Go on to next step */ - ctx->step++; - interface_enabling_step (ctx); -} - -static void enable_unsolicited_events_ready (MMIfaceModem3gpp *self, GAsyncResult *res, EnablingContext *ctx) @@ -1317,11 +1266,6 @@ enable_unsolicited_events_ready (MMIfaceModem3gpp *self, /* This error shouldn't be treated as critical */ mm_dbg ("Enabling unsolicited events failed: '%s'", error->message); g_error_free (error); - - /* Reset support flag */ - g_object_set_qdata (G_OBJECT (self), - unsolicited_events_supported_quark, - GUINT_TO_POINTER (FALSE)); } /* Go on to next step */ @@ -1342,11 +1286,6 @@ setup_unsolicited_events_ready (MMIfaceModem3gpp *self, mm_dbg ("Setting up unsolicited events failed: '%s'", error->message); g_error_free (error); - /* Reset support flag */ - g_object_set_qdata (G_OBJECT (self), - unsolicited_events_supported_quark, - GUINT_TO_POINTER (FALSE)); - /* If we get an error setting up unsolicited events, don't even bother trying to * enable them. */ ctx->step = ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS + 1; @@ -1448,67 +1387,29 @@ interface_enabling_step (EnablingContext *ctx) switch (ctx->step) { case ENABLING_STEP_FIRST: - /* Setup quarks if we didn't do it before */ - if (G_UNLIKELY (!indicators_checked_quark)) - indicators_checked_quark = (g_quark_from_static_string ( - INDICATORS_CHECKED_TAG)); - if (G_UNLIKELY (!unsolicited_events_supported_quark)) - unsolicited_events_supported_quark = (g_quark_from_static_string ( - UNSOLICITED_EVENTS_SUPPORTED_TAG)); - /* Fall down to next step */ - ctx->step++; - - case ENABLING_STEP_SETUP_INDICATORS: - if (!GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self), - indicators_checked_quark))) { - /* Set the checked flag so that we don't run it again */ - g_object_set_qdata (G_OBJECT (ctx->self), - indicators_checked_quark, - GUINT_TO_POINTER (TRUE)); - /* Initially, assume we don't support unsolicited events */ - g_object_set_qdata (G_OBJECT (ctx->self), - unsolicited_events_supported_quark, - GUINT_TO_POINTER (FALSE)); - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_indicators && - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_indicators_finish) { - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_indicators ( - ctx->self, - (GAsyncReadyCallback)setup_indicators_ready, - ctx); - return; - } - } /* Fall down to next step */ ctx->step++; case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS: - /* Only try to setup unsolicited events if they are supported */ - if (GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self), - unsolicited_events_supported_quark))) { - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_unsolicited_events && - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_unsolicited_events ( - ctx->self, - (GAsyncReadyCallback)setup_unsolicited_events_ready, - ctx); - return; - } + if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_unsolicited_events && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_unsolicited_events ( + ctx->self, + (GAsyncReadyCallback)setup_unsolicited_events_ready, + ctx); + return; } /* Fall down to next step */ ctx->step++; case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS: - /* Only try to enable unsolicited events if they are supported */ - if (GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self), - unsolicited_events_supported_quark))) { - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events && - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events ( - ctx->self, - (GAsyncReadyCallback)enable_unsolicited_events_ready, - ctx); - return; - } + if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events ( + ctx->self, + (GAsyncReadyCallback)enable_unsolicited_events_ready, + ctx); + return; } /* Fall down to next step */ ctx->step++; |