diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-04-27 12:21:41 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-04-27 12:25:53 +0200 |
commit | 0583a712a46f0d42dbff1a168d97f08c523e4aaf (patch) | |
tree | cbd168f39336fe2630ead524da3c4157f1593401 /src | |
parent | 9370d31e814d29b9525346712f5dedea76f3a124 (diff) | |
download | libuca-0583a712a46f0d42dbff1a168d97f08c523e4aaf.tar.gz libuca-0583a712a46f0d42dbff1a168d97f08c523e4aaf.tar.bz2 libuca-0583a712a46f0d42dbff1a168d97f08c523e4aaf.tar.xz libuca-0583a712a46f0d42dbff1a168d97f08c523e4aaf.zip |
pco: add acquisition mode
Diffstat (limited to 'src')
-rw-r--r-- | src/cameras/uca-pco-camera.c | 61 | ||||
-rw-r--r-- | src/cameras/uca-pco-camera.h | 9 |
2 files changed, 67 insertions, 3 deletions
diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c index 4730bad..e589b13 100644 --- a/src/cameras/uca-pco-camera.c +++ b/src/cameras/uca-pco-camera.c @@ -55,6 +55,8 @@ G_DEFINE_TYPE(UcaPcoCamera, uca_pco_camera, UCA_TYPE_CAMERA) +#define TIMEBASE_INVALID 0xDEAD + /** * UcaPcoCameraError: * @UCA_PCO_CAMERA_ERROR_LIBPCO_INIT: Initializing libpco failed @@ -81,6 +83,7 @@ enum { PROP_DOUBLE_IMAGE_MODE, PROP_OFFSET_MODE, PROP_RECORD_MODE, + PROP_ACQUIRE_MODE, PROP_COOLING_POINT, PROP_NOISE_FILTER, N_PROPERTIES @@ -170,7 +173,27 @@ static GType uca_pco_camera_record_mode_get_type(void) return record_mode_type; } -#define TIMEBASE_INVALID 0xDEAD +/** + * UcaPcoCameraAcquireMode: + * @UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO: Take all images + * @UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL: Use <acq enbl> signal + */ +static GType uca_pco_camera_acquire_mode_get_type(void) +{ + static GType acquire_mode_type = 0; + + if (!acquire_mode_type) { + static GEnumValue acquire_modes[] = { + { UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO, "Take all images", "auto" }, + { UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL, "Use <acq enbl> signal", "external" }, + { 0, NULL, NULL } + }; + + acquire_mode_type = g_enum_register_static("UcaPcoCameraAcquireMode", acquire_modes); + } + + return acquire_mode_type; +} static pco_cl_map_entry pco_cl_map[] = { { CAMERATYPE_PCO_EDGE, "libFullAreaGray8.so", FG_CL_8BIT_FULL_10, FG_GRAY, 30.0f, FALSE }, @@ -588,6 +611,19 @@ static void uca_pco_camera_set_property(GObject *object, guint property_id, cons } break; + case PROP_ACQUIRE_MODE: + { + UcaPcoCameraAcquireMode mode = (UcaPcoCameraAcquireMode) g_value_get_enum(value); + + if (mode == UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO) + pco_set_acquire_mode(priv->pco, ACQUIRE_MODE_AUTO); + else if (mode == UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL) + pco_set_record_mode(priv->pco, ACQUIRE_MODE_EXTERNAL); + else + g_warning("Unknown acquire mode"); + } + break; + case PROP_TRIGGER_MODE: { UcaCameraTrigger trigger_mode = (UcaCameraTrigger) g_value_get_enum(value); @@ -770,6 +806,20 @@ static void uca_pco_camera_get_property(GObject *object, guint property_id, GVal } break; + case PROP_ACQUIRE_MODE: + { + guint16 mode; + pco_get_acquire_mode(priv->pco, &mode); + + if (mode == ACQUIRE_MODE_AUTO) + g_value_set_enum(value, UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO); + else if (mode == ACQUIRE_MODE_EXTERNAL) + g_value_set_enum(value, UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL); + else + g_warning("pco acquire mode not handled"); + } + break; + case PROP_TRIGGER_MODE: { guint16 mode; @@ -964,7 +1014,14 @@ static void uca_pco_camera_class_init(UcaPcoCameraClass *klass) g_param_spec_enum("record-mode", "Record mode", "Record mode", - UCA_TYPE_PCO_CAMERA_RECORDE_MODE, UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE, + UCA_TYPE_PCO_CAMERA_RECORD_MODE, UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE, + G_PARAM_READWRITE); + + pco_properties[PROP_ACQUIRE_MODE] = + g_param_spec_enum("acquire-mode", + "Acquire mode", + "Acquire mode", + UCA_TYPE_PCO_CAMERA_ACQUIRE_MODE, UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO, G_PARAM_READWRITE); pco_properties[PROP_DELAY_TIME] = diff --git a/src/cameras/uca-pco-camera.h b/src/cameras/uca-pco-camera.h index 3fc8522..243fac4 100644 --- a/src/cameras/uca-pco-camera.h +++ b/src/cameras/uca-pco-camera.h @@ -42,13 +42,20 @@ typedef struct _UcaPcoCamera UcaPcoCamera; typedef struct _UcaPcoCameraClass UcaPcoCameraClass; typedef struct _UcaPcoCameraPrivate UcaPcoCameraPrivate; -#define UCA_TYPE_PCO_CAMERA_RECORDE_MODE (uca_pco_camera_record_mode_get_type()) +#define UCA_TYPE_PCO_CAMERA_RECORD_MODE (uca_pco_camera_record_mode_get_type()) typedef enum { UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE, UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER, } UcaPcoCameraRecordMode; +#define UCA_TYPE_PCO_CAMERA_ACQUIRE_MODE (uca_pco_camera_acquire_mode_get_type()) + +typedef enum { + UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO, + UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL +} UcaPcoCameraAcquireMode; + /** * UcaPcoCamera: * |