libmm-glib: new 'roaming-allowance' in 3GPP profile and bearer properties

This commit is contained in:
Aleksander Morgado
2021-11-26 15:26:05 +01:00
parent 24e634229d
commit f6a91b2250
5 changed files with 97 additions and 0 deletions

View File

@@ -1298,6 +1298,8 @@ mm_bearer_properties_get_multiplex
mm_bearer_properties_set_multiplex mm_bearer_properties_set_multiplex
mm_bearer_properties_get_access_type_preference mm_bearer_properties_get_access_type_preference
mm_bearer_properties_set_access_type_preference mm_bearer_properties_set_access_type_preference
mm_bearer_properties_get_roaming_allowance
mm_bearer_properties_set_roaming_allowance
<SUBSECTION Private> <SUBSECTION Private>
mm_bearer_properties_new_from_dictionary mm_bearer_properties_new_from_dictionary
mm_bearer_properties_new_from_string mm_bearer_properties_new_from_string
@@ -1651,6 +1653,8 @@ mm_3gpp_profile_get_access_type_preference
mm_3gpp_profile_set_access_type_preference mm_3gpp_profile_set_access_type_preference
mm_3gpp_profile_get_enabled mm_3gpp_profile_get_enabled
mm_3gpp_profile_set_enabled mm_3gpp_profile_set_enabled
mm_3gpp_profile_get_roaming_allowance
mm_3gpp_profile_set_roaming_allowance
<SUBSECTION Private> <SUBSECTION Private>
mm_3gpp_profile_new_from_dictionary mm_3gpp_profile_new_from_dictionary
mm_3gpp_profile_new_from_string mm_3gpp_profile_new_from_string

View File

@@ -47,6 +47,7 @@ G_DEFINE_TYPE (MM3gppProfile, mm_3gpp_profile, G_TYPE_OBJECT)
#define PROPERTY_APN_TYPE "apn-type" #define PROPERTY_APN_TYPE "apn-type"
#define PROPERTY_ACCESS_TYPE_PREFERENCE "access-type-preference" #define PROPERTY_ACCESS_TYPE_PREFERENCE "access-type-preference"
#define PROPERTY_ENABLED "profile-enabled" #define PROPERTY_ENABLED "profile-enabled"
#define PROPERTY_ROAMING_ALLOWANCE "roaming-allowance"
struct _MM3gppProfilePrivate { struct _MM3gppProfilePrivate {
gint profile_id; gint profile_id;
@@ -57,6 +58,7 @@ struct _MM3gppProfilePrivate {
MMBearerAccessTypePreference access_type_preference; MMBearerAccessTypePreference access_type_preference;
gboolean enabled; gboolean enabled;
gboolean enabled_set; gboolean enabled_set;
MMBearerRoamingAllowance roaming_allowance;
/* Optional authentication settings */ /* Optional authentication settings */
MMBearerAllowedAuth allowed_auth; MMBearerAllowedAuth allowed_auth;
@@ -118,6 +120,9 @@ mm_3gpp_profile_cmp (MM3gppProfile *a,
if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED) && if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED) &&
((a->priv->enabled != b->priv->enabled) || (a->priv->enabled_set != b->priv->enabled_set))) ((a->priv->enabled != b->priv->enabled) || (a->priv->enabled_set != b->priv->enabled_set)))
return FALSE; return FALSE;
if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ROAMING_ALLOWANCE) &&
(a->priv->roaming_allowance != b->priv->roaming_allowance))
return FALSE;
return TRUE; return TRUE;
} }
@@ -518,6 +523,44 @@ mm_3gpp_profile_get_enabled (MM3gppProfile *self)
/*****************************************************************************/ /*****************************************************************************/
/**
* mm_3gpp_profile_set_roaming_allowance:
* @self: a #MM3gppProfile.
* @roaming_allowance: a mask of #MMBearerRoamingAllowance values.
*
* Sets the roaming allowance rules.
*
* Since: 1.20
*/
void
mm_3gpp_profile_set_roaming_allowance (MM3gppProfile *self,
MMBearerRoamingAllowance roaming_allowance)
{
g_return_if_fail (MM_IS_3GPP_PROFILE (self));
self->priv->roaming_allowance = roaming_allowance;
}
/**
* mm_3gpp_profile_get_roaming_allowance:
* @self: a #MM3gppProfile.
*
* Gets the roaming allowance rules.
*
* Returns: a mask of #MMBearerRoamingAllowance values.
*
* Since: 1.20
*/
MMBearerRoamingAllowance
mm_3gpp_profile_get_roaming_allowance (MM3gppProfile *self)
{
g_return_val_if_fail (MM_IS_3GPP_PROFILE (self), MM_BEARER_ROAMING_ALLOWANCE_NONE);
return self->priv->roaming_allowance;
}
/*****************************************************************************/
/** /**
* mm_3gpp_profile_get_dictionary: (skip) * mm_3gpp_profile_get_dictionary: (skip)
*/ */
@@ -865,6 +908,7 @@ mm_3gpp_profile_init (MM3gppProfile *self)
self->priv->apn_type = MM_BEARER_APN_TYPE_NONE; self->priv->apn_type = MM_BEARER_APN_TYPE_NONE;
self->priv->access_type_preference = MM_BEARER_ACCESS_TYPE_PREFERENCE_NONE; self->priv->access_type_preference = MM_BEARER_ACCESS_TYPE_PREFERENCE_NONE;
self->priv->enabled = TRUE; self->priv->enabled = TRUE;
self->priv->roaming_allowance = MM_BEARER_ROAMING_ALLOWANCE_NONE;
} }
static void static void

