[gupnp] Add API for retrieving device class identifiers



commit f6d106550f6e197cd4e43ad64b6400330722ee17
Author: Sébastien Bianti <sebastien bianti linux intel com>
Date:   Wed May 29 15:52:34 2013 +0200

    Add API for retrieving device class identifiers
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700947

 libgupnp/gupnp-device-info.c |   33 +++++++++++++++++++++++++++++++++
 libgupnp/gupnp-device-info.h |    3 +++
 2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c
index 50d96c1..1afb025 100644
--- a/libgupnp/gupnp-device-info.c
+++ b/libgupnp/gupnp-device-info.c
@@ -927,6 +927,39 @@ resource_type_match (const char *query,
 }
 
 /**
+ * gupnp_device_info_list_dlna_device_class_identifier:
+ * @info: A #GUPnPDeviceInfo
+ *
+ * Get a #GList of strings that represent the device class and version as
+ * announced in the device description file using the &lt;dlna:X_DLNADOC&gt;
+ * element.
+ * Returns: (transfer full) (element-type utf8): a #GList of newly allocated strings or
+ * %NULL if the device description doesn't contain the &lt;dlna:X_DLNADOC&gt;
+ * element.
+ **/
+GList *
+gupnp_device_info_list_dlna_device_class_identifier (GUPnPDeviceInfo *info)
+{
+        xmlNode *element;
+        GList *list  = NULL;
+
+        g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL);
+
+        element = info->priv->element;
+
+        for (element = element->children; element; element = element->next) {
+                /* No early exit since the node explicitly may appear multiple
+                 * times: 7.2.10.3 */
+                if (!strcmp ("X_DLNADOC", (char *) element->name))
+                        list = g_list_prepend (list,
+                                               xmlNodeGetContent(element));
+        }
+
+        /* Return in order of appearance in document */
+        return g_list_reverse (list);
+}
+
+/**
  * gupnp_device_info_list_dlna_capabilities:
  * @info: A #GUPnPDeviceInfo
  *
diff --git a/libgupnp/gupnp-device-info.h b/libgupnp/gupnp-device-info.h
index 3a14238..0a65184 100644
--- a/libgupnp/gupnp-device-info.h
+++ b/libgupnp/gupnp-device-info.h
@@ -152,6 +152,9 @@ char *
 gupnp_device_info_get_presentation_url   (GUPnPDeviceInfo *info);
 
 GList *
+gupnp_device_info_list_dlna_device_class_identifier (GUPnPDeviceInfo *info);
+
+GList *
 gupnp_device_info_list_dlna_capabilities (GUPnPDeviceInfo *info);
 
 char *


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