[aravis] gv_device: function for retrieving the genicam xml data.



commit 9d4c486c20dd2ce0e2585144ace3ecc548549b2c
Author: Tom Cobb <tom cobb diamond ac uk>
Date:   Thu Jan 6 15:45:40 2011 +0100

    gv_device: function for retrieving the genicam xml data.
    
    When testing new cameras, the first thing I generally do is dump the genicam
    xml file to disk. There didn't seem to be a function to do this, so I created
    one.

 docs/reference/aravis/aravis-sections.txt |    1 +
 src/arvgvdevice.c                         |   28 ++++++++++++++++++++++++----
 src/arvgvdevice.h                         |    1 +
 3 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 63b3198..57ca32c 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -393,6 +393,7 @@ ArvGvInterfaceClass
 <TITLE>ArvGvDevice</TITLE>
 ArvGvDevice
 arv_gv_device_new
+arv_gv_device_get_xml
 arv_gv_device_get_timestamp_tick_frequency
 <SUBSECTION Standard>
 ARV_GV_DEVICE
diff --git a/src/arvgvdevice.c b/src/arvgvdevice.c
index be10168..212868f 100644
--- a/src/arvgvdevice.c
+++ b/src/arvgvdevice.c
@@ -415,16 +415,36 @@ _load_genicam (ArvGvDevice *gv_device, guint32 address, size_t  *size)
 	return genicam;
 }
 
+/**
+ * arv_gv_device_get_xml:
+ * @gv_device: a #ArvGvDevice
+ * @size: placeholder for the returned data size (bytes)
+ * Return value: a newly allocated buffer with the Genicam xml data.
+ *
+ * Gets the Genicam data stored in the device memory. The buffer must be freed after use using g_free.
+ **/
+
+char *
+arv_gv_device_get_xml (ArvGvDevice *gv_device, size_t *size)
+{
+	char *xml;
+
+	g_return_val_if_fail (ARV_IS_GV_DEVICE (gv_device), NULL);
+
+	xml = _load_genicam (gv_device, ARV_GVBS_FIRST_XML_URL, size);
+	if (xml == NULL)
+		xml = _load_genicam (gv_device, ARV_GVBS_SECOND_XML_URL, size);
+
+	return xml;
+}
+
 static void
 arv_gv_device_load_genicam (ArvGvDevice *gv_device)
 {
 	char *genicam;
 	size_t size;
 
-	genicam = _load_genicam (gv_device, ARV_GVBS_FIRST_XML_URL, &size);
-	if (genicam == NULL)
-		genicam = _load_genicam (gv_device, ARV_GVBS_SECOND_XML_URL, &size);
-
+	genicam = arv_gv_device_get_xml (gv_device, &size);
 	if (genicam != NULL) {
 		gv_device->priv->genicam = arv_gc_new (ARV_DEVICE (gv_device), genicam, size);
 		g_free (genicam);
diff --git a/src/arvgvdevice.h b/src/arvgvdevice.h
index e67bb39..bc7ca4f 100644
--- a/src/arvgvdevice.h
+++ b/src/arvgvdevice.h
@@ -57,6 +57,7 @@ struct _ArvGvDeviceClass {
 GType arv_gv_device_get_type (void);
 
 ArvDevice * 	arv_gv_device_new 	(GInetAddress *interface_address, GInetAddress *device_address);
+char *		arv_gv_device_get_xml 	(ArvGvDevice *gv_device, size_t *size);
 
 guint64 	arv_gv_device_get_timestamp_tick_frequency 	(ArvGvDevice *gv_device);
 



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