summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihael Koep <koep@schneide.com>2014-07-29 13:19:08 +0200
committerMihael Koep <koep@schneide.com>2014-07-29 13:32:56 +0200
commit57299b6cf9e606310d0997aeddd62141e824947c (patch)
tree86690019d03e49f19600db5331fc672ee149c35f
parentb891357388676e73229f24575245b4baadb70be0 (diff)
downloadlibuca-57299b6cf9e606310d0997aeddd62141e824947c.tar.gz
libuca-57299b6cf9e606310d0997aeddd62141e824947c.tar.bz2
libuca-57299b6cf9e606310d0997aeddd62141e824947c.tar.xz
libuca-57299b6cf9e606310d0997aeddd62141e824947c.zip
Updates to the dexela plugin
-rw-r--r--plugins/dexela/CMakeLists.txt4
-rw-r--r--plugins/dexela/changelog.txt2
-rw-r--r--plugins/dexela/uca-dexela-camera.c71
-rw-r--r--plugins/dexela/uca-dexela-camera.h6
4 files changed, 50 insertions, 33 deletions
diff --git a/plugins/dexela/CMakeLists.txt b/plugins/dexela/CMakeLists.txt
index 101f11e..a93ddc6 100644
--- a/plugins/dexela/CMakeLists.txt
+++ b/plugins/dexela/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.6)
project(ucadexela C)
-set(VERSION "1.0.3")
+set(VERSION "1.2.0")
find_package(DEXELA)
@@ -11,7 +11,7 @@ if (DEXELA_FOUND)
set(PLUGIN_SUMMARY "Dexela plugin for libuca")
set(PLUGIN_CHANGELOG "${CMAKE_CURRENT_SOURCE_DIR}/changelog.txt")
set(PLUGIN_DESCRIPTION "Plugin for the Dexela 1207 detector.")
- set(PLUGIN_REQUIRES "libuca = 1.3.0, libdexela >= 1.1.0")
+ set(PLUGIN_REQUIRES "libuca >= 1.3.0, libdexela >= 1.1.0")
set(PLUGIN_VENDOR "ANKA Computing Group")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../package-plugin.sh.in
diff --git a/plugins/dexela/changelog.txt b/plugins/dexela/changelog.txt
index 7ee4c54..4bcd2d6 100644
--- a/plugins/dexela/changelog.txt
+++ b/plugins/dexela/changelog.txt
@@ -1,3 +1,5 @@
+* Tue Jul 29 2014 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.2.0-1
+- bump plugin version for package management systems
* Wed Mar 19 2014 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.0.3-1
- bump libdexela requirement to 1.1.0
- use new libdexela API for FMT file
diff --git a/plugins/dexela/uca-dexela-camera.c b/plugins/dexela/uca-dexela-camera.c
index aa0a049..287ba5c 100644
--- a/plugins/dexela/uca-dexela-camera.c
+++ b/plugins/dexela/uca-dexela-camera.c
@@ -16,13 +16,18 @@
Franklin St, Fifth Floor, Boston, MA 02110, USA */
#include <string.h>
+#include <gio/gio.h>
#include <gmodule.h>
#include "uca-dexela-camera.h"
#include "dexela/dexela_api.h"
#define UCA_DEXELA_CAMERA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UCA_TYPE_DEXELA_CAMERA, UcaDexelaCameraPrivate))
-G_DEFINE_TYPE(UcaDexelaCamera, uca_dexela_camera, UCA_TYPE_CAMERA)
+static void uca_dexela_camera_initable_iface_init (GInitableIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (UcaDexelaCamera, uca_dexela_camera, UCA_TYPE_CAMERA,
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+ uca_dexela_camera_initable_iface_init))
/**
* UcaDexelaCameraError:
* @UCA_DEXELA_CAMERA_ERROR_LIBDEXELA_INIT: Initializing libdexela failed
@@ -136,26 +141,6 @@ static gboolean is_binning_allowed(UcaDexelaCameraPrivate *priv, guint binning)
return FALSE;
}
-UcaDexelaCamera *uca_dexela_camera_new(GError **error)
-{
- UcaDexelaCamera *camera = g_object_new(UCA_TYPE_DEXELA_CAMERA, NULL);
- UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(camera);
- fill_binnings(priv);
- /*
- * Here we override property ranges because we didn't know them at property
- * installation time.
- */
- GObjectClass *camera_class = G_OBJECT_CLASS (UCA_CAMERA_GET_CLASS (camera));
- // TODO implement error checking
- dexela_open_detector(DEFAULT_FMT_FILE_PATH);
- dexela_init_serial_connection();
- priv->bits = dexela_get_bit_depth();
- priv->width = dexela_get_width();
- priv->height = dexela_get_height();
- priv->num_bytes = 2;
- return camera;
-}
-
static void uca_dexela_camera_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(object);
@@ -334,17 +319,13 @@ static void uca_dexela_camera_stop_recording(UcaCamera *camera, GError **error)
dexela_stop_acquisition();
}
-static void uca_dexela_camera_grab(UcaCamera *camera, gpointer *data, GError **error)
+static gboolean uca_dexela_camera_grab(UcaCamera *camera, gpointer data, GError **error)
{
g_debug("grab called");
g_return_if_fail(UCA_IS_DEXELA_CAMERA(camera));
UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(camera);
- if (*data == NULL) {
- g_debug("Allocating buffer");
- *data = g_malloc0(priv->width * priv->height * priv->num_bytes);
- }
- // TODO: copy to the data buffer
- memcpy((gchar *) *data, dexela_grab(), priv->width * priv->height * priv->num_bytes);
+ memcpy((gchar *) data, dexela_grab(), priv->width * priv->height * priv->num_bytes);
+ return TRUE;
}
static void uca_dexela_camera_finalize(GObject *object)
@@ -355,6 +336,23 @@ static void uca_dexela_camera_finalize(GObject *object)
G_OBJECT_CLASS(uca_dexela_camera_parent_class)->finalize(object);
}
+static gboolean uca_dexela_camera_initable_init(GInitable *initable, GCancellable *cancellable, GError **error)
+{
+ g_return_val_if_fail (UCA_IS_DEXELA_CAMERA (initable), FALSE);
+
+ if (cancellable != NULL) {
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ "Cancellable initialization not supported");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void uca_dexela_camera_initable_iface_init(GInitableIface *iface)
+{
+ iface->init = uca_dexela_camera_initable_init;
+}
+
static void uca_dexela_camera_class_init(UcaDexelaCameraClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
@@ -388,7 +386,22 @@ static void uca_dexela_camera_class_init(UcaDexelaCameraClass *klass)
static void uca_dexela_camera_init(UcaDexelaCamera *self)
{
- self->priv = UCA_DEXELA_CAMERA_GET_PRIVATE(self);
+ UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(self);
+ self->priv = priv;
+ fill_binnings(priv);
+ // TODO implement error checking
+ dexela_open_detector(DEFAULT_FMT_FILE_PATH);
+ dexela_init_serial_connection();
+ priv->bits = dexela_get_bit_depth();
+ priv->width = dexela_get_width();
+ priv->height = dexela_get_height();
+ priv->num_bytes = 2;
+}
+
+G_MODULE_EXPORT GType
+uca_camera_get_type (void)
+{
+ return UCA_TYPE_DEXELA_CAMERA;
}
G_MODULE_EXPORT UcaCamera *
diff --git a/plugins/dexela/uca-dexela-camera.h b/plugins/dexela/uca-dexela-camera.h
index 9badf10..32d231e 100644
--- a/plugins/dexela/uca-dexela-camera.h
+++ b/plugins/dexela/uca-dexela-camera.h
@@ -21,6 +21,8 @@
#include <glib-object.h>
#include "uca-camera.h"
+G_BEGIN_DECLS
+
#define UCA_TYPE_DEXELA_CAMERA (uca_dexela_camera_get_type())
#define UCA_DEXELA_CAMERA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), UCA_TYPE_DEXELA_CAMERA, UcaDexelaCamera))
#define UCA_IS_DEXELA_CAMERA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), UCA_TYPE_DEXELA_CAMERA))
@@ -61,8 +63,8 @@ struct _UcaDexelaCameraClass {
UcaCameraClass parent;
};
-UcaDexelaCamera *uca_dexela_camera_new(GError **error);
-
GType uca_dexela_camera_get_type(void);
+G_END_DECLS
+
#endif