[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