diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-07-27 14:56:01 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-07-27 14:56:01 +0200 |
commit | d332dcbe5913bade12defca4cb15b5984fe8287d (patch) | |
tree | 26bfbe404677219ade36bec4caa5ff4d22c88f00 | |
parent | 9279bb496b11e349839609d962e40d16fd27c48e (diff) | |
download | uca-d332dcbe5913bade12defca4cb15b5984fe8287d.tar.gz uca-d332dcbe5913bade12defca4cb15b5984fe8287d.tar.bz2 uca-d332dcbe5913bade12defca4cb15b5984fe8287d.tar.xz uca-d332dcbe5913bade12defca4cb15b5984fe8287d.zip |
Set timeout less than infinity
-rw-r--r-- | src/cameras/uca-ufo-camera.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cameras/uca-ufo-camera.c b/src/cameras/uca-ufo-camera.c index fc27b1b..5e17937 100644 --- a/src/cameras/uca-ufo-camera.c +++ b/src/cameras/uca-ufo-camera.c @@ -259,15 +259,21 @@ static void uca_ufo_camera_grab(UcaCamera *camera, gpointer *data, GError **erro { g_return_if_fail(UCA_IS_UFO_CAMERA(camera)); UcaUfoCameraPrivate *priv = UCA_UFO_CAMERA_GET_PRIVATE(camera); - const gsize size = SENSOR_WIDTH * SENSOR_HEIGHT * sizeof(guint16); - pcilib_event_id_t event_id; + pcilib_event_id_t event_id; pcilib_event_info_t event_info; - size_t err = 0; + pcilib_timeout_t timeout; + gdouble exposure_time; + size_t err; + + const gsize size = SENSOR_WIDTH * SENSOR_HEIGHT * sizeof(guint16); err = pcilib_trigger(priv->handle, PCILIB_EVENT0, 0, NULL); PCILIB_SET_ERROR(err, UCA_UFO_CAMERA_ERROR_TRIGGER); - err = pcilib_get_next_event(priv->handle, PCILIB_TIMEOUT_INFINITE, &event_id, sizeof(pcilib_event_info_t), &event_info); + g_object_get (G_OBJECT (camera), "exposure-time", &exposure_time, NULL); + timeout = ((pcilib_timeout_t) (exposure_time * 1000 + 50.0) * 1000); + + err = pcilib_get_next_event(priv->handle, timeout, &event_id, sizeof(pcilib_event_info_t), &event_info); PCILIB_SET_ERROR(err, UCA_UFO_CAMERA_ERROR_NEXT_EVENT); if (*data == NULL) |