diff options
author | Ben Chan <benchan@chromium.org> | 2013-11-21 22:24:49 -0800 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-11-22 08:35:41 +0100 |
commit | e4382212586447f63004db0fdd7df78243da582a (patch) | |
tree | 65c74424763bcd7d11c136565e8a53c81b0bdaa1 | |
parent | a787d1bbb8460e577f1f32bda84f6c1b7420274e (diff) |
libmm-glib: add methods to retrieve 'Bearers' property in Modem interface
-rw-r--r-- | docs/reference/libmm-glib/libmm-glib-sections.txt | 2 | ||||
-rw-r--r-- | libmm-glib/mm-modem.c | 39 | ||||
-rw-r--r-- | libmm-glib/mm-modem.h | 3 |
3 files changed, 44 insertions, 0 deletions
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt index 71b809ad..415962f7 100644 --- a/docs/reference/libmm-glib/libmm-glib-sections.txt +++ b/docs/reference/libmm-glib/libmm-glib-sections.txt @@ -113,6 +113,8 @@ mm_modem_peek_unlock_retries mm_modem_get_unlock_retries mm_modem_get_max_bearers mm_modem_get_max_active_bearers +mm_modem_get_bearer_paths +mm_modem_dup_bearer_paths mm_modem_get_own_numbers mm_modem_dup_own_numbers mm_modem_peek_supported_modes diff --git a/libmm-glib/mm-modem.c b/libmm-glib/mm-modem.c index c1dee3ac..213f679d 100644 --- a/libmm-glib/mm-modem.c +++ b/libmm-glib/mm-modem.c @@ -341,6 +341,45 @@ mm_modem_get_max_active_bearers (MMModem *self) /*****************************************************************************/ /** + * mm_modem_get_bearer_paths: + * @self: A #MMModem. + * + * Gets the DBus paths of the #MMBearer handled in 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_bearer_paths() if on another + * thread.</warning> + * + * Returns: (transfer none): The DBus paths of the #MMBearer handled in this #MMModem, or %NULL if none available. Do not free the returned value, it belongs to @self. + */ +const gchar * const * +mm_modem_get_bearer_paths (MMModem *self) +{ + g_return_val_if_fail (MM_IS_MODEM (self), NULL); + + return mm_gdbus_modem_get_bearers (MM_GDBUS_MODEM (self)); +} + +/** + * mm_modem_dup_bearer_paths: + * @self: A #MMModem. + * + * Gets a copy of the DBus paths of the #MMBearer handled in this #MMModem. + * + * Returns: (transfer full): The DBus paths of the #MMBearer handled in this #MMModem, or %NULL if none available. The returned value should be freed with g_strfreev(). + */ +gchar ** +mm_modem_dup_bearer_paths (MMModem *self) +{ + g_return_val_if_fail (MM_IS_MODEM (self), NULL); + + return mm_gdbus_modem_dup_bearers (MM_GDBUS_MODEM (self)); +} + +/*****************************************************************************/ + +/** * mm_modem_get_manufacturer: * @self: A #MMModem. * diff --git a/libmm-glib/mm-modem.h b/libmm-glib/mm-modem.h index 8fb1fafc..04906285 100644 --- a/libmm-glib/mm-modem.h +++ b/libmm-glib/mm-modem.h @@ -87,6 +87,9 @@ guint mm_modem_get_max_bearers (MMModem *self); guint mm_modem_get_max_active_bearers (MMModem *self); +const gchar * const *mm_modem_get_bearer_paths (MMModem *self); +gchar **mm_modem_dup_bearer_paths (MMModem *self); + const gchar *mm_modem_get_manufacturer (MMModem *self); gchar *mm_modem_dup_manufacturer (MMModem *self); |