View File

@@ -94,6 +94,8 @@ void mm_3gpp_profile_set_access_type_preference (MM3gppProfile *s
MMBearerAccessTypePreference access_type_preference); MMBearerAccessTypePreference access_type_preference);
void mm_3gpp_profile_set_enabled (MM3gppProfile *self, void mm_3gpp_profile_set_enabled (MM3gppProfile *self,
gboolean enabled); gboolean enabled);
void mm_3gpp_profile_set_roaming_allowance (MM3gppProfile *self,
MMBearerRoamingAllowance roaming_allowance);
gint mm_3gpp_profile_get_profile_id (MM3gppProfile *self); gint mm_3gpp_profile_get_profile_id (MM3gppProfile *self);
const gchar *mm_3gpp_profile_get_profile_name (MM3gppProfile *self); const gchar *mm_3gpp_profile_get_profile_name (MM3gppProfile *self);
@@ -105,6 +107,7 @@ MMBearerIpFamily mm_3gpp_profile_get_ip_type (MM3gpp
MMBearerApnType mm_3gpp_profile_get_apn_type (MM3gppProfile *self); MMBearerApnType mm_3gpp_profile_get_apn_type (MM3gppProfile *self);
MMBearerAccessTypePreference mm_3gpp_profile_get_access_type_preference (MM3gppProfile *self); MMBearerAccessTypePreference mm_3gpp_profile_get_access_type_preference (MM3gppProfile *self);
gboolean mm_3gpp_profile_get_enabled (MM3gppProfile *self); gboolean mm_3gpp_profile_get_enabled (MM3gppProfile *self);
MMBearerRoamingAllowance mm_3gpp_profile_get_roaming_allowance (MM3gppProfile *self);
/*****************************************************************************/ /*****************************************************************************/
/* ModemManager/libmm-glib/mmcli specific methods */ /* ModemManager/libmm-glib/mmcli specific methods */
@@ -136,6 +139,7 @@ typedef enum {
MM_3GPP_PROFILE_CMP_FLAGS_NO_IP_TYPE = 1 << 5, 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_ACCESS_TYPE_PREFERENCE = 1 << 6,
MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED = 1 << 7, MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED = 1 << 7,
MM_3GPP_PROFILE_CMP_FLAGS_NO_ROAMING_ALLOWANCE = 1 << 8,
} MM3gppProfileCmpFlags; } MM3gppProfileCmpFlags;
gboolean mm_3gpp_profile_cmp (MM3gppProfile *a, gboolean mm_3gpp_profile_cmp (MM3gppProfile *a,

View File

@@ -410,6 +410,44 @@ mm_bearer_properties_get_access_type_preference (MMBearerProperties *self)
/*****************************************************************************/ /*****************************************************************************/
/**
* mm_bearer_properties_set_roaming_allowance:
* @self: a #MMBearerProperties.
* @roaming_allowance: a mask of #MMBearerRoamingAllowance values
*
* Sets the roaming allowance rules.
*
* Since: 1.20
*/
void
mm_bearer_properties_set_roaming_allowance (MMBearerProperties *self,
MMBearerRoamingAllowance roaming_allowance)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_3gpp_profile_set_roaming_allowance (self->priv->profile, roaming_allowance);
}
/**
* mm_bearer_properties_get_roaming_allowance:
* @self: a #MMBearerProperties.
*
* Gets the roaming allowance rules.
*
* Returns: a mask of #MMBearerRoamingAllowance values.
*
* Since: 1.20
*/
MMBearerRoamingAllowance
mm_bearer_properties_get_roaming_allowance (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), MM_BEARER_ROAMING_ALLOWANCE_NONE);
return mm_3gpp_profile_get_roaming_allowance (self->priv->profile);
}
/*****************************************************************************/
/** /**
* mm_bearer_properties_set_allow_roaming: * mm_bearer_properties_set_allow_roaming:
* @self: a #MMBearerProperties. * @self: a #MMBearerProperties.
@@ -873,6 +911,9 @@ mm_bearer_properties_cmp (MMBearerProperties *a,
if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE) && if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE) &&
(mm_3gpp_profile_get_access_type_preference (a->priv->profile) != mm_3gpp_profile_get_access_type_preference (b->priv->profile))) (mm_3gpp_profile_get_access_type_preference (a->priv->profile) != mm_3gpp_profile_get_access_type_preference (b->priv->profile)))
return FALSE; return FALSE;
if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ROAMING_ALLOWANCE) &&
(mm_3gpp_profile_get_roaming_allowance (a->priv->profile) != mm_3gpp_profile_get_roaming_allowance (b->priv->profile)))
return FALSE;
if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ALLOW_ROAMING)) { if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ALLOW_ROAMING)) {
if (a->priv->allow_roaming != b->priv->allow_roaming) if (a->priv->allow_roaming != b->priv->allow_roaming)
return FALSE; return FALSE;

View File

@@ -90,6 +90,8 @@ void mm_bearer_properties_set_multiplex (MMBearerProperties
MMBearerMultiplexSupport multiplex); MMBearerMultiplexSupport multiplex);
void mm_bearer_properties_set_access_type_preference (MMBearerProperties *self, void mm_bearer_properties_set_access_type_preference (MMBearerProperties *self,
MMBearerAccessTypePreference access_type_preference); MMBearerAccessTypePreference access_type_preference);
void mm_bearer_properties_set_roaming_allowance (MMBearerProperties *self,
MMBearerRoamingAllowance roaming_allowance);
const gchar *mm_bearer_properties_get_apn (MMBearerProperties *self); const gchar *mm_bearer_properties_get_apn (MMBearerProperties *self);
MMBearerAllowedAuth mm_bearer_properties_get_allowed_auth (MMBearerProperties *self); MMBearerAllowedAuth mm_bearer_properties_get_allowed_auth (MMBearerProperties *self);
@@ -103,6 +105,7 @@ gboolean mm_bearer_properties_get_allow_roaming (MM
MMModemCdmaRmProtocol mm_bearer_properties_get_rm_protocol (MMBearerProperties *self); MMModemCdmaRmProtocol mm_bearer_properties_get_rm_protocol (MMBearerProperties *self);
MMBearerMultiplexSupport mm_bearer_properties_get_multiplex (MMBearerProperties *self); MMBearerMultiplexSupport mm_bearer_properties_get_multiplex (MMBearerProperties *self);
MMBearerAccessTypePreference mm_bearer_properties_get_access_type_preference (MMBearerProperties *self); MMBearerAccessTypePreference mm_bearer_properties_get_access_type_preference (MMBearerProperties *self);
MMBearerRoamingAllowance mm_bearer_properties_get_roaming_allowance (MMBearerProperties *self);
/*****************************************************************************/ /*****************************************************************************/
/* ModemManager/libmm-glib/mmcli specific methods */ /* ModemManager/libmm-glib/mmcli specific methods */
@@ -141,6 +144,7 @@ typedef enum {
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_ID = 1 << 5, MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_ID = 1 << 5,
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_NAME = 1 << 6, MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_NAME = 1 << 6,
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE = 1 << 7, MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE = 1 << 7,
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ROAMING_ALLOWANCE = 1 << 8,
} MMBearerPropertiesCmpFlags; } MMBearerPropertiesCmpFlags;
gboolean mm_bearer_properties_cmp (MMBearerProperties *a, gboolean mm_bearer_properties_cmp (MMBearerProperties *a,