ctb
index
/mnt/s/wxaddons/wxctb-0.9/SWIG/ctb.py

 
Modules
       
re
sys
wxctb

 
Classes
       
wxIOBase
wxGPIB
wxSerialPort

 
class wxGPIB(wxIOBase)
    wxGPIB class
 
  Methods defined here:
GetError(self)
GetSTB(self)
Returns the value of the internal GPIB status byte register.
Ibrd(self, length)
# This is only for internal usage!!!
Ibwrt(self, string)
# This is only for internal usage!!!
Open(self, devname, adr)
Open(gpibdevice,address)
Opens a connected device at the GPIB bus. gpibdevice means the
controller, (mostly "gpib1"), address the address of the desired
device in the range 1...31. For example:
dev = wxGPIB()
dev.Open("gpib1",17)
Opens the device with the address 17.
Open returns >= 0 or a negativ value, if something going wrong.
Reset(self)
Resets the connected device. In the GPIB definition, the device
should be reset to it's initial state, so you can restart a
formely lost communication.
ResetBus(self)
The command asserts the GPIB interface clear (IFC) line for
ast least 100us if the GPIB board is the system controller.
This initializes the GPIB and makes the interface CIC and
active controller with ATN asserted.
Note! The IFC signal resets only the GPIB interface functions
of the bus devices and not the internal device functions.
For a device reset you should use the Reset() command above.
__del__(self)
__init__(self)

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

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

 
class wxSerialPort(wxIOBase)
     Methods defined here:
ChangeLineState(self, lineState)
Change (toggle) the state of each the lines given in the
linestate parameter. Possible values are wxSERIAL_LINESTATE_DTR
(means the DTR signal) and/or wxSERIAL_LINESTATE_RTS (RTS signal).
For example to toggle the RTS line only:
dev.ChangeLineState(wxSERIAL_LINESTATE_RTS)
ClrLineState(self, lineState)
Clear the lines given in the linestate parameter. Possible
values are wxSERIAL_LINESTATE_DTR (means the DTR signal) and/or
wxSERIAL_LINESTATE_RTS (RTS signal). For example to clear only
the RTS line:
dev.ClrLineState(wxSERIAL_LINESTATE_RTS)
GetAvailableBytes(self)
Returns the available bytes in the input queue of the serial
driver.
GetCommErrors(self)
Get the internal communication errors like breaks, framing,
parity or overrun errors.
Returns the count of each error as a tuple like this:
(b,f,o,p) = dev.GetCommErrors()
b: breaks, f: framing errors,  o: overruns, p: parity errors
GetLineState(self)
Returns the current linestates of the CTS, DCD, DSR and RING
signal line as an integer value with the appropriate bits or
-1 on error.
For example:
lines = dev.GetLineState()
if lines & wxSERIAL_LINESTATE_CTS:
    print "CTS is on"
Open(self, devname, baudrate, protocol='8N1', handshake='no_handshake')
Open the device devname with the given baudrate, the protocol
like '8N1' (default) and the use of the handshake [no_handshake
(default), rtscts or xonxoff]
For example:
At Linux:
dev = wxSerialPort()
dev.Open("/dev/ttyS0",115200)
or with a datalen of 7 bits, even parity, 2 stopbits and rts/cts
handshake:
dev.Open("/dev/ttyS0",115200,'7E2',True)
At Windows:
dev = wxSerialPort()
dev.Open("COM1",115200)
dev.Open("COM1",115200,'7E2',True)
Returns the handle on success or a negativ value on failure.
Reset(self)
Send a break for 0.25s.
SetBaudRate(self, baudrate)
Set the baudrate for the device.
SetLineState(self, lineState)
Set the lines given in the linestate parameter. Possible
values are wxSERIAL_LINESTATE_DTR (means the DTR signal) and/or
wxSERIAL_LINESTATE_RTS (RTS signal). For example to set both:
dev.SetLineState(wxSERIAL_LINESTATE_DTR | wxSERIAL_LINESTATE_RTS)
__del__(self)
__init__(self)

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

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

 
Data
        wxSERIAL_LINESTATE_CTS = 32
wxSERIAL_LINESTATE_DCD = 64
wxSERIAL_LINESTATE_DSR = 256
wxSERIAL_LINESTATE_DTR = 2
wxSERIAL_LINESTATE_NULL = 0
wxSERIAL_LINESTATE_RING = 128
wxSERIAL_LINESTATE_RTS = 4