From 89ced9478f200facde423423df8c1718752f8a6c Mon Sep 17 00:00:00 2001 From: Mihael Koep Date: Thu, 6 Aug 2015 12:44:54 +0200 Subject: Remove ANKA plugins and change versioning scheme for bundled plugins ANKA plugins are developed and distributed separately like other plugins depending on vendor SDKs. The bundled plugins use libuca version as their version and depend on it directly. This ensures that they always match the libuca version and makes versioning more transparent for the end users. Conflicts: plugins/mock/CMakeLists.txt --- plugins/CMakeLists.txt | 4 +- plugins/dexela/CMakeLists.txt | 30 -- plugins/dexela/changelog.txt | 26 -- plugins/dexela/software-roi.c | 12 - plugins/dexela/software-roi.h | 18 -- plugins/dexela/uca-dexela-camera.c | 543 ------------------------------------- plugins/dexela/uca-dexela-camera.h | 70 ----- plugins/file/CMakeLists.txt | 6 +- plugins/mock/CMakeLists.txt | 6 +- plugins/package-plugin.sh.in | 2 +- plugins/pylon/CMakeLists.txt | 38 --- plugins/pylon/changelog.txt | 20 -- plugins/pylon/uca-pylon-camera.c | 483 --------------------------------- plugins/pylon/uca-pylon-camera.h | 84 ------ 14 files changed, 8 insertions(+), 1334 deletions(-) delete mode 100644 plugins/dexela/CMakeLists.txt delete mode 100644 plugins/dexela/changelog.txt delete mode 100644 plugins/dexela/software-roi.c delete mode 100644 plugins/dexela/software-roi.h delete mode 100644 plugins/dexela/uca-dexela-camera.c delete mode 100644 plugins/dexela/uca-dexela-camera.h delete mode 100644 plugins/pylon/CMakeLists.txt delete mode 100644 plugins/pylon/changelog.txt delete mode 100644 plugins/pylon/uca-pylon-camera.c delete mode 100644 plugins/pylon/uca-pylon-camera.h (limited to 'plugins') diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 65b0cb0..7029cf7 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -2,11 +2,9 @@ set(UCA_CONFIGDIR "${CMAKE_CURRENT_BINARY_DIR}/../src") add_subdirectory(mock) add_subdirectory(file) -add_subdirectory(pylon) -add_subdirectory(dexela) message("-- Building the following plugins:") -set(_plugins "mock;file;;pylon;dexela") +set(_plugins "mock;file") foreach(_target ${_plugins}) if (TARGET "uca${_target}") diff --git a/plugins/dexela/CMakeLists.txt b/plugins/dexela/CMakeLists.txt deleted file mode 100644 index d04c2e6..0000000 --- a/plugins/dexela/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(ucadexela C) -set(VERSION "1.4.0") - -find_package(DEXELA) - -if (DEXELA_FOUND) - set(UCA_CAMERA_NAME "dexela") - 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 >= 2.0.0, libdexela >= 1.2.0") - set(PLUGIN_VENDOR "ANKA Computing Group") - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../package-plugin.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/../../package-plugin-${UCA_CAMERA_NAME}.sh) - - include_directories(${DEXELA_INCLUDE_DIRS} - ${UCA_CONFIGDIR}) - - add_library(ucadexela SHARED uca-dexela-camera.c software-roi.c) - - target_link_libraries(ucadexela ${UCA_DEPS} ${DEXELA_LIBRARIES}) - - install(TARGETS ucadexela - LIBRARY DESTINATION ${UCA_PLUGINDIR} - COMPONENT ${UCA_CAMERA_NAME}) -endif() diff --git a/plugins/dexela/changelog.txt b/plugins/dexela/changelog.txt deleted file mode 100644 index 7b2d81b..0000000 --- a/plugins/dexela/changelog.txt +++ /dev/null @@ -1,26 +0,0 @@ -* Mon May 18 2015 Mihael Koep 1.4.0-1 -- Update to libuca 2.0.0 -- Report errors opening the detector instead of crashing -* Tue Mar 17 2015 Mihael Koep 1.3.3-1 -- adjust the ROI depending on the binning -* Wed Oct 8 2014 Mihael Koep 1.3.2-2 -- new revision for libuca 1.6.0 -* Tue Sep 16 2014 Mihael Koep 1.3.2-1 -- implement sensor pixel width and height properties -* Tue Sep 16 2014 Mihael Koep 1.3.1-1 -- fix software roi for multi-byte images -* Tue Sep 9 2014 Mihael Koep 1.3.0-1 -- add software roi feature -* Tue Jul 29 2014 Mihael Koep 1.2.0-1 -- bump plugin version for package management systems -* Wed Mar 19 2014 Mihael Koep 1.0.3-1 -- bump libdexela requirement to 1.1.0 -- use new libdexela API for FMT file -* Tue Oct 15 2013 Mihael Koep 1.0.2-2 -- bump libuca requirement to 1.3.0 -* Wed Mar 27 2013 Mihael Koep 1.0.2-1 -- return current width and height as rois -* Thu Mar 14 2013 Mihael Koep 1.0.0-3 -- improve package metadata and build scripts -* Thu Mar 7 2013 Mihael Koep 1.0.0-2 -- add changelog and improve package metadata diff --git a/plugins/dexela/software-roi.c b/plugins/dexela/software-roi.c deleted file mode 100644 index 6056dec..0000000 --- a/plugins/dexela/software-roi.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "software-roi.h" -#include - -void apply_software_roi(const guchar* src, guint srcWidth, guint bytesPerPixel, guchar* dest, guint x, guint y, guint roiWidth, guint roiHeight) -{ - for (guint row = 0; row < roiHeight; row++) { - guint roiWidthInBytes = roiWidth * bytesPerPixel; - guint rowOffset = srcWidth * bytesPerPixel * (y + row); - guint offset = rowOffset + x * bytesPerPixel; - memcpy(dest + row * roiWidthInBytes, src + offset, roiWidthInBytes); - } -} diff --git a/plugins/dexela/software-roi.h b/plugins/dexela/software-roi.h deleted file mode 100644 index 3fb3b69..0000000 --- a/plugins/dexela/software-roi.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef SOFTWAREROI_H -#define SOFTWAREROI_H -#include - -/** - * @brief apply_software_roi Extracts the pixels defined by x, y, roiWidth, roiHeight from - * the src array and writes them into the dest buffer - * @param src - * @param srcWidth - * @param dest - * @param x - * @param y - * @param roiWidth - * @param roiHeight - */ -void apply_software_roi(const guchar* src, guint srcWidth, guint bytesPerPixel, guchar* dest, guint x, guint y, guint roiWidth, guint roiHeight); - -#endif // SOFTWAREROI_H diff --git a/plugins/dexela/uca-dexela-camera.c b/plugins/dexela/uca-dexela-camera.c deleted file mode 100644 index 3e22c06..0000000 --- a/plugins/dexela/uca-dexela-camera.c +++ /dev/null @@ -1,543 +0,0 @@ -/* Copyright (C) 2011, 2012 Mihael Koep - (Softwareschneiderei GmbH) - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2.1 of the License, or (at your - option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., 51 - Franklin St, Fifth Floor, Boston, MA 02110, USA */ - -#include -#include -#include -#include -#include "uca-dexela-camera.h" -#include "dexela/dexela_api.h" -#include "software-roi.h" - -#define UCA_DEXELA_CAMERA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UCA_TYPE_DEXELA_CAMERA, UcaDexelaCameraPrivate)) - -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 - */ -GQuark uca_dexela_camera_error_quark() -{ - return g_quark_from_static_string("uca-dexela-camera-error-quark"); -} - -enum { - PROP_GAIN_MODE = N_BASE_PROPERTIES, - PROP_TEST_MODE, - N_PROPERTIES -}; - -static gint base_overrideables[] = { - PROP_NAME, - PROP_SENSOR_WIDTH, - PROP_SENSOR_HEIGHT, - PROP_SENSOR_PIXEL_WIDTH, - PROP_SENSOR_PIXEL_HEIGHT, - PROP_SENSOR_BITDEPTH, - PROP_SENSOR_HORIZONTAL_BINNING, - PROP_SENSOR_HORIZONTAL_BINNINGS, - PROP_SENSOR_VERTICAL_BINNING, - PROP_SENSOR_VERTICAL_BINNINGS, - PROP_EXPOSURE_TIME, - PROP_TRIGGER_SOURCE, - PROP_ROI_X, - PROP_ROI_Y, - PROP_ROI_WIDTH, - PROP_ROI_HEIGHT, - PROP_ROI_WIDTH_MULTIPLIER, - PROP_ROI_HEIGHT_MULTIPLIER, - PROP_HAS_STREAMING, - PROP_HAS_CAMRAM_RECORDING, - 0 -}; - -static GParamSpec *dexela_properties[N_PROPERTIES] = { NULL, }; - -static const gdouble MICROS_TO_SECONDS_FACTOR = 1e6d; -static const gdouble MINIMUM_EXPOSURE_TIME_IN_SECONDS = 0.017d; // 17ms as per documentation -static const gdouble PIXEL_SIZE = 74.8e-6; // 74.8µm as per data sheet - -struct _UcaDexelaCameraPrivate { - GError* init_error; - - GValueArray *binnings; - guint width; - guint height; - guint roi_x; - guint roi_y; - guint roi_width; - guint roi_height; - guint bits; - gsize num_bytes; - UcaCameraTriggerSource uca_trigger_source; - UcaCameraTriggerType uca_trigger_type; -}; - -/** - * Hardcode possible binnings for now - */ -static void fill_binnings(UcaDexelaCameraPrivate *priv) -{ - GValue val = {0}; - g_value_init(&val, G_TYPE_UINT); - - priv->binnings = g_value_array_new(3); - g_value_set_uint(&val, 1); - g_value_array_append(priv->binnings, &val); - g_value_set_uint(&val, 2); - g_value_array_append(priv->binnings, &val); - g_value_set_uint(&val, 4); - g_value_array_append(priv->binnings, &val); -} - -static void map_dexela_trigger_mode_to_uca_source(UcaDexelaCameraPrivate *priv, GValue* value, TriggerMode mode) -{ - if (mode == SOFTWARE) { - priv->uca_trigger_source = UCA_CAMERA_TRIGGER_SOURCE_AUTO; - } - if (mode == EDGE || mode == DURATION) { - priv->uca_trigger_source = UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL; - } - g_value_set_enum(value, priv->uca_trigger_source); -} - -static void map_dexela_trigger_mode_to_uca_type(UcaDexelaCameraPrivate *priv, GValue* value, TriggerMode mode) -{ - if (mode == EDGE) { - priv->uca_trigger_type = UCA_CAMERA_TRIGGER_TYPE_EDGE; - } - if (mode == DURATION) { - priv->uca_trigger_type = UCA_CAMERA_TRIGGER_TYPE_LEVEL; - } - g_value_set_enum(value, priv->uca_trigger_type); -} - -static void set_triggering(UcaDexelaCameraPrivate *priv, UcaCameraTriggerSource source, UcaCameraTriggerType type) -{ - priv->uca_trigger_source = source; - priv->uca_trigger_type = type; - if (source == UCA_CAMERA_TRIGGER_SOURCE_AUTO) { - dexela_set_trigger_mode(SOFTWARE); - return; - } - if (source == UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE) { - dexela_set_trigger_mode(SOFTWARE); - return; - } - if (source == UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL) { - if (type == UCA_CAMERA_TRIGGER_TYPE_EDGE) { - dexela_set_trigger_mode(EDGE); - return; - } - if (type == UCA_CAMERA_TRIGGER_TYPE_LEVEL) { - dexela_set_trigger_mode(DURATION); - return; - } - } - g_warning("Unsupported uca trigger source and type: %d/%d", source, type); -} - -static gboolean is_binning_allowed(UcaDexelaCameraPrivate *priv, guint binning) -{ - for (int i = 0; i < priv->binnings->n_values; i++) { - guint allowedBinning = g_value_get_uint(g_value_array_get_nth(priv->binnings, i)); - if (binning == allowedBinning) { - return TRUE; - } - } - return FALSE; -} - -static guint real_width(UcaDexelaCameraPrivate *priv) -{ - return priv->width / dexela_get_binning_mode_horizontal(); -} - -static guint real_height(UcaDexelaCameraPrivate *priv) -{ - return priv->height / dexela_get_binning_mode_vertical(); -} - -static void adjust_roi_width(UcaDexelaCameraPrivate *priv, guint requested_width) -{ - guint maxRoiWidth = real_width(priv) - priv->roi_x; - priv->roi_width = min(maxRoiWidth, requested_width); -} - -static void adjust_roi_height(UcaDexelaCameraPrivate *priv, guint requested_height) -{ - guint maxRoiHeight = real_height(priv) - priv->roi_y; - priv->roi_height = min(maxRoiHeight, requested_height); -} - -static void uca_dexela_camera_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec) -{ - UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(object); - - switch (property_id) { - case PROP_NAME: - { - gchar* model = dexela_get_model(); - g_value_set_string(value, g_strdup_printf("Dexela %s", model)); - g_free(model); - break; - } - case PROP_EXPOSURE_TIME: - { - g_value_set_double(value, dexela_get_exposure_time_micros() / MICROS_TO_SECONDS_FACTOR); - break; - } - case PROP_HAS_CAMRAM_RECORDING: - { - g_value_set_boolean(value, FALSE); - break; - } - case PROP_HAS_STREAMING: - { - g_value_set_boolean(value, FALSE); - break; - } - case PROP_SENSOR_BITDEPTH: - { - g_value_set_uint(value, priv->bits); - break; - } - case PROP_SENSOR_WIDTH: - { - g_value_set_uint(value, priv->width); - break; - } - case PROP_SENSOR_HEIGHT: - { - g_value_set_uint(value, priv->height); - break; - } - case PROP_SENSOR_PIXEL_WIDTH: - { - g_value_set_double(value, PIXEL_SIZE); - break; - } - case PROP_SENSOR_PIXEL_HEIGHT: - { - g_value_set_double(value, PIXEL_SIZE); - break; - } - case PROP_ROI_X: - { - g_value_set_uint(value, priv->roi_x); - break; - } - case PROP_ROI_Y: - { - g_value_set_uint(value, priv->roi_y); - break; - } - case PROP_ROI_WIDTH: - { - g_value_set_uint(value, priv->roi_width); - break; - } - case PROP_ROI_HEIGHT: - { - g_value_set_uint(value, priv->roi_height); - break; - } - case PROP_SENSOR_HORIZONTAL_BINNING: - { - g_value_set_uint(value, dexela_get_binning_mode_horizontal()); - break; - } - case PROP_SENSOR_HORIZONTAL_BINNINGS: - { - g_value_set_boxed(value, priv->binnings); - break; - } - case PROP_SENSOR_VERTICAL_BINNING: - { - g_value_set_uint(value, dexela_get_binning_mode_vertical()); - break; - } - case PROP_SENSOR_VERTICAL_BINNINGS: - { - g_value_set_boxed(value, priv->binnings); - break; - } - case PROP_GAIN_MODE: - { - g_value_set_uint(value, dexela_get_gain()); - break; - } - case PROP_TEST_MODE: - { - g_value_set_boolean(value, dexela_get_control_register() & 1); - break; - } - case PROP_TRIGGER_SOURCE: - { - map_dexela_trigger_mode_to_uca_source(priv, value, dexela_get_trigger_mode()); - break; - } - case PROP_TRIGGER_TYPE: - { - map_dexela_trigger_mode_to_uca_type(priv, value, dexela_get_trigger_mode()); - break; - } - default: - { - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); - break; - } - } -} - -static void uca_dexela_camera_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) -{ - g_return_if_fail (UCA_IS_DEXELA_CAMERA (object)); - UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE (object); - - if (uca_camera_is_recording (UCA_CAMERA (object)) && !uca_camera_is_writable_during_acquisition (UCA_CAMERA (object), pspec->name)) { - g_warning ("Property '%s' cant be changed during acquisition", pspec->name); - return; - } - - switch (property_id) { - case PROP_EXPOSURE_TIME: - { - const gdouble exposureTimeInSeconds = fmax(MINIMUM_EXPOSURE_TIME_IN_SECONDS, g_value_get_double(value)); - dexela_set_exposure_time_micros((gint) (exposureTimeInSeconds * MICROS_TO_SECONDS_FACTOR)); - break; - } - case PROP_ROI_X: - { - guint maxRoiX = real_width(priv) - 1; - guint requestedRoiX = g_value_get_uint(value); - priv->roi_x = min(maxRoiX, requestedRoiX); - adjust_roi_width(priv, priv->roi_width); - break; - } - case PROP_ROI_Y: - { - guint maxRoiY = real_height(priv) -1; - guint requestedRoiY = g_value_get_uint(value); - priv->roi_y = min(maxRoiY, requestedRoiY); - adjust_roi_height(priv, priv->roi_height); - break; - } - case PROP_ROI_WIDTH: - { - adjust_roi_width(priv, g_value_get_uint(value)); - break; - } - case PROP_ROI_HEIGHT: - { - adjust_roi_height(priv, g_value_get_uint(value)); - break; - } - case PROP_SENSOR_HORIZONTAL_BINNING: - { - const guint horizontalBinning = g_value_get_uint(value); - if (!is_binning_allowed(priv, horizontalBinning)) { - g_warning("Tried to set illegal horizontal binning: %d", horizontalBinning); - return; - } - dexela_set_binning_mode(horizontalBinning, horizontalBinning); - adjust_roi_width(priv, priv->roi_width); - break; - } - case PROP_SENSOR_VERTICAL_BINNING: - { - const guint verticalBinning = g_value_get_uint(value); - if (!is_binning_allowed(priv, verticalBinning)) { - g_warning("Tried to set illegal vertical binning: %d", verticalBinning); - return; - } - dexela_set_binning_mode(verticalBinning, verticalBinning); - adjust_roi_height(priv, priv->roi_height); - break; - } - case PROP_GAIN_MODE: - { - const guint gain = g_value_get_uint(value); - if (gain == 0) { - dexela_set_gain(LOW); - return; - } - if (gain == 1) { - dexela_set_gain(HIGH); - return; - } - g_warning("Illegal attempt to set gain: %d", gain); - break; - } - case PROP_TEST_MODE: - { - if (g_value_get_boolean(value)) { - dexela_set_control_register(dexela_get_control_register() | 1); - return; - } - dexela_set_control_register(dexela_get_control_register() & 0xFFFE); - break; - } - case PROP_TRIGGER_SOURCE: - { - set_triggering(priv, g_value_get_enum(value), priv->uca_trigger_type); - break; - } - case PROP_TRIGGER_TYPE: - { - set_triggering(priv, priv->uca_trigger_source, g_value_get_enum(value)); - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); - return; - } -} - -static void uca_dexela_camera_start_recording(UcaCamera *camera, GError **error) -{ - g_debug("start recording called"); - dexela_start_acquisition(); -} - -static void uca_dexela_camera_stop_recording(UcaCamera *camera, GError **error) -{ - g_debug("stop recording called"); - dexela_stop_acquisition(); -} - -static gboolean uca_dexela_camera_grab(UcaCamera *camera, gpointer data, GError **error) -{ - 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_source == UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE) { - // TODO: wait for a signal from uca_camera_trigger() - } - guchar* fullFrame = dexela_grab(); - apply_software_roi(fullFrame, real_width(priv), priv->num_bytes, data, priv->roi_x, priv->roi_y, priv->roi_width, priv->roi_height); - return TRUE; -} - -static void uca_dexela_camera_finalize(GObject *object) -{ - UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(object); - g_value_array_free(priv->binnings); - - 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); - UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(initable); - - if (cancellable != NULL) { - g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - "Cancellable initialization not supported"); - return FALSE; - } - if (priv->init_error != NULL) { - if (error) { - *error = g_error_copy (priv->init_error); - } - 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); - gobject_class->set_property = uca_dexela_camera_set_property; - gobject_class->get_property = uca_dexela_camera_get_property; - gobject_class->finalize = uca_dexela_camera_finalize; - - UcaCameraClass *camera_class = UCA_CAMERA_CLASS(klass); - camera_class->start_recording = uca_dexela_camera_start_recording; - camera_class->stop_recording = uca_dexela_camera_stop_recording; - camera_class->grab = uca_dexela_camera_grab; - - for (guint i = 0; base_overrideables[i] != 0; i++) { - g_object_class_override_property(gobject_class, base_overrideables[i], uca_camera_props[base_overrideables[i]]); - } - dexela_properties[PROP_GAIN_MODE] = - g_param_spec_uint("gain-mode", - "High or Low Full Well", - "High (1) or Low (0) Full Well", - 0, 1, 0, G_PARAM_READWRITE); - dexela_properties[PROP_TEST_MODE] = - g_param_spec_boolean("test-mode", - "Enable or disable test mode", - "Enable (true) or disable (false) test mode", - FALSE, G_PARAM_READWRITE); - for (guint id = N_BASE_PROPERTIES; id < N_PROPERTIES; id++) { - g_object_class_install_property(gobject_class, id, dexela_properties[id]); - } - g_type_class_add_private(klass, sizeof(UcaDexelaCameraPrivate)); -} - -static gboolean setup_dexela(UcaDexelaCameraPrivate *priv) -{ - if (!dexela_open_detector(DEFAULT_FMT_FILE_PATH)) { - g_set_error_literal(&priv->init_error, G_IO_ERROR, G_IO_ERROR_FAILED, "Failed to open dexela detector. Check cable, driver and permissions."); - return FALSE; - } - // TODO implement more error checking - dexela_init_serial_connection(); - priv->bits = dexela_get_bit_depth(); - priv->width = dexela_get_width(); - priv->height = dexela_get_height(); - priv->roi_x = 0; - priv->roi_y = 0; - priv->roi_width = real_width(priv); - priv->roi_height = real_height(priv); - priv->num_bytes = 2; - return TRUE; -} - -static void uca_dexela_camera_init(UcaDexelaCamera *self) -{ - UcaDexelaCameraPrivate *priv = UCA_DEXELA_CAMERA_GET_PRIVATE(self); - self->priv = priv; - fill_binnings(priv); - priv->uca_trigger_source = UCA_CAMERA_TRIGGER_SOURCE_AUTO; - priv->uca_trigger_type = UCA_CAMERA_TRIGGER_TYPE_EDGE; - setup_dexela(priv); -} - -G_MODULE_EXPORT GType -uca_camera_get_type (void) -{ - return UCA_TYPE_DEXELA_CAMERA; -} - -G_MODULE_EXPORT UcaCamera * -uca_camera_impl_new (GError **error) -{ - return UCA_CAMERA(uca_dexela_camera_new(error)); -} diff --git a/plugins/dexela/uca-dexela-camera.h b/plugins/dexela/uca-dexela-camera.h deleted file mode 100644 index 32d231e..0000000 --- a/plugins/dexela/uca-dexela-camera.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (C) 2011, 2012 Mihael Koep - (Softwareschneiderei GmbH) - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2.1 of the License, or (at your - option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., 51 - Franklin St, Fifth Floor, Boston, MA 02110, USA */ - -#ifndef __UCA_DEXELA_CAMERA_H -#define __UCA_DEXELA_CAMERA_H - -#include -#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)) -#define UCA_DEXELA_CAMERA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), UCA_TYPE_DEXELA_CAMERA, UcaDexelaCameraClass)) -#define UCA_IS_DEXELA_CAMERA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), UCA_TYPE_DEXELA_CAMERA)) -#define UCA_DEXELA_CAMERA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), UCA_TYPE_DEXELA_CAMERA, UcaDexelaCameraClass)) - -#define UCA_DEXELA_CAMERA_ERROR uca_dexela_camera_error_quark() -typedef enum { - UCA_DEXELA_CAMERA_ERROR_LIBPCO_INIT, -} UcaDexelaCameraError; - -typedef struct _UcaDexelaCamera UcaDexelaCamera; -typedef struct _UcaDexelaCameraClass UcaDexelaCameraClass; -typedef struct _UcaDexelaCameraPrivate UcaDexelaCameraPrivate; - -/** - * UcaDexelaCamera: - * - * Creates #UcaDexelaCamera instances by loading corresponding shared objects. The - * contents of the #UcaDexelaCamera structure are private and should only be - * accessed via the provided API. - */ -struct _UcaDexelaCamera { - /*< private >*/ - UcaCamera parent; - - UcaDexelaCameraPrivate *priv; -}; - -/** - * UcaDexelaCameraClass: - * - * #UcaDexelaCamera class - */ -struct _UcaDexelaCameraClass { - /*< private >*/ - UcaCameraClass parent; -}; - -GType uca_dexela_camera_get_type(void); - -G_END_DECLS - -#endif diff --git a/plugins/file/CMakeLists.txt b/plugins/file/CMakeLists.txt index 41aa81c..ab655fb 100644 --- a/plugins/file/CMakeLists.txt +++ b/plugins/file/CMakeLists.txt @@ -5,9 +5,9 @@ find_package(TIFF) if (TIFF_FOUND) set(UCA_CAMERA_NAME "file") - set(PLUGIN_VERSION "0.0.2") - set(PLUGIN_REVISION "1") - set(PLUGIN_REQUIRES "libuca >= 2.0.0") + set(PLUGIN_VERSION ${UCA_VERSION_STRING}) + set(PLUGIN_REVISION ${CPACK_PACKAGE_RELEASE}) + set(PLUGIN_REQUIRES "libuca = ${UCA_VERSION_STRING}") set(PLUGIN_SUMMARY "File plugin for libuca") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../package-plugin.sh.in diff --git a/plugins/mock/CMakeLists.txt b/plugins/mock/CMakeLists.txt index eafd180..5cb1067 100644 --- a/plugins/mock/CMakeLists.txt +++ b/plugins/mock/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 2.6) project(ucamock C) set(UCA_CAMERA_NAME "mock") -set(PLUGIN_VERSION "1.0.2") -set(PLUGIN_REVISION "1") -set(PLUGIN_REQUIRES "libuca >= 2.1.0") +set(PLUGIN_VERSION ${UCA_VERSION_STRING}) +set(PLUGIN_REVISION ${CPACK_PACKAGE_RELEASE}) +set(PLUGIN_REQUIRES "libuca = ${UCA_VERSION_STRING}") set(PLUGIN_SUMMARY "Mock plugin for libuca") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../package-plugin.sh.in diff --git a/plugins/package-plugin.sh.in b/plugins/package-plugin.sh.in index 65c401c..23d7b34 100644 --- a/plugins/package-plugin.sh.in +++ b/plugins/package-plugin.sh.in @@ -1,5 +1,5 @@ PACKAGE_CHANGELOG="-D CPACK_RPM_CHANGELOG_FILE=${PLUGIN_CHANGELOG}" -PACKAGE_FILE_NAME="-D CPACK_PACKAGE_FILE_NAME=uca-plugin-${UCA_CAMERA_NAME}-${UCA_VERSION_STRING}-${PLUGIN_VERSION}-${PLUGIN_REVISION}" +PACKAGE_FILE_NAME="-D CPACK_PACKAGE_FILE_NAME=uca-plugin-${UCA_CAMERA_NAME}-${PLUGIN_VERSION}-${PLUGIN_REVISION}" PACKAGE_NAME="-D CPACK_PACKAGE_NAME=uca-plugin-${UCA_CAMERA_NAME}" PACKAGE_DEPENDENCIES="-D CPACK_RPM_PACKAGE_REQUIRES=\"${PLUGIN_REQUIRES}\"" PACKAGE_DESCRIPTION="-D CPACK_RPM_PACKAGE_DESCRIPTION=\"${PLUGIN_DESCRIPTION}\"" diff --git a/plugins/pylon/CMakeLists.txt b/plugins/pylon/CMakeLists.txt deleted file mode 100644 index e2ace6b..0000000 --- a/plugins/pylon/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(ucapylon C) -set(VERSION "1.4.0") - -find_package(Pylon) - -if (PYLON_FOUND) - set(UCA_CAMERA_NAME "pylon") - set(PLUGIN_REVISION "1") - set(PLUGIN_VERSION ${VERSION}) - 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 >= 2.0.0, libpyloncam >= 0.5.0") - set(PLUGIN_VENDOR "ANKA Computing Group") - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../package-plugin.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/../../package-plugin-${UCA_CAMERA_NAME}.sh) - - include_directories(${LIBPYLONCAM_INCLUDEDIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${UCA_CONFIGDIR}) - - create_enums(uca-pylon-enums - ${CMAKE_CURRENT_SOURCE_DIR}/../../src/uca-enums - uca-pylon-camera.h) - - add_library(ucapylon SHARED - uca-pylon-camera.c - uca-pylon-enums.c) - - target_link_libraries(ucapylon ${UCA_DEPS} ${LIBPYLONCAM_LIBRARIES}) - - install(TARGETS ucapylon - LIBRARY DESTINATION ${UCA_PLUGINDIR} - COMPONENT ${UCA_CAMERA_NAME}) -endif() diff --git a/plugins/pylon/changelog.txt b/plugins/pylon/changelog.txt deleted file mode 100644 index ea5e9be..0000000 --- a/plugins/pylon/changelog.txt +++ /dev/null @@ -1,20 +0,0 @@ -* Mon May 18 2015 Mihael Koep 1.4.0-1 -- Update to libuca 2.0.0 -* Wed Oct 8 2014 Mihael Koep 1.3.0-2 -- new revision for libuca 1.6.0 -* Tue Oct 7 2014 Mihael Koep 1.3.0-1 -- require libpyloncam 0.5.0 because of new auto exposure feature -* Thu Sep 11 2014 Mihael Koep 1.2.1-1 -- improve robustness of roi setting -* Thu Jul 31 2014 Mihael Koep 1.2.0-1 -- require libpyloncam 0.4.0 -- update to modified libpyloncam API -* Wed Apr 9 2014 Mihael Koep 1.1.1-1 -- remove unneeded memory allocation -- require libpyloncam 0.3.0 -* Wed Apr 9 2014 Mihael Koep 1.1.0-1 -- make compatible with current libuca -* Tue Oct 15 2013 Mihael Koep 1.0.2-2 -- updated to libuca 1.3.0 -* Tue Apr 23 2013 Vasili Kvockin 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 deleted file mode 100644 index 0265ade..0000000 --- a/plugins/pylon/uca-pylon-camera.c +++ /dev/null @@ -1,483 +0,0 @@ -/* Copyright (C) 2012 Volker Kaiser - (Karlsruhe Institute of Technology) - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2.1 of the License, or (at your - option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., 51 - Franklin St, Fifth Floor, Boston, MA 02110, USA */ - -#include -#include -#include -#include -#include -#include -#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)) - -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 -#define PROP_GAIN_DEFAULT PROP_GAIN_MAX - -/** - * UcapylonCameraError: - * @UCA_PYLON_CAMERA_ERROR_LIBPYLON_INIT: Initializing libpylon failed - * @UCA_PYLON_CAMERA_ERROR_LIBPYLON_GENERAL: General libpylon error - * @UCA_PYLON_CAMERA_ERROR_UNSUPPORTED: Camera type is not supported - * @UCA_PYLON_CAMERA_ERROR_FG_INIT: Framegrabber initialization failed - * @UCA_PYLON_CAMERA_ERROR_FG_GENERAL: General framegrabber error - * @UCA_PYLON_CAMERA_ERROR_FG_ACQUISITION: Framegrabber acquisition error - */ -GQuark uca_pylon_camera_error_quark() -{ - return g_quark_from_static_string("uca-pylon-camera-error-quark"); -} - -enum { - PROP_ROI_WIDTH_DEFAULT = N_BASE_PROPERTIES, - PROP_ROI_HEIGHT_DEFAULT, - PROP_GAIN, - PROP_BALANCE_WHITE_AUTO, - PROP_EXPOSURE_AUTO, - N_PROPERTIES -}; - -static gint base_overrideables[] = { - PROP_NAME, - PROP_SENSOR_WIDTH, - PROP_SENSOR_HEIGHT, - PROP_SENSOR_BITDEPTH, - PROP_SENSOR_HORIZONTAL_BINNING, - PROP_SENSOR_HORIZONTAL_BINNINGS, - PROP_SENSOR_VERTICAL_BINNING, - PROP_SENSOR_VERTICAL_BINNINGS, - PROP_TRIGGER_SOURCE, - PROP_EXPOSURE_TIME, - PROP_ROI_X, - PROP_ROI_Y, - PROP_ROI_WIDTH, - PROP_ROI_HEIGHT, - PROP_ROI_WIDTH_MULTIPLIER, - PROP_ROI_HEIGHT_MULTIPLIER, - PROP_HAS_STREAMING, - PROP_HAS_CAMRAM_RECORDING, - 0 -}; - -static GParamSpec *pylon_properties[N_PROPERTIES] = { NULL, }; - - -struct _UcaPylonCameraPrivate { - guint bit_depth; - gsize num_bytes; - - guint width; - guint height; - guint16 roi_x; - guint16 roi_y; - guint16 roi_width; - guint16 roi_height; - GValueArray *binnings; -}; - - -static void pylon_get_roi(GObject *object, GError** error) -{ - UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(object); - pylon_camera_get_roi(&priv->roi_x, &priv->roi_y, &priv->roi_width, &priv->roi_height, error); -} - -static void pylon_set_roi(GObject *object, GError** error) -{ - UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(object); - pylon_camera_set_roi(priv->roi_x, priv->roi_y, priv->roi_width, priv->roi_height, error); -} - -static void uca_pylon_camera_start_recording(UcaCamera *camera, GError **error) -{ - g_return_if_fail(UCA_IS_PYLON_CAMERA(camera)); - UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(camera); - - priv->num_bytes = 2; - pylon_camera_start_acquision(error); -} - -static void uca_pylon_camera_stop_recording(UcaCamera *camera, GError **error) -{ - g_return_if_fail(UCA_IS_PYLON_CAMERA(camera)); - pylon_camera_stop_acquision(error); -} - -static gboolean uca_pylon_camera_grab(UcaCamera *camera, gpointer data, GError **error) -{ - g_return_val_if_fail(UCA_IS_PYLON_CAMERA(camera), FALSE); - - pylon_camera_grab(data, error); - return TRUE; -} - -static void uca_pylon_camera_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) -{ - g_return_if_fail (UCA_IS_PYLON_CAMERA (object)); - UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE (object); - GError* error = NULL; - - if (uca_camera_is_recording (UCA_CAMERA (object)) && !uca_camera_is_writable_during_acquisition (UCA_CAMERA (object), pspec->name)) { - g_warning ("Property '%s' cant be changed during acquisition", pspec->name); - return; - } - - switch (property_id) { - case PROP_SENSOR_HORIZONTAL_BINNING: - /* intentional fall-through*/ - case PROP_SENSOR_VERTICAL_BINNING: - /* intentional fall-through*/ - case PROP_TRIGGER_SOURCE: - /* this plugin supports AUTO triggering only ATM */ - break; - case PROP_BALANCE_WHITE_AUTO: - { - pylon_camera_set_int_attribute("BalanceWhiteAuto", g_value_get_enum(value), &error); - break; - } - case PROP_EXPOSURE_AUTO: - { - pylon_camera_set_int_attribute("ExposureAuto", g_value_get_enum(value), &error); - break; - } - case PROP_ROI_X: - { - priv->roi_x = g_value_get_uint(value); - gint max_roi_width = priv->width - priv->roi_x; - priv->roi_width = MIN(priv->roi_width, max_roi_width); - pylon_set_roi(object, &error); - break; - } - case PROP_ROI_Y: - { - priv->roi_y = g_value_get_uint(value); - gint max_roi_height = priv->height - priv->roi_y; - priv->roi_height = MIN(priv->roi_height, max_roi_height); - pylon_set_roi(object, &error); - break; - } - case PROP_ROI_WIDTH: - { - priv->roi_width = g_value_get_uint(value); - pylon_set_roi(object, &error); - break; - } - case PROP_ROI_HEIGHT: - { - priv->roi_height = g_value_get_uint(value); - pylon_set_roi(object, &error); - break; - } - case PROP_EXPOSURE_TIME: - pylon_camera_set_exposure_time(g_value_get_double(value), &error); - break; - case PROP_GAIN: - pylon_camera_set_gain(g_value_get_int(value), &error); - break; - default: - 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); - } else { - g_warning("failed to set property %d", property_id); - } - } -} - -static void uca_pylon_camera_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec) -{ - UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(object); - GError* error = NULL; - - 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; - } - case PROP_EXPOSURE_AUTO: - { - gint enum_value = UCA_CAMERA_EXPOSURE_AUTO_OFF; - pylon_camera_get_int_attribute("ExposureAuto", &enum_value, &error); - UcaCameraExposureAuto 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); - break; - - case PROP_SENSOR_HEIGHT: - pylon_camera_get_sensor_size(&priv->width, &priv->height, &error); - g_value_set_uint(value, priv->height); - break; - - case PROP_SENSOR_BITDEPTH: - pylon_camera_get_bit_depth(&priv->bit_depth, &error); - g_value_set_uint(value, priv->bit_depth); - break; - - case PROP_SENSOR_HORIZONTAL_BINNING: - g_value_set_uint(value, 1); - break; - - case PROP_SENSOR_HORIZONTAL_BINNINGS: - g_value_set_boxed(value, priv->binnings); - break; - - case PROP_SENSOR_VERTICAL_BINNING: - g_value_set_uint(value, 1); - break; - - case PROP_SENSOR_VERTICAL_BINNINGS: - g_value_set_boxed(value, priv->binnings); - break; - - case PROP_TRIGGER_SOURCE: - g_value_set_enum(value, UCA_CAMERA_TRIGGER_SOURCE_AUTO); - break; - - case PROP_HAS_STREAMING: - g_value_set_boolean(value, FALSE); - break; - - case PROP_HAS_CAMRAM_RECORDING: - g_value_set_boolean(value, FALSE); - break; - - case PROP_ROI_X: - { - pylon_get_roi(object, &error); - g_value_set_uint(value, priv->roi_x); - } - break; - - case PROP_ROI_Y: - { - pylon_get_roi(object, &error); - g_value_set_uint(value, priv->roi_y); - } - break; - - case PROP_ROI_WIDTH: - { - pylon_get_roi(object, &error); - g_value_set_uint(value, priv->roi_width); - } - break; - - case PROP_ROI_HEIGHT: - { - pylon_get_roi(object, &error); - g_value_set_uint(value, priv->roi_height); - } - break; - - case PROP_ROI_WIDTH_DEFAULT: - pylon_camera_get_sensor_size(&priv->width, &priv->height, &error); - g_value_set_uint(value, priv->width); - break; - - case PROP_ROI_HEIGHT_DEFAULT: - pylon_camera_get_sensor_size(&priv->width, &priv->height, &error); - g_value_set_uint(value, priv->height); - break; - - case PROP_GAIN: - { - gint gain=0; - pylon_camera_get_gain(&gain, &error); - g_value_set_int(value, gain); - } - break; - - case PROP_ROI_WIDTH_MULTIPLIER: - g_value_set_uint(value, 1); - break; - - case PROP_ROI_HEIGHT_MULTIPLIER: - g_value_set_uint(value, 1); - break; - - case PROP_EXPOSURE_TIME: - { - gdouble exp_time = 0.0; - pylon_camera_get_exposure_time(&exp_time, &error); - g_value_set_double(value, exp_time); - } - break; - - case PROP_NAME: - { - const gchar* name = NULL; - pylon_camera_get_string_attribute("ModelName", &name, &error); - g_value_set_string(value, name); - } - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); - break; - } - if (error) { - if(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_debug("pylon_get_property end\n"); -} - -static void uca_pylon_camera_finalize(GObject *object) -{ - UcaPylonCameraPrivate *priv = UCA_PYLON_CAMERA_GET_PRIVATE(object); - g_value_array_free(priv->binnings); - - 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(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); - gobject_class->set_property = uca_pylon_camera_set_property; - gobject_class->get_property = uca_pylon_camera_get_property; - gobject_class->finalize = uca_pylon_camera_finalize; - - UcaCameraClass *camera_class = UCA_CAMERA_CLASS(klass); - camera_class->start_recording = uca_pylon_camera_start_recording; - camera_class->stop_recording = uca_pylon_camera_stop_recording; - camera_class->grab = uca_pylon_camera_grab; - - for (guint i = 0; base_overrideables[i] != 0; i++) - g_object_class_override_property(gobject_class, base_overrideables[i], uca_camera_props[base_overrideables[i]]); - - pylon_properties[PROP_NAME] = - g_param_spec_string("name", - "Name of the camera", - "Name of the camera", - "", G_PARAM_READABLE); - - pylon_properties[PROP_ROI_WIDTH_DEFAULT] = - g_param_spec_uint("roi-width-default", - "ROI width default value", - "ROI width default value", - 0, G_MAXUINT, 0, - G_PARAM_READABLE); - - pylon_properties[PROP_ROI_HEIGHT_DEFAULT] = - g_param_spec_uint("roi-height-default", - "ROI height default value", - "ROI height default value", - 0, G_MAXUINT, 0, - G_PARAM_READABLE); - - pylon_properties[PROP_GAIN] = - g_param_spec_int("gain", - "gain", - "gain", - PROP_GAIN_MIN, PROP_GAIN_MAX, PROP_GAIN_DEFAULT, - G_PARAM_READWRITE); - pylon_properties[PROP_BALANCE_WHITE_AUTO] = - g_param_spec_enum("balance-white-auto", - "Balance White Auto mode", - "White balance mode (0: Off, 1: Once, 2: Continuous)", - UCA_TYPE_CAMERA_BALANCE_WHITE_AUTO, UCA_CAMERA_BALANCE_WHITE_OFF, - G_PARAM_READWRITE); - pylon_properties[PROP_EXPOSURE_AUTO] = - g_param_spec_enum("exposure-auto", - "Exposure Auto mode", - "Exposure auto mode (0: Off, 1: Once, 2: Continuous)", - UCA_TYPE_CAMERA_EXPOSURE_AUTO, UCA_CAMERA_EXPOSURE_AUTO_OFF, - G_PARAM_READWRITE); - - for (guint id = N_BASE_PROPERTIES; id < N_PROPERTIES; id++) - g_object_class_install_property(gobject_class, id, pylon_properties[id]); - - g_type_class_add_private(klass, sizeof(UcaPylonCameraPrivate)); -} - -static void uca_pylon_camera_init(UcaPylonCamera *self) -{ - - self->priv = UCA_PYLON_CAMERA_GET_PRIVATE(self); - - /* binnings */ - GValue val = {0}; - g_value_init(&val, G_TYPE_UINT); - g_value_set_uint(&val, 1); - self->priv->binnings = g_value_array_new(1); - g_value_array_append(self->priv->binnings, &val); -} - -G_MODULE_EXPORT GType -uca_camera_get_type (void) -{ - return UCA_TYPE_PYLON_CAMERA; -} diff --git a/plugins/pylon/uca-pylon-camera.h b/plugins/pylon/uca-pylon-camera.h deleted file mode 100644 index 621c8da..0000000 --- a/plugins/pylon/uca-pylon-camera.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (C) 2011, 2012 Matthias Vogelgesang - (Karlsruhe Institute of Technology) - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2.1 of the License, or (at your - option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., 51 - Franklin St, Fifth Floor, Boston, MA 02110, USA */ - -#ifndef __UCA_PYLON_CAMERA_H -#define __UCA_PYLON_CAMERA_H - -#include -#include "uca-camera.h" - -G_BEGIN_DECLS - -#define UCA_TYPE_PYLON_CAMERA (uca_pylon_camera_get_type()) -#define UCA_PYLON_CAMERA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), UCA_TYPE_PYLON_CAMERA, UcaPylonCamera)) -#define UCA_IS_PYLON_CAMERA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), UCA_TYPE_PYLON_CAMERA)) -#define UCA_PYLON_CAMERA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), UFO_TYPE_PYLON_CAMERA, UfoPylonCameraClass)) -#define UCA_IS_PYLON_CAMERA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), UCA_TYPE_PYLON_CAMERA)) -#define UCA_PYLON_CAMERA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), UCA_TYPE_PYLON_CAMERA, UcaPylonCameraClass)) - -#define UCA_PYLON_CAMERA_ERROR uca_pylon_camera_error_quark() -typedef enum { - UCA_PYLON_CAMERA_ERROR_LIBPYLON_INIT, - UCA_PYLON_CAMERA_ERROR_LIBPYLON_GENERAL, - UCA_PYLON_CAMERA_ERROR_UNSUPPORTED, -} UcaPylonCameraError; - -typedef enum { - UCA_CAMERA_BALANCE_WHITE_OFF, - UCA_CAMERA_BALANCE_WHITE_ONCE, - UCA_CAMERA_BALANCE_WHITE_CONTINUOUSLY -} UcaCameraBalanceWhiteAuto; - -typedef enum { - UCA_CAMERA_EXPOSURE_AUTO_OFF, - UCA_CAMERA_EXPOSURE_AUTO_ONCE, - UCA_CAMERA_EXPOSURE_AUTO_CONTINUOUSLY -} UcaCameraExposureAuto; - -typedef struct _UcaPylonCamera UcaPylonCamera; -typedef struct _UcaPylonCameraClass UcaPylonCameraClass; -typedef struct _UcaPylonCameraPrivate UcaPylonCameraPrivate; - -/** - * UcaPylonCamera: - * - * Creates #UcaPylonCamera instances by loading corresponding shared objects. The - * contents of the #UcaPylonCamera structure are private and should only be - * accessed via the provided API. - */ -struct _UcaPylonCamera { - /*< private >*/ - UcaCamera parent; - - UcaPylonCameraPrivate *priv; -}; - -/** - * UcaPylonCameraClass: - * - * #UcaPylonCamera class - */ -struct _UcaPylonCameraClass { - /*< private >*/ - UcaCameraClass parent; -}; - -GType uca_pylon_camera_get_type(void); - -G_END_DECLS - -#endif -- cgit v1.2.3