[aravis] fake: allow setting of fake camera IP address.



commit 0f981a12bfdd6e08b5cb9ce156e1999b1f37926a
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun May 30 11:28:06 2010 +0200

    fake: allow setting of fake camera IP address.

 src/arvfakecamera.c |   17 ++++++++++++++++-
 src/arvfakecamera.h |    6 +++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/arvfakecamera.c b/src/arvfakecamera.c
index 98d072e..550dc93 100644
--- a/src/arvfakecamera.c
+++ b/src/arvfakecamera.c
@@ -78,7 +78,7 @@ arv_fake_camera_read_memory (ArvFakeCamera *camera, guint32 address, guint32 siz
 }
 
 gboolean
-arv_fake_camera_write_memory (ArvFakeCamera *camera, guint32 address, guint32 size, void *buffer)
+arv_fake_camera_write_memory (ArvFakeCamera *camera, guint32 address, guint32 size, const void *buffer)
 {
 	g_return_val_if_fail (ARV_IS_FAKE_CAMERA (camera), FALSE);
 	g_return_val_if_fail (address + size < ARV_FAKE_CAMERA_MEMORY_SIZE + camera->priv->genicam_data_size, FALSE);
@@ -179,6 +179,21 @@ arv_fake_camera_fill_buffer (ArvFakeCamera *camera, ArvBuffer *buffer)
 }
 
 void
+arv_fake_camera_set_inet_address (ArvFakeCamera *camera, GInetAddress *address)
+{
+	const guint8 *bytes;
+
+	g_return_if_fail (ARV_IS_FAKE_CAMERA (camera));
+	g_return_if_fail (G_IS_INET_ADDRESS (address));
+	g_return_if_fail (g_inet_address_get_family (address) == G_SOCKET_FAMILY_IPV4);
+
+	bytes = g_inet_address_to_bytes (address);
+
+	arv_fake_camera_write_memory (camera, ARV_GVBS_CURRENT_IP_ADDRESS,
+				      g_inet_address_get_native_size (address), (char *) bytes);
+}
+
+void
 arv_fake_camera_set_trigger_frequency (ArvFakeCamera *camera, double frequency)
 {
 	g_return_if_fail (ARV_IS_FAKE_CAMERA (camera));
diff --git a/src/arvfakecamera.h b/src/arvfakecamera.h
index 919a460..00eed28 100644
--- a/src/arvfakecamera.h
+++ b/src/arvfakecamera.h
@@ -24,6 +24,7 @@
 #define ARV_FAKE_CAMERA_H
 
 #include <arvtypes.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -99,13 +100,16 @@ GType arv_fake_camera_get_type (void);
 
 ArvFakeCamera * arv_fake_camera_new 		(const char *serial_number);
 gboolean	arv_fake_camera_read_memory 	(ArvFakeCamera *camera, guint32 address, guint32 size, void *buffer);
-gboolean	arv_fake_camera_write_memory	(ArvFakeCamera *camera, guint32 address, guint32 size, void *buffer);
+gboolean	arv_fake_camera_write_memory	(ArvFakeCamera *camera, guint32 address, guint32 size,
+						 const void *buffer);
 gboolean 	arv_fake_camera_read_register	(ArvFakeCamera *camera, guint32 address, guint32 *value);
 gboolean	arv_fake_camera_write_register 	(ArvFakeCamera *camera, guint32 address, guint32 value);
 
 void 		arv_fake_camera_wait_for_next_frame 	(ArvFakeCamera *camera);
 void		arv_fake_camera_fill_buffer		(ArvFakeCamera *camera, ArvBuffer *buffer);
 
+void		arv_fake_camera_set_inet_address	(ArvFakeCamera *camera, GInetAddress *address);
+
 void 		arv_set_fake_camera_genicam_filename 	(const char *filename);
 const char *	arv_get_fake_camera_genicam_data	(size_t *size);
 



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