iface-modem-3gpp: let plugins ignore facility locks

Plugins may decide which facility locks can be completely skipped from the list
being checked.
This commit is contained in:
Aleksander Morgado
2013-03-27 15:14:34 +01:00
parent fea5b7a670
commit d9cf4fe91c
3 changed files with 39 additions and 5 deletions

View File

@@ -87,6 +87,7 @@ enum {
PROP_MODEM_3GPP_CS_NETWORK_SUPPORTED,
PROP_MODEM_3GPP_PS_NETWORK_SUPPORTED,
PROP_MODEM_3GPP_EPS_NETWORK_SUPPORTED,
PROP_MODEM_3GPP_IGNORED_FACILITY_LOCKS,
PROP_MODEM_CDMA_CDMA1X_REGISTRATION_STATE,
PROP_MODEM_CDMA_EVDO_REGISTRATION_STATE,
PROP_MODEM_CDMA_CDMA1X_NETWORK_SUPPORTED,
@@ -134,6 +135,7 @@ struct _MMBroadbandModemPrivate {
gboolean modem_3gpp_eps_network_supported;
/* Implementation helpers */
GPtrArray *modem_3gpp_registration_regex;
MMModem3gppFacility modem_3gpp_ignored_facility_locks;
/*<--- Modem 3GPP USSD interface --->*/
/* Properties */
@@ -3054,6 +3056,17 @@ clck_test_ready (MMBaseModem *self,
return;
}
/* Ignore facility locks specified by the plugins */
if (MM_BROADBAND_MODEM (self)->priv->modem_3gpp_ignored_facility_locks) {
gchar *str;
str = mm_modem_3gpp_facility_build_string_from_mask (MM_BROADBAND_MODEM (self)->priv->modem_3gpp_ignored_facility_locks);
mm_dbg ("Ignoring facility locks: '%s'", str);
g_free (str);
ctx->facilities &= ~MM_BROADBAND_MODEM (self)->priv->modem_3gpp_ignored_facility_locks;
}
/* Go on... */
get_next_facility_lock_status (ctx);
}
@@ -8960,6 +8973,9 @@ set_property (GObject *object,
case PROP_MODEM_3GPP_EPS_NETWORK_SUPPORTED:
self->priv->modem_3gpp_eps_network_supported = g_value_get_boolean (value);
break;
case PROP_MODEM_3GPP_IGNORED_FACILITY_LOCKS:
self->priv->modem_3gpp_ignored_facility_locks = g_value_get_flags (value);
break;
case PROP_MODEM_CDMA_CDMA1X_REGISTRATION_STATE:
self->priv->modem_cdma_cdma1x_registration_state = g_value_get_enum (value);
break;
@@ -9049,6 +9065,9 @@ get_property (GObject *object,
case PROP_MODEM_3GPP_EPS_NETWORK_SUPPORTED:
g_value_set_boolean (value, self->priv->modem_3gpp_eps_network_supported);
break;
case PROP_MODEM_3GPP_IGNORED_FACILITY_LOCKS:
g_value_set_flags (value, self->priv->modem_3gpp_ignored_facility_locks);
break;
case PROP_MODEM_CDMA_CDMA1X_REGISTRATION_STATE:
g_value_set_enum (value, self->priv->modem_cdma_cdma1x_registration_state);
break;
@@ -9093,6 +9112,7 @@ mm_broadband_modem_init (MMBroadbandModem *self)
self->priv->modem_3gpp_cs_network_supported = TRUE;
self->priv->modem_3gpp_ps_network_supported = TRUE;
self->priv->modem_3gpp_eps_network_supported = FALSE;
self->priv->modem_3gpp_ignored_facility_locks = MM_MODEM_3GPP_FACILITY_NONE;
self->priv->modem_cdma_cdma1x_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
self->priv->modem_cdma_evdo_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
self->priv->modem_cdma_cdma1x_network_supported = TRUE;
@@ -9457,6 +9477,10 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
PROP_MODEM_3GPP_EPS_NETWORK_SUPPORTED,
MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED);
g_object_class_override_property (object_class,
PROP_MODEM_3GPP_IGNORED_FACILITY_LOCKS,
MM_IFACE_MODEM_3GPP_IGNORED_FACILITY_LOCKS);
g_object_class_override_property (object_class,
PROP_MODEM_CDMA_CDMA1X_REGISTRATION_STATE,
MM_IFACE_MODEM_CDMA_CDMA1X_REGISTRATION_STATE);

View File

@@ -2148,6 +2148,15 @@ iface_modem_3gpp_init (gpointer g_iface)
FALSE,
G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_flags (MM_IFACE_MODEM_3GPP_IGNORED_FACILITY_LOCKS,
"Ignored locks",
"Ignored facility locks",
MM_TYPE_MODEM_3GPP_FACILITY,
MM_MODEM_3GPP_FACILITY_NONE,
G_PARAM_READWRITE));
initialized = TRUE;
}

View File

@@ -28,11 +28,12 @@
#define MM_IS_IFACE_MODEM_3GPP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_3GPP))
#define MM_IFACE_MODEM_3GPP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_IFACE_MODEM_3GPP, MMIfaceModem3gpp))
#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_CS_NETWORK_SUPPORTED "iface-modem-3gpp-cs-network-supported"
#define MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED "iface-modem-3gpp-ps-network-supported"
#define MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED "iface-modem-3gpp-eps-network-supported"
#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_CS_NETWORK_SUPPORTED "iface-modem-3gpp-cs-network-supported"
#define MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED "iface-modem-3gpp-ps-network-supported"
#define MM_IFACE_MODEM_3GPP_EPS_NETWORK_SUPPORTED "iface-modem-3gpp-eps-network-supported"
#define MM_IFACE_MODEM_3GPP_IGNORED_FACILITY_LOCKS "iface-modem-3gpp-ignored-facility-locks"
#define MM_IFACE_MODEM_3GPP_ALL_ACCESS_TECHNOLOGIES_MASK \
(MM_MODEM_ACCESS_TECHNOLOGY_GSM | \