diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2014-12-16 17:17:30 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2014-12-16 17:17:30 +0100 |
commit | 2480178acbf97c72205d525d3d4d4f589477c2b0 (patch) | |
tree | 3200b299741067f15e428f57712df34f6945d10d | |
parent | cbecaaf86a32d7b6c173e8978aad2f6771b3017f (diff) | |
download | libuca-2480178acbf97c72205d525d3d4d4f589477c2b0.tar.gz libuca-2480178acbf97c72205d525d3d4d4f589477c2b0.tar.bz2 libuca-2480178acbf97c72205d525d3d4d4f589477c2b0.tar.xz libuca-2480178acbf97c72205d525d3d4d4f589477c2b0.zip |
Add uca_camera_write to write arbitrary data
This is necessary for cameras that provide a custom calibration.
-rw-r--r-- | src/uca-camera.c | 33 | ||||
-rw-r--r-- | src/uca-camera.h | 6 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c index 50a9aea..965015b 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -342,6 +342,7 @@ uca_camera_class_init (UcaCameraClass *klass) klass->start_recording = NULL; klass->stop_recording = NULL; klass->grab = NULL; + klass->write = NULL; camera_properties[PROP_NAME] = g_param_spec_string("name", @@ -919,6 +920,38 @@ uca_camera_trigger (UcaCamera *camera, GError **error) } /** + * uca_camera_write: + * @camera: A #UcaCamera object + * @name: String that identifies the written data. + * @data: (type gulong): Pointer to suitably sized data buffer. Must not be + * %NULL. + * @size: Size of the data buffer in bytes. + * @error: Location to store a #UcaCameraError or %NULL. + * + * Writes camera-specific @data containing @size bytes and identified by @name. + */ +void +uca_camera_write (UcaCamera *camera, const gchar *name, gpointer data, gsize size, GError **error) +{ + UcaCameraClass *klass; + + g_return_if_fail (UCA_IS_CAMERA (camera)); + + klass = UCA_CAMERA_GET_CLASS (camera); + + g_return_if_fail (klass != NULL); + + if (klass->write == NULL) { + g_set_error (error, UCA_CAMERA_ERROR, UCA_CAMERA_ERROR_NOT_IMPLEMENTED, + "`%s' does not provide a `write' method", + G_OBJECT_TYPE_NAME (G_OBJECT (camera))); + } + else { + (*klass->write) (camera, name, data, size, error); + } +} + +/** * uca_camera_grab: * @camera: A #UcaCamera object * @data: (type gulong): Pointer to suitably sized data buffer. Must not be diff --git a/src/uca-camera.h b/src/uca-camera.h index 62a6c89..156df8b 100644 --- a/src/uca-camera.h +++ b/src/uca-camera.h @@ -135,6 +135,7 @@ struct _UcaCameraClass { void (*start_readout) (UcaCamera *camera, GError **error); void (*stop_readout) (UcaCamera *camera, GError **error); void (*trigger) (UcaCamera *camera, GError **error); + void (*write) (UcaCamera *camera, const gchar *name, gpointer data, gsize size, GError **error); gboolean (*grab) (UcaCamera *camera, gpointer data, GError **error); }; @@ -151,6 +152,11 @@ void uca_camera_stop_readout (UcaCamera *camera, GError **error); void uca_camera_trigger (UcaCamera *camera, GError **error); +void uca_camera_write (UcaCamera *camera, + const gchar *name, + gpointer data, + gsize size, + GError **error); gboolean uca_camera_grab (UcaCamera *camera, gpointer data, GError **error) |