aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lassalle <andrewlassalle@chromium.org>2021-10-15 10:47:39 -0700
committerAleksander Morgado <aleksander@aleksander.es>2021-10-17 17:56:44 +0200
commitc355210f5da1be575ea117f5033dc3a9a06df473 (patch)
treeecc36f3d9acc3ae050f01d761237785a019033ce
parentb2a7591bcfc765089004129501d418f474a3ae8b (diff)
bearer-properties: Add profile-name to the bearer properties
-rw-r--r--docs/reference/libmm-glib/libmm-glib-sections.txt2
-rw-r--r--introspection/org.freedesktop.ModemManager1.Bearer.xml8
-rw-r--r--libmm-glib/mm-bearer-properties.c41
-rw-r--r--libmm-glib/mm-bearer-properties.h4
4 files changed, 55 insertions, 0 deletions
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt
index 2f96519c..f3a786cd 100644
--- a/docs/reference/libmm-glib/libmm-glib-sections.txt
+++ b/docs/reference/libmm-glib/libmm-glib-sections.txt
@@ -1238,6 +1238,8 @@ mm_bearer_properties_get_ip_type
mm_bearer_properties_set_ip_type
mm_bearer_properties_get_profile_id
mm_bearer_properties_set_profile_id
+mm_bearer_properties_get_profile_name
+mm_bearer_properties_set_profile_name
mm_bearer_properties_get_allow_roaming
mm_bearer_properties_set_allow_roaming
mm_bearer_properties_get_rm_protocol
diff --git a/introspection/org.freedesktop.ModemManager1.Bearer.xml b/introspection/org.freedesktop.ModemManager1.Bearer.xml
index b890195c..f8c65b46 100644
--- a/introspection/org.freedesktop.ModemManager1.Bearer.xml
+++ b/introspection/org.freedesktop.ModemManager1.Bearer.xml
@@ -454,6 +454,14 @@
indicate an invalid or uninitialized profile id. Since 1.18.
</listitem>
</varlistentry>
+ <varlistentry><term><literal>"profile-name"</literal></term>
+ <listitem><para>
+ The name of the profile, given as a string
+ value (signature <literal>"s"</literal>).
+ This value has no effect on the connection, but can be used by the host
+ to identify the profiles. Since 1.20.
+ </para></listitem>
+ </varlistentry>
</variablelist>
The following settings apply to 3GPP2 (CDMA/EVDO) devices:
diff --git a/libmm-glib/mm-bearer-properties.c b/libmm-glib/mm-bearer-properties.c
index 51d0a60b..4e3d7730 100644
--- a/libmm-glib/mm-bearer-properties.c
+++ b/libmm-glib/mm-bearer-properties.c
@@ -56,6 +56,44 @@ struct _MMBearerPropertiesPrivate {
/*****************************************************************************/
/**
+ * mm_bearer_properties_set_profile_name:
+ * @self: a #MMBearerProperties.
+ * @profile_name: Name of the profile.
+ *
+ * Sets the name of the profile to use when connecting.
+ *
+ * Since: 1.20
+ */
+void
+mm_bearer_properties_set_profile_name (MMBearerProperties *self,
+ const gchar *profile_name)
+{
+ g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
+
+ mm_3gpp_profile_set_profile_name (self->priv->profile, profile_name);
+}
+
+/**
+ * mm_bearer_properties_get_profile_name:
+ * @self: a #MMBearerProperties.
+ *
+ * Gets the name of the profile to use when connecting.
+ *
+ * Returns: (transfer none): the profile name, or #NULL if not set. Do not free
+ * the returned value, it is owned by @self.
+ *
+ * Since: 1.20
+ */
+const gchar *
+mm_bearer_properties_get_profile_name (MMBearerProperties *self)
+{
+ g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
+
+ return mm_3gpp_profile_get_profile_name (self->priv->profile);
+}
+/*****************************************************************************/
+
+/**
* mm_bearer_properties_set_apn:
* @self: a #MMBearerProperties.
* @apn: Name of the access point.
@@ -784,6 +822,9 @@ mm_bearer_properties_cmp (MMBearerProperties *a,
if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_ID) &&
(mm_3gpp_profile_get_profile_id (a->priv->profile) != mm_3gpp_profile_get_profile_id (b->priv->profile)))
return FALSE;
+ if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_NAME) &&
+ !cmp_str (mm_3gpp_profile_get_profile_name (a->priv->profile), mm_3gpp_profile_get_profile_name (b->priv->profile), flags))
+ return FALSE;
if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ALLOW_ROAMING)) {
if (a->priv->allow_roaming != b->priv->allow_roaming)
return FALSE;
diff --git a/libmm-glib/mm-bearer-properties.h b/libmm-glib/mm-bearer-properties.h
index e6e4f537..14b351a6 100644
--- a/libmm-glib/mm-bearer-properties.h
+++ b/libmm-glib/mm-bearer-properties.h
@@ -73,6 +73,8 @@ void mm_bearer_properties_set_apn_type (MMBearerProperties *self,
MMBearerApnType apn_type);
void mm_bearer_properties_set_profile_id (MMBearerProperties *self,
gint profile_id);
+void mm_bearer_properties_set_profile_name (MMBearerProperties *self,
+ const gchar *profile_name);
void mm_bearer_properties_set_allow_roaming (MMBearerProperties *self,
gboolean allow_roaming);
void mm_bearer_properties_set_rm_protocol (MMBearerProperties *self,
@@ -87,6 +89,7 @@ const gchar *mm_bearer_properties_get_password (MMBearerProper
MMBearerIpFamily mm_bearer_properties_get_ip_type (MMBearerProperties *self);
MMBearerApnType mm_bearer_properties_get_apn_type (MMBearerProperties *self);
gint mm_bearer_properties_get_profile_id (MMBearerProperties *self);
+const gchar *mm_bearer_properties_get_profile_name (MMBearerProperties *self);
gboolean mm_bearer_properties_get_allow_roaming (MMBearerProperties *self);
MMModemCdmaRmProtocol mm_bearer_properties_get_rm_protocol (MMBearerProperties *self);
MMBearerMultiplexSupport mm_bearer_properties_get_multiplex (MMBearerProperties *self);
@@ -126,6 +129,7 @@ typedef enum {
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_RM_PROTOCOL = 1 << 3,
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_APN_TYPE = 1 << 4,
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_ID = 1 << 5,
+ MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_NAME = 1 << 6,
} MMBearerPropertiesCmpFlags;
gboolean mm_bearer_properties_cmp (MMBearerProperties *a,