diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/COPYRIGHT b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/COPYRIGHT new file mode 100644 index 0000000000..9d0d9da185 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/COPYRIGHT @@ -0,0 +1,18 @@ +Copyright + +Copyright (C) 1999-2010 Joachim Buermann (jbuermann@iftools.com) + +ctb is free software; you can redistribute it and/or modify it under +the term of the GNU Library General Public Licence as published by the +Free Software Foundation. + +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 +Library General Public Licence for more details + + +EXCEPTION NOTICE +As a special exception, you may use, copy, link, modify and distribute +under the user's own terms, binary object code versions of works based +on the library. diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/GNUmakefile b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/GNUmakefile new file mode 100644 index 0000000000..e39a687d4c --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/GNUmakefile @@ -0,0 +1,293 @@ +# ========================================================================= +# This makefile was generated by +# Bakefile 0.2.5 (http://www.bakefile.org) +# Do not modify, all changes will be overwritten! +# ========================================================================= + + + +# ------------------------------------------------------------------------- +# These are configurable options: +# ------------------------------------------------------------------------- + +# 'install' program location +INSTALL ?= install + +# Location where the package is installed by 'make install' +prefix ?= /usr/local + +# Destination root (/ is used if empty) +DESTDIR ?= + +# +AR ?= ar + +# +RANLIB ?= ranlib + +# Compiler flags to link shared library +LINK_DLL_FLAGS ?= -shared + +# C++ compiler +CXX = g++ + +# Standard flags for C++ +CXXFLAGS ?= + +# Standard preprocessor flags (common for CC and CXX) +CPPFLAGS ?= + +# Standard linker flags +LDFLAGS ?= + +# Set to 1 to build debug version [0,1] +DEBUG ?= 0 + +# +GPIB ?= 0 + + + +# ------------------------------------------------------------------------- +# Do not modify the rest of this file! +# ------------------------------------------------------------------------- + +### Variables: ### + +CPPDEPS = -MT$@ -MF`echo $@ | sed -e 's,\.o$$,.d,'` -MD -MP +CTB_LIB_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -D_THREAD_SAFE -pthread \ + $(__OPTIMIZE_FLAG) -I../include $(CPPFLAGS) $(CXXFLAGS) +CTB_LIB_OBJECTS = \ + $(OUTPUT)/ctb_lib_fifo.o \ + $(OUTPUT)/ctb_lib_getopt.o \ + $(OUTPUT)/ctb_lib_iobase.o \ + $(OUTPUT)/ctb_lib_portscan.o \ + $(OUTPUT)/ctb_lib_serportx.o \ + $(OUTPUT)/ctb_lib_serport.o \ + $(OUTPUT)/ctb_lib_timer.o \ + $(__GPIBSRC_OBJECTS) +CTB_DLL_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -D_THREAD_SAFE -pthread \ + $(__OPTIMIZE_FLAG) -I../include -fPIC -DPIC $(CPPFLAGS) $(CXXFLAGS) +CTB_DLL_OBJECTS = \ + $(OUTPUT)/ctb_dll_fifo.o \ + $(OUTPUT)/ctb_dll_getopt.o \ + $(OUTPUT)/ctb_dll_iobase.o \ + $(OUTPUT)/ctb_dll_portscan.o \ + $(OUTPUT)/ctb_dll_serportx.o \ + $(OUTPUT)/ctb_dll_serport.o \ + $(OUTPUT)/ctb_dll_timer.o \ + $(__GPIBSRC_OBJECTS_1) +CTBTEST_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -DGPIB=$(GPIB) -D_THREAD_SAFE \ + -pthread $(__OPTIMIZE_FLAG) -I../include $(CPPFLAGS) $(CXXFLAGS) +CTBTEST_OBJECTS = \ + $(OUTPUT)/ctbtest_ctbtest.o + +### Conditionally set variables: ### + +ifeq ($(DEBUG),0) +OUTPUT = release +endif +ifeq ($(DEBUG),1) +OUTPUT = debug +endif +ifeq ($(DEBUG),1) +LIBFLAG = d +endif +ifeq ($(GPIB),1) +GPIBFLAG = _gpib +endif +ifeq ($(GPIB),1) +GPIBINC = gpib.h +endif +ifeq ($(GPIB),1) +__GPIBSRC_OBJECTS = \ + $(OUTPUT)/ctb_lib_gpib.o +endif +ifeq ($(GPIB),1) +__GPIBSRC_OBJECTS_1 = \ + $(OUTPUT)/ctb_dll_gpib.o +endif +ifeq ($(DEBUG),0) +____DEBUG = -DNDEBUG +endif +ifeq ($(DEBUG),1) +____DEBUG = +endif +ifeq ($(DEBUG),0) +__OPTIMIZE_FLAG = -O0 +endif +ifeq ($(DEBUG),1) +__OPTIMIZE_FLAG = -O2 +endif +ifeq ($(GPIB),1) +__SYSLIB2_p = -lgpib +endif +ifeq ($(DEBUG),0) +____DEBUG_1 = +endif +ifeq ($(DEBUG),1) +____DEBUG_1 = -g +endif + + +all: $(OUTPUT) +$(OUTPUT): + @mkdir -p $(OUTPUT) + +### Targets: ### + +all: ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so $(OUTPUT)/ctbtest tip-linux + +install: install_ctb_lib install_ctb_dll + $(INSTALL) -d $(DESTDIR)$(prefix)/include/ctb-0.16 + for f in ctb.h fifo.h getopt.h $(GPIBINC) iobase.h linux/serport.h linux/timer.h portscan.h serport.h serportx.h timer.h; do \ + if test ! -d $(DESTDIR)$(prefix)/include/ctb-0.16/`dirname $$f` ; then \ + $(INSTALL) -d $(DESTDIR)$(prefix)/include/ctb-0.16/`dirname $$f`; \ + fi; \ + $(INSTALL) -m 644 ../include/ctb-0.16/$$f $(DESTDIR)$(prefix)/include/ctb-0.16/$$f; \ + done + +uninstall: uninstall_ctb_lib uninstall_ctb_dll + for f in ctb.h fifo.h getopt.h $(GPIBINC) iobase.h linux/serport.h linux/timer.h portscan.h serport.h serportx.h timer.h; do \ + rm -f $(DESTDIR)$(prefix)/include/ctb-0.16/$$f; \ + done + +clean: + rm -f $(OUTPUT)/*.o + rm -f $(OUTPUT)/*.d + rm -f ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a + rm -f ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so + rm -f ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so + rm -f $(OUTPUT)/ctbtest + +htmldoc: + (cd ..; tar -cvzf manual/libctb-0.16-htmldoc.tar.gz docs/html/ ) + +tarball: + (cd ../..; tar -cvzf libctb-0.16.tar.gz \ + libctb-0.16/build/ \ + libctb-0.16/manual/refman.pdf \ + libctb-0.16/include \ + libctb-0.16/python \ + libctb-0.16/samples \ + libctb-0.16/src \ + libctb-0.16/lib/gpib32.lib \ + --exclude=release \ + --exclude=debug \ + --exclude=install \ + --exclude=output \ + --exclude=website \ + --exclude=*~ \ + --exclude=buildall.sh \ + --exclude=buildall.bat \ + --exclude=version-update.sh \ + --exclude=libctb-0.16.tar.gz \ + --exclude=*.ilk \ + --exclude=*.log \ + --exclude=*.o* \ + --exclude=*.pdb \ + --exclude=*.pyc \ + --exclude=.svn; mv libctb-0.16.tar.gz libctb-0.16/build ) + +../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a: $(CTB_LIB_OBJECTS) + rm -f $@ + $(AR) rcu $@ $(CTB_LIB_OBJECTS) + $(RANLIB) $@ + +install_ctb_lib: ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a + $(INSTALL) -d $(DESTDIR)$(prefix)/lib + $(INSTALL) -m 644 ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a $(DESTDIR)$(prefix)/lib + +uninstall_ctb_lib: + rm -f $(DESTDIR)$(prefix)/lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a + +../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so: $(CTB_DLL_OBJECTS) + $(CXX) $(LINK_DLL_FLAGS) -fPIC -o $@ $(CTB_DLL_OBJECTS) $(____DEBUG_1) -pthread -L../lib $(LDFLAGS) -lpthread $(__SYSLIB2_p) + +install_ctb_dll: ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so + $(INSTALL) -d $(DESTDIR)$(prefix)/lib + $(INSTALL) -m 644 ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so $(DESTDIR)$(prefix)/lib + install -c ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so $(DESTDIR)$(prefix)/lib + +uninstall_ctb_dll: + rm -f $(DESTDIR)$(prefix)/lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so + rm -f $(DESTDIR)$(prefix)/lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.so + +$(OUTPUT)/ctbtest: $(CTBTEST_OBJECTS) ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a + $(CXX) -o $@ $(CTBTEST_OBJECTS) $(____DEBUG_1) -pthread -L../lib $(LDFLAGS) ../lib/libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a -lpthread $(__SYSLIB2_p) + +tip-linux: + @echo " " + @echo "================================================================" + @echo " The building of ctb is finished. On Linux you'll now" + @echo " have to run (as root):" + @echo " " + @echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) install" + @echo " " + @echo " to install the libraries in $(prefix)/lib" + @echo " and the header files in $(prefix)/include/ctb-0.16" + @echo " " + @echo " Don't forget to run ldconfig (also as root)" + @echo " " + @echo " ctb comes with no guarantees and doesn't claim" + @echo " to be suitable for any purpose." + @echo "================================================================" + @echo " " + +$(OUTPUT)/ctb_lib_fifo.o: ./../src/fifo.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_lib_getopt.o: ./../src/getopt.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_lib_iobase.o: ./../src/iobase.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_lib_portscan.o: ./../src/portscan.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_lib_serportx.o: ./../src/serportx.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_lib_serport.o: ./../src/linux/serport.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_lib_timer.o: ./../src/linux/timer.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_lib_gpib.o: ./../src/gpib.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_fifo.o: ./../src/fifo.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_getopt.o: ./../src/getopt.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_iobase.o: ./../src/iobase.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_portscan.o: ./../src/portscan.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_serportx.o: ./../src/serportx.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_serport.o: ./../src/linux/serport.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_timer.o: ./../src/linux/timer.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctb_dll_gpib.o: ./../src/gpib.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)/ctbtest_ctbtest.o: ./../samples/ctbtest.cpp + $(CXX) -c -o $@ $(CTBTEST_CXXFLAGS) $(CPPDEPS) $< + +.PHONY: all install uninstall clean install_ctb_lib uninstall_ctb_lib \ + install_ctb_dll uninstall_ctb_dll + + +# Dependencies tracking: +-include $(OUTPUT)/*.d diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/README b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/README new file mode 100644 index 0000000000..fdcdb1d37b --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/README @@ -0,0 +1,169 @@ + +CTB (Communication toolbox library) 08.02.2010 +====================================================================== + +Website: http://www.iftools.com/opensource/ctb.en.php +Version: 0.16 + + +Linux GCC compiliation +---------------------------------------------------------------- + +Type 'make DEBUG=x GPIB=x' or 'make -f GNUmakefile DEBUG=x GPIB=x' + +Type the same command with an additional install as root to copy the +headers and libs to there according system places +(i.e. /usr/local/include/ctb-0.16 and /usr/local/lib/libctb-0.16.a) +like: + +sudo make DEBUG=x GPIB=x install + + +Microsoft MingW32 compilation +---------------------------------------------------------------- + +Type mingw32-make -f makefile.gcc DEBUG=x GPIB=x + +Please note! Currently only a shared ctb library will be created. +You have to copy the ctb-VERSION.dll in the application path of +your application linked with ctb or in a global dll folder (but +not recommented!) + + +Microsoft Visual C++ compilation +---------------------------------------------------------------- + +Type 'nmake -f makefile.vc DEBUG=x GPIB=x' + +To create all libs (debug/release with and without gpib support) +just input: ./buildall.bat in the build folder. + + +Borland C++ 5.0/5.5 compilation +---------------------------------------------------------------- + +Type 'make -f makefile.bcc DEBUG=x GPIB=x' + + +Watcom C++ 10.6/11 and OpenWatcom compilation +---------------------------------------------------------------- + +Type 'wmake -f makefile.wat' + + +Python support +-------------- + +Since version 0.9 ctb also includes a python module ctb.py. +To build the python module by yourself, your system has to satisfy +the following requirements: + +- the SWIG program, you get it at http://www.swig.org/ (for linux, + take a look in your favorite distribution package manager). + The current ctb module was build with SWIG version 1.3.29 (linux) + and version 1.3.40 (Windows) +- the develop files for python (means the header and the library + files). I tested it with Python 2.4. You will get it at: + http://www.python.org/ftp/python/2.4.4/python-2.4.4.msi +- if you want to communicate via GPIB, a GPIB installation (GPIB + controller and software, for instance a Nation Instruments or + Keithley card). On Linux the libgpib. + +Like the building of the wxctb C++ library, you also can choose +between GPIB and non GPIB (default) support. + +Compile the python module + +Linux +cd in the python/src/linux folder and type: +./makepy.sh USE_GPIB +or +./makepy.sh +if you don't need any GPIB support + +Windows +cd in the python/src/windows folder. Open the makepy.bat with your +favorite editor and set the commented enviroment variables. See the +makepy.bat file for more information, how you can do that. +After that, just type: + +./makepy.sh USE_GPIB +(for GPIB support) or +./makepy.sh +if you don't need any GPIB support + +At last set the python modul path to the ctb-0.15/python/module +path. +On linux: + +export PYTHONPATH=somepath/ctb-0.15/python/module/linux + +On Windows: + +set PYTHONPATH=drive:\somepath\ctb-0.15\python\module\win32 + + +ChangeLog +--------- + +0.16 + - added port scan function. + - bug fixes for MingW build. + +0.15 + - added ctb namespace and removed all wx prefix (also in the header + path). + - Linux: A serial port cannot opened twice or more any longer. + - 9 bit data transmission support using the parity bit as ninth bit. + - improved documentation + - Some more documentation + +0.14 + - Support for non-standard baudrates (depends on the used UART + or USB to RS232 converter. + +0.13 + - remove the expect and match mechanism. They didn't work very + well, and a future implementation should be done as a + independent library. If someone missed this functions, please + let me know. + +0.12 + - more documentation for doxygen + - replace the ugly GetSettingsAsString methods by a more intuitive + one. + - wxGPIB::Read now checks the MAV bit before reading. This resolves + some stderr stuff on linux. + +0.11 + - the gpib sources are no longer depending on the OS. They are + identical for linux and windows. + - add the current version to the ctb include path, so you can + handle a parallel installation of different versions. + For instance: The header path wx/ctb is replaced by wx/ctb-0.11 + +0.10 + - replace the former gpib async io access with the standard + NI-488 functions (ibrd,ibwrt). To avoid blocking, the internal + gpib timeout was set to the lowest value, whereas the wxIOBase + methods handles the timeout in a global and transparent manner. + - add a FindListener method in the wxGPIB class to look for all + connected gpib devices (listeners). + - The Read and Readv method of the python wxIOBase class returns + additional zero bytes, fixed. + +0.9 + - added python support for both, serial and gpib + +0.8 + - added bakefile support + +0.7 + - added GPIB (Nation Instruments GPIB cards) support + + +Authors' info +------------- + +Joachim Buermann jbuermann@iftools.com + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/libctb.bkl b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/libctb.bkl new file mode 100644 index 0000000000..eb5670bd4a --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/libctb.bkl @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + 0.16 + libctb + + + + % + + + + + + + + + + debug + release + + $(OUTPUT) + + + ..$(DIRSEP)lib + + + + + d + + + + pthread + winmm + + + + gpib + gpib32 + + + + linux + win32 + + + + _gpib + + + + + ../src/gpib.cpp + + + + + + gpib.h + + + + + off + speed + + + + ../src/fifo.cpp + ../src/getopt.cpp + ../src/iobase.cpp + ../src/portscan.cpp + ../src/serportx.cpp + ../src/$(OS)/serport.cpp + ../src/$(OS)/timer.cpp + + + + + (cd ..; tar -cvzf manual/$(value) docs/html/ ) + + + + + + $(NAME)-$(VERSION)-htmldoc.tar.gz + + + + + + (cd ../..; tar -cvzf $(value) \ + $(NAME)-$(VERSION)/build/ \ + $(NAME)-$(VERSION)/manual/refman.pdf \ + $(NAME)-$(VERSION)/include \ + $(NAME)-$(VERSION)/python \ + $(NAME)-$(VERSION)/samples \ + $(NAME)-$(VERSION)/src \ + $(NAME)-$(VERSION)/lib/gpib32.lib \ + --exclude=release \ + --exclude=debug \ + --exclude=install \ + --exclude=output \ + --exclude=website \ + --exclude=*~ \ + --exclude=buildall.sh \ + --exclude=buildall.bat \ + --exclude=g++.sh \ + --exclude=version-update.sh \ + --exclude=$(value) \ + --exclude=*.ilk \ + --exclude=*.log \ + --exclude=*.o* \ + --exclude=*.pdb \ + --exclude=*.pyc \ + --exclude=.svn; mv $(value) $(NAME)-$(VERSION)/build ) + + + + + + $(NAME)-$(VERSION).tar.gz + + + + + + ..$(DIRSEP)include$(DIRSEP)ctb-$(VERSION) + + ctb.h + fifo.h + getopt.h + $(GPIBINC) + iobase.h + linux/serport.h + linux/timer.h + portscan.h + serport.h + serportx.h + timer.h + + $(INCLUDEDIR)$(DIRSEP)ctb-$(VERSION) + + + + ../lib + ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION) + + multi + static + $(OPTIMIZE_FLAG) + + $(FILES) + $(GPIBSRC) + + ../lib + $(SYSLIB1) + $(SYSLIB2) + ../include + $(LIBDIR) + + + ../lib + multi + ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION) + static + $(OPTIMIZE_FLAG) + ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION) + + $(FILES) + $(GPIBSRC) + + ../lib + $(SYSLIB1) + $(SYSLIB2) + ../include + $(LIBDIR) + + + + + + GPIB=$(GPIB) + multi + static + $(OPTIMIZE_FLAG) + + ../samples/ctbtest.cpp + + ../include + ../lib + ctb_lib + $(SYSLIB1) + $(SYSLIB2) + + + + vc + $(FORMAT) + + + + + + @if not exist $(INSTALLDIR)\lib\$(LIBNAME)_lib mkdir $(INSTALLDIR)\lib\$(LIBNAME)_lib + + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION).lib $(INSTALLDIR)\lib\$(LIBNAME)_lib + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-$(VERSION).dll $(INSTALLDIR)\lib\$(LIBNAME)_lib + + @if not exist $(INSTALLDIR)\include\ctb-$(VERSION)\win32 mkdir $(INSTALLDIR)\include\ctb-$(VERSION)\win32 + @copy ..\include\ctb-$(VERSION)\*.h $(INSTALLDIR)\include\ctb-$(VERSION) + @copy ..\include\ctb-$(VERSION)\win32\*.h $(INSTALLDIR)\include\ctb-$(VERSION)\win32 + + + + + all + + @echo " " + @echo "================================================================" + @echo " The building of ctb is finished. On Linux you'll now" + @echo " have to run (as root):" + @echo " " + @echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) install" + @echo " " + @echo " to install the libraries in $(LIBDIR)" + @echo " and the header files in $(INCLUDEDIR)/ctb-$(VERSION)" + @echo " " + @echo " Don't forget to run ldconfig (also as root)" + @echo " " + @echo " ctb comes with no guarantees and doesn't claim" + @echo " to be suitable for any purpose." + @echo "================================================================" + @echo " " + + + + + all + + @echo " " + @echo "================================================================" + @echo " The building of ctb is finished. If you have an installed " + @echo " wxWidget package (WXWIN must be defined in the enviroment), " + @echo " you'll now have to run: " + @echo " " + @echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall " + @echo " " + @echo " to install the libraries in: " + @echo " $(INSTALLDIR)$(DIRSEP)lib$(DIRSEP)$(LIBNAME)_lib " + @echo " and the header files in" + @echo " $(INSTALLDIR)$(DIRSEP)ctb-$(VERSION)" + @echo " " + @echo " If you are using another compiler (Borland, Watcom, mingw,...) " + @echo " take a look in the README in this directory! " + @echo " " + @echo " ctb comes with no guarantees and doesn't claim " + @echo " to be suitable for any purpose. " + @echo "================================================================" + @echo " " + + + + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.bcc b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.bcc new file mode 100644 index 0000000000..6afadafb3f --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.bcc @@ -0,0 +1,269 @@ +# ========================================================================= +# This makefile was generated by +# Bakefile 0.2.5 (http://www.bakefile.org) +# Do not modify, all changes will be overwritten! +# ========================================================================= + +.autodepend + +!ifndef BCCDIR +!ifndef MAKEDIR +!error Your Borland compiler does not define MAKEDIR. Please define the BCCDIR variable, e.g. BCCDIR=d:\bc4 +!endif +BCCDIR = $(MAKEDIR)\.. +!endif + + + +# ------------------------------------------------------------------------- +# These are configurable options: +# ------------------------------------------------------------------------- + +# C++ compiler +!ifndef CXX +CXX = bcc32 +!endif + +# Standard flags for C++ +!ifndef CXXFLAGS +CXXFLAGS = +!endif + +# Standard preprocessor flags (common for CC and CXX) +!ifndef CPPFLAGS +CPPFLAGS = -a8 -g0 +!endif + +# Standard linker flags +!ifndef LDFLAGS +LDFLAGS = +!endif + +# Set to 1 to build debug version [0,1] +!ifndef DEBUG +DEBUG = 0 +!endif + +# +!ifndef GPIB +GPIB = 0 +!endif + +# +!ifndef WXDIR +WXDIR = $(WXWIN) +!endif + +# +!ifndef INSTALLDIR +INSTALLDIR = $(WXWIN) +!endif + + + +# ------------------------------------------------------------------------- +# Do not modify the rest of this file! +# ------------------------------------------------------------------------- + +### Variables: ### + +CTB_LIB_CXXFLAGS = -I$(BCCDIR)\include $(____DEBUG) $(____DEBUG_2) -tWM \ + $(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS) +CTB_LIB_OBJECTS = \ + $(OUTPUT)\ctb_lib_fifo.obj \ + $(OUTPUT)\ctb_lib_getopt.obj \ + $(OUTPUT)\ctb_lib_iobase.obj \ + $(OUTPUT)\ctb_lib_portscan.obj \ + $(OUTPUT)\ctb_lib_serportx.obj \ + $(OUTPUT)\ctb_lib_serport.obj \ + $(OUTPUT)\ctb_lib_timer.obj \ + $(____GPIBSRC_FILENAMES_OBJECTS) +CTB_DLL_CXXFLAGS = -I$(BCCDIR)\include $(____DEBUG) $(____DEBUG_2) -tWM \ + $(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS) +CTB_DLL_OBJECTS = \ + $(OUTPUT)\ctb_dll_fifo.obj \ + $(OUTPUT)\ctb_dll_getopt.obj \ + $(OUTPUT)\ctb_dll_iobase.obj \ + $(OUTPUT)\ctb_dll_portscan.obj \ + $(OUTPUT)\ctb_dll_serportx.obj \ + $(OUTPUT)\ctb_dll_serport.obj \ + $(OUTPUT)\ctb_dll_timer.obj \ + $(____GPIBSRC_FILENAMES_1_OBJECTS) +CTBTEST_CXXFLAGS = -I$(BCCDIR)\include $(____DEBUG) $(____DEBUG_2) \ + -DGPIB=$(GPIB) -tWM $(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS) +CTBTEST_OBJECTS = \ + $(OUTPUT)\ctbtest_ctbtest.obj + +### Conditionally set variables: ### + +!if "$(DEBUG)" == "0" +OUTPUT = release +!endif +!if "$(DEBUG)" == "1" +OUTPUT = debug +!endif +!if "$(WXDIR)" == "" +INSTALLDIR = ..\lib +!endif +!if "$(DEBUG)" == "1" +LIBFLAG = d +!endif +!if "$(GPIB)" == "1" +GPIBFLAG = _gpib +!endif +!if "$(GPIB)" == "1" +____GPIBSRC_FILENAMES_OBJECTS = \ + $(OUTPUT)\ctb_lib_gpib.obj +!endif +!if "$(GPIB)" == "1" +____GPIBSRC_FILENAMES_1_OBJECTS = \ + $(OUTPUT)\ctb_dll_gpib.obj +!endif +!if "$(DEBUG)" == "0" +____DEBUG = -DNDEBUG +!endif +!if "$(DEBUG)" == "1" +____DEBUG = +!endif +!if "$(DEBUG)" == "0" +__OPTIMIZE_FLAG = -Od +!endif +!if "$(DEBUG)" == "1" +__OPTIMIZE_FLAG = -O2 +!endif +!if "$(GPIB)" == "1" +__SYSLIB2_p = gpib32.lib +!endif +!if "$(DEBUG)" == "0" +____DEBUG_2 = -v- +!endif +!if "$(DEBUG)" == "1" +____DEBUG_2 = -v +!endif + + +all: $(OUTPUT) +$(OUTPUT): + -if not exist $(OUTPUT) mkdir $(OUTPUT) + +### Targets: ### + +all: ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32 + +clean: + -if exist $(OUTPUT)\*.obj del $(OUTPUT)\*.obj + -if exist $(OUTPUT)\*.res del $(OUTPUT)\*.res + -if exist $(OUTPUT)\*.csm del $(OUTPUT)\*.csm + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.tds del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.tds + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilc del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilc + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ild del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ild + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilf del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilf + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ils del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ils + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + -if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe + -if exist $(OUTPUT)\ctbtest.tds del $(OUTPUT)\ctbtest.tds + -if exist $(OUTPUT)\ctbtest.ilc del $(OUTPUT)\ctbtest.ilc + -if exist $(OUTPUT)\ctbtest.ild del $(OUTPUT)\ctbtest.ild + -if exist $(OUTPUT)\ctbtest.ilf del $(OUTPUT)\ctbtest.ilf + -if exist $(OUTPUT)\ctbtest.ils del $(OUTPUT)\ctbtest.ils + +..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib: $(CTB_LIB_OBJECTS) + if exist $@ del $@ + tlib /a /p4096 $@ @&&| + $(CTB_LIB_OBJECTS) +| + +..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll: $(CTB_DLL_OBJECTS) + ilink32 -Tpd -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(____DEBUG_2) -L..\lib $(LDFLAGS) @&&| + c0d32.obj $(CTB_DLL_OBJECTS),$@,, winmm.lib $(__SYSLIB2_p) import32.lib cw32mt.lib,, +| + implib -f ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16 $@ + +$(OUTPUT)\ctbtest.exe: $(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(____DEBUG_2) -L..\lib $(LDFLAGS) @&&| + c0x32.obj $(CTBTEST_OBJECTS),$@,, ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib winmm.lib $(__SYSLIB2_p) import32.lib cw32mt.lib,, +| + +wxinstall: + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\borland_lib + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\borland_lib + + @if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32 + @copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16 + @copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32 + +tip-win32: + @echo " " + @echo "================================================================" + @echo " The building of ctb is finished. If you have an installed " + @echo " wxWidget package (WXWIN must be defined in the enviroment), " + @echo " you'll now have to run: " + @echo " " + @echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall " + @echo " " + @echo " to install the libraries in: " + @echo " $(INSTALLDIR)\lib\borland_lib " + @echo " and the header files in" + @echo " $(INSTALLDIR)\ctb-0.16" + @echo " " + @echo " If you are using another compiler (Borland, Watcom, mingw,...) " + @echo " take a look in the README in this directory! " + @echo " " + @echo " ctb comes with no guarantees and doesn't claim " + @echo " to be suitable for any purpose. " + @echo "================================================================" + @echo " " + +$(OUTPUT)\ctb_lib_fifo.obj: .\..\src\fifo.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\fifo.cpp + +$(OUTPUT)\ctb_lib_getopt.obj: .\..\src\getopt.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\getopt.cpp + +$(OUTPUT)\ctb_lib_iobase.obj: .\..\src\iobase.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\iobase.cpp + +$(OUTPUT)\ctb_lib_portscan.obj: .\..\src\portscan.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\portscan.cpp + +$(OUTPUT)\ctb_lib_serportx.obj: .\..\src\serportx.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\serportx.cpp + +$(OUTPUT)\ctb_lib_serport.obj: .\..\src\win32\serport.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\serport.cpp + +$(OUTPUT)\ctb_lib_timer.obj: .\..\src\win32\timer.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\timer.cpp + +$(OUTPUT)\ctb_lib_gpib.obj: .\..\src\gpib.cpp + $(CXX) -q -c -P -o$@ $(CTB_LIB_CXXFLAGS) .\..\src\gpib.cpp + +$(OUTPUT)\ctb_dll_fifo.obj: .\..\src\fifo.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\fifo.cpp + +$(OUTPUT)\ctb_dll_getopt.obj: .\..\src\getopt.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\getopt.cpp + +$(OUTPUT)\ctb_dll_iobase.obj: .\..\src\iobase.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\iobase.cpp + +$(OUTPUT)\ctb_dll_portscan.obj: .\..\src\portscan.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\portscan.cpp + +$(OUTPUT)\ctb_dll_serportx.obj: .\..\src\serportx.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\serportx.cpp + +$(OUTPUT)\ctb_dll_serport.obj: .\..\src\win32\serport.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\serport.cpp + +$(OUTPUT)\ctb_dll_timer.obj: .\..\src\win32\timer.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\timer.cpp + +$(OUTPUT)\ctb_dll_gpib.obj: .\..\src\gpib.cpp + $(CXX) -q -c -P -o$@ $(CTB_DLL_CXXFLAGS) .\..\src\gpib.cpp + +$(OUTPUT)\ctbtest_ctbtest.obj: .\..\samples\ctbtest.cpp + $(CXX) -q -c -P -o$@ $(CTBTEST_CXXFLAGS) .\..\samples\ctbtest.cpp + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.gcc b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.gcc new file mode 100644 index 0000000000..febca07dc8 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.gcc @@ -0,0 +1,238 @@ +# ========================================================================= +# This makefile was generated by +# Bakefile 0.2.5 (http://www.bakefile.org) +# Do not modify, all changes will be overwritten! +# ========================================================================= + + + +# ------------------------------------------------------------------------- +# These are configurable options: +# ------------------------------------------------------------------------- + +# Compiler flags to link shared library +LINK_DLL_FLAGS ?= -shared + +# C++ compiler +CXX = g++ + +# Standard flags for C++ +CXXFLAGS ?= + +# Standard preprocessor flags (common for CC and CXX) +CPPFLAGS ?= + +# Standard linker flags +LDFLAGS ?= + +# Set to 1 to build debug version [0,1] +DEBUG ?= 0 + +# +GPIB ?= 0 + +# +WXDIR ?= $(WXWIN) + +# +INSTALLDIR ?= $(WXWIN) + + + +# ------------------------------------------------------------------------- +# Do not modify the rest of this file! +# ------------------------------------------------------------------------- + +### Variables: ### + +CPPDEPS = -MT$@ -MF$@.d -MD -MP +CTB_LIB_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -mthreads $(__OPTIMIZE_FLAG) \ + -I..\include $(CPPFLAGS) $(CXXFLAGS) +CTB_LIB_OBJECTS = \ + $(OUTPUT)\ctb_lib_fifo.o \ + $(OUTPUT)\ctb_lib_getopt.o \ + $(OUTPUT)\ctb_lib_iobase.o \ + $(OUTPUT)\ctb_lib_portscan.o \ + $(OUTPUT)\ctb_lib_serportx.o \ + $(OUTPUT)\ctb_lib_serport.o \ + $(OUTPUT)\ctb_lib_timer.o \ + $(____GPIBSRC_FILENAMES_OBJECTS) +CTB_DLL_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -mthreads $(__OPTIMIZE_FLAG) \ + -I..\include $(CPPFLAGS) $(CXXFLAGS) +CTB_DLL_OBJECTS = \ + $(OUTPUT)\ctb_dll_fifo.o \ + $(OUTPUT)\ctb_dll_getopt.o \ + $(OUTPUT)\ctb_dll_iobase.o \ + $(OUTPUT)\ctb_dll_portscan.o \ + $(OUTPUT)\ctb_dll_serportx.o \ + $(OUTPUT)\ctb_dll_serport.o \ + $(OUTPUT)\ctb_dll_timer.o \ + $(____GPIBSRC_FILENAMES_1_OBJECTS) +CTBTEST_CXXFLAGS = $(____DEBUG) $(____DEBUG_1) -DGPIB=$(GPIB) -mthreads \ + $(__OPTIMIZE_FLAG) -I..\include $(CPPFLAGS) $(CXXFLAGS) +CTBTEST_OBJECTS = \ + $(OUTPUT)\ctbtest_ctbtest.o + +### Conditionally set variables: ### + +ifeq ($(DEBUG),0) +OUTPUT = release +endif +ifeq ($(DEBUG),1) +OUTPUT = debug +endif +ifeq ($(WXDIR),) +INSTALLDIR = ..\lib +endif +ifeq ($(DEBUG),1) +LIBFLAG = d +endif +ifeq ($(GPIB),1) +GPIBFLAG = _gpib +endif +ifeq ($(GPIB),1) +____GPIBSRC_FILENAMES_OBJECTS = \ + $(OUTPUT)\ctb_lib_gpib.o +endif +ifeq ($(GPIB),1) +____GPIBSRC_FILENAMES_1_OBJECTS = \ + $(OUTPUT)\ctb_dll_gpib.o +endif +ifeq ($(DEBUG),0) +____DEBUG = -DNDEBUG +endif +ifeq ($(DEBUG),1) +____DEBUG = +endif +ifeq ($(DEBUG),0) +__OPTIMIZE_FLAG = -O0 +endif +ifeq ($(DEBUG),1) +__OPTIMIZE_FLAG = -O2 +endif +ifeq ($(GPIB),1) +__SYSLIB2_p = -lgpib32 +endif +ifeq ($(DEBUG),0) +____DEBUG_1 = +endif +ifeq ($(DEBUG),1) +____DEBUG_1 = -g +endif + + +all: $(OUTPUT) +$(OUTPUT): + -if not exist $(OUTPUT) mkdir $(OUTPUT) + +### Targets: ### + +all: ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32 + +clean: + -if exist $(OUTPUT)\*.o del $(OUTPUT)\*.o + -if exist $(OUTPUT)\*.d del $(OUTPUT)\*.d + -if exist ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a del ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll + -if exist ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a del ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a + -if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe + +..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a: $(CTB_LIB_OBJECTS) + if exist $@ del $@ + ar rcu $@ $(CTB_LIB_OBJECTS) + ranlib $@ + +..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll: $(CTB_DLL_OBJECTS) + $(CXX) $(LINK_DLL_FLAGS) -fPIC -o $@ $(CTB_DLL_OBJECTS) $(____DEBUG_1) -mthreads -Wl,--out-implib=..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a -L..\lib $(LDFLAGS) -lwinmm $(__SYSLIB2_p) + +$(OUTPUT)\ctbtest.exe: $(CTBTEST_OBJECTS) ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a + $(CXX) -o $@ $(CTBTEST_OBJECTS) $(____DEBUG_1) -mthreads -L..\lib $(LDFLAGS) ..\lib\libctb$(LIBFLAG)$(GPIBFLAG)-0.16.a -lwinmm $(__SYSLIB2_p) + +wxinstall: + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\mingw_lib + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\mingw_lib + + @if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32 + @copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16 + @copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32 + +tip-win32: + @echo " " + @echo "================================================================" + @echo " The building of ctb is finished. If you have an installed " + @echo " wxWidget package (WXWIN must be defined in the enviroment), " + @echo " you'll now have to run: " + @echo " " + @echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall " + @echo " " + @echo " to install the libraries in: " + @echo " $(INSTALLDIR)\lib\mingw_lib " + @echo " and the header files in" + @echo " $(INSTALLDIR)\ctb-0.16" + @echo " " + @echo " If you are using another compiler (Borland, Watcom, mingw,...) " + @echo " take a look in the README in this directory! " + @echo " " + @echo " ctb comes with no guarantees and doesn't claim " + @echo " to be suitable for any purpose. " + @echo "================================================================" + @echo " " + +$(OUTPUT)\ctb_lib_fifo.o: ./../src/fifo.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_lib_getopt.o: ./../src/getopt.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_lib_iobase.o: ./../src/iobase.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_lib_portscan.o: ./../src/portscan.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_lib_serportx.o: ./../src/serportx.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_lib_serport.o: ./../src/win32/serport.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_lib_timer.o: ./../src/win32/timer.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_lib_gpib.o: ./../src/gpib.cpp + $(CXX) -c -o $@ $(CTB_LIB_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_fifo.o: ./../src/fifo.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_getopt.o: ./../src/getopt.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_iobase.o: ./../src/iobase.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_portscan.o: ./../src/portscan.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_serportx.o: ./../src/serportx.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_serport.o: ./../src/win32/serport.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_timer.o: ./../src/win32/timer.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctb_dll_gpib.o: ./../src/gpib.cpp + $(CXX) -c -o $@ $(CTB_DLL_CXXFLAGS) $(CPPDEPS) $< + +$(OUTPUT)\ctbtest_ctbtest.o: ./../samples/ctbtest.cpp + $(CXX) -c -o $@ $(CTBTEST_CXXFLAGS) $(CPPDEPS) $< + +.PHONY: all clean + + +SHELL := $(COMSPEC) + +# Dependencies tracking: +-include $(OUTPUT)/*.d diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.vc b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.vc new file mode 100644 index 0000000000..62e7b56371 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.vc @@ -0,0 +1,260 @@ +# ========================================================================= +# This makefile was generated by +# Bakefile 0.2.5 (http://www.bakefile.org) +# Do not modify, all changes will be overwritten! +# ========================================================================= + + + +# ------------------------------------------------------------------------- +# These are configurable options: +# ------------------------------------------------------------------------- + +# C++ compiler +CXX = cl + +# Standard flags for C++ +CXXFLAGS = + +# Standard preprocessor flags (common for CC and CXX) +CPPFLAGS = + +# Standard linker flags +LDFLAGS = + +# Set to 1 to build debug version [0,1] +# 0 - Release +# 1 - Debug +DEBUG = 0 + +# +GPIB = 0 + +# +WXDIR = $(WXWIN) + +# +INSTALLDIR = $(WXWIN) + + + +# ------------------------------------------------------------------------- +# Do not modify the rest of this file! +# ------------------------------------------------------------------------- + +### Variables: ### + +CTB_LIB_CXXFLAGS = /MT$(____DEBUG_4) /DWIN32 $(____DEBUG) $(____DEBUG_2) \ + $(______DEBUG) /Fd..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb \ + $(__OPTIMIZE_FLAG) /I..\include /GR /EHsc $(CPPFLAGS) $(CXXFLAGS) +CTB_LIB_OBJECTS = \ + $(OUTPUT)\ctb_lib_fifo.obj \ + $(OUTPUT)\ctb_lib_getopt.obj \ + $(OUTPUT)\ctb_lib_iobase.obj \ + $(OUTPUT)\ctb_lib_portscan.obj \ + $(OUTPUT)\ctb_lib_serportx.obj \ + $(OUTPUT)\ctb_lib_serport.obj \ + $(OUTPUT)\ctb_lib_timer.obj \ + $(____GPIBSRC_FILENAMES_OBJECTS) +CTB_DLL_CXXFLAGS = /MT$(____DEBUG_4) /DWIN32 $(____DEBUG) $(____DEBUG_2) \ + $(______DEBUG) /Fd..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb \ + $(__OPTIMIZE_FLAG) /I..\include /GR /EHsc $(CPPFLAGS) $(CXXFLAGS) +CTB_DLL_OBJECTS = \ + $(OUTPUT)\ctb_dll_fifo.obj \ + $(OUTPUT)\ctb_dll_getopt.obj \ + $(OUTPUT)\ctb_dll_iobase.obj \ + $(OUTPUT)\ctb_dll_portscan.obj \ + $(OUTPUT)\ctb_dll_serportx.obj \ + $(OUTPUT)\ctb_dll_serport.obj \ + $(OUTPUT)\ctb_dll_timer.obj \ + $(____GPIBSRC_FILENAMES_1_OBJECTS) +CTBTEST_CXXFLAGS = /MT$(____DEBUG_4) /DWIN32 $(____DEBUG) $(____DEBUG_2) \ + $(______DEBUG) /Fd$(OUTPUT)\ctbtest.pdb /DGPIB=$(GPIB) $(__OPTIMIZE_FLAG) \ + /I..\include /GR /EHsc $(CPPFLAGS) $(CXXFLAGS) +CTBTEST_OBJECTS = \ + $(OUTPUT)\ctbtest_ctbtest.obj + +### Conditionally set variables: ### + +!if "$(DEBUG)" == "0" +OUTPUT = release +!endif +!if "$(DEBUG)" == "1" +OUTPUT = debug +!endif +!if "$(WXDIR)" == "" +INSTALLDIR = ..\lib +!endif +!if "$(DEBUG)" == "1" +LIBFLAG = d +!endif +!if "$(GPIB)" == "1" +GPIBFLAG = _gpib +!endif +!if "$(GPIB)" == "1" +____GPIBSRC_FILENAMES_OBJECTS = \ + $(OUTPUT)\ctb_lib_gpib.obj +!endif +!if "$(GPIB)" == "1" +____GPIBSRC_FILENAMES_1_OBJECTS = \ + $(OUTPUT)\ctb_dll_gpib.obj +!endif +!if "$(DEBUG)" == "0" +____DEBUG = /DNDEBUG +!endif +!if "$(DEBUG)" == "1" +____DEBUG = +!endif +!if "$(DEBUG)" == "0" +____DEBUG_2 = +!endif +!if "$(DEBUG)" == "1" +____DEBUG_2 = /Zi +!endif +!if "$(DEBUG)" == "0" +____DEBUG_3 = +!endif +!if "$(DEBUG)" == "1" +____DEBUG_3 = /DEBUG +!endif +!if "$(DEBUG)" == "0" +______DEBUG = +!endif +!if "$(DEBUG)" == "1" +______DEBUG = /D_DEBUG +!endif +!if "$(DEBUG)" == "0" +____DEBUG_4 = +!endif +!if "$(DEBUG)" == "1" +____DEBUG_4 = d +!endif +!if "$(DEBUG)" == "0" +__OPTIMIZE_FLAG = /Od +!endif +!if "$(DEBUG)" == "1" +__OPTIMIZE_FLAG = /O2 +!endif +!if "$(GPIB)" == "1" +__SYSLIB2_p = gpib32.lib +!endif + + +all: $(OUTPUT) +$(OUTPUT): + -if not exist $(OUTPUT) mkdir $(OUTPUT) + +### Targets: ### + +all: ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32 + +clean: + -if exist $(OUTPUT)\*.obj del $(OUTPUT)\*.obj + -if exist $(OUTPUT)\*.res del $(OUTPUT)\*.res + -if exist $(OUTPUT)\*.pch del $(OUTPUT)\*.pch + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilk del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.ilk + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + -if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe + -if exist $(OUTPUT)\ctbtest.ilk del $(OUTPUT)\ctbtest.ilk + -if exist $(OUTPUT)\ctbtest.pdb del $(OUTPUT)\ctbtest.pdb + +..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib: $(CTB_LIB_OBJECTS) + if exist $@ del $@ + link /LIB /NOLOGO /OUT:$@ @<< + $(CTB_LIB_OBJECTS) +<< + +..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll: $(CTB_DLL_OBJECTS) + link /DLL /NOLOGO /OUT:$@ $(____DEBUG_3) /pdb:"..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.pdb" /LIBPATH:..\lib $(LDFLAGS) @<< + $(CTB_DLL_OBJECTS) winmm.lib $(__SYSLIB2_p) /IMPLIB:..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib +<< + +$(OUTPUT)\ctbtest.exe: $(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + link /NOLOGO /OUT:$@ $(____DEBUG_3) /pdb:"$(OUTPUT)\ctbtest.pdb" /LIBPATH:..\lib $(LDFLAGS) @<< + $(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib winmm.lib $(__SYSLIB2_p) +<< + +wxinstall: + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\vc_lib + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\vc_lib + + @if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32 + @copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16 + @copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32 + +tip-win32: + @echo " " + @echo "================================================================" + @echo " The building of ctb is finished. If you have an installed " + @echo " wxWidget package (WXWIN must be defined in the enviroment), " + @echo " you'll now have to run: " + @echo " " + @echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall " + @echo " " + @echo " to install the libraries in: " + @echo " $(INSTALLDIR)\lib\vc_lib " + @echo " and the header files in" + @echo " $(INSTALLDIR)\ctb-0.16" + @echo " " + @echo " If you are using another compiler (Borland, Watcom, mingw,...) " + @echo " take a look in the README in this directory! " + @echo " " + @echo " ctb comes with no guarantees and doesn't claim " + @echo " to be suitable for any purpose. " + @echo "================================================================" + @echo " " + +$(OUTPUT)\ctb_lib_fifo.obj: .\..\src\fifo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\fifo.cpp + +$(OUTPUT)\ctb_lib_getopt.obj: .\..\src\getopt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\getopt.cpp + +$(OUTPUT)\ctb_lib_iobase.obj: .\..\src\iobase.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\iobase.cpp + +$(OUTPUT)\ctb_lib_portscan.obj: .\..\src\portscan.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\portscan.cpp + +$(OUTPUT)\ctb_lib_serportx.obj: .\..\src\serportx.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\serportx.cpp + +$(OUTPUT)\ctb_lib_serport.obj: .\..\src\win32\serport.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\serport.cpp + +$(OUTPUT)\ctb_lib_timer.obj: .\..\src\win32\timer.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\win32\timer.cpp + +$(OUTPUT)\ctb_lib_gpib.obj: .\..\src\gpib.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_LIB_CXXFLAGS) .\..\src\gpib.cpp + +$(OUTPUT)\ctb_dll_fifo.obj: .\..\src\fifo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\fifo.cpp + +$(OUTPUT)\ctb_dll_getopt.obj: .\..\src\getopt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\getopt.cpp + +$(OUTPUT)\ctb_dll_iobase.obj: .\..\src\iobase.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\iobase.cpp + +$(OUTPUT)\ctb_dll_portscan.obj: .\..\src\portscan.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\portscan.cpp + +$(OUTPUT)\ctb_dll_serportx.obj: .\..\src\serportx.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\serportx.cpp + +$(OUTPUT)\ctb_dll_serport.obj: .\..\src\win32\serport.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\serport.cpp + +$(OUTPUT)\ctb_dll_timer.obj: .\..\src\win32\timer.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\win32\timer.cpp + +$(OUTPUT)\ctb_dll_gpib.obj: .\..\src\gpib.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTB_DLL_CXXFLAGS) .\..\src\gpib.cpp + +$(OUTPUT)\ctbtest_ctbtest.obj: .\..\samples\ctbtest.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CTBTEST_CXXFLAGS) .\..\samples\ctbtest.cpp + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.wat b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.wat new file mode 100644 index 0000000000..5041ddac36 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/build/makefile.wat @@ -0,0 +1,283 @@ +# ========================================================================= +# This makefile was generated by +# Bakefile 0.2.5 (http://www.bakefile.org) +# Do not modify, all changes will be overwritten! +# ========================================================================= + + + +# ------------------------------------------------------------------------- +# These are configurable options: +# ------------------------------------------------------------------------- + +# C++ compiler +CXX = wpp386 + +# Standard flags for C++ +CXXFLAGS = + +# Standard preprocessor flags (common for CC and CXX) +CPPFLAGS = + +# Standard linker flags +LDFLAGS = + +# Set to 1 to build debug version [0,1] +# 0 - Release +# 1 - Debug +DEBUG = 0 + +# +GPIB = 0 + +# +WXDIR = $(%WXWIN) + +# +INSTALLDIR = $(%WXWIN) + + + +# ------------------------------------------------------------------------- +# Do not modify the rest of this file! +# ------------------------------------------------------------------------- + +# Speed up compilation a bit: +!ifdef __LOADDLL__ +! loaddll wcc wccd +! loaddll wccaxp wccdaxp +! loaddll wcc386 wccd386 +! loaddll wpp wppdi86 +! loaddll wppaxp wppdaxp +! loaddll wpp386 wppd386 +! loaddll wlink wlink +! loaddll wlib wlibd +!endif + +# We need these variables in some bakefile-made rules: +WATCOM_CWD = $+ $(%cdrive):$(%cwd) $- + +### Conditionally set variables: ### + +OUTPUT = +!ifeq DEBUG 0 +OUTPUT = release +!endif +!ifeq DEBUG 1 +OUTPUT = debug +!endif +INSTALLDIR = +!ifeq WXDIR +INSTALLDIR = ..\lib +!endif +LIBFLAG = +!ifeq DEBUG 1 +LIBFLAG = d +!endif +GPIBFLAG = +!ifeq GPIB 1 +GPIBFLAG = _gpib +!endif +____GPIBSRC_FILENAMES_OBJECTS = +!ifeq GPIB 1 +____GPIBSRC_FILENAMES_OBJECTS = & + $(OUTPUT)\ctb_lib_gpib.obj +!endif +____GPIBSRC_FILENAMES_1_OBJECTS = +!ifeq GPIB 1 +____GPIBSRC_FILENAMES_1_OBJECTS = & + $(OUTPUT)\ctb_dll_gpib.obj +!endif +____DEBUG = +!ifeq DEBUG 0 +____DEBUG = -dNDEBUG +!endif +!ifeq DEBUG 1 +____DEBUG = +!endif +____DEBUG_0 = +!ifeq DEBUG 0 +____DEBUG_0 = -d0 +!endif +!ifeq DEBUG 1 +____DEBUG_0 = -d2 +!endif +____DEBUG_2 = +!ifeq DEBUG 0 +____DEBUG_2 = +!endif +!ifeq DEBUG 1 +____DEBUG_2 = debug all +!endif +__OPTIMIZE_FLAG = +!ifeq DEBUG 0 +__OPTIMIZE_FLAG = -od +!endif +!ifeq DEBUG 1 +__OPTIMIZE_FLAG = -ot -ox +!endif +__SYSLIB2_p = +!ifeq GPIB 1 +__SYSLIB2_p = gpib32.lib +!endif + +### Variables: ### + +CTB_LIB_CXXFLAGS = $(____DEBUG) $(____DEBUG_0) -bm $(__OPTIMIZE_FLAG) & + -i=..\include $(CPPFLAGS) $(CXXFLAGS) +CTB_LIB_OBJECTS = & + $(OUTPUT)\ctb_lib_fifo.obj & + $(OUTPUT)\ctb_lib_getopt.obj & + $(OUTPUT)\ctb_lib_iobase.obj & + $(OUTPUT)\ctb_lib_portscan.obj & + $(OUTPUT)\ctb_lib_serportx.obj & + $(OUTPUT)\ctb_lib_serport.obj & + $(OUTPUT)\ctb_lib_timer.obj & + $(____GPIBSRC_FILENAMES_OBJECTS) +CTB_DLL_CXXFLAGS = -bd $(____DEBUG) $(____DEBUG_0) -bm $(__OPTIMIZE_FLAG) & + -i=..\include $(CPPFLAGS) $(CXXFLAGS) +CTB_DLL_OBJECTS = & + $(OUTPUT)\ctb_dll_fifo.obj & + $(OUTPUT)\ctb_dll_getopt.obj & + $(OUTPUT)\ctb_dll_iobase.obj & + $(OUTPUT)\ctb_dll_portscan.obj & + $(OUTPUT)\ctb_dll_serportx.obj & + $(OUTPUT)\ctb_dll_serport.obj & + $(OUTPUT)\ctb_dll_timer.obj & + $(____GPIBSRC_FILENAMES_1_OBJECTS) +CTBTEST_CXXFLAGS = $(____DEBUG) $(____DEBUG_0) -dGPIB=$(GPIB) -bm & + $(__OPTIMIZE_FLAG) -i=..\include $(CPPFLAGS) $(CXXFLAGS) +CTBTEST_OBJECTS = & + $(OUTPUT)\ctbtest_ctbtest.obj + + +all : $(OUTPUT) +$(OUTPUT) : + -if not exist $(OUTPUT) mkdir $(OUTPUT) + +### Targets: ### + +all : .SYMBOLIC ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(OUTPUT)\ctbtest.exe tip-win32 + +clean : .SYMBOLIC + -if exist $(OUTPUT)\*.obj del $(OUTPUT)\*.obj + -if exist $(OUTPUT)\*.res del $(OUTPUT)\*.res + -if exist $(OUTPUT)\*.lbc del $(OUTPUT)\*.lbc + -if exist $(OUTPUT)\*.ilk del $(OUTPUT)\*.ilk + -if exist $(OUTPUT)\*.pch del $(OUTPUT)\*.pch + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll + -if exist ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib del ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + -if exist $(OUTPUT)\ctbtest.exe del $(OUTPUT)\ctbtest.exe + +..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib : $(CTB_LIB_OBJECTS) + @%create $(OUTPUT)\ctb_lib.lbc + @for %i in ($(CTB_LIB_OBJECTS)) do @%append $(OUTPUT)\ctb_lib.lbc +%i + wlib -q -p4096 -n -b $^@ @$(OUTPUT)\ctb_lib.lbc + +..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll : $(CTB_DLL_OBJECTS) + @%create $(OUTPUT)\ctb_dll.lbc + @%append $(OUTPUT)\ctb_dll.lbc option quiet + @%append $(OUTPUT)\ctb_dll.lbc name $^@ + @%append $(OUTPUT)\ctb_dll.lbc option caseexact + @%append $(OUTPUT)\ctb_dll.lbc $(____DEBUG_2) libpath ..\lib $(LDFLAGS) + @for %i in ($(CTB_DLL_OBJECTS)) do @%append $(OUTPUT)\ctb_dll.lbc file %i + @for %i in ( winmm.lib $(__SYSLIB2_p)) do @%append $(OUTPUT)\ctb_dll.lbc library %i + @%append $(OUTPUT)\ctb_dll.lbc + @%append $(OUTPUT)\ctb_dll.lbc system nt_dll + wlink @$(OUTPUT)\ctb_dll.lbc + wlib -q -n -b ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib +$^@ + +$(OUTPUT)\ctbtest.exe : $(CTBTEST_OBJECTS) ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib + @%create $(OUTPUT)\ctbtest.lbc + @%append $(OUTPUT)\ctbtest.lbc option quiet + @%append $(OUTPUT)\ctbtest.lbc name $^@ + @%append $(OUTPUT)\ctbtest.lbc option caseexact + @%append $(OUTPUT)\ctbtest.lbc $(____DEBUG_2) libpath ..\lib $(LDFLAGS) + @for %i in ($(CTBTEST_OBJECTS)) do @%append $(OUTPUT)\ctbtest.lbc file %i + @for %i in ( ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib winmm.lib $(__SYSLIB2_p)) do @%append $(OUTPUT)\ctbtest.lbc library %i + @%append $(OUTPUT)\ctbtest.lbc + @for %i in () do @%append $(OUTPUT)\ctbtest.lbc option stack=%i + wlink @$(OUTPUT)\ctbtest.lbc + +wxinstall : + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.lib $(INSTALLDIR)\lib\watcom_lib + @copy ..\lib\ctb$(LIBFLAG)$(GPIBFLAG)-0.16.dll $(INSTALLDIR)\lib\watcom_lib + + @if not exist $(INSTALLDIR)\include\ctb-0.16\win32 mkdir $(INSTALLDIR)\include\ctb-0.16\win32 + @copy ..\include\ctb-0.16\*.h $(INSTALLDIR)\include\ctb-0.16 + @copy ..\include\ctb-0.16\win32\*.h $(INSTALLDIR)\include\ctb-0.16\win32 + +tip-win32 : + @echo " " + @echo "================================================================" + @echo " The building of ctb is finished. If you have an installed " + @echo " wxWidget package (WXWIN must be defined in the enviroment), " + @echo " you'll now have to run: " + @echo " " + @echo " make DEBUG=$(DEBUG) GPIB=$(GPIB) wxinstall " + @echo " " + @echo " to install the libraries in: " + @echo " $(INSTALLDIR)\lib\watcom_lib " + @echo " and the header files in" + @echo " $(INSTALLDIR)\ctb-0.16" + @echo " " + @echo " If you are using another compiler (Borland, Watcom, mingw,...) " + @echo " take a look in the README in this directory! " + @echo " " + @echo " ctb comes with no guarantees and doesn't claim " + @echo " to be suitable for any purpose. " + @echo "================================================================" + @echo " " + +$(OUTPUT)\ctb_lib_fifo.obj : .AUTODEPEND .\..\src\fifo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_lib_getopt.obj : .AUTODEPEND .\..\src\getopt.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_lib_iobase.obj : .AUTODEPEND .\..\src\iobase.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_lib_portscan.obj : .AUTODEPEND .\..\src\portscan.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_lib_serportx.obj : .AUTODEPEND .\..\src\serportx.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_lib_serport.obj : .AUTODEPEND .\..\src\win32\serport.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_lib_timer.obj : .AUTODEPEND .\..\src\win32\timer.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_lib_gpib.obj : .AUTODEPEND .\..\src\gpib.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_LIB_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_fifo.obj : .AUTODEPEND .\..\src\fifo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_getopt.obj : .AUTODEPEND .\..\src\getopt.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_iobase.obj : .AUTODEPEND .\..\src\iobase.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_portscan.obj : .AUTODEPEND .\..\src\portscan.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_serportx.obj : .AUTODEPEND .\..\src\serportx.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_serport.obj : .AUTODEPEND .\..\src\win32\serport.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_timer.obj : .AUTODEPEND .\..\src\win32\timer.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctb_dll_gpib.obj : .AUTODEPEND .\..\src\gpib.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTB_DLL_CXXFLAGS) $< + +$(OUTPUT)\ctbtest_ctbtest.obj : .AUTODEPEND .\..\samples\ctbtest.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CTBTEST_CXXFLAGS) $< + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/ctb.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/ctb.h new file mode 100644 index 0000000000..767067d6a0 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/ctb.h @@ -0,0 +1,139 @@ +#ifndef LIBCTB_CTB_H_INCLUDED_ +#define LIBCTB_CTB_H_INCLUDED_ + +#include "ctb-0.16/fifo.h" +#if ( GPIB ) +# include "ctb-0.16/gpib.h" +#endif +#include "ctb-0.16/getopt.h" +#include "ctb-0.16/iobase.h" +#include "ctb-0.16/kbhit.h" +#include "ctb-0.16/portscan.h" +#include "ctb-0.16/serport.h" +#include "ctb-0.16/serportx.h" +#include "ctb-0.16/timer.h" + +/*! + \mainpage ctb overview + + The ctb (communication toolbox) library was realized, to simplify the + communication with other instruments throughout the serial com ports + (at first). To make my life easier, it should works with Linux and + all win32 plattforms (excepted windows 3.1, which is a only 16bit OS) + because I develope my applications for both plattforms).\n + Some times later GPIB support was added to make ctb an integrated part + for the extensive test and calibration system of a company I worked + these days.\n + The main goal of the library was a non-blocked communication to avoid + frozen GUIs waiting for data which in some conditions never arrives. + + On the base ctb defines an abstract class IOBase, which must be + derivate for several interfaces (at now this was done for the + RS232 comports and GPIB IEEE488 interface). + + This leads to another feature: Because all classes depends on one + super class, you have just open your wanted interface and don't + worry about it's special typ later. This is like the 'Virtual + Instrument' featured by Nation Instruments LabView. + + Last not least: ctb provides one written code for Linux and Windows + (compiles well with GNU G++ and VC++). Without any dependences (execept + for a standard C++ compilier) ctb runs also in small enviroments like + embedded systems and doesn't need any graphic stuff for use. + + ctb is composed of five parts: + + - ctb::IOBase class + - ctb::SerialPort class + - ctb::GpibDevice class + - ctb::Timer class + - ctb::Fifo class + + \section IOBase IOBase class + + An abstract class for different interfaces. The idea behind this: + Similar to the virtual file system this class defines a lot of + preset member functions, which the derivate classes must be + overload.\n + In the main thing these are: open a interface (such as RS232), + reading and writing non blocked through the interface and at + last, close it.\n + For special interface settings the method ioctl was defined. + (control interface). ioctl covers some interface dependent + settings like switch on/off the RS232 status lines and must also + be defined from each derivated class. + + + \section SerialPort SerialPort class + + The class for the serial ports is named as + ctb::SerialPort. SerialPort is a wrapper for non blocked reading and + writing. This is easy under linux, but with windows a lot more + tricky. SerialPort is as simple as possible. It doesn't create any + gui events or signals, so it works also standalone. It's also not a + device driver, means, you must call the read method, if you look for + receiving data. + + You can write any desired data with any length (length type is + size_t, I think, on win32 and linux this is a 32Bit integer) and + SerialPort returns the really writen data length, also you can read + a lot of data and SerialPort returns the really received data count. + + Both, read and write returns immediatelly. Using these, the program + never blocks. Also IOBase implements a blocked read and write. You can + use these functions, if you want a definitiv count of data and never + accept less than this. Because there is a difficulty, when the + communication is interrupted or death, both blocked functions get a + timeout flag to returns after a given time interval. The timeouts + will be handled with the second timer class. + + As an additional benefit ctb features also 9 Bit transmission (with + take advantage of the parity bit), non-standard baudrates (depending + on your hardware but not on ctb) and all parity eventualities + including static parity settings like Mark and Space. + + \section GpibDevice GpibDevice class + + Named as ctb::GpibDevice. In the philosophy of the SerialPort class + GpibDevice also supports non-blocking communication. You can instant + as many GpibDevice objects as you need for instance to communicate + with a lot of different bus participants in a typical GPIB enviroment. + GPIB support was tested with PCI cards and USB adapter from Nation + Instrument and Keithley. + + \section Timer Timer class + + The idea of the ctb::Timer class is to base on the Unix C alarm + function. You create a Timer with a given alarm time and a adress of + flag, which the timer must set after the time is over. + + Because the alarm function cannot used more than once in the same + process (under windows I don't know a similar function), every timer + instance will be a separate thread after starting it. So you can start + a timer and continue in your program, make a lot of things and test + the flag whenever you want this. (For example, you read/write a + given count of data). + + \note + I think, it's a better style, to request a given count of data in + 100ms (for example) and trap the situation, if there are not enough + data after this time. And not do this for every byte! + + \section Fifo Fifo cass + Provides a simple thread safe fifo to realize a fast and simple + communication pipe between two threads (and was used also as a put + back mechanism for the wxIOBase and it's derivated classes).\n + ctb::Fifo tackles the concurrently access from different threads with an + internal temporary pointer asignment which was atomic. From there no + mutex or semaphore is involved and lead to a fast access. + + Please note:\n + The thread safeness is limited to the put/get write/read methods but + which should be sufficent for a fifo. + + + \latexonly \newpage \endlatexonly + + */ + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/fifo.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/fifo.h new file mode 100644 index 0000000000..d17079d4a2 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/fifo.h @@ -0,0 +1,96 @@ +#ifndef __LIBCTB_FIFO_H_INCLUDED_ +#define __LIBCTB_FIFO_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: fifo.h +// Purpose: +// Author: Joachim Buermann, Michael Hungershausen +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include + +/** + \file fifo.h +*/ + +namespace ctb { + +/*! + \class Fifo + A simple thread safe fifo to realize a put back mechanism for the + wxIOBase and it's derivated classes. +*/ + class Fifo + { + protected: + /*! the size of the fifo */ + size_t m_size; + /*! the start of the internal fifo buffer */ + char* m_begin; + /*! + the end of the internal fifo buffer (m_end marks the first + invalid byte AFTER the internal buffer) + */ + char* m_end; + /*! the current read position */ + char* m_rdptr; + /*! the current write position */ + char* m_wrptr; + public: + /*! + \brief the constructor initialize a fifo with the given size. + \param size size of the fifo + */ + Fifo(size_t size); + /*! + \brief the destructor destroys all internal memory. + */ + virtual ~Fifo(); + /*! + \brief clear all internal memory and set the read and write + pointers to the start of the internal memory. + \Note This function is not thread safe! Don't use it, if another + thread takes access to the fifo instance. Use a looping get() or + read() call instead of this. + */ + virtual void clear(); + /*! + \brief fetch the next available byte from the fifo. + \param ch points to a charater to store the result + \return 1 if successful, 0 otherwise + */ + virtual int get(char* ch); + /*! + \brief query the fifo for it's available bytes. + \return count of readable bytes, storing in the fifo + */ + size_t items(); + /*! + \brief put a character into the fifo. + \param ch the character to put in + \return 1 if successful, 0 otherwise + */ + virtual int put(char ch); + /*! + \brief read a given count of bytes out of the fifo. + \param data memory to store the readed data + \param count number of bytes to read + \return On success, the number of bytes read are returned, + 0 otherwise + */ + virtual int read(char* data,int count); + /*! + \brief write a given count of bytes into the fifo. + \param data start of the data to write + \param count number of bytes to write + \return On success, the number of bytes written are returned, + 0 otherwise + */ + virtual int write(char* data,int count); + }; + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/getopt.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/getopt.h new file mode 100644 index 0000000000..2efd341889 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/getopt.h @@ -0,0 +1,19 @@ +#ifndef LIBCTB_GETOPT_H_INCLUDED_ +#define LIBCTB_GETOPT_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: getopt.h +// Purpose: Simple wrapper file +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined (WIN32) +# include "win32/getopt.h" +#else +# include +#endif + +#endif +// __WX_GETOPT_H diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/gpib.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/gpib.h new file mode 100644 index 0000000000..1d360a8c49 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/gpib.h @@ -0,0 +1,378 @@ +#ifndef LIBCTB_GPIB_H_INCLUDED_ +#define LIBCTB_GPIB_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: gpibx.h +// Purpose: base class for gpib devices +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "ctb-0.16/iobase.h" + +namespace ctb { + +/*! + \file gpib.h +*/ + + /*! defines the os specific name for the first gpib controller */ + extern const char* GPIB1; + + /*! defines the os specific name for the second gpib controller */ + extern const char* GPIB2; + + /*! + \enum GpibTimeout + NI488.2 API defines the following valid timeouts. + */ + enum GpibTimeout + { + /// no timeout (infinity) + GpibTimeoutNone = 0, + /// 10 micro seconds + GpibTimeout10us, + /// 30 micro seconds + GpibTimeout30us, + /// 100 micro seconds + GpibTimeout100us, + /// 300 micro seconds + GpibTimeout300us, + /// 1 milli second + GpibTimeout1ms, + /// 3 milli seconds + GpibTimeout3ms, + /// 10 milli seconds + GpibTimeout10ms, + /// 30 milli seconds + GpibTimeout30ms, + /// 0.1 seconds + GpibTimeout100ms, + /// 0.3 seconds + GpibTimeout300ms, + /// 1 second + GpibTimeout1s, + /// 3 seconds + GpibTimeout3s, + /// 10 seconds + GpibTimeout10s, + /// 30 seconds + GpibTimeout30s, + /// 100 seconds + GpibTimeout100s, + /// 300 seconds (5 minutes) + GpibTimeout300s, + /// 1000 seconds + GpibTimeout1000s + }; + + /*! + \struct Gpib_DCS + + The device control struct for the gpib communication class. + This struct should be used, if you refer advanced parameter. + */ + struct Gpib_DCS + { + /*! primary address of GPIB device */ + int m_address1; + /*! secondary address of GPIB device */ + int m_address2; + /*! I/O timeout */ + GpibTimeout m_timeout; + /*! EOT enable */ + bool m_eot; + /*! + Defines the EOS character. + Note! Defining an EOS byte does not cause the driver to + automatically send that byte at the end of write I/O + operations. The application is responsible for placing the + EOS byte at the end of the data strings that it defines. + (National Instruments NI-488.2M Function Reference Manual) + */ + unsigned char m_eosChar; + /*! + Set the EOS mode (handling).m_eosMode may be a combination + of bits ORed together. The following bits can be used: + 0x04: Terminate read when EOS is detected. + 0x08: Set EOI (End or identify line) with EOS on write function + 0x10: Compare all 8 bits of EOS byte rather than low 7 bits + (all read and write functions). + */ + unsigned char m_eosMode; + /*! buffer for internal use */ + char m_buf[32]; + /*! to avoid memory leak warnings generated by swig */ + ~Gpib_DCS() {}; + /*! + \brief the constructor initiate the device control struct with + the common useful values and set the internal timeout for the + GPIB controller to 1ms to avoid (or better reduce) blocking + */ + Gpib_DCS() { + /*! set default device address to 1 */ + m_address1 = 1; + m_address2 = 0; + /*! + set the timeout to a short value to avoid blocking + (default are 1msec) + */ + m_timeout = GpibTimeout1ms; + m_eot = true; + /*! EOS character, see above! */ + m_eosChar = 0;//'\n'; + /*! EOS mode, see above! */ + m_eosMode = 0; + }; + /*! + \brief returns the internal parameters in a more human readable + string format like 'Adr: (1,0) to:1ms'. + \return the settings as a null terminated string + */ + char* GetSettings(); + }; + +/*! + \enum GpibIoctls + + The following Ioctl calls are only valid for the GpibDevice class. +*/ + enum GpibIoctls { + /*! + Set the adress of the via gpib connected device. + */ + CTB_GPIB_SETADR = CTB_GPIB, + /*! + Get the serial poll byte + */ + CTB_GPIB_GETRSP, + /*! + Get the GPIB status + */ + CTB_GPIB_GETSTA, + /*! + Get the last GPIB error number + */ + CTB_GPIB_GETERR, + /*! + Get the GPIB line status (hardware control lines) as an + integer. The lowest 8 bits correspond to the current state + of the lines. + */ + CTB_GPIB_GETLINES, + /*! + Set the GPIB specific timeout + */ + CTB_GPIB_SETTIMEOUT, + /*! + Forces the specified device to go to local program mode + */ + CTB_GPIB_GTL, + /*! + This routine can only be used if the specified GPIB + Interface Board is the System Controller. + Remember that even though the REN line is asserted, + the device(s) will not be put into remote state until is + addressed to listen by the Active Controller + */ + CTB_GPIB_REN, + /*! + The command asserts the GPIB interface clear (IFC) line for + ast least 100us if the GPIB board is the system controller. + This initializes the GPIB and makes the interface CIC and + active controller with ATN asserted. + Note! The IFC signal resets only the GPIB interface functions + of the bus devices and not the internal device functions. + For a device reset you should use the CTB_RESET command above. + */ + CTB_GPIB_RESET_BUS, + /*! + Configure the end-of-string (EOS) termination character. + Note! Defining an EOS byte does not cause the driver to + automatically send that byte at the end of write I/O + operations. The application is responsible for placing the + EOS byte at the end of the data strings that it defines. + (National Instruments NI-488.2M Function Reference Manual) + */ + CTB_GPIB_SET_EOS_CHAR, + /*! + Get the internal EOS termination character (see above). + */ + CTB_GPIB_GET_EOS_CHAR, + /*! + Set the EOS mode (handling).m_eosMode may be a combination + of bits ORed together. The following bits can be used: + 0x04: Terminate read when EOS is detected. + 0x08: Set EOI (End or identify line) with EOS on write function + 0x10: Compare all 8 bits of EOS byte rather than low 7 bits + (all read and write functions). + */ + CTB_GPIB_SET_EOS_MODE, + /*! + Get the internal EOS mode (see above). + */ + CTB_GPIB_GET_EOS_MODE, + }; + +/*! + \class GpibDevice + GpibDevice is the basic class for communication via the GPIB bus. +*/ + class GpibDevice : public IOBase + { + protected: + /*! + \brief + the internal board identifier, 0 for the first gpib controller, + 1 for the second one + */ + int m_board; + /*! + \brief + the file descriptor of the connected gpib device + */ + int m_hd; + /*! + \brief + contains the internal conditions of the GPIB communication like + GPIB error, timeout and so on... + */ + int m_state; + /*! the internal GPIB error number */ + int m_error; + /*! the count of data read or written */ + int m_count; + /*! + \brief contains the internal settings of the GPIB connection like + address, timeout, end of string character and so one... + */ + Gpib_DCS m_dcs; + int CloseDevice(); + /*! + \brief returns a short notation or more detail description of + the given GPIB error number. + \param error the occured GPIB error + \param detailed true for a more detailed description, false + otherwise + \return a null terminated string with the short or detailed + error message. + */ + virtual const char* GetErrorString(int error,bool detailed); + /*! + Open the interface (internally to request a file descriptor for the + given interface). The second parameter is a undefined pointer of a + Gpib_DCS data struct. + \param devname the name of the GPIB device, GPIB1 means the first + GPIB controller, GPIB2 the second (if available). + \param dcs untyped pointer of advanced device parameters, + \sa struct Gpib_DCS (data struct for the gpib device) + \return zero on success, otherwise -1 + */ + int OpenDevice(const char* devname, void* dcs); + public: + GpibDevice() { + m_board = -1; + m_hd = -1; + m_state = m_count = m_error = 0; + }; + virtual ~GpibDevice() {Close();}; + /*! + \brief returns the name of the class instance. You find this useful, + if you handle different devices like a serial port or a gpib device + via a IOBase pointer. + \return name of the class. + */ + const char* ClassName() {return "ctb::GpibDevice";}; + /*! + \brief returns a more detail description of the given error + number. + \param error the occured error number + \return null terminated string with the error description + */ + virtual const char* GetErrorDescription(int error) { + return GetErrorString(error,true); + }; + /*! + \brief returns a short notation like 'EABO' of the given error + number. + \param error the occured error number + \return null terminated string with the short error notation + */ + virtual const char* GetErrorNotation(int error) { + return GetErrorString(error,false); + }; + /*! + \brief request the current settings of the connected gpib device + as a null terminated string. + \return the settings as a string like 'Adr: (1,0) to:1ms' + */ + virtual char* GetSettingsAsString() { + return m_dcs.GetSettings(); + }; + /// This is only for internal usage + int Ibrd(char* buf,size_t len); + /// This is only for internal usage + int Ibwrt(char* buf,size_t len); + /*! + \brief Many operating characteristics are only possible for + special devices. To avoid the need of a lot of different functions + and to give the user a uniform interface, all this special + operating instructions will covered by one Ioctl methode (like + the linux ioctl call). + The Ioctl command (cmd) has encoded in it whether the argument + is an in parameter or out parameter, and the size of the + argument args in bytes. Macros and defines used in specifying an + ioctl request are located in iobase.h and the header file for + the derivated device (for example in gpib.h). + \param cmd one of GpibIoctls specify the ioctl request. + \param args is a typeless pointer to a memory location, where + Ioctl reads the request arguments or write the results. + Please note, that an invalid memory location or size involving + a buffer overflow or segmention fault! + */ + virtual int Ioctl(int cmd,void* args); + /*! + Returns the current state of the device. + \return 1 if device is valid and open, otherwise 0 + */ + int IsOpen() { + return m_hd >= 0; + }; + + /*! + \brief Opens a GPIB device in a user likely way. Insteed of + using the Device Control Struct just input your parameter in a + more intuitive manner. + \param devname the name of the GPIB controler like GPIB1 or GPIB2 + \param address the address of the connected device (1...31) + \return the new file descriptor, or -1 if an error occurred + */ + int Open( const char* devname, int address ); + + // Open overrides and hides the IOBase::Open( const char* + // devname, void* dcs ) of the base class! So bring it into scope + // again! + using IOBase::Open; + + int Read(char* buf,size_t len); + + int Write(char* buf,size_t len); + + /*! + \brief FindListener returns all listening devices connected to + the GPIB bus of the given board. + This function is not member of the GPIB class, becauce it + should do it's job before you open any GPIB connection. + \param board the board nummber. Default is the first board (=0). + Valid board numbers are 0 and 1. + \return -1 if an error occurred, otherwise a setting bit for + each listener address. Bit0 is always 0 (address 0 isn't valid, + Bit1 means address 1, Bit2 address 2 and so on... + */ + static int FindListeners(int board = 0); + }; + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/iobase.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/iobase.h new file mode 100644 index 0000000000..eda03b314f --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/iobase.h @@ -0,0 +1,294 @@ +#ifndef LIBCTB_IOBASE_H_INCLUDED_ +#define LIBCTB_IOBASE_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: iobase.h +// Purpose: io basic class +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "ctb-0.16/fifo.h" +#include + +/** + \file iobase.h +*/ + +namespace ctb { + + enum { + + CTB_COMMON = 0x0000, + CTB_SERIAL = 0x0100, + CTB_GPIB = 0x0200, + CTB_TIMEOUT_INFINITY = 0xFFFFFFFF + }; + +// const unsigned int wxTIMEOUT_INFINITY = 0xFFFFFFFF; + +/*! + \enum IOBaseIoctls + + Defines the ioctl calls for derivated classes. The following Ioctl + calls are valid for all from wxIOBase derivated classes. +*/ + enum IOBaseIoctls { + /*! + Reset the connected device. For a serial (RS232) connection, + a break is send. For GPIB the IFC (Interface Clear) line is + set. + */ + CTB_RESET = CTB_COMMON + }; + +/*! + \class IOBase + An abstract class for different interfaces. The idea behind this: + Similar to the virtual file system this class defines a lot of + preset member functions, which the derivate classes must be + overload. + In the main thing these are: open a interface (such as RS232), + reading and writing non blocked through the interface and at + last, close it. + For special interface settings the method ioctl was defined. + (control interface). ioctl covers some interface dependent + settings like switch on/off the RS232 status lines and must also + be defined from each derivated class. +*/ + + class IOBase + { + protected: + /*! + \brief internal fifo (first in, first out queue) to put back + already readed bytes into the reading stream. After put back a single + byte or sequence of characters, you can read them again with the + next Read call. + */ + Fifo* m_fifo; + enum { + /// fifosize of the putback fifo + fifoSize = 256 + }; + /*! + Close the interface (internally the file descriptor, which was + connected with the interface). + \return zero on success, otherwise -1. + */ + virtual int CloseDevice() = 0; + /*! + Open the interface (internally to request a file descriptor for the + given interface). The second parameter is a undefined pointer of a + device dependent data struct. It must be undefined, because different + devices have different settings. A serial device like the com ports + points here to a data struct, includes information like baudrate, + parity, count of stopbits and wordlen and so on. Another devices + (for example a IEEE) needs a adress and EOS (end of string character) + and don't use baudrate or parity. + \param devname the name of the device, presents the given interface. + Under windows for example COM1, under Linux /dev/cua0. Use wxCOMn to + avoid plattform depended code (n is the serial port number, beginning + with 1). + \param dcs untyped pointer of advanced device parameters, + \sa struct dcs_devCUA (data struct for the serail com ports) + \return zero on success, otherwise -1 + */ + virtual int OpenDevice(const char* devname, void* dcs = 0L) = 0; + public: + /*! + Default constructor + */ + IOBase() { + m_fifo = new Fifo(fifoSize); + }; + + /*! + Default destructor + */ + virtual ~IOBase() { + delete m_fifo; + }; + /*! + \brief A little helper function to detect the class name + \return the name of the class + */ + virtual const char* ClassName() {return "ctb::IOBase";}; + /*! + Closed the interface. Internally it calls the CloseDevice() + method, which must be defined in the derivated class. + \return zero on success, or -1 if an error occurred. + */ + int Close() {return CloseDevice();}; + + /*! + In this method we can do all things, which are different + between the discrete interfaces. The method is similar to the + C ioctl function. We take a command number and a integer + pointer as command parameter. + An example for this is the reset of a connection between a PC + and one ore more other instruments. On serial (RS232) connections + mostly a break will be send, GPIB on the other hand defines a + special line on the GPIB bus, to reset all connected devices. + If you only want to reset your connection, you should use the + Ioctl methode for doing this, independent of the real type of + the connection. + \param cmd a command identifier, (under Posix such as TIOCMBIS + for RS232 interfaces), IOBaseIoctls + \param args typeless parameter pointer for the command above. + \return zero on success, or -1 if an error occurred. + */ + virtual int Ioctl(int cmd,void* args) {return -1;}; + + /*! + Returns the current state of the device. + \return 1 if device is valid and open, otherwise 0 + */ + virtual int IsOpen() = 0; + + /*! + \param devname name of the interface, we want to open + \param dcs a untyped pointer to a device control struct. If + he is NULL, the default device parameter will be used. + \return the new file descriptor, or -1 if an error occurred + + The pointer dcs will be used for special device dependent + settings. Because this is very specific, the struct or + destination of the pointer will be defined by every device + itself. (For example: a serial device class should refer + things like parity, word length and count of stop bits, + a IEEE class adress and EOS character). + */ + int Open(const char* devname,void* dcs=0L) { + return OpenDevice(devname,dcs); + }; + + /*! + \brief In some circumstances you want to put back a already + readed byte (for instance, you have overreaded it and like to + parse the recieving bytes again). + The internal fifo stores fifoSize characters until you + have to read again. + \param ch the character to put back in the input stream + \return 1, if successful, otherwise 0 + */ + int PutBack(char ch) { + return m_fifo->put(ch); + }; + + /*! + Read attempt to read len bytes from the interface into the buffer + starting with buf. Read never blocks. If there are no bytes for + reading, Read returns zero otherwise the count of bytes been readed. + \param buf starting adress of the buffer + \param len count of bytes, we want to read + \return -1 on fails, otherwise the count of readed bytes + */ + virtual int Read(char* buf,size_t len) = 0; + + /*! + \brief + ReadUntilEos read bytes from the interface until the EOS string + was received or a timeout occurs. + ReadUntilEos returns the count of bytes been readed. The received + bytes are stored on the heap point by the readbuf pointer and + must delete by the caller. + \param readbuf points to the start of the readed bytes. You must + delete them, also if you received no byte. + \param readedBytes A pointer to the variable that receives the number + of bytes read. + \param eosString is the null terminated end of string sequence. + Default is the linefeed character. + \param timeout_in_ms the function returns after this time, also + if no eos occured (default is 1s). + \param quota defines a character between those an EOS doesn't + terminate the string + \return 1 on sucess (the operation ends successfull without a timeout), + 0 if a timeout occurred and -1 otherwise + */ + virtual int ReadUntilEOS(char*& readbuf, + size_t* readedBytes, + char* eosString = "\n", + long timeout_in_ms = 1000L, + char quota = 0); + + /*! + \brief + readv() attempts to read up to len bytes from the interface + into the buffer starting at buf. + readv() is blocked till len bytes are readed or the given + timeout in milliseconds was reached. + \param buf starting address of the buffer + \param len count bytes, we want to read + \param timeout_in_ms in milliseconds. If you don't want any timeout, + you give the wxTIMEOUT_INFINITY here. + But think of it: In this case, this function never returns + if there a not enough bytes to read. + \return the number of data bytes successfully read + */ + int Readv(char* buf,size_t len,unsigned int timeout_in_ms); + + /*! + \brief + readv() attempts to read up to len bytes from the interface + into the buffer starting at buf. + readv() is blocked till len bytes are readed or the timeout_flag + points on a int greater then zero. + \param buf starting adress of the buffer + \param len count bytes, we want to read + \param timeout_flag a pointer to an integer. If you don't want + any timeout, you given a null pointer here. + But think of it: In this case, this function comes never + back, if there a not enough bytes to read. + \param nice if true go to sleep for one ms (reduce CPU last), + if there is no byte available (default is false) + */ + int Readv(char* buf,size_t len,int* timeout_flag,bool nice=false); + + /*! + Write writes up to len bytes from the buffer starting with buf + into the interface. + \param buf start adress of the buffer + \param len count of bytes, we want to write + \return on success, the number of bytes written are returned + (zero indicates nothing was written). On error, -1 is returned. + */ + virtual int Write(char* buf,size_t len) = 0; + + /*! + Writev() writes up to len bytes to the interface from the buffer, + starting at buf. + Also Writev() blocks till all bytes are written or the given + timeout in milliseconds was reached. + \param buf starting address of the buffer + \param len count bytes, we want to write + \param timeout_in_ms timeout in milliseconds. If you give + wxTIMEOUT_INFINITY here, the function blocks, till all data was + written. + \return the number of data bytes successfully written. + */ + int Writev(char* buf,size_t len,unsigned int timeout_in_ms); + + /*! + Writev() writes up to len bytes to the interface from the buffer, + starting at buf. + Also Writev() blocks till all bytes are written or the timeout_flag + points to an integer greater then zero. + \param buf starting adress of the buffer + \param len count bytes, we want to write + \param timeout_flag a pointer to an integer. You also can give a null + pointer here. This blocks, til all data is writen. + \param nice if true go to sleep for one ms (reduce CPU last), + if there is no byte available (default is false) + */ + int Writev(char* buf,size_t len,int* timeout_flag,bool nice = false); + + }; + +} // namespace ctb + +#endif + + + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/kbhit.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/kbhit.h new file mode 100644 index 0000000000..2a0545439c --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/kbhit.h @@ -0,0 +1,10 @@ +#ifndef LIBCTB_KBHIT_H_INCLUDED_ +#define LIBCTB_KBHIT_H_INCLUDED_ + +namespace ctb { + + char GetKey(); + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/linux/serport.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/linux/serport.h new file mode 100644 index 0000000000..d88528bd25 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/linux/serport.h @@ -0,0 +1,94 @@ +#ifndef LIBCTB_LINUX_SERPORT_H_INCLUDED_ +#define LIBCTB_LINUX_SERPORT_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: linux/serport.h +// Purpose: +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "ctb-0.16/serportx.h" +#include +#include + +namespace ctb { + +/*! + \class SerialPort + + \brief the linux version +*/ + class SerialPort : public SerialPort_x + { + protected: + /*! + \brief under Linux, the serial ports are normal file descriptor + */ + int fd; + /*! + \brief Linux defines this struct termios for controling asynchronous + communication. t covered the active settings, save_t the original + settings. + */ + struct termios t, save_t; + + /*! + \brief The Linux serial driver summing all breaks, framings, overruns + and parity errors for each port during system runtime. Because we only + need the errors during a active connection, we must save the actual + error numbers in this separate structurs. + */ + struct serial_icounter_struct save_info, last_info; + + /*! + \brief adaptor member function, to convert the plattform independent + type wxBaud into a linux conform value. + \param baud the baudrate as wxBaud type + \return speed_t linux specific data type, defined in termios.h + */ + speed_t AdaptBaudrate( int baud ); + + int CloseDevice(); + int OpenDevice(const char* devname, void* dcs); + + /*! + \brief internal member function to set an unusal (non-standard) + baudrate. Called by SetBaudrate. + */ + int SetBaudrateAny( int baudrate ); + + /*! + \brief internal member function to set a standard baudrate. + Called by SetBaudrate. + */ + int SetBaudrateStandard( int baudrate ); + + public: + SerialPort(); + + ~SerialPort(); + + int ChangeLineState( SerialLineState flags ); + + int ClrLineState( SerialLineState flags ); + + int GetLineState(); + int Ioctl(int cmd,void* args); + int IsOpen(); + int Read(char* buf,size_t len); + int SendBreak(int duration); + + int SetBaudrate( int baudrate ); + + int SetParityBit( bool parity ); + + int SetLineState( SerialLineState flags ); + + int Write(char* buf,size_t len); + }; + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/linux/timer.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/linux/timer.h new file mode 100644 index 0000000000..7cc1a51e01 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/linux/timer.h @@ -0,0 +1,139 @@ +#ifndef LIBCTB_LINUX_TIMER_H_INCLUDED_ +#define LIBCTB_LINUX_TIMER_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: linux/timer.h +// Purpose: +// Author: Joachim Buermann +// Id: $Id: timer.h,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/** + \file timer.h +*/ + +#include + +namespace ctb { + +/*! + \brief A data struct, using from class timer. +*/ + struct timer_control + { + /*! + under linux, we used usec internally + */ + unsigned int usecs; + /*! + covers the adress of the exitflag + */ + int *exitflag; + /*! + covers the adress of the exit function. NULL, if + there was no exit function. + */ + void* (*exitfnc)(void*); + }; + +/*! + \class Timer + \brief A thread based timer class for handling timeouts in + an easier way. + + On starting every timer instance will create it's own thread. + The thread makes simply nothing, until it's given time is over. + After that, he set a variable, refer by it's adress to one + and exit. + + There are a lot of situations, which the timer class must handle. + The timer instance leaves his valid range (for example, the + timer instance is local inside a function, and the function fished) + BEFORE the thread was ending. In this case, the destructor must + terminate the thread in a correct way. (This is very different + between the OS. threads are a system resource like file descriptors + and must be deallocated after using it). + + The thread should be asynchronously stopped. Means, under all + circumstance, it must be possible, to finish the timer and start + it again. + + Several timer instance can be used simultanously. +*/ + class Timer + { + protected: + /*! + control covers the time interval, the adress + of the exitflag, and if not null, a function, which will + be called on the end. + */ + timer_control control; + /*! + stopped will be set by calling the stop() method. + Internaly the timer thread steadily tests the state of + this variable. If stopped not zero, the thread will be + finished. + */ + int stopped; + /*! + under linux we use the pthread library. tid covers the + identifier for a separate threads. + */ + pthread_t tid; + /*! + here we store the time interval, whilst the timer run. + This is waste!!! + */ + unsigned int timer_secs; + + public: + /*! + The constructor creates an timer object with the given + properties. The timer at this moment is not started. This + will be done with the start() member function. + \param msec time interval after that the the variable + pointed by exitflag is setting to one. + \param exitflag the adress of an integer, which was set + to one after the given time interval. + \warning The integer variable shouldn't leave it's valid + range, before the timer was finished. So never take a + local variable. + \param exitfnc A function, which was called after msec. + If you don't want this, refer a NULL pointer. + */ + Timer(unsigned int msec,int* exitflag,void*(*exitfnc)(void*)); + /*! + the destructor. If his was called (for example by leaving the + valid range of the timer object), the timer thread automaticaly + will finished. The exitflag wouldn't be set, also the exitfnc + wouldn't be called. + */ + ~Timer(); + /*! + starts the timer. But now a thread will created and started. + After this, the timer thread will be running until he was stopped + by calling stop() or reached his given time interval. + */ + int start(); + /*! + stops the timer and canceled the timer thread. After timer::stop() a new + start() will started the timer from beginning. + */ + int stop(); + }; + +/*! + \brief sleepms + A plattform independent function, to go to sleep for the given + time interval. + \param ms time interval in milli seconds +*/ + void sleepms(unsigned int ms); + +} // namespace ctb + +#endif + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/portscan.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/portscan.h new file mode 100644 index 0000000000..92c4ba11d6 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/portscan.h @@ -0,0 +1,25 @@ +#ifndef LIBCTB_PORTSCAN_H_INCLUDED_ +#define LIBCTB_PORTSCAN_H_INCLUDED_ + +#include +#include + +/** + \file portscan.h +*/ + +namespace ctb { + + /*! + \brief returns all available COM ports as an array of strings. + \param result stores the available COM ports + \param checkInUse return only ports which are available AND + unused (default) + \return true if successful, false otherwise + */ + bool GetAvailablePorts( std::vector& result, + bool checkInUse = true ); + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/serport.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/serport.h new file mode 100644 index 0000000000..9488753d4b --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/serport.h @@ -0,0 +1,20 @@ +#ifndef LIBCTB_SERPORT_H_INCLUDED_ +#define LIBCTB_SERPORT_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: serport.h +// Purpose: simple wrapper file +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined (WIN32) +# include "ctb-0.16/win32/serport.h" +#else +# include "ctb-0.16/linux/serport.h" +#endif + +#endif +// __SERPORT_BASE_H + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/serportx.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/serportx.h new file mode 100644 index 0000000000..aa55c4ec59 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/serportx.h @@ -0,0 +1,451 @@ +#ifndef LIBCTB_SERPORTX_H_INCLUDED_ +#define LIBCTB_SERPORTX_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: serportx.h +// Purpose: +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include +#include +#include "ctb-0.16/iobase.h" + +#if defined (WIN32) +# define snprintf _snprintf +#endif + +/** + \file serportx.h +*/ + +/*! + \def SERIALPORT_NAME_LEN + defines the maximum length of the os depending serial port names +*/ +#define SERIALPORT_NAME_LEN 32 + +namespace ctb { + + /*! specifices the first serial port */ + extern const char* COM1; + /*! specifies the second serial port */ + extern const char* COM2; + /*! specifies the third serial port */ + extern const char* COM3; + /*! specifies the fourth serial port */ + extern const char* COM4; + /*! specifies the fifth serial port */ + extern const char* COM5; + /*! specifies the sixth serial port */ + extern const char* COM6; + /*! specifies the seventh serial port */ + extern const char* COM7; + /*! specifies the eighth serial port */ + extern const char* COM8; + /*! specifies the ninth serial port */ + extern const char* COM9; + /*! specifies the tenth serial port */ + extern const char* COM10; + /*! specifies the eleventh serial port */ + extern const char* COM11; + /*! specifies the twelfth serial port */ + extern const char* COM12; + /*! specifies the thriteenth serial port */ + extern const char* COM13; + /*! specifies the fourteenth serial port */ + extern const char* COM14; + /*! specifies the fiveteenth serial port */ + extern const char* COM15; + /*! specifies the sixteenth serial port */ + extern const char* COM16; + /*! specifies the seventeenth serial port */ + extern const char* COM17; + /*! specifies the eighteenth serial port */ + extern const char* COM18; + /*! specifies the nineteenth serial port */ + extern const char* COM19; + /*! specifies the twentieth serial port */ + extern const char* COM20; + + /*! + \enum Parity + + \brief Defines the different modes of parity checking. Under + Linux, the struct termios will be set to provide the wanted + behaviour. + */ + enum Parity + { + /*! no parity check */ + ParityNone, + /*! odd parity check */ + ParityOdd, + /*! even parity check */ + ParityEven, + /*! mark (not implemented yet) */ + ParityMark, + /*! space (not implemented yet) */ + ParitySpace + }; + + /*! + \enum SerialLineState + + Defines the different modem control lines. The value for + each item are defined in /usr/include/bits/ioctl-types.h. + This is the linux definition. The window version translate + each item in it's own value. + modem lines defined in ioctl-types.h + \code + #define TIOCM_LE 0x001 + #define TIOCM_DTR 0x002 + #define TIOCM_RTS 0x004 + #define TIOCM_ST 0x008 + #define TIOCM_SR 0x010 + #define TIOCM_CTS 0x020 + #define TIOCM_CAR 0x040 + #define TIOCM_RNG 0x080 + #define TIOCM_DSR 0x100 + #define TIOCM_CD TIOCM_CAR + #define TIOCM_RI TIOCM_RNG + \endcode + */ + enum SerialLineState + { + /*! Data Carrier Detect (read only) */ + LinestateDcd = 0x040, + /*! Clear To Send (read only) */ + LinestateCts = 0x020, + /*! Data Set Ready (read only) */ + LinestateDsr = 0x100, + /*! Data Terminal Ready (write only) */ + LinestateDtr = 0x002, + /*! Ring Detect (read only) */ + LinestateRing = 0x080, + /*! Request To Send (write only) */ + LinestateRts = 0x004, + /*! no active line state, use this for clear */ + LinestateNull = 0x000 + }; + + /*! + \struct SerialPort_DCS + + The device control struct for the serial communication class. + This struct should be used, if you refer advanced parameter. + */ + struct SerialPort_DCS + { + /*! the baudrate */ + int baud; + /*! the parity */ + Parity parity; + /*! the wordlen */ + unsigned char wordlen; + /*! count of stopbits */ + unsigned char stopbits; + /*! rtscts flow control */ + bool rtscts; + /*! XON/XOFF flow control */ + bool xonxoff; + /*! buffer for internal use */ + char buf[16]; + SerialPort_DCS() { + baud = 38400; + parity = ParityNone; + wordlen = 8; + stopbits = 1; + rtscts = false; + xonxoff = false; + }; + // to avoid memory leak warnings generated by swig + ~SerialPort_DCS() {}; + /*! + \brief returns the internal settings of the DCS as a human + readable string like '8N1 115200'. + \return the internal settings as null terminated string + */ + char* GetSettings() { + const char ac[5] = {'N','O','E','M','S'}; + memset(buf,0,sizeof(buf)); + snprintf(buf,sizeof(buf)-1,"%i%c%i %i", + wordlen, + ac[parity], + stopbits, + baud); + return buf; + }; + }; + +/*! + \struct SerialPort_EINFO + + The internal communication error struct. It contains the number + of each error (break, framing, overrun and parity) since opening + the serial port. Each error number will be cleared if the open + methode was called. +*/ + struct SerialPort_EINFO + { + /*! number of breaks */ + int brk; + /*! number of framing errors */ + int frame; + /*! number of overrun errors */ + int overrun; + /*! number of parity errors */ + int parity; + SerialPort_EINFO() { + brk = frame = overrun = parity = 0; + }; + ~SerialPort_EINFO() {}; + }; + + /*! + \enum SerialPortIoctls + + The following Ioctl calls are only valid for the SerialPort + class. + */ + enum SerialPortIoctls { + /*! + Get all numbers of occured communication errors (breaks + framing, overrun and parity), so the args parameter of + the Ioctl call must pointed to a SerialPort_EINFO + struct. + */ + CTB_SER_GETEINFO = CTB_SERIAL, + /*! + Get integer 1, if a break occured since the last call + so the args parameter of the Ioctl methode must pointed + to an integer value. If there was no break, the result + is integer 0. + */ + CTB_SER_GETBRK, + /*! + Get integer 1, if a framing occured since the last call + so the args parameter of the Ioctl methode must pointed + to an integer value. If there was no break, the result + is integer 0. + */ + CTB_SER_GETFRM, + /*! + Get integer 1, if a overrun occured since the last call + so the args parameter of the Ioctl methode must pointed + to an integer value. If there was no break, the result + is integer 0. + */ + CTB_SER_GETOVR, + /*! + Get integer 1, if a parity occured since the last call + so the args parameter of the Ioctl methode must pointed + to an integer value. If there was no break, the result + is integer 0. + */ + CTB_SER_GETPAR, + /*! + Get the number of bytes received by the serial port driver + but not yet read by a Read or Readv Operation. + */ + CTB_SER_GETINQUE, + /*! + Set the parity bit on or off to use it as a ninth bit. + */ + CTB_SER_SETPAR + }; + +/*! + \class SerialPort_x + SerialPort_x is the basic class for serial communication via + the serial comports. It is also an abstract class and defines + all necessary methods, which the derivated plattform depended + classes must be invoke. +*/ + class SerialPort_x : public IOBase + { + protected: + /*! + \brief contains the internal settings of the serial port like + baudrate, protocol, wordlen and so on. + */ + SerialPort_DCS m_dcs; + /*! + \brief contains the internal (os specific) name of the serial + device. + */ + char m_devname[SERIALPORT_NAME_LEN]; + public: + + /*! + \enum FlowControl + \brief Specifies the flow control. + + + */ + enum FlowControl + { + NoFlowControl, /*!< No flow control at all */ + + RtsCtsFlowControl, /*!< Enable RTS/CTS hardware flow control */ + + XonXoffFlowControl /*!< Enable XON/XOFF protocol */ + }; + + SerialPort_x() {m_devname[0] = '\0';}; + virtual ~SerialPort_x() {}; + /*! + \brief returns the name of the class instance. You find this useful, + if you handle different devices like a serial port or a gpib device + via a IOBase pointer. + \return name of the class. + */ + const char* ClassName() {return "ctb::SerialPort";}; + + /*! + \brief change the linestates according to which bits + are set/unset in flags. + \param flags valid line flags are SERIAL_LINESTATE_DSR and/or + SERIAL_LINESTATE_RTS + \return zero on success, -1 if an error occurs + */ + virtual int ChangeLineState( SerialLineState flags ) = 0; + + /*! + \brief turn off status lines depending upon which bits (DSR and/or RTS) + are set in flags. + \param flags valid line flags are SERIAL_LINESTATE_DSR and/or + SERIAL_LINESTATE_RTS + \return zero on success, -1 if an error occurs + */ + virtual int ClrLineState( SerialLineState flags ) = 0; + + /*! + \brief Read the line states of DCD, CTS, DSR and RING + \return returns the appropriate bits on sucess, otherwise -1 + */ + virtual int GetLineState() = 0; + + /*! + \brief request the current settings of the connected serial port + as a null terminated string. + \return the settings as a string like '8N1 115200' + */ + virtual char* GetSettingsAsString() { + return m_dcs.GetSettings(); + }; + + /*! + \brief Many operating characteristics are only possible for + special devices. To avoid the need of a lot of different functions + and to give the user a uniform interface, all this special + operating instructions will covered by one Ioctl methode (like + the linux ioctl call). + The Ioctl command (cmd) has encoded in it whether the argument + is an in parameter or out parameter, and the size of the + argument args in bytes. Macros and defines used in specifying an + ioctl request are located in iobase.h and the header file for + the derivated device (for example in serportx.h). + \param cmd one of SerialPortIoctls specify the ioctl request. + \param args is a typeless pointer to a memory location, where + Ioctl reads the request arguments or write the results. + Please note, that an invalid memory location or size involving + a buffer overflow or segmention fault! + */ + virtual int Ioctl(int cmd,void* args) {return -1;}; + + /*! + \brief Opens a serial port in a user likely way. Insteed of + using the Device Control Struct just input your parameter in a + more intuitive manner. + \param portname the name of the serial port + \param baudrate any baudrate, also an unusual one, if your + serial device support them + \param protocol a string with the number of databits (5...8), + the parity setting (N=None,O=Odd,E=Even,M=Mark,S=Space), also + in lower case, and the count of stopbits (1...2) + \param flowControl one of NoFlowControl, RtsCtsFlowControl or + XonXoffFlowControl. + \return the new file descriptor, or -1 if an error occurred + */ + int Open( const char* portname, int baudrate, + const char* protocol = "8N1", + FlowControl flowControl = NoFlowControl ); + + /*! + \brief Opens the serial port with the given number. + \note The port numbering starts with 1 (COM1 for windows and + /dev/ttyS0 for Linux. Please note, that USB to RS232 converter + in Linux are named as /dev/ttyUSBx and from there have to + opened with their device name! + \param number of the serial port count from 1 + \param baudrate any baudrate, also an unusual one, if your + serial device support them + \param protocol a string with the number of databits (5...8), + the parity setting (N=None,O=Odd,E=Even,M=Mark,S=Space), also + in lower case, and the count of stopbits (1...2) + \param flowControl one of NoFlowControl, RtsCtsFlowControl or + XonXoffFlowControl. + \return the new file descriptor, or -1 if an error occurred + */ + int Open( const int portnumber, int baudrate, + const char* protocol = "8N1", + FlowControl flowControl = NoFlowControl ); + + // Open overrides and hides the IOBase::Open( const char* + // devname, void* dcs ) of the base class! So bring it into scope + // again! + using IOBase::Open; + + /*! + \brief Sendbreak transmits a continuous stream of zero-valued + bits for a specific duration. + \param duration If duration is zero, it transmits + zero-valued bits for at least 0.25 seconds, and not more that + 0.5 seconds. If duration is not zero, it sends zero-valued bits + for duration*N seconds, where N is at least 0.25, and not more + than 0.5. + \return zero on success, -1 if an error occurs. + */ + virtual int SendBreak(int duration) = 0; + + /*! + \brief Set the baudrate (also non-standard) + Please note: Non-standard baudrates like 70000 are not supported + by each UART and depends on the RS232 chipset you apply. + \param baudrate the new baudrate + \return zero on success, -1 if an error occurs + */ + virtual int SetBaudrate( int baudrate ) = 0; + + /*! + \brief turn on status lines depending upon which bits (DSR and/or RTS) + are set in flags. + \param flags valid line flags are SERIAL_LINESTATE_DSR and/or + SERIAL_LINESTATE_RTS + \return zero on success, -1 if an error occurs + */ + virtual int SetLineState( SerialLineState flags ) = 0; + + /*! + \brief Set the parity bit to a firm state, for instance to use + the parity bit as the ninth bit in a 9 bit dataword + communication. + \return zero on succes, a negative value if an error occurs + */ + virtual int SetParityBit( bool parity ) = 0; + + /*! + \brief check the given baudrate against a list of standard rates. + \ return true, if the baudrate is a standard value, false + otherwise + */ + static bool IsStandardRate( int rate ); + + }; + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/timer.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/timer.h new file mode 100644 index 0000000000..b1313ebfef --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/timer.h @@ -0,0 +1,19 @@ +#ifndef LIBCTB_TIMER_H_INCLUDED_ +#define LIBCTB_TIMER_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: simple wrapper file +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined (WIN32) +# include "win32/timer.h" +#else +# include "linux/timer.h" +#endif + +#endif + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/getopt.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/getopt.h new file mode 100644 index 0000000000..afa50d4567 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/getopt.h @@ -0,0 +1,17 @@ +#ifndef LIBCTB_WIN32_GETOPT_H_INCLUDED_ +#define LIBCTB_WIN32_GETOPT_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: win32/getopt.h +// Purpose: +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +extern char* optarg; +extern int optind; + +int getopt(int argc, char* argv[], char* optstring); + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/gpib-32.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/gpib-32.h new file mode 100644 index 0000000000..627b30acfa --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/gpib-32.h @@ -0,0 +1,414 @@ +/* + * + * + * Win32 include file + * for accessing the 32-bit GPIB DLL (gpib-32.dll) + * + * + * Contains user variables (ibsta, iberr, ibcnt, ibcntl), + * function prototypes and useful defined constants for + * calling NI-488 and NI-488.2 routines from a Microsoft + * C/C++ Win32 application. + * + * + * Copyright 1998 National Instruments Corporation + * + */ + +#ifndef DECL_32_H // ensure we are only included once +#define DECL_32_H + +#include "windows.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/***************************************************************************/ +/* HANDY CONSTANTS FOR USE BY APPLICATION PROGRAMS ... */ +/***************************************************************************/ +#define UNL 0x3f /* GPIB unlisten command */ +#define UNT 0x5f /* GPIB untalk command */ +#define GTL 0x01 /* GPIB go to local */ +#define SDC 0x04 /* GPIB selected device clear */ +#define PPC 0x05 /* GPIB parallel poll configure */ +#define GET 0x08 /* GPIB group execute trigger */ +#define TCT 0x09 /* GPIB take control */ +#define LLO 0x11 /* GPIB local lock out */ +#define DCL 0x14 /* GPIB device clear */ +#define PPU 0.16 /* GPIB parallel poll unconfigure */ +#define SPE 0x18 /* GPIB serial poll enable */ +#define SPD 0x19 /* GPIB serial poll disable */ +#define PPE 0x60 /* GPIB parallel poll enable */ +#define PPD 0x70 /* GPIB parallel poll disable */ + +/* GPIB status bit vector : */ +/* global variable ibsta and wait mask */ + +#define ERR (1<<15) /* Error detected */ +#define TIMO (1<<14) /* Timeout */ +#define END (1<<13) /* EOI or EOS detected */ +#define SRQI (1<<12) /* SRQ detected by CIC */ +#define RQS (1<<11) /* Device needs service */ +#define CMPL (1<<8) /* I/O completed */ +#define LOK (1<<7) /* Local lockout state */ +#define REM (1<<6) /* Remote state */ +#define CIC (1<<5) /* Controller-in-Charge */ +#define ATN (1<<4) /* Attention asserted */ +#define TACS (1<<3) /* Talker active */ +#define LACS (1<<2) /* Listener active */ +#define DTAS (1<<1) /* Device trigger state */ +#define DCAS (1<<0) /* Device clear state */ + +/* Error messages returned in global variable iberr */ + +#define EDVR 0 /* System error */ +#define ECIC 1 /* Function requires GPIB board to be CIC */ +#define ENOL 2 /* Write function detected no Listeners */ +#define EADR 3 /* Interface board not addressed correctly*/ +#define EARG 4 /* Invalid argument to function call */ +#define ESAC 5 /* Function requires GPIB board to be SAC */ +#define EABO 6 /* I/O operation aborted */ +#define ENEB 7 /* Non-existent interface board */ +#define EDMA 8 /* Error performing DMA */ +#define EOIP 10 /* I/O operation started before previous */ + /* operation completed */ +#define ECAP 11 /* No capability for intended operation */ +#define EFSO 12 /* File system operation error */ +#define EBUS 14 /* Command error during device call */ +#define ESTB 15 /* Serial poll status byte lost */ +#define ESRQ 16 /* SRQ remains asserted */ +#define ETAB 20 /* The return buffer is full. */ +#define ELCK 21 /* Address or board is locked. */ + +/* EOS mode bits */ + +#define BIN (1<<12) /* Eight bit compare */ +#define XEOS (1<<11) /* Send END with EOS byte */ +#define REOS (1<<10) /* Terminate read on EOS */ + +/* Timeout values and meanings */ + +#define TNONE 0 /* Infinite timeout (disabled) */ +#define T10us 1 /* Timeout of 10 us (ideal) */ +#define T30us 2 /* Timeout of 30 us (ideal) */ +#define T100us 3 /* Timeout of 100 us (ideal) */ +#define T300us 4 /* Timeout of 300 us (ideal) */ +#define T1ms 5 /* Timeout of 1 ms (ideal) */ +#define T3ms 6 /* Timeout of 3 ms (ideal) */ +#define T10ms 7 /* Timeout of 10 ms (ideal) */ +#define T30ms 8 /* Timeout of 30 ms (ideal) */ +#define T100ms 9 /* Timeout of 100 ms (ideal) */ +#define T300ms 10 /* Timeout of 300 ms (ideal) */ +#define T1s 11 /* Timeout of 1 s (ideal) */ +#define T3s 12 /* Timeout of 3 s (ideal) */ +#define T10s 13 /* Timeout of 10 s (ideal) */ +#define T30s 14 /* Timeout of 30 s (ideal) */ +#define T100s 15 /* Timeout of 100 s (ideal) */ +#define T300s 16 /* Timeout of 300 s (ideal) */ +#define T1000s 17 /* Timeout of 1000 s (ideal) */ + + +/* IBLN Constants */ +#define NO_SAD 0 +#define ALL_SAD -1 + + +/* The following constants are used for the second parameter of the + * ibconfig function. They are the "option" selection codes. + */ +#define IbcPAD 0x0001 /* Primary Address */ +#define IbcSAD 0x0002 /* Secondary Address */ +#define IbcTMO 0x0003 /* Timeout Value */ +#define IbcEOT 0x0004 /* Send EOI with last data byte? */ +#define IbcPPC 0x0005 /* Parallel Poll Configure */ +#define IbcREADDR 0x0006 /* Repeat Addressing */ +#define IbcAUTOPOLL 0x0007 /* Disable Auto Serial Polling */ +#define IbcCICPROT 0x0008 /* Use the CIC Protocol? */ +#define IbcIRQ 0x0009 /* Use PIO for I/O */ +#define IbcSC 0x000A /* Board is System Controller? */ +#define IbcSRE 0x000B /* Assert SRE on device calls? */ +#define IbcEOSrd 0x000C /* Terminate reads on EOS */ +#define IbcEOSwrt 0x000D /* Send EOI with EOS character */ +#define IbcEOScmp 0x000E /* Use 7 or 8-bit EOS compare */ +#define IbcEOSchar 0x000F /* The EOS character. */ +#define IbcPP2 0x0010 /* Use Parallel Poll Mode 2. */ +#define IbcTIMING 0x0011 /* NORMAL, HIGH, or VERY_HIGH timing. */ +#define IbcDMA 0x0012 /* Use DMA for I/O */ +#define IbcReadAdjust 0x0013 /* Swap bytes during an ibrd. */ +#define IbcWriteAdjust 0x014 /* Swap bytes during an ibwrt. */ +#define IbcSendLLO 0x0017 /* Enable/disable the sending of LLO. */ +#define IbcSPollTime 0x0018 /* Set the timeout value for serial polls. */ +#define IbcPPollTime 0x0019 /* Set the parallel poll length period. */ +#define IbcEndBitIsNormal 0x001A /* Remove EOS from END bit of IBSTA. */ +#define IbcUnAddr 0x001B /* Enable/disable device unaddressing. */ +#define IbcSignalNumber 0x001C /* Set UNIX signal number - unsupported */ +#define IbcBlockIfLocked 0x001D /* Enable/disable blocking for locked boards/devices */ +#define IbcHSCableLength 0x001F /* Length of cable specified for high speed timing.*/ +#define IbcIst 0x0020 /* Set the IST bit. */ +#define IbcRsv 0x0021 /* Set the RSV byte. */ + +/* + * Constants that can be used (in addition to the ibconfig constants) + * when calling the ibask() function. + */ + +#define IbaPAD IbcPAD +#define IbaSAD IbcSAD +#define IbaTMO IbcTMO +#define IbaEOT IbcEOT +#define IbaPPC IbcPPC +#define IbaREADDR IbcREADDR +#define IbaAUTOPOLL IbcAUTOPOLL +#define IbaCICPROT IbcCICPROT +#define IbaIRQ IbcIRQ +#define IbaSC IbcSC +#define IbaSRE IbcSRE +#define IbaEOSrd IbcEOSrd +#define IbaEOSwrt IbcEOSwrt +#define IbaEOScmp IbcEOScmp +#define IbaEOSchar IbcEOSchar +#define IbaPP2 IbcPP2 +#define IbaTIMING IbcTIMING +#define IbaDMA IbcDMA +#define IbaReadAdjust IbcReadAdjust +#define IbaWriteAdjust IbcWriteAdjust +#define IbaSendLLO IbcSendLLO +#define IbaSPollTime IbcSPollTime +#define IbaPPollTime IbcPPollTime +#define IbaEndBitIsNormal IbcEndBitIsNormal +#define IbaUnAddr IbcUnAddr +#define IbaSignalNumber IbcSignalNumber +#define IbaBlockIfLocked IbcBlockIfLocked +#define IbaHSCableLength IbcHSCableLength +#define IbaIst IbcIst +#define IbaRsv IbcRsv + +#define IbaBNA 0x0200 /* A device's access board. */ + + +/* Values used by the Send 488.2 command. */ +#define NULLend 0x00 /* Do nothing at the end of a transfer.*/ +#define NLend 0x01 /* Send NL with EOI after a transfer. */ +#define DABend 0x02 /* Send EOI with the last DAB. */ + +/* Value used by the 488.2 Receive command. + */ +#define STOPend 0x0100 + + +/* Address type (for 488.2 calls) */ + +typedef short Addr4882_t; /* System dependent: must be 16 bits */ + +/* + * This macro can be used to easily create an entry in address list + * that is required by many of the 488.2 functions. The primary address goes in the + * lower 8-bits and the secondary address goes in the upper 8-bits. + */ +#define MakeAddr(pad, sad) ((Addr4882_t)(((pad)&0xFF) | ((sad)<<8))) + +/* + * This value is used to terminate an address list. It should be + * assigned to the last entry. + */ +#ifndef NOADDR +#define NOADDR (Addr4882_t)((unsigned short)0xFFFF) +#endif + +/* + * The following two macros are used to "break apart" an address list + * entry. They take an unsigned integer and return either the primary + * or secondary address stored in the integer. + */ +#define GetPAD(val) ((val) & 0xFF) +#define GetSAD(val) (((val) >> 8) & 0xFF) + +/* iblines constants */ + +#define ValidEOI (short)0x0080 +#define ValidATN (short)0x0040 +#define ValidSRQ (short)0x0020 +#define ValidREN (short)0x0010 +#define ValidIFC (short)0x0008 +#define ValidNRFD (short)0x0004 +#define ValidNDAC (short)0x0002 +#define ValidDAV (short)0x0001 +#define BusEOI (short)0x8000 +#define BusATN (short)0x4000 +#define BusSRQ (short)0x2000 +#define BusREN (short)0x1000 +#define BusIFC (short)0x0800 +#define BusNRFD (short)0x0400 +#define BusNDAC (short)0x0200 +#define BusDAV (short)0x0100 + +/**** + **** typedef for ibnotify callback **** + ****/ +typedef int (__stdcall * GpibNotifyCallback_t)(int, int, int, long, PVOID); + +#define IBNOTIFY_REARM_FAILED 0xE00A003F + + +/*************************************************************************/ +/* */ +/* iblockx and ibunlockx definitions --- for use with GPIB-ENET only !! */ +/* */ +/*************************************************************************/ +#define TIMMEDIATE -1 +#define TINFINITE -2 +#define MAX_LOCKSHARENAME_LENGTH 64 + +#if defined(UNICODE) + #define iblockx iblockxW +#else + #define iblockx iblockxA +#endif + +extern int __stdcall iblockxA (int ud, int LockWaitTime, PCHAR LockShareName); +extern int __stdcall iblockxW (int ud, int LockWaitTime, PWCHAR LockShareName); +extern int __stdcall ibunlockx (int ud); + + +/***************************************************************************/ +/* IBSTA, IBERR, IBCNT, IBCNTL and FUNCTION PROTOTYPES */ +/* ( only included if not accessing the 32-bit DLL directly ) */ +/***************************************************************************/ +#if !defined(GPIB_DIRECT_ACCESS) + +/* + * Set up access to the user variables (ibsta, iberr, ibcnt, ibcntl). + * These are declared and exported by the 32-bit DLL. Separate copies + * exist for each process that accesses the DLL. They are shared by + * multiple threads of a single process. + */ + +extern int ibsta; +extern int iberr; +extern int ibcnt; +extern long ibcntl; + + +#if defined(UNICODE) + #define ibbna ibbnaW + #define ibfind ibfindW + #define ibrdf ibrdfW + #define ibwrtf ibwrtfW +#else + #define ibbna ibbnaA + #define ibfind ibfindA + #define ibrdf ibrdfA + #define ibwrtf ibwrtfA +#endif + +/* + * Extern 32-bit GPIB DLL functions + */ + +/* NI-488 Function Prototypes */ +extern int __stdcall ibfindA (LPCSTR udname); +extern int __stdcall ibbnaA (int ud, LPCSTR udname); +extern int __stdcall ibrdfA (int ud, LPCSTR filename); +extern int __stdcall ibwrtfA (int ud, LPCSTR filename); + +extern int __stdcall ibfindW (LPCWSTR udname); +extern int __stdcall ibbnaW (int ud, LPCWSTR udname); +extern int __stdcall ibrdfW (int ud, LPCWSTR filename); +extern int __stdcall ibwrtfW (int ud, LPCWSTR filename); + +extern int __stdcall ibask (int ud, int option, PINT v); +extern int __stdcall ibcac (int ud, int v); +extern int __stdcall ibclr (int ud); +extern int __stdcall ibcmd (int ud, PVOID buf, long cnt); +extern int __stdcall ibcmda (int ud, PVOID buf, long cnt); +extern int __stdcall ibconfig (int ud, int option, int v); +extern int __stdcall ibdev (int boardID, int pad, int sad, int tmo, int eot, int eos); +extern int __stdcall ibdiag (int ud, PVOID buf, long cnt); +extern int __stdcall ibdma (int ud, int v); +extern int __stdcall ibeos (int ud, int v); +extern int __stdcall ibeot (int ud, int v); +extern int __stdcall ibgts (int ud, int v); +extern int __stdcall ibist (int ud, int v); +extern int __stdcall iblines (int ud, PSHORT result); +extern int __stdcall ibln (int ud, int pad, int sad, PSHORT listen); +extern int __stdcall ibloc (int ud); +extern int __stdcall ibnotify (int ud, int mask, GpibNotifyCallback_t Callback, PVOID RefData); +extern int __stdcall ibonl (int ud, int v); +extern int __stdcall ibpad (int ud, int v); +extern int __stdcall ibpct (int ud); +extern int __stdcall ibpoke (int ud, long option, long v); +extern int __stdcall ibppc (int ud, int v); +extern int __stdcall ibrd (int ud, PVOID buf, long cnt); +extern int __stdcall ibrda (int ud, PVOID buf, long cnt); +extern int __stdcall ibrpp (int ud, PCHAR ppr); +extern int __stdcall ibrsc (int ud, int v); +extern int __stdcall ibrsp (int ud, PCHAR spr); +extern int __stdcall ibrsv (int ud, int v); +extern int __stdcall ibsad (int ud, int v); +extern int __stdcall ibsic (int ud); +extern int __stdcall ibsre (int ud, int v); +extern int __stdcall ibstop (int ud); +extern int __stdcall ibtmo (int ud, int v); +extern int __stdcall ibtrg (int ud); +extern int __stdcall ibwait (int ud, int mask); +extern int __stdcall ibwrt (int ud, PVOID buf, long cnt); +extern int __stdcall ibwrta (int ud, PVOID buf, long cnt); + +// GPIB-ENET only functions to support locking across machines +extern int __stdcall iblock (int ud); +extern int __stdcall ibunlock (int ud); + +/**************************************************************************/ +/* Functions to access Thread-Specific copies of the GPIB global vars */ + +extern int __stdcall ThreadIbsta (void); +extern int __stdcall ThreadIberr (void); +extern int __stdcall ThreadIbcnt (void); +extern long __stdcall ThreadIbcntl (void); + + +/**************************************************************************/ +/* NI-488.2 Function Prototypes */ + +extern void __stdcall AllSpoll (int boardID, Addr4882_t * addrlist, PSHORT results); +extern void __stdcall DevClear (int boardID, Addr4882_t addr); +extern void __stdcall DevClearList (int boardID, Addr4882_t * addrlist); +extern void __stdcall EnableLocal (int boardID, Addr4882_t * addrlist); +extern void __stdcall EnableRemote (int boardID, Addr4882_t * addrlist); +extern void __stdcall FindLstn (int boardID, Addr4882_t * addrlist, Addr4882_t * results, int limit); +extern void __stdcall FindRQS (int boardID, Addr4882_t * addrlist, PSHORT dev_stat); +extern void __stdcall PPoll (int boardID, PSHORT result); +extern void __stdcall PPollConfig (int boardID, Addr4882_t addr, int dataLine, int lineSense); +extern void __stdcall PPollUnconfig (int boardID, Addr4882_t * addrlist); +extern void __stdcall PassControl (int boardID, Addr4882_t addr); +extern void __stdcall RcvRespMsg (int boardID, PVOID buffer, long cnt, int Termination); +extern void __stdcall ReadStatusByte(int boardID, Addr4882_t addr, PSHORT result); +extern void __stdcall Receive (int boardID, Addr4882_t addr, PVOID buffer, long cnt, int Termination); +extern void __stdcall ReceiveSetup (int boardID, Addr4882_t addr); +extern void __stdcall ResetSys (int boardID, Addr4882_t * addrlist); +extern void __stdcall Send (int boardID, Addr4882_t addr, PVOID databuf, long datacnt, int eotMode); +extern void __stdcall SendCmds (int boardID, PVOID buffer, long cnt); +extern void __stdcall SendDataBytes (int boardID, PVOID buffer, long cnt, int eot_mode); +extern void __stdcall SendIFC (int boardID); +extern void __stdcall SendLLO (int boardID); +extern void __stdcall SendList (int boardID, Addr4882_t * addrlist, PVOID databuf, long datacnt, int eotMode); +extern void __stdcall SendSetup (int boardID, Addr4882_t * addrlist); +extern void __stdcall SetRWLS (int boardID, Addr4882_t * addrlist); +extern void __stdcall TestSRQ (int boardID, PSHORT result); +extern void __stdcall TestSys (int boardID, Addr4882_t * addrlist, PSHORT results); +extern void __stdcall Trigger (int boardID, Addr4882_t addr); +extern void __stdcall TriggerList (int boardID, Addr4882_t * addrlist); +extern void __stdcall WaitSRQ (int boardID, PSHORT result); + +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif // DECL_32_H + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/serport.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/serport.h new file mode 100644 index 0000000000..503f25cffb --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/serport.h @@ -0,0 +1,74 @@ +#ifndef LIBCTB_WIN32_TIMER_H_INCLUDED_ +#define LIBCTB_WIN32_TIMER_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: win32/serport.h +// Purpose: +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "../serportx.h" +#include + +namespace ctb { + + /*! + \class SerialPort + + \brief the win32 version + */ + class SerialPort : public SerialPort_x + { + protected: + /*! + \brief the win32 api equivalent for the Linux + file descriptor + */ + HANDLE fd; + /*! + \brief a very special struct in the win32 api for controling + an asynchronous serial communication through the com ports. + */ + OVERLAPPED m_ov; + + /*! + \brief The win32 API only allows to test for an existing + break, framing, overrun or parity, not for the occured numbers. + So every error event decrement this internal error struct and + can request by an Ioctl call. + */ + SerialPort_EINFO einfo; + + /*! + \brief The win32 API doesn't have any function to detect the + current state of the output lines RST and DTR (if someone knows + some function, please contact me). + So we save the state always after changing one or both lines + (for example, on Open, SetLineState and ChangeLineState) + */ + int m_rtsdtr_state; + + int CloseDevice(); + int OpenDevice(const char* devname, void* dcs); + public: + SerialPort(); + ~SerialPort(); + + int ChangeLineState( SerialLineState flags ); + int ClrLineState( SerialLineState flags ); + int GetLineState(); + int Ioctl(int cmd,void* args); + int IsOpen(); + int Read(char* buf,size_t len); + int SendBreak(int duration); + int SetBaudrate( int baudrate ); + int SetLineState( SerialLineState flags ); + int SetParityBit( bool parity ); + int Write(char* buf,size_t len); + }; + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/timer.h b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/timer.h new file mode 100644 index 0000000000..e750baead3 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/include/ctb-0.16/win32/timer.h @@ -0,0 +1,140 @@ +#ifndef LIBCTB_WINDOWS_TIMER_H_INCLUDED_ +#define LIBCTB_WINDOWS_TIMER_H_INCLUDED_ + +///////////////////////////////////////////////////////////////////////////// +// Name: win32/timer.h +// Purpose: +// Author: Joachim Buermann +// Copyright: (c) 2010 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include + +namespace ctb { + +/*! + \brief A data struct, using from class timer. +*/ + struct timer_control + { + /*! + under win32, we used msec internally + */ + unsigned int msecs; + /*! + covers the adress of the exitflag + */ + int *exitflag; + /*! + the running thread steadily polls this variable (only under win32). + If it's not zero, the thread terminate. + */ + MMRESULT stop; + /*! + covers the adress of the exit function. NULL, if + there was no exit function. + */ + void* (*exitfnc)(void*); + }; + +/*! + \class Timer + \brief A thread based timer class for handling timeouts in + an easier way. + + On starting every timer instance will create it's own thread. + The thread makes simply nothing, until it's given time is over. + After that, he set a variable, refer by it's adress to one + and exit. + + There are a lot of situations, which the timer class must handle. + The timer instance leaves his valid range (for example, the + timer instance is local inside a function, and the function fished) + BEFORE the thread was ending. In this case, the destructor must + terminate the thread in a correct way. (This is very different + between the OS. threads are a system resource like file descriptors + and must be deallocated after using it). + + The thread should be asynchronously stopped. Means, under all + circumstance, it must be possible, to finish the timer and start + it again. + + Several timer instance can be used simultanously. +*/ + class Timer + { + protected: + /*! + \brief win32 needs this + */ + DWORD id; + /*! + \brief in win32 internal handle for the timer thread + */ + MMRESULT h; + /*! + control covers the time interval, the adress + of the exitflag, and if not null, a function, which will + be called on the end. + */ + timer_control control; + /*! + here we store the time interval, whilst the timer run. + This is waste!!! + */ + unsigned int timer_secs; + public: + /*! + The constructor creates an timer object with the given + properties. The timer at this moment is not started. This + will be done with the start() member function. + \param msec time interval after that the the variable + pointed by exitflag is setting to one. + \param exitflag the adress of an integer, which was set + to one after the given time interval. + \warning The integer variable shouldn't leave it's valid + range, before the timer was finished. So never take a + local variable. + \param exitfnc A function, which was called after msec. + If you don't want this, refer a NULL pointer. + */ + Timer(unsigned int msec,int* exitflag,void*(*exitfnc)(void*)); + /*! + the destructor. If his was called (for example by leaving the + valid range of the timer object), the timer thread automaticaly + will finished. The exitflag wouldn't be set, also the exitfnc + wouldn't be called. + */ + ~Timer(); + /*! + starts the timer. But now a thread will created and started. + After this, the timer thread will be running until he was stopped + by calling stop() or reached his given time interval. + */ + int start(); + /*! + stops the timer and canceled the timer thread. After timer::stop() a new + start() will started the timer from beginning. + */ + int stop(); + }; + +/*! + \fn kill_all_timer() + \warning This function don't works under win32 and will be removed next + time. So don't use that! +*/ + void kill_all_timer(); + +/*! + \fn + A plattform independent function, to go to sleep for the given + time interval. + \param ms time interval in milli seconds +*/ + void sleepms(unsigned int ms); + +} // namespace ctb + +#endif diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/manual/refman.pdf b/src/mod/endpoints/mod_gsmopen/libctb-0.16/manual/refman.pdf new file mode 100644 index 0000000000..285e523de3 Binary files /dev/null and b/src/mod/endpoints/mod_gsmopen/libctb-0.16/manual/refman.pdf differ diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/module/linux/ctb.py b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/module/linux/ctb.py new file mode 100644 index 0000000000..6b541ffe39 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/module/linux/ctb.py @@ -0,0 +1,455 @@ +import wxctb, sys, re + +DCD = wxctb.LinestateDcd +CTS = wxctb.LinestateCts +DSR = wxctb.LinestateDsr +DTR = wxctb.LinestateDtr +RING = wxctb.LinestateRing +RTS = wxctb.LinestateRts +NULL = wxctb.LinestateNull + +def abstract(): + import inspect + caller = inspect.getouterframes(inspect.currentframe())[1][3] + raise NotImplementedError(caller + ' must be implemented in subclass') + +class IOBase: + def __init__(self): + self.device = None + # set timeout to 1000ms (the default) + self.timeout = 1000 + + def __del__(self): + pass + + def Close(self): + if self.device: + self.device.Close() + + def GetTimeout(self): + """ + Returns the internal timeout value in milliseconds + """ + return self.timeout + + def Ioctl(self,cmd,arg): + if self.device: + self.device.Ioctl(cmd,arg) + + def Open(self): + abstract() + + def PutBack(self,char): + return self.device.PutBack(char) + + def Read(self,length): + """ + Try to read the given count of data (length) and returns the + successfully readed number of data. The function never blocks. + For example: + readed = dev.Read(100) + """ + buf = "\x00"*(length+1) + rd = self.device.Read(buf,length) + return buf[0:rd] + + def ReadBinary(self,eos="\n"): + """ + Special SCPI command. Read the next data coded as a SCPI + binary format. + A binary data transfer will be startet by '#'. The next byte + tells the count of bytes for the binary length header, + following by the length bytes. After these the data begins. + For example: + #500004xxxx + The header length covers 5 Byte, the length of the binary + data is 4 (x means the binary data bytes) + """ + try: + eoslen = len(eos) + b=self.Readv(2) + if len(b) == 2: + hl = int(b[1]) + b = self.Readv(hl) + if len(b) == hl: + dl = int(b) + # don't left over the eos string or character in the + # device input buffer + data = self.Readv(dl+eoslen) + # check, if the binary data block is complete + if data[dl] == '#': + # not complete, another block is following + for c in data[dl:dl+eoslen]: + self.PutBack(c) + + data = data[:dl] + self.ReadBinary() + return data + except: + pass + return '' + + def ReadUntilEOS(self,eos="\n",quota=0): + """ + ReadUntilEOS(eosString=\"\\n\",timeout=1000) + Reads data until the given eos string was received (default is + the linefeed character (0x0a) or the internal timeout + (default 1000ms) was reached. + ReadUntilEOS returns the result as the following tuple: + ['received string',state,readedBytes] + If a timeout occurred, state is 0, otherwise 1 + """ + return self.device.ReadUntilEOS("",0,eos,self.timeout,quota) + + def Readv(self,length): + """ + Try to read the given count of data. Readv blocks until all data + was readed successfully or the internal timeout, set with the + class member function SetTimeout(timeout), was reached. + Returns the readed data. + """ + buf = "\x00"*length + rd = self.device.Readv(buf,length,self.timeout) + return buf[0:rd] + + def ResetBus(self): + """ + If the underlaying interface needs some special reset operations + (for instance the GPIB distinguish between a normal device reset + and a special bus reset), you can put some code here) + """ + pass + + def SetTimeout(self,timeout): + """ + Set the internal timeout value in milliseconds for all blocked + operations like ReadUntilEOS, Readv and Writev. + """ + self.timeout = timeout + + def Write(self,string): + """ + Writes the given string to the device and returns immediately. + Write returns the number of data bytes successfully written or a + negativ number if an error occured. For some circumstances, not + the complete string was written. + So you have to verify the return value to check this out. + """ + return self.device.Write(string,len(string)) + + def Writev(self,string): + """ + Writes the given string to the device. The function blocks until + the complete string was written or the internal timeout, set with + SetTimeout(timeout), was reached. + Writev returns the number of data successfully written or a + negativ value, if an errors occurred. + """ + return self.device.Writev(string,len(string),self.timeout) + +class SerialPort(IOBase): + def __init__(self): + IOBase.__init__(self) + + def __del__(self): + self.Close() + + def ChangeLineState(self,lineState): + """ + Change (toggle) the state of each the lines given in the + linestate parameter. Possible values are DTR and/or RTS. + For example to toggle the RTS line only: + dev.ChangeLineState(RTS) + """ + self.device.ChangeLineState(lineState) + + def ClrLineState(self,lineState): + """ + Clear the lines given in the linestate parameter. Possible + values are DTR and/or RTS. For example to clear only + the RTS line: + dev.ClrLineState(RTS) + """ + self.device.ClrLineState(lineState) + + def GetAvailableBytes(self): + """ + Returns the available bytes in the input queue of the serial + driver. + """ + n = wxctb.new_intp() + wxctb.intp_assign(n, 0) + self.device.Ioctl(wxctb.CTB_SER_GETINQUE,n) + return wxctb.intp_value(n) + + def GetCommErrors(self): + """ + Get the internal communication errors like breaks, framing, + parity or overrun errors. + Returns the count of each error as a tuple like this: + (b,f,o,p) = dev.GetCommErrors() + b: breaks, f: framing errors, o: overruns, p: parity errors + """ + einfo = wxctb.SerialPort_EINFO() + self.device.Ioctl(wxctb.CTB_SER_GETEINFO,einfo) + return einfo.brk,einfo.frame,einfo.overrun,einfo.parity + + def GetLineState(self): + """ + Returns the current linestates of the CTS, DCD, DSR and RING + signal line as an integer value with the appropriate bits or + -1 on error. + For example: + lines = dev.GetLineState() + if lines & CTS: + print \"CTS is on\" + """ + return self.device.GetLineState() + + def Open(self,devname,baudrate,protocol='8N1',handshake='no_handshake'): + """ + Open the device devname with the given baudrate, the protocol + like '8N1' (default) and the use of the handshake [no_handshake + (default), rtscts or xonxoff] + For example: + At Linux: + dev = SerialPort() + dev.Open(\"/dev/ttyS0\",115200) + or with a datalen of 7 bits, even parity, 2 stopbits and rts/cts + handshake: + dev.Open(\"/dev/ttyS0\",115200,'7E2',True) + At Windows: + dev = SerialPort() + dev.Open(\"COM1\",115200) + dev.Open(\"COM1\",115200,'7E2',True) + Returns the handle on success or a negativ value on failure. + """ + # the following parity values are valid: + # N:None, O:Odd, E:Even, M:Mark, S:Space + parity = {'N':0,'O':1,'E':2,'M':3,'S':4} + # the regular expression ensures a valid value for the datalen + # (5...8 bit) and the count of stopbits (1,2) + reg=re.compile(r"(?P[8765])"r"(?P

[NOEMS])"r"(?P[12])") + self.device = wxctb.SerialPort() + dcs = wxctb.SerialPort_DCS() + dcs.baud = baudrate + res = reg.search(protocol) + # handle the given protocol + if res: + dcs.wordlen = int(res.group('w')) + dcs.stopbits = int(res.group('s')) + dcs.parity = parity[res.group('p')] + # valid handshake are no one, rts/cts or xon/xoff + if handshake == 'rtscts': + dcs.rtscts = True + elif handshake == 'xonxoff': + dcs.xonxoff = True + + return self.device.Open(devname,dcs) + + def Reset(self): + """ + Send a break for 0.25s. + """ + self.device.SendBreak(0) + + def SetBaudrate(self,baudrate): + """ + Set the baudrate for the device. + """ + self.device.SetBaudrate(baudrate) + + def SetLineState(self,lineState): + """ + Set the lines given in the linestate parameter. Possible + values are DTR and/or RTS. For example to set both: + dev.SetLineState( DTR | RTS) + """ + self.device.SetLineState(lineState) + + def SetParityBit(self,parity): + """ + Set the parity bit explicitly to 0 or 1. Use this function, if + you would like to simulate a 9 bit wordlen at what the ninth bit + was represented by the parity bit value. For example: + dev.SetParityBit( 0 ) + dev.Write('some data sent with parity 0') + dev.SetParityBit( 1 ) + dev.Write('another sequence with parity 1') + """ + return self.device.SetParityBit( parity ) + +class GpibDevice(IOBase): + """ + GPIB class + """ + def __init__(self): + IOBase.__init__(self) + + def __del__(self): + self.Close() + + def FindListeners(self,board = 0): + """ + Returns the address of the connected devices as a list. + If no device is listening, the list is empty. If an error + occurs an IOError exception raised. For example: + g = GPIB() + listeners = g.FindListeners() + """ + listeners = wxctb.GPIB_x_FindListeners(board) + if listeners < 0: + raise IOError("GPIB board error") + result = [] + for i in range(1,31): + if listeners & (1 << i): + result.append(i) + return result + + def GetEosChar(self): + """ + Get the internal EOS termination character (see SetEosChar). + For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosChar() + """ + eos = wxctb.new_intp() + wxctb.intp_assign(eos, 0) + self.device.Ioctl(wxctb.CTB_GPIB_GET_EOS_CHAR,eos) + return wxctb.intp_value(eos) + + def GetEosMode(self): + """ + Get the internal EOS mode (see SetEosMode). + For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosMode() + """ + mode = wxctb.new_intp() + wxctb.intp_assign(mode, 0) + self.device.Ioctl(wxctb.CTB_GPIB_GET_EOS_MODE,mode) + return wxctb.intp_value(mode) + + def GetError(self): + errorString = " "*256 + self.device.GetError(errorString,256) + return errorString + + def GetSTB(self): + """ + Returns the value of the internal GPIB status byte register. + """ + stb = wxctb.new_intp() + wxctb.intp_assign(stb, 0) + self.device.Ioctl(wxctb.CTB_GPIB_GETRSP,stb) + return wxctb.intp_value(stb) + + # This is only for internal usage!!! + def Ibrd(self,length): + buf = "\x00"*length + state = self.device.Ibrd(buf,length) + return state,buf + + # This is only for internal usage!!! + def Ibwrt(self,string): + return self.device.Ibwrt(string,len(string)) + + def Open(self,devname,adr,eosChar=10,eosMode=0x08|0x04): + """ + Open(gpibdevice,address,eosChar,eosMode) + Opens a connected device at the GPIB bus. gpibdevice means the + controller, (mostly \"gpib1\"), address the address of the desired + device in the range 1...31. The eosChar defines the EOS character + (default is linefeed), eosMode may be a combination of bits ORed + together. The following bits can be used: + 0x04: Terminate read when EOS is detected. + 0x08: Set EOI (End or identify line) with EOS on write function + 0x10: Compare all 8 bits of EOS byte rather than low 7 bits + (all read and write functions). Default is 0x12 + For example: + dev = GPIB() + dev.Open(\"gpib1\",17) + Opens the device with the address 17, linefeed as EOS (default) + and eos mode with 0x04 and 0x08. + Open returns >= 0 or a negativ value, if something going wrong. + """ + self.device = wxctb.GpibDevice() + dcs = wxctb.Gpib_DCS() + dcs.m_address1 = adr + dcs.m_eosChar = eosChar + dcs.m_eosMode = eosMode + result = self.device.Open(devname,dcs) + return result + + def Reset(self): + """ + Resets the connected device. In the GPIB definition, the device + should be reset to it's initial state, so you can restart a + formely lost communication. + """ + self.device.Ioctl(wxctb.CTB_RESET,None) + + def ResetBus(self): + """ + The command asserts the GPIB interface clear (IFC) line for + ast least 100us if the GPIB board is the system controller. + This initializes the GPIB and makes the interface CIC and + active controller with ATN asserted. + Note! The IFC signal resets only the GPIB interface functions + of the bus devices and not the internal device functions. + For a device reset you should use the Reset() command above. + """ + self.device.Ioctl(wxctb.CTB_GPIB_RESET_BUS,None) + + def SetEosChar(self,eos): + """ + Configure the end-of-string (EOS) termination character. + Note! Defining an EOS byte does not cause the driver to + automatically send that byte at the end of write I/O + operations. The application is responsible for placing the + EOS byte at the end of the data strings that it defines. + (National Instruments NI-488.2M Function Reference Manual) + For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosChar(0x10) + """ + intp = wxctb.new_intp() + wxctb.intp_assign(intp, eos) + return self.device.Ioctl(wxctb.CTB_GPIB_SET_EOS_CHAR,intp) + + def SetEosMode(self,mode): + """ + Set the EOS mode (handling).m_eosMode may be a combination + of bits ORed together. The following bits can be used: + 0x04: Terminate read when EOS is detected. + 0x08: Set EOI (End or identify line) with EOS on write function + 0x10: Compare all 8 bits of EOS byte rather than low 7 bits + (all read and write functions). For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosMode(0x04 | 0x08) + """ + intp = wxctb.new_intp() + wxctb.intp_assign(intp, mode) + return self.device.Ioctl(wxctb.CTB_GPIB_SET_EOS_MODE,intp) + +def GetKey(): + """ + Returns the current pressed key or '\0', if no key is pressed. + You can simply create a query loop with: + while GetKey() == '\0': + ... make some stuff ... + + """ + return wxctb.GetKey() + +def GetVersion(): + """ + Returns the version of the ctb python module. The numbering + has the following format: x.y.z + x.y means the version of the underlaying ctb lib, z the version + of the python port. + """ + return "0.16" diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/module/linux/wxctb.py b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/module/linux/wxctb.py new file mode 100644 index 0000000000..f9e0d2ee6e --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/module/linux/wxctb.py @@ -0,0 +1,264 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 1.3.40 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + +from sys import version_info +if version_info >= (2,6,0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_wxctb', [dirname(__file__)]) + except ImportError: + import _wxctb + return _wxctb + if fp is not None: + try: + _mod = imp.load_module('_wxctb', fp, pathname, description) + finally: + fp.close() + return _mod + _wxctb = swig_import_helper() + del swig_import_helper +else: + import _wxctb +del version_info +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. +def _swig_setattr_nondynamic(self,class_type,name,value,static=1): + if (name == "thisown"): return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name,None) + if method: return method(self,value) + if (not static) or hasattr(self,name): + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + +def _swig_setattr(self,class_type,name,value): + return _swig_setattr_nondynamic(self,class_type,name,value,0) + +def _swig_getattr(self,class_type,name): + if (name == "thisown"): return self.this.own() + method = class_type.__swig_getmethods__.get(name,None) + if method: return method(self) + raise AttributeError(name) + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except AttributeError: + class _object : pass + _newclass = 0 + + +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + + + +def new_intp(): + return _wxctb.new_intp() +new_intp = _wxctb.new_intp + +def copy_intp(*args, **kwargs): + return _wxctb.copy_intp(*args, **kwargs) +copy_intp = _wxctb.copy_intp + +def delete_intp(*args, **kwargs): + return _wxctb.delete_intp(*args, **kwargs) +delete_intp = _wxctb.delete_intp + +def intp_assign(*args, **kwargs): + return _wxctb.intp_assign(*args, **kwargs) +intp_assign = _wxctb.intp_assign + +def intp_value(*args, **kwargs): + return _wxctb.intp_value(*args, **kwargs) +intp_value = _wxctb.intp_value +class timer_control(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") + __repr__ = _swig_repr + usecs = _swig_property(_wxctb.timer_control_usecs_get, _wxctb.timer_control_usecs_set) + exitflag = _swig_property(_wxctb.timer_control_exitflag_get, _wxctb.timer_control_exitflag_set) + exitfnc = _swig_property(_wxctb.timer_control_exitfnc_get, _wxctb.timer_control_exitfnc_set) +timer_control_swigregister = _wxctb.timer_control_swigregister +timer_control_swigregister(timer_control) + +class Timer(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + this = _wxctb.new_Timer(*args, **kwargs) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_Timer + __del__ = lambda self : None; + def start(self): return _wxctb.Timer_start(self) + def stop(self): return _wxctb.Timer_stop(self) +Timer_swigregister = _wxctb.Timer_swigregister +Timer_swigregister(Timer) + + +def sleepms(*args, **kwargs): + return _wxctb.sleepms(*args, **kwargs) +sleepms = _wxctb.sleepms +CTB_RESET = _wxctb.CTB_RESET +class IOBase(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + __swig_destroy__ = _wxctb.delete_IOBase + __del__ = lambda self : None; + def ClassName(self): return _wxctb.IOBase_ClassName(self) + def Close(self): return _wxctb.IOBase_Close(self) + def Ioctl(self, *args, **kwargs): return _wxctb.IOBase_Ioctl(self, *args, **kwargs) + def IsOpen(self): return _wxctb.IOBase_IsOpen(self) + def Open(self, *args, **kwargs): return _wxctb.IOBase_Open(self, *args, **kwargs) + def PutBack(self, *args, **kwargs): return _wxctb.IOBase_PutBack(self, *args, **kwargs) + def Read(self, *args, **kwargs): return _wxctb.IOBase_Read(self, *args, **kwargs) + def ReadUntilEOS(self, *args, **kwargs): return _wxctb.IOBase_ReadUntilEOS(self, *args, **kwargs) + def Readv(self, *args, **kwargs): return _wxctb.IOBase_Readv(self, *args, **kwargs) + def Write(self, *args, **kwargs): return _wxctb.IOBase_Write(self, *args, **kwargs) + def Writev(self, *args, **kwargs): return _wxctb.IOBase_Writev(self, *args, **kwargs) +IOBase_swigregister = _wxctb.IOBase_swigregister +IOBase_swigregister(IOBase) + +ParityNone = _wxctb.ParityNone +ParityOdd = _wxctb.ParityOdd +ParityEven = _wxctb.ParityEven +ParityMark = _wxctb.ParityMark +ParitySpace = _wxctb.ParitySpace +LinestateDcd = _wxctb.LinestateDcd +LinestateCts = _wxctb.LinestateCts +LinestateDsr = _wxctb.LinestateDsr +LinestateDtr = _wxctb.LinestateDtr +LinestateRing = _wxctb.LinestateRing +LinestateRts = _wxctb.LinestateRts +LinestateNull = _wxctb.LinestateNull +class SerialPort_DCS(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + baud = _swig_property(_wxctb.SerialPort_DCS_baud_get, _wxctb.SerialPort_DCS_baud_set) + parity = _swig_property(_wxctb.SerialPort_DCS_parity_get, _wxctb.SerialPort_DCS_parity_set) + wordlen = _swig_property(_wxctb.SerialPort_DCS_wordlen_get, _wxctb.SerialPort_DCS_wordlen_set) + stopbits = _swig_property(_wxctb.SerialPort_DCS_stopbits_get, _wxctb.SerialPort_DCS_stopbits_set) + rtscts = _swig_property(_wxctb.SerialPort_DCS_rtscts_get, _wxctb.SerialPort_DCS_rtscts_set) + xonxoff = _swig_property(_wxctb.SerialPort_DCS_xonxoff_get, _wxctb.SerialPort_DCS_xonxoff_set) + buf = _swig_property(_wxctb.SerialPort_DCS_buf_get, _wxctb.SerialPort_DCS_buf_set) + def __init__(self): + this = _wxctb.new_SerialPort_DCS() + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_SerialPort_DCS + __del__ = lambda self : None; + def GetSettings(self): return _wxctb.SerialPort_DCS_GetSettings(self) +SerialPort_DCS_swigregister = _wxctb.SerialPort_DCS_swigregister +SerialPort_DCS_swigregister(SerialPort_DCS) + +class SerialPort_EINFO(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + brk = _swig_property(_wxctb.SerialPort_EINFO_brk_get, _wxctb.SerialPort_EINFO_brk_set) + frame = _swig_property(_wxctb.SerialPort_EINFO_frame_get, _wxctb.SerialPort_EINFO_frame_set) + overrun = _swig_property(_wxctb.SerialPort_EINFO_overrun_get, _wxctb.SerialPort_EINFO_overrun_set) + parity = _swig_property(_wxctb.SerialPort_EINFO_parity_get, _wxctb.SerialPort_EINFO_parity_set) + def __init__(self): + this = _wxctb.new_SerialPort_EINFO() + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_SerialPort_EINFO + __del__ = lambda self : None; +SerialPort_EINFO_swigregister = _wxctb.SerialPort_EINFO_swigregister +SerialPort_EINFO_swigregister(SerialPort_EINFO) + +CTB_SER_GETEINFO = _wxctb.CTB_SER_GETEINFO +CTB_SER_GETBRK = _wxctb.CTB_SER_GETBRK +CTB_SER_GETFRM = _wxctb.CTB_SER_GETFRM +CTB_SER_GETOVR = _wxctb.CTB_SER_GETOVR +CTB_SER_GETPAR = _wxctb.CTB_SER_GETPAR +CTB_SER_GETINQUE = _wxctb.CTB_SER_GETINQUE +CTB_SER_SETPAR = _wxctb.CTB_SER_SETPAR +class SerialPort_x(IOBase): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + __swig_destroy__ = _wxctb.delete_SerialPort_x + __del__ = lambda self : None; + def ClassName(self): return _wxctb.SerialPort_x_ClassName(self) + def ChangeLineState(self, *args, **kwargs): return _wxctb.SerialPort_x_ChangeLineState(self, *args, **kwargs) + def ClrLineState(self, *args, **kwargs): return _wxctb.SerialPort_x_ClrLineState(self, *args, **kwargs) + def GetLineState(self): return _wxctb.SerialPort_x_GetLineState(self) + def GetSettingsAsString(self): return _wxctb.SerialPort_x_GetSettingsAsString(self) + def Ioctl(self, *args, **kwargs): return _wxctb.SerialPort_x_Ioctl(self, *args, **kwargs) + def SendBreak(self, *args, **kwargs): return _wxctb.SerialPort_x_SendBreak(self, *args, **kwargs) + def SetBaudrate(self, *args, **kwargs): return _wxctb.SerialPort_x_SetBaudrate(self, *args, **kwargs) + def SetLineState(self, *args, **kwargs): return _wxctb.SerialPort_x_SetLineState(self, *args, **kwargs) + def SetParityBit(self, *args, **kwargs): return _wxctb.SerialPort_x_SetParityBit(self, *args, **kwargs) + IsStandardRate = staticmethod(_wxctb.SerialPort_x_IsStandardRate) +SerialPort_x_swigregister = _wxctb.SerialPort_x_swigregister +SerialPort_x_swigregister(SerialPort_x) + +def SerialPort_x_IsStandardRate(*args, **kwargs): + return _wxctb.SerialPort_x_IsStandardRate(*args, **kwargs) +SerialPort_x_IsStandardRate = _wxctb.SerialPort_x_IsStandardRate + +COM1 = "/dev/ttyS0" +COM2 = "/dev/ttyS1" +COM3 = "/dev/ttyS2" +COM4 = "/dev/ttyS3" +COM5 = "/dev/ttyS4" +COM6 = "/dev/ttyS5" +COM7 = "/dev/ttyS6" +COM8 = "/dev/ttyS7" +COM9 = "/dev/ttyS8" + +class SerialPort(SerialPort_x): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self): + this = _wxctb.new_SerialPort() + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_SerialPort + __del__ = lambda self : None; + def ChangeLineState(self, *args, **kwargs): return _wxctb.SerialPort_ChangeLineState(self, *args, **kwargs) + def ClrLineState(self, *args, **kwargs): return _wxctb.SerialPort_ClrLineState(self, *args, **kwargs) + def GetLineState(self): return _wxctb.SerialPort_GetLineState(self) + def Ioctl(self, *args, **kwargs): return _wxctb.SerialPort_Ioctl(self, *args, **kwargs) + def IsOpen(self): return _wxctb.SerialPort_IsOpen(self) + def Read(self, *args, **kwargs): return _wxctb.SerialPort_Read(self, *args, **kwargs) + def SendBreak(self, *args, **kwargs): return _wxctb.SerialPort_SendBreak(self, *args, **kwargs) + def SetBaudrate(self, *args, **kwargs): return _wxctb.SerialPort_SetBaudrate(self, *args, **kwargs) + def SetLineState(self, *args, **kwargs): return _wxctb.SerialPort_SetLineState(self, *args, **kwargs) + def SetParityBit(self, *args, **kwargs): return _wxctb.SerialPort_SetParityBit(self, *args, **kwargs) + def Write(self, *args, **kwargs): return _wxctb.SerialPort_Write(self, *args, **kwargs) +SerialPort_swigregister = _wxctb.SerialPort_swigregister +SerialPort_swigregister(SerialPort) + + +def GetKey(): + return _wxctb.GetKey() +GetKey = _wxctb.GetKey + + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/parity.py b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/parity.py new file mode 100755 index 0000000000..910361b8e0 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/parity.py @@ -0,0 +1,70 @@ +#!/usr/bin/python + +import getopt, time, sys + +sys.path.insert( 0, r'/home/jb/project/libctb-0.16/python/module/linux') + +import ctb + +def main(): + + baudrate = 19200 + + devname = "" + + protocol = '8N1' + + try: + opt,arg = getopt.getopt(sys.argv[1:], + 'b:d:p:', + ['baudrate=', + 'device=', + 'protocol=' + ]) + + except getopt.GetoptError: + print "usage: parity.py [options]\n"\ + "\t-b baudrate\n"\ + "\t--baudrate=baudrate"\ + "\t-d device\n"\ + "\t--device=serial device name like /dev/ttyS0 or COM1\n"\ + "\t-h\n"\ + "\t--help print this\n"\ + "\n" + sys.exit(0) + + for o,a in opt: + + if o in ("-b","--baudrate"): + + baudrate = int(a) + + if o in ("-d","--device"): + + devname = a + + if o in ("-p","--protocol"): + + protocol = a + + + print "Using ctb version " + ctb.GetVersion() + + dev = ctb.SerialPort() + + if dev.Open( devname, baudrate, protocol ) < 0: + + print "Cannot open " + devname + "\n" + + # send the following string with a always set parity bit + dev.SetParityBit( 1 ) + + dev.Writev( "Hello World" ) + + # send the following string with a always cleared parity bit + dev.SetParityBit( 0 ) + + dev.Writev( "Hello World" ) + +main() + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/protocol.py b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/protocol.py new file mode 100755 index 0000000000..ff1731b895 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/protocol.py @@ -0,0 +1,88 @@ +#!/usr/bin/python + +import getopt, time, sys + +sys.path.insert( 0, r'/home/jb/project/libctb-0.16/python/module/linux') + +import ctb + +def DataBlock(): + data = '' + for c in range( 0, 256): + data += '%c' % c + + return data + +def main(): + + baudrate = 19200 + + devname = "" + + try: + opt,arg = getopt.getopt(sys.argv[1:], + 'b:d:', + ['baudrate=', + 'device=' + ]) + + except getopt.GetoptError: + print "usage: protocol.py [options]\n"\ + "\t-b baudrate\n"\ + "\t--baudrate=baudrate"\ + "\t-d device\n"\ + "\t--device=serial device name like /dev/ttyS0 or COM1\n"\ + "\t-h\n"\ + "\t--help print this\n"\ + "\n" + sys.exit(0) + + for o,a in opt: + + if o in ("-b","--baudrate"): + + baudrate = int(a) + + if o in ("-d","--device"): + + devname = a + + print "Using ctb version " + ctb.GetVersion() + + dev = ctb.SerialPort() + + protocols = [ + '8N1','8O1','8E1','8S1','8M1' + ] + + dev.SetTimeout( 1000 ) + + for protocol in protocols: + + if dev.Open( devname, baudrate, protocol ) < 0: + + print "Cannot open " + devname + "\n" + + sys.exit( 1 ) + + else: + + print( "%i %s" % ( baudrate, protocol ) ) + + for i in range(0, 4 ): + + dev.Writev( "\x33" ) + + time.sleep( 0.0006 ) + + dev.Writev( "\x31" ) + + time.sleep( 0.0006 ) + + time.sleep( 0.5 ) + + dev.Close() + + +main() + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/rtsdtr.py b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/rtsdtr.py new file mode 100755 index 0000000000..e67a9ffd3b --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/samples/rtsdtr.py @@ -0,0 +1,53 @@ +#!/usr/bin/python + +import getopt, time, sys + +sys.path.insert( 0, r'/home/jb/project/libctb-0.16/python/module/linux') + +import ctb + +def main(): + + devname = "" + + try: + opt,arg = getopt.getopt(sys.argv[1:], + 'd:', + ['device=' + ]) + + except getopt.GetoptError: + print "usage: parity.py [options]\n"\ + "\t-d device\n"\ + "\t--device=serial device name like /dev/ttyS0 or COM1\n"\ + "\t-h\n"\ + "\t--help print this\n"\ + "\n" + sys.exit(0) + + for o,a in opt: + + if o in ("-d","--device"): + + devname = a + + print "Using ctb version " + ctb.GetVersion() + + dev = ctb.SerialPort() + + if dev.Open( devname, 38400 ) < 0: + + print "Cannot open " + devname + "\n" + + dev.SetLineState( ctb.DTR ) + + dev.ClrLineState( ctb.RTS ) + + for i in range( 0, 100 ) : + + time.sleep( 0.01 ) + + dev.ChangeLineState( ctb.DTR | ctb.RTS ) + +main() + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/ctb.html b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/ctb.html new file mode 100644 index 0000000000..7a5732fa9b --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/ctb.html @@ -0,0 +1,353 @@ + + +Python: module ctb + + + + +
 
+ 
ctb
index
/mnt/s/wxaddons/wxctb-0.9/SWIG/ctb.py
+

+

+ + + + + +
 
+Modules
       
re
+
sys
+
wxctb
+

+ + + + + +
 
+Classes
       
+
wxIOBase +
+
+
wxGPIB +
wxSerialPort +
+
+
+

+ + + + + + + +
 
+class wxGPIB(wxIOBase)
   wxGPIB class
 
 Methods defined here:
+
GetError(self)
+ +
GetSTB(self)
Returns the value of the internal GPIB status byte register.
+ +
Ibrd(self, length)
# This is only for internal usage!!!
+ +
Ibwrt(self, string)
# This is only for internal usage!!!
+ +
Open(self, devname, adr)
Open(gpibdevice,address)
+Opens a connected device at the GPIB bus. gpibdevice means the
+controller, (mostly "gpib1"), address the address of the desired
+device in the range 1...31. For example:
+dev = wxGPIB()
+dev.Open("gpib1",17)
+Opens the device with the address 17.
+Open returns >= 0 or a negativ value, if something going wrong.
+ +
Reset(self)
Resets the connected device. In the GPIB definition, the device
+should be reset to it's initial state, so you can restart a
+formely lost communication.
+ +
ResetBus(self)
The command asserts the GPIB interface clear (IFC) line for
+ast least 100us if the GPIB board is the system controller.
+This initializes the GPIB and makes the interface CIC and
+active controller with ATN asserted.
+Note! The IFC signal resets only the GPIB interface functions
+of the bus devices and not the internal device functions.
+For a device reset you should use the Reset() command above.
+ +
__del__(self)
+ +
__init__(self)
+ +
+Methods inherited from wxIOBase:
+
Close(self)
+ +
GetTimeout(self)
Returns the internal timeout value in milliseconds
+ +
Ioctl(self, cmd, arg)
+ +
PutBack(self, char)
+ +
Read(self, length)
Try to read the given count of data (length) and returns the
+successfully readed number of data. The function never blocks.
+For example:
+readed = dev.Read(100)
+ +
ReadBinary(self, eos='\n')
Special SCPI command. Read the next data coded as a SCPI
+binary format.
+A binary data transfer will be startet by '#'. The next byte
+tells the count of bytes for the binary length header,
+following by the length bytes. After these the data begins.
+For example:
+#500004xxxx
+The header length covers 5 Byte, the length of the binary
+data is 4 (x means the binary data bytes)
+ +
ReadUntilEOS(self, eos='\n', quota=0)
ReadUntilEOS(eosString="\n",timeout=1000)
+Reads data until the given eos string was received (default is
+the linefeed character (0x0a) or the internal timeout
+(default 1000ms) was reached.
+ReadUntilEOS returns the result as the following tuple:
+['received string',state,readedBytes]
+If a timeout occurred, state is 0, otherwise 1
+ +
Readv(self, length)
Try to read the given count of data. Readv blocks until all data
+was readed successfully or the internal timeout, set with the
+class member function SetTimeout(timeout), was reached.
+Returns the readed data.
+ +
SetTimeout(self, timeout)
Set the internal timeout value in milliseconds for all blocked
+operations like ReadUntilEOS, Readv and Writev.
+ +
Write(self, string)
Writes the given string to the device and returns immediately.
+Write returns the number of data bytes successfully written or a
+negativ number if an error occured. For some circumstances, not
+the complete string was written.
+So you have to verify the return value to check this out.
+ +
Writev(self, string)
Writes the given string to the device. The function blocks until
+the complete string was written or the internal timeout, set with
+SetTimeout(timeout), was reached.
+Writev returns the number of data successfully written or a
+negativ value, if an errors occurred.
+ +

+ + + + + +
 
+class wxIOBase
    Methods defined here:
+
Close(self)
+ +
GetTimeout(self)
Returns the internal timeout value in milliseconds
+ +
Ioctl(self, cmd, arg)
+ +
Open(self)
+ +
PutBack(self, char)
+ +
Read(self, length)
Try to read the given count of data (length) and returns the
+successfully readed number of data. The function never blocks.
+For example:
+readed = dev.Read(100)
+ +
ReadBinary(self, eos='\n')
Special SCPI command. Read the next data coded as a SCPI
+binary format.
+A binary data transfer will be startet by '#'. The next byte
+tells the count of bytes for the binary length header,
+following by the length bytes. After these the data begins.
+For example:
+#500004xxxx
+The header length covers 5 Byte, the length of the binary
+data is 4 (x means the binary data bytes)
+ +
ReadUntilEOS(self, eos='\n', quota=0)
ReadUntilEOS(eosString="\n",timeout=1000)
+Reads data until the given eos string was received (default is
+the linefeed character (0x0a) or the internal timeout
+(default 1000ms) was reached.
+ReadUntilEOS returns the result as the following tuple:
+['received string',state,readedBytes]
+If a timeout occurred, state is 0, otherwise 1
+ +
Readv(self, length)
Try to read the given count of data. Readv blocks until all data
+was readed successfully or the internal timeout, set with the
+class member function SetTimeout(timeout), was reached.
+Returns the readed data.
+ +
ResetBus(self)
If the underlaying interface needs some special reset operations
+(for instance the GPIB distinguish between a normal device reset
+and a special bus reset), you can put some code here)
+ +
SetTimeout(self, timeout)
Set the internal timeout value in milliseconds for all blocked
+operations like ReadUntilEOS, Readv and Writev.
+ +
Write(self, string)
Writes the given string to the device and returns immediately.
+Write returns the number of data bytes successfully written or a
+negativ number if an error occured. For some circumstances, not
+the complete string was written.
+So you have to verify the return value to check this out.
+ +
Writev(self, string)
Writes the given string to the device. The function blocks until
+the complete string was written or the internal timeout, set with
+SetTimeout(timeout), was reached.
+Writev returns the number of data successfully written or a
+negativ value, if an errors occurred.
+ +
__del__(self)
+ +
__init__(self)
+ +

+ + + + + +
 
+class wxSerialPort(wxIOBase)
    Methods defined here:
+
ChangeLineState(self, lineState)
Change (toggle) the state of each the lines given in the
+linestate parameter. Possible values are wxSERIAL_LINESTATE_DTR
+(means the DTR signal) and/or wxSERIAL_LINESTATE_RTS (RTS signal).
+For example to toggle the RTS line only:
+dev.ChangeLineState(wxSERIAL_LINESTATE_RTS)
+ +
ClrLineState(self, lineState)
Clear the lines given in the linestate parameter. Possible
+values are wxSERIAL_LINESTATE_DTR (means the DTR signal) and/or
+wxSERIAL_LINESTATE_RTS (RTS signal). For example to clear only
+the RTS line:
+dev.ClrLineState(wxSERIAL_LINESTATE_RTS)
+ +
GetAvailableBytes(self)
Returns the available bytes in the input queue of the serial
+driver.
+ +
GetCommErrors(self)
Get the internal communication errors like breaks, framing,
+parity or overrun errors.
+Returns the count of each error as a tuple like this:
+(b,f,o,p) = dev.GetCommErrors()
+b: breaks, f: framing errors,  o: overruns, p: parity errors
+ +
GetLineState(self)
Returns the current linestates of the CTS, DCD, DSR and RING
+signal line as an integer value with the appropriate bits or
+-1 on error.
+For example:
+lines = dev.GetLineState()
+if lines & wxSERIAL_LINESTATE_CTS:
+    print "CTS is on"
+ +
Open(self, devname, baudrate, protocol='8N1', handshake='no_handshake')
Open the device devname with the given baudrate, the protocol
+like '8N1' (default) and the use of the handshake [no_handshake
+(default), rtscts or xonxoff]
+For example:
+At Linux:
+dev = wxSerialPort()
+dev.Open("/dev/ttyS0",115200)
+or with a datalen of 7 bits, even parity, 2 stopbits and rts/cts
+handshake:
+dev.Open("/dev/ttyS0",115200,'7E2',True)
+At Windows:
+dev = wxSerialPort()
+dev.Open("COM1",115200)
+dev.Open("COM1",115200,'7E2',True)
+Returns the handle on success or a negativ value on failure.
+ +
Reset(self)
Send a break for 0.25s.
+ +
SetBaudRate(self, baudrate)
Set the baudrate for the device.
+ +
SetLineState(self, lineState)
Set the lines given in the linestate parameter. Possible
+values are wxSERIAL_LINESTATE_DTR (means the DTR signal) and/or
+wxSERIAL_LINESTATE_RTS (RTS signal). For example to set both:
+dev.SetLineState(wxSERIAL_LINESTATE_DTR | wxSERIAL_LINESTATE_RTS)
+ +
__del__(self)
+ +
__init__(self)
+ +
+Methods inherited from wxIOBase:
+
Close(self)
+ +
GetTimeout(self)
Returns the internal timeout value in milliseconds
+ +
Ioctl(self, cmd, arg)
+ +
PutBack(self, char)
+ +
Read(self, length)
Try to read the given count of data (length) and returns the
+successfully readed number of data. The function never blocks.
+For example:
+readed = dev.Read(100)
+ +
ReadBinary(self, eos='\n')
Special SCPI command. Read the next data coded as a SCPI
+binary format.
+A binary data transfer will be startet by '#'. The next byte
+tells the count of bytes for the binary length header,
+following by the length bytes. After these the data begins.
+For example:
+#500004xxxx
+The header length covers 5 Byte, the length of the binary
+data is 4 (x means the binary data bytes)
+ +
ReadUntilEOS(self, eos='\n', quota=0)
ReadUntilEOS(eosString="\n",timeout=1000)
+Reads data until the given eos string was received (default is
+the linefeed character (0x0a) or the internal timeout
+(default 1000ms) was reached.
+ReadUntilEOS returns the result as the following tuple:
+['received string',state,readedBytes]
+If a timeout occurred, state is 0, otherwise 1
+ +
Readv(self, length)
Try to read the given count of data. Readv blocks until all data
+was readed successfully or the internal timeout, set with the
+class member function SetTimeout(timeout), was reached.
+Returns the readed data.
+ +
ResetBus(self)
If the underlaying interface needs some special reset operations
+(for instance the GPIB distinguish between a normal device reset
+and a special bus reset), you can put some code here)
+ +
SetTimeout(self, timeout)
Set the internal timeout value in milliseconds for all blocked
+operations like ReadUntilEOS, Readv and Writev.
+ +
Write(self, string)
Writes the given string to the device and returns immediately.
+Write returns the number of data bytes successfully written or a
+negativ number if an error occured. For some circumstances, not
+the complete string was written.
+So you have to verify the return value to check this out.
+ +
Writev(self, string)
Writes the given string to the device. The function blocks until
+the complete string was written or the internal timeout, set with
+SetTimeout(timeout), was reached.
+Writev returns the number of data successfully written or a
+negativ value, if an errors occurred.
+ +

+ + + + + +
 
+Functions
       
GetKey()
Returns the current pressed key or '', if no key is pressed.
+You can simply create a query loop with:
+while GetKey() == '':
+    ... make some stuff ...
+
abstract()
+

+ + + + + +
 
+Data
       wxSERIAL_LINESTATE_CTS = 32
+wxSERIAL_LINESTATE_DCD = 64
+wxSERIAL_LINESTATE_DSR = 256
+wxSERIAL_LINESTATE_DTR = 2
+wxSERIAL_LINESTATE_NULL = 0
+wxSERIAL_LINESTATE_RING = 128
+wxSERIAL_LINESTATE_RTS = 4
+ \ No newline at end of file diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/ctb.py b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/ctb.py new file mode 100644 index 0000000000..6b541ffe39 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/ctb.py @@ -0,0 +1,455 @@ +import wxctb, sys, re + +DCD = wxctb.LinestateDcd +CTS = wxctb.LinestateCts +DSR = wxctb.LinestateDsr +DTR = wxctb.LinestateDtr +RING = wxctb.LinestateRing +RTS = wxctb.LinestateRts +NULL = wxctb.LinestateNull + +def abstract(): + import inspect + caller = inspect.getouterframes(inspect.currentframe())[1][3] + raise NotImplementedError(caller + ' must be implemented in subclass') + +class IOBase: + def __init__(self): + self.device = None + # set timeout to 1000ms (the default) + self.timeout = 1000 + + def __del__(self): + pass + + def Close(self): + if self.device: + self.device.Close() + + def GetTimeout(self): + """ + Returns the internal timeout value in milliseconds + """ + return self.timeout + + def Ioctl(self,cmd,arg): + if self.device: + self.device.Ioctl(cmd,arg) + + def Open(self): + abstract() + + def PutBack(self,char): + return self.device.PutBack(char) + + def Read(self,length): + """ + Try to read the given count of data (length) and returns the + successfully readed number of data. The function never blocks. + For example: + readed = dev.Read(100) + """ + buf = "\x00"*(length+1) + rd = self.device.Read(buf,length) + return buf[0:rd] + + def ReadBinary(self,eos="\n"): + """ + Special SCPI command. Read the next data coded as a SCPI + binary format. + A binary data transfer will be startet by '#'. The next byte + tells the count of bytes for the binary length header, + following by the length bytes. After these the data begins. + For example: + #500004xxxx + The header length covers 5 Byte, the length of the binary + data is 4 (x means the binary data bytes) + """ + try: + eoslen = len(eos) + b=self.Readv(2) + if len(b) == 2: + hl = int(b[1]) + b = self.Readv(hl) + if len(b) == hl: + dl = int(b) + # don't left over the eos string or character in the + # device input buffer + data = self.Readv(dl+eoslen) + # check, if the binary data block is complete + if data[dl] == '#': + # not complete, another block is following + for c in data[dl:dl+eoslen]: + self.PutBack(c) + + data = data[:dl] + self.ReadBinary() + return data + except: + pass + return '' + + def ReadUntilEOS(self,eos="\n",quota=0): + """ + ReadUntilEOS(eosString=\"\\n\",timeout=1000) + Reads data until the given eos string was received (default is + the linefeed character (0x0a) or the internal timeout + (default 1000ms) was reached. + ReadUntilEOS returns the result as the following tuple: + ['received string',state,readedBytes] + If a timeout occurred, state is 0, otherwise 1 + """ + return self.device.ReadUntilEOS("",0,eos,self.timeout,quota) + + def Readv(self,length): + """ + Try to read the given count of data. Readv blocks until all data + was readed successfully or the internal timeout, set with the + class member function SetTimeout(timeout), was reached. + Returns the readed data. + """ + buf = "\x00"*length + rd = self.device.Readv(buf,length,self.timeout) + return buf[0:rd] + + def ResetBus(self): + """ + If the underlaying interface needs some special reset operations + (for instance the GPIB distinguish between a normal device reset + and a special bus reset), you can put some code here) + """ + pass + + def SetTimeout(self,timeout): + """ + Set the internal timeout value in milliseconds for all blocked + operations like ReadUntilEOS, Readv and Writev. + """ + self.timeout = timeout + + def Write(self,string): + """ + Writes the given string to the device and returns immediately. + Write returns the number of data bytes successfully written or a + negativ number if an error occured. For some circumstances, not + the complete string was written. + So you have to verify the return value to check this out. + """ + return self.device.Write(string,len(string)) + + def Writev(self,string): + """ + Writes the given string to the device. The function blocks until + the complete string was written or the internal timeout, set with + SetTimeout(timeout), was reached. + Writev returns the number of data successfully written or a + negativ value, if an errors occurred. + """ + return self.device.Writev(string,len(string),self.timeout) + +class SerialPort(IOBase): + def __init__(self): + IOBase.__init__(self) + + def __del__(self): + self.Close() + + def ChangeLineState(self,lineState): + """ + Change (toggle) the state of each the lines given in the + linestate parameter. Possible values are DTR and/or RTS. + For example to toggle the RTS line only: + dev.ChangeLineState(RTS) + """ + self.device.ChangeLineState(lineState) + + def ClrLineState(self,lineState): + """ + Clear the lines given in the linestate parameter. Possible + values are DTR and/or RTS. For example to clear only + the RTS line: + dev.ClrLineState(RTS) + """ + self.device.ClrLineState(lineState) + + def GetAvailableBytes(self): + """ + Returns the available bytes in the input queue of the serial + driver. + """ + n = wxctb.new_intp() + wxctb.intp_assign(n, 0) + self.device.Ioctl(wxctb.CTB_SER_GETINQUE,n) + return wxctb.intp_value(n) + + def GetCommErrors(self): + """ + Get the internal communication errors like breaks, framing, + parity or overrun errors. + Returns the count of each error as a tuple like this: + (b,f,o,p) = dev.GetCommErrors() + b: breaks, f: framing errors, o: overruns, p: parity errors + """ + einfo = wxctb.SerialPort_EINFO() + self.device.Ioctl(wxctb.CTB_SER_GETEINFO,einfo) + return einfo.brk,einfo.frame,einfo.overrun,einfo.parity + + def GetLineState(self): + """ + Returns the current linestates of the CTS, DCD, DSR and RING + signal line as an integer value with the appropriate bits or + -1 on error. + For example: + lines = dev.GetLineState() + if lines & CTS: + print \"CTS is on\" + """ + return self.device.GetLineState() + + def Open(self,devname,baudrate,protocol='8N1',handshake='no_handshake'): + """ + Open the device devname with the given baudrate, the protocol + like '8N1' (default) and the use of the handshake [no_handshake + (default), rtscts or xonxoff] + For example: + At Linux: + dev = SerialPort() + dev.Open(\"/dev/ttyS0\",115200) + or with a datalen of 7 bits, even parity, 2 stopbits and rts/cts + handshake: + dev.Open(\"/dev/ttyS0\",115200,'7E2',True) + At Windows: + dev = SerialPort() + dev.Open(\"COM1\",115200) + dev.Open(\"COM1\",115200,'7E2',True) + Returns the handle on success or a negativ value on failure. + """ + # the following parity values are valid: + # N:None, O:Odd, E:Even, M:Mark, S:Space + parity = {'N':0,'O':1,'E':2,'M':3,'S':4} + # the regular expression ensures a valid value for the datalen + # (5...8 bit) and the count of stopbits (1,2) + reg=re.compile(r"(?P[8765])"r"(?P

[NOEMS])"r"(?P[12])") + self.device = wxctb.SerialPort() + dcs = wxctb.SerialPort_DCS() + dcs.baud = baudrate + res = reg.search(protocol) + # handle the given protocol + if res: + dcs.wordlen = int(res.group('w')) + dcs.stopbits = int(res.group('s')) + dcs.parity = parity[res.group('p')] + # valid handshake are no one, rts/cts or xon/xoff + if handshake == 'rtscts': + dcs.rtscts = True + elif handshake == 'xonxoff': + dcs.xonxoff = True + + return self.device.Open(devname,dcs) + + def Reset(self): + """ + Send a break for 0.25s. + """ + self.device.SendBreak(0) + + def SetBaudrate(self,baudrate): + """ + Set the baudrate for the device. + """ + self.device.SetBaudrate(baudrate) + + def SetLineState(self,lineState): + """ + Set the lines given in the linestate parameter. Possible + values are DTR and/or RTS. For example to set both: + dev.SetLineState( DTR | RTS) + """ + self.device.SetLineState(lineState) + + def SetParityBit(self,parity): + """ + Set the parity bit explicitly to 0 or 1. Use this function, if + you would like to simulate a 9 bit wordlen at what the ninth bit + was represented by the parity bit value. For example: + dev.SetParityBit( 0 ) + dev.Write('some data sent with parity 0') + dev.SetParityBit( 1 ) + dev.Write('another sequence with parity 1') + """ + return self.device.SetParityBit( parity ) + +class GpibDevice(IOBase): + """ + GPIB class + """ + def __init__(self): + IOBase.__init__(self) + + def __del__(self): + self.Close() + + def FindListeners(self,board = 0): + """ + Returns the address of the connected devices as a list. + If no device is listening, the list is empty. If an error + occurs an IOError exception raised. For example: + g = GPIB() + listeners = g.FindListeners() + """ + listeners = wxctb.GPIB_x_FindListeners(board) + if listeners < 0: + raise IOError("GPIB board error") + result = [] + for i in range(1,31): + if listeners & (1 << i): + result.append(i) + return result + + def GetEosChar(self): + """ + Get the internal EOS termination character (see SetEosChar). + For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosChar() + """ + eos = wxctb.new_intp() + wxctb.intp_assign(eos, 0) + self.device.Ioctl(wxctb.CTB_GPIB_GET_EOS_CHAR,eos) + return wxctb.intp_value(eos) + + def GetEosMode(self): + """ + Get the internal EOS mode (see SetEosMode). + For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosMode() + """ + mode = wxctb.new_intp() + wxctb.intp_assign(mode, 0) + self.device.Ioctl(wxctb.CTB_GPIB_GET_EOS_MODE,mode) + return wxctb.intp_value(mode) + + def GetError(self): + errorString = " "*256 + self.device.GetError(errorString,256) + return errorString + + def GetSTB(self): + """ + Returns the value of the internal GPIB status byte register. + """ + stb = wxctb.new_intp() + wxctb.intp_assign(stb, 0) + self.device.Ioctl(wxctb.CTB_GPIB_GETRSP,stb) + return wxctb.intp_value(stb) + + # This is only for internal usage!!! + def Ibrd(self,length): + buf = "\x00"*length + state = self.device.Ibrd(buf,length) + return state,buf + + # This is only for internal usage!!! + def Ibwrt(self,string): + return self.device.Ibwrt(string,len(string)) + + def Open(self,devname,adr,eosChar=10,eosMode=0x08|0x04): + """ + Open(gpibdevice,address,eosChar,eosMode) + Opens a connected device at the GPIB bus. gpibdevice means the + controller, (mostly \"gpib1\"), address the address of the desired + device in the range 1...31. The eosChar defines the EOS character + (default is linefeed), eosMode may be a combination of bits ORed + together. The following bits can be used: + 0x04: Terminate read when EOS is detected. + 0x08: Set EOI (End or identify line) with EOS on write function + 0x10: Compare all 8 bits of EOS byte rather than low 7 bits + (all read and write functions). Default is 0x12 + For example: + dev = GPIB() + dev.Open(\"gpib1\",17) + Opens the device with the address 17, linefeed as EOS (default) + and eos mode with 0x04 and 0x08. + Open returns >= 0 or a negativ value, if something going wrong. + """ + self.device = wxctb.GpibDevice() + dcs = wxctb.Gpib_DCS() + dcs.m_address1 = adr + dcs.m_eosChar = eosChar + dcs.m_eosMode = eosMode + result = self.device.Open(devname,dcs) + return result + + def Reset(self): + """ + Resets the connected device. In the GPIB definition, the device + should be reset to it's initial state, so you can restart a + formely lost communication. + """ + self.device.Ioctl(wxctb.CTB_RESET,None) + + def ResetBus(self): + """ + The command asserts the GPIB interface clear (IFC) line for + ast least 100us if the GPIB board is the system controller. + This initializes the GPIB and makes the interface CIC and + active controller with ATN asserted. + Note! The IFC signal resets only the GPIB interface functions + of the bus devices and not the internal device functions. + For a device reset you should use the Reset() command above. + """ + self.device.Ioctl(wxctb.CTB_GPIB_RESET_BUS,None) + + def SetEosChar(self,eos): + """ + Configure the end-of-string (EOS) termination character. + Note! Defining an EOS byte does not cause the driver to + automatically send that byte at the end of write I/O + operations. The application is responsible for placing the + EOS byte at the end of the data strings that it defines. + (National Instruments NI-488.2M Function Reference Manual) + For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosChar(0x10) + """ + intp = wxctb.new_intp() + wxctb.intp_assign(intp, eos) + return self.device.Ioctl(wxctb.CTB_GPIB_SET_EOS_CHAR,intp) + + def SetEosMode(self,mode): + """ + Set the EOS mode (handling).m_eosMode may be a combination + of bits ORed together. The following bits can be used: + 0x04: Terminate read when EOS is detected. + 0x08: Set EOI (End or identify line) with EOS on write function + 0x10: Compare all 8 bits of EOS byte rather than low 7 bits + (all read and write functions). For example: + g = GPIB() + g.Open(\"gpib1\",1) + eos = g.GetEosMode(0x04 | 0x08) + """ + intp = wxctb.new_intp() + wxctb.intp_assign(intp, mode) + return self.device.Ioctl(wxctb.CTB_GPIB_SET_EOS_MODE,intp) + +def GetKey(): + """ + Returns the current pressed key or '\0', if no key is pressed. + You can simply create a query loop with: + while GetKey() == '\0': + ... make some stuff ... + + """ + return wxctb.GetKey() + +def GetVersion(): + """ + Returns the version of the ctb python module. The numbering + has the following format: x.y.z + x.y means the version of the underlaying ctb lib, z the version + of the python port. + """ + return "0.16" diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/gpib.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/gpib.i new file mode 100644 index 0000000000..752ecd3a18 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/gpib.i @@ -0,0 +1,96 @@ +%{ +#include "ctb-0.16/gpib.h" +%} + +%include iobase.i + +namespace ctb { + +%typemap(in) void * dcs (Gpib_DCS tmp) { + /* dont check for list */ + $1 = &tmp; +} + +enum GpibTimeout +{ + GpibTimeoutNONE = 0, + GpibTimeout10us, + GpibTimeout30us, + GpibTimeout100us, + GpibTimeout300us, + GpibTimeout1ms, + GpibTimeout3ms, + GpibTimeout10ms, + GpibTimeout30ms, + GpibTimeout100ms, + GpibTimeout300ms, + GpibTimeout1s, + GpibTimeout3s, + GpibTimeout10s, + GpibTimeout30s, + GpibTimeout100s, + GpibTimeout300s, + GpibTimeout1000s +}; + +struct Gpib_DCS +{ + int m_address1; + int m_address2; + GpibTimeout m_timeout; + bool m_eot; + unsigned char m_eosChar; + unsigned char m_eosMode; + Gpib_DCS(); + ~Gpib_DCS(); + char* GetSettings(); +}; + +enum { + CTB_GPIB_SETADR = CTB_GPIB, + CTB_GPIB_GETRSP, + CTB_GPIB_GETSTA, + CTB_GPIB_GETERR, + CTB_GPIB_GETLINES, + CTB_GPIB_SETTIMEOUT, + CTB_GPIB_GTL, + CTB_GPIB_REN, + CTB_GPIB_RESET_BUS, + CTB_GPIB_SET_EOS_CHAR, + CTB_GPIB_GET_EOS_CHAR, + CTB_GPIB_SET_EOS_MODE, + CTB_GPIB_GET_EOS_MODE +}; + +class GpibDevice : public IOBase +{ +protected: + int m_board; + int m_hd; + int m_state; + int m_error; + int m_count; + int m_asyncio; + Gpib_DCS m_dcs; + int CloseDevice(); + int OpenDevice(const char* devname, void* dcs); + virtual const char* GetErrorString(int error,bool detailed); +public: + GpibDevice(); + virtual ~GpibDevice(); + const char* ClassName(); + virtual const char* GetErrorDescription(int error); + virtual const char* GetErrorNotation(int error); + virtual char* GetSettingsAsString(); + int Ibrd(char* buf,size_t len); + int Ibwrt(char* buf,size_t len); + virtual int Ioctl(int cmd,void* args); + int IsOpen(); + int Read(char* buf,size_t len); + int Write(char* buf,size_t len); + + static int FindListeners(int board = 0); + +}; + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/iobase.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/iobase.i new file mode 100644 index 0000000000..c6bc452adb --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/iobase.i @@ -0,0 +1,59 @@ +%{ +#include "ctb-0.16/iobase.h" +%} + +namespace ctb { + +enum { + CTB_RESET = CTB_COMMON +}; + +%typemap(in) char *& readbuf (char * tmp) { + /* dont check for list */ + $1 = &tmp; +} + +%typemap(argout) char *& readbuf { + PyObject * plist = PyList_New(2); + PyList_SetItem(plist, 0, PyString_FromString(*$1)); + PyList_SetItem(plist, 1, $result); + $result = plist; + delete *$1; +} + +%typemap(in) size_t * readedBytes (size_t tmp) { + /* dont check for list */ + $1 = &tmp; +} + +%typemap(argout) size_t * readedBytes { + PyList_Append($result, PyInt_FromLong(*$1)); +} + +class IOBase +{ +protected: + virtual int CloseDevice() = 0; + virtual int OpenDevice(const char* devname, void* dcs = 0L) = 0; +public: + IOBase(); + virtual ~IOBase(); + + virtual const char* ClassName(); + int Close(); + virtual int Ioctl(int cmd,void* args); + virtual int IsOpen() = 0; + int Open(const char* devname,void* dcs=0L); + int PutBack(char ch); + virtual int Read(char* buf,size_t len) = 0; + virtual int ReadUntilEOS(char*& readbuf, + size_t* readedBytes, + char* eosString = "\n", + long timeout_in_ms = 1000L, + char quota = 0); + int Readv(char* buf,size_t len,unsigned int timeout_in_ms); + virtual int Write(char* buf,size_t len) = 0; + int Writev(char* buf,size_t len,unsigned int timeout_in_ms); +}; + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/kbhit.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/kbhit.i new file mode 100644 index 0000000000..7e5b6cddd3 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/kbhit.i @@ -0,0 +1,9 @@ +%{ +#include "ctb-0.16/kbhit.h" +%} + +namespace ctb { + +char GetKey(); + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/makepy.sh b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/makepy.sh new file mode 100755 index 0000000000..40b49dfb2e --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/makepy.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +CFLAG='' +GPIB_SOURCES='' +GPIB_LIB='' +GPIB_SUPPORT='' + +# the python develop version. Please check the right version of your +# python developent enviroment +PYTHON_VERSION='2.6' + +for arg in $*; do + if [ "$arg" = "USE_GPIB" ]; then + GPIB_SOURCES='../../../src/gpib.cpp' + GPIB_LIB='-lgpib' + GPIB_SUPPORT='Yes' + else + echo '============================================================' + echo 'You run makepy.sh without GPIB support.' + echo 'If you want to create the python wxctb library with' + echo 'GPIB support, rerun the command with:' + echo 'makepy.sh USE_GPIB=1' + echo '============================================================' + GPIB_SUPPORT='No' + fi + if [ "$arg" = "USE_DEBUG" ]; then + CFLAG='-g' + fi +done + +echo "// This file is created automatically, don't change it!" > wxctb.i +echo "%module wxctb" >> wxctb.i +echo "typedef int size_t;" >> wxctb.i +echo "%include timer.i" >> wxctb.i +echo "%include serport.i" >> wxctb.i +echo "%include ../kbhit.i" >> wxctb.i +if [ "$arg" = "USE_GPIB" ]; then + echo "%include ../gpib.i" >> wxctb.i +fi + +echo "swig generates python wrapper files..." +swig -c++ -Wall -nodefault -python -keyword -new_repr -modern wxctb.i + +echo "create shared library wxctb with GPIB=$GPIB_SUPPORT for python"\ + "$PYTHON_VERSION ..." +g++ -Wall $CFLAG -shared -I /usr/include/python$PYTHON_VERSION/ \ + -I ../../../include \ + wxctb_wrap.cxx \ + ../../../src/linux/timer.cpp \ + ../../../src/linux/serport.cpp \ + ../../../src/serportx.cpp \ + ../../../src/kbhit.cpp \ + ../../../src/iobase.cpp \ + ../../../src/fifo.cpp \ + $GPIB_SOURCES \ + $GPIB_LIB \ + -o _wxctb.so + +echo "copy ctb.py, wxctb.py and _wxctb.so to the module/linux folder..." +mkdir -p ../../module/linux +cp ../ctb.py ../../module/linux/ +cp wxctb.py ../../module/linux/ +cp _wxctb.so ../../module/linux/ diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/serport.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/serport.i new file mode 100644 index 0000000000..3150fe9117 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/serport.i @@ -0,0 +1,50 @@ +%module serport + +%{ +#include "ctb-0.16/linux/serport.h" +%} + +%include ../serportx.i + +namespace ctb { + +%pythoncode { +COM1 = "/dev/ttyS0" +COM2 = "/dev/ttyS1" +COM3 = "/dev/ttyS2" +COM4 = "/dev/ttyS3" +COM5 = "/dev/ttyS4" +COM6 = "/dev/ttyS5" +COM7 = "/dev/ttyS6" +COM8 = "/dev/ttyS7" +COM9 = "/dev/ttyS8" +}; + +class SerialPort : public SerialPort_x +{ +protected: + int fd; + struct termios t, save_t; + struct serial_icounter_struct save_info, last_info; + speed_t AdaptBaudrate(int baud); + + int CloseDevice(); + int OpenDevice(const char* devname, void* dcs); +public: + SerialPort(); + ~SerialPort(); + + int ChangeLineState(SerialLineState flags); + int ClrLineState(SerialLineState flags); + int GetLineState(); + int Ioctl(int cmd,void* args); + int IsOpen(); + int Read(char* buf,size_t len); + int SendBreak(int duration); + int SetBaudrate(int baudrate); + int SetLineState(SerialLineState flags); + int SetParityBit( bool parity ); + int Write(char* buf,size_t len); +}; + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/timer.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/timer.i new file mode 100644 index 0000000000..5709224113 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/timer.i @@ -0,0 +1,37 @@ +%{ +#include "ctb-0.16/linux/timer.h" +%} + +%include cpointer.i + +// lets create new fuctions for pointer handling in python (for int *exitflag) +%pointer_functions(int, intp); + +namespace ctb { + +// perhaps we doesn''t need timer_control to export +// but we need if we want to inherit from timer in python +struct timer_control +{ + unsigned int usecs; + int *exitflag; + void* (*exitfnc)(void*); +}; + +class Timer +{ +protected: + timer_control control; + int stopped; + pthread_t tid; + unsigned int timer_secs; +public: + Timer(unsigned int msec,int* exitflag,void*(*exitfnc)(void*)=NULL); + ~Timer(); + int start(); + int stop(); +}; + +void sleepms(unsigned int ms); + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb.i new file mode 100644 index 0000000000..7f84b5fb33 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb.i @@ -0,0 +1,6 @@ +// This file is created automatically, don't change it! +%module wxctb +typedef int size_t; +%include timer.i +%include serport.i +%include ../kbhit.i diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb.py b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb.py new file mode 100644 index 0000000000..f9e0d2ee6e --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb.py @@ -0,0 +1,264 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 1.3.40 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + +from sys import version_info +if version_info >= (2,6,0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_wxctb', [dirname(__file__)]) + except ImportError: + import _wxctb + return _wxctb + if fp is not None: + try: + _mod = imp.load_module('_wxctb', fp, pathname, description) + finally: + fp.close() + return _mod + _wxctb = swig_import_helper() + del swig_import_helper +else: + import _wxctb +del version_info +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. +def _swig_setattr_nondynamic(self,class_type,name,value,static=1): + if (name == "thisown"): return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name,None) + if method: return method(self,value) + if (not static) or hasattr(self,name): + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + +def _swig_setattr(self,class_type,name,value): + return _swig_setattr_nondynamic(self,class_type,name,value,0) + +def _swig_getattr(self,class_type,name): + if (name == "thisown"): return self.this.own() + method = class_type.__swig_getmethods__.get(name,None) + if method: return method(self) + raise AttributeError(name) + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except AttributeError: + class _object : pass + _newclass = 0 + + +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + + + +def new_intp(): + return _wxctb.new_intp() +new_intp = _wxctb.new_intp + +def copy_intp(*args, **kwargs): + return _wxctb.copy_intp(*args, **kwargs) +copy_intp = _wxctb.copy_intp + +def delete_intp(*args, **kwargs): + return _wxctb.delete_intp(*args, **kwargs) +delete_intp = _wxctb.delete_intp + +def intp_assign(*args, **kwargs): + return _wxctb.intp_assign(*args, **kwargs) +intp_assign = _wxctb.intp_assign + +def intp_value(*args, **kwargs): + return _wxctb.intp_value(*args, **kwargs) +intp_value = _wxctb.intp_value +class timer_control(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") + __repr__ = _swig_repr + usecs = _swig_property(_wxctb.timer_control_usecs_get, _wxctb.timer_control_usecs_set) + exitflag = _swig_property(_wxctb.timer_control_exitflag_get, _wxctb.timer_control_exitflag_set) + exitfnc = _swig_property(_wxctb.timer_control_exitfnc_get, _wxctb.timer_control_exitfnc_set) +timer_control_swigregister = _wxctb.timer_control_swigregister +timer_control_swigregister(timer_control) + +class Timer(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + this = _wxctb.new_Timer(*args, **kwargs) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_Timer + __del__ = lambda self : None; + def start(self): return _wxctb.Timer_start(self) + def stop(self): return _wxctb.Timer_stop(self) +Timer_swigregister = _wxctb.Timer_swigregister +Timer_swigregister(Timer) + + +def sleepms(*args, **kwargs): + return _wxctb.sleepms(*args, **kwargs) +sleepms = _wxctb.sleepms +CTB_RESET = _wxctb.CTB_RESET +class IOBase(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + __swig_destroy__ = _wxctb.delete_IOBase + __del__ = lambda self : None; + def ClassName(self): return _wxctb.IOBase_ClassName(self) + def Close(self): return _wxctb.IOBase_Close(self) + def Ioctl(self, *args, **kwargs): return _wxctb.IOBase_Ioctl(self, *args, **kwargs) + def IsOpen(self): return _wxctb.IOBase_IsOpen(self) + def Open(self, *args, **kwargs): return _wxctb.IOBase_Open(self, *args, **kwargs) + def PutBack(self, *args, **kwargs): return _wxctb.IOBase_PutBack(self, *args, **kwargs) + def Read(self, *args, **kwargs): return _wxctb.IOBase_Read(self, *args, **kwargs) + def ReadUntilEOS(self, *args, **kwargs): return _wxctb.IOBase_ReadUntilEOS(self, *args, **kwargs) + def Readv(self, *args, **kwargs): return _wxctb.IOBase_Readv(self, *args, **kwargs) + def Write(self, *args, **kwargs): return _wxctb.IOBase_Write(self, *args, **kwargs) + def Writev(self, *args, **kwargs): return _wxctb.IOBase_Writev(self, *args, **kwargs) +IOBase_swigregister = _wxctb.IOBase_swigregister +IOBase_swigregister(IOBase) + +ParityNone = _wxctb.ParityNone +ParityOdd = _wxctb.ParityOdd +ParityEven = _wxctb.ParityEven +ParityMark = _wxctb.ParityMark +ParitySpace = _wxctb.ParitySpace +LinestateDcd = _wxctb.LinestateDcd +LinestateCts = _wxctb.LinestateCts +LinestateDsr = _wxctb.LinestateDsr +LinestateDtr = _wxctb.LinestateDtr +LinestateRing = _wxctb.LinestateRing +LinestateRts = _wxctb.LinestateRts +LinestateNull = _wxctb.LinestateNull +class SerialPort_DCS(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + baud = _swig_property(_wxctb.SerialPort_DCS_baud_get, _wxctb.SerialPort_DCS_baud_set) + parity = _swig_property(_wxctb.SerialPort_DCS_parity_get, _wxctb.SerialPort_DCS_parity_set) + wordlen = _swig_property(_wxctb.SerialPort_DCS_wordlen_get, _wxctb.SerialPort_DCS_wordlen_set) + stopbits = _swig_property(_wxctb.SerialPort_DCS_stopbits_get, _wxctb.SerialPort_DCS_stopbits_set) + rtscts = _swig_property(_wxctb.SerialPort_DCS_rtscts_get, _wxctb.SerialPort_DCS_rtscts_set) + xonxoff = _swig_property(_wxctb.SerialPort_DCS_xonxoff_get, _wxctb.SerialPort_DCS_xonxoff_set) + buf = _swig_property(_wxctb.SerialPort_DCS_buf_get, _wxctb.SerialPort_DCS_buf_set) + def __init__(self): + this = _wxctb.new_SerialPort_DCS() + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_SerialPort_DCS + __del__ = lambda self : None; + def GetSettings(self): return _wxctb.SerialPort_DCS_GetSettings(self) +SerialPort_DCS_swigregister = _wxctb.SerialPort_DCS_swigregister +SerialPort_DCS_swigregister(SerialPort_DCS) + +class SerialPort_EINFO(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + brk = _swig_property(_wxctb.SerialPort_EINFO_brk_get, _wxctb.SerialPort_EINFO_brk_set) + frame = _swig_property(_wxctb.SerialPort_EINFO_frame_get, _wxctb.SerialPort_EINFO_frame_set) + overrun = _swig_property(_wxctb.SerialPort_EINFO_overrun_get, _wxctb.SerialPort_EINFO_overrun_set) + parity = _swig_property(_wxctb.SerialPort_EINFO_parity_get, _wxctb.SerialPort_EINFO_parity_set) + def __init__(self): + this = _wxctb.new_SerialPort_EINFO() + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_SerialPort_EINFO + __del__ = lambda self : None; +SerialPort_EINFO_swigregister = _wxctb.SerialPort_EINFO_swigregister +SerialPort_EINFO_swigregister(SerialPort_EINFO) + +CTB_SER_GETEINFO = _wxctb.CTB_SER_GETEINFO +CTB_SER_GETBRK = _wxctb.CTB_SER_GETBRK +CTB_SER_GETFRM = _wxctb.CTB_SER_GETFRM +CTB_SER_GETOVR = _wxctb.CTB_SER_GETOVR +CTB_SER_GETPAR = _wxctb.CTB_SER_GETPAR +CTB_SER_GETINQUE = _wxctb.CTB_SER_GETINQUE +CTB_SER_SETPAR = _wxctb.CTB_SER_SETPAR +class SerialPort_x(IOBase): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + __swig_destroy__ = _wxctb.delete_SerialPort_x + __del__ = lambda self : None; + def ClassName(self): return _wxctb.SerialPort_x_ClassName(self) + def ChangeLineState(self, *args, **kwargs): return _wxctb.SerialPort_x_ChangeLineState(self, *args, **kwargs) + def ClrLineState(self, *args, **kwargs): return _wxctb.SerialPort_x_ClrLineState(self, *args, **kwargs) + def GetLineState(self): return _wxctb.SerialPort_x_GetLineState(self) + def GetSettingsAsString(self): return _wxctb.SerialPort_x_GetSettingsAsString(self) + def Ioctl(self, *args, **kwargs): return _wxctb.SerialPort_x_Ioctl(self, *args, **kwargs) + def SendBreak(self, *args, **kwargs): return _wxctb.SerialPort_x_SendBreak(self, *args, **kwargs) + def SetBaudrate(self, *args, **kwargs): return _wxctb.SerialPort_x_SetBaudrate(self, *args, **kwargs) + def SetLineState(self, *args, **kwargs): return _wxctb.SerialPort_x_SetLineState(self, *args, **kwargs) + def SetParityBit(self, *args, **kwargs): return _wxctb.SerialPort_x_SetParityBit(self, *args, **kwargs) + IsStandardRate = staticmethod(_wxctb.SerialPort_x_IsStandardRate) +SerialPort_x_swigregister = _wxctb.SerialPort_x_swigregister +SerialPort_x_swigregister(SerialPort_x) + +def SerialPort_x_IsStandardRate(*args, **kwargs): + return _wxctb.SerialPort_x_IsStandardRate(*args, **kwargs) +SerialPort_x_IsStandardRate = _wxctb.SerialPort_x_IsStandardRate + +COM1 = "/dev/ttyS0" +COM2 = "/dev/ttyS1" +COM3 = "/dev/ttyS2" +COM4 = "/dev/ttyS3" +COM5 = "/dev/ttyS4" +COM6 = "/dev/ttyS5" +COM7 = "/dev/ttyS6" +COM8 = "/dev/ttyS7" +COM9 = "/dev/ttyS8" + +class SerialPort(SerialPort_x): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self): + this = _wxctb.new_SerialPort() + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _wxctb.delete_SerialPort + __del__ = lambda self : None; + def ChangeLineState(self, *args, **kwargs): return _wxctb.SerialPort_ChangeLineState(self, *args, **kwargs) + def ClrLineState(self, *args, **kwargs): return _wxctb.SerialPort_ClrLineState(self, *args, **kwargs) + def GetLineState(self): return _wxctb.SerialPort_GetLineState(self) + def Ioctl(self, *args, **kwargs): return _wxctb.SerialPort_Ioctl(self, *args, **kwargs) + def IsOpen(self): return _wxctb.SerialPort_IsOpen(self) + def Read(self, *args, **kwargs): return _wxctb.SerialPort_Read(self, *args, **kwargs) + def SendBreak(self, *args, **kwargs): return _wxctb.SerialPort_SendBreak(self, *args, **kwargs) + def SetBaudrate(self, *args, **kwargs): return _wxctb.SerialPort_SetBaudrate(self, *args, **kwargs) + def SetLineState(self, *args, **kwargs): return _wxctb.SerialPort_SetLineState(self, *args, **kwargs) + def SetParityBit(self, *args, **kwargs): return _wxctb.SerialPort_SetParityBit(self, *args, **kwargs) + def Write(self, *args, **kwargs): return _wxctb.SerialPort_Write(self, *args, **kwargs) +SerialPort_swigregister = _wxctb.SerialPort_swigregister +SerialPort_swigregister(SerialPort) + + +def GetKey(): + return _wxctb.GetKey() +GetKey = _wxctb.GetKey + + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb_wrap.cxx b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb_wrap.cxx new file mode 100644 index 0000000000..c72f220ded --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/linux/wxctb_wrap.cxx @@ -0,0 +1,6469 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.40 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGPYTHON +#define SWIG_PYTHON_DIRECTOR_NO_VTABLE + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); + SwigValueWrapper(const SwigValueWrapper& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +/* Python.h has to appear first */ +#include + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return and integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if () { + if () { + *ptr = ; + return SWIG_NEWOBJ; + } else { + *ptr = ; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class" == "Class", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like ||... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like ||... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCompare(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + register size_t l = 0; + register size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + register size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + register int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + register size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + register const unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + register unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register char d = *(c++); + register unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = ((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = ((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +/* Compatibility macros for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) + +#endif + +#ifndef Py_TYPE +# define Py_TYPE(op) ((op)->ob_type) +#endif + +/* SWIG APIs for compatibility of both Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + + +/* Warning: This function will allocate a new string in Python 3, + * so please call SWIG_Python_str_DelForPy3(x) to free the space. + */ +SWIGINTERN char* +SWIG_Python_str_AsChar(PyObject *str) +{ +#if PY_VERSION_HEX >= 0x03000000 + char *cstr; + char *newstr; + Py_ssize_t len; + str = PyUnicode_AsUTF8String(str); + PyBytes_AsStringAndSize(str, &cstr, &len); + newstr = (char *) malloc(len+1); + memcpy(newstr, cstr, len+1); + Py_XDECREF(str); + return newstr; +#else + return PyString_AsString(str); +#endif +} + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) +#else +# define SWIG_Python_str_DelForPy3(x) +#endif + + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} + +/* Add PyOS_snprintf for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# define PyOS_snprintf _snprintf +# else +# define PyOS_snprintf snprintf +# endif +#endif + +/* A crude PyString_FromFormat implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 + +#ifndef SWIG_PYBUFFER_SIZE +# define SWIG_PYBUFFER_SIZE 1024 +#endif + +static PyObject * +PyString_FromFormat(const char *fmt, ...) { + va_list ap; + char buf[SWIG_PYBUFFER_SIZE * 2]; + int res; + va_start(ap, fmt); + res = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); +} +#endif + +/* Add PyObject_Del for old Pythons */ +#if PY_VERSION_HEX < 0x01060000 +# define PyObject_Del(op) PyMem_DEL((op)) +#endif +#ifndef PyObject_DEL +# define PyObject_DEL PyObject_Del +#endif + +/* A crude PyExc_StopIteration exception for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# ifndef PyExc_StopIteration +# define PyExc_StopIteration PyExc_RuntimeError +# endif +# ifndef PyObject_GenericGetAttr +# define PyObject_GenericGetAttr 0 +# endif +#endif + +/* Py_NotImplemented is defined in 2.1 and up. */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef Py_NotImplemented +# define Py_NotImplemented PyExc_RuntimeError +# endif +#endif + +/* A crude PyString_AsStringAndSize implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef PyString_AsStringAndSize +# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} +# endif +#endif + +/* PySequence_Size for old Pythons */ +#if PY_VERSION_HEX < 0x02000000 +# ifndef PySequence_Size +# define PySequence_Size PySequence_Length +# endif +#endif + +/* PyBool_FromLong for old Pythons */ +#if PY_VERSION_HEX < 0x02030000 +static +PyObject *PyBool_FromLong(long ok) +{ + PyObject *result = ok ? Py_True : Py_False; + Py_INCREF(result); + return result; +} +#endif + +/* Py_ssize_t for old Pythons */ +/* This code is as recommended by: */ +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIME PyObject* +SWIG_Python_ErrorType(int code) { + PyObject* type = 0; + switch(code) { + case SWIG_MemoryError: + type = PyExc_MemoryError; + break; + case SWIG_IOError: + type = PyExc_IOError; + break; + case SWIG_RuntimeError: + type = PyExc_RuntimeError; + break; + case SWIG_IndexError: + type = PyExc_IndexError; + break; + case SWIG_TypeError: + type = PyExc_TypeError; + break; + case SWIG_DivisionByZero: + type = PyExc_ZeroDivisionError; + break; + case SWIG_OverflowError: + type = PyExc_OverflowError; + break; + case SWIG_SyntaxError: + type = PyExc_SyntaxError; + break; + case SWIG_ValueError: + type = PyExc_ValueError; + break; + case SWIG_SystemError: + type = PyExc_SystemError; + break; + case SWIG_AttributeError: + type = PyExc_AttributeError; + break; + default: + type = PyExc_RuntimeError; + } + return type; +} + + +SWIGRUNTIME void +SWIG_Python_AddErrorMsg(const char* mesg) +{ + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + + if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + PyErr_Clear(); + Py_XINCREF(type); + + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + Py_DECREF(value); + } else { + PyErr_SetString(PyExc_RuntimeError, mesg); + } +} + +#if defined(SWIG_PYTHON_NO_THREADS) +# if defined(SWIG_PYTHON_THREADS) +# undef SWIG_PYTHON_THREADS +# endif +#endif +#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ +# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) +# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ +# define SWIG_PYTHON_USE_GIL +# endif +# endif +# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ +# ifndef SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# endif +# ifdef __cplusplus /* C++ code */ + class SWIG_Python_Thread_Block { + bool status; + PyGILState_STATE state; + public: + void end() { if (status) { PyGILState_Release(state); status = false;} } + SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} + ~SWIG_Python_Thread_Block() { end(); } + }; + class SWIG_Python_Thread_Allow { + bool status; + PyThreadState *save; + public: + void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} + ~SWIG_Python_Thread_Allow() { end(); } + }; +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block +# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow +# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() +# else /* C code */ +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() +# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() +# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) +# endif +# else /* Old thread way, not implemented, user must provide it */ +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) +# define SWIG_PYTHON_THREAD_END_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# endif +# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) +# define SWIG_PYTHON_THREAD_END_ALLOW +# endif +# endif +#else /* No thread support */ +# define SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# define SWIG_PYTHON_THREAD_END_BLOCK +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# define SWIG_PYTHON_THREAD_END_ALLOW +#endif + +/* ----------------------------------------------------------------------------- + * Python API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* cc-mode */ +#endif +#endif + +/* ----------------------------------------------------------------------------- + * Constant declarations + * ----------------------------------------------------------------------------- */ + +/* Constant Types */ +#define SWIG_PY_POINTER 4 +#define SWIG_PY_BINARY 5 + +/* Constant information structure */ +typedef struct swig_const_info { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_const_info; + + +/* ----------------------------------------------------------------------------- + * Wrapper of PyInstanceMethod_New() used in Python 3 + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyInstanceMethod_New(func); +#else + return NULL; +#endif +} + +#ifdef __cplusplus +#if 0 +{ /* cc-mode */ +#endif +} +#endif + + +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * pyrun.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * ----------------------------------------------------------------------------- */ + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) +#define swig_owntype int + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) + +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + + +/* Runtime API implementation */ + +/* Error manipulation */ + +SWIGINTERN void +SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetObject(errtype, obj); + Py_DECREF(obj); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +SWIGINTERN void +SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(errtype, (char *) msg); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) + +/* Set a constant value */ + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { + PyDict_SetItemString(d, (char*) name, obj); + Py_DECREF(obj); +} + +/* Append a value to the result obj */ + +SWIGINTERN PyObject* +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { +#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyList_Check(result)) { + PyObject *o2 = result; + result = PyList_New(1); + PyList_SetItem(result, 0, o2); + } + PyList_Append(result,obj); + Py_DECREF(obj); + } + return result; +#else + PyObject* o2; + PyObject* o3; + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyTuple_Check(result)) { + o2 = result; + result = PyTuple_New(1); + PyTuple_SET_ITEM(result, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SET_ITEM(o3, 0, obj); + o2 = result; + result = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return result; +#endif +} + +/* Unpack the argument tuple */ + +SWIGINTERN int +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) +{ + if (!args) { + if (!min && !max) { + return 1; + } else { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + name, (min == max ? "" : "at least "), (int)min); + return 0; + } + } + if (!PyTuple_Check(args)) { + PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); + return 0; + } else { + register Py_ssize_t l = PyTuple_GET_SIZE(args); + if (l < min) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at least "), (int)min, (int)l); + return 0; + } else if (l > max) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at most "), (int)max, (int)l); + return 0; + } else { + register int i; + for (i = 0; i < l; ++i) { + objs[i] = PyTuple_GET_ITEM(args, i); + } + for (; l < max; ++l) { + objs[l] = 0; + } + return i + 1; + } + } +} + +/* A functor is a function object with one single object argument */ +#if PY_VERSION_HEX >= 0x02020000 +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); +#else +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); +#endif + +/* + Helper for static pointer initialization for both C and C++ code, for example + static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); +*/ +#ifdef __cplusplus +#define SWIG_STATIC_POINTER(var) var +#else +#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var +#endif + +/* ----------------------------------------------------------------------------- + * Pointer declarations + * ----------------------------------------------------------------------------- */ + +/* Flags for new pointer objects */ +#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) +#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) + +#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* cc-mode */ +#endif +#endif + +/* How to access Py_None */ +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# ifndef SWIG_PYTHON_NO_BUILD_NONE +# ifndef SWIG_PYTHON_BUILD_NONE +# define SWIG_PYTHON_BUILD_NONE +# endif +# endif +#endif + +#ifdef SWIG_PYTHON_BUILD_NONE +# ifdef Py_None +# undef Py_None +# define Py_None SWIG_Py_None() +# endif +SWIGRUNTIMEINLINE PyObject * +_SWIG_Py_None(void) +{ + PyObject *none = Py_BuildValue((char*)""); + Py_DECREF(none); + return none; +} +SWIGRUNTIME PyObject * +SWIG_Py_None(void) +{ + static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); + return none; +} +#endif + +/* The python void return value */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Py_Void(void) +{ + PyObject *none = Py_None; + Py_INCREF(none); + return none; +} + +/* SwigPyClientData */ + +typedef struct { + PyObject *klass; + PyObject *newraw; + PyObject *newargs; + PyObject *destroy; + int delargs; + int implicitconv; +} SwigPyClientData; + +SWIGRUNTIMEINLINE int +SWIG_Python_CheckImplicit(swig_type_info *ty) +{ + SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; + return data ? data->implicitconv : 0; +} + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + + +SWIGRUNTIME SwigPyClientData * +SwigPyClientData_New(PyObject* obj) +{ + if (!obj) { + return 0; + } else { + SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); + /* the klass element */ + data->klass = obj; + Py_INCREF(data->klass); + /* the newraw method and newargs arguments used to create a new raw instance */ + if (PyClass_Check(obj)) { + data->newraw = 0; + data->newargs = obj; + Py_INCREF(obj); + } else { +#if (PY_VERSION_HEX < 0x02020000) + data->newraw = 0; +#else + data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); +#endif + if (data->newraw) { + Py_INCREF(data->newraw); + data->newargs = PyTuple_New(1); + PyTuple_SetItem(data->newargs, 0, obj); + } else { + data->newargs = obj; + } + Py_INCREF(data->newargs); + } + /* the destroy method, aka as the C++ delete method */ + data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); + if (PyErr_Occurred()) { + PyErr_Clear(); + data->destroy = 0; + } + if (data->destroy) { + int flags; + Py_INCREF(data->destroy); + flags = PyCFunction_GET_FLAGS(data->destroy); +#ifdef METH_O + data->delargs = !(flags & (METH_O)); +#else + data->delargs = 0; +#endif + } else { + data->delargs = 0; + } + data->implicitconv = 0; + return data; + } +} + +SWIGRUNTIME void +SwigPyClientData_Del(SwigPyClientData* data) +{ + Py_XDECREF(data->newraw); + Py_XDECREF(data->newargs); + Py_XDECREF(data->destroy); +} + +/* =============== SwigPyObject =====================*/ + +typedef struct { + PyObject_HEAD + void *ptr; + swig_type_info *ty; + int own; + PyObject *next; +} SwigPyObject; + +SWIGRUNTIME PyObject * +SwigPyObject_long(SwigPyObject *v) +{ + return PyLong_FromVoidPtr(v->ptr); +} + +SWIGRUNTIME PyObject * +SwigPyObject_format(const char* fmt, SwigPyObject *v) +{ + PyObject *res = NULL; + PyObject *args = PyTuple_New(1); + if (args) { + if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { + PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + if (ofmt) { +#if PY_VERSION_HEX >= 0x03000000 + res = PyUnicode_Format(ofmt,args); +#else + res = PyString_Format(ofmt,args); +#endif + Py_DECREF(ofmt); + } + Py_DECREF(args); + } + } + return res; +} + +SWIGRUNTIME PyObject * +SwigPyObject_oct(SwigPyObject *v) +{ + return SwigPyObject_format("%o",v); +} + +SWIGRUNTIME PyObject * +SwigPyObject_hex(SwigPyObject *v) +{ + return SwigPyObject_format("%x",v); +} + +SWIGRUNTIME PyObject * +#ifdef METH_NOARGS +SwigPyObject_repr(SwigPyObject *v) +#else +SwigPyObject_repr(SwigPyObject *v, PyObject *args) +#endif +{ + const char *name = SWIG_TypePrettyName(v->ty); + PyObject *repr = SWIG_Python_str_FromFormat("", name, v); + if (v->next) { +#ifdef METH_NOARGS + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); +#else + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); +#endif +#if PY_VERSION_HEX >= 0x03000000 + PyObject *joined = PyUnicode_Concat(repr, nrep); + Py_DecRef(repr); + Py_DecRef(nrep); + repr = joined; +#else + PyString_ConcatAndDel(&repr,nrep); +#endif + } + return repr; +} + +SWIGRUNTIME int +SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ + char *str; +#ifdef METH_NOARGS + PyObject *repr = SwigPyObject_repr(v); +#else + PyObject *repr = SwigPyObject_repr(v, NULL); +#endif + if (repr) { + str = SWIG_Python_str_AsChar(repr); + fputs(str, fp); + SWIG_Python_str_DelForPy3(str); + Py_DECREF(repr); + return 0; + } else { + return 1; + } +} + +SWIGRUNTIME PyObject * +SwigPyObject_str(SwigPyObject *v) +{ + char result[SWIG_BUFFER_SIZE]; + return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? + SWIG_Python_str_FromChar(result) : 0; +} + +SWIGRUNTIME int +SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +{ + void *i = v->ptr; + void *j = w->ptr; + return (i < j) ? -1 : ((i > j) ? 1 : 0); +} + +/* Added for Python 3.x, would it also be useful for Python 2.x? */ +SWIGRUNTIME PyObject* +SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +{ + PyObject* res; + if( op != Py_EQ && op != Py_NE ) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ) + res = Py_True; + else + res = Py_False; + Py_INCREF(res); + return res; +} + + +SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); + +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); + return type; +} + +SWIGRUNTIMEINLINE int +SwigPyObject_Check(PyObject *op) { + return (Py_TYPE(op) == SwigPyObject_type()) + || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own); + +SWIGRUNTIME void +SwigPyObject_dealloc(PyObject *v) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + PyObject *next = sobj->next; + if (sobj->own == SWIG_POINTER_OWN) { + swig_type_info *ty = sobj->ty; + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PyObject *destroy = data ? data->destroy : 0; + if (destroy) { + /* destroy is always a VARARGS method */ + PyObject *res; + if (data->delargs) { + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); + } else { + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); + } + Py_XDECREF(res); + } +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); + } +#endif + } + Py_XDECREF(next); + PyObject_DEL(v); +} + +SWIGRUNTIME PyObject* +SwigPyObject_append(PyObject* v, PyObject* next) +{ + SwigPyObject *sobj = (SwigPyObject *) v; +#ifndef METH_O + PyObject *tmp = 0; + if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; + next = tmp; +#endif + if (!SwigPyObject_Check(next)) { + return NULL; + } + sobj->next = next; + Py_INCREF(next); + return SWIG_Py_Void(); +} + +SWIGRUNTIME PyObject* +#ifdef METH_NOARGS +SwigPyObject_next(PyObject* v) +#else +SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *) v; + if (sobj->next) { + Py_INCREF(sobj->next); + return sobj->next; + } else { + return SWIG_Py_Void(); + } +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_disown(PyObject *v) +#else +SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = 0; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_acquire(PyObject *v) +#else +SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = SWIG_POINTER_OWN; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +SwigPyObject_own(PyObject *v, PyObject *args) +{ + PyObject *val = 0; +#if (PY_VERSION_HEX < 0x02020000) + if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) +#else + if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) +#endif + { + return NULL; + } + else + { + SwigPyObject *sobj = (SwigPyObject *)v; + PyObject *obj = PyBool_FromLong(sobj->own); + if (val) { +#ifdef METH_NOARGS + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v); + } else { + SwigPyObject_disown(v); + } +#else + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v,args); + } else { + SwigPyObject_disown(v,args); + } +#endif + } + return obj; + } +} + +#ifdef METH_O +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#else +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#endif + +#if PY_VERSION_HEX < 0x02020000 +SWIGINTERN PyObject * +SwigPyObject_getattr(SwigPyObject *sobj,char *name) +{ + return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); +} +#endif + +SWIGRUNTIME PyTypeObject* +_PySwigObject_type(void) { + static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + + static PyNumberMethods SwigPyObject_as_number = { + (binaryfunc)0, /*nb_add*/ + (binaryfunc)0, /*nb_subtract*/ + (binaryfunc)0, /*nb_multiply*/ + /* nb_divide removed in Python 3 */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc)0, /*nb_divide*/ +#endif + (binaryfunc)0, /*nb_remainder*/ + (binaryfunc)0, /*nb_divmod*/ + (ternaryfunc)0,/*nb_power*/ + (unaryfunc)0, /*nb_negative*/ + (unaryfunc)0, /*nb_positive*/ + (unaryfunc)0, /*nb_absolute*/ + (inquiry)0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ +#if PY_VERSION_HEX < 0x03000000 + 0, /*nb_coerce*/ +#endif + (unaryfunc)SwigPyObject_long, /*nb_int*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_long, /*nb_long*/ +#else + 0, /*nb_reserved*/ +#endif + (unaryfunc)0, /*nb_float*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_oct, /*nb_oct*/ + (unaryfunc)SwigPyObject_hex, /*nb_hex*/ +#endif +#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ +#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ +#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ +#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ + 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ +#endif + }; + + static PyTypeObject swigpyobject_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp + = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyObject", /* tp_name */ + sizeof(SwigPyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyObject_dealloc, /* tp_dealloc */ + (printfunc)SwigPyObject_print, /* tp_print */ +#if PY_VERSION_HEX < 0x02020000 + (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ +#else + (getattrfunc)0, /* tp_getattr */ +#endif + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX >= 0x03000000 + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ +#else + (cmpfunc)SwigPyObject_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyObject_repr, /* tp_repr */ + &SwigPyObject_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)SwigPyObject_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigobject_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + swigobject_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + swigpyobject_type = tmp; + /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ +#if PY_VERSION_HEX < 0x03000000 + swigpyobject_type.ob_type = &PyType_Type; +#endif + type_init = 1; + } + return &swigpyobject_type; +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own) +{ + SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + if (sobj) { + sobj->ptr = ptr; + sobj->ty = ty; + sobj->own = own; + sobj->next = 0; + } + return (PyObject *)sobj; +} + +/* ----------------------------------------------------------------------------- + * Implements a simple Swig Packed type, and use it instead of string + * ----------------------------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + void *pack; + swig_type_info *ty; + size_t size; +} SwigPyPacked; + +SWIGRUNTIME int +SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ + char result[SWIG_BUFFER_SIZE]; + fputs("pack, v->size, 0, sizeof(result))) { + fputs("at ", fp); + fputs(result, fp); + } + fputs(v->ty->name,fp); + fputs(">", fp); + return 0; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_repr(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + return SWIG_Python_str_FromFormat("", result, v->ty->name); + } else { + return SWIG_Python_str_FromFormat("", v->ty->name); + } +} + +SWIGRUNTIME PyObject * +SwigPyPacked_str(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ + return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); + } else { + return SWIG_Python_str_FromChar(v->ty->name); + } +} + +SWIGRUNTIME int +SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) +{ + size_t i = v->size; + size_t j = w->size; + int s = (i < j) ? -1 : ((i > j) ? 1 : 0); + return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); +} + +SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); + return type; +} + +SWIGRUNTIMEINLINE int +SwigPyPacked_Check(PyObject *op) { + return ((op)->ob_type == _PySwigPacked_type()) + || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); +} + +SWIGRUNTIME void +SwigPyPacked_dealloc(PyObject *v) +{ + if (SwigPyPacked_Check(v)) { + SwigPyPacked *sobj = (SwigPyPacked *) v; + free(sobj->pack); + } + PyObject_DEL(v); +} + +SWIGRUNTIME PyTypeObject* +_PySwigPacked_type(void) { + static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static PyTypeObject swigpypacked_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp + = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX>=0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyPacked", /* tp_name */ + sizeof(SwigPyPacked), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ + (printfunc)SwigPyPacked_print, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX>=0x03000000 + 0, /* tp_reserved in 3.0.1 */ +#else + (cmpfunc)SwigPyPacked_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyPacked_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)SwigPyPacked_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigpacked_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + swigpypacked_type = tmp; + /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ +#if PY_VERSION_HEX < 0x03000000 + swigpypacked_type.ob_type = &PyType_Type; +#endif + type_init = 1; + } + return &swigpypacked_type; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) +{ + SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + if (sobj) { + void *pack = malloc(size); + if (pack) { + memcpy(pack, ptr, size); + sobj->pack = pack; + sobj->ty = ty; + sobj->size = size; + } else { + PyObject_DEL((PyObject *) sobj); + sobj = 0; + } + } + return (PyObject *) sobj; +} + +SWIGRUNTIME swig_type_info * +SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +{ + if (SwigPyPacked_Check(obj)) { + SwigPyPacked *sobj = (SwigPyPacked *)obj; + if (sobj->size != size) return 0; + memcpy(ptr, sobj->pack, size); + return sobj->ty; + } else { + return 0; + } +} + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIMEINLINE PyObject * +_SWIG_This(void) +{ + return SWIG_Python_str_FromChar("this"); +} + +SWIGRUNTIME PyObject * +SWIG_This(void) +{ + static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + return swig_this; +} + +/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ + +/* TODO: I don't know how to implement the fast getset in Python 3 right now */ +#if PY_VERSION_HEX>=0x03000000 +#define SWIG_PYTHON_SLOW_GETSET_THIS +#endif + +SWIGRUNTIME SwigPyObject * +SWIG_Python_GetSwigThis(PyObject *pyobj) +{ + if (SwigPyObject_Check(pyobj)) { + return (SwigPyObject *) pyobj; + } else { + PyObject *obj = 0; +#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) + if (PyInstance_Check(pyobj)) { + obj = _PyInstance_Lookup(pyobj, SWIG_This()); + } else { + PyObject **dictptr = _PyObject_GetDictPtr(pyobj); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; + } else { +#ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } + } +#else + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } +#endif + if (obj && !SwigPyObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + SwigPyObject from it */ + return SWIG_Python_GetSwigThis(obj); + } + return (SwigPyObject *)obj; + } +} + +/* Acquire a pointer value */ + +SWIGRUNTIME int +SWIG_Python_AcquirePtr(PyObject *obj, int own) { + if (own == SWIG_POINTER_OWN) { + SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (sobj) { + int oldown = sobj->own; + sobj->own = own; + return oldown; + } + } + return 0; +} + +/* Convert a pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { + if (!obj) return SWIG_ERROR; + if (obj == Py_None) { + if (ptr) *ptr = 0; + return SWIG_OK; + } else { + SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; + while (sobj) { + void *vptr = sobj->ptr; + if (ty) { + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (SwigPyObject *)sobj->next; + } else { + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } + break; + } + } + } else { + if (ptr) *ptr = vptr; + break; + } + } + if (sobj) { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + return SWIG_OK; + } else { + int res = SWIG_ERROR; + if (flags & SWIG_POINTER_IMPLICIT_CONV) { + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + } + return res; + } + } +} + +/* Convert a function ptr value */ + +SWIGRUNTIME int +SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + if (!PyCFunction_Check(obj)) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; + + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; + if (!desc) + return SWIG_ERROR; + if (ty) { + swig_cast_info *tc = SWIG_TypeCheck(desc,ty); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } + } else { + *ptr = vptr; + } + return SWIG_OK; + } +} + +/* Convert a packed value value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +/* ----------------------------------------------------------------------------- + * Create a new pointer object + * ----------------------------------------------------------------------------- */ + +/* + Create a new instance object, without calling __init__, and set the + 'this' attribute. +*/ + +SWIGRUNTIME PyObject* +SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) +{ +#if (PY_VERSION_HEX >= 0x02020000) + PyObject *inst = 0; + PyObject *newraw = data->newraw; + if (newraw) { + inst = PyObject_Call(newraw, data->newargs, NULL); + if (inst) { +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + PyDict_SetItem(dict, SWIG_This(), swig_this); + } + } +#else + PyObject *key = SWIG_This(); + PyObject_SetAttr(inst, key, swig_this); +#endif + } + } else { +#if PY_VERSION_HEX >= 0x03000000 + inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + PyObject_SetAttr(inst, SWIG_This(), swig_this); + Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; +#else + PyObject *dict = PyDict_New(); + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); +#endif + } + return inst; +#else +#if (PY_VERSION_HEX >= 0x02010000) + PyObject *inst; + PyObject *dict = PyDict_New(); + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + return (PyObject *) inst; +#else + PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); + if (inst == NULL) { + return NULL; + } + inst->in_class = (PyClassObject *)data->newargs; + Py_INCREF(inst->in_class); + inst->in_dict = PyDict_New(); + if (inst->in_dict == NULL) { + Py_DECREF(inst); + return NULL; + } +#ifdef Py_TPFLAGS_HAVE_WEAKREFS + inst->in_weakreflist = NULL; +#endif +#ifdef Py_TPFLAGS_GC + PyObject_GC_Init(inst); +#endif + PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); + return (PyObject *) inst; +#endif +#endif +} + +SWIGRUNTIME void +SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) +{ + PyObject *dict; +#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + PyDict_SetItem(dict, SWIG_This(), swig_this); + return; + } +#endif + dict = PyObject_GetAttrString(inst, (char*)"__dict__"); + PyDict_SetItem(dict, SWIG_This(), swig_this); + Py_DECREF(dict); +} + + +SWIGINTERN PyObject * +SWIG_Python_InitShadowInstance(PyObject *args) { + PyObject *obj[2]; + if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { + return NULL; + } else { + SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + if (sthis) { + SwigPyObject_append((PyObject*) sthis, obj[1]); + } else { + SWIG_Python_SetSwigThis(obj[0], obj[1]); + } + return SWIG_Py_Void(); + } +} + +/* Create a new pointer object */ + +SWIGRUNTIME PyObject * +SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { + if (!ptr) { + return SWIG_Py_Void(); + } else { + int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + PyObject *robj = SwigPyObject_New(ptr, type, own); + SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + if (inst) { + Py_DECREF(robj); + robj = inst; + } + } + return robj; + } +} + +/* Create a new packed object */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { + return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); +} + +/* -----------------------------------------------------------------------------* + * Get type list + * -----------------------------------------------------------------------------*/ + +#ifdef SWIG_LINK_RUNTIME +void *SWIG_ReturnGlobalTypeList(void *); +#endif + +SWIGRUNTIME swig_module_info * +SWIG_Python_GetModule(void) { + static void *type_pointer = (void *)0; + /* first check if module already created */ + if (!type_pointer) { +#ifdef SWIG_LINK_RUNTIME + type_pointer = SWIG_ReturnGlobalTypeList((void *)0); +#else + type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif + } + return (swig_module_info *) type_pointer; +} + +#if PY_MAJOR_VERSION < 2 +/* PyModule_AddObject function was introduced in Python 2.0. The following function + is copied out of Python/modsupport.c in python version 2.3.4 */ +SWIGINTERN int +PyModule_AddObject(PyObject *m, char *name, PyObject *o) +{ + PyObject *dict; + if (!PyModule_Check(m)) { + PyErr_SetString(PyExc_TypeError, + "PyModule_AddObject() needs module as first arg"); + return SWIG_ERROR; + } + if (!o) { + PyErr_SetString(PyExc_TypeError, + "PyModule_AddObject() needs non-NULL value"); + return SWIG_ERROR; + } + + dict = PyModule_GetDict(m); + if (dict == NULL) { + /* Internal error -- modules must have a dict! */ + PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", + PyModule_GetName(m)); + return SWIG_ERROR; + } + if (PyDict_SetItemString(dict, name, o)) + return SWIG_ERROR; + Py_DECREF(o); + return SWIG_OK; +} +#endif + +SWIGRUNTIME void +SWIG_Python_DestroyModule(void *vptr) +{ + swig_module_info *swig_module = (swig_module_info *) vptr; + swig_type_info **types = swig_module->types; + size_t i; + for (i =0; i < swig_module->size; ++i) { + swig_type_info *ty = types[i]; + if (ty->owndata) { + SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; + if (data) SwigPyClientData_Del(data); + } + } + Py_DECREF(SWIG_This()); +} + +SWIGRUNTIME void +SWIG_Python_SetModule(swig_module_info *swig_module) { + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ + +#if PY_VERSION_HEX >= 0x03000000 + /* Add a dummy module object into sys.modules */ + PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); +#else + PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + swig_empty_runtime_method_table); +#endif + PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +} + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); + return cache; +} + +SWIGRUNTIME swig_type_info * +SWIG_Python_TypeQuery(const char *type) +{ + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *obj = PyDict_GetItem(cache, key); + swig_type_info *descriptor; + if (obj) { + descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); + } else { + swig_module_info *swig_module = SWIG_Python_GetModule(); + descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); + if (descriptor) { + obj = PyCObject_FromVoidPtr(descriptor, NULL); + PyDict_SetItem(cache, key, obj); + Py_DECREF(obj); + } + } + Py_DECREF(key); + return descriptor; +} + +/* + For backward compatibility only +*/ +#define SWIG_POINTER_EXCEPTION 0 +#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) +#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) + +SWIGRUNTIME int +SWIG_Python_AddErrMesg(const char* mesg, int infront) +{ + if (PyErr_Occurred()) { + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + Py_XINCREF(type); + PyErr_Clear(); + if (infront) { + PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); + } else { + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + } + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + } + return 1; + } else { + return 0; + } +} + +SWIGRUNTIME int +SWIG_Python_ArgFail(int argnum) +{ + if (PyErr_Occurred()) { + /* add information about failing argument */ + char mesg[256]; + PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); + return SWIG_Python_AddErrMesg(mesg, 1); + } else { + return 0; + } +} + +SWIGRUNTIMEINLINE const char * +SwigPyObject_GetDesc(PyObject *self) +{ + SwigPyObject *v = (SwigPyObject *)self; + swig_type_info *ty = v ? v->ty : 0; + return ty ? ty->str : (char*)""; +} + +SWIGRUNTIME void +SWIG_Python_TypeError(const char *type, PyObject *obj) +{ + if (type) { +#if defined(SWIG_COBJECT_TYPES) + if (obj && SwigPyObject_Check(obj)) { + const char *otype = (const char *) SwigPyObject_GetDesc(obj); + if (otype) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", + type, otype); + return; + } + } else +#endif + { + const char *otype = (obj ? obj->ob_type->tp_name : 0); + if (otype) { + PyObject *str = PyObject_Str(obj); + const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + if (cstr) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", + type, otype, cstr); + SWIG_Python_str_DelForPy3(cstr); + } else { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", + type, otype); + } + Py_XDECREF(str); + return; + } + } + PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); + } else { + PyErr_Format(PyExc_TypeError, "unexpected type is received"); + } +} + + +/* Convert a pointer value, signal an exception on a type mismatch */ +SWIGRUNTIME void * +SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { + void *result; + if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { + PyErr_Clear(); +#if SWIG_POINTER_EXCEPTION + if (flags) { + SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + SWIG_Python_ArgFail(argnum); + } +#endif + } + return result; +} + + +#ifdef __cplusplus +#if 0 +{ /* cc-mode */ +#endif +} +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_char swig_types[0] +#define SWIGTYPE_p_ctb__IOBase swig_types[1] +#define SWIGTYPE_p_ctb__SerialPort swig_types[2] +#define SWIGTYPE_p_ctb__SerialPort_DCS swig_types[3] +#define SWIGTYPE_p_ctb__SerialPort_EINFO swig_types[4] +#define SWIGTYPE_p_ctb__SerialPort_x swig_types[5] +#define SWIGTYPE_p_ctb__Timer swig_types[6] +#define SWIGTYPE_p_ctb__timer_control swig_types[7] +#define SWIGTYPE_p_f_p_void__p_void swig_types[8] +#define SWIGTYPE_p_int swig_types[9] +#define SWIGTYPE_p_p_char swig_types[10] +static swig_type_info *swig_types[12]; +static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#if (PY_VERSION_HEX <= 0x02000000) +# if !defined(SWIG_PYTHON_CLASSIC) +# error "This python version requires swig to be run with the '-classic' option" +# endif +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodern' option" +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodernargs' option" +#endif + +/*----------------------------------------------- + @(target):= _wxctb.so + ------------------------------------------------*/ +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_init PyInit__wxctb + +#else +# define SWIG_init init_wxctb + +#endif +#define SWIG_name "_wxctb" + +#define SWIGVERSION 0x010340 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include + + +namespace swig { + class SwigPtr_PyObject { + protected: + PyObject *_obj; + + public: + SwigPtr_PyObject() :_obj(0) + { + } + + SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) + { + Py_XINCREF(_obj); + } + + SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) + { + if (initial_ref) { + Py_XINCREF(_obj); + } + } + + SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) + { + Py_XINCREF(item._obj); + Py_XDECREF(_obj); + _obj = item._obj; + return *this; + } + + ~SwigPtr_PyObject() + { + Py_XDECREF(_obj); + } + + operator PyObject *() const + { + return _obj; + } + + PyObject *operator->() const + { + return _obj; + } + }; +} + + +namespace swig { + struct SwigVar_PyObject : SwigPtr_PyObject { + SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } + + SwigVar_PyObject & operator = (PyObject* obj) + { + Py_XDECREF(_obj); + _obj = obj; + return *this; + } + }; +} + + +#include "ctb-0.16/linux/timer.h" + + + static int *new_intp() { + return (new int); + } + + static int *copy_intp(int value) { + return (new int(static_cast< const int& >(value))); + } + + static void delete_intp(int *self) { + if (self) delete self; + } + + static void intp_assign(int *self, int value) { + *self = value; + } + + static int intp_value(int *self) { + return *self; + } + + +#include +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +SWIGINTERN int +SWIG_AsVal_double (PyObject *obj, double *val) +{ + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; + } else if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); + } else { + PyErr_Clear(); + } + } + } +#endif + return res; +} + + +#include + + +#include + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + + #define SWIG_From_long PyInt_FromLong + + +SWIGINTERNINLINE PyObject * +SWIG_From_int (int value) +{ + return SWIG_From_long (value); +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) +{ + if (PyInt_Check(obj)) { + long v = PyInt_AsLong(obj); + if (v >= 0) { + if (val) *val = v; + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else if (PyLong_Check(obj)) { + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { + if (val) *val = (unsigned long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > UINT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< unsigned int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject* +SWIG_From_unsigned_SS_long (unsigned long value) +{ + return (value > LONG_MAX) ? + PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_unsigned_SS_int (unsigned int value) +{ + return SWIG_From_unsigned_SS_long (value); +} + + +#include "ctb-0.16/linux/serport.h" + + +#include "ctb-0.16/serportx.h" + + +#include "ctb-0.16/iobase.h" + + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); + } else { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromStringAndSize(carray, static_cast< int >(size)); +#else + return PyString_FromStringAndSize(carray, static_cast< int >(size)); +#endif + } + } else { + return SWIG_Py_Void(); + } +} + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +{ +#if PY_VERSION_HEX>=0x03000000 + if (PyUnicode_Check(obj)) +#else + if (PyString_Check(obj)) +#endif + { + char *cstr; Py_ssize_t len; +#if PY_VERSION_HEX>=0x03000000 + if (!alloc && cptr) { + /* We can't allow converting without allocation, since the internal + representation of string in Python 3 is UCS-2/UCS-4 but we require + a UTF-8 representation. + TODO(bhy) More detailed explanation */ + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + PyBytes_AsStringAndSize(obj, &cstr, &len); + if(alloc) *alloc = SWIG_NEWOBJ; +#else + PyString_AsStringAndSize(obj, &cstr, &len); +#endif + if (cptr) { + if (alloc) { + /* + In python the user should not be able to modify the inner + string representation. To warranty that, if you define + SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string + buffer is always returned. + + The default behavior is just to return the pointer value, + so, be careful. + */ +#if defined(SWIG_PYTHON_SAFE_CSTRINGS) + if (*alloc != SWIG_OLDOBJ) +#else + if (*alloc == SWIG_NEWOBJ) +#endif + { + *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); + *alloc = SWIG_NEWOBJ; + } + else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } else { + #if PY_VERSION_HEX>=0x03000000 + assert(0); /* Should never reach here in Python 3 */ + #endif + *cptr = SWIG_Python_str_AsChar(obj); + } + } + if (psize) *psize = len + 1; +#if PY_VERSION_HEX>=0x03000000 + Py_XDECREF(obj); +#endif + return SWIG_OK; + } else { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + + + + +SWIGINTERN int +SWIG_AsCharArray(PyObject * obj, char *val, size_t size) +{ + char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; + int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); + if (SWIG_IsOK(res)) { + if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize; + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(char)); + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); + } + if (alloc == SWIG_NEWOBJ) { + delete[] cptr; + res = SWIG_DelNewMask(res); + } + return res; + } + if (alloc == SWIG_NEWOBJ) delete[] cptr; + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_char (PyObject * obj, char *val) +{ + int res = SWIG_AsCharArray(obj, val, 1); + if (!SWIG_IsOK(res)) { + long v; + res = SWIG_AddCast(SWIG_AsVal_long (obj, &v)); + if (SWIG_IsOK(res)) { + if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) { + if (val) *val = static_cast< char >(v); + } else { + res = SWIG_OverflowError; + } + } + } + return res; +} + + +SWIGINTERNINLINE int +SWIG_AsVal_size_t (PyObject * obj, size_t *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); + return res; +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_char (PyObject * obj, unsigned char *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > UCHAR_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< unsigned char >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_unsigned_SS_char (unsigned char value) +{ + return SWIG_From_unsigned_SS_long (value); +} + + +SWIGINTERN int +SWIG_AsVal_bool (PyObject *obj, bool *val) +{ + int r = PyObject_IsTrue(obj); + if (r == -1) + return SWIG_ERROR; + if (val) *val = r ? true : false; + return SWIG_OK; +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_bool (bool value) +{ + return PyBool_FromLong(value ? 1 : 0); +} + + +#include "ctb-0.16/kbhit.h" + + +SWIGINTERNINLINE PyObject * +SWIG_From_char (char c) +{ + return SWIG_FromCharPtrAndSize(&c,1); +} + +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN PyObject *_wrap_new_intp(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"new_intp",0,0)) SWIG_fail; + result = (int *)new_intp(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_copy_intp(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + char * kwnames[] = { + (char *) "value", NULL + }; + int *result = 0 ; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:copy_intp",kwnames,&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "copy_intp" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (int *)copy_intp(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_intp(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + int *arg1 = (int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char * kwnames[] = { + (char *) "self", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:delete_intp",kwnames,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_intp" "', argument " "1"" of type '" "int *""'"); + } + arg1 = reinterpret_cast< int * >(argp1); + delete_intp(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_intp_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + int *arg1 = (int *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "value", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:intp_assign",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "intp_assign" "', argument " "1"" of type '" "int *""'"); + } + arg1 = reinterpret_cast< int * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "intp_assign" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + intp_assign(arg1,arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_intp_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + int *arg1 = (int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char * kwnames[] = { + (char *) "self", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:intp_value",kwnames,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "intp_value" "', argument " "1"" of type '" "int *""'"); + } + arg1 = reinterpret_cast< int * >(argp1); + result = (int)intp_value(arg1); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_timer_control_usecs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::timer_control *arg1 = (ctb::timer_control *) 0 ; + unsigned int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"timer_control_usecs_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__timer_control, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "timer_control_usecs_set" "', argument " "1"" of type '" "ctb::timer_control *""'"); + } + arg1 = reinterpret_cast< ctb::timer_control * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "timer_control_usecs_set" "', argument " "2"" of type '" "unsigned int""'"); + } + arg2 = static_cast< unsigned int >(val2); + if (arg1) (arg1)->usecs = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_timer_control_usecs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::timer_control *arg1 = (ctb::timer_control *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + unsigned int result; + + if(!PyArg_UnpackTuple(args,(char *)"timer_control_usecs_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__timer_control, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "timer_control_usecs_get" "', argument " "1"" of type '" "ctb::timer_control *""'"); + } + arg1 = reinterpret_cast< ctb::timer_control * >(argp1); + result = (unsigned int) ((arg1)->usecs); + resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_timer_control_exitflag_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::timer_control *arg1 = (ctb::timer_control *) 0 ; + int *arg2 = (int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"timer_control_exitflag_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__timer_control, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "timer_control_exitflag_set" "', argument " "1"" of type '" "ctb::timer_control *""'"); + } + arg1 = reinterpret_cast< ctb::timer_control * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "timer_control_exitflag_set" "', argument " "2"" of type '" "int *""'"); + } + arg2 = reinterpret_cast< int * >(argp2); + if (arg1) (arg1)->exitflag = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_timer_control_exitflag_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::timer_control *arg1 = (ctb::timer_control *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"timer_control_exitflag_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__timer_control, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "timer_control_exitflag_get" "', argument " "1"" of type '" "ctb::timer_control *""'"); + } + arg1 = reinterpret_cast< ctb::timer_control * >(argp1); + result = (int *) ((arg1)->exitflag); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_timer_control_exitfnc_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::timer_control *arg1 = (ctb::timer_control *) 0 ; + void *(*arg2)(void *) = (void *(*)(void *)) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"timer_control_exitfnc_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__timer_control, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "timer_control_exitfnc_set" "', argument " "1"" of type '" "ctb::timer_control *""'"); + } + arg1 = reinterpret_cast< ctb::timer_control * >(argp1); + { + int res = SWIG_ConvertFunctionPtr(obj1, (void**)(&arg2), SWIGTYPE_p_f_p_void__p_void); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ArgError(res), "in method '" "timer_control_exitfnc_set" "', argument " "2"" of type '" "void *(*)(void *)""'"); + } + } + if (arg1) (arg1)->exitfnc = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_timer_control_exitfnc_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::timer_control *arg1 = (ctb::timer_control *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + void *(*result)(void *) = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"timer_control_exitfnc_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__timer_control, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "timer_control_exitfnc_get" "', argument " "1"" of type '" "ctb::timer_control *""'"); + } + arg1 = reinterpret_cast< ctb::timer_control * >(argp1); + result = (void *(*)(void *)) ((arg1)->exitfnc); + resultobj = SWIG_NewFunctionPtrObj((void *)(result), SWIGTYPE_p_f_p_void__p_void); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *timer_control_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ctb__timer_control, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_new_Timer(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + unsigned int arg1 ; + int *arg2 = (int *) 0 ; + void *(*arg3)(void *) = (void *(*)(void *)) NULL ; + unsigned int val1 ; + int ecode1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "msec",(char *) "exitflag",(char *) "exitfnc", NULL + }; + ctb::Timer *result = 0 ; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:new_Timer",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Timer" "', argument " "1"" of type '" "unsigned int""'"); + } + arg1 = static_cast< unsigned int >(val1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Timer" "', argument " "2"" of type '" "int *""'"); + } + arg2 = reinterpret_cast< int * >(argp2); + if (obj2) { + { + int res = SWIG_ConvertFunctionPtr(obj2, (void**)(&arg3), SWIGTYPE_p_f_p_void__p_void); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ArgError(res), "in method '" "new_Timer" "', argument " "3"" of type '" "void *(*)(void *)""'"); + } + } + } + result = (ctb::Timer *)new ctb::Timer(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ctb__Timer, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_Timer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::Timer *arg1 = (ctb::Timer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"delete_Timer",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__Timer, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Timer" "', argument " "1"" of type '" "ctb::Timer *""'"); + } + arg1 = reinterpret_cast< ctb::Timer * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Timer_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::Timer *arg1 = (ctb::Timer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"Timer_start",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__Timer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Timer_start" "', argument " "1"" of type '" "ctb::Timer *""'"); + } + arg1 = reinterpret_cast< ctb::Timer * >(argp1); + result = (int)(arg1)->start(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Timer_stop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::Timer *arg1 = (ctb::Timer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"Timer_stop",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__Timer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Timer_stop" "', argument " "1"" of type '" "ctb::Timer *""'"); + } + arg1 = reinterpret_cast< ctb::Timer * >(argp1); + result = (int)(arg1)->stop(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Timer_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ctb__Timer, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_sleepms(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + unsigned int arg1 ; + unsigned int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + char * kwnames[] = { + (char *) "ms", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:sleepms",kwnames,&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sleepms" "', argument " "1"" of type '" "unsigned int""'"); + } + arg1 = static_cast< unsigned int >(val1); + ctb::sleepms(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_IOBase(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"delete_IOBase",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IOBase" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_ClassName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"IOBase_ClassName",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_ClassName" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + result = (char *)(arg1)->ClassName(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_Close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"IOBase_Close",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_Close" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + result = (int)(arg1)->Close(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_Ioctl(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + int arg2 ; + void *arg3 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "cmd",(char *) "args", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:IOBase_Ioctl",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_Ioctl" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IOBase_Ioctl" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IOBase_Ioctl" "', argument " "3"" of type '" "void *""'"); + } + result = (int)(arg1)->Ioctl(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_IsOpen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"IOBase_IsOpen",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_IsOpen" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + result = (int)(arg1)->IsOpen(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_Open(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = (void *) 0L ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "devname",(char *) "dcs", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:IOBase_Open",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_Open" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IOBase_Open" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IOBase_Open" "', argument " "3"" of type '" "void *""'"); + } + } + result = (int)(arg1)->Open((char const *)arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_PutBack(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + char val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "ch", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:IOBase_PutBack",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_PutBack" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + ecode2 = SWIG_AsVal_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IOBase_PutBack" "', argument " "2"" of type '" "char""'"); + } + arg2 = static_cast< char >(val2); + result = (int)(arg1)->PutBack(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_Read(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + char *arg2 = (char *) 0 ; + size_t arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + size_t val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "buf",(char *) "len", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:IOBase_Read",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_Read" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IOBase_Read" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_size_t(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IOBase_Read" "', argument " "3"" of type '" "size_t""'"); + } + arg3 = static_cast< size_t >(val3); + result = (int)(arg1)->Read(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_ReadUntilEOS(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + char **arg2 = 0 ; + size_t *arg3 = (size_t *) 0 ; + char *arg4 = (char *) "\n" ; + long arg5 = (long) 1000L ; + char arg6 = (char) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + char *tmp2 ; + size_t tmp3 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + long val5 ; + int ecode5 = 0 ; + char val6 ; + int ecode6 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "readbuf",(char *) "readedBytes",(char *) "eosString",(char *) "timeout_in_ms",(char *) "quota", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OOO:IOBase_ReadUntilEOS",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_ReadUntilEOS" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + { + /* dont check for list */ + arg2 = &tmp2; + } + { + /* dont check for list */ + arg3 = &tmp3; + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IOBase_ReadUntilEOS" "', argument " "4"" of type '" "char *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + if (obj4) { + ecode5 = SWIG_AsVal_long(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "IOBase_ReadUntilEOS" "', argument " "5"" of type '" "long""'"); + } + arg5 = static_cast< long >(val5); + } + if (obj5) { + ecode6 = SWIG_AsVal_char(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "IOBase_ReadUntilEOS" "', argument " "6"" of type '" "char""'"); + } + arg6 = static_cast< char >(val6); + } + result = (int)(arg1)->ReadUntilEOS(*arg2,arg3,arg4,arg5,arg6); + resultobj = SWIG_From_int(static_cast< int >(result)); + { + PyObject * plist = PyList_New(2); + PyList_SetItem(plist, 0, PyString_FromString(*arg2)); + PyList_SetItem(plist, 1, resultobj); + resultobj = plist; + delete *arg2; + } + { + PyList_Append(resultobj, PyInt_FromLong(*arg3)); + } + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_Readv(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + char *arg2 = (char *) 0 ; + size_t arg3 ; + unsigned int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + size_t val3 ; + int ecode3 = 0 ; + unsigned int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "buf",(char *) "len",(char *) "timeout_in_ms", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:IOBase_Readv",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_Readv" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IOBase_Readv" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_size_t(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IOBase_Readv" "', argument " "3"" of type '" "size_t""'"); + } + arg3 = static_cast< size_t >(val3); + ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "IOBase_Readv" "', argument " "4"" of type '" "unsigned int""'"); + } + arg4 = static_cast< unsigned int >(val4); + result = (int)(arg1)->Readv(arg2,arg3,arg4); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_Write(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + char *arg2 = (char *) 0 ; + size_t arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + size_t val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "buf",(char *) "len", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:IOBase_Write",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_Write" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IOBase_Write" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_size_t(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IOBase_Write" "', argument " "3"" of type '" "size_t""'"); + } + arg3 = static_cast< size_t >(val3); + result = (int)(arg1)->Write(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IOBase_Writev(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::IOBase *arg1 = (ctb::IOBase *) 0 ; + char *arg2 = (char *) 0 ; + size_t arg3 ; + unsigned int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + size_t val3 ; + int ecode3 = 0 ; + unsigned int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "buf",(char *) "len",(char *) "timeout_in_ms", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:IOBase_Writev",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__IOBase, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IOBase_Writev" "', argument " "1"" of type '" "ctb::IOBase *""'"); + } + arg1 = reinterpret_cast< ctb::IOBase * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IOBase_Writev" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_size_t(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IOBase_Writev" "', argument " "3"" of type '" "size_t""'"); + } + arg3 = static_cast< size_t >(val3); + ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "IOBase_Writev" "', argument " "4"" of type '" "unsigned int""'"); + } + arg4 = static_cast< unsigned int >(val4); + result = (int)(arg1)->Writev(arg2,arg3,arg4); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *IOBase_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ctb__IOBase, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_baud_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_baud_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_baud_set" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_DCS_baud_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->baud = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_baud_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_baud_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_baud_get" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (int) ((arg1)->baud); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_parity_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + ctb::Parity arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_parity_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_parity_set" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_DCS_parity_set" "', argument " "2"" of type '" "ctb::Parity""'"); + } + arg2 = static_cast< ctb::Parity >(val2); + if (arg1) (arg1)->parity = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_parity_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + ctb::Parity result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_parity_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_parity_get" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (ctb::Parity) ((arg1)->parity); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_wordlen_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + unsigned char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned char val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_wordlen_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_wordlen_set" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_DCS_wordlen_set" "', argument " "2"" of type '" "unsigned char""'"); + } + arg2 = static_cast< unsigned char >(val2); + if (arg1) (arg1)->wordlen = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_wordlen_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + unsigned char result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_wordlen_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_wordlen_get" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (unsigned char) ((arg1)->wordlen); + resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_stopbits_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + unsigned char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned char val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_stopbits_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_stopbits_set" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_DCS_stopbits_set" "', argument " "2"" of type '" "unsigned char""'"); + } + arg2 = static_cast< unsigned char >(val2); + if (arg1) (arg1)->stopbits = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_stopbits_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + unsigned char result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_stopbits_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_stopbits_get" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (unsigned char) ((arg1)->stopbits); + resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_rtscts_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_rtscts_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_rtscts_set" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_DCS_rtscts_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->rtscts = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_rtscts_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_rtscts_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_rtscts_get" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (bool) ((arg1)->rtscts); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_xonxoff_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_xonxoff_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_xonxoff_set" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_DCS_xonxoff_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->xonxoff = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_xonxoff_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_xonxoff_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_xonxoff_get" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (bool) ((arg1)->xonxoff); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_buf_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + char *arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + char temp2[16] ; + int res2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_buf_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_buf_set" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + res2 = SWIG_AsCharArray(obj1, temp2, 16); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SerialPort_DCS_buf_set" "', argument " "2"" of type '" "char [16]""'"); + } + arg2 = reinterpret_cast< char * >(temp2); + if (arg2) memcpy(arg1->buf,arg2,16*sizeof(char)); + else memset(arg1->buf,0,16*sizeof(char)); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_buf_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_buf_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_buf_get" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (char *)(char *) ((arg1)->buf); + { + size_t size = 16; + + while (size && (result[size - 1] == '\0')) --size; + + resultobj = SWIG_FromCharPtrAndSize(result, size); + } + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_SerialPort_DCS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"new_SerialPort_DCS",0,0)) SWIG_fail; + result = (ctb::SerialPort_DCS *)new ctb::SerialPort_DCS(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ctb__SerialPort_DCS, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_SerialPort_DCS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"delete_SerialPort_DCS",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SerialPort_DCS" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_DCS_GetSettings(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_DCS *arg1 = (ctb::SerialPort_DCS *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_DCS_GetSettings",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_DCS, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_DCS_GetSettings" "', argument " "1"" of type '" "ctb::SerialPort_DCS *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_DCS * >(argp1); + result = (char *)(arg1)->GetSettings(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *SerialPort_DCS_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ctb__SerialPort_DCS, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_brk_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_brk_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_brk_set" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_EINFO_brk_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->brk = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_brk_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_brk_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_brk_get" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + result = (int) ((arg1)->brk); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_frame_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_frame_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_frame_set" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_EINFO_frame_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->frame = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_frame_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_frame_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_frame_get" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + result = (int) ((arg1)->frame); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_overrun_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_overrun_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_overrun_set" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_EINFO_overrun_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->overrun = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_overrun_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_overrun_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_overrun_get" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + result = (int) ((arg1)->overrun); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_parity_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_parity_set",2,2,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_parity_set" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_EINFO_parity_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->parity = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_EINFO_parity_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_EINFO_parity_get",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_EINFO_parity_get" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + result = (int) ((arg1)->parity); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_SerialPort_EINFO(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"new_SerialPort_EINFO",0,0)) SWIG_fail; + result = (ctb::SerialPort_EINFO *)new ctb::SerialPort_EINFO(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ctb__SerialPort_EINFO, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_SerialPort_EINFO(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_EINFO *arg1 = (ctb::SerialPort_EINFO *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"delete_SerialPort_EINFO",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_EINFO, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SerialPort_EINFO" "', argument " "1"" of type '" "ctb::SerialPort_EINFO *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_EINFO * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *SerialPort_EINFO_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ctb__SerialPort_EINFO, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_delete_SerialPort_x(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"delete_SerialPort_x",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SerialPort_x" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_ClassName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_x_ClassName",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_ClassName" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + result = (char *)(arg1)->ClassName(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_ChangeLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + ctb::SerialLineState arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "flags", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_x_ChangeLineState",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_ChangeLineState" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_x_ChangeLineState" "', argument " "2"" of type '" "ctb::SerialLineState""'"); + } + arg2 = static_cast< ctb::SerialLineState >(val2); + result = (int)(arg1)->ChangeLineState(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_ClrLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + ctb::SerialLineState arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "flags", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_x_ClrLineState",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_ClrLineState" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_x_ClrLineState" "', argument " "2"" of type '" "ctb::SerialLineState""'"); + } + arg2 = static_cast< ctb::SerialLineState >(val2); + result = (int)(arg1)->ClrLineState(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_GetLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_x_GetLineState",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_GetLineState" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + result = (int)(arg1)->GetLineState(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_GetSettingsAsString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_x_GetSettingsAsString",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_GetSettingsAsString" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + result = (char *)(arg1)->GetSettingsAsString(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_Ioctl(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + int arg2 ; + void *arg3 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "cmd",(char *) "args", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SerialPort_x_Ioctl",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_Ioctl" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_x_Ioctl" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SerialPort_x_Ioctl" "', argument " "3"" of type '" "void *""'"); + } + result = (int)(arg1)->Ioctl(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_SendBreak(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "duration", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_x_SendBreak",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_SendBreak" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_x_SendBreak" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (int)(arg1)->SendBreak(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_SetBaudrate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "baudrate", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_x_SetBaudrate",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_SetBaudrate" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_x_SetBaudrate" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (int)(arg1)->SetBaudrate(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_SetLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + ctb::SerialLineState arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "flags", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_x_SetLineState",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_SetLineState" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_x_SetLineState" "', argument " "2"" of type '" "ctb::SerialLineState""'"); + } + arg2 = static_cast< ctb::SerialLineState >(val2); + result = (int)(arg1)->SetLineState(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_SetParityBit(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort_x *arg1 = (ctb::SerialPort_x *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "parity", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_x_SetParityBit",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort_x, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_x_SetParityBit" "', argument " "1"" of type '" "ctb::SerialPort_x *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort_x * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_x_SetParityBit" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + result = (int)(arg1)->SetParityBit(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_x_IsStandardRate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + long arg1 ; + long val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + char * kwnames[] = { + (char *) "rate", NULL + }; + bool result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:SerialPort_x_IsStandardRate",kwnames,&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_long(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SerialPort_x_IsStandardRate" "', argument " "1"" of type '" "long""'"); + } + arg1 = static_cast< long >(val1); + result = (bool)ctb::SerialPort_x::IsStandardRate(arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *SerialPort_x_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ctb__SerialPort_x, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_new_SerialPort(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort *result = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"new_SerialPort",0,0)) SWIG_fail; + result = (ctb::SerialPort *)new ctb::SerialPort(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ctb__SerialPort, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_SerialPort(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if(!PyArg_UnpackTuple(args,(char *)"delete_SerialPort",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SerialPort" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_ChangeLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + ctb::SerialLineState arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "flags", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_ChangeLineState",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_ChangeLineState" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_ChangeLineState" "', argument " "2"" of type '" "ctb::SerialLineState""'"); + } + arg2 = static_cast< ctb::SerialLineState >(val2); + result = (int)(arg1)->ChangeLineState(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_ClrLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + ctb::SerialLineState arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "flags", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_ClrLineState",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_ClrLineState" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_ClrLineState" "', argument " "2"" of type '" "ctb::SerialLineState""'"); + } + arg2 = static_cast< ctb::SerialLineState >(val2); + result = (int)(arg1)->ClrLineState(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_GetLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_GetLineState",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_GetLineState" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + result = (int)(arg1)->GetLineState(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_Ioctl(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + int arg2 ; + void *arg3 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "cmd",(char *) "args", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SerialPort_Ioctl",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_Ioctl" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_Ioctl" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SerialPort_Ioctl" "', argument " "3"" of type '" "void *""'"); + } + result = (int)(arg1)->Ioctl(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_IsOpen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if(!PyArg_UnpackTuple(args,(char *)"SerialPort_IsOpen",1,1,&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_IsOpen" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + result = (int)(arg1)->IsOpen(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_Read(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + char *arg2 = (char *) 0 ; + size_t arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + size_t val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "buf",(char *) "len", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SerialPort_Read",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_Read" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SerialPort_Read" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_size_t(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SerialPort_Read" "', argument " "3"" of type '" "size_t""'"); + } + arg3 = static_cast< size_t >(val3); + result = (int)(arg1)->Read(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_SendBreak(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "duration", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_SendBreak",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_SendBreak" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_SendBreak" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (int)(arg1)->SendBreak(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_SetBaudrate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "baudrate", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_SetBaudrate",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_SetBaudrate" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_SetBaudrate" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (int)(arg1)->SetBaudrate(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_SetLineState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + ctb::SerialLineState arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "flags", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_SetLineState",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_SetLineState" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_SetLineState" "', argument " "2"" of type '" "ctb::SerialLineState""'"); + } + arg2 = static_cast< ctb::SerialLineState >(val2); + result = (int)(arg1)->SetLineState(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_SetParityBit(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "parity", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SerialPort_SetParityBit",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_SetParityBit" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SerialPort_SetParityBit" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + result = (int)(arg1)->SetParityBit(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SerialPort_Write(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + ctb::SerialPort *arg1 = (ctb::SerialPort *) 0 ; + char *arg2 = (char *) 0 ; + size_t arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + size_t val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "buf",(char *) "len", NULL + }; + int result; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SerialPort_Write",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ctb__SerialPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SerialPort_Write" "', argument " "1"" of type '" "ctb::SerialPort *""'"); + } + arg1 = reinterpret_cast< ctb::SerialPort * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SerialPort_Write" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_size_t(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SerialPort_Write" "', argument " "3"" of type '" "size_t""'"); + } + arg3 = static_cast< size_t >(val3); + result = (int)(arg1)->Write(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *SerialPort_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ctb__SerialPort, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_GetKey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char result; + + if(!PyArg_UnpackTuple(args,(char *)"GetKey",0,0)) SWIG_fail; + result = (char)ctb::GetKey(); + resultobj = SWIG_From_char(static_cast< char >(result)); + return resultobj; +fail: + return NULL; +} + + +static PyMethodDef SwigMethods[] = { + { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, + { (char *)"new_intp", _wrap_new_intp, METH_VARARGS, NULL}, + { (char *)"copy_intp", (PyCFunction) _wrap_copy_intp, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"delete_intp", (PyCFunction) _wrap_delete_intp, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"intp_assign", (PyCFunction) _wrap_intp_assign, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"intp_value", (PyCFunction) _wrap_intp_value, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"timer_control_usecs_set", _wrap_timer_control_usecs_set, METH_VARARGS, NULL}, + { (char *)"timer_control_usecs_get", _wrap_timer_control_usecs_get, METH_VARARGS, NULL}, + { (char *)"timer_control_exitflag_set", _wrap_timer_control_exitflag_set, METH_VARARGS, NULL}, + { (char *)"timer_control_exitflag_get", _wrap_timer_control_exitflag_get, METH_VARARGS, NULL}, + { (char *)"timer_control_exitfnc_set", _wrap_timer_control_exitfnc_set, METH_VARARGS, NULL}, + { (char *)"timer_control_exitfnc_get", _wrap_timer_control_exitfnc_get, METH_VARARGS, NULL}, + { (char *)"timer_control_swigregister", timer_control_swigregister, METH_VARARGS, NULL}, + { (char *)"new_Timer", (PyCFunction) _wrap_new_Timer, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"delete_Timer", _wrap_delete_Timer, METH_VARARGS, NULL}, + { (char *)"Timer_start", _wrap_Timer_start, METH_VARARGS, NULL}, + { (char *)"Timer_stop", _wrap_Timer_stop, METH_VARARGS, NULL}, + { (char *)"Timer_swigregister", Timer_swigregister, METH_VARARGS, NULL}, + { (char *)"sleepms", (PyCFunction) _wrap_sleepms, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"delete_IOBase", _wrap_delete_IOBase, METH_VARARGS, NULL}, + { (char *)"IOBase_ClassName", _wrap_IOBase_ClassName, METH_VARARGS, NULL}, + { (char *)"IOBase_Close", _wrap_IOBase_Close, METH_VARARGS, NULL}, + { (char *)"IOBase_Ioctl", (PyCFunction) _wrap_IOBase_Ioctl, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_IsOpen", _wrap_IOBase_IsOpen, METH_VARARGS, NULL}, + { (char *)"IOBase_Open", (PyCFunction) _wrap_IOBase_Open, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_PutBack", (PyCFunction) _wrap_IOBase_PutBack, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_Read", (PyCFunction) _wrap_IOBase_Read, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_ReadUntilEOS", (PyCFunction) _wrap_IOBase_ReadUntilEOS, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_Readv", (PyCFunction) _wrap_IOBase_Readv, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_Write", (PyCFunction) _wrap_IOBase_Write, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_Writev", (PyCFunction) _wrap_IOBase_Writev, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"IOBase_swigregister", IOBase_swigregister, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_baud_set", _wrap_SerialPort_DCS_baud_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_baud_get", _wrap_SerialPort_DCS_baud_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_parity_set", _wrap_SerialPort_DCS_parity_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_parity_get", _wrap_SerialPort_DCS_parity_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_wordlen_set", _wrap_SerialPort_DCS_wordlen_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_wordlen_get", _wrap_SerialPort_DCS_wordlen_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_stopbits_set", _wrap_SerialPort_DCS_stopbits_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_stopbits_get", _wrap_SerialPort_DCS_stopbits_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_rtscts_set", _wrap_SerialPort_DCS_rtscts_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_rtscts_get", _wrap_SerialPort_DCS_rtscts_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_xonxoff_set", _wrap_SerialPort_DCS_xonxoff_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_xonxoff_get", _wrap_SerialPort_DCS_xonxoff_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_buf_set", _wrap_SerialPort_DCS_buf_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_buf_get", _wrap_SerialPort_DCS_buf_get, METH_VARARGS, NULL}, + { (char *)"new_SerialPort_DCS", _wrap_new_SerialPort_DCS, METH_VARARGS, NULL}, + { (char *)"delete_SerialPort_DCS", _wrap_delete_SerialPort_DCS, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_GetSettings", _wrap_SerialPort_DCS_GetSettings, METH_VARARGS, NULL}, + { (char *)"SerialPort_DCS_swigregister", SerialPort_DCS_swigregister, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_brk_set", _wrap_SerialPort_EINFO_brk_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_brk_get", _wrap_SerialPort_EINFO_brk_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_frame_set", _wrap_SerialPort_EINFO_frame_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_frame_get", _wrap_SerialPort_EINFO_frame_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_overrun_set", _wrap_SerialPort_EINFO_overrun_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_overrun_get", _wrap_SerialPort_EINFO_overrun_get, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_parity_set", _wrap_SerialPort_EINFO_parity_set, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_parity_get", _wrap_SerialPort_EINFO_parity_get, METH_VARARGS, NULL}, + { (char *)"new_SerialPort_EINFO", _wrap_new_SerialPort_EINFO, METH_VARARGS, NULL}, + { (char *)"delete_SerialPort_EINFO", _wrap_delete_SerialPort_EINFO, METH_VARARGS, NULL}, + { (char *)"SerialPort_EINFO_swigregister", SerialPort_EINFO_swigregister, METH_VARARGS, NULL}, + { (char *)"delete_SerialPort_x", _wrap_delete_SerialPort_x, METH_VARARGS, NULL}, + { (char *)"SerialPort_x_ClassName", _wrap_SerialPort_x_ClassName, METH_VARARGS, NULL}, + { (char *)"SerialPort_x_ChangeLineState", (PyCFunction) _wrap_SerialPort_x_ChangeLineState, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_ClrLineState", (PyCFunction) _wrap_SerialPort_x_ClrLineState, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_GetLineState", _wrap_SerialPort_x_GetLineState, METH_VARARGS, NULL}, + { (char *)"SerialPort_x_GetSettingsAsString", _wrap_SerialPort_x_GetSettingsAsString, METH_VARARGS, NULL}, + { (char *)"SerialPort_x_Ioctl", (PyCFunction) _wrap_SerialPort_x_Ioctl, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_SendBreak", (PyCFunction) _wrap_SerialPort_x_SendBreak, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_SetBaudrate", (PyCFunction) _wrap_SerialPort_x_SetBaudrate, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_SetLineState", (PyCFunction) _wrap_SerialPort_x_SetLineState, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_SetParityBit", (PyCFunction) _wrap_SerialPort_x_SetParityBit, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_IsStandardRate", (PyCFunction) _wrap_SerialPort_x_IsStandardRate, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_x_swigregister", SerialPort_x_swigregister, METH_VARARGS, NULL}, + { (char *)"new_SerialPort", _wrap_new_SerialPort, METH_VARARGS, NULL}, + { (char *)"delete_SerialPort", _wrap_delete_SerialPort, METH_VARARGS, NULL}, + { (char *)"SerialPort_ChangeLineState", (PyCFunction) _wrap_SerialPort_ChangeLineState, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_ClrLineState", (PyCFunction) _wrap_SerialPort_ClrLineState, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_GetLineState", _wrap_SerialPort_GetLineState, METH_VARARGS, NULL}, + { (char *)"SerialPort_Ioctl", (PyCFunction) _wrap_SerialPort_Ioctl, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_IsOpen", _wrap_SerialPort_IsOpen, METH_VARARGS, NULL}, + { (char *)"SerialPort_Read", (PyCFunction) _wrap_SerialPort_Read, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_SendBreak", (PyCFunction) _wrap_SerialPort_SendBreak, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_SetBaudrate", (PyCFunction) _wrap_SerialPort_SetBaudrate, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_SetLineState", (PyCFunction) _wrap_SerialPort_SetLineState, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_SetParityBit", (PyCFunction) _wrap_SerialPort_SetParityBit, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_Write", (PyCFunction) _wrap_SerialPort_Write, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"SerialPort_swigregister", SerialPort_swigregister, METH_VARARGS, NULL}, + { (char *)"GetKey", _wrap_GetKey, METH_VARARGS, NULL}, + { NULL, NULL, 0, NULL } +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static void *_p_ctb__SerialPort_xTo_p_ctb__IOBase(void *x, int *SWIGUNUSEDPARM(newmemory)) { + return (void *)((ctb::IOBase *) ((ctb::SerialPort_x *) x)); +} +static void *_p_ctb__SerialPortTo_p_ctb__IOBase(void *x, int *SWIGUNUSEDPARM(newmemory)) { + return (void *)((ctb::IOBase *) (ctb::SerialPort_x *) ((ctb::SerialPort *) x)); +} +static void *_p_ctb__SerialPortTo_p_ctb__SerialPort_x(void *x, int *SWIGUNUSEDPARM(newmemory)) { + return (void *)((ctb::SerialPort_x *) ((ctb::SerialPort *) x)); +} +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ctb__IOBase = {"_p_ctb__IOBase", "ctb::IOBase *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ctb__SerialPort = {"_p_ctb__SerialPort", "ctb::SerialPort *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ctb__SerialPort_DCS = {"_p_ctb__SerialPort_DCS", "ctb::SerialPort_DCS *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ctb__SerialPort_EINFO = {"_p_ctb__SerialPort_EINFO", "ctb::SerialPort_EINFO *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ctb__SerialPort_x = {"_p_ctb__SerialPort_x", "ctb::SerialPort_x *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ctb__Timer = {"_p_ctb__Timer", "ctb::Timer *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ctb__timer_control = {"_p_ctb__timer_control", "ctb::timer_control *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_f_p_void__p_void = {"_p_f_p_void__p_void", "void *(*)(void *)", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_int = {"_p_int", "int *|size_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_char, + &_swigt__p_ctb__IOBase, + &_swigt__p_ctb__SerialPort, + &_swigt__p_ctb__SerialPort_DCS, + &_swigt__p_ctb__SerialPort_EINFO, + &_swigt__p_ctb__SerialPort_x, + &_swigt__p_ctb__Timer, + &_swigt__p_ctb__timer_control, + &_swigt__p_f_p_void__p_void, + &_swigt__p_int, + &_swigt__p_p_char, +}; + +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ctb__IOBase[] = { {&_swigt__p_ctb__IOBase, 0, 0, 0}, {&_swigt__p_ctb__SerialPort_x, _p_ctb__SerialPort_xTo_p_ctb__IOBase, 0, 0}, {&_swigt__p_ctb__SerialPort, _p_ctb__SerialPortTo_p_ctb__IOBase, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ctb__SerialPort[] = { {&_swigt__p_ctb__SerialPort, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ctb__SerialPort_DCS[] = { {&_swigt__p_ctb__SerialPort_DCS, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ctb__SerialPort_EINFO[] = { {&_swigt__p_ctb__SerialPort_EINFO, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ctb__SerialPort_x[] = { {&_swigt__p_ctb__SerialPort_x, 0, 0, 0}, {&_swigt__p_ctb__SerialPort, _p_ctb__SerialPortTo_p_ctb__SerialPort_x, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ctb__Timer[] = { {&_swigt__p_ctb__Timer, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ctb__timer_control[] = { {&_swigt__p_ctb__timer_control, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_f_p_void__p_void[] = { {&_swigt__p_f_p_void__p_void, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_char, + _swigc__p_ctb__IOBase, + _swigc__p_ctb__SerialPort, + _swigc__p_ctb__SerialPort_DCS, + _swigc__p_ctb__SerialPort_EINFO, + _swigc__p_ctb__SerialPort_x, + _swigc__p_ctb__Timer, + _swigc__p_ctb__timer_control, + _swigc__p_f_p_void__p_void, + _swigc__p_int, + _swigc__p_p_char, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_const_info swig_const_table[] = { +{0, 0, 0, 0.0, 0, 0}}; + +#ifdef __cplusplus +} +#endif +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned staticly to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int found, init; + + clientdata = clientdata; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + module_head = &swig_module; + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + found=0; + iter=module_head; + do { + if (iter==&swig_module) { + found=1; + break; + } + iter=iter->next; + } while (iter!= module_head); + + /* if the is found in the list, then all is done and we may leave */ + if (found) return; + /* otherwise we must add out module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + /* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + + /* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + + typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; + } swig_globalvar; + + typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; + } swig_varlinkobject; + + SWIGINTERN PyObject * + swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString(""); +#else + return PyString_FromString(""); +#endif + } + + SWIGINTERN PyObject * + swig_varlink_str(swig_varlinkobject *v) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; +#else + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif + return str; + } + + SWIGINTERN int + swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { + char *tmp; + PyObject *str = swig_varlink_str(v); + fprintf(fp,"Swig global variables "); + fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(str); + return 0; + } + + SWIGINTERN void + swig_varlink_dealloc(swig_varlinkobject *v) { + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } + } + + SWIGINTERN PyObject * + swig_varlink_getattr(swig_varlinkobject *v, char *n) { + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + } + return res; + } + + SWIGINTERN int + swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + int res = 1; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + } + return res; + } + + SWIGINTERN PyTypeObject* + swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp + = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* Number of items in variable part (ob_size) */ +#endif + (char *)"swigvarlink", /* Type name (tp_name) */ + sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ + 0, /* Itemsize (tp_itemsize) */ + (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ + (printfunc) swig_varlink_print, /* Print (tp_print) */ + (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ + (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc) swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + varlink_type = tmp; + /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ +#if PY_VERSION_HEX < 0x03000000 + varlink_type.ob_type = &PyType_Type; +#endif + type_init = 1; + } + return &varlink_type; + } + + /* Create a variable linking object for use later */ + SWIGINTERN PyObject * + SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); + } + + SWIGINTERN void + SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + strncpy(gv->name,name,size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; + } + + SWIGINTERN PyObject * + SWIG_globals(void) { + static PyObject *_SWIG_globals = 0; + if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); + return _SWIG_globals; + } + + /* ----------------------------------------------------------------------------- + * constants/methods manipulation + * ----------------------------------------------------------------------------- */ + + /* Install Constants */ + SWIGINTERN void + SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + PyObject *obj = 0; + size_t i; + for (i = 0; constants[i].type; ++i) { + switch(constants[i].type) { + case SWIG_PY_POINTER: + obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d, constants[i].name, obj); + Py_DECREF(obj); + } + } + } + + /* -----------------------------------------------------------------------------*/ + /* Fix SwigMethods to carry the callback ptrs when needed */ + /* -----------------------------------------------------------------------------*/ + + SWIGINTERN void + SWIG_Python_FixMethods(PyMethodDef *methods, + swig_const_info *const_table, + swig_type_info **types, + swig_type_info **types_initial) { + size_t i; + for (i = 0; methods[i].ml_name; ++i) { + const char *c = methods[i].ml_doc; + if (c && (c = strstr(c, "swig_ptr: "))) { + int j; + swig_const_info *ci = 0; + const char *name = c + 10; + for (j = 0; const_table[j].type; ++j) { + if (strncmp(const_table[j].name, name, + strlen(const_table[j].name)) == 0) { + ci = &(const_table[j]); + break; + } + } + if (ci) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + strncpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; + strncpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; + } + } + } + } + } + } + +#ifdef __cplusplus +} +#endif + +/* -----------------------------------------------------------------------------* + * Partial Init method + * -----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" +#endif + +SWIGEXPORT +#if PY_VERSION_HEX >= 0x03000000 +PyObject* +#else +void +#endif +SWIG_init(void) { + PyObject *m, *d; +#if PY_VERSION_HEX >= 0x03000000 + static struct PyModuleDef SWIG_module = { + PyModuleDef_HEAD_INIT, + (char *) SWIG_name, + NULL, + -1, + SwigMethods, + NULL, + NULL, + NULL, + NULL + }; +#endif + + /* Fix SwigMethods to carry the callback ptrs when needed */ + SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); + +#if PY_VERSION_HEX >= 0x03000000 + m = PyModule_Create(&SWIG_module); +#else + m = Py_InitModule((char *) SWIG_name, SwigMethods); +#endif + d = PyModule_GetDict(m); + + SWIG_InitializeModule(0); + SWIG_InstallConstants(d,swig_const_table); + + + SWIG_Python_SetConstant(d, "CTB_RESET",SWIG_From_int(static_cast< int >(ctb::CTB_RESET))); + SWIG_Python_SetConstant(d, "ParityNone",SWIG_From_int(static_cast< int >(ctb::ParityNone))); + SWIG_Python_SetConstant(d, "ParityOdd",SWIG_From_int(static_cast< int >(ctb::ParityOdd))); + SWIG_Python_SetConstant(d, "ParityEven",SWIG_From_int(static_cast< int >(ctb::ParityEven))); + SWIG_Python_SetConstant(d, "ParityMark",SWIG_From_int(static_cast< int >(ctb::ParityMark))); + SWIG_Python_SetConstant(d, "ParitySpace",SWIG_From_int(static_cast< int >(ctb::ParitySpace))); + SWIG_Python_SetConstant(d, "LinestateDcd",SWIG_From_int(static_cast< int >(ctb::LinestateDcd))); + SWIG_Python_SetConstant(d, "LinestateCts",SWIG_From_int(static_cast< int >(ctb::LinestateCts))); + SWIG_Python_SetConstant(d, "LinestateDsr",SWIG_From_int(static_cast< int >(ctb::LinestateDsr))); + SWIG_Python_SetConstant(d, "LinestateDtr",SWIG_From_int(static_cast< int >(ctb::LinestateDtr))); + SWIG_Python_SetConstant(d, "LinestateRing",SWIG_From_int(static_cast< int >(ctb::LinestateRing))); + SWIG_Python_SetConstant(d, "LinestateRts",SWIG_From_int(static_cast< int >(ctb::LinestateRts))); + SWIG_Python_SetConstant(d, "LinestateNull",SWIG_From_int(static_cast< int >(ctb::LinestateNull))); + SWIG_Python_SetConstant(d, "CTB_SER_GETEINFO",SWIG_From_int(static_cast< int >(ctb::CTB_SER_GETEINFO))); + SWIG_Python_SetConstant(d, "CTB_SER_GETBRK",SWIG_From_int(static_cast< int >(ctb::CTB_SER_GETBRK))); + SWIG_Python_SetConstant(d, "CTB_SER_GETFRM",SWIG_From_int(static_cast< int >(ctb::CTB_SER_GETFRM))); + SWIG_Python_SetConstant(d, "CTB_SER_GETOVR",SWIG_From_int(static_cast< int >(ctb::CTB_SER_GETOVR))); + SWIG_Python_SetConstant(d, "CTB_SER_GETPAR",SWIG_From_int(static_cast< int >(ctb::CTB_SER_GETPAR))); + SWIG_Python_SetConstant(d, "CTB_SER_GETINQUE",SWIG_From_int(static_cast< int >(ctb::CTB_SER_GETINQUE))); + SWIG_Python_SetConstant(d, "CTB_SER_SETPAR",SWIG_From_int(static_cast< int >(ctb::CTB_SER_SETPAR))); +#if PY_VERSION_HEX >= 0x03000000 + return m; +#else + return; +#endif +} + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/serportx.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/serportx.i new file mode 100644 index 0000000000..083daddab4 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/serportx.i @@ -0,0 +1,84 @@ +%{ +#include "ctb-0.16/serportx.h" +%} + +%include iobase.i + +namespace ctb { + +enum Parity +{ + ParityNone, + ParityOdd, + ParityEven, + ParityMark, + ParitySpace +}; + +enum SerialLineState +{ + LinestateDcd = 0x040, + LinestateCts = 0x020, + LinestateDsr = 0x100, + LinestateDtr = 0x002, + LinestateRing = 0x080, + LinestateRts = 0x004, + LinestateNull = 0x000 +}; + +struct SerialPort_DCS +{ + int baud; + Parity parity; + unsigned char wordlen; + unsigned char stopbits; + bool rtscts; + bool xonxoff; + char buf[16]; + SerialPort_DCS(); + ~SerialPort_DCS(); + char* GetSettings(); +}; + +struct SerialPort_EINFO +{ + int brk; + int frame; + int overrun; + int parity; + SerialPort_EINFO(); + ~SerialPort_EINFO(); +}; + +enum { + CTB_SER_GETEINFO = CTB_SERIAL, + CTB_SER_GETBRK, + CTB_SER_GETFRM, + CTB_SER_GETOVR, + CTB_SER_GETPAR, + CTB_SER_GETINQUE, + CTB_SER_SETPAR, +}; + +class SerialPort_x : public IOBase +{ +protected: + SerialPort_DCS m_dcs; + char m_devname[SERIALPORT_NAME_LEN]; +public: + SerialPort_x(); + virtual ~SerialPort_x(); + const char* ClassName(); + virtual int ChangeLineState(SerialLineState flags) = 0; + virtual int ClrLineState(SerialLineState flags) = 0; + virtual int GetLineState() = 0; + virtual char* GetSettingsAsString(); + virtual int Ioctl(int cmd,void* args); + virtual int SendBreak(int duration) = 0; + virtual int SetBaudrate(int baudrate) = 0; + virtual int SetLineState(SerialLineState flags) = 0; + virtual int SetParityBit( bool parity ) = 0; + static bool IsStandardRate( long rate ); +}; + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/makepy.bat b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/makepy.bat new file mode 100644 index 0000000000..8320cb9e57 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/makepy.bat @@ -0,0 +1,65 @@ +@ECHO OFF + +REM ################################################################## +REM # set the path/settings of your compiler enviroment and remove the +REM # comment command (REM) +REM # (you don't need this, if you set it always in your system +REM # enviroment) +REM ################################################################## +REM CALL "c:\Programme\Microsoft Visual C++ Toolkit 2003\vcvars32.bat" + +REM ################################################################## +REM # set the path to your python24 (or python23) library, for example +REM # works for me with C:\Program Files\Python2.4\libs\python24.lib +REM ################################################################## +SET PYTHON_LIB="C:\Program Files\Python2.4\libs\python24.lib" + +REM ################################################################## +REM # set the include path of your python24 (python23) deleveloper +REM # header files. For me, it's on C:\Program Files +REM ################################################################## +SET PYTHON_INCLUDE="C:\Program Files\Python2.4\include" + +REM ################################################################## +REM # after installing swig, set the path, so the script can find it +REM ################################################################## +SET SWIG="C:\Program Files\swigwin-1.3.40\swig" + +REM ################################################################## +REM # DON'T CHANGE ANYMORE AT THE FOLLOWING LINES!!! +REM ################################################################## + +SET GPIB_LIB= +SET GPIB_SRC= + +ECHO // This file is created automatically, don't change it! > wxctb.i +ECHO %%module wxctb >> wxctb.i +ECHO typedef int size_t; >> wxctb.i +ECHO %%include timer.i >> wxctb.i +ECHO %%include serport.i >> wxctb.i +ECHO %%include ../kbhit.i >> wxctb.i + +IF NOT [%1]==[USE_GPIB] GOTO nogpib +SET GPIB_LIB=../../../lib/gpib32.lib +SET GPIB_SRC=../../../src/gpib.cpp +ECHO %%include ../gpib.i >> wxctb.i + +:nogpib + + +DEL *.obj wxctb_wrap.cxx *.lib *.dll *.exp + +ECHO "swig generates python wrapper files..." +%SWIG% -c++ -Wall -nodefault -python -keyword -new_repr -modern wxctb.i + +ECHO "create shared library wxctb for python 2.4..." +cl /LD /D WIN32 /I %PYTHON_INCLUDE% /I ../../../include wxctb_wrap.cxx ../../../src/win32/serport.cpp ../../../src/serportx.cpp ../../../src/win32/timer.cpp ../../../src/kbhit.cpp ../../../src/iobase.cpp %GPIB_SRC% ../../../src/fifo.cpp /link %PYTHON_LIB% winmm.lib %GPIB_LIB% + +MOVE wxctb_wrap.dll _wxctb.dll + +ECHO "copy ctb.py, wxctb.py and _wxctb.so to the module/win32 folder..." +MKDIR ..\..\module\win32 +COPY ..\ctb.py ..\..\module\win32 +COPY wxctb.py ..\..\module\win32 +COPY _wxctb.dll ..\..\module\win32 + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/serport.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/serport.i new file mode 100644 index 0000000000..84cb69887c --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/serport.i @@ -0,0 +1,57 @@ +%{ +#include "ctb-0.16/win32/serport.h" +%} + +%include ../serportx.i + +namespace ctb { + +%pythoncode { +COM1 = "com1" +COM2 = "com2" +COM3 = "com3" +COM4 = "com4" +COM5 = "com5" +COM6 = "com6" +COM7 = "com7" +COM8 = "com8" +COM9 = "com9" +COM10 = "\\\\.\\com10" +COM11 = "\\\\.\\com11" +COM12 = "\\\\.\\com12" +COM13 = "\\\\.\\com13" +COM14 = "\\\\.\\com14" +COM15 = "\\\\.\\com15" +COM16 = "\\\\.\\com16" +COM17 = "\\\\.\\com17" +COM18 = "\\\\.\\com18" +COM19 = "\\\\.\\com19" +}; + +class SerialPort : public SerialPort_x +{ +protected: + HANDLE fd; + OVERLAPPED ov; + SerialPort_EINFO einfo; + + int CloseDevice(); + int OpenDevice(const char* devname, void* dcs); +public: + SerialPort(); + ~SerialPort(); + + int ChangeLineState(SerialLineState flags); + int ClrLineState(SerialLineState flags); + int GetLineState(); + int Ioctl(int cmd,void* args); + int IsOpen(); + int Read(char* buf,size_t len); + int SendBreak(int duration); + int SetBaudrate(int baudrate); + int SetLineState(SerialLineState flags); + int SetParityBit( bool parity ); + int Write(char* buf,size_t len); +}; + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/timer.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/timer.i new file mode 100644 index 0000000000..b95f26a0d4 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/timer.i @@ -0,0 +1,39 @@ +%{ +#include "ctb-0.16/win32/timer.h" +%} + +%include cpointer.i + +// lets create new fuctions for pointer handling in python (for int *exitflag) +%pointer_functions(int, intp); + +namespace ctb { + +// perhaps we doesn''t need timer_control to export +// but we need if we want to inherit from timer in python +struct timer_control +{ + unsigned int msecs; + int *exitflag; + MMRESULT stop; + void* (*exitfnc)(void*); +}; + +class Timer +{ +protected: + + DWORD id; + MMRESULT h; + timer_control control; + unsigned int timer_secs; +public: + Timer(unsigned int msec,int* exitflag,void*(*exitfnc)(void*)=NULL); + ~Timer(); + int start(); + int stop(); +}; + +void sleepms(unsigned int ms); + +}; diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/wxctb.i b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/wxctb.i new file mode 100644 index 0000000000..d00350fb03 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/python/src/win32/wxctb.i @@ -0,0 +1,6 @@ +// This file is created automatically, don't change it! +%module wxctb +typedef int size_t; +%include timer.i +%include serport.i +%include ../kbhit.i diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/samples/ctbtest.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/samples/ctbtest.cpp new file mode 100644 index 0000000000..bf84e20ed7 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/samples/ctbtest.cpp @@ -0,0 +1,181 @@ +#include "ctb-0.16/ctb.h" + +#include +#include +#include + +#include +#include + +using namespace std; + +// ----------------- options ------------------------------- +const char* options="a:b:d:e:hlp:t:"; + +const char* helpMessage = +{ + "A simple serial port class test\n" + "ctbtest [options]\n" + "available options are:\n" + "-a : address (only GPIB)\n" + "-b : baudrate [any value], default is 38400\n" + "-d : connected device, default is COM1\n" + "-e : eos\n" + "-h : print this\n" + "-l : list all available serial ports\n" + "-p : protocol like 8N1\n" + "-t : communication timeout in ms (default is 100ms)\n" +}; + +int main(int argc,char* argv[]) +{ + int address = 15; + + int baudrate = 19200; + + string devname = ctb::COM1; + + string eos = "\r\n"; + + string protocol = "8N1"; + + int timeout = 100; + + bool showAvailablePorts = false; + + int quit = 0; + + int val; + + while ( ( val=getopt( argc, argv, (char*)options ) ) != EOF ) { + switch ( val ) { + case 'a' : address = strtol( optarg, NULL, 10 ); break; + case 'b' : baudrate = strtol( optarg, NULL, 10 ); break; + case 'd' : devname = optarg; break; + case 'h' : cerr << helpMessage << endl; exit( 0 ); + case 'l' : showAvailablePorts = true; break; + case 'p' : protocol = optarg; break; + case 't' : timeout = strtol( optarg, NULL, 10 ); break; + } + } + + ctb::IOBase* device = NULL; + + std::vector ports; + + if( ctb::GetAvailablePorts( ports ) && showAvailablePorts ) { + + for( int i = 0; i < ports.size(); + std::cout << ports[ i++ ] << endl ) {}; + + return 0; + + } + + +#if ( GPIB ) + if( ( devname == ctb::GPIB1 ) || ( devname == ctb::GPIB2 ) ) { + + ctb::GpibDevice* gpibDevice = new ctb::GpibDevice(); + + if( gpibDevice->Open( devname.c_str(), address ) >= 0 ) { + + device = gpibDevice; + + } + + } + else { +#endif + + ctb::SerialPort* serialPort = new ctb::SerialPort(); + + if( serialPort->Open( devname.c_str(), baudrate, + protocol.c_str(), + ctb::SerialPort::NoFlowControl ) >= 0 ) { + + device = serialPort; + + } + +#if ( GPIB ) + } +#endif + + if( ! device ) { + + cout << "Cannot open " << devname.c_str() << endl; + + return -1; + + } + + // up to know you don't have to worry any longer about the kind of + // the connected device. As long as you do nothing something device + // specific (like toggle some modem control lines), the access is + // the same for each device. + + string line; + + char receiveBuf[ 128 ]; + + cout << "Enter your command or just press Enter without any\n" + "input for exit!"; + + while( true ) { + + cout << endl << "Your input >"; + + // read the string to send + getline( cin, line ); + + // add some defined EOS (end of string sequence or character) + if( line.empty() ) { + + break; + + } + + line += eos; + + // send data throughout the connected device independent of the typ + if( device->Writev( (char*)line.c_str(), + line.size(), + timeout ) != line.size() ) { + + cerr << "Incomplete data transmission" << endl; + + } + + int readed = 0; + + do { + + // in case of an event driven GUI you better use a non blocking + // Read(...) in your idle function. Here we have to wait for the + // response before we send another user command... + readed = device->Readv( receiveBuf, + sizeof( receiveBuf ) - 1, + timeout); + + // something received? + if( readed > 0 ) { + + receiveBuf[ readed ] = 0; + + cout << receiveBuf; + + } + + } while( readed > 0 ); + + cout << endl; + + } // while( true ) + + device->Close(); + + delete device; + + return 0; +} diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/fifo.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/fifo.cpp new file mode 100644 index 0000000000..c03e320846 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/fifo.cpp @@ -0,0 +1,130 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: fifo.cpp +// Purpose: +// Author: Joachim Buermann, Michael Hungershausen +// Id: $Id$ +// Copyright: (c) 2006,2007 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "ctb-0.16/fifo.h" + +namespace ctb { + + Fifo::Fifo(size_t size) : + m_size(size) + { + m_begin = new char[size]; + m_end = m_begin + m_size; + m_rdptr = m_wrptr = m_begin; + }; + + Fifo::~Fifo() + { + delete m_begin; + }; + + void Fifo::clear() + { + m_rdptr = m_wrptr = m_begin; + }; + + int Fifo::get(char* ch) + { + if(m_rdptr != m_wrptr) { + *ch = *m_rdptr++; + if(m_rdptr >= m_end) { + m_rdptr = m_begin; + } + return 1; + } + return 0; + }; + + size_t Fifo::items() + { + char* tmp_wrptr = m_wrptr; + // the rdptr will only changed by the reader. If we suppose, that + // the caller of the items() method is identical with the reader, + // this should be thread save. + char* tmp_rdptr = m_rdptr; + + // if the write pointer is identical with the read, there are no + // more data in the Fifo + if(tmp_wrptr == tmp_rdptr) { + return 0; + } + // the write pointer is greater as the read pointer, so we just + // can calculate the difference for the remaining data + if(tmp_wrptr > tmp_rdptr) { + return (tmp_wrptr - tmp_rdptr); + } + // the write pointer has circulate and stands against the read + // pointer + else { + return (m_size - (tmp_rdptr - tmp_wrptr)); + } + }; + + int Fifo::put(char ch) + { + // for a thread safe operation, the write of a data byte must be + // atomic. So we first assign the current position of the write + // pointer to a temporary pointer. + // Increment it for the comparison with the end of the internal + // buffer and the read pointer + char* tmp_wrptr = m_wrptr + 1; + if(tmp_wrptr >= m_end) { + tmp_wrptr = m_begin; + } + if(tmp_wrptr == m_rdptr) { + return 0; + } + // this don't changes the write pointer! + *m_wrptr = ch; + // that's the trick! The following assignment is atomic and cannot + // interrupted within a read access by the read thread + m_wrptr = tmp_wrptr; + return 1; + }; + + int Fifo::read(char* data,int n) + { + int nresult = 0; + while(n--) { + // the same as get() + if(m_rdptr != m_wrptr) { + *data = *m_rdptr++; + if(m_rdptr >= m_end) { + m_rdptr = m_begin; + } + } + else { + break; + } + nresult++; + data++; + } + return nresult; + }; + + int Fifo::write(char* data,int n) + { + int nresult = 0; + while(n--) { + // the same as put() + char* tmp_wrptr = m_wrptr + 1; + if(tmp_wrptr >= m_end) { + tmp_wrptr = m_begin; + } + if(tmp_wrptr == m_rdptr) { + break; + } + *m_wrptr = *data++; + m_wrptr = tmp_wrptr; + nresult++; + } + return nresult; + }; + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/getopt.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/getopt.cpp new file mode 100644 index 0000000000..69afb2e7b7 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/getopt.cpp @@ -0,0 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: getopt.cpp +// Purpose: simple wrapper file +// Author: Joachim Buermann +// Id: $Id: timer.h,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined (WIN32) +# include "win32/getopt.cpp" +#endif + + diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/gpib.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/gpib.cpp new file mode 100644 index 0000000000..f6ee5b3d7d --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/gpib.cpp @@ -0,0 +1,338 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gpibx.cpp +// Purpose: +// Author: Joachim Buermann +// Id: $Id: gpibx.cpp,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001,2004 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "ctb-0.16/gpib.h" +#include "ctb-0.16/timer.h" +#include +#include +#ifdef WIN32 +# include "ctb-0.16/win32/gpib-32.h" +# define snprintf _snprintf +#elif __GNUG__ +# include +#endif + +namespace ctb { + + const char* GPIB1 = "gpib1"; + const char* GPIB2 = "gpib2"; + + struct gpibErr_t { + int m_errno; + const char* m_notation; + const char* m_description; + }; + + static gpibErr_t gpibErrors[] = { + {0,"EDVR","DOS Error"}, + {1,"ECIC","Specified GPIB Interface Board is Not Active Controller"}, + {2,"ENOL","No present listing device"}, + {3,"EADR","GPIB Board has not been addressed properly"}, + {4,"EARG","Invalid argument"}, + {5,"ESAC","Specified GPIB Interface Board is not System Controller"}, + {6,"EABO","I/O operation aborted (time-out)"}, + {7,"ENEB","Non-existent GPIB board"}, + {10,"EOIP","Routine not allowed during asynchronous I/O operation"}, + {11,"ECAP","No capability for operation"}, + {12,"EFSO","File System Error"}, + {14,"EBUS","Command byte transfer error"}, + {15,"ESTB","Serial poll status byte lost"}, + {16,"ESQR","SRQ stuck in ON position"}, + {20,"ETAB","Table problem"}, + {247,"EINT","No interrupt configured on board"}, + {248,"EWMD","Windows is not in Enhanced mode"}, + {249,"EVDD","GPIB driver is not installed"}, + {250,"EOVR","Buffer Overflow"}, + {251,"ESML","Two library calls running simultaneously"}, + {252,"ECFG","Board type does not match GPIB.CFG"}, + {253,"ETMR","No Windows timers available"}, + {254,"ESLC","No Windows selectors available"}, + {255,"EBRK","Control-Break pressed"} + }; + + char* Gpib_DCS::GetSettings() + { + const char* to[] = { + "None","10us","30us","100us","300us","1ms","3ms","10ms","30ms", + "100ms","300ms","1s","3s","10s","30s","100s","300s","1000s" + }; + memset(m_buf,0,sizeof(m_buf)); + snprintf(m_buf,sizeof(m_buf)-1,"Adr: (%i,%i) to:%s", + m_address1, + m_address2, + to[m_timeout]); + return m_buf; + }; + + int GpibDevice::CloseDevice() + { + if(m_hd != -1) { + // goto local... + ibloc(m_hd); + // ...and switch device offline + ibonl(m_hd,0); + m_hd = -1; + m_board = -1; + } + return 0; + }; + + const char* GpibDevice::GetErrorString(int error,bool detailed) + { + for(size_t i=0;i<(sizeof(gpibErrors)/sizeof(gpibErr_t));i++) { + if(gpibErrors[i].m_errno == error) { + if(detailed) { + return gpibErrors[i].m_description; + } + else { + return gpibErrors[i].m_notation; + } + } + } + return 0; + }; + +// This is only for internal usage + int GpibDevice::Ibrd(char* buf,size_t len) + { + return ibrd(m_hd,buf,len); + }; + +// This is only for internal usage + int GpibDevice::Ibwrt(char* buf,size_t len) + { + return ibwrt(m_hd,buf,len); + }; + + int GpibDevice::Ioctl(int cmd,void* args) + { + switch(cmd) { + case CTB_RESET: + if(m_hd >= 0) { + ibclr(m_hd); + return 0; + } + return -1; + case CTB_GPIB_GETRSP: { + char spr = 0; + if(m_hd >= 0) { + ibrsp(m_hd,&spr); + *(int*)args = (int)spr; + return 0; + } + return 1; } + case CTB_GPIB_GETSTA: + *(int*)args = m_state; + return 0; + case CTB_GPIB_GETERR: + *(int*)args = m_error; + return 0; + case CTB_GPIB_GETLINES: { + short state = 0; + if(m_hd >= 0) { + iblines(m_board,&state); + *(int*)args = (int)state; + return 0; + } + return -1; } + case CTB_GPIB_SETTIMEOUT: { + if(m_hd >= 0) { + GpibTimeout timeout; + unsigned long to = *(unsigned long*)args; + // convert the timeout in ms (given by args) into the + // traditional NI-488.2 timeout period + if(to > 1000000) timeout = GpibTimeout1000s; + else if(to >= 300000) timeout = GpibTimeout300s; + else if(to >= 100000) timeout = GpibTimeout100s; + else if(to >= 30000) timeout = GpibTimeout30s; + else if(to >= 10000) timeout = GpibTimeout10s; + else if(to >= 3000) timeout = GpibTimeout3s; + else if(to >= 1000) timeout = GpibTimeout1s; + else if(to >= 300) timeout = GpibTimeout300ms; + else if(to >= 100) timeout = GpibTimeout100ms; + else if(to >= 30) timeout = GpibTimeout30ms; + else if(to >= 10) timeout = GpibTimeout10ms; + else if(to >= 3) timeout = GpibTimeout3ms; + else if(to >= 1) timeout = GpibTimeout1ms; + else timeout = GpibTimeoutNone; + ibtmo(m_hd,timeout); + return 0; + } + return -1; } + case CTB_GPIB_GTL: + // Forces the specified device to go to local program mode + if(m_hd >= 0) { + ibloc(m_hd); + return 0; + } + return -1; + case CTB_GPIB_REN: + // This routine can only be used if the specified GPIB + // Interface Board is the System Controller. + // Remember that even though the REN line is asserted, + // the device(s) will not be put into remote state until is + // addressed to listen by the Active Controller + if(m_hd) { + char adr = (char)m_dcs.m_address1; + ibsre(m_board,1); + ibcmd(m_board,&adr,1); + return 0; + } + return -1; + case CTB_GPIB_RESET_BUS: + ibsic(m_board); + return 0; + case CTB_GPIB_GET_EOS_CHAR: + if( m_hd ) { + *(int*)args = (int)m_dcs.m_eosChar; + return 0; + } + return -1; + case CTB_GPIB_SET_EOS_CHAR: +#ifdef __GNUG__ + // FIXME! + // Doesn't work with linux-gpib-3.2.08. All EOS beside 0x00 + // are blocking during sending data to the device. (Look at + // function my_ibwrt in linux-gpib-3.2.08/lib/ibWrt.c + if( m_hd ) { + m_dcs.m_eosChar = (char)*(int*)args; + ibeos(m_hd,(m_dcs.m_eosMode << 8) | m_dcs.m_eosChar); + return 0; + } +#endif + return -1; + case CTB_GPIB_GET_EOS_MODE: + if( m_hd ) { + *(int*)args = (int)m_dcs.m_eosMode; + return 0; + } + return -1; + case CTB_GPIB_SET_EOS_MODE: + if( m_hd ) { + m_dcs.m_eosMode = (char)*(int*)args; + ibeos(m_hd,(m_dcs.m_eosMode << 8) | m_dcs.m_eosChar); + return 0; + } + return -1; + } + // error or unknown command + return -1; + }; + + int GpibDevice::FindListeners(int board) + { + int listeners = 0; + if((unsigned int)board > 1) { + return -1; + } + // reset the GPIB, otherwise no connected device is found (linux) + SendIFC(board); + // list of primary addresses to searching for. Must be terminated + // with NOADDR. + Addr4882_t addrlist[31]; + // The range of valid addresses is 1...30, 0 is reservated by the + // controller, 31 is not valid + for(int i = 0;i < 30; i++) addrlist[i] = (Addr4882_t) i + 1; + addrlist[30] = NOADDR; + // place to store the results + Addr4882_t results[31]; + memset(results,0,sizeof(results)); + FindLstn(board, addrlist, results, 31); + if(ibsta & ERR) { + return -1; + } + for(int i=0;i<=30;i++) { + if(results[i]) { + listeners |= 1 << results[i]; + } + } + return listeners; + }; + + int GpibDevice::Open( const char* devname, int address ) + { + m_dcs.m_address1 = address; + + return OpenDevice( devname, &m_dcs ); + } + + + int GpibDevice::OpenDevice(const char* devname, void* dcs) + { + // if dcs isn't NULL, type cast + if(dcs) m_dcs = *(Gpib_DCS*)dcs; + + if(strncmp(devname,"gpib1",5) == 0) m_board = 0; + else if(strncmp(devname,"gpib2",5) == 0) m_board = 1; + if(m_board < 0) { + return -1; + } + // check for a valid timeout + if((unsigned int)m_dcs.m_timeout > GpibTimeout1000s) { + m_dcs.m_timeout = GpibTimeout10us; + } + + m_hd = ibdev(m_board, + m_dcs.m_address1, + m_dcs.m_address2, + m_dcs.m_timeout, + m_dcs.m_eot, +#ifdef __GNUG__ + // FIXME! + // linux-gpib-3.2.08 doesn't work with any EOS (blocks). + // Because we always has to add an EOS on the message + // (independent of the m_eosChar setting), we can ignore it! + 0 +#else + (m_dcs.m_eosMode << 8) | m_dcs.m_eosChar +#endif + ); + if(m_hd < 0) { + // no gpib controller installed (not found) + return -2; + } + // test for a connected listener (device with given address) + short int listen = 0; + ibln(m_board,m_dcs.m_address1,NO_SAD,&listen); + if(!listen) { + // no listener at the given address + CloseDevice(); + return -3; + } + // reset device + ibclr(m_hd); + // save state, error and count + m_state = ThreadIbsta(); + m_count = ThreadIbcnt(); + m_error = ThreadIberr(); + // no error + return 0; + }; + + int GpibDevice::Read(char* buf,size_t len) + { + // if something is in the fifo, first read that + if(m_fifo->items() > 0) { + return m_fifo->read(buf,len); + } + m_state = ibrd(m_hd,buf,len); + m_error = ThreadIberr(); + m_count = ThreadIbcnt(); + return m_count; + }; + + int GpibDevice::Write(char* buf,size_t len) + { + m_state = ibwrt(m_hd,buf,len); + m_error = ThreadIberr(); + m_count = ThreadIbcnt(); + return m_count; + }; + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/iobase.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/iobase.cpp new file mode 100644 index 0000000000..b92ba4f2d6 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/iobase.cpp @@ -0,0 +1,211 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: iobase.cpp +// Purpose: +// Author: Joachim Buermann +// Id: $Id: iobase.cpp,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include +#include +#include "ctb-0.16/iobase.h" +#include "ctb-0.16/timer.h" + +namespace ctb { + +#define DELTA_BUFSIZE 512 + + int IOBase::Readv(char* buf,size_t len,unsigned int timeout_in_ms) + { + char *cp = buf; + int n = 0; + int timeout = 0; + size_t toread = len; + + Timer t(timeout_in_ms,&timeout,NULL); + if(timeout_in_ms != 0xFFFFFFFF) { + t.start(); + } + + while(!timeout && (toread > 0)) { + if((n = Read(cp,toread)) < 0) { + break; + } + if(!n) { + sleepms(1); + } + toread -= n; + cp += n; + } + // ok, all bytes received + return(len - toread); + }; + +/* + Readv() calls the member function Read() repeatedly, til all + demand bytes were received. To avoid an endless loop, you + can refer an integer, which was set unequal zero after a + specific time. (See the timer class) +*/ + int IOBase::Readv(char* buf,size_t len,int* timeout_flag,bool nice) + { + size_t toread = len; + int n = 0; + char *cp = buf; + + while(toread > 0) { + if(timeout_flag && (*timeout_flag > 0)) { + return (len - toread); + } + if((n = Read(cp,toread)) < 0) { + return (len - toread); + } + if(!n && nice) { + sleepms(1); + } + if (n > 0) + { + toread -= n; + cp += n; + } + } + // ok, all bytes received + return(len - toread); + }; + + int IOBase::ReadUntilEOS(char*& readbuf, + size_t* readedBytes, + char* eosString, + long timeout_in_ms, + char quota) + { + int n = 0; + int timeout = 0; + int bufsize = DELTA_BUFSIZE; + int result = 0; + int quoted = 0; + char* buf = new char[bufsize]; + char* des = buf; + char* eos = eosString; + char ch; + + Timer t(timeout_in_ms,&timeout,NULL); + t.start(); + + while(!timeout) { + if(des >= &buf[bufsize]) { + // buffer full, realloc more memory + char* tmp = new char[bufsize + DELTA_BUFSIZE + 1]; + memcpy(tmp,buf,bufsize); + delete[] buf; + buf = tmp; + des = &buf[bufsize]; + bufsize += DELTA_BUFSIZE; + } + // read next byte + n = Read(&ch,1); + if(n < 0) { + // an error occured + result = -1; + break; + } + else if(n == 0) { + // no data available, give up the processor for some time + // to reduce the cpu last + sleepms(10); + continue; + } + // if eos is composed of more than one char, and the current + // byte doesn't match the next eos character, we handle the + // readed byte as a normal char (and not an eos) + if((eos != eosString) && (ch != *eos)) { + // FIXME! + // write all characters, which was matched the eos string + // until now (with the first wrong character all received + // eos characters are invalid and must handled as normal + // characters). + + // This doesn't work right and is only a little workaround + // because the received eos chars are lost + PutBack(ch); + // because we doesn't match the eos string, we must 'reset' + // the eos match + eos = eosString; + continue; + } + else { + if((ch == *eos) && !quoted) { + if(*++eos == 0) { + // the eos string is complete + result = 1; + break; + } + continue; + } + } + if(ch == quota) { + quoted ^= 1; + } + *des++ = ch; + } + *des = 0; + readbuf = buf; + *readedBytes = des - buf; + return result; + }; + + int IOBase::Writev(char* buf,size_t len,unsigned int timeout_in_ms) + { + char *cp = buf; + int n = 0; + int timeout = 0; + size_t towrite = len; + + Timer t(timeout_in_ms,&timeout,NULL); + if(timeout_in_ms != 0xFFFFFFFF) { + t.start(); + } + + while(!timeout && (towrite > 0)) { + if((n = Write(cp,towrite)) < 0) { + // an error occurs + break; + } + if(!n) { + sleepms(1); + } + towrite -= n; + cp += n; + } + return (len - towrite); + }; + +/* + Similar to Readv(). Writev() calls Write() repeatedly till + all bytes are written. +*/ + int IOBase::Writev(char* buf,size_t len,int* timeout_flag,bool nice) + { + size_t towrite = len; + int n = 0; + char *cp = buf; + + while(towrite > 0) { + if(timeout_flag && (*timeout_flag > 0)) { + return (len - towrite); + } + if((n = Write(cp,towrite)) < 0) { + // an error occurs + return (len - towrite); + } + if(!n && nice) { + sleepms(1); + } + towrite -= n; + cp += n; + } + return(len); + }; + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/kbhit.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/kbhit.cpp new file mode 100644 index 0000000000..4a244ea251 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/kbhit.cpp @@ -0,0 +1,37 @@ +#if defined ( WIN32 ) +# include +#else +# include +# include +#endif + +namespace ctb { + + char GetKey() + { +#if defined ( WIN32 ) + if(_kbhit()) { + return _getch(); + } + return '\0'; +#else + int ch; + static struct termios t, save_t; + tcgetattr(0,&t); + save_t = t; + t.c_lflag &= ~(ICANON); + t.c_cc[VMIN] = 0; + t.c_cc[VTIME] = 0; + tcsetattr(0,TCSANOW,&t); + + ch = fgetc(stdin); + + tcsetattr(0,TCSANOW,&save_t); + if(ch != EOF) { + return ch; + } + return '\0'; +#endif + } + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/linux/serport.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/linux/serport.cpp new file mode 100644 index 0000000000..a369abc5e7 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/linux/serport.cpp @@ -0,0 +1,443 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: linux/serport.cpp +// Purpose: +// Author: Joachim Buermann +// Id: $Id: serport.cpp,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "ctb-0.16/linux/serport.h" + +#include +#include +#include +#include +#include +#include +#include + +#define CMSPAR 010000000000 /* mark or space (stick) parity */ + +namespace ctb { + + const char* COM1 = "/dev/ttyS0"; + const char* COM2 = "/dev/ttyS1"; + const char* COM3 = "/dev/ttyS2"; + const char* COM4 = "/dev/ttyS3"; + const char* COM5 = "/dev/ttyS4"; + const char* COM6 = "/dev/ttyS5"; + const char* COM7 = "/dev/ttyS6"; + const char* COM8 = "/dev/ttyS7"; + const char* COM9 = "/dev/ttyS8"; + const char* COM10 = "/dev/ttyS9"; + const char* COM11= "/dev/ttyS10"; + const char* COM12= "/dev/ttyS11"; + const char* COM13 = "/dev/ttyS12"; + const char* COM14 = "/dev/ttyS13"; + const char* COM15 = "/dev/ttyS14"; + const char* COM16 = "/dev/ttyS15"; + const char* COM17 = "/dev/ttyS16"; + const char* COM18 = "/dev/ttyS17"; + const char* COM19 = "/dev/ttyS18"; + const char* COM20 = "/dev/ttyS19"; + + SerialPort::SerialPort() : + SerialPort_x() + { + fd = -1; + }; + + SerialPort::~SerialPort() + { + Close(); + }; + + speed_t SerialPort::AdaptBaudrate( int baud ) + { + switch(baud) { + case 150: return B150; + case 300: return B300; + case 600: return B600; + case 1200: return B1200; + case 2400: return B2400; + case 4800: return B4800; + case 9600: return B9600; + case 19200: return B19200; + case 57600: return B57600; + case 115200: return B115200; + case 230400: return B230400; + case 460800: return B460800; + case 921600: return B921600; + + // NOTE! The speed of 38400 is required, if you want to set + // an non-standard baudrate. See below! + default: return B38400; + } + }; + + int SerialPort::CloseDevice() + { + int err = 0; + // only close an open file handle + if(fd < 0) return EBADF; + // With some systems, it is recommended to flush the serial port's + // Output before closing it, in order to avoid a possible hang of + // the process... + // Thanks to Germain (I couldn't answer you, because your email + // address was invalid) + tcflush(fd, TCOFLUSH); + + // Don't recover the orgin settings while the device is open. This + // implicate a mismatched data output! + // Just close device + err = close( fd ); + + fd = -1; + + return err; + }; + + int SerialPort::ChangeLineState( SerialLineState flags ) + { + int state; + ioctl(fd,TIOCMGET,&state); + state ^= flags; + return ioctl(fd,TIOCMSET,&state); + }; + + int SerialPort::ClrLineState( SerialLineState flags ) + { + return ioctl(fd,TIOCMBIC,&flags); + }; + + int SerialPort::GetLineState() + { + SerialLineState flags = LinestateNull; + + if( ioctl( fd, TIOCMGET, &flags ) < 0 ) { + + return -1; + + } + return (int)( flags & 0x1FF ); + }; + +// +// included from /usr/include/linux/serial.h +// +// struct serial_icounter_struct { +// int cts, dsr, rng, dcd; +// int rx, tx; +// int frame, overrun, parity, brk; +// int buf_overrun; +// int reserved[9]; +// }; +// + int SerialPort::Ioctl(int cmd, void* args) + { + int count = 0; + int err = 0; + struct serial_icounter_struct info; + SerialPort_EINFO einfo; + + switch(cmd) { + case CTB_RESET: + return SendBreak(0); + case CTB_SER_GETEINFO: + err = ioctl(fd,TIOCGICOUNT,&info); + if(err) return err; + einfo.brk = info.brk - save_info.brk; + einfo.frame = info.frame - save_info.frame; + einfo.overrun = info.overrun - save_info.overrun; + einfo.parity = info.parity - save_info.parity; + *(SerialPort_EINFO*)args = einfo; + break; + case CTB_SER_GETBRK: + err = ioctl(fd,TIOCGICOUNT,&info); + if(err) return err; + if(last_info.brk != info.brk) count = 1; + break; + case CTB_SER_GETFRM: + err = ioctl(fd,TIOCGICOUNT,&info); + if(err) return err; + if(last_info.frame != info.frame) count = 1; + break; + case CTB_SER_GETOVR: + err = ioctl(fd,TIOCGICOUNT,&info); + if(err) return err; + if(last_info.overrun != info.overrun) count = 1; + break; + case CTB_SER_GETPAR: + err = ioctl(fd,TIOCGICOUNT,&info); + if(err) return err; + if(last_info.parity != info.parity) count = 1; + break; + case CTB_SER_GETINQUE: + err = ioctl(fd,TIOCINQ,&count); + if(err) return err; + *(int*)args = count; + return 0; + case CTB_SER_SETPAR: + return SetParityBit( *(int*)args == 1 ); + default: + return -1; + } + last_info = info; + return 0; + }; + + int SerialPort::IsOpen() + { + return (fd != -1); + }; + + int SerialPort::OpenDevice(const char* devname, void* dcs) + { + // if dcs isn't NULL, type cast + if(dcs) m_dcs = *(SerialPort_DCS*)dcs; + // open serial comport device for reading and writing, + // don't wait (O_NONBLOCK) + fd = open(devname, O_RDWR | O_NOCTTY | O_NONBLOCK); + if(fd >= 0) { + + // exclusive use + int dummy; + + ioctl( fd, TIOCEXCL, &dummy ); + + tcgetattr(fd,&t); + save_t = t; + + // save the device name + strncpy(m_devname,(char*)devname,sizeof(m_devname)); + // we write an eos to avoid a buffer overflow + m_devname[sizeof(m_devname)-1] = '\0'; + + // Fill the internal terios struct. + // If the given baudrate is an non-standard one, the AdaptBaudrate + // call returns the linux specific value B38400 which is a + // condition for the later switch to an unusual baudrate! + cfsetspeed(&t, AdaptBaudrate( m_dcs.baud ) ); + + //cfsetospeed(&t, AdaptBaudrate( m_dcs.baud ) ); + + // parity settings + switch( m_dcs.parity ) { + + case ParityNone: + t.c_cflag &= ~PARENB; break; + + case ParityOdd: + t.c_cflag |= PARENB; + t.c_cflag |= PARODD; + break; + + case ParityEven: + t.c_cflag |= PARENB; + t.c_cflag &= ~PARODD; + break; + + case ParityMark: + t.c_cflag |= PARENB | CMSPAR | PARODD; + break; + + case ParitySpace: + t.c_cflag |= PARENB | CMSPAR; + t.c_cflag &= ~PARODD; + break; + } + + // stopbits + if(m_dcs.stopbits == 2) + t.c_cflag |= CSTOPB; + else + t.c_cflag &= ~CSTOPB; + // wordlen + t.c_cflag &= ~CSIZE; + if(m_dcs.wordlen == 7) t.c_cflag |= CS7; + else if(m_dcs.wordlen == 6) t.c_cflag |= CS6; + else if(m_dcs.wordlen == 5) t.c_cflag |= CS5; + // this is the default + else t.c_cflag |= CS8; + // rts/cts + if(m_dcs.rtscts == false) + t.c_cflag &= ~CRTSCTS; + else + t.c_cflag |= CRTSCTS; + + t.c_lflag &= ~(ICANON | ECHO | ISIG | IEXTEN); + t.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON | IXOFF | IXANY); + t.c_iflag |= IGNPAR; + t.c_oflag &= ~OPOST; + + if(m_dcs.xonxoff == true) { + t.c_iflag |= (IXON | IXOFF); + } + + // look out! + // MIN = 1 means, in TIME (1/10 secs) defined timeout + // will be started AFTER receiving the first byte + // so we must set MIN = 0. (timeout starts immediately, abort + // also without readed byte) + t.c_cc[VMIN] = 0; + // timeout in 1/10 secs + // no timeout for non blocked transfer + t.c_cc[VTIME] = 0; + // write the settings + tcsetattr(fd,TCSANOW,&t); + // it's careless, but in the moment we don't test + // the return of tcsetattr (normally there is no error) + + // request the actual numbers of breaks, framing, overrun + // and parity errors (because Linux summing all of them during + // system lifetime, not only while serial port is open. + ioctl(fd,TIOCGICOUNT,&save_info); + // it's also careless, but we assume, that there was no error + last_info = save_info; + + // in case of a non-standard rate, the termios struct have to set + // with the B38400 rate, see above! + if( ! IsStandardRate( m_dcs.baud ) ) { + + SetBaudrateAny( m_dcs.baud ); + + } + } + return fd; + }; + + int SerialPort::Read(char* buf,size_t len) + { + if(m_fifo->items() > 0) { + return m_fifo->read(buf,len); + } + // Read() (using read() ) will return an 'error' EAGAIN as it is + // set to non-blocking. This is not a true error within the + // functionality of Read, and thus should be handled by the caller. + int n = read(fd,buf,len); + if((n < 0) && (errno == EAGAIN)) return 0; + return n; + }; + + int SerialPort::SendBreak(int duration) + { + // the parameter is equal with linux + return tcsendbreak(fd,duration); + }; + + /* + Note: The following hints are copied from the ftdi_sio.c sources of + the kernel modul for the USB to RS232 converter using an FTDI + chipset (FT232BM or similar). Thanks to all those people + contribute code and above all helpful comments to this modul. + */ + + /* + * The logic involved in setting the baudrate can be cleanly split in 3 steps. + * Obtaining the actual baud rate is a little tricky since unix traditionally + * somehow ignored the possibility to set non-standard baud rates. + * 1. Standard baud rates are set in tty->termios->c_cflag + * 2. If these are not enough, you can set any speed using alt_speed as + * follows: + * - set tty->termios->c_cflag speed to B38400 + * - set your real speed in tty->alt_speed; it gets ignored when + * alt_speed==0, (or) + * - call TIOCSSERIAL ioctl with (struct serial_struct) set as follows: + * flags & ASYNC_SPD_MASK == ASYNC_SPD_[HI, VHI, SHI, WARP], this just + * sets alt_speed to (HI: 57600, VHI: 115200, SHI: 230400, WARP: 460800) + * ** Steps 1, 2 are done courtesy of tty_get_baud_rate + * 3. You can also set baud rate by setting custom divisor as follows + * - set tty->termios->c_cflag speed to B38400 + * - call TIOCSSERIAL ioctl with (struct serial_struct) set as follows: + * o flags & ASYNC_SPD_MASK == ASYNC_SPD_CUST + * o custom_divisor set to baud_base / your_new_baudrate + * ** Step 3 is done courtesy of code borrowed from serial.c - I should really + * spend some time and separate+move this common code to serial.c, it is + * replicated in nearly every serial driver you see. + */ + + int SerialPort::SetBaudrateAny( int baudrate ) + { + struct serial_struct ser_info; + + int result = ioctl( fd, TIOCGSERIAL, &ser_info ); + + ser_info.flags = ASYNC_SPD_CUST | ASYNC_LOW_LATENCY; + + ser_info.custom_divisor = ser_info.baud_base / baudrate; + + result = ioctl( fd, TIOCSSERIAL, &ser_info ); + + return result; + } + + int SerialPort::SetBaudrateStandard( int baudrate ) + { + speed_t baud = AdaptBaudrate( baudrate ); + // setting the input baudrate + if(cfsetspeed(&t,baud) < 0) { + return -1; + } + // take over + m_dcs.baud = baudrate; + + tcsetattr(fd,TCSANOW,&t); + + return tcgetattr( fd, &t ); + + }; + + int SerialPort::SetBaudrate( int baudrate ) + { + return IsStandardRate( baudrate ) ? + SetBaudrateStandard( baudrate ) : + SetBaudrateAny( baudrate ); + + } + + int SerialPort::SetLineState( SerialLineState flags ) + { + return ioctl(fd,TIOCMBIS,&flags); + }; + + int SerialPort::SetParityBit( bool parity ) + { + // waits until all output has been transmitted + tcdrain( fd ); + + // now read the current termios settings and manipulate + // the parity + tcgetattr( fd, &t ); + + if( parity ) { + + t.c_cflag |= PARENB | CMSPAR | PARODD; + + } + else { + + t.c_cflag |= PARENB | CMSPAR; + + t.c_cflag &= ~PARODD; + + } + + tcsetattr( fd,TCSANOW, &t ); + + tcgetattr( fd, &t ); + + return 0; + } + + int SerialPort::Write(char* buf,size_t len) + { + // Write() (using write() ) will return an 'error' EAGAIN as it is + // set to non-blocking. This is not a true error within the + // functionality of Write, and thus should be handled by the caller. + int n = write(fd,buf,len); + if((n < 0) && (errno == EAGAIN)) return 0; + return n; + }; + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/linux/timer.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/linux/timer.cpp new file mode 100644 index 0000000000..f1c50f613b --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/linux/timer.cpp @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: linux/timer.cpp +// Purpose: +// Author: Joachim Buermann +// Id: $Id: timer.cpp,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#include "ctb-0.16/timer.h" +#include + +namespace ctb { + +// a dummy function, see below + static void timer_exit(void* arg) + { + }; + + static void* timer_fnc(void* arg) + { + // the timer thread should be canceled every time + // (asyncronously) + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL); + // this is tricky, but absolutly necessarily to avoid segfaults + // if the destructor finished a running thread + pthread_cleanup_push(timer_exit,NULL); + timer_control *tc = (timer_control*)arg; + // linux allows a real sleep, means the timer thread will + // be sleeping (no reduce of the system performance) + usleep(tc->usecs); + // time is over, system reawake the thread. + // if there is an exit function, calling it + if(tc->exitfnc) tc->exitfnc(NULL); + // set the exit flag + if(tc->exitflag) *tc->exitflag = 1; + // deallocate the system resources (thread) + pthread_cleanup_pop(1); + return NULL; + }; + + // the constructor initiate the internal control struct + Timer::Timer( unsigned int msecs, int* exitflag, void*( *exitfnc )(void*) ) + { + control.usecs = msecs * 1000; + control.exitflag = exitflag; + control.exitfnc = exitfnc; + stopped = 1; + }; + + // if a timer instance leave it's valid range, it automaticaly will + // be finished + Timer::~Timer() + { + if(!stopped) { + // only a running thread may be canceled + stop(); + } + }; + + // starts the timer thread + int Timer::start() + { + stopped = 0; + if(pthread_create(&tid, // result parameter, covers the id + // of the new threads + NULL, // thread attribute object, NULL means + // the defaults + timer_fnc, // start function of the thread + &control // start function parameter, must refer + // as void* + ) == -1) { + return -1; // there was something going wrong + } + pthread_detach(tid); // thread status must be "detach". In the other + // case, the destructor call of a running + // thread throws a segfault + return 0; + }; + + // stop the timer thread + int Timer::stop() + { + if(control.exitflag && (*control.exitflag == 0)) { + pthread_cancel(tid); + } + stopped = 1; + return 0; + }; + + void sleepms(unsigned int ms) + { + usleep(ms * 1000); + }; + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/portscan.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/portscan.cpp new file mode 100644 index 0000000000..f13766e9fa --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/portscan.cpp @@ -0,0 +1,109 @@ +#include "ctb-0.16/ctb.h" +#include "ctb-0.16/portscan.h" + +#include + +#ifndef _WIN32 +# include +#endif + +namespace ctb { + + bool GetAvailablePorts( std::vector& result, + bool checkInUse ) + { +#ifdef _WIN32 + + std::stringstream devname; + + for( int i = 1; i < 100; i++ ) { + + devname.clear(); devname.str( "" ); + + // some systems like WinCE doesn't like the extended port numbering... + i < 10 ? devname << "com" << i : devname << "\\\\.\\com" << i; + + COMMCONFIG cc; + + DWORD dwSize = sizeof( cc ); + + if ( ::GetDefaultCommConfig( devname.str().c_str(), &cc, &dwSize ) ) { + + if( cc.dwProviderSubType == PST_RS232 ) { + + ctb::SerialPort com; + + if( com.Open( devname.str().c_str() ) < 0 ) { + + continue; + + } + + result.push_back( devname.str().c_str() ); + + } + } + } + +#else + glob_t globbuf; + + // search for standard serial ports + int res = glob( "/dev/ttyS*", GLOB_ERR, NULL, &globbuf ); + + if( res == 0 ) { + + // no error, glob was successful + for( int i = 0; i < globbuf.gl_pathc; i++ ) { + + if( checkInUse ) { + + ctb::SerialPort com; + + if( com.Open( globbuf.gl_pathv[ i ] ) < 0 ) { + + continue; + + } + + result.push_back( std::string( globbuf.gl_pathv[ i ] ) ); + + } + } + + } + globfree( &globbuf ); + + // search for USB to RS232 converters + res = glob( "/dev/ttyUSB*", GLOB_ERR, NULL, &globbuf ); + + if( res == 0 ) { + + // no error, glob was successful + for( int i = 0; i < globbuf.gl_pathc; i++ ) { + + if( checkInUse ) { + + ctb::SerialPort com; + + if( com.Open( globbuf.gl_pathv[ i ] ) < 0 ) { + + continue; + + } + + result.push_back( std::string( globbuf.gl_pathv[ i ] ) ); + + } + } + + } + + globfree( &globbuf ); +#endif + + return result.size(); + + } + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/serportx.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/serportx.cpp new file mode 100644 index 0000000000..c59bcc002f --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/serportx.cpp @@ -0,0 +1,104 @@ +#include "ctb-0.16/serportx.h" + +#include + +namespace ctb { + + int SerialPort_x::Open( const char* portname, int baudrate, + const char* protocol, + FlowControl flowControl ) + { + SerialPort_DCS dcs; + + dcs.baud = baudrate; + + // default wordlen is 8 + if( ( protocol[ 0 ] >= '5' ) && ( protocol[ 0 ] <= '8' )) { + + dcs.wordlen = protocol[ 0 ] - '0'; + + } + else { + + return -1; + + } + + // protocol is given as a string like "8N1", the first + // character specifies the data bits (5...8), the second + // the parity (None,Odd,Even,Mark,Space). + // The third character defines the stopbit (1...2). + switch( protocol[ 1 ] ) { + case 'N': case 'n': dcs.parity = ParityNone; break; + case 'O': case 'o': dcs.parity = ParityOdd; break; + case 'E': case 'e': dcs.parity = ParityEven; break; + case 'M': case 'm': dcs.parity = ParityMark; break; + case 'S': case 's': dcs.parity = ParitySpace; break; + // all other parameters cause an error! + default: return -1; + } + // default stopbits is 1 + if( ( protocol[ 2 ] >= '1' ) && ( protocol[ 2 ] <= '2' )) { + + dcs.stopbits = protocol[ 2 ] - '0'; + + } + else { + + return -1; + + } + // default flow control is disabled + dcs.rtscts = ( flowControl == RtsCtsFlowControl ); + + dcs.xonxoff = ( flowControl == XonXoffFlowControl ); + + // save the settings in the internal dcs for later use + m_dcs = dcs; + + return OpenDevice( portname, &m_dcs ); + + } + + int SerialPort_x::Open( const int portnumber, int baudrate, + const char* protocol, + FlowControl flowControl ) + { + // portnumbers start with 1 + if( portnumber < 1 ) { + + return -1; + + } + std::stringstream devname; + +#if defined ( WIN32 ) + // some systems like WinCE doesn't like the extended port numbering... + portnumber < 10 ? devname << "com" << portnumber : + devname << "\\\\.\\com" << portnumber; +#else + devname << "/dev/ttyS" << ( portnumber - 1 ); +#endif + + return Open( devname.str().c_str(), baudrate, protocol, flowControl ); + } + + bool SerialPort_x::IsStandardRate( int rate ) + { + const int rates[] = { + 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, + 115200, 230400, 460800, 921600 + }; + + for( unsigned int i = 0; i < ( sizeof( rates ) / sizeof( int ) ); i++ ) { + + if( rate == rates[ i ] ) { + + return true; + + } + } + return false; + } + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/getopt.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/getopt.cpp new file mode 100644 index 0000000000..c8454b9bde --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/getopt.cpp @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: win32/getopt.cpp +// Purpose: +// Author: unknown, I found it in the internet +// Id: $Id: getopt.cpp,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001 ? +// Licence: (I think Open Source) +///////////////////////////////////////////////////////////////////////////// + +#include +#include + +char *optarg; /* Global argument pointer. */ +int optind = 0; /* Global argv index. */ + +static char *scan = NULL; /* Private scan pointer. */ + +/* found char, or NULL if none */ +static char *index(const char* s,char charwanted) +{ + return(strchr((char*)s, charwanted)); +} + +int getopt(int argc, char* argv[], char* optstring) +{ + register char c; + register char *place; + + optarg = NULL; + + if (scan == NULL || *scan == '\0') { + if (optind == 0) + optind++; + + if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') + return(EOF); + if (strcmp(argv[optind], "--")==0) { + optind++; + return(EOF); + } + + scan = argv[optind]+1; + optind++; + } + + c = *scan++; + place = index(optstring, c); + + if (place == NULL || c == ':') { + fprintf(stderr, "%s: unknown option -%c\n", argv[0], c); + return('?'); + } + + place++; + if (*place == ':') { + if (*scan != '\0') { + optarg = scan; + scan = NULL; + } else { + optarg = argv[optind]; + optind++; + } + } + + return(c); +} diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/serport.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/serport.cpp new file mode 100644 index 0000000000..23b50ab32b --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/serport.cpp @@ -0,0 +1,452 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: serport.cpp +// Purpose: +// Author: Joachim Buermann +// Id: $Id: serport.cpp,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $ +// Copyright: (c) 2001 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include +#include "ctb-0.16/serport.h" + +#define SERIALPORT_BUFSIZE 4096 + +namespace ctb { + + const char* COM1 = "com1"; + const char* COM2 = "com2"; + const char* COM3 = "com3"; + const char* COM4 = "com4"; + const char* COM5 = "com5"; + const char* COM6 = "com6"; + const char* COM7 = "com7"; + const char* COM8 = "com8"; + const char* COM9 = "com9"; + const char* COM10 = "\\\\.\\com10"; + const char* COM11 = "\\\\.\\com11"; + const char* COM12 = "\\\\.\\com12"; + const char* COM13 = "\\\\.\\com13"; + const char* COM14 = "\\\\.\\com14"; + const char* COM15 = "\\\\.\\com15"; + const char* COM16 = "\\\\.\\com16"; + const char* COM17 = "\\\\.\\com17"; + const char* COM18 = "\\\\.\\com18"; + const char* COM19 = "\\\\.\\com19"; + const char* COM20 = "\\\\.\\com20"; + + SerialPort::SerialPort() + { + memset( &m_ov, 0, sizeof( OVERLAPPED ) ); + fd = INVALID_HANDLE_VALUE; + m_rtsdtr_state = LinestateNull; + }; + + SerialPort::~SerialPort() + { + Close(); + }; + + int SerialPort::CloseDevice() + { + if(fd != INVALID_HANDLE_VALUE) { + CloseHandle(m_ov.hEvent); + CloseHandle(fd); + fd = INVALID_HANDLE_VALUE; + } + return 0; + }; + + int SerialPort::ChangeLineState( SerialLineState flags ) + { + bool ok = false; + if(flags & LinestateDtr) { + if(m_rtsdtr_state & LinestateDtr) { + ok = EscapeCommFunction(fd,CLRDTR); + } + else { + ok = EscapeCommFunction(fd,SETDTR); + } + m_rtsdtr_state ^= LinestateDtr; + } + if(flags & LinestateRts) { + if(m_rtsdtr_state & LinestateRts) { + ok = EscapeCommFunction(fd,CLRRTS); + } + else { + ok = EscapeCommFunction(fd,SETRTS); + } + m_rtsdtr_state ^= LinestateRts; + } + if(!ok) return -1; + return 0; + }; + + int SerialPort::ClrLineState( SerialLineState flags ) + { + BOOL ok = false; + if(flags & LinestateDtr) { + ok = EscapeCommFunction(fd,CLRDTR); + m_rtsdtr_state &= ~LinestateDtr; + } + if(flags & LinestateRts) { + ok = EscapeCommFunction(fd,CLRRTS); + m_rtsdtr_state &= ~LinestateRts; + } + if(!ok) return -1; + return 0; + }; + + int SerialPort::GetLineState() + { + BOOL ok = false; + DWORD stat; + int flags = 0; + if(GetCommModemStatus(fd,&stat)) { + if(stat & MS_CTS_ON) + flags |= LinestateCts; + if(stat & MS_DSR_ON) + flags |= LinestateDsr; + if(stat & MS_RING_ON) + flags |= LinestateRing; + if(stat & MS_RLSD_ON) + flags |= LinestateDcd; + ok = true; + } + if(!ok) return -1; + return flags; + }; + + int SerialPort::Ioctl(int cmd,void* args) + { + COMSTAT comstat; + DWORD errors; + int result = 0; + bool brk; + switch(cmd) { + case CTB_RESET: + return SendBreak(0); + case CTB_SER_GETEINFO: + if(ClearCommError(fd,&errors,&comstat)) { + // actualize the last events + if(errors & CE_BREAK) einfo.brk++; + if(errors & CE_FRAME) einfo.frame++; + if(errors & CE_OVERRUN) einfo.overrun++; + if(errors & CE_RXPARITY) einfo.parity++; + *(SerialPort_EINFO*)args = einfo; + return 0; + } + case CTB_SER_GETBRK: + if(ClearCommError(fd,&errors,&comstat)) { + if(errors & CE_BREAK) result = 1; + einfo.brk += result; + *(int*)args = result; + return 0; + } + break; + case CTB_SER_GETFRM: + if(ClearCommError(fd,&errors,&comstat)) { + if(errors & CE_FRAME) result = 1; + einfo.frame += result; + *(int*)args = result; + return 0; + } + case CTB_SER_GETOVR: + if(ClearCommError(fd,&errors,&comstat)) { + if(errors & CE_OVERRUN) result = 1; + einfo.overrun += result; + *(int*)args = result; + return 0; + } + break; + case CTB_SER_GETPAR: + if(ClearCommError(fd,&errors,&comstat)) { + if(errors & CE_RXPARITY) result = 1; + einfo.parity += result; + *(int*)args = result; + return 0; + } + break; + case CTB_SER_GETINQUE: + if(ClearCommError(fd,&errors,&comstat)) { + *(int*)args = (int)comstat.cbInQue; + return 0; + } + break; + case CTB_SER_SETPAR: + return SetParityBit( *(int*)args == 1 ); + } + // error or unknown command + return -1; + }; + + int SerialPort::IsOpen() + { + return (fd != INVALID_HANDLE_VALUE); + }; + + int SerialPort::OpenDevice(const char* devname, void* dcs) + { + // if dcs isn't NULL, type cast + if(dcs) m_dcs = *(SerialPort_DCS*)dcs; + + fd = CreateFile(devname, // device name + GENERIC_READ | GENERIC_WRITE, // O_RDWR + 0, // not shared + NULL, // default value for object security ?!? + OPEN_EXISTING, // file (device) exists + FILE_FLAG_OVERLAPPED, // asynchron handling + NULL); // no more handle flags + + if(fd == INVALID_HANDLE_VALUE) { + return -1; + } + // save the device name + strncpy(m_devname,(char*)devname,sizeof(m_devname)); + // we write an eos to avoid a buffer overflow + m_devname[sizeof(m_devname)-1] = '\0'; + + // device control block + DCB dcb; + memset(&dcb,0,sizeof(dcb)); + dcb.DCBlength = sizeof(dcb); + dcb.BaudRate = m_dcs.baud; + dcb.fBinary = 1; + + m_rtsdtr_state = LinestateNull; + + // Specifies whether the CTS (clear-to-send) signal is monitored + // for output flow control. If this member is TRUE and CTS is turned + // off, output is suspended until CTS is sent again. + dcb.fOutxCtsFlow = m_dcs.rtscts; + + // Specifies the DTR (data-terminal-ready) flow control. + // This member can be one of the following values: + // DTR_CONTROL_DISABLE Disables the DTR line when the device is + // opened and leaves it disabled. + // DTR_CONTROL_ENABLE Enables the DTR line when the device is + // opened and leaves it on. + // DTR_CONTROL_HANDSHAKE Enables DTR handshaking. If handshaking is + // enabled, it is an error for the application + // to adjust the line by using the + // EscapeCommFunction function. + dcb.fDtrControl = DTR_CONTROL_DISABLE; + m_rtsdtr_state |= LinestateDtr; + // Specifies the RTS flow control. If this value is zero, the + // default is RTS_CONTROL_HANDSHAKE. This member can be one of + // the following values: + // RTS_CONTROL_DISABLE Disables the RTS line when device is + // opened and leaves it disabled. + // RTS_CONTROL_ENABLED Enables the RTS line when device is + // opened and leaves it on. + // RTS_CONTROL_HANDSHAKE Enables RTS handshaking. The driver + // raises the RTS line when the + // "type-ahead" (input)buffer is less than + // one-half full and lowers the RTS line + // when the buffer is more than three-quarters + // full. If handshaking is enabled, it is an + // error for the application to adjust the + // line by using the EscapeCommFunction function. + // RTS_CONTROL_TOGGLE Specifies that the RTS line will be high if + // bytes are available for transmission. After + // all buffered bytes have been send, the RTS + // line will be low. + if(m_dcs.rtscts) dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; + else { + dcb.fRtsControl = RTS_CONTROL_DISABLE; + m_rtsdtr_state |= LinestateRts; + } + // Specifies the XON/XOFF flow control. + // If fOutX is true (the default is false), transmission stops when the + // XOFF character is received and starts again, when the XON character + // is received. + dcb.fOutX = m_dcs.xonxoff; + // If fInX is true (default is false), the XOFF character is sent when + // the input buffer comes within XoffLim bytes of being full, and the + // XON character is sent, when the input buffer comes within XonLim + // bytes of being empty. + dcb.fInX = m_dcs.xonxoff; + // default character for XOFF is 0x13 (hex 13) + dcb.XoffChar = 0x13; + // default character for XON is 0x11 (hex 11) + dcb.XonChar = 0x11; + // set the minimum number of bytes allowed in the input buffer before + // the XON character is sent (3/4 of full size) + dcb.XonLim = (SERIALPORT_BUFSIZE >> 2) * 3; + // set the maximum number of free bytes in the input buffer, before the + // XOFF character is sent (3/4 of full size) + dcb.XoffLim = (SERIALPORT_BUFSIZE >> 2) * 3; + + // parity + switch( m_dcs.parity ) { + + case ParityOdd: dcb.Parity = ODDPARITY; break; + case ParityEven: dcb.Parity = EVENPARITY; break; + case ParityMark: dcb.Parity = MARKPARITY; break; + case ParitySpace: dcb.Parity = SPACEPARITY; break; + default: dcb.Parity = NOPARITY; + + } + // stopbits + if(m_dcs.stopbits == 2) dcb.StopBits = TWOSTOPBITS; + else dcb.StopBits = ONESTOPBIT; + // wordlen, valid values are 5,6,7,8 + dcb.ByteSize = m_dcs.wordlen; + + if(!SetCommState(fd,&dcb)) + return -2; + + // create event for overlapped I/O + // we need a event object, which inform us about the + // end of an operation (here reading device) + m_ov.hEvent = CreateEvent(NULL,// LPSECURITY_ATTRIBUTES lpsa + TRUE, // BOOL fManualReset + TRUE, // BOOL fInitialState + NULL); // LPTSTR lpszEventName + if(m_ov.hEvent == INVALID_HANDLE_VALUE) { + return -3; + } + + /* THIS IS OBSOLETE!!! + // event should be triggered, if there are some received data + if(!SetCommMask(fd,EV_RXCHAR)) + return -4; + */ + + COMMTIMEOUTS cto = {MAXDWORD,0,0,0,0}; + if(!SetCommTimeouts(fd,&cto)) + return -5; + + // for a better performance with win95/98 I increased the internal + // buffer to SERIALPORT_BUFSIZE (normal size is 1024, but this can + // be a little bit to small, if you use a higher baudrate like 115200) + if(!SetupComm(fd,SERIALPORT_BUFSIZE,SERIALPORT_BUFSIZE)) + return -6; + + // clear the internal error struct + memset(&einfo,0,sizeof(einfo)); + return 0; + }; + + int SerialPort::Read(char* buf,size_t len) + { + DWORD read; + int m = m_fifo->items(); + while(len) { + if(m_fifo->get(buf) == 1) { + len--; + buf++; + } + else { + break; + } + } + if(!ReadFile(fd,buf,len,&read,&m_ov)) { + // if we use a asynchrone reading, ReadFile gives always + // FALSE + // ERROR_IO_PENDING means ok, other values show an error + if(GetLastError() != ERROR_IO_PENDING) { + // oops..., error in communication + return -1; + } + } + else { + // ok, we have read all wanted bytes + return (int)read + m; + } + return 0; + }; + + int SerialPort::SendBreak(int duration) + { + if(duration <= 0) duration = 1; + if(!SetCommBreak(fd)) return -1; + // win32 Sleep parameter is ms + Sleep(duration * 250); + if(!ClearCommBreak(fd)) return -1; + // no error + return 0; + }; + +/* + FIXME! : We need some additional code to check the success of the + baudrate modulation (non-standard rates depend on the used + UART chipset). +*/ + int SerialPort::SetBaudrate( int baudrate ) + { + DCB dcb; + + // get the current dcb... + if(!GetCommState(fd,&dcb)) { + return -1; + } + dcb.BaudRate = baudrate; + // and write it back + if(!SetCommState(fd,&dcb)) { + return -1; + } + m_dcs.baud = baudrate; + return 0; + } + + int SerialPort::SetLineState( SerialLineState flags ) + { + BOOL ok = false; + if(flags & LinestateDtr) { + ok = EscapeCommFunction(fd,SETDTR); + // save the new state + m_rtsdtr_state |= LinestateDtr; + } + if(flags & LinestateRts) { + ok = EscapeCommFunction(fd,SETRTS); + // save the new state + m_rtsdtr_state |= LinestateRts; + } + if(!ok) return -1; + return 0; + }; + + int SerialPort::SetParityBit( bool parity ) + { + DCB dcb; + + if( ! GetCommState( fd, &dcb ) ) { + + return -1; + + } + + parity ? dcb.Parity = MARKPARITY : dcb.Parity = SPACEPARITY; + + if( ! SetCommState( fd, &dcb ) ) { + + return -2; + + } + return 0; + } + + int SerialPort::Write(char* buf,size_t len) + { + DWORD write; + if(!WriteFile(fd,buf,len,&write,&m_ov)) { + if(GetLastError() != ERROR_IO_PENDING) { + return -1; + } + else { + // VERY IMPORTANT to flush the data out of the internal + // buffer + FlushFileBuffers(fd); + // first you must call GetOverlappedResult, then you + // get the REALLY transmitted count of bytes + if(!GetOverlappedResult(fd,&m_ov,&write,TRUE)) { + // ooops... something is going wrong + return (int)write; + } + } + } + return write; + }; + +} // namespace ctb diff --git a/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/timer.cpp b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/timer.cpp new file mode 100644 index 0000000000..617aa5b5ad --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/libctb-0.16/src/win32/timer.cpp @@ -0,0 +1,85 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: win32/timer.cpp +// Purpose: +// Author: Joachim Buermann +// Id: $Id: timer.cpp,v 1.2 2004/11/30 12:39:17 jb Exp $ +// Copyright: (c) 2001 Joachim Buermann +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include +#include + +#ifdef WIN32 +#include +# ifndef DWORD_PTR +# define DWORD_PTR DWORD* +# endif +#endif + +#include "ctb-0.16/timer.h" + +namespace ctb { + + static void WINAPI timer_fnc(UINT uTimerID, + UINT uMsg, + DWORD_PTR dwUser, + DWORD_PTR dw1, + DWORD_PTR dw2) + { + timer_control *tc = (timer_control*)dwUser; + + if(tc->exitfnc) tc->exitfnc(NULL); + if(tc->exitflag) *tc->exitflag = 1; + tc->stop = 0; + }; + + Timer::Timer(unsigned int msecs,int* exitflag,void*(*exitfnc)(void*)) + { + control.msecs = msecs; + if(!control.msecs) control.msecs = 1; + control.exitflag = exitflag; + control.exitfnc = exitfnc; + control.stop = 0; + }; + + Timer::~Timer() + { + stop(); // stop the thread + }; + + int Timer::start() + { + stop(); + control.stop = timeSetEvent(control.msecs, + (control.msecs > 10) ? 5 : 1, + (LPTIMECALLBACK) timer_fnc, + (DWORD) &control, + TIME_ONESHOT | TIME_CALLBACK_FUNCTION); + return 0; + }; + + int Timer::stop() + { + if (control.stop) + timeKillEvent(control.stop); + control.stop = 0; + return 0; + }; + + void kill_all_timer() + { + }; + + void sleepms(unsigned int ms) + { + // set the granularity of Sleep() for the application, that + // calls it so Sleep(1) will truly sleep for just a millisecond, + // rather than the default 10! + // See: http://www.geisswerks.com/ryan/FAQS/timing.html + timeBeginPeriod(1); + SleepEx(ms,false); + timeEndPeriod(1); + }; + +} // namespace ctb