[aravis] fake: more features.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] fake: more features.
- Date: Fri, 14 May 2010 21:20:41 +0000 (UTC)
commit 4e172e2782591d34fa3c66e998fc5c5439099eb1
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Fri May 14 23:19:14 2010 +0200
fake: more features.
src/arv-fake-camera.xml | 170 ++++++++++++++++++++++++++++++-----------------
src/arvfakecamera.c | 10 ++-
src/arvfakecamera.h | 12 +++-
src/arvgc.c | 6 +-
src/tests/fake.c | 59 ++++++++--------
5 files changed, 159 insertions(+), 98 deletions(-)
---
diff --git a/src/arv-fake-camera.xml b/src/arv-fake-camera.xml
index f8be8ae..42374c9 100644
--- a/src/arv-fake-camera.xml
+++ b/src/arv-fake-camera.xml
@@ -18,34 +18,22 @@
xsi:schemaLocation="http://www.genicam.org/GenApi/Version_1_0 GenApiSchema.xsd">
<Category Name="Root" NameSpace="Standard">
+ <pFeature>DeviceControl</pFeature>
+ <pFeature>ImageFormatControl</pFeature>
<pFeature>AcquisitionControl</pFeature>
- <pFeature>FeatureControl</pFeature>
<pFeature>TransportLayerControl</pFeature>
</Category>
- <Category Name="AcquisitionControl" NameSpace="Custom">
- <pFeature>AcquisitionStart</pFeature>
- <pFeature>AcquisitionStop</pFeature>
- </Category>
+ <!-- Device control -->
- <Category Name="FeatureControl" NameSpace="Custom">
- <pFeature>GainSelector</pFeature>
- <pFeature>GainRaw</pFeature>
- <pFeature>GainAuto</pFeature>
+ <Category Name="DeviceControl" NameSpace="Standard">
+ <pFeature>DeviceVendorName</pFeature>
+ <pFeature>DeviceModelName</pFeature>
+ <pFeature>DeviceManufacturerInfo</pFeature>
+ <pFeature>DeviceID</pFeature>
+ <pFeature>DeviceVersion</pFeature>
</Category>
- <Category Name="TransportLayerControl" NameSpace="Standard">
- <pFeature>PayloadSize</pFeature>
- </Category>
-
- <StringReg Name="DeviceID" NameSpace="Standard">
- <DisplayName>Device ID</DisplayName>
- <Address>0xd8</Address>
- <Length>16</Length>
- <AccessMode>RO</AccessMode>
- <pPort>Device</pPort>
- </StringReg>
-
<StringReg Name="DeviceVendorName" NameSpace="Standard">
<DisplayName>Vendor Name</DisplayName>
<Address>0x48</Address>
@@ -70,6 +58,14 @@
<pPort>Device</pPort>
</StringReg>
+ <StringReg Name="DeviceID" NameSpace="Standard">
+ <DisplayName>Device ID</DisplayName>
+ <Address>0xd8</Address>
+ <Length>16</Length>
+ <AccessMode>RO</AccessMode>
+ <pPort>Device</pPort>
+ </StringReg>
+
<StringReg Name="DeviceVersion" NameSpace="Standard">
<DisplayName>Device Version</DisplayName>
<Address>0x88</Address>
@@ -78,26 +74,19 @@
<pPort>Device</pPort>
</StringReg>
- <Command Name="AcquisitionStart" NameSpace="Standard">
- <Description>Start acquisition.</Description>
- <pValue>AcquisitionCommandRegister</pValue>
- <CommandValue>1</CommandValue>
- </Command>
-
- <Command Name="AcquisitionStop" NameSpace="Standard">
- <Description>Stop acquisition.</Description>
- <pValue>AcquisitionCommandRegister</pValue>
- <CommandValue>0</CommandValue>
- </Command>
-
- <IntReg Name="AcquisitionCommandRegister" NameSpace="Custom">
- <Address>0x120</Address>
- <Length>4</Length>
- <AccessMode>WO</AccessMode>
- <pPort>Device</pPort>
- <Sign>Unsigned</Sign>
- <Endianess>LittleEndian</Endianess>
- </IntReg>
+ <!-- Image format control -->
+
+ <Category Name="ImageFormatControl" NameSpace="Standard">
+ <pFeature>SensorHeight</pFeature>
+ <pFeature>SensorWidth</pFeature>
+ <pFeature>Width</pFeature>
+ <pFeature>Height</pFeature>
+ <pFeature>WidthMax</pFeature>
+ <pFeature>HeightMax</pFeature>
+ <pFeature>BinningHorizontal</pFeature>
+ <pFeature>BinningVertical</pFeature>
+ <pFeature>PixelFormat</pFeature>
+ </Category>
<Integer Name="SensorHeight" NameSpace="Standard">
<Description>Full height of image sensor.</Description>
@@ -193,6 +182,81 @@
<Endianess>LittleEndian</Endianess>
</IntReg>
+ <Enumeration Name="PixelFormat" NameSpace="Standard">
+ <DisplayName>Pixel format</DisplayName>
+ <EnumEntry Name="Mono8" NameSpace="Standard">
+ <Value>17301505</Value>
+ </EnumEntry>
+ <pValue>PixelFormatRegister</pValue>
+ </Enumeration>
+
+ <IntReg Name="PixelFormatRegister" NameSpace="Custom">
+ <Address>0x128</Address>
+ <Length>4</Length>
+ <AccessMode>RW</AccessMode>
+ <pPort>Device</pPort>
+ <Sign>Unsigned</Sign>
+ <Endianess>LittleEndian</Endianess>
+ </IntReg>
+
+ <!-- Acquisition control -->
+
+ <Category Name="AcquisitionControl" NameSpace="Custom">
+ <pFeature>AcquisitionStart</pFeature>
+ <pFeature>AcquisitionStop</pFeature>
+ <pFeature>ExposureTimeAbs</pFeature>
+ </Category>
+
+ <Command Name="AcquisitionStart" NameSpace="Standard">
+ <Description>Start acquisition.</Description>
+ <pValue>AcquisitionCommandRegister</pValue>
+ <CommandValue>1</CommandValue>
+ </Command>
+
+ <Command Name="AcquisitionStop" NameSpace="Standard">
+ <Description>Stop acquisition.</Description>
+ <pValue>AcquisitionCommandRegister</pValue>
+ <CommandValue>0</CommandValue>
+ </Command>
+
+ <IntReg Name="AcquisitionCommandRegister" NameSpace="Custom">
+ <Address>0x124</Address>
+ <Length>4</Length>
+ <AccessMode>WO</AccessMode>
+ <pPort>Device</pPort>
+ <Sign>Unsigned</Sign>
+ <Endianess>LittleEndian</Endianess>
+ </IntReg>
+
+ <Float Name="ExposureTimeAbs" NameSpace="Standard">
+ <Description>Exposure duration, in microseconds.</Description>
+ <pValue>ExposureTimeAbsConverter</pValue>
+ <Min>10.0</Min>
+ <Max>10000000.0</Max>
+ </Float>
+
+ <Converter Name="ExposureTimeAbsConverter" NameSpace="Custom">
+ <FormulaTo>FROM</FormulaTo>
+ <FormulaFrom>TO</FormulaFrom>
+ <pValue>ExposureTimeAbsRegister</pValue>
+ </Converter>
+
+ <IntReg Name="ExposureTimeAbsRegister" NameSpace="Custom">
+ <Address>0x120</Address>
+ <Length>4</Length>
+ <AccessMode>RW</AccessMode>
+ <pPort>Device</pPort>
+ <Sign>Unsigned</Sign>
+ <Endianess>LittleEndian</Endianess>
+ </IntReg>
+
+ <!-- Analog control -->
+
+ <Category Name="AnalogControl" NameSpace="Custom">
+ <pFeature>GainRaw</pFeature>
+ <pFeature>GainAuto</pFeature>
+ </Category>
+
<Integer Name="GainRaw" NameSpace="Standard">
<Description>Raw gain.</Description>
<pValue>GainRawRegister</pValue>
@@ -232,27 +296,11 @@
<Endianess>LittleEndian</Endianess>
</IntReg>
- <Float Name="ExposureTimeAbs" NameSpace="Standard">
- <Description>Exposure duration, in microseconds.</Description>
- <pValue>ExposureTimeAbsConverter</pValue>
- <Min>10.0</Min>
- <Max>10000000.0</Max>
- </Float>
+ <!-- Transport layer control -->
- <Converter Name="ExposureTimeAbsConverter" NameSpace="Custom">
- <FormulaTo>FROM</FormulaTo>
- <FormulaFrom>TO</FormulaFrom>
- <pValue>ExposureTimeAbsRegister</pValue>
- </Converter>
-
- <IntReg Name="ExposureTimeAbsRegister" NameSpace="Custom">
- <Address>0x120</Address>
- <Length>4</Length>
- <AccessMode>RW</AccessMode>
- <pPort>Device</pPort>
- <Sign>Unsigned</Sign>
- <Endianess>LittleEndian</Endianess>
- </IntReg>
+ <Category Name="TransportLayerControl" NameSpace="Standard">
+ <pFeature>PayloadSize</pFeature>
+ </Category>
<IntSwissKnife Name="PayloadSize" NameSpace="Standard">
<pVariable Name="WIDTH">Width</pVariable>
diff --git a/src/arvfakecamera.c b/src/arvfakecamera.c
index 5b20eca..539ff05 100644
--- a/src/arvfakecamera.c
+++ b/src/arvfakecamera.c
@@ -128,10 +128,10 @@ arv_get_fake_camera_genicam_data (size_t *size)
genicam_file = g_mapped_file_new (filename, FALSE, NULL);
if (genicam_file != NULL) {
- arv_debug ("fakegenicam", "[get_fake_camera_genicam_data] %s [size = %d]",
+ arv_debug ("fake-genicam", "[get_fake_camera_genicam_data] %s [size = %d]",
filename,
g_mapped_file_get_length (genicam_file));
- arv_debug ("fakegenicam", g_mapped_file_get_contents (genicam_file));
+ arv_debug ("fake-genicam", g_mapped_file_get_contents (genicam_file));
}
g_free (filename);
@@ -185,9 +185,13 @@ arv_fake_camera_new (const char *serial_number)
arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_HEIGHT, 512);
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_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_EXPOSURE_TIME_US, 40000);
+
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);
- arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US, 40000);
return fake_camera;
}
diff --git a/src/arvfakecamera.h b/src/arvfakecamera.h
index 239da52..850be96 100644
--- a/src/arvfakecamera.h
+++ b/src/arvfakecamera.h
@@ -31,15 +31,25 @@ G_BEGIN_DECLS
/* To keep in sync with arv-fake-camera.xml */
+/* Image format control */
+
#define ARV_FAKE_CAMERA_REGISTER_SENSOR_WIDTH 0x11c
#define ARV_FAKE_CAMERA_REGISTER_SENSOR_HEIGHT 0x118
#define ARV_FAKE_CAMERA_REGISTER_WIDTH 0x100
#define ARV_FAKE_CAMERA_REGISTER_HEIGHT 0x104
#define ARV_FAKE_CAMERA_REGISTER_BINNING_HORIZONTAL 0x108
#define ARV_FAKE_CAMERA_REGISTER_BINNING_VERTICAL 0x10c
+#define ARV_FAKE_CAMERA_REGISTER_PIXEL_FORMAT 0x128
+
+/* Acquisition control */
+
+#define ARV_FAKE_CAMERA_REGISTER_ACQUISITION 0x124
+#define ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US 0x120
+
+/* Analog control */
+
#define ARV_FAKE_CAMERA_REGISTER_GAIN_RAW 0x110
#define ARV_FAKE_CAMERA_REGISTER_GAIN_MODE 0x114
-#define ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US 0x120
#define ARV_TYPE_FAKE_CAMERA (arv_fake_camera_get_type ())
#define ARV_FAKE_CAMERA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_FAKE_CAMERA, ArvFakeCamera))
diff --git a/src/arvgc.c b/src/arvgc.c
index 7c78099..6dc261c 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -231,7 +231,7 @@ arv_gc_parser_warning (void *user_data, const char *msg, ...)
va_list args;
va_start(args, msg);
- g_logv("Genicam", G_LOG_LEVEL_WARNING, msg, args);
+ g_logv("GcParser", G_LOG_LEVEL_WARNING, msg, args);
va_end(args);
}
@@ -241,7 +241,7 @@ arv_gc_parser_error (void *user_data, const char *msg, ...)
va_list args;
va_start(args, msg);
- g_logv("Genicam", G_LOG_LEVEL_CRITICAL, msg, args);
+ g_logv("GcParser", G_LOG_LEVEL_CRITICAL, msg, args);
va_end(args);
}
@@ -251,7 +251,7 @@ arv_gc_parser_fatal_error (void *user_data, const char *msg, ...)
va_list args;
va_start(args, msg);
- g_logv("Genicam", G_LOG_LEVEL_ERROR, msg, args);
+ g_logv("GcParser", G_LOG_LEVEL_ERROR, msg, args);
va_end(args);
}
diff --git a/src/tests/fake.c b/src/tests/fake.c
index bbb7ef7..b085d41 100644
--- a/src/tests/fake.c
+++ b/src/tests/fake.c
@@ -19,44 +19,43 @@ static void
fake_device_test (void)
{
ArvDevice *device;
- ArvGc *genicam;
- int value;
+ int int_value;
+ double dbl_value;
device = arv_fake_device_new ("TEST0");
g_assert (ARV_IS_FAKE_DEVICE (device));
- genicam = arv_device_get_genicam (device);
- g_assert (ARV_IS_GC (genicam));
-
/* Check default */
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "Width")));
- g_assert_cmpint (value, ==, 512);
+ int_value = arv_device_get_integer_feature_value (device, "Width");
+ g_assert_cmpint (int_value, ==, 512);
- arv_gc_integer_set_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "Width")), 1024);
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "Width")));
- g_assert_cmpint (value, ==, 1024);
+ arv_device_set_integer_feature_value (device, "Width", 1024);
+ int_value = arv_device_get_integer_feature_value (device, "Width");
+ g_assert_cmpint (int_value, ==, 1024);
/* Check default */
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "Height")));
- g_assert_cmpint (value, ==, 512);
-
- arv_gc_integer_set_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "Height")), 1024);
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "Height")));
- g_assert_cmpint (value, ==, 1024);
-
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "PayloadSize")));
- g_assert_cmpint (value, ==, 1024 * 1024);
-
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "BinningHorizontal")));
- g_assert_cmpint (value, ==, 1);
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "BinningVertical")));
- g_assert_cmpint (value, ==, 1);
- value = arv_gc_integer_get_value (ARV_GC_INTEGER (arv_gc_get_node (genicam, "GainRaw")));
- g_assert_cmpint (value, ==, 0);
- value = arv_gc_enumeration_get_int_value (ARV_GC_ENUMERATION (arv_gc_get_node (genicam, "GainAuto")));
- g_assert_cmpint (value, ==, 0);
- value = arv_gc_float_get_value (ARV_GC_FLOAT (arv_gc_get_node (genicam, "ExposureTimeAbs")));
- g_assert_cmpfloat (value, ==, 40000.0);
+ int_value = arv_device_get_integer_feature_value (device, "Height");
+ g_assert_cmpint (int_value, ==, 512);
+
+ 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, "PayloadSize");
+ g_assert_cmpint (int_value, ==, 1024 * 1024);
+
+ int_value = arv_device_get_integer_feature_value (device, "BinningHorizontal");
+ g_assert_cmpint (int_value, ==, 1);
+ int_value = arv_device_get_integer_feature_value (device, "BinningVertical");
+ g_assert_cmpint (int_value, ==, 1);
+ int_value = arv_device_get_integer_feature_value (device, "GainRaw");
+ g_assert_cmpint (int_value, ==, 0);
+ int_value = arv_device_get_integer_feature_value (device, "GainAuto");
+ g_assert_cmpint (int_value, ==, 0);
+ dbl_value = arv_device_get_float_feature_value (device, "ExposureTimeAbs");
+ g_assert_cmpfloat (dbl_value, ==, 40000.0);
+ int_value = arv_device_get_integer_feature_value (device, "PixelFormat");
+ g_assert_cmpint (int_value, ==, ARV_PIXEL_FORMAT_MONO_8);
g_object_unref (device);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]