From c7b0d014b3a568ceb2db5d582a57cb7002face5e Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 8 Mar 2011 13:56:00 +0100 Subject: Add more offset properties --- src/cameras/pf.c | 11 +++++++++-- src/uca-cam.h | 8 +++++--- src/uca.c | 4 ++++ src/uca.h | 4 ++++ test/control.c | 10 +++++++--- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/cameras/pf.c b/src/cameras/pf.c index 0703f69..92ffa5d 100644 --- a/src/cameras/pf.c +++ b/src/cameras/pf.c @@ -21,6 +21,7 @@ #define FG_CAMERA_LINK_CAMTYP 11011 #define FG_CL_8BIT_FULL_8 308 #define FG_TRIGGERMODE 8100 +#define FG_EXPOSURE 10020 /**< Exposure Time in us (Brigthness) (float) */ #define set_void(p, type, value) { *((type *) p) = value; } @@ -38,7 +39,11 @@ static struct uca_pf_map uca_to_pf[] = { { UCA_PROP_HEIGHT_MIN, "Window.H.Min" }, { UCA_PROP_HEIGHT_MAX, "Window.H.Max" }, { UCA_PROP_X_OFFSET, "Window.X" }, + { UCA_PROP_X_OFFSET_MIN,"Window.X.Min" }, + { UCA_PROP_X_OFFSET_MAX,"Window.X.Max" }, { UCA_PROP_Y_OFFSET, "Window.Y" }, + { UCA_PROP_Y_OFFSET_MIN,"Window.Y.Min" }, + { UCA_PROP_Y_OFFSET_MAX,"Window.Y.Max" }, { UCA_PROP_EXPOSURE, "ExposureTime" }, { UCA_PROP_EXPOSURE_MIN, "ExposureTime.Min" }, { UCA_PROP_EXPOSURE_MAX, "ExposureTime.Max" }, @@ -105,12 +110,14 @@ static uint32_t uca_pf_set_property(struct uca_camera_t *cam, enum uca_property_ return UCA_ERR_PROP_VALUE_OUT_OF_RANGE; break; - /* case UCA_PROP_EXPOSURE: if (grabber->set_property(grabber, FG_EXPOSURE, (uint32_t *) data) != UCA_NO_ERROR) return UCA_ERR_PROP_VALUE_OUT_OF_RANGE; + + value.value.f = (float) *((uint32_t *) data); + if (pfDevice_SetProperty(0, t, &value) < 0) + return UCA_ERR_PROP_VALUE_OUT_OF_RANGE; break; - */ default: return UCA_ERR_PROP_INVALID; diff --git a/src/uca-cam.h b/src/uca-cam.h index 5710b0a..a7f1827 100644 --- a/src/uca-cam.h +++ b/src/uca-cam.h @@ -39,15 +39,17 @@ typedef uint32_t (*uca_cam_destroy) (struct uca_camera_t *cam); /** * \brief Set a property - * \param[in] property_name Name of the property as defined in XXX + * \param[in] property ID of the property as defined in XXX + * \param[out] data Where to read the property's value from * \return UCA_ERR_PROP_INVALID if property is not supported on the camera or * UCA_ERR_PROP_VALUE_OUT_OF_RANGE if value cannot be set. */ typedef uint32_t (*uca_cam_set_property) (struct uca_camera_t *cam, enum uca_property_ids property, void *data); /** - * \brief Set a property - * \param[in] property_name Name of the property as defined in XXX + * \brief Get a property + * \param[in] property ID of the property as defined in XXX + * \param[out] data Where to store the property's value * \return UCA_ERR_PROP_INVALID if property is not supported on the camera */ typedef uint32_t (*uca_cam_get_property) (struct uca_camera_t *cam, enum uca_property_ids property, void *data); diff --git a/src/uca.c b/src/uca.c index ea91f59..24c8461 100644 --- a/src/uca.c +++ b/src/uca.c @@ -46,7 +46,11 @@ static struct uca_property_t property_map[UCA_PROP_LAST+1] = { { "image.height.min", uca_pixel, uca_uint32t, uca_read }, { "image.height.max", uca_pixel, uca_uint32t, uca_read }, { "image.offset.x", uca_pixel, uca_uint32t, uca_readwrite }, + { "image.offset.x.min", uca_pixel, uca_uint32t, uca_read }, + { "image.offset.x.max", uca_pixel, uca_uint32t, uca_read }, { "image.offset.y", uca_pixel, uca_uint32t, uca_readwrite }, + { "image.offset.y.min", uca_pixel, uca_uint32t, uca_read }, + { "image.offset.y.max", uca_pixel, uca_uint32t, uca_read }, { "image.bitdepth", uca_bits, uca_uint8t, uca_read}, { "time.exposure", uca_us, uca_uint32t, uca_readwrite }, { "time.exposure.min", uca_ns, uca_uint32t, uca_read }, diff --git a/src/uca.h b/src/uca.h index 0c554c6..28459e4 100644 --- a/src/uca.h +++ b/src/uca.h @@ -53,7 +53,11 @@ enum uca_property_ids { UCA_PROP_HEIGHT_MIN, UCA_PROP_HEIGHT_MAX, UCA_PROP_X_OFFSET, + UCA_PROP_X_OFFSET_MIN, + UCA_PROP_X_OFFSET_MAX, UCA_PROP_Y_OFFSET, + UCA_PROP_Y_OFFSET_MIN, + UCA_PROP_Y_OFFSET_MAX, UCA_PROP_BITDEPTH, UCA_PROP_EXPOSURE, UCA_PROP_EXPOSURE_MIN, diff --git a/test/control.c b/test/control.c index baf6ee2..5444755 100644 --- a/test/control.c +++ b/test/control.c @@ -144,18 +144,19 @@ void fill_tree_store(GtkTreeStore *tree_store, struct uca_camera_t *cam) for (int prop_id = 0; prop_id < UCA_PROP_LAST; prop_id++) { property = uca_get_full_property(prop_id); + uint32_t result = UCA_NO_ERROR; switch (property->type) { case uca_string: - cam->get_property(cam, prop_id, value_string); + result = cam->get_property(cam, prop_id, value_string); break; case uca_uint8t: - cam->get_property(cam, prop_id, &value_8); + result = cam->get_property(cam, prop_id, &value_8); g_sprintf(value_string, "%d", value_8); break; case uca_uint32t: - cam->get_property(cam, prop_id, &value_32); + result = cam->get_property(cam, prop_id, &value_32); g_sprintf(value_string, "%d", value_32); break; } @@ -165,6 +166,9 @@ void fill_tree_store(GtkTreeStore *tree_store, struct uca_camera_t *cam) get_first_level_root(tree_store, &iter, tokens[0]); find_recursively(tree_store, &iter, &child, tokens, 1); + if (result == UCA_ERR_PROP_INVALID) + g_sprintf(value_string, "n/a"); + int count = 0; while (tokens[count++] != NULL); -- cgit v1.2.3