diff options
author | Mihael Koep <koep@schneide.com> | 2014-09-09 16:54:43 +0200 |
---|---|---|
committer | Mihael Koep <koep@schneide.com> | 2014-09-17 09:52:47 +0200 |
commit | d35c0cf63f1174932b5a3bccb5f1db0a2e9bacc9 (patch) | |
tree | 4535c7851d6c84d8b713f3ba618fde7a7d754eb2 /plugins/dexela/uca-dexela-camera.c | |
parent | 685091674abecc4a8f3cd8d315c8c41a234a2309 (diff) | |
download | libuca-d35c0cf63f1174932b5a3bccb5f1db0a2e9bacc9.tar.gz libuca-d35c0cf63f1174932b5a3bccb5f1db0a2e9bacc9.tar.bz2 libuca-d35c0cf63f1174932b5a3bccb5f1db0a2e9bacc9.tar.xz libuca-d35c0cf63f1174932b5a3bccb5f1db0a2e9bacc9.zip |
Change trigger mode mapping to better match libuca rules
Diffstat (limited to 'plugins/dexela/uca-dexela-camera.c')
-rw-r--r-- | plugins/dexela/uca-dexela-camera.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/plugins/dexela/uca-dexela-camera.c b/plugins/dexela/uca-dexela-camera.c index db808fc..49f4635 100644 --- a/plugins/dexela/uca-dexela-camera.c +++ b/plugins/dexela/uca-dexela-camera.c @@ -85,6 +85,7 @@ struct _UcaDexelaCameraPrivate { guint roi_height; guint bits; gsize num_bytes; + UcaCameraTrigger uca_trigger_mode; }; /** @@ -104,26 +105,26 @@ static void fill_binnings(UcaDexelaCameraPrivate *priv) g_value_array_append(priv->binnings, &val); } -static void map_dexela_trigger_mode_to_uca(GValue* value, TriggerMode mode) +static void map_dexela_trigger_mode_to_uca(UcaDexelaCameraPrivate *priv, GValue* value, TriggerMode mode) { if (mode == SOFTWARE) { - g_value_set_enum(value, UCA_CAMERA_TRIGGER_SOFTWARE); + g_value_set_enum(value, priv->uca_trigger_mode); return; } if (mode == EDGE) { g_value_set_enum(value, UCA_CAMERA_TRIGGER_EXTERNAL); return; } - // XXX: this mapping is only a hack/guess - if (mode == DURATION) { - g_value_set_enum(value, UCA_CAMERA_TRIGGER_AUTO); - return; - } g_warning("Unsupported dexela trigger mode: %d", mode); } -static void set_trigger_mode(UcaCameraTrigger mode) +static void set_trigger_mode(UcaDexelaCameraPrivate *priv, UcaCameraTrigger mode) { + priv->uca_trigger_mode = mode; + if (mode == UCA_CAMERA_TRIGGER_AUTO) { + dexela_set_trigger_mode(SOFTWARE); + return; + } if (mode == UCA_CAMERA_TRIGGER_SOFTWARE) { dexela_set_trigger_mode(SOFTWARE); return; @@ -132,10 +133,6 @@ static void set_trigger_mode(UcaCameraTrigger mode) dexela_set_trigger_mode(EDGE); return; } - if (mode == UCA_CAMERA_TRIGGER_AUTO) { - dexela_set_trigger_mode(DURATION); - return; - } g_warning("Unsupported uca trigger mode: %d", mode); } @@ -254,7 +251,7 @@ static void uca_dexela_camera_get_property(GObject *object, guint property_id, G } case PROP_TRIGGER_MODE: { - map_dexela_trigger_mode_to_uca(value, dexela_get_trigger_mode()); + map_dexela_trigger_mode_to_uca(priv, value, dexela_get_trigger_mode()); break; } default: @@ -341,7 +338,7 @@ static void uca_dexela_camera_set_property(GObject *object, guint property_id, c } case PROP_TRIGGER_MODE: { - set_trigger_mode(g_value_get_enum(value)); + set_trigger_mode(priv, g_value_get_enum(value)); break; } default: @@ -367,6 +364,10 @@ static gboolean uca_dexela_camera_grab(UcaCamera *camera, gpointer data, GError g_debug("grab called"); g_return_val_if_fail(UCA_IS_DEXELA_CAMERA(camera), FALSE); UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(camera); + + if (priv->uca_trigger_mode == UCA_CAMERA_TRIGGER_SOFTWARE) { + // TODO: wait for a signal from uca_camera_trigger() + } guchar* fullFrame = dexela_grab(); apply_software_roi(fullFrame, priv->width, priv->num_bytes, data, priv->roi_x, priv->roi_y, priv->roi_width, priv->roi_height); return TRUE; @@ -444,6 +445,7 @@ static void uca_dexela_camera_init(UcaDexelaCamera *self) priv->roi_width = priv->width; priv->roi_height = priv->height; priv->num_bytes = 2; + priv->uca_trigger_mode = UCA_CAMERA_TRIGGER_AUTO; } G_MODULE_EXPORT GType |