diff options
author | Hans Ulrich Niedermann <gp@n-dimensional.de> | 2006-12-18 17:51:06 +0000 |
---|---|---|
committer | Hans Ulrich Niedermann <gp@n-dimensional.de> | 2006-12-18 17:51:06 +0000 |
commit | fed6dfa7e375e2870d8a001c69a2dd1f237b0d02 (patch) | |
tree | 2b270b8a482ac0d0bc34a23dc0a81be56268feba | |
parent | 376d942e7751421274cf160e18cd51eb157730ab (diff) | |
download | libgphoto2-fed6dfa7e375e2870d8a001c69a2dd1f237b0d02.tar.gz |
Moved all bindings into separate packages.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_3/libgphoto2@9680 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | bindings/Makefile.am | 7 | ||||
-rw-r--r-- | bindings/java/Makefile.am | 55 | ||||
-rw-r--r-- | bindings/java/README | 190 | ||||
-rw-r--r-- | bindings/java/TODO | 7 | ||||
-rw-r--r-- | bindings/java/gphoto2.i | 144 | ||||
-rw-r--r-- | bindings/java/javatest.java.in | 167 | ||||
-rw-r--r-- | bindings/java/make-clean.sh | 4 | ||||
-rw-r--r-- | bindings/java/make-swig-java.sh | 42 | ||||
-rw-r--r-- | bindings/python/INSTALL | 9 | ||||
-rw-r--r-- | bindings/python/README | 17 | ||||
-rw-r--r-- | bindings/python/gphoto2.pyx | 1014 | ||||
-rw-r--r-- | bindings/python/gptest.py | 57 | ||||
-rw-r--r-- | bindings/python/setup.py | 31 | ||||
-rw-r--r-- | configure.ac | 25 |
16 files changed, 4 insertions, 1770 deletions
diff --git a/Makefile.am b/Makefile.am index ae3e0fe31..dd488e9d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ bin_SCRIPTS = gphoto2-config EXTRA_DIST = HACKING MAINTAINERS TESTERS installcheck.mk # Note: @subdirs@ lists all the directories from AC_CONFIG_SUBDIRS() -SUBDIRS = @subdirs@ libgphoto2 camlibs tests po bindings packaging doc +SUBDIRS = @subdirs@ libgphoto2 camlibs tests po packaging doc doc_DATA = AUTHORS COPYING README NEWS @@ -3,6 +3,9 @@ libgphoto2 2.3.0.1 (will become 2.3.1 eventually) PTP: * Fixed a memory leak in continuous Nikon / Canon capture mode. +Bindings: + * Moved all bindings into separate packages. + Package / System integration: * Add README.packaging file. * Removed obsolete print-usb-usermap. Use diff --git a/bindings/Makefile.am b/bindings/Makefile.am deleted file mode 100644 index 5bae528dc..000000000 --- a/bindings/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# We're not using @BINDING_SUBDIRS@ here because we want to ship -# the bindings in the "make dist" tarball regardless of whether -# the system building the tarball has mono, java, or python installed. -# -# However, we are only shipping those bindings which actually work. -# SUBDIRS = -# SUBDIRS = @BINDING_SUBDIRS@ diff --git a/bindings/java/Makefile.am b/bindings/java/Makefile.am deleted file mode 100644 index a2f7b5667..000000000 --- a/bindings/java/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -# - -EXTRA_DIST = gphoto2.i TODO javatest.java.in - -data_DATA = javatest.class - -# FIXME: Is "sed -i" a standard? -gphoto2_wrap.c: $(srcdir)/gphoto2.i - mkdir -p swig/org/gphoto2 - $(SWIG) -v -I$(top_builddir) \ - -o gphoto2_wrap.c -oh gphoto2_wrap.h \ - -java -package swig.org.gphoto2 -outdir swig/org/gphoto2 \ - $(srcdir)/gphoto2.i - sed -i -e 's/ interface)/ interface1)/' \ - swig/org/gphoto2/_GPPortSettingsUSB.java || exit -1 - -lib_LTLIBRARIES = libgphoto2_jni.la - -libgphoto2_jni_la_CPPFLAGS = \ - $(LTDLINCL) \ - $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(LIBEXIF_CFLAGS) - -nodist_libgphoto2_jni_la_SOURCES = gphoto2_wrap.c -libgphoto2_jni_la_LIBADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ - $(LIBEXIF_LIBS) \ - $(INTLLIBS) - -clean-local: - rm -rf swig - -CLEANFILES = $(nodist_libgphoto2_jni_la_SOURCES) javatest.class javatest.java swig-org-gphoto2.jar - -swig-org-gphoto2.jar: gphoto2_wrap.c - find swig/org/gphoto2 -type f -name '*.java' \ - | xargs javac - find swig/org/gphoto2 -type f -name '*.class' \ - | xargs jar cf swig-org-gphoto2.jar - -javatest.java: $(srcdir)/javatest.java.in swig-org-gphoto2.jar - cat '$<' > '$@' - -javatest.class: javatest.java - javac -classpath swig-org-gphoto2.jar javatest.java - -javatest.sh: Makefile - echo '###' cp -f "$$PWD/.libs/libgphoto2_jni.so" "..../jre/lib/i386" - echo java -classpath .:swig-org-gphoto2.jar javatest > '$@' - chmod +x '$@' - -check_SCRIPTS = javatest.sh - -TESTS = javatest.sh diff --git a/bindings/java/README b/bindings/java/README deleted file mode 100644 index 3c2d8b048..000000000 --- a/bindings/java/README +++ /dev/null @@ -1,190 +0,0 @@ -######################################################################## -# NOTE: -# -# You can find a quite old README for the 3rd-party version of the -# SWIG based bindings below. -# -# As of 2006-05, the gphoto2 team is integrating SWIG based bindings -# into the libgphoto2 build system, but that work is not finished -# yet. -# -# For now, all bindings to libgphoto2 are considered alpha, i.e. -# API and ABI may still change and break backward compatibility. -# -######################################################################## - - -This directory holds the files used by SWIG to generate bindings for -Java and other high-level languages such as C#, Perl, PHP, Python, Tcl -and others. - -For more information on SWIG, see http://www.swig.org/ - -This file and these scripts focus on Java. Other languages should be -simple since the SWIG interface file should be the same. Note that -the SWIG wrapper libraries can only support one language at a time (at -least not without a lot more work), so if you compile for another -language you may want to create a separate directory for those files. - -To build the Java bindings, first configure and build the libgphoto2 -library. Then cd to the swig-java directory and run "make-swig-java.sh" - -See the end of this file for a list of files that should be created... - -copy the jni library to your jre/lib/i386 directory, such as: -cp -a libgphoto2_jni.so /opt/SUNWappserver/jdk/jre/lib/i386/ - -then you should be able to run the javatest.java file: -java -classpath swig-java:swig-java/swig-org-gphoto2.jar javatest - -The two files, "libgphoto2_jni.so" and "swig-org-gphoto2.jar" (plus -the standard libgphoto2 install) should be all that you need to -include in your java project. - - -You should get a bunch of files like this: -swig -swig/org -swig/org/gphoto2 -swig/org/gphoto2/CameraAbilities.class -swig/org/gphoto2/CameraAbilities.java -swig/org/gphoto2/_CameraAbilitiesList.class -swig/org/gphoto2/_CameraAbilitiesList.java -swig/org/gphoto2/_Camera.class -swig/org/gphoto2/_CameraFileInfoAudio.class -swig/org/gphoto2/_CameraFileInfoAudio.java -swig/org/gphoto2/_CameraFileInfo.class -swig/org/gphoto2/_CameraFileInfoFile.class -swig/org/gphoto2/_CameraFileInfoFile.java -swig/org/gphoto2/_CameraFileInfo.java -swig/org/gphoto2/_CameraFileInfoPreview.class -swig/org/gphoto2/_CameraFileInfoPreview.java -swig/org/gphoto2/CameraFilePath.class -swig/org/gphoto2/CameraFilePath.java -swig/org/gphoto2/_CameraFunctions.class -swig/org/gphoto2/_CameraFunctions.java -swig/org/gphoto2/_Camera.java -swig/org/gphoto2/_CameraList.class -swig/org/gphoto2/_CameraList_entry.class -swig/org/gphoto2/_CameraList_entry.java -swig/org/gphoto2/_CameraList.java -swig/org/gphoto2/CameraText.class -swig/org/gphoto2/CameraText.java -swig/org/gphoto2/_GPContext.class -swig/org/gphoto2/_GPContext.java -swig/org/gphoto2/gphoto2.class -swig/org/gphoto2/gphoto2Constants.class -swig/org/gphoto2/gphoto2Constants.java -swig/org/gphoto2/gphoto2.java -swig/org/gphoto2/gphoto2JNI.class -swig/org/gphoto2/gphoto2JNI.java -swig/org/gphoto2/_GPPort.class -swig/org/gphoto2/_GPPortInfo.class -swig/org/gphoto2/_GPPortInfo.java -swig/org/gphoto2/_GPPortInfoList.class -swig/org/gphoto2/_GPPortInfoList.java -swig/org/gphoto2/_GPPort.java -swig/org/gphoto2/_GPPortSettings.class -swig/org/gphoto2/_GPPortSettings.java -swig/org/gphoto2/_GPPortSettingsSerial.class -swig/org/gphoto2/_GPPortSettingsSerial.java -swig/org/gphoto2/_GPPortSettingsUSB.class -swig/org/gphoto2/_GPPortSettingsUSB.java -swig/org/gphoto2/SWIGTYPE_p__CameraFile.class -swig/org/gphoto2/SWIGTYPE_p__CameraFile.java -swig/org/gphoto2/SWIGTYPE_p__CameraFilesystem.class -swig/org/gphoto2/SWIGTYPE_p__CameraFilesystem.java -swig/org/gphoto2/SWIGTYPE_p__CameraPrivateCore.class -swig/org/gphoto2/SWIGTYPE_p__CameraPrivateCore.java -swig/org/gphoto2/SWIGTYPE_p__CameraPrivateLibrary.class -swig/org/gphoto2/SWIGTYPE_p__CameraPrivateLibrary.java -swig/org/gphoto2/SWIGTYPE_p__CameraWidget.class -swig/org/gphoto2/SWIGTYPE_p__CameraWidget.java -swig/org/gphoto2/SWIGTYPE_p_DIR.class -swig/org/gphoto2/SWIGTYPE_p_dirent.class -swig/org/gphoto2/SWIGTYPE_p_dirent.java -swig/org/gphoto2/SWIGTYPE_p_DIR.java -swig/org/gphoto2/SWIGTYPE_p_f_enum__unnamed18__p_q_const__char_p_q_const__char_va_list_p_void__void.class -swig/org/gphoto2/SWIGTYPE_p_f_enum__unnamed18__p_q_const__char_p_q_const__char_va_list_p_void__void.java -swig/org/gphoto2/SWIGTYPE_p_float.class -swig/org/gphoto2/SWIGTYPE_p_float.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_enum__unnamed8__p_CameraFilePath_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_enum__unnamed8__p_CameraFilePath_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_enum__unnamed9__p_struct__CameraFile_p_void_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_enum__unnamed9__p_struct__CameraFile_p_void_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_p_struct__CameraFileInfo_p_void_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_p_struct__CameraFileInfo_p_void_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_p_void_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_p_void_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_struct__CameraFileInfo_p_void_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_q_const__char_struct__CameraFileInfo_p_void_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_struct__CameraFile_p_void_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_struct__CameraFile_p_void_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_struct__CameraList_p_void_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_struct__CameraList_p_void_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_void_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__CameraFilesystem_p_q_const__char_p_void_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_CameraText_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_CameraText_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_p_struct__CameraWidget_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_p_struct__CameraWidget_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_struct__CameraFile_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_struct__CameraFile_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_struct__CameraWidget_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_struct__CameraWidget_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_struct__GPContext__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_p_struct__GPContext__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_unsigned_int_p_f_p_struct__Camera_p_struct__GPContext__int_p_void__unsigned_int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_unsigned_int_p_f_p_struct__Camera_p_struct__GPContext__int_p_void__unsigned_int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_unsigned_int_p_void__void.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__Camera_unsigned_int_p_void__void.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_float_p_q_const__char_va_list_p_void__unsigned_int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_float_p_q_const__char_va_list_p_void__unsigned_int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_q_const__char_va_list_p_void__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_q_const__char_va_list_p_void__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_q_const__char_va_list_p_void__void.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_q_const__char_va_list_p_void__void.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_void__int.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_void__int.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_void__void.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_p_void__void.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_unsigned_int_float_p_void__void.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_unsigned_int_float_p_void__void.java -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_unsigned_int_p_void__void.class -swig/org/gphoto2/SWIGTYPE_p_f_p_struct__GPContext_unsigned_int_p_void__void.java -swig/org/gphoto2/SWIGTYPE_p__GPPortPrivateCore.class -swig/org/gphoto2/SWIGTYPE_p__GPPortPrivateCore.java -swig/org/gphoto2/SWIGTYPE_p__GPPortPrivateLibrary.class -swig/org/gphoto2/SWIGTYPE_p__GPPortPrivateLibrary.java -swig/org/gphoto2/SWIGTYPE_p_int.class -swig/org/gphoto2/SWIGTYPE_p_int.java -swig/org/gphoto2/SWIGTYPE_p_p__CameraAbilitiesList.class -swig/org/gphoto2/SWIGTYPE_p_p__CameraAbilitiesList.java -swig/org/gphoto2/SWIGTYPE_p_p__Camera.class -swig/org/gphoto2/SWIGTYPE_p_p__CameraFile.class -swig/org/gphoto2/SWIGTYPE_p_p__CameraFile.java -swig/org/gphoto2/SWIGTYPE_p_p__CameraFilesystem.class -swig/org/gphoto2/SWIGTYPE_p_p__CameraFilesystem.java -swig/org/gphoto2/SWIGTYPE_p_p__Camera.java -swig/org/gphoto2/SWIGTYPE_p_p__CameraList.class -swig/org/gphoto2/SWIGTYPE_p_p__CameraList.java -swig/org/gphoto2/SWIGTYPE_p_p__CameraWidget.class -swig/org/gphoto2/SWIGTYPE_p_p__CameraWidget.java -swig/org/gphoto2/SWIGTYPE_p_p_char.class -swig/org/gphoto2/SWIGTYPE_p_p_char.java -swig/org/gphoto2/SWIGTYPE_p_p__GPPort.class -swig/org/gphoto2/SWIGTYPE_p_p__GPPortInfoList.class -swig/org/gphoto2/SWIGTYPE_p_p__GPPortInfoList.java -swig/org/gphoto2/SWIGTYPE_p_p__GPPort.java -swig/org/gphoto2/SWIGTYPE_p_time_t.class -swig/org/gphoto2/SWIGTYPE_p_time_t.java -swig/org/gphoto2/SWIGTYPE_p_unsigned_char.class -swig/org/gphoto2/SWIGTYPE_p_unsigned_char.java -swig/org/gphoto2/SWIGTYPE_p_unsigned_long.class -swig/org/gphoto2/SWIGTYPE_p_unsigned_long.java -swig/org/gphoto2/SWIGTYPE_p_va_list.class -swig/org/gphoto2/SWIGTYPE_p_va_list.java -swig/org/gphoto2/SWIGTYPE_p_void.class -swig/org/gphoto2/SWIGTYPE_p_void.java - -# diff --git a/bindings/java/TODO b/bindings/java/TODO deleted file mode 100644 index f2f693f38..000000000 --- a/bindings/java/TODO +++ /dev/null @@ -1,7 +0,0 @@ - * This swig-java build process needs to be integrated into the - libtool process used by the rest of the library - * Bindings for other languages supported by SWIG - * May need more helper functions in the SWIG interface file for - dereferencing pointers and converting types. - * Clean up build system - * Make bindings and test cases work with non-Sun java diff --git a/bindings/java/gphoto2.i b/bindings/java/gphoto2.i deleted file mode 100644 index 499d5f00f..000000000 --- a/bindings/java/gphoto2.i +++ /dev/null @@ -1,144 +0,0 @@ -/* - * SWIG interface file for libgphoto2 - * - * ChangeLog: - * * 23 Jan 2005 - Jason Watson <jason.watson@agrios.net> - * - initial version submitted to libgphoto2 project - * - * Original author for this file is Jason Watson <jason.watson@agrios.net> - */ -%module gphoto2 -%javaconst(1); - -%typemap(javagetcptr) SWIGTYPE %{ - public static long getCPtr($javaclassname obj) { - return (obj == null) ? 0 : obj.swigCPtr; - } -%} - -%{ -#include <gphoto2/gphoto2-abilities-list.h> -#include <gphoto2/gphoto2-camera.h> -#include <gphoto2/gphoto2-context.h> -#include <gphoto2/gphoto2-endian.h> -#include <gphoto2/gphoto2-file.h> -#include <gphoto2/gphoto2-filesys.h> -#include <gphoto2/gphoto2.h> -#include <gphoto2/gphoto2-library.h> -#include <gphoto2/gphoto2-list.h> -#include <gphoto2/gphoto2-port.h> -#include <gphoto2/gphoto2-port-info-list.h> -#include <gphoto2/gphoto2-port-library.h> -#include <gphoto2/gphoto2-port-log.h> -#include <gphoto2/gphoto2-port-portability.h> -#include <gphoto2/gphoto2-port-portability-os2.h> -#include <gphoto2/gphoto2-port-result.h> -#include <gphoto2/gphoto2-port-version.h> -#include <gphoto2/gphoto2-result.h> -#include <gphoto2/gphoto2-setting.h> -#include <gphoto2/gphoto2-version.h> -#include <gphoto2/gphoto2-widget.h> -%} - - -%include "gphoto2/gphoto2-abilities-list.h" -%include "gphoto2/gphoto2-camera.h" -%include "gphoto2/gphoto2-context.h" -%include "gphoto2/gphoto2-endian.h" -%include "gphoto2/gphoto2-file.h" -%include "gphoto2/gphoto2-filesys.h" -%include "gphoto2/gphoto2.h" -%include "gphoto2/gphoto2-library.h" -%include "gphoto2/gphoto2-list.h" -%include "gphoto2/gphoto2-port.h" -%include "gphoto2/gphoto2-port-info-list.h" -%include "gphoto2/gphoto2-port-library.h" -%include "gphoto2/gphoto2-port-log.h" -%include "gphoto2/gphoto2-port-portability.h" -%include "gphoto2/gphoto2-port-portability-os2.h" -%include "gphoto2/gphoto2-port-result.h" -%include "gphoto2/gphoto2-port-version.h" -%include "gphoto2/gphoto2-result.h" -%include "gphoto2/gphoto2-setting.h" -%include "gphoto2/gphoto2-version.h" -%include "gphoto2/gphoto2-widget.h" - - -%inline %{ - -/* copied from gphoto2-context.c so that swig knows what the type is */ -struct _GPContext -{ - GPContextIdleFunc idle_func; - void *idle_func_data; - - GPContextProgressStartFunc progress_start_func; - GPContextProgressUpdateFunc progress_update_func; - GPContextProgressStopFunc progress_stop_func; - void *progress_func_data; - - GPContextErrorFunc error_func; - void *error_func_data; - - GPContextQuestionFunc question_func; - void *question_func_data; - - GPContextCancelFunc cancel_func; - void *cancel_func_data; - - GPContextStatusFunc status_func; - void *status_func_data; - - GPContextMessageFunc message_func; - void *message_func_data; - - unsigned int ref_count; -}; - -/* copied from gphoto2-abilities-list.c so that swig knows what the type is */ -struct _CameraAbilitiesList { - int count; - CameraAbilities *abilities; -}; - -/* copied from gphoto2-port-info-list.c so that swig knows what the type is */ -struct _GPPortInfoList { - GPPortInfo *info; - unsigned int count; -}; - - -Camera * -dereference_p_p__Camera( Camera **pp_C ) { - /* Given a pointer to a pointer to a Camera, return just the pointer to a Camera */ - return (pp_C==NULL) ? NULL : *pp_C; -} - -CameraAbilitiesList * -dereference_p_p__CameraAbilitiesList( CameraAbilitiesList **pp_CAL ) { - /* Given a pointer to a pointer to a CAL, return just the pointer to a CAL */ - return (pp_CAL==NULL) ? NULL : *pp_CAL; -} - -GPPortInfoList * -dereference_p_p__GPPortInfoList( GPPortInfoList **pp_GPPIL ) { - /* Given a pointer to a pointer to a GPPIL, return just the pointer to a GPPIL */ - return (pp_GPPIL==NULL) ? NULL : *pp_GPPIL; -} - -GPPortInfoList ** -create_null_p_p__GPPortInfoList() { - return malloc(sizeof(GPPortInfoList **)); -} - -Camera ** -create_null_p_p__Camera() { - return malloc(sizeof(Camera **)); -} - -CameraAbilitiesList ** -create_null_p_p__CameraAbilitiesList() { - return malloc(sizeof(CameraAbilitiesList **)); -} - -%} diff --git a/bindings/java/javatest.java.in b/bindings/java/javatest.java.in deleted file mode 100644 index a2ed55482..000000000 --- a/bindings/java/javatest.java.in +++ /dev/null @@ -1,167 +0,0 @@ -import swig.org.gphoto2.*; - -public class javatest { - - public static void main(String argv[]) { - final String sCameraModel="USB PTP Class Camera"; // "Canon Powershot A75"; - - System.out.println("loading JNI library \"gphoto2_jni\""); - System.loadLibrary("gphoto2_jni"); - - System.out.println(" JNI: Creating context..."); - _GPContext context = gphoto2.gp_context_new(); - - // create and load list of ports - this should list all usb ports of all devices on the system, not just cameras - System.out.println(" JNI: gphoto2.create_null_p_p__GPPortInfoList()"); - SWIGTYPE_p_p__GPPortInfoList ppInfoList=gphoto2.create_null_p_p__GPPortInfoList(); // create the empty pointer - - System.out.println(" JNI: gphoto2.gp_port_info_list_new()"); - gphoto2.gp_port_info_list_new(ppInfoList); // create the new (empty) list and get a pointer to it - - System.out.println(" JNI: gphoto2.dereference_p_p__GPPortInfoList()"); - _GPPortInfoList infolist=gphoto2.dereference_p_p__GPPortInfoList(ppInfoList); // dereference the pointer to get the (empty list) java object - - System.out.println(" JNI: gphoto2.gp_port_info_list_load()"); - int result = gphoto2.gp_port_info_list_load(infolist); // populate the list object with current data - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - _GPPortInfo portinfo = new _GPPortInfo(); - /* - int k=gphoto2.gp_port_info_list_lookup_path (infolist, "usb:"); - result=gphoto2.gp_port_info_list_get_info (infolist, k, portinfo); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - */ - - if (gphoto2.gp_port_info_list_count(infolist)==0) throw new RuntimeException("no cameras detected "); - - // for each port in the list - for(int nCurPortNum=0; nCurPortNum<gphoto2.gp_port_info_list_count(infolist); nCurPortNum++) - { - System.out.println(" JNI: gphoto2.gp_port_info_list_get_info()"); - _GPPortInfo portinfotmp=new _GPPortInfo(); - gphoto2.gp_port_info_list_get_info(infolist, nCurPortNum, portinfotmp); // get more info about the current port - System.out.println(" port " + nCurPortNum + " = '" + portinfotmp.getPath() + "'"); - - if ("usb:".equalsIgnoreCase(portinfotmp.getPath()) ) { - portinfo=portinfotmp; - } - portinfotmp=null; - } - - // release the info list resources - gphoto2.gp_port_info_list_free(infolist); - infolist=null; - ppInfoList=null; - - // TODO is this really a camera on this port? - - System.out.println(" JNI: gphoto2.create_null_p_p__Camera()"); - SWIGTYPE_p_p__Camera ppCamera=gphoto2.create_null_p_p__Camera(); - - System.out.println(" JNI: gphoto2.gp_camera_new() - Creating camera..."); - result=gphoto2.gp_camera_new (ppCamera); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - System.out.println(" JNI: gphoto2.dereference_p_p__Camera()"); - _Camera cam=gphoto2.dereference_p_p__Camera(ppCamera); - - System.out.println(" JNI: gphoto2.create_null_p_p__CameraAbilitiesList()"); - SWIGTYPE_p_p__CameraAbilitiesList p_al=gphoto2.create_null_p_p__CameraAbilitiesList(); - - System.out.println(" JNI: gphoto2.gp_abilities_list_new()"); - result=gphoto2.gp_abilities_list_new(p_al); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - System.out.println(" JNI: gphoto2.dereference_p_p__CameraAbilitiesList()"); - _CameraAbilitiesList al=gphoto2.dereference_p_p__CameraAbilitiesList(p_al); - - System.out.println(" JNI: gphoto2.gp_abilities_list_load() - Loading Abilities..."); - result=gphoto2.gp_abilities_list_load(al, context); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - System.out.println(" JNI: gphoto2.gp_camera_set_port_info() - Setting PortInfo on Camera..."); - result=gphoto2.gp_camera_set_port_info(cam, portinfo); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - System.out.println(" JNI: gphoto2.gp_abilities_list_get_abilities() - Using Camera Model '" + sCameraModel + "'"); - CameraAbilities abilities=new CameraAbilities(); - result=gphoto2.gp_abilities_list_get_abilities(al, gphoto2.gp_abilities_list_lookup_model(al, sCameraModel), abilities); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - System.out.println(" JNI: gphoto2.gp_abilities_list_free()"); - result=gphoto2.gp_abilities_list_free(al); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - System.out.println(" JNI: gphoto2.gp_camera_set_abilities()"); - result=gphoto2.gp_camera_set_abilities(cam, abilities); - if (result!=0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - for (int i = 0; result!=0 && i<5; i++) { - System.out.println(" JNI: gphoto2.gp_camera_init() - Initializing Camera..."); - result = gphoto2.gp_camera_init(cam, context); - if (result != 0) { - System.out.println(" << gphoto2.gp_camera_init() returned " + result + "..."); - try { - System.out.println(" **Sleeping 1000 msec..."); - Thread.sleep(1000); // pause for a bit - } catch(InterruptedException e) {} - // -52 = camera not found? (when run with camera off) - // -60 = not a camera? (when tried to init usb mouse as camera, got -52 here too) - } - } - if (result == -60 || result == -52) { // looks like it wasn't a camera - System.out.println("(port '" + portinfo.getPath() + "' was not a camera?)"); - } - - /* TODO change timeout - SWIGTYPE_p_GPPort p = cam.getPort(); - _GPPort pp = new _GPPort(); - pp.setTimeout(1000*30); - */ - - - // Now, take a picture - System.out.println(" JNI: gphoto2.gp_camera_capture() - Capturing Image..."); - CameraFilePath cfpOut = new CameraFilePath(); - - result=-1; - // int nLoops=0; - for (int i=0; result!=0 && i<5; i++) { - result = gphoto2.gp_camera_capture(cam, CameraCaptureType.GP_CAPTURE_IMAGE, cfpOut, context); - if (result != 0) System.out.println("unexpected JNI result '" + result + "', retrying..."); - } - if (result != 0) throw new RuntimeException("unexpected JNI result '" + result + "'"); - - - - - // TODO download image from camera - /* - * for each folder - * for each file - * check date - * download latest - * delete all - */ - - - - /* - * Don't forget to clean up when you don't need the camera any - * more. Please use unref instead of destroy - you'll never know - * if some part of the program still needs the camera. - */ - System.out.println(" JNI: gphoto2.gp_camera_unref() - Releasing Camera..."); - result = gphoto2.gp_camera_exit(cam, context); - result = gphoto2.gp_camera_unref(cam); - - System.out.println("exiting"); - } -} - - -/* - * Local Variables: - * mode: java - * End: - */ diff --git a/bindings/java/make-clean.sh b/bindings/java/make-clean.sh deleted file mode 100644 index eaac2fa5f..000000000 --- a/bindings/java/make-clean.sh +++ /dev/null @@ -1,4 +0,0 @@ -echo 'rm -f *.class *.c *.so swig/org/gphoto2/*.{java,class} swig-org-gphoto2.jar' -rm -f *.class *.c *.o *.so swig/org/gphoto2/*.{java,class} swig-org-gphoto2.jar -echo rmdir -p swig/org/gphoto2 -rmdir -p swig/org/gphoto2 diff --git a/bindings/java/make-swig-java.sh b/bindings/java/make-swig-java.sh deleted file mode 100644 index 160a2834e..000000000 --- a/bindings/java/make-swig-java.sh +++ /dev/null @@ -1,42 +0,0 @@ -MYCAMERADRIVER=ptp2 -MYCAMLIBDIR=/usr/lib/gphoto2/2.1.5 -MYIOLIBDIR=/usr/lib/gphoto2_port/0.5.1 -MYLOCALEDIR=/usr/share/locale -LIBGPHOTO2SRCDIR=.. -LIBGPHOTO2PORTSRCDIR=../libgphoto2_port -JDKHOME=/opt/SUNWappserver/jdk -MYINCL="-I${JDKHOME}/include -I${JDKHOME}/include/linux -I${LIBGPHOTO2SRCDIR} -I${LIBGPHOTO2SRCDIR}/libgphoto2 -I${LIBGPHOTO2PORTSRCDIR} -I${LIBGPHOTO2PORTSRCDIR}/libgphoto2_port -I${LIBGPHOTO2SRCDIR}/intl" -MYLDADD="" -EXTRACFLAGS=" -DIOLIBS=\"${MYIOLIBDIR}\" -DCAMLIBS=\"${MYCAMLIBDIR}\" -DLOCALEDIR=\"${MYLOCALEDIR}\" " -GPSOURCEFILES="${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-abilities-list.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-camera.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-context.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-file.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-filesys.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-list.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-result.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-setting.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-version.c ${LIBGPHOTO2SRCDIR}/libgphoto2/gphoto2-widget.c" -GPPORTSOURCEFILES="${LIBGPHOTO2PORTSRCDIR}/libgphoto2_port/gphoto2-port.c ${LIBGPHOTO2PORTSRCDIR}/libgphoto2_port/gphoto2-port-info-list.c ${LIBGPHOTO2PORTSRCDIR}/libgphoto2_port/gphoto2-port-log.c ${LIBGPHOTO2PORTSRCDIR}/libgphoto2_port/gphoto2-port-portability.c ${LIBGPHOTO2PORTSRCDIR}/libgphoto2_port/gphoto2-port-result.c ${LIBGPHOTO2PORTSRCDIR}/libgphoto2_port/gphoto2-port-version.c" - - -echo "Generating SWIG files..." -echo " *" -echo " * Messages such as \"Warning(305): Bad constant value (ignored)\" are expected and ignoreable" -echo " *" -mkdir -p swig/org/gphoto2 -swig -I${LIBGPHOTO2SRCDIR} -I${LIBGPHOTO2PORTSRCDIR} -java -package swig.org.gphoto2 -outdir swig/org/gphoto2 gphoto2.i || exit -1 -echo "Compiling..." -gcc -fpic ${MYINCL} ${EXTRACFLAGS} -c ${GPSOURCEFILES} ${GPPORTSOURCEFILES} gphoto2_wrap.c || exit -1 -echo "Linking..." -gcc -shared -fpic ${MYLDADD} ${EXTRACFLAGS} -lgphoto2 -lexif -L${MYCAMLIBDIR} -lgphoto2_${MYCAMERADRIVER} ${MYINCL} ${GPSOURCEFILES} ${GPPORTSOURCEFILES} gphoto2_wrap.o -o libgphoto2_jni.so || exit -1 - -# patch a couple of things in the swig-generated files -#sed -i -e 's/private long swigCPtr;/public long swigCPtr;/' swig/org/gphoto2/_GPPortInfo.java -#sed -i -e 's/private long swigCPtr;/public long swigCPtr;/' swig/org/gphoto2/port/_GPPortInfo.java -sed -i -e 's/ interface)/ interface1)/' ./swig/org/gphoto2/_GPPortSettingsUSB.java || exit -1 - -echo "Compiling Java files..." -find ./swig/org/gphoto2 -name "*.java" | xargs javac || exit -1 - -echo "Creating JAR archive..." -find ./swig/org/gphoto2 -name "*.class" | xargs jar cf swig-org-gphoto2.jar || exit -1 - -# compile test program -cp javatest.java.in javatest.java || exit -1 -javac -classpath swig-org-gphoto2.jar javatest.java || exit -1 - -echo cp -f libgphoto2_jni.so ${JDKHOME}/jre/lib/i386/ -echo java -classpath .:swig-org-gphoto2.jar javatest || exit -1 diff --git a/bindings/python/INSTALL b/bindings/python/INSTALL deleted file mode 100644 index 56ebfc6fc..000000000 --- a/bindings/python/INSTALL +++ /dev/null @@ -1,9 +0,0 @@ -To install this python extension, you just have to type : - -$ python2.3-pyrexc gphoto2.pyx - -$ python setup.py build -$ sudo python setup.py install - -then you can run the test program : -$ python gptest.py diff --git a/bindings/python/README b/bindings/python/README deleted file mode 100644 index 479b7f907..000000000 --- a/bindings/python/README +++ /dev/null @@ -1,17 +0,0 @@ -Python language bindings for gphoto2 using PyRex (http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/) - -Copyright (C) 2003-2004 David PHAM-VAN -- david@ab2r.com - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/bindings/python/gphoto2.pyx b/bindings/python/gphoto2.pyx deleted file mode 100644 index f4ab0fff9..000000000 --- a/bindings/python/gphoto2.pyx +++ /dev/null @@ -1,1014 +0,0 @@ -# Copyright (C) 2003-2004 David PHAM-VAN -- david@ab2r.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -#------------------------------------------------------------------------------ -cdef extern from "Python.h": - object PyString_FromStringAndSize(char *, int) - -#------------------------------------------------------------------------------ -cdef extern from "stdlib.h": - void free(void *) - -#------------------------------------------------------------------------------ - -cdef extern from "time.h": - ctypedef struct time_t: - int a - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-port-version.h": - - ctypedef enum GPVersionVerbosity: - GP_VERSION_SHORT - GP_VERSION_VERBOSE - - char **gp_port_library_version(GPVersionVerbosity verbose) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-version.h": - char **gp_library_version(GPVersionVerbosity verbose) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-context.h": - ctypedef struct GPContext - - GPContext *gp_context_new () - - void gp_context_ref (GPContext *context) - void gp_context_unref (GPContext *context) - - ctypedef enum GPContextFeedback: - GP_CONTEXT_FEEDBACK_OK - GP_CONTEXT_FEEDBACK_CANCEL - - ctypedef void (* GPContextIdleFunc) (GPContext *context, void *data) - ctypedef void (* GPContextErrorFunc) (GPContext *context, char *format, args, void *data) - ctypedef void (* GPContextStatusFunc) (GPContext *context, char *format, args, void *data) - ctypedef void (* GPContextMessageFunc) (GPContext *context, char *format, args, void *data) - ctypedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context, char *format, args, void *data) - ctypedef GPContextFeedback (* GPContextCancelFunc) (GPContext *context, void *data) - ctypedef unsigned int (* GPContextProgressStartFunc) (GPContext *context, float target, char *format, args, void *data) - ctypedef void (* GPContextProgressUpdateFunc) (GPContext *context, unsigned int id, float current, void *data) - ctypedef void (* GPContextProgressStopFunc) (GPContext *context, unsigned int id, void *data) - - void gp_context_set_idle_func (GPContext *context, GPContextIdleFunc func, void *data) - void gp_context_set_progress_funcs (GPContext *context, GPContextProgressStartFunc start_func, GPContextProgressUpdateFunc update_func, - GPContextProgressStopFunc stop_func, void *data) - void gp_context_set_error_func (GPContext *context, GPContextErrorFunc func, void *data) - void gp_context_set_status_func (GPContext *context, GPContextStatusFunc func, void *data) - void gp_context_set_question_func (GPContext *context, GPContextQuestionFunc func, void *data) - void gp_context_set_cancel_func (GPContext *context, GPContextCancelFunc func, void *data) - void gp_context_set_message_func (GPContext *context, GPContextMessageFunc func, void *data) - - void gp_context_idle (GPContext *context) - void gp_context_error (GPContext *context, char *format, ...) - - void gp_context_status (GPContext *context, char *format, ...) - void gp_context_message (GPContext *context, char *format, ...) - - GPContextFeedback gp_context_question (GPContext *context, char *format, ...) - GPContextFeedback gp_context_cancel (GPContext *context) - unsigned int gp_context_progress_start (GPContext *context, float target, char *format, ...) - - void gp_context_progress_update (GPContext *context, unsigned int id, float current) - void gp_context_progress_stop (GPContext *context, unsigned int id) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-port-info-list.h": - ctypedef enum GPPortType: - GP_PORT_NONE - GP_PORT_SERIAL - GP_PORT_USB - - ctypedef struct GPPortInfo: - GPPortType type - char name[64] - char path[64] - char library_filename[1024] - - ctypedef struct GPPortInfoList - - int gp_port_info_list_new (GPPortInfoList **list) - int gp_port_info_list_free (GPPortInfoList *list) - - int gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info) - - int gp_port_info_list_load (GPPortInfoList *list) - - int gp_port_info_list_count (GPPortInfoList *list) - - int gp_port_info_list_lookup_path (GPPortInfoList *list, char *path) - int gp_port_info_list_lookup_name (GPPortInfoList *list, char *name) - - int gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-port.h": - - ctypedef enum GPPortSerialParity: - GP_PORT_SERIAL_PARITY_OFF - GP_PORT_SERIAL_PARITY_EVEN - GP_PORT_SERIAL_PARITY_ODD - - ctypedef enum defines_port: - GP_PORT_MAX_BUF_LEN - - ctypedef struct GPPortSettingsSerial: - char port[128] - int speed - int bits - GPPortSerialParity parity - int stopbits - - ctypedef struct GPPortSettingsUSB: - int inep, outep, intep - int config - int interface - int altsetting - char port[64] - - ctypedef union GPPortSettings: - GPPortSettingsSerial serial - GPPortSettingsUSB usb - - enum: - GP_PORT_USB_ENDPOINT_IN - GP_PORT_USB_ENDPOINT_OUT - GP_PORT_USB_ENDPOINT_INT - - ctypedef struct GPPortPrivateLibrary - ctypedef struct GPPortPrivateCore - - ctypedef struct GPPort: - GPPortType type - GPPortSettings settings - GPPortSettings settings_pending - int timeout - GPPortPrivateLibrary *pl - GPPortPrivateCore *pc - - int gp_port_new (GPPort **port) - int gp_port_free (GPPort *port) - - int gp_port_set_info (GPPort *port, GPPortInfo info) - int gp_port_get_info (GPPort *port, GPPortInfo *info) - - int gp_port_open (GPPort *port) - int gp_port_close (GPPort *port) - - int gp_port_write (GPPort *port, char *data, int size) - int gp_port_read (GPPort *port, char *data, int size) - int gp_port_check_int (GPPort *port, char *data, int size) - int gp_port_check_int_fast (GPPort *port, char *data, int size) - - int gp_port_get_timeout (GPPort *port, int *timeout) - int gp_port_set_timeout (GPPort *port, int timeout) - - int gp_port_set_settings (GPPort *port, GPPortSettings settings) - int gp_port_get_settings (GPPort *port, GPPortSettings *settings) - - ctypedef enum GPPin: - GP_PIN_RTS - GP_PIN_DTR - GP_PIN_CTS - GP_PIN_DSR - GP_PIN_CD - GP_PIN_RING - - ctypedef enum GPLevel: - GP_LEVEL_LOW - GP_LEVEL_HIGH - - int gp_port_get_pin (GPPort *port, GPPin pin, GPLevel *level) - int gp_port_set_pin (GPPort *port, GPPin pin, GPLevel level) - - int gp_port_send_break (GPPort *port, int duration) - int gp_port_flush (GPPort *port, int direction) - - int gp_port_usb_find_device (GPPort *port, int idvendor, int idproduct) - int gp_port_usb_find_device_by_class (GPPort *port, int mainclass, int subclass, int protocol) - int gp_port_usb_clear_halt (GPPort *port, int ep) - int gp_port_usb_msg_write (GPPort *port, int request, int value, int index, char *bytes, int size) - int gp_port_usb_msg_read (GPPort *port, int request, int value, int index, char *bytes, int size) - int gp_port_set_error (GPPort *port, char *format, ...) - char *gp_port_get_error (GPPort *port) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-port-log.h": - ctypedef enum GPLogLevel: - GP_LOG_ERROR - GP_LOG_VERBOSE - GP_LOG_DEBUG - GP_LOG_DATA - - ctypedef void *GPLogFunc (GPLogLevel level, char *domain, char *format, args, void *data) - - int gp_log_add_func (GPLogLevel level, GPLogFunc func, void *data) - int gp_log_remove_func (int id) - - void gp_log (GPLogLevel level, char *domain, char *format, ...) - void gp_logv (GPLogLevel level, char *domain, char *format, args) - void gp_log_data (char *domain, char *data, unsigned int size) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-port-result.h": - ctypedef enum port_result: - GP_OK - GP_ERROR - GP_ERROR_BAD_PARAMETERS - GP_ERROR_NO_MEMORY - GP_ERROR_LIBRARY - GP_ERROR_UNKNOWN_PORT - GP_ERROR_NOT_SUPPORTED - GP_ERROR_IO - GP_ERROR_TIMEOUT - GP_ERROR_IO_SUPPORTED_SERIAL - GP_ERROR_IO_SUPPORTED_USB - GP_ERROR_IO_INIT - GP_ERROR_IO_READ - GP_ERROR_IO_WRITE - GP_ERROR_IO_UPDATE - GP_ERROR_IO_SERIAL_SPEED - GP_ERROR_IO_USB_CLEAR_HALT - GP_ERROR_IO_USB_FIND - GP_ERROR_IO_USB_CLAIM - GP_ERROR_IO_LOCK - - char *gp_port_result_as_string (int result) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-port-result.h": - ctypedef enum gphoto2_result: - GP_ERROR_CORRUPTED_DATA - GP_ERROR_FILE_EXISTS - GP_ERROR_MODEL_NOT_FOUND - GP_ERROR_DIRECTORY_NOT_FOUND - GP_ERROR_FILE_NOT_FOUND - GP_ERROR_DIRECTORY_EXISTS - GP_ERROR_CAMERA_BUSY - GP_ERROR_PATH_NOT_ABSOLUTE - GP_ERROR_CANCEL - - char *gp_result_as_string(int result) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-widget.h": - ctypedef struct CameraWidget - - ctypedef enum CameraWidgetType: - GP_WIDGET_WINDOW - GP_WIDGET_SECTION - GP_WIDGET_TEXT - GP_WIDGET_RANGE - GP_WIDGET_TOGGLE - GP_WIDGET_RADIO - GP_WIDGET_MENU - GP_WIDGET_BUTTON - GP_WIDGET_DATE - - ctypedef int (* CameraWidgetCallback) (Camera, CameraWidget, GPContext) - - int gp_widget_new (CameraWidgetType _type, char *label, CameraWidget **widget) - int gp_widget_free (CameraWidget *widget) - int gp_widget_ref (CameraWidget *widget) - int gp_widget_unref (CameraWidget *widget) - - int gp_widget_append (CameraWidget *widget, CameraWidget *child) - int gp_widget_prepend (CameraWidget *widget, CameraWidget *child) - - int gp_widget_count_children (CameraWidget *widget) - int gp_widget_get_child (CameraWidget *widget, int child_number, - CameraWidget **child) - - int gp_widget_get_child_by_label (CameraWidget *widget, char *label, - CameraWidget **child) - int gp_widget_get_child_by_id (CameraWidget *widget, int id, CameraWidget **child) - int gp_widget_get_child_by_name (CameraWidget *widget, char *name, CameraWidget **child) - int gp_widget_get_root (CameraWidget *widget, CameraWidget **root) - int gp_widget_get_parent (CameraWidget *widget, CameraWidget **parent) - - int gp_widget_set_value (CameraWidget *widget, void *value) - int gp_widget_get_value (CameraWidget *widget, void *value) - - int gp_widget_set_name (CameraWidget *widget, char *name) - int gp_widget_get_name (CameraWidget *widget, char **name) - - int gp_widget_set_info (CameraWidget *widget, char *info) - int gp_widget_get_info (CameraWidget *widget, char **info) - - int gp_widget_get_id (CameraWidget *widget, int *id) - int gp_widget_get_type (CameraWidget *widget, CameraWidgetType *type) - int gp_widget_get_label (CameraWidget *widget, char **label) - - int gp_widget_set_range (CameraWidget *range, float low, float high, float increment) - int gp_widget_get_range (CameraWidget *range, float *min, float *max, float *increment) - - int gp_widget_add_choice (CameraWidget *widget, char *choice) - int gp_widget_count_choices (CameraWidget *widget) - int gp_widget_get_choice (CameraWidget *widget, int choice_number, char **choice) - - int gp_widget_changed (CameraWidget *widget) - int gp_widget_set_changed (CameraWidget *widget, int changed) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-file.h": - ctypedef enum defines_file: - GP_MIME_WAV - GP_MIME_RAW - GP_MIME_PNG - GP_MIME_PGM - GP_MIME_PPM - GP_MIME_PNM - GP_MIME_JPEG - GP_MIME_TIFF - GP_MIME_BMP - GP_MIME_QUICKTIME - GP_MIME_AVI - GP_MIME_CRW - GP_MIME_UNKNOWN - GP_MIME_EXIF - - ctypedef enum CameraFileType: - GP_FILE_TYPE_PREVIEW - GP_FILE_TYPE_NORMAL - GP_FILE_TYPE_RAW - GP_FILE_TYPE_AUDIO - GP_FILE_TYPE_EXIF - - ctypedef struct CameraFile - - int gp_file_new (CameraFile **file) - int gp_file_ref (CameraFile *file) - int gp_file_unref (CameraFile *file) - int gp_file_free (CameraFile *file) - - int gp_file_open (CameraFile *file, char *filename) - int gp_file_save (CameraFile *file, char *filename) - int gp_file_clean (CameraFile *file) - int gp_file_copy (CameraFile *destination, CameraFile *source) - - int gp_file_set_name (CameraFile *file, char *name) - int gp_file_get_name (CameraFile *file, char **name) - - int gp_file_set_mime_type (CameraFile *file, char *mime_type) - int gp_file_get_mime_type (CameraFile *file, char **mime_type) - - int gp_file_set_type (CameraFile *file, CameraFileType type) - int gp_file_get_type (CameraFile *file, CameraFileType *type) - - int gp_file_set_mtime (CameraFile *file, mtime) - int gp_file_get_mtime (CameraFile *file, mtime) - - int gp_file_detect_mime_type (CameraFile *file) - int gp_file_adjust_name_for_mime_type (CameraFile *file) - - int gp_file_append (CameraFile*, char *data, unsigned long int size) - int gp_file_set_data_and_size (CameraFile*, char *data, unsigned long int size) - int gp_file_get_data_and_size (CameraFile*, char **data, unsigned long int *size) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-list.h": - ctypedef enum defines_list: - MAX_ENTRIES - - cdef struct s_entry: - char name[128] - char value[128] - - ctypedef struct CameraList: - int count - s_entry entry[MAX_ENTRIES] - int ref_count - - int gp_list_new (CameraList **list) - int gp_list_ref (CameraList *list) - int gp_list_unref (CameraList *list) - int gp_list_free (CameraList *list) - - int gp_list_count (CameraList *list) - int gp_list_append (CameraList *list, char *name, char *value) - int gp_list_reset (CameraList *list) - int gp_list_sort (CameraList *list) - - int gp_list_get_name (CameraList *list, int index, char **name) - int gp_list_get_value (CameraList *list, int index, char **value) - - int gp_list_set_name (CameraList *list, int index, char *name) - int gp_list_set_value (CameraList *list, int index, char *value) - - int gp_list_populate (CameraList *list, char *format, int count) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-filesys.h": - - ctypedef enum CameraFileInfoFields: - GP_FILE_INFO_NONE - GP_FILE_INFO_TYPE - GP_FILE_INFO_NAME - GP_FILE_INFO_SIZE - GP_FILE_INFO_WIDTH - GP_FILE_INFO_HEIGHT - GP_FILE_INFO_PERMISSIONS - GP_FILE_INFO_STATUS - GP_FILE_INFO_MTIME - GP_FILE_INFO_ALL - - ctypedef enum CameraFilePermissions: - GP_FILE_PERM_NONE - GP_FILE_PERM_READ - GP_FILE_PERM_DELETE - GP_FILE_PERM_ALL - - ctypedef enum CameraFileStatus: - GP_FILE_STATUS_NOT_DOWNLOADED - GP_FILE_STATUS_DOWNLOADED - - ctypedef struct CameraFileInfoFile: - CameraFileInfoFields fields - CameraFileStatus status - unsigned long size - char type[64] - - unsigned int width, height - char name[64] - CameraFilePermissions permissions - time_t mtime - - ctypedef struct CameraFileInfoPreview: - CameraFileInfoFields fields - CameraFileStatus status - unsigned long size - char type[64] - unsigned int width, height - - ctypedef struct CameraFileInfoAudio: - CameraFileInfoFields fields - CameraFileStatus status - unsigned long size - char type[64] - - ctypedef struct CameraFileInfo: - CameraFileInfoPreview preview - CameraFileInfoFile file - CameraFileInfoAudio audio - - ctypedef struct CameraFilesystem - - int gp_filesystem_new (CameraFilesystem **fs) - int gp_filesystem_free (CameraFilesystem *fs) - - int gp_filesystem_append (CameraFilesystem *fs, char *folder, char *filename, GPContext *context) - int gp_filesystem_set_info_noop (CameraFilesystem *fs, char *folder, CameraFileInfo info, GPContext *context) - int gp_filesystem_set_file_noop (CameraFilesystem *fs, char *folder, CameraFile *file, GPContext *context) - int gp_filesystem_delete_file_noop (CameraFilesystem *fs, char *folder, char *filename, GPContext *context) - int gp_filesystem_reset (CameraFilesystem *fs) - - int gp_filesystem_count (CameraFilesystem *fs, char *folder, GPContext *context) - int gp_filesystem_name (CameraFilesystem *fs, char *folder, int filenumber, char **filename, GPContext *context) - int gp_filesystem_get_folder (CameraFilesystem *fs, char *filename, char **folder, GPContext *context) - int gp_filesystem_number (CameraFilesystem *fs, char *folder, char *filename, GPContext *context) - - ctypedef int (*CameraFilesystemListFunc) (CameraFilesystem *fs, char *folder, CameraList *list, void *data, GPContext *context) - int gp_filesystem_set_list_funcs (CameraFilesystem *fs, CameraFilesystemListFunc file_list_func, CameraFilesystemListFunc folder_list_func, void *data) - int gp_filesystem_list_files (CameraFilesystem *fs, char *folder, CameraList *list, GPContext *context) - int gp_filesystem_list_folders (CameraFilesystem *fs, char *folder, CameraList *list, GPContext *context) - - ctypedef int (*CameraFilesystemSetInfoFunc) (CameraFilesystem *fs, char *folder, char *filename, CameraFileInfo info, void *data, GPContext *context) - ctypedef int (*CameraFilesystemGetInfoFunc) (CameraFilesystem *fs, char *folder, char *filename, CameraFileInfo *info, void *data, GPContext *context) - int gp_filesystem_set_info_funcs (CameraFilesystem *fs, CameraFilesystemGetInfoFunc get_info_func, - CameraFilesystemSetInfoFunc set_info_func, - void *data) - int gp_filesystem_get_info (CameraFilesystem *fs, char *folder, - char *filename, CameraFileInfo *info, - GPContext *context) - int gp_filesystem_set_info (CameraFilesystem *fs, char *folder, - char *filename, CameraFileInfo info, - GPContext *context) - - ctypedef int (*CameraFilesystemGetFileFunc) (CameraFilesystem *fs, - char *folder, - char *filename, - CameraFileType type, - CameraFile *file, void *data, - GPContext *context) - ctypedef int (*CameraFilesystemDeleteFileFunc) (CameraFilesystem *fs, - char *folder, - char *filename, - void *data, GPContext *context) - int gp_filesystem_set_file_funcs (CameraFilesystem *fs, - CameraFilesystemGetFileFunc get_file_func, - CameraFilesystemDeleteFileFunc del_file_func, - void *data) - int gp_filesystem_get_file (CameraFilesystem *fs, char *folder, - char *filename, CameraFileType type, - CameraFile *file, GPContext *context) - int gp_filesystem_delete_file (CameraFilesystem *fs, char *folder, - char *filename, GPContext *context) - - ctypedef int (*CameraFilesystemPutFileFunc) (CameraFilesystem *fs, - char *folder, - CameraFile *file, void *data, - GPContext *context) - ctypedef int (*CameraFilesystemDeleteAllFunc) (CameraFilesystem *fs, - char *folder, void *data, - GPContext *context) - ctypedef int (*CameraFilesystemDirFunc) (CameraFilesystem *fs, - char *folder, - char *name, void *data, - GPContext *context) - int gp_filesystem_set_folder_funcs (CameraFilesystem *fs, - CameraFilesystemPutFileFunc put_file_func, - CameraFilesystemDeleteAllFunc delete_all_func, - CameraFilesystemDirFunc make_dir_func, - CameraFilesystemDirFunc remove_dir_func, - void *data) - int gp_filesystem_put_file (CameraFilesystem *fs, char *folder, - CameraFile *file, GPContext *context) - int gp_filesystem_delete_all (CameraFilesystem *fs, char *folder, - GPContext *context) - int gp_filesystem_make_dir (CameraFilesystem *fs, char *folder, - char *name, GPContext *context) - int gp_filesystem_remove_dir (CameraFilesystem *fs, char *folder, - char *name, GPContext *context) - - int gp_filesystem_dump (CameraFilesystem *fs) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-abilities-list.h": - ctypedef enum CameraDriverStatus: - GP_DRIVER_STATUS_PRODUCTION - GP_DRIVER_STATUS_TESTING - GP_DRIVER_STATUS_EXPERIMENTAL - GP_DRIVER_STATUS_DEPRECATED - - ctypedef enum CameraOperation: - GP_OPERATION_NONE - GP_OPERATION_CAPTURE_IMAGE - GP_OPERATION_CAPTURE_VIDEO - GP_OPERATION_CAPTURE_AUDIO - GP_OPERATION_CAPTURE_PREVIEW - GP_OPERATION_CONFIG - - ctypedef enum CameraFileOperation: - GP_FILE_OPERATION_NONE - GP_FILE_OPERATION_DELETE - GP_FILE_OPERATION_PREVIEW - GP_FILE_OPERATION_RAW - GP_FILE_OPERATION_AUDIO - GP_FILE_OPERATION_EXIF - - ctypedef enum CameraFolderOperation: - GP_FOLDER_OPERATION_NONE - GP_FOLDER_OPERATION_DELETE_ALL - GP_FOLDER_OPERATION_PUT_FILE - GP_FOLDER_OPERATION_MAKE_DIR - GP_FOLDER_OPERATION_REMOVE_DIR - - ctypedef struct CameraAbilities: - char model [128] - CameraDriverStatus status - GPPortType port - int speed [64] - CameraOperation operations - CameraFileOperation file_operations - CameraFolderOperation folder_operations - int usb_vendor, usb_product - int usb_class, usb_subclass, usb_protocol - char library [1024] - char id [1024] - int reserved1 - int reserved2 - int reserved3 - int reserved4 - int reserved5 - int reserved6 - int reserved7 - int reserved8 - - ctypedef struct CameraAbilitiesList - - int gp_abilities_list_new (CameraAbilitiesList **list) - int gp_abilities_list_free (CameraAbilitiesList *list) - int gp_abilities_list_load (CameraAbilitiesList *list, GPContext *context) - int gp_abilities_list_reset (CameraAbilitiesList *list) - int gp_abilities_list_detect (CameraAbilitiesList *list, GPPortInfoList *info_list, CameraList *l, GPContext *context) - int gp_abilities_list_append (CameraAbilitiesList *list, CameraAbilities abilities) - int gp_abilities_list_count (CameraAbilitiesList *list) - int gp_abilities_list_lookup_model (CameraAbilitiesList *list, char *model) - int gp_abilities_list_get_abilities (CameraAbilitiesList *list, int index, CameraAbilities *abilities) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-camera.h": - # include <gphoto2-context.h> - - ctypedef struct Camera - - #include <gphoto2-port.h> - #include <gphoto2-port-info-list.h> - - #include <gphoto2-widget.h> - #include <gphoto2-list.h> - #include <gphoto2-file.h> - #include <gphoto2-filesys.h> - #include <gphoto2-abilities-list.h> - #include <gphoto2-result.h> - #include <gphoto2-context.h> - - ctypedef struct CameraText: - char text [32 * 1024] - - ctypedef struct CameraFilePath: - char name [128] - char folder [1024] - - ctypedef enum CameraCaptureType: - GP_CAPTURE_IMAGE - GP_CAPTURE_MOVIE - GP_CAPTURE_SOUND - - ctypedef enum CameraEventType: - GP_EVENT_UNKNOWN # unknown and unhandled event - GP_EVENT_TIMEOUT # timeout, no arguments - GP_EVENT_FILE_ADDED # CameraFilePath = file in camfs - GP_EVENT_FOLDER_ADDED # CameraFilePath = folder in camfs - - ctypedef int (*CameraExitFunc) (Camera *camera, GPContext *context) - ctypedef int (*CameraGetConfigFunc) (Camera *camera, CameraWidget **widget, GPContext *context) - ctypedef int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget, GPContext *context) - ctypedef int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context) - ctypedef int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file, GPContext *context) - ctypedef int (*CameraSummaryFunc) (Camera *camera, CameraText *text, - GPContext *context) - ctypedef int (*CameraManualFunc) (Camera *camera, CameraText *text, - GPContext *context) - ctypedef int (*CameraAboutFunc) (Camera *camera, CameraText *text, - GPContext *context) - - ctypedef int (*CameraPrePostFunc) (Camera *camera, GPContext *context) - - ctypedef struct CameraFunctions: - CameraPrePostFunc pre_func - CameraPrePostFunc post_func - CameraExitFunc exit - CameraGetConfigFunc get_config - CameraSetConfigFunc set_config - CameraCaptureFunc capture - CameraCapturePreviewFunc capture_preview - CameraSummaryFunc summary - CameraManualFunc manual - CameraAboutFunc about - void *reserved1 - void *reserved2 - void *reserved3 - void *reserved4 - void *reserved5 - void *reserved6 - void *reserved7 - void *reserved8 - - ctypedef GPPort CameraPort - ctypedef GPPortInfo CameraPortInfo - - ctypedef struct CameraPrivateLibrary - ctypedef struct CameraPrivateCore - - cdef struct _Camera: - GPPort *port - CameraFilesystem *fs - CameraFunctions *functions - CameraPrivateLibrary *pl - CameraPrivateCore *pc - - int gp_camera_new (Camera **camera) - - int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities) - int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities) - int gp_camera_set_port_info (Camera *camera, GPPortInfo info) - int gp_camera_get_port_info (Camera *camera, GPPortInfo *info) - - int gp_camera_set_port_speed (Camera *camera, int speed) - int gp_camera_get_port_speed (Camera *camera) - - int gp_camera_init (Camera *camera, GPContext *context) - int gp_camera_exit (Camera *camera, GPContext *context) - - int gp_camera_ref (Camera *camera) - int gp_camera_unref (Camera *camera) - int gp_camera_free (Camera *camera) - - int gp_camera_get_config (Camera *camera, CameraWidget **window, GPContext *context) - int gp_camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) - int gp_camera_get_summary (Camera *camera, CameraText *summary, GPContext *context) - int gp_camera_get_manual (Camera *camera, CameraText *manual, GPContext *context) - int gp_camera_get_about (Camera *camera, CameraText *about, GPContext *context) - int gp_camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context) - int gp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context) - int gp_camera_wait_for_event (Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context) - - int gp_camera_folder_list_files (Camera *camera, char *folder, CameraList *list, GPContext *context) - int gp_camera_folder_list_folders (Camera *camera, char *folder, CameraList *list, GPContext *context) - int gp_camera_folder_delete_all (Camera *camera, char *folder, GPContext *context) - int gp_camera_folder_put_file (Camera *camera, char *folder, CameraFile *file, GPContext *context) - int gp_camera_folder_make_dir (Camera *camera, char *folder, char *name, GPContext *context) - int gp_camera_folder_remove_dir (Camera *camera, char *folder, char *name, GPContext *context) - - int gp_camera_file_get_info (Camera *camera, char *folder, char *file, CameraFileInfo *info, GPContext *context) - int gp_camera_file_set_info (Camera *camera, char *folder, char *file, CameraFileInfo info, GPContext *context) - int gp_camera_file_get (Camera *camera, char *folder, char *file, CameraFileType type, CameraFile *camera_file, GPContext *context) - int gp_camera_file_delete (Camera *camera, char *folder, char *file, GPContext *context) - - ctypedef int (* CameraTimeoutFunc) (Camera *camera, GPContext *context) - ctypedef unsigned int (* CameraTimeoutStartFunc) (Camera *camera, unsigned int timeout, CameraTimeoutFunc func, void *data) - ctypedef void (* CameraTimeoutStopFunc) (Camera *camera, unsigned int id, void *data) - void gp_camera_set_timeout_funcs (Camera *camera, CameraTimeoutStartFunc start_func, CameraTimeoutStopFunc stop_func, void *data) - int gp_camera_start_timeout (Camera *camera, unsigned int timeout, CameraTimeoutFunc func) - void gp_camera_stop_timeout (Camera *camera, unsigned int id) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-library.h": - ctypedef int (* CameraLibraryIdFunc) (CameraText *id) - ctypedef int (* CameraLibraryAbilitiesFunc) (CameraAbilitiesList *list) - ctypedef int (* CameraLibraryInitFunc) (Camera *camera, GPContext *context) - int camera_id (CameraText *id) - int camera_abilities (CameraAbilitiesList *list) - int camera_init (Camera *camera, GPContext *context) - -#------------------------------------------------------------------------------ - -cdef extern from "gphoto2-setting.h": - int gp_setting_set (char *id, char *key, char *value) - int gp_setting_get (char *id, char *key, char *value) - -#------------------------------------------------------------------------------ - -def version(verbose=False): - cdef char **cText - if verbose==False: - cText=<char **>gp_library_version(GP_VERSION_SHORT) - else: - cText=<char **>gp_library_version(GP_VERSION_VERBOSE) - return cText[0] - -cdef check(result): - if result!=0: - txt=gp_result_as_string(result) - raise Exception('Error ('+str(result)+') : '+txt) - -cdef check_unref(int result,CameraFile *file): - if result!=0: - gp_file_unref(file) - txt=gp_result_as_string(result) - raise Exception('Error ('+str(result)+') : '+txt) - -cdef class portInfo: - cdef GPPortInfo info - - def __repr__(self): - return self.info.name - -cdef class ports: - cdef GPPortInfoList *portInfoList - - def __new__(self): - check(gp_port_info_list_new(&self.portInfoList)) - - def __dealloc__(self): - check(gp_port_info_list_free(self.portInfoList)) - - def load(self): - check(gp_port_info_list_load(self.portInfoList)) - - def count(self): - return gp_port_info_list_count(self.portInfoList) - - def __getitem__(self, num): - cdef portInfo info - info=portInfo() - check(gp_port_info_list_get_info(self.portInfoList, num, &info.info)) - return info - -cdef class cameraList: - cdef CameraList *liste - - def __new__(self): - check(gp_list_new(&self.liste)) - - def __dealloc__(self): - check(gp_list_free(self.liste)) - - def count(self): - return gp_list_count(self.liste) - - def __getitem__(self, index): - cdef char *name - cdef char *value - check(gp_list_get_name(self.liste, index, &name)) - check(gp_list_get_value(self.liste, index, &value)) - return (name, value) - -cdef class cameraAbilities: - cdef CameraAbilities abilitie - - def __new__(self): - pass - - def __repr__(self): - return "Model : %s\nStatus : %d\nPort : %d\nOperations : %d\nFile Operations : %d\nFolder Operations : %d\nUSB (vendor/product) : %d/%d\nUSB class : %d/%d/%d\nLibrary : %s\nId : %s\n" % (self.abilitie.model, self.abilitie.status, self.abilitie.port, self.abilitie.operations, self.abilitie.file_operations, self.abilitie.folder_operations, self.abilitie.usb_vendor, self.abilitie.usb_product, self.abilitie.usb_class, self.abilitie.usb_subclass, self.abilitie.usb_protocol, self.abilitie.library, self.abilitie.id) - - property model: - def __get__(self): - return self.abilitie.model - - property status: - def __get__(self): - return self.abilitie.status - - property port: - def __get__(self): - return self.abilitie.port - - property operations: - def __get__(self): - return self.abilitie.operations - - property file_operations: - def __get__(self): - return self.abilitie.file_operations - - property folder_operations: - def __get__(self): - return self.abilitie.folder_operations - - property usb_vendor: - def __get__(self): - return self.abilitie.usb_vendor - - property usb_product: - def __get__(self): - return self.abilitie.usb_product - - property usb_class: - def __get__(self): - return self.abilitie.usb_class - - property usb_subclass: - def __get__(self): - return self.abilitie.usb_subclass - - property usb_protocol: - def __get__(self): - return self.abilitie.usb_protocol - - property library: - def __get__(self): - return self.abilitie.library - - property id: - def __get__(self): - return self.abilitie.id - -cdef class abilities_list: - cdef CameraAbilitiesList *abilitiesList - - def __new__(self): - check(gp_abilities_list_new(&self.abilitiesList)) - - def __dealloc__(self): - check(gp_abilities_list_free(self.abilitiesList)) - - def count(self): - return gp_abilities_list_count(self.abilitiesList) - - def load(self): - check(gp_abilities_list_load(self.abilitiesList, NULL)) - - def __getitem__(self, index): - cdef cameraAbilities ab - ab=cameraAbilities() - check(gp_abilities_list_get_abilities(self.abilitiesList, index, &ab.abilitie)) - return ab - - def lookup_model(self, model): - ret=gp_abilities_list_lookup_model(self.abilitiesList, model) - return ret - - def detect(self, ports p): - cdef cameraList l - l=cameraList() - check(gp_abilities_list_detect(self.abilitiesList, p.portInfoList, l.liste, NULL)) - return l - -class cameraeventtype: - GP_EVENT_UNKNOWN, \ - GP_EVENT_TIMEOUT, \ - GP_EVENT_FILE_ADDED, \ - GP_EVENT_FOLDER_ADDED \ - = range(0,4) - -cdef class camera: - cdef Camera *camera - - def __new__(self): - check(gp_camera_new(&self.camera)) - - def init(self): - check(gp_camera_init(self.camera, NULL)) - - def reinit(self): - gp_camera_free(self.camera) - check(gp_camera_new(&self.camera)) - self.init() - - def __dealloc__(self): - check(gp_camera_free(self.camera)) - - property abilities: - def __set__(self, cameraAbilities ab): - check(gp_camera_set_abilities(self.camera, ab.abilitie)) - def __get__(self): - cdef cameraAbilities ab - ab=cameraAbilities() - check(gp_camera_get_abilities(self.camera, &ab.abilitie)) - return ab - - property summary: - def __get__(self): - cdef CameraText txt - check(gp_camera_get_summary(self.camera, &txt, NULL)) - return txt.text - - def capture_image(self): - cdef CameraFilePath path - check(gp_camera_capture(self.camera, GP_CAPTURE_IMAGE, &path, NULL)) - return (path.folder, path.name) - - def wait_for_event(self,int timeout): - cdef CameraEventType event - cdef void *data - check(gp_camera_wait_for_event(self.camera,timeout,&event,&data,NULL)) - eventdata=None - if event==GP_EVENT_FILE_ADDED: - eventdata=((<CameraFilePath*>data).folder,(<CameraFilePath*>data).name) - free(data) - return (event,eventdata) - - def list_folders_in_folder(self,char *path): - cdef cameraList l - l=cameraList() - check(gp_camera_folder_list_folders( self.camera, path, l.liste, NULL )); - return l - - def list_files_in_folder(self,char *path): - cdef cameraList l - l=cameraList() - check(gp_camera_folder_list_files( self.camera, path, l.liste, NULL )); - return l - - def upload_file_to(self,char *srcpath,char *destfolder,char *destfilename): - cdef CameraFile *cfile - check( gp_file_new( &cfile ) ) - check_unref( gp_file_open( cfile, srcpath ), cfile ) - check_unref( gp_file_set_name( cfile, destfilename ), cfile ) - check_unref( gp_camera_folder_put_file( self.camera, destfolder, cfile, NULL ), cfile ) - gp_file_unref( cfile ) - - def download_file_to(self,char *srcfolder,char *srcfilename,char *destpath): - cdef CameraFile *cfile - cdef char *data - cdef unsigned long size - check( gp_file_new( &cfile ) ) - check_unref( gp_camera_file_get ( self.camera, srcfolder, srcfilename, GP_FILE_TYPE_NORMAL, cfile, NULL ), cfile ) - check_unref( gp_file_get_data_and_size( cfile, &data, &size ), cfile ) - gp_file_unref( cfile ) - dfile = open( destpath, 'w' ) - dfile.write( PyString_FromStringAndSize( data, size ) ) - dfile.close() - diff --git a/bindings/python/gptest.py b/bindings/python/gptest.py deleted file mode 100644 index b3d541383..000000000 --- a/bindings/python/gptest.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2003-2004 David PHAM-VAN -- david@ab2r.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -import gphoto2 - -print "GPhoto version "+gphoto2.version() - -#print dir(gphoto2) - -print("Creating camera...") -cam=gphoto2.camera() - -# ports=gphoto2.ports() -# ports.load() -# print ports.count(), " ports trouves" -# for port in range(0,ports.count()): -# print ports[port] -# -# -# print("Setting model...") -# abl=gphoto2.abilities_list() -# abl.load() -# -# print("Detection des cameras...") -# dt=abl.detect(ports) -# print dt.count() -# for i in range(0,dt.count()): -# print dt[i] -# -# mdl=abl.lookup_model(dt[0][0]) -# ab=abl[mdl] -# -# print ab -# -# cam.set_abilities(ab) - -print("Initializing camera...") -cam.init() -list = cam.list_folders_in_folder('/') -for i in range(0,list.count()): - print list[i] -print cam.summary -print cam.abilities -print cam.capture_image() diff --git a/bindings/python/setup.py b/bindings/python/setup.py deleted file mode 100644 index d8e2d7e11..000000000 --- a/bindings/python/setup.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2003-2004 David PHAM-VAN -- david@ab2r.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from distutils.core import setup -from distutils.extension import Extension -from Pyrex.Distutils import build_ext - -setup( - name = "python-gphoto2", - ext_modules=[ - Extension( - "gphoto2", ["gphoto2.pyx"], - libraries = ["gphoto2"], - include_dirs = ["/usr/include/gphoto2"] - ) - ], - cmdclass = {'build_ext': build_ext} -) diff --git a/configure.ac b/configure.ac index 430bbc589..81d918ba7 100644 --- a/configure.ac +++ b/configure.ac @@ -136,30 +136,6 @@ GP_CONFIG_MSG([GP2DDB support], [${gp_msg_gp2ddb} (EXPERIMENTAL)]) GP_PKG_CONFIG -dnl -------------------------------------------------------------------- -dnl Check requirements for bindings -dnl -------------------------------------------------------------------- - -dnl Check for SWIG - -AC_PATH_PROG([SWIG], [swig]) -AC_SUBST([SWIG]) -AM_CONDITIONAL([HAVE_SWIG], [test -x "$SWIG"]) - -AC_PATH_PROG([JAVAC], [javac]) -AC_SUBST([JAVAC]) -AC_PATH_PROG([JAVA], [java]) -AC_SUBST([JAVA]) -AM_CONDITIONAL([HAVA_JDK], [test -x "$JAVAC" && test -x "$JAVA"]) - -if false && test -x "$SWIG" && test -x "$JAVAC" && test -x "$JAVA"; then - bindings="${bindings}${bindings+ }java" -fi - -GP_CONFIG_MSG([Bindings], [${bindings}]) - -AC_SUBST([BINDING_SUBDIRS], [${bindings}]) - dnl check for/set up libtool and libltdl dnl AC_DISABLE_STATIC dnl AC_DISABLE_SHARED @@ -620,7 +596,6 @@ po/Makefile.in doc/Makefile doc/Doxyfile doc/api/Makefile -bindings/Makefile ],[ dnl This relies on this code being called for each of the above files dnl with ac_file set to the filename. |