summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS19
-rw-r--r--doc/CMakeLists.txt26
-rw-r--r--src/CMakeLists.txt58
-rw-r--r--src/cameras/dummy.c327
-rw-r--r--src/cameras/dummy.h23
-rw-r--r--src/cameras/ipe.c240
-rw-r--r--src/cameras/ipe.h23
-rw-r--r--src/cameras/pco.c460
-rw-r--r--src/cameras/pco.h23
-rw-r--r--src/cameras/pf.c265
-rw-r--r--src/cameras/pf.h23
-rw-r--r--src/cameras/simple.c166
-rw-r--r--src/cameras/simple.h23
-rw-r--r--src/grabbers/me4.c294
-rw-r--r--src/grabbers/me4.h6
-rw-r--r--src/uca-cam.c36
-rw-r--r--src/uca-cam.h125
-rw-r--r--src/uca-grabber.c0
-rw-r--r--src/uca-grabber.h163
-rw-r--r--src/uca.c370
-rw-r--r--src/uca.h592
-rw-r--r--src/uca.i8
22 files changed, 51 insertions, 3219 deletions
diff --git a/NEWS b/NEWS
index 1eb4cdc..7856b66 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,23 @@
+Changes in libuca 0.6.0
+=======================
+
+GObject Type System
+-------------------
+
+Instead of using a home-grown type and class system, we switched to the GObject
+system as part of GLib. This effort has the advantage of much more typesafe
+properties and better signal and closure handling.
+
+Most of the ideas and approaches of libuca 0.5 have been transfered. However,
+instead of trying to initialize each camera first and having the user decide
+what to use, the user must now determine the used camera at compile time or use
+the factory pattern to delegate this to run-time.
+
+
+
Changes in libuca 0.5.0
------------------------
+=======================
- Put work under LGPL 2.1
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 0e5afd1..aeb482e 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,17 +1,17 @@
cmake_minimum_required(VERSION 2.8)
-find_package(Doxygen)
+#find_package(Doxygen)
# --- Create Doxygen source documentation by typing `make doc`
-if(DOXYGEN_FOUND)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/publish.sh.in ${CMAKE_CURRENT_BINARY_DIR}/publish.sh)
-
- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
- COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../src/uca.h
- COMMENT "Generating API documentation with Doxygen" VERBATIM
- )
- add_custom_target(docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
-endif(DOXYGEN_FOUND)
+#if(DOXYGEN_FOUND)
+# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/publish.sh.in ${CMAKE_CURRENT_BINARY_DIR}/publish.sh)
+#
+# add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
+# COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+# DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../src/uca.h
+# COMMENT "Generating API documentation with Doxygen" VERBATIM
+# )
+# add_custom_target(docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
+#endif(DOXYGEN_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f2124da..b3650f6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,6 @@ set(uca_HDRS
uca-camera.h
)
-set(uca_LIBS)
# --- Find packages and libraries ---------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
@@ -30,6 +29,10 @@ find_package(Threads)
pkg_check_modules(GLIB2 glib-2.0>=2.24 REQUIRED)
pkg_check_modules(GOBJECT2 gobject-2.0>=2.24 REQUIRED)
+set(uca_LIBS
+ ${GLIB2_LIBRARIES}
+ ${GOBJECT2_LIBRARIES})
+
# --- Build options -----------------------------------------------------------
option(HAVE_DUMMY_CAMERA "Camera: Dummy" OFF)
@@ -39,7 +42,8 @@ if (PF_FOUND)
option(HAVE_PHOTON_FOCUS "Camera: Photon Focus MV2-D1280-640-CL-8" ON)
if (HAVE_PHOTON_FOCUS)
- set(uca_SRCS ${uca_SRCS} cameras/pf.c)
+ set(uca_SRCS ${uca_SRCS} cameras/uca-pf-camera.c)
+ set(uca_HDRS ${uca_HDRS} cameras/uca-pf-camera.h)
set(uca_LIBS ${uca_LIBS} ${PF_LIBRARIES})
include_directories(${PF_INCLUDE_DIRS})
@@ -65,36 +69,18 @@ if (PCO_FOUND AND CLSERME4_FOUND AND FGLIB5_FOUND)
endif()
endif()
-#if (IPE_FOUND)
-# option(HAVE_IPE_CAMERA "Camera: Custom IPE based on Xilinx FPGA" ON)
-#
-# if (HAVE_IPE_CAMERA)
-# set(uca_SRCS ${uca_SRCS} cameras/ipe.c)
-# set(uca_LIBS ${uca_LIBS} ${IPE_LIBRARIES})
-#
-# include_directories(${IPE_INCLUDE_DIRS})
-# endif()
-#endif()
-#
-#if (CLSERME4_FOUND AND FGLIB5_FOUND)
-# option(HAVE_ME4 "Grabber: Silicon Software microEnable IV" ON)
-# if (HAVE_ME4)
-# set(uca_SRCS ${uca_SRCS} grabbers/me4.c)
-# set(uca_LIBS ${uca_LIBS}
-# ${CLSERME4_LIBRARY}
-# ${FGLIB5_LIBRARY})
-#
-# include_directories(
-# ${CLSERME4_INCLUDE_DIR}
-# ${FGLIB5_INCLUDE_DIR})
-# endif()
-#
-# option(HAVE_SIMPLE_CAMERA "Camera: Just grabber based" ON)
-# if (HAVE_SIMPLE_CAMERA)
-# set(uca_SRCS ${uca_SRCS} cameras/simple.c)
-# endif()
-#endif()
-#
+if (IPE_FOUND)
+ option(HAVE_IPE_CAMERA "Camera: Custom IPE based on Xilinx FPGA" ON)
+
+ if (HAVE_IPE_CAMERA)
+ set(uca_SRCS ${uca_SRCS} cameras/uca-ipe-camera.c)
+ set(uca_HDRS ${uca_HDRS} cameras/uca-ipe-camera.h)
+ set(uca_LIBS ${uca_LIBS} ${IPE_LIBRARIES})
+
+ include_directories(${IPE_INCLUDE_DIRS})
+ endif()
+endif()
+
if (HAVE_DUMMY_CAMERA)
set(uca_SRCS ${uca_SRCS} cameras/uca-mock-camera.c)
set(uca_HDRS ${uca_HDRS} cameras/uca-mock-camera.h)
@@ -105,8 +91,7 @@ if (Threads_FOUND)
set(uca_LIBS
${uca_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
- )
+ ${CMAKE_THREAD_LIBS_INIT})
endif()
# --- Configure step
@@ -118,8 +103,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cameras
${GLIB2_INCLUDE_DIRS}
- ${GOBJECT2_INCLUDE_DIRS}
- )
+ ${GOBJECT2_INCLUDE_DIRS})
# --- Build target ------------------------------------------------------------
add_definitions("-std=c99 -Wall")
@@ -131,8 +115,6 @@ set_target_properties(uca-gobject PROPERTIES
SOVERSION ${UCA_VERSION_MINOR})
target_link_libraries(uca-gobject
- ${GLIB2_LIBRARIES}
- ${GOBJECT2_LIBRARIES}
${uca_LIBS})
diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c
deleted file mode 100644
index 255a54b..0000000
--- a/src/cameras/dummy.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 <stdlib.h>
-#include <string.h>
-#define __USE_BSD
-#include <unistd.h>
-#undef __USE_BSD
-#include <sys/time.h>
-#include <assert.h>
-
-#include "config.h"
-#include "uca.h"
-#include "uca-cam.h"
-#include "uca-grabber.h"
-
-#ifdef HAVE_PTHREADS
-#include <pthread.h>
-#endif
-
-/**
- * User structure for the dummy camera.
- */
-typedef struct dummy_cam {
- uint32_t bitdepth;
- uint32_t frame_rate;
-#ifdef HAVE_PTHREADS
- pthread_t grab_thread;
- bool thread_running;
- char *buffer;
-#endif
-} dummy_cam_t;
-
-
-static const char g_digits[10][20] = {
- /* 0 */
- { 0x00, 0xff, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0xff, 0x00, 0x00, 0xff,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0xff, 0xff, 0x00 },
- /* 1 */
- { 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0xff, 0x00,
- 0x00, 0x00, 0xff, 0x00,
- 0x00, 0x00, 0xff, 0x00,
- 0x00, 0x00, 0xff, 0x00 },
- /* 2 */
- { 0x00, 0xff, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff },
- /* 3 */
- { 0x00, 0xff, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0xff, 0xff, 0x00 },
- /* 4 */
- { 0xff, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0xff, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff },
- /* 5 */
- { 0xff, 0xff, 0xff, 0xff,
- 0xff, 0x00, 0x00, 0x00,
- 0x00, 0xff, 0xff, 0x00,
- 0x00, 0x00, 0x00, 0xff,
- 0xff, 0xff, 0xff, 0x00 },
- /* 6 */
- { 0x00, 0xff, 0xff, 0xff,
- 0xff, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0xff, 0xff, 0x00 },
- /* 7 */
- { 0xff, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00 },
- /* 8 */
- { 0x00, 0xff, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0xff, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0xff, 0xff, 0x00 },
- /* 9 */
- { 0x00, 0xff, 0xff, 0x00,
- 0xff, 0x00, 0x00, 0xff,
- 0x00, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0xff,
- 0xff, 0xff, 0xff, 0x00 }
-};
-
-const int DIGIT_WIDTH = 4;
-const int DIGIT_HEIGHT = 5;
-
-#define GET_DUMMY(uca) ((struct dummy_cam *)(uca->user))
-
-static void uca_dummy_print_number(char *buffer, int number, int x, int y, int width)
-{
- for (int i = 0; i < DIGIT_WIDTH; i++) {
- for (int j = 0; j < DIGIT_HEIGHT; j++) {
- buffer[(y+j)*width + (x+i)] = g_digits[number][j*DIGIT_WIDTH+i];
- }
- }
-}
-
-static void uca_dummy_memcpy(struct uca_camera_priv *cam, char *buffer)
-{
- /* print current frame number */
- unsigned int number = cam->current_frame;
- unsigned int divisor = 100000000;
- int x = 10;
- while (divisor > 1) {
- uca_dummy_print_number(buffer, number / divisor, x, 10, cam->frame_width);
- number = number % divisor;
- divisor = divisor / 10;
- x += 5;
- }
-}
-
-static __suseconds_t uca_dummy_time_diff(struct timeval *start, struct timeval *stop)
-{
- return (stop->tv_sec - start->tv_sec)*1000000 + (stop->tv_usec - start->tv_usec);
-}
-
-static void *uca_dummy_grab_thread(void *arg)
-{
- struct uca_camera_priv *cam = ((struct uca_camera_priv *) arg);
- struct dummy_cam *dc = GET_DUMMY(cam);
-
- assert(dc->frame_rate > 0);
- const __useconds_t sleep_time = (unsigned int) 1000000.0f / dc->frame_rate;
- __suseconds_t call_time;
- struct timeval start, stop;
-
- while (dc->thread_running) {
- uca_dummy_memcpy(cam, dc->buffer);
- gettimeofday(&start, NULL);
- cam->callback(cam->current_frame, dc->buffer, NULL, cam->callback_user);
- gettimeofday(&stop, NULL);
-
- call_time = uca_dummy_time_diff(&start, &stop);
- if (call_time < sleep_time) {
- cam->current_frame++;
- usleep(sleep_time - call_time);
- }
- else
- cam->current_frame += call_time / sleep_time;
- }
- return NULL;
-}
-
-
-/*
- * --- interface implementations ----------------------------------------------
- */
-static uint32_t uca_dummy_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
-{
- uint32_t err = UCA_ERR_CAMERA | UCA_ERR_PROP;
-
- switch (property) {
- case UCA_PROP_WIDTH:
- cam->frame_width = *((uint32_t *) data);
- break;
-
- case UCA_PROP_HEIGHT:
- cam->frame_height = *((uint32_t *) data);
- break;
-
- case UCA_PROP_FRAMERATE:
- GET_DUMMY(cam)->frame_rate = *((uint32_t *) data);
- break;
-
- default:
- return err | UCA_ERR_INVALID;
- }
-
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_dummy_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
-{
- switch (property) {
- case UCA_PROP_NAME:
- strncpy((char *) data, "dummy", num);
- break;
-
- case UCA_PROP_WIDTH:
- uca_set_void(data, uint32_t, cam->frame_width);
- break;
-
- case UCA_PROP_WIDTH_MIN:
- uca_set_void(data, uint32_t, 1);
- break;
-
- case UCA_PROP_WIDTH_MAX:
- uca_set_void(data, uint32_t, 4096);
- break;
-
- case UCA_PROP_HEIGHT:
- uca_set_void(data, uint32_t, cam->frame_height);
- break;
-
- case UCA_PROP_HEIGHT_MIN:
- uca_set_void(data, uint32_t, 1);
- break;
-
- case UCA_PROP_HEIGHT_MAX:
- uca_set_void(data, uint32_t, 4096);
- break;
-
- case UCA_PROP_BITDEPTH:
- uca_set_void(data, uint32_t, 8);
- break;
-
- default:
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
- }
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_dummy_start_recording(struct uca_camera_priv *cam)
-{
- if (cam->callback != NULL) {
-#ifdef HAVE_PTHREADS
- struct dummy_cam *dc = GET_DUMMY(cam);
- /* FIXME: handle return value */
- dc->thread_running = true;
- dc->buffer = (char *) malloc(cam->frame_width * cam->frame_height);
- pthread_create(&dc->grab_thread, NULL, &uca_dummy_grab_thread, cam);
-#endif
- }
- cam->current_frame = 0;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_dummy_stop_recording(struct uca_camera_priv *cam)
-{
- struct dummy_cam *dc = GET_DUMMY(cam);
- if (cam->callback != NULL) {
- dc->thread_running = false;
- free(dc->buffer);
- dc->buffer = NULL;
- }
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_dummy_register_callback(struct uca_camera_priv *cam, uca_cam_grab_callback cb, void *user)
-{
- if (cam->callback == NULL) {
- cam->callback = cb;
- cam->callback_user = user;
- }
- else
- return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED;
-
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_dummy_grab(struct uca_camera_priv *cam, char *buffer, void *meta_data)
-{
- if (cam->callback != NULL)
- return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED;
-
- uca_dummy_memcpy(cam, buffer);
- cam->current_frame++;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_dummy_destroy(struct uca_camera_priv *cam)
-{
- struct dummy_cam *dc = GET_DUMMY(cam);
- free(dc->buffer);
- free(dc);
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_dummy_ignore(struct uca_camera_priv *cam)
-{
- return UCA_NO_ERROR;
-}
-
-uint32_t uca_dummy_init(struct uca_camera_priv **cam, struct uca_grabber_priv *grabber)
-{
- struct uca_camera_priv *uca = uca_cam_new();
-
- uca->destroy = &uca_dummy_destroy;
- uca->set_property = &uca_dummy_set_property;
- uca->get_property = &uca_dummy_get_property;
- uca->start_recording = &uca_dummy_start_recording;
- uca->stop_recording = &uca_dummy_stop_recording;
- uca->trigger = &uca_dummy_ignore;
- uca->grab = &uca_dummy_grab;
- uca->register_callback = &uca_dummy_register_callback;
-
- uca->state = UCA_CAM_CONFIGURABLE;
- uca->frame_width = 320;
- uca->frame_height = 240;
-
- struct dummy_cam *dummy_cam = (struct dummy_cam *) malloc(sizeof(struct dummy_cam));
- dummy_cam->bitdepth = 8;
- dummy_cam->frame_rate = 100;
- uca->user = dummy_cam;
-
- *cam = uca;
-
- return UCA_NO_ERROR;
-}
diff --git a/src/cameras/dummy.h b/src/cameras/dummy.h
deleted file mode 100644
index ba9a8d4..0000000
--- a/src/cameras/dummy.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_DUMMY_H
-#define __UNIFIED_CAMERA_ACCESS_DUMMY_H
-
-uint32_t uca_dummy_init(struct uca_camera_priv **uca, struct uca_grabber_priv *grabber);
-
-#endif
diff --git a/src/cameras/ipe.c b/src/cameras/ipe.c
deleted file mode 100644
index b027d50..0000000
--- a/src/cameras/ipe.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <pcilib.h>
-#include "uca.h"
-#include "uca-cam.h"
-#include "uca-grabber.h"
-
-#define set_void(p, type, value) { *((type *) p) = value; }
-#define GET_HANDLE(cam) ((pcilib_t *) cam->user)
-
-static void uca_ipe_handle_error(const char *format, ...)
-{
- if (format) {
- va_list ap;
- va_start(ap, format);
- vprintf(format, ap);
- printf("\n");
- va_end(ap);
- }
-}
-
-static uint32_t uca_ipe_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
-{
- pcilib_t *handle = GET_HANDLE(cam);
- pcilib_register_value_t value = *((pcilib_register_value_t *) data);
-
- switch (property) {
- case UCA_PROP_EXPOSURE:
- pcilib_write_register(handle, NULL, "exp_time", value);
- break;
-
- default:
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
- }
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_ipe_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
-{
- pcilib_t *handle = GET_HANDLE(cam);
- pcilib_register_value_t value = 0;
-
- switch (property) {
- case UCA_PROP_NAME:
- strncpy((char *) data, "IPE PCIe based on CMOSIS CMV2000", num);
- break;
-
- case UCA_PROP_BITDEPTH:
- set_void(data, uint32_t, 16);
- break;
-
- case UCA_PROP_WIDTH:
- set_void(data, uint32_t, 2048);
- break;
-
- case UCA_PROP_HEIGHT:
- set_void(data, uint32_t, 1088);
- break;
-
- case UCA_PROP_EXPOSURE:
- pcilib_read_register(handle, NULL, "exp_time", &value);
- set_void(data, uint32_t, (uint32_t) value);
-
- case UCA_PROP_TEMPERATURE_SENSOR:
- pcilib_read_register(handle, NULL, "cmosis_temperature", &value);
- set_void(data, uint32_t, (uint32_t) value);
- break;
-
- case UCA_PROP_PGA_GAIN:
- pcilib_read_register(handle, NULL, "pga", &value);
- set_void(data, uint32_t, (uint32_t) value);
- break;
-
- case UCA_PROP_PGA_GAIN_MIN:
- set_void(data, uint32_t, 0);
- break;
-
- case UCA_PROP_PGA_GAIN_MAX:
- set_void(data, uint32_t, 3);
- break;
-
- case UCA_PROP_ADC_GAIN:
- pcilib_read_register(handle, NULL, "adc_gain", &value);
- set_void(data, uint32_t, (uint32_t) value);
- break;
-
- case UCA_PROP_ADC_GAIN_MIN:
- set_void(data, uint32_t, 32);
- break;
-
- case UCA_PROP_ADC_GAIN_MAX:
- set_void(data, uint32_t, 55);
- break;
-
- default:
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
- }
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_ipe_start_recording(struct uca_camera_priv *cam)
-{
- pcilib_t *handle = cam->user;
- pcilib_start(handle, PCILIB_EVENT_DATA, PCILIB_EVENT_FLAGS_DEFAULT);
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_ipe_stop_recording(struct uca_camera_priv *cam)
-{
- pcilib_t *handle = cam->user;
- pcilib_stop(handle, PCILIB_EVENT_FLAGS_DEFAULT);
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_ipe_grab(struct uca_camera_priv *cam, char *buffer, void *meta_data)
-{
- pcilib_t *handle = GET_HANDLE(cam);
- size_t size = cam->frame_width * cam->frame_height * sizeof(uint16_t);
- void *data = NULL;
- pcilib_event_id_t event_id;
- pcilib_event_info_t event_info;
-
- if (pcilib_trigger(handle, PCILIB_EVENT0, 0, NULL))
- return UCA_ERR_CAMERA;
-
- if (pcilib_get_next_event(handle, PCILIB_TIMEOUT_INFINITE, &event_id, sizeof(pcilib_event_info_t), &event_info))
- return UCA_ERR_CAMERA;
-
- size_t err = 0;
- data = pcilib_get_data(handle, event_id, PCILIB_EVENT_DATA, &err);
-
- if (data == NULL)
- return UCA_ERR_CAMERA;
-
- assert(err == size);
-
- memcpy(buffer, data, size);
- pcilib_return_data(handle, event_id, PCILIB_EVENT_DATA, data);
- return UCA_NO_ERROR;
-}
-
-static int event_callback(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *user)
-{
- struct uca_camera_priv *cam = (struct uca_camera_priv *) user;
- pcilib_t *handle = GET_HANDLE(cam);
- size_t error = 0;
-
- void *buffer = pcilib_get_data(handle, event_id, PCILIB_EVENT_DATA, &error);
-
- if (buffer == NULL) {
- pcilib_trigger(handle, PCILIB_EVENT0, 0, NULL);
- return PCILIB_STREAMING_CONTINUE;
- }
-
- uca_buffer_status status = cam->callback(info->seqnum, buffer, NULL, cam->callback_user);
-
- if (status == UCA_BUFFER_RELEASE)
- pcilib_return_data(handle, event_id, PCILIB_EVENT_DATA, buffer);
-
- pcilib_trigger(handle, PCILIB_EVENT0, 0, NULL);
- return PCILIB_STREAMING_CONTINUE;
-}
-
-static uint32_t uca_ipe_register_callback(struct uca_camera_priv *cam, uca_cam_grab_callback cb, void *user)
-{
- if (cam->callback == NULL) {
- cam->callback = cb;
- cam->callback_user = user;
- pcilib_trigger(GET_HANDLE(cam), PCILIB_EVENT0, 0, NULL);
- pcilib_stream(GET_HANDLE(cam), &event_callback, cam);
- return UCA_NO_ERROR;
- }
- return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED;
-}
-
-static uint32_t uca_ipe_release_buffer(struct uca_camera_priv *cam, void *buffer)
-{
- /* FIXME: call return_data */
- /* pcilib_t *handle = GET_HANDLE(cam); */
- /* pcilib_return_data(handle, event_id, PCILIB_EVENT_DATA, buffer); */
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_ipe_destroy(struct uca_camera_priv *cam)
-{
- pcilib_close(GET_HANDLE(cam));
- return UCA_NO_ERROR;
-}
-
-uint32_t uca_ipe_init(struct uca_camera_priv **cam, struct uca_grabber_priv *grabber)
-{
- pcilib_model_t model = PCILIB_MODEL_DETECT;
- pcilib_set_error_handler(uca_ipe_handle_error, uca_ipe_handle_error);
- pcilib_t *handle = pcilib_open("/dev/fpga0", model);
-
- if (handle == NULL)
- return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_NOT_FOUND;
-
- pcilib_set_error_handler(&uca_ipe_handle_error, &uca_ipe_handle_error);
- pcilib_reset(handle);
-
- struct uca_camera_priv *uca = uca_cam_new();
-
- /* Camera found, set function pointers... */
- uca->destroy = &uca_ipe_destroy;
- uca->set_property = &uca_ipe_set_property;
- uca->get_property = &uca_ipe_get_property;
- uca->start_recording = &uca_ipe_start_recording;
- uca->stop_recording = &uca_ipe_stop_recording;
- uca->grab = &uca_ipe_grab;
- uca->register_callback = &uca_ipe_register_callback;
- uca->release_buffer = &uca_ipe_release_buffer;
-
- uca->frame_width = 2048;
- uca->frame_height = 1088;
- uca->user = handle;
- *cam = uca;
-
- return UCA_NO_ERROR;
-}
diff --git a/src/cameras/ipe.h b/src/cameras/ipe.h
deleted file mode 100644
index 50bd5bd..0000000
--- a/src/cameras/ipe.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_IPE_H
-#define __UNIFIED_CAMERA_ACCESS_IPE_H
-
-uint32_t uca_ipe_init(struct uca_camera_priv **uca, struct uca_grabber_priv *grabber);
-
-#endif
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
deleted file mode 100644
index da4fd73..0000000
--- a/src/cameras/pco.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 <stdlib.h>
-#include <string.h>
-#include <libpco/libpco.h>
-#include <libpco/sc2_defs.h>
-#include "uca.h"
-#include "uca-cam.h"
-#include "uca-grabber.h"
-#include "pco.h"
-
-typedef struct pco_desc {
- pco_handle pco;
- uint16_t type, subtype;
- uint16_t roi[4];
-
- uint16_t active_segment;
- uint32_t current_image;
- uint32_t num_recorded_images;
-} pco_desc_t;
-
-#define GET_PCO_DESC(cam) ((struct pco_desc *) cam->user)
-#define GET_PCO(cam) (((struct pco_desc *)(cam->user))->pco)
-
-#define uca_set_void(p, type, value) { *((type *) p) = (type) value; }
-
-
-static uint32_t uca_pco_set_exposure(struct uca_camera_priv *cam, uint32_t *exposure)
-{
- if (pco_set_exposure_time(GET_PCO(cam), *exposure) != PCO_NOERROR)
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pco_set_delay(struct uca_camera_priv *cam, uint32_t *delay)
-{
- if (pco_set_delay_time(GET_PCO(cam), *delay) != PCO_NOERROR)
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pco_destroy(struct uca_camera_priv *cam)
-{
- cam->grabber->stop_acquire(cam->grabber);
- pco_stop_recording(GET_PCO(cam));
- pco_destroy(GET_PCO(cam));
- free(GET_PCO_DESC(cam));
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
-{
- struct uca_grabber_priv *grabber = cam->grabber;
- struct pco_desc *pco_d = GET_PCO_DESC(cam);
- uint32_t err = UCA_ERR_CAMERA | UCA_ERR_PROP;
-
- /* We try to set the property on the grabber. If it returns "invalid", we
- * also try it via the libpco. Else, there was a more serious error. */
- err = grabber->set_property(grabber, property, data);
- if (((err & UCA_ERR_MASK_CODE) == UCA_ERR_INVALID) || (err == UCA_NO_ERROR))
- err = UCA_ERR_CAMERA | UCA_ERR_PROP;
- else
- return err;
-
- switch (property) {
- case UCA_PROP_WIDTH:
- cam->frame_width = *((uint32_t *) data);
- pco_d->roi[2] = cam->frame_width;
- if (pco_set_roi(pco_d->pco, pco_d->roi) != PCO_NOERROR)
- return err | UCA_ERR_OUT_OF_RANGE;
-
- /* Twice the width because of 16 bits per pixel */
- uint32_t w = cam->frame_width * 2;
- grabber->set_property(grabber, UCA_PROP_WIDTH, &w);
- break;
-
- case UCA_PROP_HEIGHT:
- cam->frame_height = *((uint32_t *) data);
- pco_d->roi[3] = cam->frame_height;
- if (pco_set_roi(pco_d->pco, pco_d->roi) == PCO_NOERROR)
- return err | UCA_ERR_OUT_OF_RANGE;
- break;
-
- case UCA_PROP_EXPOSURE:
- return uca_pco_set_exposure(cam, (uint32_t *) data);
-
- case UCA_PROP_DELAY:
- return uca_pco_set_delay(cam, (uint32_t *) data);
-
- case UCA_PROP_GRAB_AUTO:
- return pco_set_auto_transfer(GET_PCO(cam), *(uint32_t *) data);
-
- case UCA_PROP_TRIGGER_MODE:
- /* XXX: We have a 1:1 mapping between UCA_TRIGGER_* and
- * TRIGGER_MODE_*
- */
- return pco_set_trigger_mode(GET_PCO(cam), (uint16_t) *(uint32_t *) data);
-
- case UCA_PROP_TIMESTAMP_MODE:
- {
- uint32_t mode = *((uint32_t *) data);
- if (mode & UCA_TIMESTAMP_ASCII) {
- if (mode & UCA_TIMESTAMP_BINARY)
- return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_BINARYANDASCII);
- else
- return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_ASCII);
- }
- else if (mode & UCA_TIMESTAMP_BINARY)
- return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_BINARY);
- else
- return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_OFF);
- }
-
- case UCA_PROP_HOTPIXEL_CORRECTION:
- return pco_set_hotpixel_correction(GET_PCO(cam), *(uint32_t *) data);
-
- default:
- return err | UCA_ERR_INVALID;
- }
- return UCA_NO_ERROR;
-}
-
-
-static uint32_t uca_pco_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
-{
- pco_handle pco = GET_PCO(cam);
- struct uca_grabber_priv *grabber = cam->grabber;
-
- switch (property) {
- case UCA_PROP_NAME:
- {
- char *name = NULL;
- pco_get_name(pco, &name);
- strncpy((char *) data, name, num);
- free(name);
- }
- break;
-
- case UCA_PROP_TEMPERATURE_SENSOR:
- {
- uint32_t t1, t2, t3;
- if (pco_get_temperature(pco, &t1, &t2, &t3) == PCO_NOERROR) {
- uca_set_void(data, uint32_t, (t1 / 10));
- }
- }
- break;
-
- case UCA_PROP_TEMPERATURE_CAMERA:
- {
- uint32_t t1, t2, t3;
- if (pco_get_temperature(pco, &t1, &t2, &t3) == PCO_NOERROR)
- uca_set_void(data, uint32_t, t2);
- }
- break;
-
- case UCA_PROP_WIDTH:
- uca_set_void(data, uint32_t, cam->frame_width);
- break;
-
- case UCA_PROP_WIDTH_MIN:
- uca_set_void(data, uint32_t, 1);
- break;
-
- case UCA_PROP_HEIGHT:
- uca_set_void(data, uint32_t, cam->frame_height);
- break;
-
- case UCA_PROP_HEIGHT_MIN:
- uca_set_void(data, uint32_t, 1);
- break;
-
- case UCA_PROP_BINNING_X:
- {
- uint16_t hb, vb;
- if (pco_get_binning(pco, &hb, &vb) == PCO_NOERROR)
- uca_set_void(data, uint32_t, hb);
- }
- break;
-
- case UCA_PROP_BINNING_Y:
- {
- uint16_t hb, vb;
- if (pco_get_binning(pco, &hb, &vb) == PCO_NOERROR)
- uca_set_void(data, uint32_t, vb);
- }
- break;
-
- case UCA_PROP_X_OFFSET:
- return grabber->get_property(grabber, UCA_PROP_X_OFFSET, (uint32_t *) data);
-
- case UCA_PROP_Y_OFFSET:
- return grabber->get_property(grabber, UCA_PROP_Y_OFFSET, (uint32_t *) data);
-
- case UCA_PROP_DELAY:
- pco_get_delay_time(pco, (uint32_t *) data);
- break;
-
- case UCA_PROP_DELAY_MIN:
- {
- uint32_t dummy1, dummy2;
- pco_get_delay_range(pco, (uint32_t *) data, &dummy1, &dummy2);
- }
- break;
-
- case UCA_PROP_DELAY_MAX:
- {
- uint32_t dummy1, dummy2;
- pco_get_delay_range(pco, &dummy1, (uint32_t *) data, &dummy2);
- }
- break;
-
- case UCA_PROP_EXPOSURE:
- pco_get_exposure_time(pco, (uint32_t *) data);
- break;
-
- case UCA_PROP_EXPOSURE_MIN:
- {
- uint32_t dummy1, dummy2;
- pco_get_exposure_range(pco, (uint32_t *) data, &dummy1, &dummy2);
- }
- break;
-
- case UCA_PROP_EXPOSURE_MAX:
- {
- uint32_t dummy1, dummy2;
- pco_get_exposure_range(pco, &dummy1, (uint32_t *) data, &dummy2);
- }
- break;
-
- case UCA_PROP_BITDEPTH:
- uca_set_void(data, uint32_t, 16);
- break;
-
- case UCA_PROP_GRAB_AUTO:
- {
- int value = 0;
- uint32_t err = pco_get_auto_transfer(pco, &value);
- if (err != PCO_NOERROR)
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
- uca_set_void(data, uint32_t, value);
- }
- break;
-
- case UCA_PROP_GRAB_TIMEOUT:
- {
- uint32_t timeout;
- uint32_t err = cam->grabber->get_property(cam->grabber, UCA_PROP_GRAB_TIMEOUT, &timeout);
- if (err != UCA_NO_ERROR)
- return err;
- uca_set_void(data, uint32_t, timeout);
- }
- break;
-
- default:
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
- }
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pco_start_recording(struct uca_camera_priv *cam)
-{
- uint32_t err = UCA_ERR_CAMERA | UCA_ERR_INIT;
- pco_handle pco = GET_PCO(cam);
-
- if (GET_PCO_DESC(cam)->type == CAMERATYPE_PCO_DIMAX_STD)
- pco_clear_active_segment(pco);
-
- if (pco_arm_camera(pco) != PCO_NOERROR)
- return err | UCA_ERR_UNCLASSIFIED;
-
- if (pco_start_recording(pco) != PCO_NOERROR)
- return err | UCA_ERR_UNCLASSIFIED;
-
- return cam->grabber->acquire(cam->grabber, -1);
-}
-
-static uint32_t uca_pco_stop_recording(struct uca_camera_priv *cam)
-{
- if (pco_stop_recording(GET_PCO(cam)) != PCO_NOERROR)
- return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_UNCLASSIFIED;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pco_trigger(struct uca_camera_priv *cam)
-{
- /* TODO: is this correct? */
- uint32_t success = 0;
- pco_force_trigger(GET_PCO(cam), &success);
- return cam->grabber->trigger(cam->grabber);
-}
-
-static uint32_t uca_pco_grab(struct uca_camera_priv *cam, char *buffer, void *meta_data)
-{
- uint16_t *frame;
- pco_desc_t *pco_d = GET_PCO_DESC(cam);
- pco_handle pco = pco_d->pco;
-
- if (cam->state == UCA_CAM_READOUT) {
- if (pco_d->current_image == pco_d->num_recorded_images)
- return UCA_ERR_NO_MORE_IMAGES;
-
- /* Ok, this is pco's way of requesting multiple frames... you have to do
- * it one by one :/ */
- pco_read_images(pco, pco_d->active_segment, pco_d->current_image, pco_d->current_image);
- pco_d->current_image++;
- }
-
- pco_request_image(GET_PCO(cam));
- uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
- if (err != UCA_NO_ERROR)
- return err;
-
- /* Copy data into user buffer */
- if (pco_d->type == CAMERATYPE_PCO_EDGE)
- pco_get_reorder_func(GET_PCO(cam))((uint16_t *) buffer, frame, cam->frame_width, cam->frame_height);
- else
- memcpy(buffer, (char *) frame, cam->frame_width * cam->frame_height * 2);
-
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pco_readout(struct uca_camera_priv *cam)
-{
- pco_desc_t *pco_d = GET_PCO_DESC(cam);
- /* TODO: error handling */
- pco_handle pco = GET_PCO(cam);
- pco_get_active_segment(pco, &pco_d->active_segment);
- pco_get_num_images(pco, pco_d->active_segment, &pco_d->num_recorded_images);
- pco_d->current_image = 1;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pco_register_callback(struct uca_camera_priv *cam, uca_cam_grab_callback callback, void *user)
-{
- if (cam->callback == NULL) {
- cam->callback = callback;
- cam->callback_user = user;
- return cam->grabber->register_callback(cam->grabber, callback, NULL, user);
- }
- return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED;
-}
-
-uint32_t uca_pco_init(struct uca_camera_priv **cam, struct uca_grabber_priv *grabber)
-{
- uint32_t err = UCA_ERR_CAMERA | UCA_ERR_INIT;
- if (grabber == NULL)
- return err | UCA_ERR_NOT_FOUND;
-
- pco_handle pco = pco_init();
- if (pco == NULL)
- return err | UCA_ERR_NOT_FOUND;
-
- if (!pco_is_active(pco)) {
- pco_destroy(pco);
- return err | UCA_ERR_NOT_FOUND;
- }
-
- struct uca_camera_priv *uca = uca_cam_new();
-
- /* Prepare user data */
- struct pco_desc *pco_d = (struct pco_desc *) malloc(sizeof(struct pco_desc));
- uca->user = pco_d;
- pco_d->pco = pco;
- pco_get_camera_type(pco, &pco_d->type, &pco_d->subtype);
-
- uca->grabber = grabber;
- uca->grabber->synchronous = true;
-
- /* Camera found, set function pointers... */
- uca->destroy = &uca_pco_destroy;
- uca->set_property = &uca_pco_set_property;
- uca->get_property = &uca_pco_get_property;
- uca->start_recording = &uca_pco_start_recording;
- uca->stop_recording = &uca_pco_stop_recording;
- uca->trigger = &uca_pco_trigger;
- uca->grab = &uca_pco_grab;
- uca->readout = &uca_pco_readout;
- uca->register_callback = &uca_pco_register_callback;
-
- /* Prepare camera for recording */
- if (pco_d->type == CAMERATYPE_PCO_EDGE)
- pco_set_scan_mode(pco, PCO_SCANMODE_SLOW);
-
- pco_stop_recording(pco);
- pco_set_timestamp_mode(pco, TIMESTAMP_MODE_ASCII);
- /* pco_set_timebase(pco, 1, 1); */
- /* pco_arm_camera(pco); */
-
- /* Prepare frame grabber for recording */
- int val = 0;
-
- switch (pco_d->type) {
- case CAMERATYPE_PCO_EDGE:
- val = UCA_CL_8BIT_FULL_10;
- break;
- case CAMERATYPE_PCO_DIMAX_STD:
- val = UCA_CL_SINGLE_TAP_8;
- break;
- case CAMERATYPE_PCO4000:
- val = UCA_CL_SINGLE_TAP_16;
- break;
- default:
- break;
- }
- grabber->set_property(grabber, UCA_GRABBER_CAMERALINK_TYPE, &val);
-
- val = 0;
- switch (pco_d->type) {
- case CAMERATYPE_PCO_EDGE:
- val = UCA_FORMAT_GRAY8;
- break;
- case CAMERATYPE_PCO_DIMAX_STD:
- case CAMERATYPE_PCO4000:
- val = UCA_FORMAT_GRAY16;
- break;
- default:
- break;
- }
- grabber->set_property(grabber, UCA_GRABBER_FORMAT, &val);
-
- val = UCA_TRIGGER_AUTO;
- grabber->set_property(grabber, UCA_GRABBER_TRIGGER_MODE, &val);
-
- uint16_t width_std, height_std, width_ex, height_ex;
- pco_get_resolution(pco, &width_std, &height_std, &width_ex, &height_ex);
-
- uint32_t width = width_std, height = height_std;
- uca->frame_width = width;
- uca->frame_height = height;
- pco_d->roi[0] = pco_d->roi[1] = 1;
- pco_d->roi[2] = width;
- pco_d->roi[3] = height;
-
- /* Yes, we really have to take an image twice as large because we set the
- * CameraLink interface to 8-bit 10 Taps, but are actually using 5x16 bits. */
- if (pco_d->type == CAMERATYPE_PCO_EDGE)
- width *= 2;
- grabber->set_property(grabber, UCA_PROP_WIDTH, &width);
- grabber->set_property(grabber, UCA_PROP_HEIGHT, &height);
-
- uca->state = UCA_CAM_CONFIGURABLE;
- *cam = uca;
-
- return UCA_NO_ERROR;
-}
diff --git a/src/cameras/pco.h b/src/cameras/pco.h
deleted file mode 100644
index 4d1a2b4..0000000
--- a/src/cameras/pco.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_PCO_H
-#define __UNIFIED_CAMERA_ACCESS_PCO_H
-
-uint32_t uca_pco_init(struct uca_camera_priv **uca, struct uca_grabber_priv *grabber);
-
-#endif
diff --git a/src/cameras/pf.c b/src/cameras/pf.c
deleted file mode 100644
index 829b94a..0000000
--- a/src/cameras/pf.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libpf/pfcam.h>
-#include "uca.h"
-#include "uca-cam.h"
-#include "uca-grabber.h"
-
-struct uca_pf_map {
- uca_property_ids uca_prop;
- const char *pf_prop;
-};
-
-static struct uca_pf_map uca_to_pf[] = {
- { UCA_PROP_NAME, "CameraName" },
- { UCA_PROP_WIDTH, "Window.W" },
- { UCA_PROP_WIDTH_MIN, "Window.W.Min" },
- { UCA_PROP_WIDTH_MAX, "Window.W.Max" },
- { UCA_PROP_HEIGHT, "Window.H" },
- { UCA_PROP_HEIGHT_MIN, "Window.H.Min" },
- { UCA_PROP_HEIGHT_MAX, "Window.H.Max" },
- { UCA_PROP_X_OFFSET, "Window.X" },
- { UCA_PROP_X_OFFSET_MIN,"Window.X.Min" },
- { UCA_PROP_X_OFFSET_MAX,"Window.X.Max" },
- { UCA_PROP_Y_OFFSET, "Window.Y" },
- { UCA_PROP_Y_OFFSET_MIN,"Window.Y.Min" },
- { UCA_PROP_Y_OFFSET_MAX,"Window.Y.Max" },
- { UCA_PROP_EXPOSURE, "ExposureTime" },
- { UCA_PROP_EXPOSURE_MIN,"ExposureTime.Min" },
- { UCA_PROP_EXPOSURE_MAX,"ExposureTime.Max" },
- { UCA_PROP_DELAY, "Trigger.Delay" },
- { UCA_PROP_DELAY_MIN, "Trigger.Delay.Min" },
- { UCA_PROP_DELAY_MAX, "Trigger.Delay.Max" },
- { UCA_PROP_FRAMERATE, "FrameRate" },
- { UCA_PROP_TRIGGER_MODE,"Trigger.Source" },
- { -1, NULL }
-};
-
-static int uca_pf_set_uint32_property(TOKEN token, void *data, uint32_t *update_var)
-{
- PFValue value;
- value.type = PF_INT;
- value.value.i = *((uint32_t *) data);
- if (update_var != NULL)
- *update_var = value.value.i;
- return pfDevice_SetProperty(0, token, &value);
-}
-
-static uint32_t uca_pf_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
-{
- struct uca_grabber_priv *grabber = cam->grabber;
- TOKEN token = INVALID_TOKEN;
- int i = 0;
- int err = UCA_NO_ERROR;
-
- /* We try to set the property on the grabber. If it returns "invalid", we
- * also try it via the PF SDK. Else, there was a more serious error.
- *
- * FIXME: This is actually not that good for cases where only the grabber
- * should set a certain property and the camera itself is not able to do so. */
- err = grabber->set_property(grabber, property, data);
- if (((err & UCA_ERR_MASK_CODE) == UCA_ERR_INVALID) || (err == UCA_NO_ERROR))
- err = UCA_ERR_CAMERA | UCA_ERR_PROP;
- else
- return err;
-
- /* Find a valid pf token for the property */
- while (uca_to_pf[i].uca_prop != -1) {
- if (uca_to_pf[i].uca_prop == property) {
- token = pfProperty_ParseName(0, uca_to_pf[i].pf_prop);
- break;
- }
- i++;
- }
- if (token == INVALID_TOKEN)
- return err | UCA_ERR_INVALID;
-
- PFValue value;
-
- switch (property) {
- case UCA_PROP_WIDTH:
- if (uca_pf_set_uint32_property(token, data, &cam->frame_width) < 0)
- return err | UCA_ERR_OUT_OF_RANGE;
- break;
-
- case UCA_PROP_HEIGHT:
- if (uca_pf_set_uint32_property(token, data, &cam->frame_height) < 0)
- return err | UCA_ERR_OUT_OF_RANGE;
- break;
-
- case UCA_PROP_EXPOSURE:
- /* I haven't found a specification but it looks like PF uses milli
- * seconds. We also by-pass the frame grabber... */
- value.type = PF_FLOAT;
- value.value.f = (float) *((uint32_t *) data) / 1000.0;
- if (pfDevice_SetProperty(0, token, &value) < 0)
- return err | UCA_ERR_OUT_OF_RANGE;
- break;
-
- default:
- return err | UCA_ERR_INVALID;
- }
- return UCA_NO_ERROR;
-}
-
-
-static uint32_t uca_pf_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
-{
- TOKEN t; /* You gotta love developers who name types capitalized... */
- PFValue value;
-
- /* Handle all special cases */
- switch (property) {
- case UCA_PROP_BITDEPTH:
- uca_set_void(data, uint32_t, 8);
- return UCA_NO_ERROR;
-
- default:
- break;
- }
-
- int i = 0;
- while (uca_to_pf[i].uca_prop != -1) {
- if (uca_to_pf[i].uca_prop == property) {
- t = pfProperty_ParseName(0, uca_to_pf[i].pf_prop);
- if (t == INVALID_TOKEN || (pfDevice_GetProperty(0, t, &value) < 0))
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
-
- switch (value.type) {
- case PF_INT:
- uca_set_void(data, uint32_t, value.value.i);
- break;
-
- case PF_FLOAT:
- uca_set_void(data, uint32_t, (uint32_t) floor((value.value.f * 1000.0)+0.5));
- break;
-
- case PF_STRING:
- if (property == UCA_PROP_FRAMERATE) {
- uca_set_void(data, uint32_t, (uint32_t) floor(atof(value.value.p)+0.5));
- }
- else {
- strncpy((char *) data, value.value.p, num);
- }
- break;
-
- case PF_MODE:
- uca_set_void(data, uint32_t, (uint32_t) value.value.i);
- break;
-
- default:
- break;
- }
- return UCA_NO_ERROR;
- }
- i++;
- }
-
- /* Try to get the property via frame grabber */
- return cam->grabber->get_property(cam->grabber, property, data);
-}
-
-static uint32_t uca_pf_start_recording(struct uca_camera_priv *cam)
-{
- return cam->grabber->acquire(cam->grabber, -1);
-}
-
-static uint32_t uca_pf_stop_recording(struct uca_camera_priv *cam)
-{
- return cam->grabber->stop_acquire(cam->grabber);
-}
-
-static uint32_t uca_pf_trigger(struct uca_camera_priv *cam)
-{
- return cam->grabber->trigger(cam->grabber);
-}
-
-static uint32_t uca_pf_grab(struct uca_camera_priv *cam, char *buffer, void *metadata)
-{
- uint16_t *frame;
- uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
- if (err != UCA_NO_ERROR)
- return err;
-
- memcpy(buffer, frame, cam->frame_width*cam->frame_height);
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_pf_register_callback(struct uca_camera_priv *cam, uca_cam_grab_callback callback, void *user)
-{
- if (cam->callback == NULL) {
- cam->callback = callback;
- cam->callback_user = user;
- return cam->grabber->register_callback(cam->grabber, callback, NULL, user);
- }
- return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED;
-}
-
-static uint32_t uca_pf_destroy(struct uca_camera_priv *cam)
-{
- pfDeviceClose(0);
- return UCA_NO_ERROR;
-}
-
-uint32_t uca_pf_init(struct uca_camera_priv **cam, struct uca_grabber_priv *grabber)
-{
- int num_ports;
- if ((grabber == NULL) || (pfPortInit(&num_ports) < 0) || (pfDeviceOpen(0) < 0))
- return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_NOT_FOUND;
-
- /* We could check if a higher baud rate is supported, but... forget about
- * it. We don't need high speed configuration. */
-
- struct uca_camera_priv *uca = uca_cam_new();
- uca->grabber = grabber;
- uca->grabber->synchronous = false;
-
- /* Camera found, set function pointers... */
- uca->destroy = &uca_pf_destroy;
- uca->set_property = &uca_pf_set_property;
- uca->get_property = &uca_pf_get_property;
- uca->start_recording = &uca_pf_start_recording;
- uca->stop_recording = &uca_pf_stop_recording;
- uca->trigger = &uca_pf_trigger;
- uca->grab = &uca_pf_grab;
- uca->register_callback = &uca_pf_register_callback;
-
- /* Prepare frame grabber for recording */
- int val = UCA_CL_8BIT_FULL_8;
- grabber->set_property(grabber, UCA_GRABBER_CAMERALINK_TYPE, &val);
-
- val = UCA_FORMAT_GRAY8;
- grabber->set_property(grabber, UCA_GRABBER_FORMAT, &val);
-
- val = UCA_TRIGGER_AUTO;
- grabber->set_property(grabber, UCA_GRABBER_TRIGGER_MODE, &val);
-
- uca_pf_get_property(uca, UCA_PROP_WIDTH, &uca->frame_width, 0);
- uca_pf_get_property(uca, UCA_PROP_HEIGHT, &uca->frame_height, 0);
-
- grabber->set_property(grabber, UCA_PROP_WIDTH, &uca->frame_width);
- grabber->set_property(grabber, UCA_PROP_HEIGHT, &uca->frame_height);
-
- uca->state = UCA_CAM_CONFIGURABLE;
- *cam = uca;
-
- return UCA_NO_ERROR;
-}
diff --git a/src/cameras/pf.h b/src/cameras/pf.h
deleted file mode 100644
index 74efbe5..0000000
--- a/src/cameras/pf.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_PHOTON_H
-#define __UNIFIED_CAMERA_ACCESS_PHOTON_H
-
-uint32_t uca_pf_init(struct uca_camera_priv **uca, struct uca_grabber_priv *grabber);
-
-#endif
diff --git a/src/cameras/simple.c b/src/cameras/simple.c
deleted file mode 100644
index 9b8be9a..0000000
--- a/src/cameras/simple.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include "uca.h"
-#include "uca-cam.h"
-#include "uca-grabber.h"
-
-
-static uint32_t uca_simple_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data)
-{
- struct uca_grabber_priv *grabber = cam->grabber;
- int err = UCA_NO_ERROR;
-
- /* We try to set the property on the grabber. If it returns "invalid", we
- * also try it via the PF SDK. Else, there was a more serious error.
- *
- * FIXME: This is actually not that good for cases where only the grabber
- * should set a certain property and the camera itself is not able to do so. */
- err = grabber->set_property(grabber, property, data);
- if (((err & UCA_ERR_MASK_CODE) == UCA_ERR_INVALID) || (err == UCA_NO_ERROR))
- err = UCA_ERR_CAMERA | UCA_ERR_PROP;
- else
- return err;
-
- return UCA_NO_ERROR;
-}
-
-
-static uint32_t uca_simple_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num)
-{
- struct uca_grabber_priv *grabber = cam->grabber;
- uint32_t value32 = 0;
-
- /* Handle all special cases */
- switch (property) {
- case UCA_PROP_NAME:
- strncpy((char *) data, "Simple Framegrabber Access", num);
- break;
-
- case UCA_PROP_WIDTH:
- grabber->get_property(grabber, UCA_PROP_WIDTH, &value32);
- uca_set_void(data, uint32_t, value32);
- break;
-
- case UCA_PROP_HEIGHT:
- grabber->get_property(grabber, UCA_PROP_HEIGHT, &value32);
- uca_set_void(data, uint32_t, value32);
- break;
-
- case UCA_PROP_X_OFFSET:
- grabber->get_property(grabber, UCA_PROP_X_OFFSET, &value32);
- uca_set_void(data, uint32_t, value32);
- break;
-
- case UCA_PROP_Y_OFFSET:
- grabber->get_property(grabber, UCA_PROP_Y_OFFSET, &value32);
- uca_set_void(data, uint32_t, value32);
- break;
-
- case UCA_PROP_BITDEPTH:
- uca_set_void(data, uint32_t, 8);
- return UCA_NO_ERROR;
-
- default:
- break;
- }
-
- /* Try to get the property via frame grabber */
- return cam->grabber->get_property(cam->grabber, property, data);
-}
-
-static uint32_t uca_simple_start_recording(struct uca_camera_priv *cam)
-{
- return cam->grabber->acquire(cam->grabber, -1);
-}
-
-static uint32_t uca_simple_stop_recording(struct uca_camera_priv *cam)
-{
- return cam->grabber->stop_acquire(cam->grabber);
-}
-
-static uint32_t uca_simple_trigger(struct uca_camera_priv *cam)
-{
- return cam->grabber->trigger(cam->grabber);
-}
-
-static uint32_t uca_simple_grab(struct uca_camera_priv *cam, char *buffer, void *metadata)
-{
- uint16_t *frame;
- uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
- if (err != UCA_NO_ERROR)
- return err;
-
- memcpy(buffer, frame, cam->frame_width*cam->frame_height);
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_simple_register_callback(struct uca_camera_priv *cam, uca_cam_grab_callback callback, void *user)
-{
- if (cam->callback == NULL) {
- cam->callback = callback;
- cam->callback_user = user;
- return cam->grabber->register_callback(cam->grabber, callback, NULL, user);
- }
- return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED;
-}
-
-static uint32_t uca_simple_destroy(struct uca_camera_priv *cam)
-{
- return UCA_NO_ERROR;
-}
-
-uint32_t uca_simple_init(struct uca_camera_priv **cam, struct uca_grabber_priv *grabber)
-{
- if (grabber == NULL)
- return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_NOT_FOUND;
-
- struct uca_camera_priv *uca = uca_cam_new();
- uca->grabber = grabber;
- uca->grabber->synchronous = false;
-
- /* Camera found, set function pointers... */
- uca->destroy = &uca_simple_destroy;
- uca->set_property = &uca_simple_set_property;
- uca->get_property = &uca_simple_get_property;
- uca->start_recording = &uca_simple_start_recording;
- uca->stop_recording = &uca_simple_stop_recording;
- uca->trigger = &uca_simple_trigger;
- uca->grab = &uca_simple_grab;
- uca->register_callback = &uca_simple_register_callback;
-
- /* Prepare frame grabber for recording */
- int val = UCA_CL_8BIT_FULL_8;
- grabber->set_property(grabber, UCA_GRABBER_CAMERALINK_TYPE, &val);
-
- val = UCA_FORMAT_GRAY8;
- grabber->set_property(grabber, UCA_GRABBER_FORMAT, &val);
-
- val = UCA_TRIGGER_AUTO;
- grabber->set_property(grabber, UCA_GRABBER_TRIGGER_MODE, &val);
-
- grabber->get_property(grabber, UCA_PROP_WIDTH, &uca->frame_width);
- grabber->get_property(grabber, UCA_PROP_HEIGHT, &uca->frame_height);
-
- uca->state = UCA_CAM_CONFIGURABLE;
- *cam = uca;
-
- return UCA_NO_ERROR;
-}
diff --git a/src/cameras/simple.h b/src/cameras/simple.h
deleted file mode 100644
index 6d8e45e..0000000
--- a/src/cameras/simple.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_SIMPLE_H
-#define __UNIFIED_CAMERA_ACCESS_SIMPLE_H
-
-uint32_t uca_simple_init(struct uca_camera_priv **uca, struct uca_grabber_priv *grabber);
-
-#endif
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
deleted file mode 100644
index 08abef6..0000000
--- a/src/grabbers/me4.c
+++ /dev/null
@@ -1,294 +0,0 @@
-
-#include <stdlib.h>
-#include <string.h>
-#include <clser.h>
-#include <fgrab_struct.h>
-#include <fgrab_prototyp.h>
-
-#include "uca.h"
-#include "uca-grabber.h"
-
-struct fg_apc_data {
- Fg_Struct *fg;
- dma_mem *mem;
- uint32_t timeout;
-
- /* End-user related callback variables */
- uca_cam_grab_callback callback;
- void *meta_data;
- void *user;
-};
-
-struct uca_sisofg_map_t {
- enum uca_grabber_constants uca_prop;
- int fg_id;
- bool interpret_data; /**< is data a constant or a value? */
-};
-
-static struct uca_sisofg_map_t uca_to_fg[] = {
- /* properties */
- { UCA_PROP_WIDTH, FG_WIDTH, false },
- { UCA_PROP_HEIGHT, FG_HEIGHT, false },
- { UCA_PROP_X_OFFSET, FG_XOFFSET, false },
- { UCA_PROP_Y_OFFSET, FG_YOFFSET, false },
- { UCA_PROP_EXPOSURE, FG_EXPOSURE, false },
- { UCA_PROP_GRAB_TIMEOUT, FG_TIMEOUT, false },
-
- { UCA_GRABBER_TRIGGER_MODE, FG_TRIGGERMODE, true },
- { UCA_GRABBER_FORMAT, FG_FORMAT, true },
- { UCA_GRABBER_CAMERALINK_TYPE, FG_CAMERA_LINK_CAMTYP, true },
-
- /* values */
- { UCA_FORMAT_GRAY8, FG_GRAY, false },
- { UCA_FORMAT_GRAY16, FG_GRAY16, false },
- { UCA_CL_SINGLE_TAP_8, FG_CL_SINGLETAP_8_BIT, false },
- { UCA_CL_SINGLE_TAP_16, FG_CL_SINGLETAP_16_BIT, false },
- { UCA_CL_8BIT_FULL_8, FG_CL_8BIT_FULL_8, false },
- { UCA_CL_8BIT_FULL_10, FG_CL_8BIT_FULL_10, false },
- { UCA_TRIGGER_AUTO, FREE_RUN, false },
- { UCA_TRIGGER_SOFTWARE, ASYNC_SOFTWARE_TRIGGER, false },
- { UCA_TRIGGER_EXTERNAL, ASYNC_TRIGGER, false },
- { UCA_GRABBER_INVALID, 0, false }
-};
-
-#define GET_FG(grabber) (((struct fg_apc_data *) grabber->user)->fg)
-#define GET_MEM(grabber) (((struct fg_apc_data *) grabber->user)->mem)
-
-static uint32_t uca_me4_destroy(struct uca_grabber_priv *grabber)
-{
- if (grabber != NULL) {
- Fg_FreeMemEx(GET_FG(grabber), GET_MEM(grabber));
- Fg_FreeGrabber(GET_FG(grabber));
- }
- return UCA_NO_ERROR;
-}
-
-static struct uca_sisofg_map_t *uca_me4_find_fg_property(enum uca_grabber_constants property)
-{
- int i = 0;
- /* Find a valid frame grabber id for the property */
- while (uca_to_fg[i].uca_prop != UCA_GRABBER_INVALID) {
- if (uca_to_fg[i].uca_prop == property)
- return &uca_to_fg[i];
- i++;
- }
- return NULL;
-}
-
-static struct uca_sisofg_map_t *uca_me4_find_uca_property(int fg_id)
-{
- int i = 0;
- /* Find a valid frame grabber id for the property */
- while (uca_to_fg[i].fg_id != 0) {
- if (uca_to_fg[i].fg_id == fg_id)
- return &uca_to_fg[i];
- i++;
- }
- return NULL;
-}
-
-static uint32_t uca_me4_set_property(struct uca_grabber_priv *grabber, int32_t property, void *data)
-{
- /* Handle all properties not related specifically to the me4 */
- union uca_value *v = (union uca_value *) data;
- switch (property) {
- case UCA_PROP_GRAB_TIMEOUT:
- ((struct fg_apc_data *) grabber->user)->timeout = v->u32;
- break;
-
- case UCA_PROP_GRAB_SYNCHRONOUS:
- grabber->synchronous = v->u32 != 0;
- return UCA_NO_ERROR;
-
- default:
- break;
- }
-
- /* Try to find a matching me4 property */
- uint32_t err = UCA_ERR_GRABBER | UCA_ERR_PROP;
- struct uca_sisofg_map_t *fg_prop = uca_me4_find_fg_property(property);
- if (fg_prop == NULL)
- return err | UCA_ERR_INVALID;
-
- if (fg_prop->interpret_data) {
- /* Data is not a value but a SiSo specific constant that we need to
- * translate to Silicon Software speak. Therefore, we try to find it in
- * the map. */
- struct uca_sisofg_map_t *constant = uca_me4_find_fg_property(*((uint32_t *) data));
- if (constant != NULL)
- return Fg_setParameter(GET_FG(grabber), fg_prop->fg_id, &constant->fg_id, PORT_A) == FG_OK ? \
- UCA_NO_ERROR : err | UCA_ERR_INVALID;
- return err | UCA_ERR_INVALID;
- }
- else
- return Fg_setParameter(GET_FG(grabber), fg_prop->fg_id, data, PORT_A) == FG_OK ? \
- UCA_NO_ERROR : err | UCA_ERR_INVALID;
-}
-
-static uint32_t uca_me4_get_property(struct uca_grabber_priv *grabber, int32_t property, void *data)
-{
- switch (property) {
- case UCA_PROP_GRAB_SYNCHRONOUS:
- *((uint32_t *) data) = grabber->synchronous ? 1 : 0;
- return UCA_NO_ERROR;
-
- default:
- break;
- }
-
- uint32_t err = UCA_ERR_GRABBER | UCA_ERR_PROP;
- struct uca_sisofg_map_t *fg_prop = uca_me4_find_fg_property(property);
- if (fg_prop == NULL)
- return err | UCA_ERR_INVALID;
-
- if (fg_prop->interpret_data) {
- int constant;
- if (Fg_getParameter(GET_FG(grabber), fg_prop->fg_id, &constant, PORT_A) != FG_OK)
- return err | UCA_ERR_INVALID;
-
- /* Try to find the constant value */
- struct uca_sisofg_map_t *uca_prop = uca_me4_find_uca_property(constant);
- if (uca_prop == NULL)
- return err | UCA_ERR_INVALID;
-
- *((uint32_t *) data) = uca_prop->uca_prop;
- return UCA_NO_ERROR;
- }
-
- return Fg_getParameter(GET_FG(grabber), fg_prop->fg_id, data, PORT_A) == FG_OK ? \
- UCA_NO_ERROR : err | UCA_ERR_INVALID;
-}
-
-static uint32_t uca_me4_alloc(struct uca_grabber_priv *grabber, uint32_t pixel_size, uint32_t n_buffers)
-{
- dma_mem *mem = GET_MEM(grabber);
- /* If buffers are already allocated, we are freeing every buffer and start
- * again. */
- if (mem != NULL)
- Fg_FreeMemEx(GET_FG(grabber), mem);
-
- uint32_t width, height;
- uca_me4_get_property(grabber, UCA_PROP_WIDTH, &width);
- uca_me4_get_property(grabber, UCA_PROP_HEIGHT, &height);
-
- mem = Fg_AllocMemEx(GET_FG(grabber), n_buffers*width*height*pixel_size, n_buffers);
- if (mem != NULL) {
- ((struct fg_apc_data *) grabber->user)->mem = mem;
- return UCA_NO_ERROR;
- }
- return UCA_ERR_GRABBER | UCA_ERR_NO_MEMORY;
-}
-
-static uint32_t uca_me4_acquire(struct uca_grabber_priv *grabber, int32_t n_frames)
-{
- if (GET_MEM(grabber) == NULL)
- return UCA_ERR_GRABBER | UCA_ERR_NO_MEMORY;
-
- n_frames = n_frames < 0 ? GRAB_INFINITE : n_frames;
- if (Fg_AcquireEx(GET_FG(grabber), 0, n_frames, ACQ_STANDARD, GET_MEM(grabber)) == FG_OK)
- return UCA_NO_ERROR;
-
- return UCA_ERR_GRABBER | UCA_ERR_ACQUIRE;
-}
-
-static uint32_t uca_me4_stop_acquire(struct uca_grabber_priv *grabber)
-{
- if (GET_MEM(grabber) != NULL)
- if (Fg_stopAcquireEx(GET_FG(grabber), 0, GET_MEM(grabber), STOP_SYNC) != FG_OK)
- return UCA_ERR_GRABBER | UCA_ERR_ACQUIRE;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_me4_trigger(struct uca_grabber_priv *grabber)
-{
- if (Fg_sendSoftwareTrigger(GET_FG(grabber), PORT_A) != FG_OK)
- return UCA_ERR_GRABBER | UCA_ERR_TRIGGER;
- return UCA_NO_ERROR;
-}
-
-static uint32_t uca_me4_grab(struct uca_grabber_priv *grabber, void **buffer, uint64_t *frame_number)
-{
- static frameindex_t last_frame = 0;
- struct fg_apc_data *me4 = (struct fg_apc_data *) grabber->user;
-
- if (grabber->synchronous)
- last_frame = Fg_getLastPicNumberBlockingEx(me4->fg, last_frame+1, PORT_A, me4->timeout, me4->mem);
- else
- last_frame = Fg_getLastPicNumberEx(me4->fg, PORT_A, me4->mem);
-
- if (last_frame <= 0) {
- *buffer = NULL;
- return UCA_ERR_GRABBER | UCA_ERR_FRAME_TRANSFER;
- }
-
- *frame_number = (uint64_t) last_frame;
- *buffer = Fg_getImagePtrEx(me4->fg, last_frame, PORT_A, me4->mem);
- return UCA_NO_ERROR;
-}
-
-static int uca_me4_callback(frameindex_t frame, struct fg_apc_data *apc)
-{
- apc->callback(frame, Fg_getImagePtrEx(apc->fg, frame, PORT_A, apc->mem), apc->meta_data, apc->user);
- return 0;
-}
-
-static uint32_t uca_me4_register_callback(struct uca_grabber_priv *grabber, uca_cam_grab_callback callback, void *meta_data, void *user)
-{
- if (GET_MEM(grabber) == NULL)
- return UCA_ERR_GRABBER | UCA_ERR_CALLBACK | UCA_ERR_NO_MEMORY;
-
- if (grabber->callback == NULL) {
- grabber->callback = callback;
-
- struct fg_apc_data *apc_data = (struct fg_apc_data *) grabber->user;
- apc_data->callback = callback;
- apc_data->meta_data = meta_data;
- apc_data->user = user;
-
- struct FgApcControl ctrl;
- ctrl.version = 0;
- ctrl.data = (struct fg_apc_data *) grabber->user;
- ctrl.func = &uca_me4_callback;
- ctrl.flags = FG_APC_DEFAULTS;
- ctrl.timeout = 1;
-
- if (Fg_registerApcHandler(GET_FG(grabber), PORT_A, &ctrl, FG_APC_CONTROL_BASIC) != FG_OK)
- return UCA_ERR_GRABBER | UCA_ERR_CALLBACK;
- }
- else
- return UCA_ERR_GRABBER | UCA_ERR_CALLBACK;
-
- return UCA_NO_ERROR;
-}
-
-uint32_t uca_me4_init(struct uca_grabber_priv **grabber)
-{
- /* Fg_Struct *fg = Fg_Init("libFullAreaGray8.so", 0); */
- Fg_Struct *fg = Fg_Init("libDualAreaGray16.so", 0);
- if (fg == NULL)
- return UCA_ERR_GRABBER | UCA_ERR_NOT_FOUND;
-
- struct uca_grabber_priv *uca = (struct uca_grabber_priv *) malloc(sizeof(struct uca_grabber_priv));
- memset(uca, 0, sizeof(struct uca_grabber_priv));
-
- struct fg_apc_data *me4 = (struct fg_apc_data *) malloc(sizeof(struct fg_apc_data));
- memset(me4, 0, sizeof(struct fg_apc_data));
- me4->fg = fg;
-
- Fg_getParameter(fg, FG_TIMEOUT, &me4->timeout, PORT_A);
-
- me4->timeout = 4;
- uca->user = me4;
- uca->destroy = &uca_me4_destroy;
- uca->set_property = &uca_me4_set_property;
- uca->get_property = &uca_me4_get_property;
- uca->alloc = &uca_me4_alloc;
- uca->acquire = &uca_me4_acquire;
- uca->stop_acquire = &uca_me4_stop_acquire;
- uca->trigger = &uca_me4_trigger;
- uca->grab = &uca_me4_grab;
- uca->register_callback = &uca_me4_register_callback;
-
- *grabber = uca;
- return UCA_NO_ERROR;
-}
diff --git a/src/grabbers/me4.h b/src/grabbers/me4.h
deleted file mode 100644
index 96a596b..0000000
--- a/src/grabbers/me4.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __UNIFIED_CAMERA_ACCESS_ME4_H
-#define __UNIFIED_CAMERA_ACCESS_ME4_H
-
-uint32_t uca_me4_init(struct uca_grabber_priv **grabber);
-
-#endif
diff --git a/src/uca-cam.c b/src/uca-cam.c
deleted file mode 100644
index 64d35d6..0000000
--- a/src/uca-cam.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 <stdlib.h>
-#include <string.h>
-#include "uca.h"
-#include "uca-cam.h"
-#include "uca-grabber.h"
-
-
-struct uca_camera_priv *uca_cam_new(void)
-{
- struct uca_camera_priv *cam = (struct uca_camera_priv *) malloc(sizeof(struct uca_camera_priv));
-
- /* Set all function pointers to NULL so we know early on, if something has
- * not been implemented. */
- memset(cam, 0, sizeof(struct uca_camera_priv));
-
- cam->state = UCA_CAM_CONFIGURABLE;
- cam->current_frame = 0;
- return cam;
-}
diff --git a/src/uca-cam.h b/src/uca-cam.h
deleted file mode 100644
index 0e07c29..0000000
--- a/src/uca-cam.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_CAM_H
-#define __UNIFIED_CAMERA_ACCESS_CAM_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file uca-cam.h
- * \brief Abstract camera model
- *
- * The uca_camera_priv_t structure represents a common interface for cameras regardless of
- * their connectivity. Each camera that adheres to this model must provide an
- * initialization function implementing uca_cam_init() that probes the device
- * and sets all function pointers to their respective implementations.
- */
-
-enum uca_property_ids;
-
-/*
- * --- non-virtual methods ----------------------------------------------------
- */
-typedef uint32_t (*uca_cam_init) (struct uca_camera_priv **cam, struct uca_grabber_priv *grabber);
-
-/**
- * Allocates memory for a new uca_camera_priv structure and initializes all fields to
- * sane values.
- *
- * \return Pointer to block of memory for a uca_camera_priv structure
- *
- * \note This is is a utility function used internally by drivers
- */
-struct uca_camera_priv *uca_cam_new(void);
-
-/**
- * Represents a camera abstraction, that concrete cameras must implement.
- */
-typedef struct uca_camera_priv {
- /**
- * \see ufo_destroy()
- */
- uint32_t (*destroy) (struct uca_camera_priv *cam);
-
- /**
- * \see ufo_cam_set_property()
- */
- uint32_t (*set_property) (struct uca_camera_priv *cam, uca_property_ids property, void *data);
-
- /**
- * \see ufo_cam_get_property()
- */
- uint32_t (*get_property) (struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num);
-
- /**
- * \see ufo_cam_start_recording()
- */
- uint32_t (*start_recording) (struct uca_camera_priv *cam);
-
- /**
- * \see ufo_cam_stop_recording()
- */
- uint32_t (*stop_recording) (struct uca_camera_priv *cam);
-
- /**
- * \see ufo_cam_trigger()
- */
- uint32_t (*trigger) (struct uca_camera_priv *cam);
-
- /**
- * \see ufo_cam_register_callback()
- */
- uint32_t (*register_callback) (struct uca_camera_priv *cam, uca_cam_grab_callback callback, void *user);
-
- /**
- * \see ufo_cam_release_buffer()
- */
- uint32_t (*release_buffer) (struct uca_camera_priv *cam, void *buffer);
-
- /**
- * \see ufo_cam_grab()
- */
- uint32_t (*grab) (struct uca_camera_priv *cam, char *buffer, void *meta_data);
-
- /**
- * \see ufo_cam_readout()
- */
- uint32_t (*readout) (struct uca_camera_priv *cam);
-
- struct uca_grabber_priv *grabber; /**< grabber associated with this camera */
- uca_cam_state state; /**< camera state handled in uca.c */
- uint32_t frame_width; /**< current frame width */
- uint32_t frame_height; /**< current frame height */
- uint64_t current_frame; /**< last grabbed frame number */
-
- uca_cam_grab_callback callback;
- void *callback_user; /**< user data for callback */
-
- void *user; /**< private user data to be used by the camera driver */
-} uca_camera_priv_t;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/uca-grabber.c b/src/uca-grabber.c
deleted file mode 100644
index e69de29..0000000
--- a/src/uca-grabber.c
+++ /dev/null
diff --git a/src/uca-grabber.h b/src/uca-grabber.h
deleted file mode 100644
index 414b9ac..0000000
--- a/src/uca-grabber.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_GRABBER_H
-#define __UNIFIED_CAMERA_ACCESS_GRABBER_H
-
-#include <stdbool.h>
-#include "uca.h"
-#include "uca-cam.h"
-
-/**
- * \file uca-grabber.h
- * \brief Abstract frame grabber model
- */
-
-enum uca_grabber_constants {
- UCA_GRABBER_INVALID = -1,
-
- /* properties */
- UCA_GRABBER_FORMAT = UCA_PROP_LAST + 1,
- UCA_GRABBER_TRIGGER_MODE,
- UCA_GRABBER_CAMERALINK_TYPE,
-
- /* values */
- UCA_FORMAT_GRAY8,
- UCA_FORMAT_GRAY16,
-
- UCA_CL_SINGLE_TAP_8,
- UCA_CL_SINGLE_TAP_16,
- UCA_CL_8BIT_FULL_8,
- UCA_CL_8BIT_FULL_10
-};
-
-
-/*
- * --- virtual methods --------------------------------------------------------
- */
-
-/**
- * Camera probing and initialization.
- *
- * \return UCA_ERR_INIT_NOT_FOUND if grabber is not found or could not be initialized
- */
-typedef uint32_t (*uca_grabber_init) (struct uca_grabber_priv **grabber);
-
-/**
- * Free frame grabber resouces.
- */
-typedef uint32_t (*uca_grabber_destroy) (struct uca_grabber_priv *grabber);
-
-/**
- * Set a frame grabber property.
- *
- * \param[in] prop Name of the property as defined in uca_grabber_priv_constants
- *
- * \return UCA_ERR_PROP_INVALID if property is not supported on the frame
- * grabber or UCA_ERR_PROP_VALUE_OUT_OF_RANGE if value cannot be set.
- */
-typedef uint32_t (*uca_grabber_set_property) (struct uca_grabber_priv *grabber, enum uca_grabber_constants prop, void *data);
-
-/**
- * Get a frame grabber property.
- *
- * \param[in] prop Name of the property as defined in uca_grabber_priv_constants
- *
- * \return UCA_ERR_PROP_INVALID if property is not supported on the frame grabber
- */
-typedef uint32_t (*uca_grabber_get_property) (struct uca_grabber_priv *grabber, enum uca_grabber_constants prop, void *data);
-
-/**
- * Allocate buffers with current width, height and bitdepth.
- *
- * \warning Subsequent changes of width and height might corrupt memory.
- */
-typedef uint32_t (*uca_grabber_alloc) (struct uca_grabber_priv *grabber, uint32_t pixel_size, uint32_t n_buffers);
-
-/**
- * Begin acquiring frames.
- *
- * \param[in] n_frames Number of frames to acquire, -1 means infinite number
- *
- * \param[in] async Grab asynchronous if true
- */
-typedef uint32_t (*uca_grabber_acquire) (struct uca_grabber_priv *grabber, int32_t n_frames);
-
-/**
- * Stop acquiring frames.
- */
-typedef uint32_t (*uca_grabber_stop_acquire) (struct uca_grabber_priv *grabber);
-
-/**
- * Issue a software trigger signal.
- */
-typedef uint32_t (*uca_grabber_trigger) (struct uca_grabber_priv *grabber);
-
-/**
- * Grab a frame.
- *
- * This method is usually called through the camera interface and not directly.
- *
- * \param[in] buffer The pointer of the frame buffer is set here
- *
- * \param[out] frame_number Number of the grabbed frame
- */
-typedef uint32_t (*uca_grabber_grab) (struct uca_grabber_priv *grabber, void **buffer, uint64_t *frame_number);
-
-
-/**
- * Register callback for given frame grabber. To actually start receiving
- * frames, call uca_grabber_priv_acquire().
- *
- * \param[in] grabber The grabber for which the callback should be installed
- *
- * \param[in] cb Callback function for when a frame arrived
- */
-typedef uca_buffer_status (*uca_grabber_register_callback) (struct uca_grabber_priv *grabber, uca_cam_grab_callback cb, void *meta_data, void *user);
-
-
-/**
- * Represents a frame grabber abstraction, that concrete frame grabber
- * implementations must implement.
- *
- * A uca_grabber_priv_t structure is never used directly but only via the
- * uca_camera_t interface in order to keep certain duplicated properties in sync
- * (e.g. image dimensions can be set on frame grabber and camera).
- */
-typedef struct uca_grabber_priv {
- struct uca_grabber_priv *next;
-
- /* Function pointers to grabber-specific methods */
- uca_grabber_destroy destroy;
- uca_grabber_set_property set_property;
- uca_grabber_get_property get_property;
- uca_grabber_alloc alloc;
- uca_grabber_acquire acquire;
- uca_grabber_stop_acquire stop_acquire;
- uca_grabber_trigger trigger;
- uca_grabber_grab grab;
- uca_grabber_register_callback register_callback;
-
- /* Private */
- uca_cam_grab_callback callback;
- bool synchronous; /**< if true uca_grabber_priv_grab() blocks until image is transferred */
- void *user;
-} uca_grabber_priv_t;
-
-
-
-#endif
diff --git a/src/uca.c b/src/uca.c
deleted file mode 100644
index 04af76b..0000000
--- a/src/uca.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "uca.h"
-#include "uca-cam.h"
-#include "uca-grabber.h"
-
-#ifdef HAVE_PTHREADS
-#include <pthread.h>
-#endif
-
-#ifdef HAVE_DUMMY_CAMERA
-#include "cameras/dummy.h"
-#endif
-
-#ifdef HAVE_ME4
-#include "grabbers/me4.h"
-#endif
-
-#ifdef HAVE_PCO_CL
-#include "cameras/pco.h"
-#endif
-
-#ifdef HAVE_PHOTON_FOCUS
-#include "cameras/pf.h"
-#endif
-
-#ifdef HAVE_IPE_CAMERA
-#include "cameras/ipe.h"
-#endif
-
-#ifdef HAVE_SIMPLE_CAMERA
-#include "cameras/simple.h"
-#endif
-
-const char *uca_unit_map[] = {
- "px",
- "bits",
- "ns",
- "µs",
- "ms",
- "s",
- "rows",
- "fps",
- "°C",
- "[0/1]",
- ""
-};
-
-static uca_property property_map[UCA_PROP_LAST+1] = {
- { "General.Name", uca_na, uca_string, uca_read },
- { "Image.Width", uca_pixel, uca_uint32t, uca_readwrite },
- { "Image.Width.Min", uca_pixel, uca_uint32t, uca_read },
- { "Image.Width.Max", uca_pixel, uca_uint32t, uca_read },
- { "Image.Height", uca_pixel, uca_uint32t, uca_readwrite },
- { "Image.Height.Min", uca_pixel, uca_uint32t, uca_read },
- { "Image.Height.Max", uca_pixel, uca_uint32t, uca_read },
- { "Image.Offset.x", uca_pixel, uca_uint32t, uca_readwrite },
- { "Image.Offset.x.Min", uca_pixel, uca_uint32t, uca_read },
- { "Image.Offset.x.Max", uca_pixel, uca_uint32t, uca_read },
- { "Image.Offset.y", uca_pixel, uca_uint32t, uca_readwrite },
- { "Image.Offset.y.Min", uca_pixel, uca_uint32t, uca_read },
- { "Image.Offset.y.Max", uca_pixel, uca_uint32t, uca_read },
- { "Image.Binning.x", uca_pixel, uca_uint32t, uca_readwrite },
- { "Image.Binning.y", uca_pixel, uca_uint32t, uca_readwrite },
- { "Image.Bitdepth", uca_bits, uca_uint32t, uca_read},
- { "Time.Exposure", uca_us, uca_uint32t, uca_readwrite },
- { "Time.Exposure.Min", uca_us, uca_uint32t, uca_read },
- { "Time.Exposure.Max", uca_us, uca_uint32t, uca_read },
- { "Time.Delay", uca_us, uca_uint32t, uca_readwrite },
- { "Time.Delay.Min", uca_us, uca_uint32t, uca_read },
- { "Time.Delay.Max", uca_us, uca_uint32t, uca_read },
- { "Time.Framerate", uca_fps, uca_uint32t, uca_read },
- { "Temperature.Sensor", uca_dc, uca_uint32t, uca_read },
- { "Temperature.Camera", uca_dc, uca_uint32t, uca_read },
- { "Trigger.Mode", uca_na, uca_uint32t, uca_readwrite },
- { "Trigger.Exposure", uca_na, uca_uint32t, uca_readwrite },
- { "Gain.PGA", uca_na, uca_uint32t, uca_readwrite },
- { "Gain.PGA.Min", uca_na, uca_uint32t, uca_read },
- { "Gain.PGA.Max", uca_na, uca_uint32t, uca_read },
- { "Gain.PGA.Step", uca_na, uca_uint32t, uca_read },
- { "Gain.ADC", uca_na, uca_uint32t, uca_readwrite },
- { "Gain.ADC.Min", uca_na, uca_uint32t, uca_read },
- { "Gain.ADC.Max", uca_na, uca_uint32t, uca_read },
- { "Gain.ADC.Step", uca_na, uca_uint32t, uca_read },
- { "Grabber.Timeout", uca_s, uca_uint32t, uca_readwrite },
- { "Grabber.Synchronous", uca_bool, uca_uint32t, uca_readwrite },
- { "Grabber.Auto", uca_bool, uca_uint32t, uca_readwrite },
- { "Mode.Timestamp", uca_na, uca_uint32t, uca_readwrite },
- { "Mode.Scan", uca_na, uca_uint32t, uca_readwrite },
- { "Mode.Hotpixel", uca_na, uca_uint32t, uca_readwrite },
- { "Interlace.Samplerate", uca_na, uca_uint32t, uca_readwrite },
- { "Interlace.Threshold.Pixel", uca_na, uca_uint32t, uca_readwrite },
- { "Interlace.Threshold.Row", uca_na, uca_uint32t, uca_readwrite },
- { "Mode.correction", uca_na, uca_uint32t, uca_readwrite },
- { NULL, 0, 0, 0 }
-};
-
-
-#ifdef HAVE_PTHREADS
-static pthread_mutex_t g_uca_init_lock = PTHREAD_MUTEX_INITIALIZER;
-#define uca_lock() pthread_mutex_lock((&g_uca_init_lock))
-#define uca_unlock() pthread_mutex_unlock((&g_uca_init_lock))
-#else
-#define uca_lock(lock)
-#define uca_unlock(lock)
-#endif
-
-uca *g_uca = NULL;
-
-uca *uca_init(const char *config_filename)
-{
- uca_lock();
- if (g_uca != NULL) {
- uca_unlock();
- return g_uca;
- }
- g_uca = (uca *) malloc(sizeof(uca));
- g_uca->cameras = NULL;
-
- uca_grabber_init grabber_inits[] = {
-#ifdef HAVE_ME4
- uca_me4_init,
-#endif
- NULL
- };
-
- uca_cam_init cam_inits[] = {
-#ifdef HAVE_PCO_CL
- uca_pco_init,
-#endif
-#ifdef HAVE_PHOTON_FOCUS
- uca_pf_init,
-#endif
-#ifdef HAVE_IPE_CAMERA
- uca_ipe_init,
-#endif
-#ifdef HAVE_DUMMY_CAMERA
- uca_dummy_init,
-#endif
-#ifdef HAVE_SIMPLE_CAMERA
- uca_simple_init,
-#endif
- NULL
- };
-
- /* Probe each frame grabber that is configured */
- int i = 0;
- struct uca_grabber_priv *grabber = NULL;
- while (grabber_inits[i] != NULL) {
- uca_grabber_init init = grabber_inits[i];
- /* FIXME: we don't want to take the only first one */
- if (init(&grabber) == UCA_NO_ERROR)
- break;
- i++;
- }
-
- /* XXX: We could have no grabber (aka NULL) which is good anyway, since
- * some cameras don't need a grabber device (such as the IPE camera),
- * therefore we also probe each camera against the NULL grabber. However,
- * each camera must make sure to check for such a situation. */
-
- if (grabber != NULL) {
- g_uca->grabbers = (uca_grabber *) malloc(sizeof(uca_grabber));
- g_uca->grabbers->priv = grabber;
- g_uca->grabbers->next = NULL;
- }
-
- i = 0;
- uca_camera *current = NULL;
- /* Probe each camera that is configured and append a found camera to the
- * linked list. */
- while (cam_inits[i] != NULL) {
- struct uca_camera_priv *cam = NULL;
- uca_cam_init init = cam_inits[i];
- if (init(&cam, grabber) == UCA_NO_ERROR) {
- if (current == NULL) {
- g_uca->cameras = (uca_camera *) malloc(sizeof(uca_camera));
- g_uca->cameras->priv = cam;
- g_uca->cameras->next = NULL;
- current = g_uca->cameras;
- }
- else {
- current->next = (uca_camera *) malloc(sizeof(uca_camera));
- current->next->priv = cam;
- current = current->next;
- }
- current->next = NULL;
- }
- i++;
- }
-
- if (g_uca->cameras == NULL) {
- free(g_uca);
- g_uca = NULL;
- uca_unlock();
- return NULL;
- }
- uca_unlock();
- return g_uca;
-}
-
-void uca_destroy(uca *u)
-{
- uca_lock();
- if (u != NULL) {
- uca_camera *cam = u->cameras, *tmp;
- struct uca_camera_priv *cam_priv;
- while (cam != NULL) {
- tmp = cam;
- cam_priv = cam->priv;
- cam_priv->destroy(cam_priv);
- cam = cam->next;
- free(tmp);
- }
-
- uca_grabber *grabber = u->grabbers, *tmpg;
- struct uca_grabber_priv *grabber_priv;
- while (grabber != NULL) {
- tmpg = grabber;
- grabber_priv = grabber->priv;
- grabber_priv->destroy(grabber_priv);
- grabber = grabber->next;
- free(tmpg);
- }
-
- free(u);
- }
- uca_unlock();
-}
-
-uint32_t uca_get_property_id(const char *property_name, uca_property_ids *prop_id)
-{
- int i = 0;
- while (property_map[i].name != NULL) {
- if (!strcmp(property_map[i].name, property_name)) {
- *prop_id = (uca_property_ids) i;
- return UCA_NO_ERROR;
- }
- i++;
- }
- return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
-}
-
-uca_property *uca_get_full_property(uca_property_ids property_id)
-{
- if ((property_id >= 0) && (property_id < UCA_PROP_LAST))
- return &property_map[property_id];
- return NULL;
-}
-
-const char* uca_get_property_name(uca_property_ids property_id)
-{
- if ((property_id >= 0) && (property_id < UCA_PROP_LAST))
- return property_map[property_id].name;
- return UCA_NO_ERROR;
-}
-
-uint32_t uca_cam_alloc(uca_camera *cam, uint32_t n_buffers)
-{
- uint32_t bitdepth;
- struct uca_camera_priv *priv = cam->priv;
- priv->get_property(priv, UCA_PROP_BITDEPTH, &bitdepth, 0);
- const int pixel_size = bitdepth == 8 ? 1 : 2;
- if (priv->grabber != NULL)
- return priv->grabber->alloc(priv->grabber, pixel_size, n_buffers);
- return UCA_NO_ERROR;
-}
-
-uca_cam_state uca_cam_get_state(uca_camera *cam)
-{
- struct uca_camera_priv *priv = cam->priv;
- return priv->state;
-}
-
-uint32_t uca_cam_set_property(uca_camera *cam, uca_property_ids property, void *data)
-{
- struct uca_camera_priv *priv = cam->priv;
- return priv->set_property(priv, property, data);
-}
-
-uint32_t uca_cam_get_property(uca_camera *cam, uca_property_ids property, void *data, size_t num)
-{
- struct uca_camera_priv *priv = cam->priv;
- return priv->get_property(priv, property, data, num);
-}
-
-uint32_t uca_cam_start_recording(uca_camera *cam)
-{
- struct uca_camera_priv *priv = cam->priv;
- if (priv->state == UCA_CAM_RECORDING)
- return UCA_ERR_CAMERA | UCA_ERR_CONFIGURATION | UCA_ERR_IS_RECORDING;
-
- uint32_t err = priv->start_recording(priv);
- if (err == UCA_NO_ERROR)
- priv->state = UCA_CAM_RECORDING;
- return err;
-}
-
-uint32_t uca_cam_stop_recording(uca_camera *cam)
-{
- struct uca_camera_priv *priv = cam->priv;
- if (priv->state != UCA_CAM_RECORDING)
- return UCA_ERR_CAMERA | UCA_ERR_CONFIGURATION | UCA_ERR_NOT_RECORDING;
-
- uint32_t err = priv->stop_recording(priv);
- if (err == UCA_NO_ERROR)
- priv->state = UCA_CAM_CONFIGURABLE;
- return err;
-}
-
-uint32_t uca_cam_trigger(uca_camera *cam)
-{
- struct uca_camera_priv *priv = cam->priv;
- if (priv->state != UCA_CAM_RECORDING)
- return UCA_ERR_CAMERA | UCA_ERR_TRIGGER | UCA_ERR_NOT_RECORDING;
- return priv->trigger(priv);
-}
-
-uint32_t uca_cam_register_callback(uca_camera *cam, uca_cam_grab_callback callback, void *user)
-{
- struct uca_camera_priv *priv = cam->priv;
- return priv->register_callback(priv, callback, user);
-}
-
-uint32_t uca_cam_release_buffer(uca_camera *cam, void *buffer)
-{
- struct uca_camera_priv *priv = cam->priv;
- if (priv->release_buffer != NULL)
- return priv->release_buffer(priv, buffer);
- return UCA_ERR_NOT_IMPLEMENTED;
-}
-
-uint32_t uca_cam_grab(uca_camera *cam, char *buffer, void *meta_data)
-{
- struct uca_camera_priv *priv = cam->priv;
- if ((priv->state != UCA_CAM_RECORDING) && (priv->state != UCA_CAM_READOUT))
- return UCA_ERR_CAMERA | UCA_ERR_NOT_RECORDING;
- return priv->grab(priv, buffer, meta_data);
-}
-
-uint32_t uca_cam_readout(uca_camera *cam)
-{
- struct uca_camera_priv *priv = cam->priv;
- if (priv->state == UCA_CAM_RECORDING)
- return UCA_ERR_CAMERA | UCA_ERR_IS_RECORDING;
- if (priv->readout == NULL)
- return UCA_ERR_CAMERA | UCA_ERR_NOT_IMPLEMENTED;
- priv->state = UCA_CAM_READOUT;
- return priv->readout(priv);
-}
-
diff --git a/src/uca.h b/src/uca.h
deleted file mode 100644
index 60bb681..0000000
--- a/src/uca.h
+++ /dev/null
@@ -1,592 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (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 __UNIFIED_CAMERA_ACCESS_H
-#define __UNIFIED_CAMERA_ACCESS_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file uca.h
- * \brief Abstract camera model
- *
- * The uca_t structure represents a common interface for cameras regardless of
- * their connectivity. Each camera that adheres to this model must provide an
- * initialization function that probes the device and sets all function pointers
- * to their respective implementation.
- */
-
-/**
- * \mainpage
- *
- * \section intro_sec Introduction
- *
- * libuca is a thin wrapper to make different cameras and their access
- * interfaces (via CameraLink, PCIe …) accessible in an easy way.
- * It builds support for cameras, when it can find the necessary dependencies,
- * so there is no need to have camera SDKs installed when you don't own a
- * camera.
- *
- * \section intro_installation Installation from source
- *
- * Check out the code from vogelgesang/libuca or untar the tarball. Make sure to
- * install CMake and any third party drivers and SDKs that you want to have
- * accessed by libuca. Now go into some empty build directory and issue
- *
- * \verbatim
-$ cmake PATH_TO_LIBUCA_SOURCE
-$ make
-$ make install
- \endverbatim
- *
- * \section intro_quickstart Quick Start
- *
- * First of all you have to create a new uca handle to initialize the individual
- * subsystems
- *
- * \code uca *u = uca_init(); \endcode
- *
- * and see if uca_init() did not return NULL. If this is the case, no camera or
- * frame grabber was found. If you build with HAVE_DUMMY_CAMERA, there will
- * always be at least the dummy camera available.
- *
- * You can then iterate through all available cameras using
- *
- * \code
- * uca_camera *i = uca->cameras;
- * while (i != NULL) {
- * // do something with i
- * i = i->next;
- * }
- * \endcode
- *
- * The uca_camera handle is used to set and retrieve properties:
- *
- * \code
- * uca_camera *cam = uca->cameras;
- * uint32_t val = 5000;
- * uca_cam_set_property(cam, UCA_PROP_EXPOSURE, &val);
- *
- * uint32_t width, height;
- * uca_cam_get_property(cam, UCA_PROP_WIDTH, &width, NULL);
- * uca_cam_get_property(cam, UCA_PROP_HEIGHT, &height, NULL);
- * \endcode
- *
- * \section properties Property system
- *
- * Each property has a unique id listed in the #uca_property_ids enum.
- * Information about each property is given in a uca_property structure that is
- * mapped with uca_get_full_property(). The description lists the unit, type and
- * access rights.
- *
- * \section intro_recording Recording
- *
- * To record in synchronous fashion use uca_cam_grab() like
- *
- * \code
- * void *buffer = (void *) malloc(width * height * bytes_per_pixel);
- * uca_cam_start_recording(cam);
- * uca_cam_grab(cam, (char *) buffer, NULL);
- * uca_cam_stop_recording(cam);
- * \endcode
- *
- * Eventually you will have to cleanup the system by calling
- *
- * \code uca_destroy(u); \endcode
- *
- * \section intro_usage Adding new cameras
- *
- * To add a new camera, add cameras/new-cam.c and cameras/new-cam.h to the
- * source tree and change CMakeLists.txt to include these files.
- * Furthermore, if this camera relies on external dependencies, these have
- * to be found first via the CMake system.
- *
- * The new camera must export exactly one function: uca_new_camera_init() which
- * checks if (given the grabber) the camera is available and sets the function
- * pointers to access the camera accordingly.
- *
- * \section api_reference API reference
- *
- * All function definitions can be found in uca.h.
- *
- */
-
-/* The property IDs must start with 0 and must be continuous. Whenever this
- * library is released, the IDs must not change to guarantee binary compatibility! */
-/**
- * ID of all supported properties
- */
-typedef enum {
- UCA_PROP_NAME = 0,
- UCA_PROP_WIDTH,
- UCA_PROP_WIDTH_MIN,
- UCA_PROP_WIDTH_MAX,
- UCA_PROP_HEIGHT,
- UCA_PROP_HEIGHT_MIN,
- UCA_PROP_HEIGHT_MAX,
- UCA_PROP_X_OFFSET,
- UCA_PROP_X_OFFSET_MIN,
- UCA_PROP_X_OFFSET_MAX,
- UCA_PROP_Y_OFFSET,
- UCA_PROP_Y_OFFSET_MIN,
- UCA_PROP_Y_OFFSET_MAX,
- UCA_PROP_BINNING_X,
- UCA_PROP_BINNING_Y,
- UCA_PROP_BITDEPTH,
- UCA_PROP_EXPOSURE,
- UCA_PROP_EXPOSURE_MIN,
- UCA_PROP_EXPOSURE_MAX,
- UCA_PROP_DELAY,
- UCA_PROP_DELAY_MIN,
- UCA_PROP_DELAY_MAX,
- UCA_PROP_FRAMERATE,
- UCA_PROP_TEMPERATURE_SENSOR,
- UCA_PROP_TEMPERATURE_CAMERA,
- UCA_PROP_TRIGGER_MODE,
- UCA_PROP_TRIGGER_EXPOSURE,
-
- UCA_PROP_PGA_GAIN,
- UCA_PROP_PGA_GAIN_MIN,
- UCA_PROP_PGA_GAIN_MAX,
- UCA_PROP_PGA_GAIN_STEPS,
- UCA_PROP_ADC_GAIN,
- UCA_PROP_ADC_GAIN_MIN,
- UCA_PROP_ADC_GAIN_MAX,
- UCA_PROP_ADC_GAIN_STEPS,
-
- /* grabber specific */
- UCA_PROP_GRAB_TIMEOUT,
- UCA_PROP_GRAB_SYNCHRONOUS,
- UCA_PROP_GRAB_AUTO,
-
- /* pco.edge specific */
- UCA_PROP_TIMESTAMP_MODE,
- UCA_PROP_SCAN_MODE,
- UCA_PROP_HOTPIXEL_CORRECTION,
-
- /* IPE camera specific */
- UCA_PROP_INTERLACE_SAMPLE_RATE,
- UCA_PROP_INTERLACE_PIXEL_THRESH,
- UCA_PROP_INTERLACE_ROW_THRESH,
-
- /* Photon Focus specific */
- UCA_PROP_CORRECTION_MODE,
-
- UCA_PROP_LAST
-} uca_property_ids;
-
-/* Possible timestamp modes for UCA_PROP_TIMESTAMP_MODE */
-#define UCA_TIMESTAMP_NONE 0x00
-#define UCA_TIMESTAMP_ASCII 0x01
-#define UCA_TIMESTAMP_BINARY 0x02
-
-/* Trigger mode for UCA_PROP_TRIGGER_MODE */
-#define UCA_TRIGGER_AUTO 0 /**< free-run mode */
-#define UCA_TRIGGER_SOFTWARE 1 /**< software trigger via uca_cam_trigger() */
-#define UCA_TRIGGER_EXTERNAL 2 /**< external hardware trigger */
-#define UCA_TRIGGER_EXTERNAL_EXPOSURE 3 /**< hardware trigger controlling exposure */
-
-#define UCA_TRIGGER_EXP_CAMERA 1 /**< camera-controlled exposure time */
-#define UCA_TRIGGER_EXP_LEVEL 2 /**< level-controlled (trigger signal) exposure time */
-
-/* Correction modes for UCA_PROP_CORRECTION_MODE */
-#define UCA_CORRECT_OFFSET 0x01
-#define UCA_CORRECT_HOTPIXEL 0x02
-#define UCA_CORRECT_GAIN 0x04
-
-/**
- * The physical unit of this property.
- *
- * This is important in order to let the camera drivers know, how to convert
- * the values into their respective target value. It is also used for human
- * interfaces.
- */
-typedef enum {
- uca_pixel, /**< number of pixels */
- uca_bits, /**< number of bits */
- uca_ns, /**< nanoseconds */
- uca_us, /**< microseconds */
- uca_ms, /**< milliseconds */
- uca_s, /**< seconds */
- uca_rows, /**< number of rows */
- uca_fps, /**< frames per second */
- uca_dc, /**< degree celsius */
- uca_bool, /**< 1 or 0 for true and false */
- uca_na /**< no unit available (for example modes) */
-} uca_unit;
-
-/**
- * The data type of this property.
- *
- * When using uca_cam_set_property() and uca_cam_get_property() this field
- * must be respected and correct data transfered, as the values are
- * interpreted like defined here.
- */
-typedef enum {
- uca_uint32t,
- uca_uint8t,
- uca_string
-} uca_types;
-
-/**
- * Access rights determine if uca_cam_get_property() and/or
- * uca_cam_set_property() can be used with this property.
- */
-typedef enum {
- uca_read = 0x01, /**< property can be read */
- uca_write = 0x02, /**< property can be written */
- uca_readwrite = 0x01 | 0x02 /**< property can be read and written */
-} uca_access_rights;
-
-/**
- * Describes the current state of the camera.
- *
- * \see uca_cam_get_state()
- */
-typedef enum {
- UCA_CAM_CONFIGURABLE, /**< Camera can be configured and is not recording */
- UCA_CAM_ARMED, /**< Camera is ready for recording */
- UCA_CAM_RECORDING, /**< Camera is currently recording */
- UCA_CAM_READOUT /**< Camera recorded and is currently in readout mode */
-} uca_cam_state;
-
-/**
- * Specify if the callback function keeps the buffer and will call
- * ufo_cam_release_buffer() at later time or if after returning the buffer can
- * be released automatically.
- *
- * \since 0.5
- */
-typedef enum {
- UCA_BUFFER_KEEP, /**< Keep the buffer and call ufo_cam_release_buffer() manually */
- UCA_BUFFER_RELEASE /**< Buffer is released upon return */
-} uca_buffer_status;
-
-/**
- * A uca_property_t describes a vendor-independent property used by cameras and
- * frame grabbers. It basically consists of a human-readable name, a physical
- * unit, a type and some access rights.
- * \see uca_get_full_property()
- */
-typedef struct {
- /**
- * A human-readable string for this property.
- *
- * A name is defined in a tree-like structure, to build some form of
- * hierarchical namespace. To define a parent-child-relationship a dot '.'
- * is used. For example "image.width.min" might be the name for the minimal
- * acceptable frame width.
- */
- const char *name;
-
- uca_unit unit; /**< Physical unit of this property */
- uca_types type; /**< Type of this property */
- uca_access_rights access; /**< Access rights of this property */
-
-} uca_property;
-
-union uca_value {
- uint32_t u32;
- uint8_t u8;
- char *string;
-};
-
-
-/**
- * Grab callback.
- *
- * Register such a callback function with uca_cam_register_callback() to
- * receive data as soon as it is delivered.
- *
- * \param[in] image_number Current frame number
- * \param[in] buffer Image data.
- * \param[in] meta_data Meta data provided by the camera specifying per-frame
- * data.
- * \param[in] user User data registered in uca_cam_register_callback()
- * \return Value from uca_buffer_status. If #UCA_BUFFER_KEEP is returned, the
- * callee must make sure to call uca_cam_release_buffer(). On the other hand, if
- * #UCA_BUFFER_RELEASE is returned this is done by the caller.
- *
- * \note The meta data parameter is not yet specified but just a place holder.
- */
-typedef uca_buffer_status (*uca_cam_grab_callback) (uint64_t image_number, void *buffer, void *meta_data, void *user);
-
-extern const char *uca_unit_map[]; /**< maps unit numbers to corresponding strings */
-
-
-/**
- * An error code is a 32 bit integer with the following format (x:y means x bits
- * for purpose y):
- *
- * [ 31 (MSB) ... ... 0 (LSB) ]
- * [ 4:lvl | 4:rsv | 4:class | 4:source | 16:code ]
- *
- * where
- *
- * - lvl describes severity such as warning or failure,
- * - rsv is reserved,
- * - class describes the general class of the error,
- * - source describes where the error occured and
- * - code is the actual error condition
- *
- * UCA_ERR_MASK_*s can be used to mask the desired field of the error code.
- *
- */
-
-#define UCA_NO_ERROR 0x00000000
-
-#define UCA_ERR_MASK_CODE 0xF000FFFF
-#define UCA_ERR_MASK_SOURCE 0x000F0000
-#define UCA_ERR_MASK_TYPE 0x00F00000
-#define UCA_ERR_MASK_RESRV 0x0F000000
-#define UCA_ERR_MASK_LEVEL 0xF0000000
-
-#define UCA_ERR_GRABBER 0x00010000
-#define UCA_ERR_CAMERA 0x00020000
-
-#define UCA_ERR_INIT 0x00100000 /**< error during initialization */
-#define UCA_ERR_PROP 0x00200000 /**< error while setting/getting property */
-#define UCA_ERR_CALLBACK 0x00300000 /**< callback-related errors */
-#define UCA_ERR_TRIGGER 0x00400000 /**< errors concerning trigger */
-#define UCA_ERR_CONFIGURATION 0x00500000 /**< errors related to configuration steps */
-
-#define UCA_ERR_FAILURE 0x10000000
-#define UCA_ERR_WARNING 0x20000000
-
-#define UCA_ERR_UNCLASSIFIED 0x10000001
-#define UCA_ERR_NOT_FOUND 0x10000002
-#define UCA_ERR_INVALID 0x10000003
-#define UCA_ERR_NO_MEMORY 0x10000004
-#define UCA_ERR_OUT_OF_RANGE 0x10000005
-#define UCA_ERR_ACQUIRE 0x10000006
-#define UCA_ERR_IS_RECORDING 0x10000007 /**< error because device is recording */
-#define UCA_ERR_NOT_RECORDING 0x10000008
-#define UCA_ERR_FRAME_TRANSFER 0x10000009
-#define UCA_ERR_ALREADY_REGISTERED 0x1000000A
-#define UCA_ERR_NOT_IMPLEMENTED 0x1000000B
-#define UCA_ERR_NO_MORE_IMAGES 0x1000000C
-
-struct uca_camera_priv;
-/**
- * uca_camera is an opaque structure that is only accessed with the uca_cam_*
- * methods.
- */
-typedef struct uca_camera {
- struct uca_camera *next;
- struct uca_camera_priv* priv;
-} uca_camera;
-
-struct uca_grabber_priv;
-typedef struct uca_grabber {
- struct uca_grabber *next;
- struct uca_grabber_priv* priv;
-} uca_grabber;
-
-/**
- * Keeps a list of cameras and grabbers.
- */
-typedef struct {
- uca_camera *cameras; /**< Root of detected camera list */
- uca_grabber *grabbers; /**< Root of detected grabber list */
-} uca;
-
-/**
- * Initialize the unified camera access interface.
- *
- * \param[in] config_filename Configuration file in JSON format for cameras
- * relying on external calibration data. It is ignored when no JSON parser can
- * be found at compile time or config_filename is NULL.
- *
- * \return Pointer to a #uca structure
- *
- * \note uca_init() is thread-safe if a Pthread-implementation is available.
- */
-uca *uca_init(const char *config_filename);
-
-/**
- * Free resources of the unified camera access interface
- *
- * \note uca_destroy() is thread-safe if a Pthread-implementation is available.
- */
-void uca_destroy(uca *u);
-
-/**
- * Convert a property string to the corresponding ID
- *
- * \param[in] property_name Name of the property
- * \param[out] prop_id Resulting property ID
- * \return Error code
- */
-uint32_t uca_get_property_id(const char *property_name, uca_property_ids *prop_id);
-
-/**
- * Convert a property ID to the corresponding string
- *
- * \param property_id ID of a property
- * \return If property is found name of the property else NULL
- */
-const char* uca_get_property_name(uca_property_ids property_id);
-
-/**
- * Return the full property structure for a given ID
- *
- * \param property_id ID of a property
- * \return Property description or NULL if property is not found
- */
-uca_property *uca_get_full_property(uca_property_ids property_id);
-
-/**
- * Allocates buffer memory for the internal frame grabber.
- *
- * The allocation is just a hint to the underlying camera driver. It might
- * ignore this or pass this information on to a related frame grabber.
- *
- * \param[in] cam A uca_camera object
- * \param[in] n_buffers Number of sub-buffers with size frame_width*frame_height.
- * \return Error code
- */
-uint32_t uca_cam_alloc(uca_camera *cam, uint32_t n_buffers);
-
-/**
- * Retrieve current state of the camera.
- *
- * \param[in] cam A uca_camera object
- * \return A value from the uca_cam_state enum representing the current state of
- * the camera.
- */
-uca_cam_state uca_cam_get_state(uca_camera *cam);
-
-
-/**
- * Set a camera property.
- *
- * \param[in] cam The camera whose properties are to be set.
- * \param[in] cam A uca_camera object
- * \param[in] property ID of the property as defined in XXX
- * \param[out] data Where to read the property's value from
- *
- * \return UCA_ERR_PROP_INVALID if property is not supported on the camera or
- * UCA_ERR_PROP_VALUE_OUT_OF_RANGE if value cannot be set.
- */
-uint32_t uca_cam_set_property(uca_camera *cam, uca_property_ids property, void *data);
-
-/**
- * Get a property.
- *
- * \param[in] cam A uca_camera object
- * \param[in] property ID of the property as defined in XXX
- * \param[out] data Where to store the property's value
- * \param[in] num Number of bytes of string storage. Ignored for uca_uint8t
- * and uca_uint32t properties.
- *
- * \return UCA_ERR_PROP_INVALID if property is not supported on the camera
- */
-uint32_t uca_cam_get_property(uca_camera *cam, uca_property_ids property, void *data, size_t num);
-
-/**
- * Begin recording.
- *
- * Usually this also involves the frame acquisition of the frame grabber but is
- * hidden by this function.
- *
- * \param[in] cam A uca_camera object
- * \return Error code
- */
-uint32_t uca_cam_start_recording(uca_camera *cam);
-
-/**
- * Stop recording.
- *
- * \param[in] cam A uca_camera object
- * \return Error code
- */
-uint32_t uca_cam_stop_recording(uca_camera *cam);
-
-/**
- * Send a software trigger signal to start a sensor read-out.
- *
- * This method is only useful when #UCA_PROP_TRIGGER_MODE is set to
- * #UCA_TRIGGER_SOFTWARE.
- *
- * \param[in] cam A uca_camera object
- * \return Error code
- */
-uint32_t uca_cam_trigger(uca_camera *cam);
-
-/**
- * Register callback for given frame grabber. To actually start receiving
- * frames, call uca_grabber_acquire().
- *
- * \param[in] cam A uca_camera object
- * \param[in] callback Callback function for when a frame arrived
- * \param[in] user User data that is passed to the callback function
- * \return Error code
- */
-uint32_t uca_cam_register_callback(uca_camera *cam, uca_cam_grab_callback callback, void *user);
-
-/**
- * Release the buffer that was given in the grab callback.
- *
- * \param[in] cam A uca_camera object
- * \param[in] buffer The buffer that was passed to the callback
- *
- * \see uca_cam_register_callback(), uca_cam_grab_callback
- * \since 0.5
- */
-uint32_t uca_cam_release_buffer(uca_camera *cam, void *buffer);
-
-/**
- * \brief Grab one image from the camera
- *
- * The grabbing involves a memory copy because we might have to decode the image
- * coming from the camera, which the frame grabber is not able to do.
- *
- * \param[in] cam A uca_camera object
- * \param[in] buffer Destination buffer
- * \param[in] meta_data Meta data provided by the camera specifying per-frame
- * data.
- * \return Error code
- *
- * \note The meta data parameter is not yet specified but just a place holder.
- *
- */
-uint32_t uca_cam_grab(uca_camera *cam, char *buffer, void *meta_data);
-
-/**
- * \brief Initiate read out for recording based cameras like pco.dimax or
- * Photron SAx
- *
- * This function merely starts read out and requires that recording has stopped
- * with uca_cam_stop_recording. To retrieve the image data, you have still have
- * to use uca_cam_grab.
- *
- * \param[in] cam A uca_camera object
- * \return Error code
- */
-uint32_t uca_cam_readout(uca_camera *cam);
-
-#define uca_set_void(p, type, value) { *((type *) p) = (type) value; }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/uca.i b/src/uca.i
deleted file mode 100644
index 1846a46..0000000
--- a/src/uca.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module uca
-%{
-#include "uca.h"
-#include "uca-cam.h"
-%}
-
-%include "uca.h"
-%include "uca-cam.h"