예제 #1
0
    def __init__(self, device, baud=9600, timeout=0.1, bufflen=1000,
                 verbose=True):
        InputBuffer.__init__(self, bufflen, verbose)

        # Open the serial connection
        self.connection = serial.Serial(device, baud, timeout=timeout)
        self.logger.log("SerialBuffer: connected to %s" % device,
                        color=TimedLogger.CYAN)
예제 #2
0
파일: SocketBuffer.py 프로젝트: HMTL/HMTL
    def __init__(self, address, port,
                 timeout=0.1, bufflen=1000,
                 verbose=True):
        InputBuffer.__init__(self, bufflen, verbose)

        self.address = (address, port)

        # Open the serial connection
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        # TODO: The timeout argument is from SerialBuffer, where the timeout is
        # for a particular serial.read() call.  This should do something similar
        self.sock.settimeout(30)
        self.sock.connect(self.address)

        self.logger.log("SocketBuffer: connected to %s:%d" % self.address,
                        color=TimedLogger.CYAN)
예제 #3
0
 def __init__(self, bufflen=1000, verbose=True):
     InputBuffer.__init__(self, bufflen, verbose)
예제 #4
0
 def stop(self):
     self.connection.close()
     InputBuffer.stop()