aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-10-19 00:58:36 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-10-19 00:58:36 +0200
commit79fdddccbfccd50f2c4d98d90fc707061c39d1f5 (patch)
tree49e2eb7f44cf05b8d869ceeeebe0164c9a512ee8 /libmm-glib
parente123c7d5b43cd4fb63d7f1fbdb44fbb641e410ac (diff)
api,modem: new 'PrimaryPort' property
We do need to specify which is the primary port being used for controlling the modem. This allows us to match the device with an already existing bluetooth device in NetworkManager.
Diffstat (limited to 'libmm-glib')
-rw-r--r--libmm-glib/mm-modem.c41
-rw-r--r--libmm-glib/mm-modem.h3
2 files changed, 44 insertions, 0 deletions
diff --git a/libmm-glib/mm-modem.c b/libmm-glib/mm-modem.c
index 6b9357a0..b575a300 100644
--- a/libmm-glib/mm-modem.c
+++ b/libmm-glib/mm-modem.c
@@ -538,6 +538,47 @@ mm_modem_dup_plugin (MMModem *self)
/*****************************************************************************/
/**
+ * mm_modem_get_primary_port:
+ * @self: A #MMModem.
+ *
+ * Gets the name of the primary port controlling this #MMModem.
+ *
+ * <warning>The returned value is only valid until the property changes so
+ * it is only safe to use this function on the thread where
+ * @self was constructed. Use mm_modem_dup_primary_port() if on another
+ * thread.</warning>
+ *
+ * Returns: (transfer none): The name of the primary port. Do not free the returned value, it belongs to @self.
+ */
+const gchar *
+mm_modem_get_primary_port (MMModem *self)
+{
+ g_return_val_if_fail (MM_IS_MODEM (self), NULL);
+
+ RETURN_NON_EMPTY_CONSTANT_STRING (
+ mm_gdbus_modem_get_primary_port (MM_GDBUS_MODEM (self)));
+}
+
+/**
+ * mm_modem_dup_primary_port:
+ * @self: A #MMModem.
+ *
+ * Gets a copy of the name of the primary port controlling this #MMModem.
+ *
+ * Returns: (transfer full): The name of the primary port. The returned value should be freed with g_free().
+ */
+gchar *
+mm_modem_dup_primary_port (MMModem *self)
+{
+ g_return_val_if_fail (MM_IS_MODEM (self), NULL);
+
+ RETURN_NON_EMPTY_STRING (
+ mm_gdbus_modem_dup_primary_port (MM_GDBUS_MODEM (self)));
+}
+
+/*****************************************************************************/
+
+/**
* mm_modem_get_equipment_identifier:
* @self: A #MMModem.
*
diff --git a/libmm-glib/mm-modem.h b/libmm-glib/mm-modem.h
index 480c3fe4..46609ca4 100644
--- a/libmm-glib/mm-modem.h
+++ b/libmm-glib/mm-modem.h
@@ -102,6 +102,9 @@ gchar **mm_modem_dup_drivers (MMModem *self);
const gchar *mm_modem_get_plugin (MMModem *self);
gchar *mm_modem_dup_plugin (MMModem *self);
+const gchar *mm_modem_get_primary_port (MMModem *self);
+gchar *mm_modem_dup_primary_port (MMModem *self);
+
const gchar *mm_modem_get_equipment_identifier (MMModem *self);
gchar *mm_modem_dup_equipment_identifier (MMModem *self);