diff options
-rw-r--r-- | docs/reference/libmm-glib/libmm-glib-sections.txt | 2 | ||||
-rw-r--r-- | libmm-glib/mm-3gpp-profile.c | 58 | ||||
-rw-r--r-- | libmm-glib/mm-3gpp-profile.h | 4 | ||||
-rw-r--r-- | libmm-glib/mm-common-helpers.c | 10 | ||||
-rw-r--r-- | libmm-glib/mm-common-helpers.h | 2 |
5 files changed, 76 insertions, 0 deletions
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt index 153d1d804..26bc73e8c 100644 --- a/docs/reference/libmm-glib/libmm-glib-sections.txt +++ b/docs/reference/libmm-glib/libmm-glib-sections.txt @@ -1655,6 +1655,8 @@ mm_3gpp_profile_get_enabled mm_3gpp_profile_set_enabled mm_3gpp_profile_get_roaming_allowance mm_3gpp_profile_set_roaming_allowance +mm_3gpp_profile_get_profile_source +mm_3gpp_profile_set_profile_source <SUBSECTION Private> mm_3gpp_profile_new_from_dictionary mm_3gpp_profile_new_from_string diff --git a/libmm-glib/mm-3gpp-profile.c b/libmm-glib/mm-3gpp-profile.c index b9c66fce1..cc2218252 100644 --- a/libmm-glib/mm-3gpp-profile.c +++ b/libmm-glib/mm-3gpp-profile.c @@ -48,6 +48,7 @@ G_DEFINE_TYPE (MM3gppProfile, mm_3gpp_profile, G_TYPE_OBJECT) #define PROPERTY_ACCESS_TYPE_PREFERENCE "access-type-preference" #define PROPERTY_ENABLED "profile-enabled" #define PROPERTY_ROAMING_ALLOWANCE "roaming-allowance" +#define PROPERTY_SOURCE "profile-source" struct _MM3gppProfilePrivate { gint profile_id; @@ -59,6 +60,7 @@ struct _MM3gppProfilePrivate { gboolean enabled; gboolean enabled_set; MMBearerRoamingAllowance roaming_allowance; + MMBearerProfileSource profile_source; /* Optional authentication settings */ MMBearerAllowedAuth allowed_auth; @@ -123,6 +125,9 @@ mm_3gpp_profile_cmp (MM3gppProfile *a, if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ROAMING_ALLOWANCE) && (a->priv->roaming_allowance != b->priv->roaming_allowance)) return FALSE; + if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_PROFILE_SOURCE) && + (a->priv->profile_source != b->priv->profile_source)) + return FALSE; return TRUE; } @@ -562,6 +567,44 @@ mm_3gpp_profile_get_roaming_allowance (MM3gppProfile *self) /*****************************************************************************/ /** + * mm_3gpp_profile_set_profile_source: + * @self: a #MM3gppProfile. + * @profile_source: a #MMBearerProfileSource. + * + * Sets profile source. + * + * Since: 1.20 + */ +void +mm_3gpp_profile_set_profile_source (MM3gppProfile *self, + MMBearerProfileSource profile_source) +{ + g_return_if_fail (MM_IS_3GPP_PROFILE (self)); + + self->priv->profile_source = profile_source; +} + +/** + * mm_3gpp_profile_get_profile_source: + * @self: a #MM3gppProfile. + * + * Gets the profile source. + * + * Returns: a #MMBearerProfileSource. + * + * Since: 1.20 + */ +MMBearerProfileSource +mm_3gpp_profile_get_profile_source (MM3gppProfile *self) +{ + g_return_val_if_fail (MM_IS_3GPP_PROFILE (self), MM_BEARER_PROFILE_SOURCE_UNKNOWN); + + return self->priv->profile_source; +} + +/*****************************************************************************/ + +/** * mm_3gpp_profile_get_dictionary: (skip) */ GVariant * @@ -717,6 +760,16 @@ mm_3gpp_profile_consume_string (MM3gppProfile *self, return FALSE; } mm_3gpp_profile_set_enabled (self, profile_enabled); + } else if (g_str_equal (key, PROPERTY_SOURCE)) { + GError *inner_error = NULL; + MMBearerProfileSource profile_source; + + profile_source = mm_common_get_profile_source_from_string (value, &inner_error); + if (inner_error) { + g_propagate_error (error, inner_error); + return FALSE; + } + mm_3gpp_profile_set_profile_source (self, profile_source); } else { g_set_error (error, MM_CORE_ERROR, @@ -821,6 +874,10 @@ mm_3gpp_profile_consume_variant (MM3gppProfile *self, mm_3gpp_profile_set_enabled ( self, g_variant_get_boolean (value)); + else if (g_str_equal (key, PROPERTY_SOURCE)) + mm_3gpp_profile_set_profile_source ( + self, + g_variant_get_uint32 (value)); else { /* Set error */ g_set_error (error, @@ -909,6 +966,7 @@ mm_3gpp_profile_init (MM3gppProfile *self) self->priv->access_type_preference = MM_BEARER_ACCESS_TYPE_PREFERENCE_NONE; self->priv->enabled = TRUE; self->priv->roaming_allowance = MM_BEARER_ROAMING_ALLOWANCE_NONE; + self->priv->profile_source = MM_BEARER_PROFILE_SOURCE_UNKNOWN; } static void diff --git a/libmm-glib/mm-3gpp-profile.h b/libmm-glib/mm-3gpp-profile.h index 7dc491dfe..7b45b55ef 100644 --- a/libmm-glib/mm-3gpp-profile.h +++ b/libmm-glib/mm-3gpp-profile.h @@ -96,6 +96,8 @@ void mm_3gpp_profile_set_enabled (MM3gppProfile *s gboolean enabled); void mm_3gpp_profile_set_roaming_allowance (MM3gppProfile *self, MMBearerRoamingAllowance roaming_allowance); +void mm_3gpp_profile_set_profile_source (MM3gppProfile *self, + MMBearerProfileSource profile_source); gint mm_3gpp_profile_get_profile_id (MM3gppProfile *self); const gchar *mm_3gpp_profile_get_profile_name (MM3gppProfile *self); @@ -108,6 +110,7 @@ MMBearerApnType mm_3gpp_profile_get_apn_type (MM3gpp MMBearerAccessTypePreference mm_3gpp_profile_get_access_type_preference (MM3gppProfile *self); gboolean mm_3gpp_profile_get_enabled (MM3gppProfile *self); MMBearerRoamingAllowance mm_3gpp_profile_get_roaming_allowance (MM3gppProfile *self); +MMBearerProfileSource mm_3gpp_profile_get_profile_source (MM3gppProfile *self); /*****************************************************************************/ /* ModemManager/libmm-glib/mmcli specific methods */ @@ -140,6 +143,7 @@ typedef enum { MM_3GPP_PROFILE_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE = 1 << 6, MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED = 1 << 7, MM_3GPP_PROFILE_CMP_FLAGS_NO_ROAMING_ALLOWANCE = 1 << 8, + MM_3GPP_PROFILE_CMP_FLAGS_NO_PROFILE_SOURCE = 1 << 9, } MM3gppProfileCmpFlags; gboolean mm_3gpp_profile_cmp (MM3gppProfile *a, diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c index 69838caca..b7883b265 100644 --- a/libmm-glib/mm-common-helpers.c +++ b/libmm-glib/mm-common-helpers.c @@ -716,6 +716,16 @@ mm_common_get_access_type_preference_from_string (const gchar *str, error); } +MMBearerProfileSource +mm_common_get_profile_source_from_string (const gchar *str, + GError **error) +{ + return _enum_from_string (MM_TYPE_BEARER_PROFILE_SOURCE, + str, + MM_BEARER_PROFILE_SOURCE_UNKNOWN, + error); +} + /******************************************************************************/ /* MMModemPortInfo array management */ diff --git a/libmm-glib/mm-common-helpers.h b/libmm-glib/mm-common-helpers.h index 4ede6e058..d444012c0 100644 --- a/libmm-glib/mm-common-helpers.h +++ b/libmm-glib/mm-common-helpers.h @@ -100,6 +100,8 @@ MMModem3gppDrxCycle mm_common_get_3gpp_drx_cycle_from_string GError **error); MMBearerAccessTypePreference mm_common_get_access_type_preference_from_string (const gchar *str, GError **error); +MMBearerProfileSource mm_common_get_profile_source_from_string (const gchar *str, + GError **error); /******************************************************************************/ |