Re: [gupnp] [PATCH] new function gupnp_device_info_list_dlna_capabilities()



On Mon, 2009-07-06 at 13:10 +0100, Ross Burton wrote:
> On Thu, 2009-07-02 at 10:49 +0200, Sven Neumann wrote:
> > attached patch gives access to the DLNA capabilities of a device as
> > announced in the <dlna:X_DLNACAP> element. Please consider this for
> > inclusion in libgupnp.
> 
> Committed.  Bonus points for a second patch which adds a generic "get
> string value" method for getting the content of an arbitrary element.

At your service. Please review the attached patch.


Sven


>From a851aa7260bbd28fcc151b7f3546c9a37400da24 Mon Sep 17 00:00:00 2001
From: Sven Neumann <s neumann raumfeld com>
Date: Mon, 6 Jul 2009 14:28:12 +0200
Subject: [PATCH] new function gupnp_device_info_get_description_value()

The new function introduced by this commit allows to retrieve the
content of arbitrary elements in the device description files.
---
 doc/gupnp-sections.txt       |    1 +
 libgupnp/gupnp-device-info.c |   22 ++++++++++++++++++++++
 libgupnp/gupnp-device-info.h |    3 +++
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/doc/gupnp-sections.txt b/doc/gupnp-sections.txt
index 7da27cc..4e11ba6 100644
--- a/doc/gupnp-sections.txt
+++ b/doc/gupnp-sections.txt
@@ -43,6 +43,7 @@ gupnp_device_info_get_presentation_url
 gupnp_device_info_get_upc
 gupnp_device_info_get_icon_url
 gupnp_device_info_list_dlna_capabilities
+gupnp_device_info_get_description_value
 gupnp_device_info_list_devices
 gupnp_device_info_list_device_types
 gupnp_device_info_get_device
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c
index 3116ef9..17482e6 100644
--- a/libgupnp/gupnp-device-info.c
+++ b/libgupnp/gupnp-device-info.c
@@ -983,6 +983,28 @@ gupnp_device_info_list_dlna_capabilities (GUPnPDeviceInfo *info)
 }
 
 /**
+ * gupnp_device_info_get_description_value
+ * @info:    A #GUPnPDeviceInfo
+ * @element: Name of the description element to retrieve
+ *
+ * This function provides generic access to the contents of arbitrary
+ * elements in the device description file.
+ *
+ * Return value: a newly allocated string or %NULL if the device
+ *               description doesn't contain the given @element
+ **/
+char *
+gupnp_device_info_get_description_value (GUPnPDeviceInfo *info,
+                                         const char      *element)
+{
+        g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL);
+        g_return_val_if_fail (element != NULL, NULL);
+
+        return xml_util_get_child_element_content_glib (info->priv->element,
+                                                        element);
+}
+
+/**
  * gupnp_device_info_list_devices
  * @info: A #GUPnPDeviceInfo
  *
diff --git a/libgupnp/gupnp-device-info.h b/libgupnp/gupnp-device-info.h
index 3aaf6ec..df7aa80 100644
--- a/libgupnp/gupnp-device-info.h
+++ b/libgupnp/gupnp-device-info.h
@@ -148,6 +148,9 @@ gupnp_device_info_get_presentation_url   (GUPnPDeviceInfo *info);
 GList *
 gupnp_device_info_list_dlna_capabilities (GUPnPDeviceInfo *info);
 
+char *
+gupnp_device_info_get_description_value  (GUPnPDeviceInfo *info,
+                                          const char      *element);
 GList *
 gupnp_device_info_list_devices           (GUPnPDeviceInfo *info);
 
-- 
1.6.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]