summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2014-04-09 15:19:48 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2014-04-09 15:19:48 +0200
commitbb8d8f137197857e0e497d5c0b446c1b5f1b7a3e (patch)
treee02cd3ec095f606f85eb0fff71ab5b1eed19f50e
parent6ea92130f1c791007b417e41b39e21f07d644a3c (diff)
parent10c2e35112d43c06fc715014b33094761f01c992 (diff)
downloaduca-bb8d8f137197857e0e497d5c0b446c1b5f1b7a3e.tar.gz
uca-bb8d8f137197857e0e497d5c0b446c1b5f1b7a3e.tar.bz2
uca-bb8d8f137197857e0e497d5c0b446c1b5f1b7a3e.tar.xz
uca-bb8d8f137197857e0e497d5c0b446c1b5f1b7a3e.zip
Merge pull request #35 from miq/anka_plugin_updates
Anka plugin updates
-rw-r--r--cmake/FindDEXELA.cmake2
-rw-r--r--cmake/FindPylon.cmake8
-rw-r--r--plugins/dexela/CMakeLists.txt6
-rw-r--r--plugins/dexela/changelog.txt3
-rw-r--r--plugins/dexela/uca-dexela-camera.c4
-rw-r--r--plugins/pylon/CMakeLists.txt12
-rw-r--r--plugins/pylon/changelog.txt7
-rw-r--r--plugins/pylon/uca-pylon-camera.c125
-rw-r--r--plugins/pylon/uca-pylon-camera.h2
9 files changed, 95 insertions, 74 deletions
diff --git a/cmake/FindDEXELA.cmake b/cmake/FindDEXELA.cmake
index 1fef7af..a68bf6c 100644
--- a/cmake/FindDEXELA.cmake
+++ b/cmake/FindDEXELA.cmake
@@ -8,7 +8,7 @@
find_package(PackageHandleStandardArgs)
-find_path(DEXELA_INCLUDE_DIRS dexela_api.h PATHS /usr/include)
+find_path(DEXELA_INCLUDE_DIRS dexela_api.h PATHS /usr/include /usr/include/dexela)
find_library(DEXELA_LIBRARIES dexela)
find_package_handle_standard_args(DEXELA DEFAULT_MSG DEXELA_LIBRARIES DEXELA_INCLUDE_DIRS)
diff --git a/cmake/FindPylon.cmake b/cmake/FindPylon.cmake
index d3f8879..e096bb4 100644
--- a/cmake/FindPylon.cmake
+++ b/cmake/FindPylon.cmake
@@ -1,11 +1,11 @@
-# Try to find libpco.so
+# Try to find libpylon.so
#
# Defines
#
-# PYLON_FOUND - system has libpco
-# PYLON_INCLUDE_DIR - libpco include directory
-# PYLON_LIB - pco library
+# PYLON_FOUND - system has libpylon
+# PYLON_INCLUDE_DIR - libpylon include directory
+# PYLON_LIB - pylon library
# check for environment variable PYLON_ROOT
find_package(YAT)
diff --git a/plugins/dexela/CMakeLists.txt b/plugins/dexela/CMakeLists.txt
index 1dbae27..101f11e 100644
--- a/plugins/dexela/CMakeLists.txt
+++ b/plugins/dexela/CMakeLists.txt
@@ -1,17 +1,17 @@
cmake_minimum_required(VERSION 2.6)
project(ucadexela C)
-set(VERSION "1.0.2")
+set(VERSION "1.0.3")
find_package(DEXELA)
if (DEXELA_FOUND)
set(UCA_CAMERA_NAME "dexela")
- set(PLUGIN_REVISION "2")
+ set(PLUGIN_REVISION "1")
set(PLUGIN_VERSION ${VERSION})
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.0.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 027b3ea..7ee4c54 100644
--- a/plugins/dexela/changelog.txt
+++ b/plugins/dexela/changelog.txt
@@ -1,3 +1,6 @@
+* 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
* Tue Oct 15 2013 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.0.2-2
- bump libuca requirement to 1.3.0
* Wed Mar 27 2013 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.0.2-1
diff --git a/plugins/dexela/uca-dexela-camera.c b/plugins/dexela/uca-dexela-camera.c
index 0003f22..aa0a049 100644
--- a/plugins/dexela/uca-dexela-camera.c
+++ b/plugins/dexela/uca-dexela-camera.c
@@ -18,7 +18,7 @@
#include <string.h>
#include <gmodule.h>
#include "uca-dexela-camera.h"
-#include "dexela_api.h"
+#include "dexela/dexela_api.h"
#define UCA_DEXELA_CAMERA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UCA_TYPE_DEXELA_CAMERA, UcaDexelaCameraPrivate))
@@ -147,7 +147,7 @@ UcaDexelaCamera *uca_dexela_camera_new(GError **error)
*/
GObjectClass *camera_class = G_OBJECT_CLASS (UCA_CAMERA_GET_CLASS (camera));
// TODO implement error checking
- dexela_open_detector("/usr/share/dexela/dexela-1207_32.fmt");
+ dexela_open_detector(DEFAULT_FMT_FILE_PATH);
dexela_init_serial_connection();
priv->bits = dexela_get_bit_depth();
priv->width = dexela_get_width();
diff --git a/plugins/pylon/CMakeLists.txt b/plugins/pylon/CMakeLists.txt
index 7e573f1..5864b84 100644
--- a/plugins/pylon/CMakeLists.txt
+++ b/plugins/pylon/CMakeLists.txt
@@ -1,17 +1,17 @@
cmake_minimum_required(VERSION 2.6)
project(ucapylon C)
-set(VERSION "1.0.0")
+set(VERSION "1.1.1")
find_package(Pylon)
if (PYLON_FOUND)
set(UCA_CAMERA_NAME "pylon")
+ set(PLUGIN_REVISION "1")
set(PLUGIN_VERSION ${VERSION})
- set(PLUGIN_REVISION "2")
set(PLUGIN_SUMMARY "Pylon plugin for libuca")
set(PLUGIN_CHANGELOG "${CMAKE_CURRENT_SOURCE_DIR}/changelog.txt")
set(PLUGIN_DESCRIPTION "Plugin for the Basler GigE CCD Camera.")
- set(PLUGIN_REQUIRES "libuca >= 1.3.0, libpyloncam >= 0.2.3")
+ set(PLUGIN_REQUIRES "libuca >= 1.3.0, libpyloncam >= 0.3.0")
set(PLUGIN_VENDOR "ANKA Computing Group")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../package-plugin.sh.in
@@ -25,10 +25,10 @@ if (PYLON_FOUND)
create_enums(uca-pylon-enums
${CMAKE_CURRENT_SOURCE_DIR}/../../src/uca-enums
uca-pylon-camera.h)
-
+
add_library(ucapylon SHARED
- uca-pylon-enums.c
- uca-pylon-camera.c)
+ uca-pylon-camera.c
+ uca-pylon-enums.c)
target_link_libraries(ucapylon
${UCA_DEPS}
diff --git a/plugins/pylon/changelog.txt b/plugins/pylon/changelog.txt
index 78c6406..adfa95b 100644
--- a/plugins/pylon/changelog.txt
+++ b/plugins/pylon/changelog.txt
@@ -1,4 +1,9 @@
-* Tue Oct 15 2013 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.0.0-2
+* Wed Apr 9 2014 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.1.1-1
+- remove unneeded memory allocation
+- require libpyloncam 0.3.0
+* Wed Apr 9 2014 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.1.0-1
+- make compatible with current libuca
+* Tue Oct 15 2013 Mihael Koep <mihael.koep@softwareschneiderei.de> 1.0.2-2
- updated to libuca 1.3.0
* Tue Apr 23 2013 Vasili Kvockin <vasili.kvockin@softwareschneiderei.de> 1.0.0-1
- repackaged as part of libuca 1.*
diff --git a/plugins/pylon/uca-pylon-camera.c b/plugins/pylon/uca-pylon-camera.c
index 97c7d35..02d6795 100644
--- a/plugins/pylon/uca-pylon-camera.c
+++ b/plugins/pylon/uca-pylon-camera.c
@@ -20,12 +20,17 @@
#include <string.h>
#include <libpyloncam/pylon_camera.h>
#include <gmodule.h>
+#include <gio/gio.h>
#include "uca-pylon-camera.h"
#include "uca-pylon-enums.h"
#define UCA_PYLON_CAMERA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UCA_TYPE_PYLON_CAMERA, UcaPylonCameraPrivate))
-G_DEFINE_TYPE(UcaPylonCamera, uca_pylon_camera, UCA_TYPE_CAMERA)
+static void uca_pylon_camera_initable_iface_init (GInitableIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (UcaPylonCamera, uca_pylon_camera, UCA_TYPE_CAMERA,
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+ uca_pylon_camera_initable_iface_init))
#define PROP_GAIN_MIN 300
#define PROP_GAIN_MAX 400
@@ -50,7 +55,7 @@ enum {
PROP_ROI_HEIGHT_DEFAULT,
PROP_GAIN,
PROP_BALANCE_WHITE_AUTO,
- N_PROPERTIES
+ N_PROPERTIES
};
static gint base_overrideables[] = {
@@ -103,29 +108,6 @@ static void pylon_set_roi(GObject *object, GError** error)
pylon_camera_set_roi(priv->roi_x, priv->roi_y, priv->roi_width, priv->roi_height, error);
}
-UcaPylonCamera *uca_pylon_camera_new(GError **error)
-{
- UcaPylonCamera *camera = g_object_new(UCA_TYPE_PYLON_CAMERA, NULL);
- UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(camera);
-
- gchar* pylon_camera_ip = getenv("PYLON_CAMERA_IP");
- if(!pylon_camera_ip) {
- g_error("no environment variable PYLON_CAMERA_IP found");
- }
-
- pylon_camera_new("/usr/local/lib64", pylon_camera_ip, error);
-
- if (*error != NULL)
- return NULL;
-
- pylon_camera_get_sensor_size(&priv->width, &priv->height, error);
-
- if (*error != NULL)
- return NULL;
-
- return camera;
-}
-
static void uca_pylon_camera_start_recording(UcaCamera *camera, GError **error)
{
g_return_if_fail(UCA_IS_PYLON_CAMERA(camera));
@@ -133,7 +115,6 @@ static void uca_pylon_camera_start_recording(UcaCamera *camera, GError **error)
priv->num_bytes = 2;
pylon_camera_start_acquision(error);
-
}
static void uca_pylon_camera_stop_recording(UcaCamera *camera, GError **error)
@@ -142,15 +123,12 @@ static void uca_pylon_camera_stop_recording(UcaCamera *camera, GError **error)
pylon_camera_stop_acquision(error);
}
-static void uca_pylon_camera_grab(UcaCamera *camera, gpointer *data, GError **error)
+static gboolean uca_pylon_camera_grab(UcaCamera *camera, gpointer data, GError **error)
{
- g_return_if_fail(UCA_IS_PYLON_CAMERA(camera));
- UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(camera);
+ g_return_val_if_fail(UCA_IS_PYLON_CAMERA(camera), FALSE);
- if (*data == NULL) {
- *data = g_malloc0(priv->roi_width * priv->roi_height * priv->num_bytes);
- }
pylon_camera_grab(data, error);
+ return TRUE;
}
static void uca_pylon_camera_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
@@ -166,9 +144,9 @@ static void uca_pylon_camera_set_property(GObject *object, guint property_id, co
case PROP_TRIGGER_MODE:
break;
case PROP_BALANCE_WHITE_AUTO:
- {
- pylon_camera_set_int_attribute("BalanceWhiteAuto", g_value_get_enum(value), &error);
- }
+ {
+ pylon_camera_set_int_attribute("BalanceWhiteAuto", g_value_get_enum(value), &error);
+ }
break;
case PROP_ROI_X:
@@ -211,12 +189,12 @@ static void uca_pylon_camera_set_property(GObject *object, guint property_id, co
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
return;
}
-
+
if (error) {
if(error->message) {
- g_warning("failed to set property %d: %s", property_id, error->message);
+ g_warning("failed to set property %d: %s", property_id, error->message);
} else {
- g_warning("failed to set property %d", property_id);
+ g_warning("failed to set property %d", property_id);
}
}
}
@@ -228,13 +206,13 @@ static void uca_pylon_camera_get_property(GObject *object, guint property_id, GV
switch (property_id) {
case PROP_BALANCE_WHITE_AUTO:
- {
- gint enum_value = UCA_CAMERA_BALANCE_WHITE_OFF;
- pylon_camera_get_int_attribute("BalanceWhiteAuto", &enum_value, &error);
- UcaCameraBalanceWhiteAuto mode = enum_value;
- g_value_set_enum(value, mode);
- break;
- }
+ {
+ gint enum_value = UCA_CAMERA_BALANCE_WHITE_OFF;
+ pylon_camera_get_int_attribute("BalanceWhiteAuto", &enum_value, &error);
+ UcaCameraBalanceWhiteAuto mode = enum_value;
+ g_value_set_enum(value, mode);
+ break;
+ }
case PROP_SENSOR_WIDTH:
pylon_camera_get_sensor_size(&priv->width, &priv->height, &error);
g_value_set_uint(value, priv->width);
@@ -345,11 +323,11 @@ static void uca_pylon_camera_get_property(GObject *object, guint property_id, GV
break;
case PROP_NAME:
- {
- const gchar* name = NULL;
- pylon_camera_get_string_attribute("ModelName", &name, &error);
- g_value_set_string(value, name);
- }
+ {
+ const gchar* name = NULL;
+ pylon_camera_get_string_attribute("ModelName", &name, &error);
+ g_value_set_string(value, name);
+ }
break;
default:
@@ -358,9 +336,9 @@ static void uca_pylon_camera_get_property(GObject *object, guint property_id, GV
}
if (error) {
if(error->message) {
- g_warning("failed to get property %d: %s", property_id, error->message);
+ g_warning("failed to get property %d: %s", property_id, error->message);
} else {
- g_warning("failed to get property %d", property_id);
+ g_warning("failed to get property %d", property_id);
}
}
//g_debug("pylon_get_property end\n");
@@ -374,6 +352,42 @@ static void uca_pylon_camera_finalize(GObject *object)
G_OBJECT_CLASS(uca_pylon_camera_parent_class)->finalize(object);
}
+static gboolean uca_pylon_camera_initable_init(GInitable *initable, GCancellable *cancellable, GError **error)
+{
+ g_return_val_if_fail (UCA_IS_PYLON_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;
+ }
+
+ UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(initable);
+
+ gchar* pylon_camera_ip = getenv("PYLON_CAMERA_IP");
+ if(!pylon_camera_ip) {
+ g_error("no environment variable PYLON_CAMERA_IP found");
+ }
+
+ pylon_camera_new("/usr/local/lib64", pylon_camera_ip, error);
+ if (*error != NULL) {
+ return FALSE;
+ }
+
+ pylon_camera_get_sensor_size(&priv->width, &priv->height, error);
+ if (*error != NULL) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void uca_pylon_camera_initable_iface_init(GInitableIface *iface)
+{
+ iface->init = uca_pylon_camera_initable_init;
+}
+
+
static void uca_pylon_camera_class_init(UcaPylonCameraClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
@@ -430,6 +444,7 @@ static void uca_pylon_camera_class_init(UcaPylonCameraClass *klass)
static void uca_pylon_camera_init(UcaPylonCamera *self)
{
+
self->priv = UCA_PYLON_CAMERA_GET_PRIVATE(self);
/* binnings */
@@ -440,8 +455,8 @@ static void uca_pylon_camera_init(UcaPylonCamera *self)
g_value_array_append(self->priv->binnings, &val);
}
-G_MODULE_EXPORT UcaCamera *
-uca_camera_impl_new (GError **error)
+G_MODULE_EXPORT GType
+uca_camera_get_type (void)
{
- return UCA_CAMERA(uca_pylon_camera_new(error));
+ return UCA_TYPE_PYLON_CAMERA;
}
diff --git a/plugins/pylon/uca-pylon-camera.h b/plugins/pylon/uca-pylon-camera.h
index ed95544..f3d7bb5 100644
--- a/plugins/pylon/uca-pylon-camera.h
+++ b/plugins/pylon/uca-pylon-camera.h
@@ -71,8 +71,6 @@ struct _UcaPylonCameraClass {
UcaCameraClass parent;
};
-UcaPylonCamera *uca_pylon_camera_new(GError **error);
-
GType uca_pylon_camera_get_type(void);
G_END_DECLS