diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-03-31 12:02:11 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-03-31 12:02:11 +0200 |
commit | 1217923dbc0b907410642f611fdb5b13236cf850 (patch) | |
tree | 351ed1f7305b77a479e87c6f214416a81937aaea /src | |
parent | 67f433437efdfd7fa7a087603f38663574ea9146 (diff) | |
download | libuca-1217923dbc0b907410642f611fdb5b13236cf850.tar.gz libuca-1217923dbc0b907410642f611fdb5b13236cf850.tar.bz2 libuca-1217923dbc0b907410642f611fdb5b13236cf850.tar.xz libuca-1217923dbc0b907410642f611fdb5b13236cf850.zip |
Switch to trigger source/type semantics
This change makes the naming more consistent but will break client and plugin
code. The main idea is to specify a trigger source (AUTO being a virtual source)
which denotes how causes a trigger and a trigger type which denotes when
triggering happens (edge or level).
Diffstat (limited to 'src')
-rw-r--r-- | src/uca-camera.c | 54 | ||||
-rw-r--r-- | src/uca-camera.h | 16 |
2 files changed, 50 insertions, 20 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c index 66d7743..466d0df 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -41,14 +41,20 @@ G_DEFINE_TYPE(UcaCamera, uca_camera, G_TYPE_OBJECT) /** - * UcaCameraTrigger: - * @UCA_CAMERA_TRIGGER_AUTO: Trigger automatically - * @UCA_CAMERA_TRIGGER_EXTERNAL: Trigger from an external source - * @UCA_CAMERA_TRIGGER_SOFTWARE: Trigger from software using + * UcaCameraTriggerSource: + * @UCA_CAMERA_TRIGGER_SOURCE_AUTO: Trigger automatically + * @UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL: Trigger from an external source + * @UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE: Trigger from software using * #uca_camera_trigger */ /** + * UcaCameraTriggerType: + * @UCA_CAMERA_TRIGGER_TYPE_EDGE: Trigger on rising edge + * @UCA_CAMERA_TRIGGER_TYPE_LEVEL: Trigger during level signal + */ + +/** * UcaCameraError: * @UCA_CAMERA_ERROR_NOT_FOUND: Camera type is unknown * @UCA_CAMERA_ERROR_RECORDING: Camera is already recording @@ -108,6 +114,7 @@ const gchar *uca_camera_props[N_BASE_PROPERTIES] = { "sensor-horizontal-binnings", "sensor-vertical-binning", "sensor-vertical-binnings", + "trigger", "trigger-mode", "exposure-time", "frames-per-second", @@ -139,7 +146,8 @@ struct _UcaCameraPrivate { guint num_buffers; GThread *read_thread; UcaRingBuffer *ring_buffer; - UcaCameraTrigger trigger; + UcaCameraTriggerSource trigger_source; + UcaCameraTriggerType trigger_type; GValueArray *h_binnings; GValueArray *v_binnings; }; @@ -180,8 +188,12 @@ uca_camera_set_property (GObject *object, guint property_id, const GValue *value } break; - case PROP_TRIGGER_MODE: - priv->trigger = g_value_get_enum (value); + case PROP_TRIGGER_SOURCE: + priv->trigger_source = g_value_get_enum (value); + break; + + case PROP_TRIGGER_TYPE: + priv->trigger_type = g_value_get_enum (value); break; case PROP_BUFFERED: @@ -215,8 +227,12 @@ uca_camera_get_property(GObject *object, guint property_id, GValue *value, GPara g_value_set_boolean (value, priv->transfer_async); break; - case PROP_TRIGGER_MODE: - g_value_set_enum (value, priv->trigger); + case PROP_TRIGGER_SOURCE: + g_value_set_enum (value, priv->trigger_source); + break; + + case PROP_TRIGGER_TYPE: + g_value_set_enum (value, priv->trigger_type); break; case PROP_FRAMES_PER_SECOND: @@ -423,11 +439,18 @@ uca_camera_class_init (UcaCameraClass *klass) 1, G_MAXUINT, 1, G_PARAM_READABLE), G_PARAM_READABLE); - camera_properties[PROP_TRIGGER_MODE] = - g_param_spec_enum("trigger-mode", - "Trigger mode", - "Trigger mode", - UCA_TYPE_CAMERA_TRIGGER, UCA_CAMERA_TRIGGER_AUTO, + camera_properties[PROP_TRIGGER_SOURCE] = + g_param_spec_enum("trigger-source", + "Trigger source", + "Trigger source", + UCA_TYPE_CAMERA_TRIGGER_SOURCE, UCA_CAMERA_TRIGGER_SOURCE_AUTO, + G_PARAM_READWRITE); + + camera_properties[PROP_TRIGGER_TYPE] = + g_param_spec_enum("trigger-type", + "Trigger type", + "Trigger type", + UCA_TYPE_CAMERA_TRIGGER_TYPE, UCA_CAMERA_TRIGGER_TYPE_EDGE, G_PARAM_READWRITE); camera_properties[PROP_ROI_X] = @@ -561,7 +584,8 @@ uca_camera_init (UcaCamera *camera) camera->priv->is_recording = FALSE; camera->priv->is_readout = FALSE; camera->priv->transfer_async = FALSE; - camera->priv->trigger = UCA_CAMERA_TRIGGER_AUTO; + camera->priv->trigger_source = UCA_CAMERA_TRIGGER_SOURCE_AUTO; + camera->priv->trigger_type = UCA_CAMERA_TRIGGER_TYPE_EDGE; camera->priv->h_binnings = g_value_array_new (1); camera->priv->v_binnings = g_value_array_new (1); camera->priv->buffered = FALSE; diff --git a/src/uca-camera.h b/src/uca-camera.h index 0b6270c..97d3e6e 100644 --- a/src/uca-camera.h +++ b/src/uca-camera.h @@ -48,10 +48,15 @@ typedef enum { } UcaCameraError; typedef enum { - UCA_CAMERA_TRIGGER_AUTO, - UCA_CAMERA_TRIGGER_SOFTWARE, - UCA_CAMERA_TRIGGER_EXTERNAL -} UcaCameraTrigger; + UCA_CAMERA_TRIGGER_SOURCE_AUTO, + UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE, + UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL +} UcaCameraTriggerSource; + +typedef enum { + UCA_CAMERA_TRIGGER_TYPE_EDGE, + UCA_CAMERA_TRIGGER_TYPE_LEVEL +} UcaCameraTriggerType; typedef enum { UCA_UNIT_NA = 0, @@ -78,7 +83,8 @@ enum { PROP_SENSOR_HORIZONTAL_BINNINGS, PROP_SENSOR_VERTICAL_BINNING, PROP_SENSOR_VERTICAL_BINNINGS, - PROP_TRIGGER_MODE, + PROP_TRIGGER_SOURCE, + PROP_TRIGGER_TYPE, PROP_EXPOSURE_TIME, PROP_FRAMES_PER_SECOND, PROP_ROI_X, |