summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt17
-rw-r--r--src/uca-cam.h23
-rw-r--r--src/uca.h62
-rw-r--r--src/uca.i8
4 files changed, 75 insertions, 35 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3ae6394..7a69ed4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -33,8 +33,12 @@ find_package(IPE)
find_package(FgLib5)
find_package(ClSerMe4)
-# --- Add sources if camera/framegrabber access sources are available ---------
+# --- Miscellanous packages
+find_package(SWIG)
+find_package(PythonLibs)
+
+# --- Add sources if camera/framegrabber access sources are available ---------
if (PF_FOUND)
set(HAVE_PHOTON_FOCUS TRUE)
@@ -112,11 +116,22 @@ if(CLSERME4_FOUND AND FGLIB5_FOUND)
)
endif()
+# --- Configure step
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# --- Build language bindings via SWIG
+if(SWIG_FOUND AND PYTHONLIBS_FOUND)
+ include(${SWIG_USE_FILE})
+ include_directories(${PYTHON_INCLUDE_DIR})
+ set(CMAKE_SWIG_FLAGS "")
+
+ set_source_files_properties(uca.i PROPERTIES CPLUSPLUS ON)
+ SWIG_ADD_MODULE(uca python uca.i ${uca_SRCS})
+ SWIG_LINK_LIBRARIES(uca ${PYTHON_LIBRARIES} ${uca_LIBS})
+endif()
# --- Build target ------------------------------------------------------------
add_definitions("-std=c99 -Wall")
diff --git a/src/uca-cam.h b/src/uca-cam.h
index a7f1827..367b7ab 100644
--- a/src/uca-cam.h
+++ b/src/uca-cam.h
@@ -3,12 +3,24 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct uca_camera_t;
struct uca_grabber_t;
struct uca_property_t;
enum uca_property_ids;
+enum uca_cam_state {
+ UCA_CAM_ERROR,
+ UCA_CAM_CONFIGURABLE,
+ UCA_CAM_ARMED,
+ UCA_CAM_RECORDING,
+};
+
+
/*
* --- non-virtual methods ----------------------------------------------------
*/
@@ -75,13 +87,6 @@ typedef uint32_t (*uca_cam_stop_recording) (struct uca_camera_t *cam);
typedef uint32_t (*uca_cam_grab) (struct uca_camera_t *cam, char *buffer);
-enum uca_cam_state {
- UCA_CAM_ERROR,
- UCA_CAM_CONFIGURABLE,
- UCA_CAM_ARMED,
- UCA_CAM_RECORDING,
-};
-
struct uca_camera_t {
struct uca_camera_t *next;
@@ -103,4 +108,8 @@ struct uca_camera_t {
void *user; /**< private user data to be used by the camera driver */
};
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/uca.h b/src/uca.h
index 30966c4..e206ad0 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -1,6 +1,10 @@
#ifndef __UNIFIED_CAMERA_ACCESS_H
#define __UNIFIED_CAMERA_ACCESS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \file uca.h
* \brief Abstract camera model
@@ -15,33 +19,6 @@ struct uca_t;
struct uca_camera_t;
struct uca_property_t;
-/**
- * \brief Initialize the unified camera access interface
- * \return Pointer to a uca_t structure
- */
-struct uca_t *uca_init(void);
-
-/**
- * \brief Free resources of the unified camera access interface
- */
-void uca_destroy(struct uca_t *uca);
-
-/**
- * \brief Convert a property string to the corresponding ID
- */
-enum uca_property_ids uca_get_property_id(const char *property_name);
-
-/**
- * \brief Convert a property ID to the corresponding string
- */
-const char* uca_get_property_name(enum uca_property_ids property_id);
-
-/**
- * \brief Return the full property structure for a given ID
- */
-struct uca_property_t *uca_get_full_property(enum uca_property_ids property_id);
-
-
/* 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! */
enum uca_property_ids {
@@ -86,6 +63,34 @@ enum uca_property_ids {
UCA_PROP_LAST
};
+/**
+ * \brief Initialize the unified camera access interface
+ * \return Pointer to a uca_t structure
+ */
+struct uca_t *uca_init(void);
+
+/**
+ * \brief Free resources of the unified camera access interface
+ */
+void uca_destroy(struct uca_t *uca);
+
+/**
+ * \brief Convert a property string to the corresponding ID
+ */
+enum uca_property_ids uca_get_property_id(const char *property_name);
+
+/**
+ * \brief Convert a property ID to the corresponding string
+ */
+const char* uca_get_property_name(enum uca_property_ids property_id);
+
+/**
+ * \brief Return the full property structure for a given ID
+ */
+struct uca_property_t *uca_get_full_property(enum uca_property_ids property_id);
+
+
+
/* Possible timestamp modes for UCA_PROP_TIMESTAMP_MODE */
#define UCA_TIMESTAMP_ASCII 0x01
#define UCA_TIMESTAMP_BINARY 0x02
@@ -158,5 +163,8 @@ struct uca_t {
struct uca_grabber_t *grabbers;
};
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/uca.i b/src/uca.i
new file mode 100644
index 0000000..1846a46
--- /dev/null
+++ b/src/uca.i
@@ -0,0 +1,8 @@
+%module uca
+%{
+#include "uca.h"
+#include "uca-cam.h"
+%}
+
+%include "uca.h"
+%include "uca-cam.h"