serialposix
index
/home/optics/pyserial-2.1/serial/serialposix.py

#Python Serial Port Extension for Win32, Linux, BSD, Jython
#module for serial IO for POSIX compatible systems, like Linux
#see __init__.py
#
#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt
#
#parts based on code from Grant B. Edwards  <grante@visi.com>:
#  ftp://ftp.visi.com/users/grante/python/PosixSerial.py
# references: http://www.easysw.com/~mike/serial/serial.html

 
Modules
       
fcntl
termios
fcntl
os
select
struct
sys
termios

 
Classes
       
serialutil.SerialBase(serialutil.FileLike)
Serial

 
class Serial(serialutil.SerialBase)
    Serial port class POSIX implementation. Serial port configuration is 
done with termios and fcntl. Runs on Linux and many other Un*x like
systems.
 
 
Method resolution order:
Serial
serialutil.SerialBase
serialutil.FileLike
__builtin__.object

Methods defined here:
close(self)
Close port
drainOutput(self)
internal - not portable!
flush(self)
Flush of file like objects. In this case, wait until all data
is written.
flushInput(self)
Clear input buffer, discarding all that is in the buffer.
flushOutput(self)
Clear output buffer, aborting the current output and
discarding all that is in the buffer.
getCD(self)
Read terminal status line: Carrier Detect
getCTS(self)
Read terminal status line: Clear To Send
getDSR(self)
Read terminal status line: Data Set Ready
getRI(self)
Read terminal status line: Ring Indicator
inWaiting(self)
Return the number of characters currently in the input buffer.
makeDeviceName(self, port)
nonblocking(self)
internal - not portable!
open(self)
Open port with current settings. This may throw a SerialException
if the port cannot be opened.
read(self, size=1)
Read size bytes from the serial port. If a timeout is set it may
return less characters as requested. With no timeout it will block
until the requested number of bytes is read.
sendBreak(self)
Send break condition.
setDTR(self, on=1)
Set terminal status line: Data Terminal Ready
setRTS(self, on=1)
Set terminal status line: Request To Send
write(self, data)
Output the given string over the serial port.

Methods inherited from serialutil.SerialBase:
__init__(self, port=None, baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=0, rtscts=0, writeTimeout=None)
Initialize comm port object. If a port is given, then the port will be
opened immediately. Otherwise a Serial port object in closed state
is returned.
__repr__(self)
String representation of the current port settings and its state.
getBaudrate(self)
Get the current baudrate setting.
getByteSize(self)
Get the current byte size setting.
getParity(self)
Get the current parity setting.
getPort(self)
Get the current port setting. The value that was passed on init or using
setPort() is passed back. See also the attribute portstr which contains
the name of the port as a string.
getRtsCts(self)
Get the current RtsCts setting.
getStopbits(self)
Get the current stopbits setting.
getSupportedBaudrates(self)
getSupportedByteSizes(self)
getSupportedParities(self)
getSupportedStopbits(self)
getTimeout(self)
Get the current timeout setting.
getWriteTimeout(self)
Get the current timeout setting.
getXonXoff(self)
Get the current XonXoff setting.
isOpen(self)
Check if the port is opened.
setBaudrate(self, baudrate)
Change baudrate. It raises a ValueError if the port is open and the
baudrate is not possible. If the port is closed, then tha value is
accepted and the exception is raised when the port is opened.
setByteSize(self, bytesize)
Change byte size.
setParity(self, parity)
Change parity setting.
setPort(self, port)
Change the port. The attribute portstr is set to a string that
contains the name of the port.
setRtsCts(self, rtscts)
Change RtsCts setting.
setStopbits(self, stopbits)
Change stopbits size.
setTimeout(self, timeout)
Change timeout setting.
setWriteTimeout(self, timeout)
Change timeout setting.
setXonXoff(self, xonxoff)
Change XonXoff setting.

Properties inherited from serialutil.SerialBase:
baudrate
get = getBaudrate(self)
Get the current baudrate setting.
set = setBaudrate(self, baudrate)
Change baudrate. It raises a ValueError if the port is open and the
baudrate is not possible. If the port is closed, then tha value is
accepted and the exception is raised when the port is opened.
delete = 'Baudrate setting'
bytesize
get = getByteSize(self)
Get the current byte size setting.
set = setByteSize(self, bytesize)
Change byte size.
delete = 'Byte size setting'
parity
get = getParity(self)
Get the current parity setting.
set = setParity(self, parity)
Change parity setting.
delete = 'Parity setting'
port
get = getPort(self)
Get the current port setting. The value that was passed on init or using
setPort() is passed back. See also the attribute portstr which contains
the name of the port as a string.
set = setPort(self, port)
Change the port. The attribute portstr is set to a string that
contains the name of the port.
delete = 'Port setting'
rtscts
get = getRtsCts(self)
Get the current RtsCts setting.
set = setRtsCts(self, rtscts)
Change RtsCts setting.
delete = 'RTS/CTS setting'
stopbits
get = getStopbits(self)
Get the current stopbits setting.
set = setStopbits(self, stopbits)
Change stopbits size.
delete = 'Stopbits setting'
timeout
get = getTimeout(self)
Get the current timeout setting.
set = setTimeout(self, timeout)
Change timeout setting.
delete = 'Timeout setting for read()'
writeTimeout
get = getWriteTimeout(self)
Get the current timeout setting.
set = setWriteTimeout(self, timeout)
Change timeout setting.
delete = 'Timeout setting for write()'
xonxoff
get = getXonXoff(self)
Get the current XonXoff setting.
set = setXonXoff(self, xonxoff)
Change XonXoff setting.
delete = 'Xon/Xoff setting'

Data and other attributes inherited from serialutil.SerialBase:
BAUDRATES = (50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, ...)
BYTESIZES = (5, 6, 7, 8)
PARITIES = ('N', 'E', 'O')
STOPBITS = (1, 2)

Methods inherited from serialutil.FileLike:
readline(self, size=None, eol='\n')
read a line which is terminated with end-of-line (eol) character
        ('
' by default) or until timeout
readlines(self, sizehint=None, eol='\n')
read a list of lines, until timeout
sizehint is ignored
writelines(self, sequence)
xreadlines(self, sizehint=None)
just call readlines - here for compatibility

Data and other attributes inherited from serialutil.FileLike:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'FileLike' objects>
list of weak references to the object (if defined)

 
Data
        EIGHTBITS = 8
FIVEBITS = 5
PARITY_EVEN = 'E'
PARITY_NAMES = {'E': 'Even', 'N': 'None', 'O': 'Odd'}
PARITY_NONE = 'N'
PARITY_ODD = 'O'
SEVENBITS = 7
SIXBITS = 6
STOPBITS_ONE = 1
STOPBITS_TWO = 2
TIOCINQ = 21531
TIOCMBIC = 21527
TIOCMBIS = 21526
TIOCMGET = 21525
TIOCMSET = 21528
TIOCM_CAR = 64
TIOCM_CD = 64
TIOCM_CTS = 32
TIOCM_DSR = 256
TIOCM_DTR = 2
TIOCM_DTR_str = '\x02\x00\x00\x00'
TIOCM_RI = 128
TIOCM_RNG = 128
TIOCM_RTS = 4
TIOCM_RTS_str = '\x04\x00\x00\x00'
TIOCM_zero_str = '\x00\x00\x00\x00'
VERSION = '1.23'
XOFF = '\x13'
XON = '\x11'
plat = 'linux2'
portNotOpenError = <serialutil.SerialException instance>
writeTimeoutError = <serialutil.SerialTimeoutException instance>