diff options
Diffstat (limited to 'pyserial/serial')
-rw-r--r-- | pyserial/serial/serialjava.py | 4 | ||||
-rw-r--r-- | pyserial/serial/serialposix.py | 4 | ||||
-rw-r--r-- | pyserial/serial/sermsdos.py | 28 |
3 files changed, 11 insertions, 25 deletions
diff --git a/pyserial/serial/serialjava.py b/pyserial/serial/serialjava.py index a0d48a6..c199d82 100644 --- a/pyserial/serial/serialjava.py +++ b/pyserial/serial/serialjava.py @@ -8,7 +8,7 @@ import sys, os, string, javax.comm import serialutil -VERSION = string.split("$Revision: 1.6 $")[1] #extract CVS version +VERSION = string.split("$Revision: 1.7 $")[1] #extract CVS version PARITY_NONE, PARITY_EVEN, PARITY_ODD, PARITY_MARK, PARITY_SPACE = (0,1,2,3,4) STOPBITS_ONE, STOPBITS_TWO, STOPBITS_ONE_HALVE = (1, 2, 3) @@ -36,7 +36,7 @@ class Serial(serialutil.FileLike): bytesize=EIGHTBITS, #number of databits parity=PARITY_NONE, #enable parity checking stopbits=STOPBITS_ONE, #number of stopbits - timeout=None, #set a timeout value, None for waiting forever + timeout=None, #set a timeout value, None to wait forever xonxoff=0, #enable software flow control rtscts=0, #enable RTS/CTS flow control ): diff --git a/pyserial/serial/serialposix.py b/pyserial/serial/serialposix.py index ff4cd39..855ee30 100644 --- a/pyserial/serial/serialposix.py +++ b/pyserial/serial/serialposix.py @@ -12,7 +12,7 @@ import sys, os, fcntl, termios, struct, string, select import serialutil -VERSION = string.split("$Revision: 1.15 $")[1] #extract CVS version +VERSION = string.split("$Revision: 1.16 $")[1] #extract CVS version PARITY_NONE, PARITY_EVEN, PARITY_ODD = range(3) STOPBITS_ONE, STOPBITS_TWO = (1, 2) @@ -136,7 +136,7 @@ class Serial(serialutil.FileLike): bytesize=EIGHTBITS, #number of databits parity=PARITY_NONE, #enable parity checking stopbits=STOPBITS_ONE, #number of stopbits - timeout=None, #set a timeout value, None for waiting forever + timeout=None, #set a timeout value, None to wait forever xonxoff=0, #enable software flow control rtscts=0, #enable RTS/CTS flow control ): diff --git a/pyserial/serial/sermsdos.py b/pyserial/serial/sermsdos.py index c16d1bd..a516118 100644 --- a/pyserial/serial/sermsdos.py +++ b/pyserial/serial/sermsdos.py @@ -38,6 +38,7 @@ import os import sys import string +import serialutil BAUD_RATES = { 110: "11", @@ -59,10 +60,10 @@ FIVEBITS, SIXBITS, SEVENBITS, EIGHTBITS = (5,6,7,8) RETURN_NONE) = ('E', 'B', 'P', 'R', 'N') portNotOpenError = ValueError('port not open') -class SerialException(Exception): - pass +def device(portnum): + return 'COM%d' % (portnum+1) -class Serial: +class Serial(serialutil.FileLike): """ port: number of device; numbering starts at zero. if everything fails, the user can @@ -94,7 +95,7 @@ class Serial: self.portstr = port else: #numbers are transformed to a string - self.portstr = 'COM%d' % (port+1) + self.portstr = device(port+1) self.baud = BAUD_RATES[baudrate] self.bytesize = str(bytesize) @@ -141,7 +142,7 @@ class Serial: raise NotImplementedError def read(self, num = 1): - "Read num bytes from serial port" + """Read num bytes from serial port""" handle = os.open(self.portstr, os.O_RDONLY | os.O_BINARY) # print os.fstat(handle) @@ -150,7 +151,7 @@ class Serial: return rv def write(self, s): - "Write string to serial port" + """Write string to serial port""" handle = os.open(self.portstr, os.O_WRONLY | os.O_BINARY) rv = os.write(handle, s) @@ -190,21 +191,6 @@ class Serial: """Eead terminal status line""" raise NotImplementedError - def readline(self, size=None): - raise NotImplementedError - - def readlines(self, sizehint=None): - raise NotImplementedError - - def xreadlines(self, sizehint=None): - raise NotImplementedError - - def writelines(self, sequence): - raise NotImplementedError - - def flush(self): - raise NotImplementedError - def __repr__(self): return string.join(( "<Serial>: ", self.portstr , self.baud, self.parity, self.bytesize, self.stop, |