diff options
-rw-r--r-- | src/mm-broadband-modem.c | 26 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 101 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.h | 2 |
3 files changed, 117 insertions, 12 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 9e5b5528..47a6a3c0 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -62,6 +62,8 @@ enum { PROP_MODEM_STATE, PROP_MODEM_CURRENT_CAPABILITIES, PROP_MODEM_3GPP_REGISTRATION_STATE, + PROP_MODEM_3GPP_CS_NETWORK_SUPPORTED, + PROP_MODEM_3GPP_PS_NETWORK_SUPPORTED, PROP_MODEM_SIMPLE_STATUS, PROP_LAST }; @@ -80,6 +82,8 @@ struct _MMBroadbandModemPrivate { MMModemState modem_state; MMModemCapability modem_current_capabilities; MMModem3gppRegistrationState modem_3gpp_registration_state; + gboolean modem_3gpp_cs_network_supported; + gboolean modem_3gpp_ps_network_supported; MMCommonSimpleProperties *modem_simple_status; /* Modem helpers */ @@ -3341,6 +3345,12 @@ set_property (GObject *object, case PROP_MODEM_3GPP_REGISTRATION_STATE: self->priv->modem_3gpp_registration_state = g_value_get_enum (value); break; + case PROP_MODEM_3GPP_CS_NETWORK_SUPPORTED: + self->priv->modem_3gpp_cs_network_supported = g_value_get_boolean (value); + break; + case PROP_MODEM_3GPP_PS_NETWORK_SUPPORTED: + self->priv->modem_3gpp_ps_network_supported = g_value_get_boolean (value); + break; case PROP_MODEM_SIMPLE_STATUS: self->priv->modem_simple_status = g_value_dup_object (value); break; @@ -3386,6 +3396,12 @@ get_property (GObject *object, case PROP_MODEM_3GPP_REGISTRATION_STATE: g_value_set_enum (value, self->priv->modem_3gpp_registration_state); break; + case PROP_MODEM_3GPP_CS_NETWORK_SUPPORTED: + g_value_set_boolean (value, self->priv->modem_3gpp_cs_network_supported); + break; + case PROP_MODEM_3GPP_PS_NETWORK_SUPPORTED: + g_value_set_boolean (value, self->priv->modem_3gpp_ps_network_supported); + break; case PROP_MODEM_SIMPLE_STATUS: g_value_set_object (value, self->priv->modem_simple_status); break; @@ -3407,6 +3423,8 @@ mm_broadband_modem_init (MMBroadbandModem *self) self->priv->modem_3gpp_registration_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; self->priv->reg_regex = mm_3gpp_creg_regex_get (TRUE); self->priv->current_charset = MM_MODEM_CHARSET_UNKNOWN; + self->priv->modem_3gpp_cs_network_supported = TRUE; + self->priv->modem_3gpp_ps_network_supported = TRUE; } static void @@ -3612,6 +3630,14 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass) MM_IFACE_MODEM_3GPP_REGISTRATION_STATE); g_object_class_override_property (object_class, + PROP_MODEM_3GPP_CS_NETWORK_SUPPORTED, + MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED); + + g_object_class_override_property (object_class, + PROP_MODEM_3GPP_PS_NETWORK_SUPPORTED, + MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED); + + g_object_class_override_property (object_class, PROP_MODEM_SIMPLE_STATUS, MM_IFACE_MODEM_SIMPLE_STATUS); diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 3f1b7326..bade166b 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -401,6 +401,8 @@ mm_iface_modem_3gpp_create_bearer (MMIfaceModem3gpp *self, typedef struct { GSimpleAsyncResult *result; + gboolean cs_supported; + gboolean ps_supported; gboolean cs_done; GError *cs_reg_error; GError *ps_reg_error; @@ -448,7 +450,8 @@ run_cs_registration_check_ready (MMIfaceModem3gpp *self, { MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_cs_registration_check_finish (self, res, &ctx->cs_reg_error); - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check && + if (ctx->ps_supported && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check && MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check_finish) { ctx->cs_done = TRUE; MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check ( @@ -479,7 +482,17 @@ mm_iface_modem_3gpp_run_all_registration_checks (MMIfaceModem3gpp *self, user_data, mm_iface_modem_3gpp_run_all_registration_checks); - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_cs_registration_check && + g_object_get (self, + MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &ctx->ps_supported, + MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &ctx->cs_supported, + NULL); + + mm_dbg ("Running registration checks (CS: '%s', PS: '%s')", + ctx->cs_supported ? "yes" : "no", + ctx->ps_supported ? "yes" : "no"); + + if (ctx->cs_supported && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_cs_registration_check && MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_cs_registration_check_finish) { MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_cs_registration_check ( self, @@ -488,7 +501,8 @@ mm_iface_modem_3gpp_run_all_registration_checks (MMIfaceModem3gpp *self, return; } - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check && + if (ctx->ps_supported && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check && MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check_finish) { MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->run_ps_registration_check ( self, @@ -751,6 +765,14 @@ mm_iface_modem_3gpp_update_cs_registration_state (MMIfaceModem3gpp *self, MMModemAccessTechnology access_tech) { RegistrationStateContext *ctx; + gboolean supported = FALSE; + + g_object_get (self, + MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &supported, + NULL); + + if (!supported) + return; ctx = get_registration_state_context (self); ctx->cs = state; @@ -763,6 +785,14 @@ mm_iface_modem_3gpp_update_ps_registration_state (MMIfaceModem3gpp *self, MMModemAccessTechnology access_tech) { RegistrationStateContext *ctx; + gboolean supported = FALSE; + + g_object_get (self, + MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &supported, + NULL); + + if (!supported) + return; ctx = get_registration_state_context (self); ctx->ps = state; @@ -1106,8 +1136,15 @@ interface_disabling_step (DisablingContext *ctx) /* Fall down to next step */ ctx->step++; - case DISABLING_STEP_CLEANUP_PS_REGISTRATION: - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_ps_registration && + case DISABLING_STEP_CLEANUP_PS_REGISTRATION: { + gboolean ps_supported = FALSE; + + g_object_get (ctx->self, + MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &ps_supported, + NULL); + + if (ps_supported && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_ps_registration && MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_ps_registration_finish) { MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_ps_registration ( ctx->self, @@ -1117,9 +1154,17 @@ interface_disabling_step (DisablingContext *ctx) } /* Fall down to next step */ ctx->step++; + } + + case DISABLING_STEP_CLEANUP_CS_REGISTRATION: { + gboolean cs_supported = FALSE; - case DISABLING_STEP_CLEANUP_CS_REGISTRATION: - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_cs_registration && + g_object_get (ctx->self, + MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &cs_supported, + NULL); + + if (cs_supported && + MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_cs_registration && MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_cs_registration_finish) { MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_cs_registration ( ctx->self, @@ -1129,6 +1174,7 @@ interface_disabling_step (DisablingContext *ctx) } /* Fall down to next step */ ctx->step++; + } case DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION: if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_registration && @@ -1451,8 +1497,15 @@ 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 && + case ENABLING_STEP_SETUP_CS_REGISTRATION: { + gboolean cs_supported = FALSE; + + g_object_get (ctx->self, + MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, &cs_supported, + NULL); + + if (cs_supported && + 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, @@ -1462,9 +1515,17 @@ interface_enabling_step (EnablingContext *ctx) } /* Fall down to next step */ ctx->step++; + } + + case ENABLING_STEP_SETUP_PS_REGISTRATION: { + gboolean ps_supported = FALSE; + + g_object_get (ctx->self, + MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, &ps_supported, + NULL); - case ENABLING_STEP_SETUP_PS_REGISTRATION: - if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_ps_registration && + if (ps_supported && + 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, @@ -1474,7 +1535,7 @@ interface_enabling_step (EnablingContext *ctx) } /* Fall down to next step */ ctx->step++; - + } case ENABLING_STEP_RUN_ALL_REGISTRATION_CHECKS: mm_iface_modem_3gpp_run_all_registration_checks ( ctx->self, @@ -1720,6 +1781,22 @@ iface_modem_3gpp_init (gpointer g_iface) MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN, G_PARAM_READWRITE)); + g_object_interface_install_property + (g_iface, + g_param_spec_boolean (MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED, + "CS network supported", + "Whether the modem works in the CS network", + TRUE, + G_PARAM_READWRITE)); + + g_object_interface_install_property + (g_iface, + g_param_spec_boolean (MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, + "PS network supported", + "Whether the modem works in the PS network", + TRUE, + G_PARAM_READWRITE)); + initialized = TRUE; } diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h index 424b6241..70bfc7bc 100644 --- a/src/mm-iface-modem-3gpp.h +++ b/src/mm-iface-modem-3gpp.h @@ -30,6 +30,8 @@ #define MM_IFACE_MODEM_3GPP_DBUS_SKELETON "iface-modem-3gpp-dbus-skeleton" #define MM_IFACE_MODEM_3GPP_REGISTRATION_STATE "iface-modem-3gpp-registration-state" +#define MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED "iface-modem-3gpp-ps-network-supported" +#define MM_IFACE_MODEM_3GPP_CS_NETWORK_SUPPORTED "iface-modem-3gpp-cs-network-supported" typedef struct _MMIfaceModem3gpp MMIfaceModem3gpp; |