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

#Python Serial Port Extension for Win32, Linux, BSD, Jython
#see __init__.py
#
#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt

 
Classes
       
exceptions.Exception
SerialException
SerialTimeoutException
__builtin__.object
FileLike
SerialBase

 
class FileLike(__builtin__.object)
    An abstract file like class.
 
This class implements readline and readlines based on read and
writelines based on write.
This class is used to provide the above functions for to Serial
port objects.
 
Note that when the serial port was opened with _NO_ timeout that
readline blocks until it sees a newline (or the specified size is
reached) and that readlines would never return and therefore
refuses to work (it raises an exception in this case)!
 
  Methods defined here:
flush(self)
flush of file like objects
read(self, size)
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
write(self, s)
writelines(self, sequence)
xreadlines(self, sizehint=None)
just call readlines - here for compatibility

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

 
class SerialBase(FileLike)
    Serial port base class. Provides __init__ function and properties to
get/set port settings.
 
 
Method resolution order:
SerialBase
FileLike
__builtin__.object

Methods defined here:
__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 defined here:
baudrate
get = getBaudrate(self)
set = setBaudrate(self, baudrate)
delete = 'Baudrate setting'
bytesize
get = getByteSize(self)
set = setByteSize(self, bytesize)
delete = 'Byte size setting'
parity
get = getParity(self)
set = setParity(self, parity)
delete = 'Parity setting'
port
get = getPort(self)
set = setPort(self, port)
delete = 'Port setting'
rtscts
get = getRtsCts(self)
set = setRtsCts(self, rtscts)
delete = 'RTS/CTS setting'
stopbits
get = getStopbits(self)
set = setStopbits(self, stopbits)
delete = 'Stopbits setting'
timeout
get = getTimeout(self)
set = setTimeout(self, timeout)
delete = 'Timeout setting for read()'
writeTimeout
get = getWriteTimeout(self)
set = setWriteTimeout(self, timeout)
delete = 'Timeout setting for write()'
xonxoff
get = getXonXoff(self)
set = setXonXoff(self, xonxoff)
delete = 'Xon/Xoff setting'

Data and other attributes defined here:
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 FileLike:
flush(self)
flush of file like objects
read(self, size)
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
write(self, s)
writelines(self, sequence)
xreadlines(self, sizehint=None)
just call readlines - here for compatibility

Data and other attributes inherited from 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)

 
class SerialException(exceptions.Exception)
    Base class for serial port related exceptions.
 
  Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class SerialTimeoutException(SerialException)
    Write timeouts give an exception
 
 
Method resolution order:
SerialTimeoutException
SerialException
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
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
XOFF = '\x13'
XON = '\x11'
portNotOpenError = <serialutil.SerialException instance>
writeTimeoutError = <serialutil.SerialTimeoutException instance>