[aravis] camera: API addition.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] camera: API addition.
- Date: Thu, 13 May 2010 16:51:44 +0000 (UTC)
commit 0f83ea36259120a4ebe5736a0d8ca3e9c691f4f8
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Thu May 13 18:51:02 2010 +0200
camera: API addition.
src/arvcamera.c | 170 ++++++++++++++++++++++++++++++++++++-------------------
src/arvcamera.h | 41 ++++++++++----
2 files changed, 142 insertions(+), 69 deletions(-)
---
diff --git a/src/arvcamera.c b/src/arvcamera.c
index b629497..b42c3c2 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -46,6 +46,8 @@ arv_camera_new_stream (ArvCamera *camera, ArvStreamCallback callback, void *user
return arv_device_new_stream (camera->priv->device, callback, user_data);
}
+/* Device control */
+
const char *
arv_camera_get_vendor_name (ArvCamera *camera)
{
@@ -70,151 +72,191 @@ arv_camera_get_device_id (ArvCamera *camera)
return arv_device_get_string_feature_value (camera->priv->device, "DeviceID");
}
+/* Image format control */
+
void
-arv_camera_set_acquisition_mode (ArvCamera *camera, const char *value)
+arv_camera_get_sensor_size (ArvCamera *camera, gint *width, gint *height)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_set_string_feature_value (camera->priv->device, "AcquisitionMode", value);
+ if (width != NULL)
+ *width = arv_device_get_integer_feature_value (camera->priv->device, "SensorWidth");
+ if (height != NULL)
+ *height = arv_device_get_integer_feature_value (camera->priv->device, "SensorHeight");
}
-const char *
-arv_camera_get_acquisition_mode (ArvCamera *camera)
+void
+arv_camera_set_region (ArvCamera *camera, int x, int y, int width, int height)
{
- g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
+ g_return_if_fail (ARV_IS_CAMERA (camera));
- return arv_device_get_string_feature_value (camera->priv->device, "AcquisitionMode");
+ if (x > 0)
+ arv_device_set_integer_feature_value (camera->priv->device, "OffsetX", x);
+ if (y > 0)
+ arv_device_set_integer_feature_value (camera->priv->device, "OffsetY", y);
+ if (width > 0)
+ arv_device_set_integer_feature_value (camera->priv->device, "Width", width);
+ if (height > 0)
+ arv_device_set_integer_feature_value (camera->priv->device, "Height", height);
}
void
-arv_camera_start_acquisition (ArvCamera *camera)
+arv_camera_get_region (ArvCamera *camera, gint *x, gint *y, gint *width, gint *height)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_execute_command (camera->priv->device, "AcquisitionStart");
+ if (x != NULL)
+ *x = arv_device_get_integer_feature_value (camera->priv->device, "OffsetX");
+ if (y != NULL)
+ *y = arv_device_get_integer_feature_value (camera->priv->device, "OffsetY");
+ if (width != NULL)
+ *width = arv_device_get_integer_feature_value (camera->priv->device, "Width");
+ if (height != NULL)
+ *height = arv_device_get_integer_feature_value (camera->priv->device, "Height");
}
void
-arv_camera_stop_acquisition (ArvCamera *camera)
+arv_camera_set_binning (ArvCamera *camera, gint dx, gint dy)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_execute_command (camera->priv->device, "AcquisitionStop");
+ if (dx > 0)
+ arv_device_set_integer_feature_value (camera->priv->device, "BinningHorizontal", dx);
+ if (dy > 0)
+ arv_device_set_integer_feature_value (camera->priv->device, "BinningVertical", dy);
}
void
-arv_camera_set_trigger_selector (ArvCamera *camera, const char *value)
+arv_camera_get_binning (ArvCamera *camera, gint *dx, gint *dy)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_set_string_feature_value (camera->priv->device, "TriggerSelector", value);
+ if (dx != NULL)
+ *dx = arv_device_get_integer_feature_value (camera->priv->device, "BinningHorizontal");
+ if (dy != NULL)
+ *dy = arv_device_get_integer_feature_value (camera->priv->device, "BinningVertical");
}
void
-arv_camera_set_trigger_mode (ArvCamera *camera, const char *value)
+arv_camera_set_pixel_format (ArvCamera *camera, ArvPixelFormat format)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_set_string_feature_value (camera->priv->device, "TriggerMode", value);
+ arv_device_set_integer_feature_value (camera->priv->device, "PixelFormat", format);
}
-const char *
-arv_camera_get_trigger_mode (ArvCamera *camera)
+ArvPixelFormat
+arv_camera_get_pixel_format (ArvCamera *camera)
{
- g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
+ g_return_val_if_fail (ARV_IS_CAMERA (camera), 0);
- return arv_device_get_string_feature_value (camera->priv->device, "TriggerMode");
+ return arv_device_get_integer_feature_value (camera->priv->device, "PixelFormat");
}
+/* Acquisition control */
+
void
-arv_camera_set_trigger_source (ArvCamera *camera, const char *value)
+arv_camera_set_acquisition_mode (ArvCamera *camera, const char *value)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_set_string_feature_value (camera->priv->device, "TriggerSource", value);
+ arv_device_set_string_feature_value (camera->priv->device, "AcquisitionMode", value);
}
const char *
-arv_camera_get_trigger_source (ArvCamera *camera)
+arv_camera_get_acquisition_mode (ArvCamera *camera)
{
g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
- return arv_device_get_string_feature_value (camera->priv->device, "TriggerSource");
+ return arv_device_get_string_feature_value (camera->priv->device, "AcquisitionMode");
}
void
-arv_camera_set_trigger_activation (ArvCamera *camera, const char *value)
+arv_camera_start_acquisition (ArvCamera *camera)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_set_string_feature_value (camera->priv->device, "TriggerActivation", value);
+ arv_device_execute_command (camera->priv->device, "AcquisitionStart");
}
-const char *
-arv_camera_get_trigger_activation (ArvCamera *camera)
+void
+arv_camera_stop_acquisition (ArvCamera *camera)
{
- g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
+ g_return_if_fail (ARV_IS_CAMERA (camera));
- return arv_device_get_string_feature_value (camera->priv->device, "TriggerActivation");
+ arv_device_execute_command (camera->priv->device, "AcquisitionStop");
}
-guint
-arv_camera_get_payload (ArvCamera *camera)
+void
+arv_camera_set_acquisition_frame_rate (ArvCamera *camera, double frame_rate)
{
- g_return_val_if_fail (ARV_IS_CAMERA (camera), 0);
+ g_return_if_fail (ARV_IS_CAMERA (camera));
- return arv_device_get_integer_feature_value (camera->priv->device, "PayloadSize");
+ arv_device_set_float_feature_value (camera->priv->device, "AcquisitionFrameRate", frame_rate);
+}
+
+double
+arv_camera_get_acquisition_frame_rate (ArvCamera *camera)
+{
+ g_return_val_if_fail (ARV_IS_CAMERA (camera), 0.0);
+
+ return arv_device_get_integer_feature_value (camera->priv->device, "AcquisitionFrameRate");
}
void
-arv_camera_set_region (ArvCamera *camera, int x, int y, int width, int height)
+arv_camera_set_trigger_selector (ArvCamera *camera, const char *value)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- /* FIXME check for limits */
- if (width > 0)
- arv_device_set_integer_feature_value (camera->priv->device, "Width", width);
- if (height > 0)
- arv_device_set_integer_feature_value (camera->priv->device, "Height", width);
+ arv_device_set_string_feature_value (camera->priv->device, "TriggerSelector", value);
}
void
-arv_camera_get_region (ArvCamera *camera, gint *x, gint *y, gint *width, gint *height)
+arv_camera_set_trigger_mode (ArvCamera *camera, const char *value)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- if (x != NULL)
- *x = 0;
- if (y != NULL)
- *y = 0;
+ arv_device_set_string_feature_value (camera->priv->device, "TriggerMode", value);
+}
- if (width != NULL)
- *width = arv_device_get_integer_feature_value (camera->priv->device, "Width");
- if (height != NULL)
- *height = arv_device_get_integer_feature_value (camera->priv->device, "Height");
+const char *
+arv_camera_get_trigger_mode (ArvCamera *camera)
+{
+ g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
+
+ return arv_device_get_string_feature_value (camera->priv->device, "TriggerMode");
}
void
-arv_camera_set_binning (ArvCamera *camera, gint dx, gint dy)
+arv_camera_set_trigger_source (ArvCamera *camera, const char *value)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- /* FIXME check for limits */
- if (dx > 0)
- arv_device_set_integer_feature_value (camera->priv->device, "BinningHorizontal", dx);
- if (dy > 0)
- arv_device_set_integer_feature_value (camera->priv->device, "BinningVertical", dx);
+ arv_device_set_string_feature_value (camera->priv->device, "TriggerSource", value);
+}
+
+const char *
+arv_camera_get_trigger_source (ArvCamera *camera)
+{
+ g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
+
+ return arv_device_get_string_feature_value (camera->priv->device, "TriggerSource");
}
void
-arv_camera_get_binning (ArvCamera *camera, gint *dx, gint *dy)
+arv_camera_set_trigger_activation (ArvCamera *camera, const char *value)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- if (dx != NULL)
- *dx = arv_device_get_integer_feature_value (camera->priv->device, "BinningHorizontal");
- if (dy != NULL)
- *dy = arv_device_get_integer_feature_value (camera->priv->device, "BinningVertical");
+ arv_device_set_string_feature_value (camera->priv->device, "TriggerActivation", value);
+}
+
+const char *
+arv_camera_get_trigger_activation (ArvCamera *camera)
+{
+ g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
+
+ return arv_device_get_string_feature_value (camera->priv->device, "TriggerActivation");
}
void
@@ -233,6 +275,8 @@ arv_camera_get_exposure_time (ArvCamera *camera)
return arv_device_get_float_feature_value (camera->priv->device, "ExposureTimeAbs");
}
+/* Analog control */
+
void
arv_camera_set_gain (ArvCamera *camera, gint64 gain)
{
@@ -249,6 +293,16 @@ arv_camera_get_gain (ArvCamera *camera)
return arv_device_get_integer_feature_value (camera->priv->device, "GainRaw");
}
+/* Transport layer control */
+
+guint
+arv_camera_get_payload (ArvCamera *camera)
+{
+ g_return_val_if_fail (ARV_IS_CAMERA (camera), 0);
+
+ return arv_device_get_integer_feature_value (camera->priv->device, "PayloadSize");
+}
+
ArvCamera *
arv_camera_new (const char *name)
{
diff --git a/src/arvcamera.h b/src/arvcamera.h
index ffc244a..50ab5dc 100644
--- a/src/arvcamera.h
+++ b/src/arvcamera.h
@@ -52,13 +52,30 @@ GType arv_camera_get_type (void);
ArvCamera * arv_camera_new (const char *name);
ArvStream * arv_camera_new_stream (ArvCamera *camera, ArvStreamCallback callback, void *user_data);
+
+/* Device control */
+
const char * arv_camera_get_vendor_name (ArvCamera *camera);
const char * arv_camera_get_model_name (ArvCamera *camera);
const char * arv_camera_get_device_id (ArvCamera *camera);
-void arv_camera_set_acquisition_mode (ArvCamera *camera, const char *value);
-const char * arv_camera_get_acquisition_mode (ArvCamera *camera);
-void arv_camera_start_acquisition (ArvCamera *camera);
-void arv_camera_stop_acquisition (ArvCamera *camera);
+
+/* Image format control */
+
+void arv_camera_get_sensor_size (ArvCamera *camera, gint *width, gint *height);
+void arv_camera_set_region (ArvCamera *camera, gint x, gint y, gint width, gint height);
+void arv_camera_get_region (ArvCamera *camera, gint *x, gint *y, gint *width, gint *height);
+void arv_camera_set_binning (ArvCamera *camera, gint dx, gint dy);
+void arv_camera_get_binning (ArvCamera *camera, gint *dx, gint *dy);
+void arv_camera_set_pixel_format (ArvCamera *camera, ArvPixelFormat format);
+ArvPixelFormat arv_camera_get_pixel_format (ArvCamera *camera);
+
+/* Acquisition control */
+
+void arv_camera_set_acquisition_mode (ArvCamera *camera, const char *value);
+const char * arv_camera_get_acquisition_mode (ArvCamera *camera);
+void arv_camera_start_acquisition (ArvCamera *camera);
+void arv_camera_stop_acquisition (ArvCamera *camera);
+void arv_camera_set_acquisition_frame_rate (ArvCamera *camera, double frame_rate);
void arv_camera_set_trigger_selector (ArvCamera *camera, const char *value);
void arv_camera_set_trigger_mode (ArvCamera *camera, const char *value);
const char * arv_camera_get_trigger_mode (ArvCamera *camera);
@@ -66,16 +83,18 @@ void arv_camera_set_trigger_source (ArvCamera *camera, const char *value);
const char * arv_camera_get_trigger_source (ArvCamera *camera);
void arv_camera_set_trigger_activation (ArvCamera *camera, const char *value);
const char * arv_camera_get_trigger_activation (ArvCamera *camera);
-guint arv_camera_get_payload (ArvCamera *camera);
-void arv_camera_set_region (ArvCamera *camera, gint x, gint y, gint width, gint height);
-void arv_camera_get_region (ArvCamera *camera, gint *x, gint *y, gint *width, gint *height);
-void arv_camera_set_binning (ArvCamera *camera, gint dx, gint dy);
-void arv_camera_get_binning (ArvCamera *camera, gint *dx, gint *dy);
-void arv_camera_set_exposure_time (ArvCamera *camera, double exposure_time_us);
-gboolean arv_camera_get_exposure_time (ArvCamera *camera);
+void arv_camera_set_exposure_time (ArvCamera *camera, double exposure_time_us);
+gboolean arv_camera_get_exposure_time (ArvCamera *camera);
+
+/* Analog control */
+
void arv_camera_set_gain (ArvCamera *camera, gint64 gain);
gint64 arv_camera_get_gain (ArvCamera *camera);
+/* Transport layer control */
+
+guint arv_camera_get_payload (ArvCamera *camera);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]