libmm-glib: new 'profile-enabled' in 3GPP profile
Not applicable to bearer properties, as this is exclusively a proflie management setting, unrelated to connection attempts.
This commit is contained in:
@@ -1649,6 +1649,8 @@ mm_3gpp_profile_get_profile_name
|
||||
mm_3gpp_profile_set_profile_name
|
||||
mm_3gpp_profile_get_access_type_preference
|
||||
mm_3gpp_profile_set_access_type_preference
|
||||
mm_3gpp_profile_get_enabled
|
||||
mm_3gpp_profile_set_enabled
|
||||
<SUBSECTION Private>
|
||||
mm_3gpp_profile_new_from_dictionary
|
||||
mm_3gpp_profile_new_from_string
|
||||
|
@@ -46,6 +46,7 @@ G_DEFINE_TYPE (MM3gppProfile, mm_3gpp_profile, G_TYPE_OBJECT)
|
||||
#define PROPERTY_IP_TYPE "ip-type"
|
||||
#define PROPERTY_APN_TYPE "apn-type"
|
||||
#define PROPERTY_ACCESS_TYPE_PREFERENCE "access-type-preference"
|
||||
#define PROPERTY_ENABLED "profile-enabled"
|
||||
|
||||
struct _MM3gppProfilePrivate {
|
||||
gint profile_id;
|
||||
@@ -54,6 +55,8 @@ struct _MM3gppProfilePrivate {
|
||||
MMBearerIpFamily ip_type;
|
||||
MMBearerApnType apn_type;
|
||||
MMBearerAccessTypePreference access_type_preference;
|
||||
gboolean enabled;
|
||||
gboolean enabled_set;
|
||||
|
||||
/* Optional authentication settings */
|
||||
MMBearerAllowedAuth allowed_auth;
|
||||
@@ -112,6 +115,9 @@ mm_3gpp_profile_cmp (MM3gppProfile *a,
|
||||
if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE) &&
|
||||
(a->priv->access_type_preference != b->priv->access_type_preference))
|
||||
return FALSE;
|
||||
if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED) &&
|
||||
((a->priv->enabled != b->priv->enabled) || (a->priv->enabled_set != b->priv->enabled_set)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -473,6 +479,45 @@ mm_3gpp_profile_get_access_type_preference (MM3gppProfile *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_3gpp_profile_set_enabled:
|
||||
* @self: a #MM3gppProfile.
|
||||
* @enabled: boolean value.
|
||||
*
|
||||
* Sets the flag to indicate whether the profile is enabled or disabled.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
void
|
||||
mm_3gpp_profile_set_enabled (MM3gppProfile *self,
|
||||
gboolean enabled)
|
||||
{
|
||||
g_return_if_fail (MM_IS_3GPP_PROFILE (self));
|
||||
|
||||
self->priv->enabled_set = TRUE;
|
||||
self->priv->enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_3gpp_profile_get_enabled:
|
||||
* @self: a #MM3gppProfile.
|
||||
*
|
||||
* Checks whether the profile is enabled or disabled.
|
||||
*
|
||||
* Returns: %TRUE if the profile is enabled, %FALSE otherwise.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
gboolean
|
||||
mm_3gpp_profile_get_enabled (MM3gppProfile *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_3GPP_PROFILE (self), FALSE);
|
||||
|
||||
return self->priv->enabled;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_3gpp_profile_get_dictionary: (skip)
|
||||
*/
|
||||
@@ -542,6 +587,13 @@ mm_3gpp_profile_get_dictionary (MM3gppProfile *self)
|
||||
PROPERTY_ACCESS_TYPE_PREFERENCE,
|
||||
g_variant_new_uint32 (self->priv->access_type_preference));
|
||||
|
||||
if (self->priv->enabled_set)
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
PROPERTY_ENABLED,
|
||||
g_variant_new_boolean (self->priv->enabled));
|
||||
|
||||
|
||||
return g_variant_ref_sink (g_variant_builder_end (&builder));
|
||||
}
|
||||
|
||||
@@ -612,6 +664,16 @@ mm_3gpp_profile_consume_string (MM3gppProfile *self,
|
||||
return FALSE;
|
||||
}
|
||||
mm_3gpp_profile_set_access_type_preference (self, access_type_preference);
|
||||
} else if (g_str_equal (key, PROPERTY_ENABLED)) {
|
||||
GError *inner_error = NULL;
|
||||
gboolean profile_enabled;
|
||||
|
||||
profile_enabled = mm_common_get_boolean_from_string (value, &inner_error);
|
||||
if (inner_error) {
|
||||
g_propagate_error (error, inner_error);
|
||||
return FALSE;
|
||||
}
|
||||
mm_3gpp_profile_set_enabled (self, profile_enabled);
|
||||
} else {
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
@@ -712,6 +774,10 @@ mm_3gpp_profile_consume_variant (MM3gppProfile *self,
|
||||
mm_3gpp_profile_set_access_type_preference (
|
||||
self,
|
||||
g_variant_get_uint32 (value));
|
||||
else if (g_str_equal (key, PROPERTY_ENABLED))
|
||||
mm_3gpp_profile_set_enabled (
|
||||
self,
|
||||
g_variant_get_boolean (value));
|
||||
else {
|
||||
/* Set error */
|
||||
g_set_error (error,
|
||||
@@ -798,6 +864,7 @@ mm_3gpp_profile_init (MM3gppProfile *self)
|
||||
self->priv->ip_type = MM_BEARER_IP_FAMILY_NONE;
|
||||
self->priv->apn_type = MM_BEARER_APN_TYPE_NONE;
|
||||
self->priv->access_type_preference = MM_BEARER_ACCESS_TYPE_PREFERENCE_NONE;
|
||||
self->priv->enabled = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -92,6 +92,8 @@ void mm_3gpp_profile_set_apn_type (MM3gppProfile *s
|
||||
MMBearerApnType apn_type);
|
||||
void mm_3gpp_profile_set_access_type_preference (MM3gppProfile *self,
|
||||
MMBearerAccessTypePreference access_type_preference);
|
||||
void mm_3gpp_profile_set_enabled (MM3gppProfile *self,
|
||||
gboolean enabled);
|
||||
|
||||
gint mm_3gpp_profile_get_profile_id (MM3gppProfile *self);
|
||||
const gchar *mm_3gpp_profile_get_profile_name (MM3gppProfile *self);
|
||||
@@ -102,6 +104,7 @@ const gchar *mm_3gpp_profile_get_password (MM3gpp
|
||||
MMBearerIpFamily mm_3gpp_profile_get_ip_type (MM3gppProfile *self);
|
||||
MMBearerApnType mm_3gpp_profile_get_apn_type (MM3gppProfile *self);
|
||||
MMBearerAccessTypePreference mm_3gpp_profile_get_access_type_preference (MM3gppProfile *self);
|
||||
gboolean mm_3gpp_profile_get_enabled (MM3gppProfile *self);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ModemManager/libmm-glib/mmcli specific methods */
|
||||
@@ -132,6 +135,7 @@ typedef enum {
|
||||
MM_3GPP_PROFILE_CMP_FLAGS_NO_APN_TYPE = 1 << 4,
|
||||
MM_3GPP_PROFILE_CMP_FLAGS_NO_IP_TYPE = 1 << 5,
|
||||
MM_3GPP_PROFILE_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE = 1 << 6,
|
||||
MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED = 1 << 7,
|
||||
} MM3gppProfileCmpFlags;
|
||||
|
||||
gboolean mm_3gpp_profile_cmp (MM3gppProfile *a,
|
||||
|
Reference in New Issue
Block a user