[aravis] fake: use defines for default feature values.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] fake: use defines for default feature values.
- Date: Mon, 17 May 2010 12:46:34 +0000 (UTC)
commit 51b44f8a89494a69672dcde76a0abe3147852f7d
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Mon May 17 14:46:01 2010 +0200
fake: use defines for default feature values.
src/arvfakecamera.c | 21 ++++++++++++++-------
src/arvfakecamera.h | 14 +++++++++++++-
src/tests/fake.c | 15 ++++++++-------
3 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/arvfakecamera.c b/src/arvfakecamera.c
index 4dd4479..f658518 100644
--- a/src/arvfakecamera.c
+++ b/src/arvfakecamera.c
@@ -253,19 +253,26 @@ arv_fake_camera_new (const char *serial_number)
strcpy (memory + ARV_GVBS_FIRST_XML_URL, xml_url);
g_free (xml_url);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_SENSOR_WIDTH, 2048);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_SENSOR_HEIGHT, 2048);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_WIDTH, 512);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_HEIGHT, 512);
+ arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_SENSOR_WIDTH,
+ ARV_FAKE_CAMERA_SENSOR_WIDTH);
+ arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_SENSOR_HEIGHT,
+ ARV_FAKE_CAMERA_SENSOR_HEIGHT);
+ arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_WIDTH,
+ ARV_FAKE_CAMERA_WIDTH_DEFAULT);
+ arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_HEIGHT,
+ ARV_FAKE_CAMERA_HEIGHT_DEFAULT);
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_X_OFFSET, 0);
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_Y_OFFSET, 0);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_BINNING_HORIZONTAL, 1);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_BINNING_VERTICAL, 1);
+ arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_BINNING_HORIZONTAL,
+ ARV_FAKE_CAMERA_BINNING_HORIZONTAL_DEFAULT);
+ arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_BINNING_VERTICAL,
+ ARV_FAKE_CAMERA_BINNING_HORIZONTAL_DEFAULT);
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_PIXEL_FORMAT, ARV_PIXEL_FORMAT_MONO_8);
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_ACQUISITION, 0);
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_ACQUISITION_MODE, 1);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US, 20000);
+ arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US,
+ ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT);
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_GAIN_RAW, 0);
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_GAIN_MODE, 0);
diff --git a/src/arvfakecamera.h b/src/arvfakecamera.h
index 39e0248..d0a65a9 100644
--- a/src/arvfakecamera.h
+++ b/src/arvfakecamera.h
@@ -43,18 +43,30 @@ G_BEGIN_DECLS
#define ARV_FAKE_CAMERA_REGISTER_BINNING_VERTICAL 0x10c
#define ARV_FAKE_CAMERA_REGISTER_PIXEL_FORMAT 0x128
+#define ARV_FAKE_CAMERA_SENSOR_WIDTH 2048
+#define ARV_FAKE_CAMERA_SENSOR_HEIGHT 2048
+#define ARV_FAKE_CAMERA_WIDTH_DEFAULT 512
+#define ARV_FAKE_CAMERA_HEIGHT_DEFAULT 512
+#define ARV_FAKE_CAMERA_BINNING_HORIZONTAL_DEFAULT 1
+#define ARV_FAKE_CAMERA_BINNING_VERTICAL_DEFAULT 1
+#define ARV_FAKE_CAMERA_PIXEL_FORMAT_DEFAULT ARV_PIXEL_FORMAT_MONO_8
+
/* Acquisition control */
#define ARV_FAKE_CAMERA_REGISTER_ACQUISITION_MODE 0x12c
-#define ARV_FAKE_CAMERA_REGISTER_TRIGGER_OFFSET 0x020
+#define ARV_FAKE_CAMERA_REGISTER_FRAME_START_OFFSET 0x000
+#define ARV_FAKE_CAMERA_REGISTER_ACQUISITION_START_OFFSET 0x020
#define ARV_FAKE_CAMERA_REGISTER_TRIGGER_MODE 0x300
#define ARV_FAKE_CAMERA_REGISTER_TRIGGER_SOURCE 0x304
#define ARV_FAKE_CAMERA_REGISTER_TRIGGER_ACTIVATION 0x308
+
#define ARV_FAKE_CAMERA_REGISTER_ACQUISITION 0x124
#define ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US 0x120
+#define ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT 20000.0
+
/* Analog control */
#define ARV_FAKE_CAMERA_REGISTER_GAIN_RAW 0x110
diff --git a/src/tests/fake.c b/src/tests/fake.c
index 47791ea..4df6878 100644
--- a/src/tests/fake.c
+++ b/src/tests/fake.c
@@ -46,7 +46,8 @@ trigger_registers_test (void)
arv_device_set_string_feature_value (device, "TriggerSelector", "AcquisitionStart");
address = arv_gc_register_get_address (ARV_GC_REGISTER (node));
- g_assert_cmpint (address, ==, ARV_FAKE_CAMERA_REGISTER_TRIGGER_MODE + ARV_FAKE_CAMERA_REGISTER_TRIGGER_OFFSET);
+ g_assert_cmpint (address, ==, ARV_FAKE_CAMERA_REGISTER_TRIGGER_MODE +
+ ARV_FAKE_CAMERA_REGISTER_ACQUISITION_START_OFFSET);
g_object_unref (device);
}
@@ -63,7 +64,7 @@ fake_device_test (void)
/* Check default */
int_value = arv_device_get_integer_feature_value (device, "Width");
- g_assert_cmpint (int_value, ==, 512);
+ g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_WIDTH_DEFAULT);
arv_device_set_integer_feature_value (device, "Width", 1024);
int_value = arv_device_get_integer_feature_value (device, "Width");
@@ -71,20 +72,20 @@ fake_device_test (void)
/* Check default */
int_value = arv_device_get_integer_feature_value (device, "Height");
- g_assert_cmpint (int_value, ==, 512);
+ g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_HEIGHT_DEFAULT);
arv_device_set_integer_feature_value (device, "Height", 1024);
int_value = arv_device_get_integer_feature_value (device, "Height");
g_assert_cmpint (int_value, ==, 1024);
int_value = arv_device_get_integer_feature_value (device, "BinningHorizontal");
- g_assert_cmpint (int_value, ==, 1);
+ g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_BINNING_HORIZONTAL_DEFAULT);
int_value = arv_device_get_integer_feature_value (device, "BinningVertical");
- g_assert_cmpint (int_value, ==, 1);
+ g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_BINNING_VERTICAL_DEFAULT);
dbl_value = arv_device_get_float_feature_value (device, "ExposureTimeAbs");
- g_assert_cmpfloat (dbl_value, ==, 40000.0);
+ g_assert_cmpfloat (dbl_value, ==, ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT);
int_value = arv_device_get_integer_feature_value (device, "PixelFormat");
- g_assert_cmpint (int_value, ==, ARV_PIXEL_FORMAT_MONO_8);
+ g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_PIXEL_FORMAT_DEFAULT);
int_value = arv_device_get_integer_feature_value (device, "GainRaw");
g_assert_cmpint (int_value, ==, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]