summaryrefslogtreecommitdiffstats
path: root/src/uca.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-21 15:06:42 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-02-21 15:06:42 +0100
commit28619821bc90ed4c15844b2e6b6a5a2971ef5f2e (patch)
treec313b5b77087c18027d152c4c69c49b8ea0254d9 /src/uca.c
downloadlibuca-28619821bc90ed4c15844b2e6b6a5a2971ef5f2e.tar.gz
libuca-28619821bc90ed4c15844b2e6b6a5a2971ef5f2e.tar.bz2
libuca-28619821bc90ed4c15844b2e6b6a5a2971ef5f2e.tar.xz
libuca-28619821bc90ed4c15844b2e6b6a5a2971ef5f2e.zip
Initial commit
Diffstat (limited to 'src/uca.c')
-rw-r--r--src/uca.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/uca.c b/src/uca.c
new file mode 100644
index 0000000..7889fe2
--- /dev/null
+++ b/src/uca.c
@@ -0,0 +1,49 @@
+#include <stdlib.h>
+
+#include "uca.h"
+
+#ifdef HAVE_PCO_EDGE
+#include "cameras/uca_pco.h"
+#endif
+
+#ifdef HAVE_PHOTON_FOCUS
+#include "cameras/uca_pf.h"
+#endif
+
+#ifdef HAVE_IPE_CAM
+#include "cameras/uca_ipe.h"
+#endif
+
+
+struct uca_t *uca_init()
+{
+ struct uca_t *uca = (struct uca_t *) malloc(sizeof(struct uca_t));
+
+ uca_cam_init inits[] = {
+#ifdef HAVE_PCO_EDGE
+ uca_pco_init,
+#elif HAVE_PHOTON_FOCUS
+ uca_pf_init,
+#elif HAVE_IPE_CAM
+ uca_ipe_init,
+#endif
+ NULL };
+
+ int i = 0;
+ while (inits[i] != NULL) {
+ uca_cam_init init = inits[i];
+ if (init(uca))
+ return uca;
+ i++;
+ }
+
+ /* No camera found then return nothing */
+ free(uca);
+ return NULL;
+}
+
+void uca_destroy(struct uca_t *uca)
+{
+ uca->cam_destroy(uca);
+ free(uca);
+}