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)
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)
def __init__(self, bufflen=1000, verbose=True): InputBuffer.__init__(self, bufflen, verbose)
def stop(self): self.connection.close() InputBuffer.stop()