public SerialPortByteStreamHandlerSettings( string portName, int baudRate = 9600, int dataBits = 8, StopBits stopBits = StopBits.One, Handshake handshake = Handshake.None, int readTimeout = -1, int writeTimeout = -1, Parity parity = Parity.None, bool dtrEnable = false, bool rtsEnable = false, ReconnectWaitTimeGetter?reconnectWaitTimeGetter = null) { this.PortName = portName; this.BaudRate = baudRate; this.DataBits = dataBits; this.StopBits = stopBits; this.Handshake = handshake; this.ReadTimeout = readTimeout; this.WriteTimeout = writeTimeout; this.Parity = parity; this.DtrEnable = dtrEnable; this.RtsEnable = rtsEnable; this.ReconnectWaitTimeGetter = reconnectWaitTimeGetter ?? new FixedReconnectWaitTimeGetter(TimeSpan.FromSeconds(1.0)); }
public SerialPortByteStreamHandler( string portName, int baudRate, int dataBits, StopBits stopBits, Handshake handshake, int readTimeout, int writeTimeout, Parity parity, bool dtrEnable, bool rtsEnable, ReconnectWaitTimeGetter reconnectWaitTimeGetter) { _portName = portName; _baudRate = baudRate; _dataBits = dataBits; _stopBits = stopBits; _handshake = handshake; _readTimeout = readTimeout; _writeTimeout = writeTimeout; _parity = parity; _dtrEnable = dtrEnable; _rtsEnable = rtsEnable; this.ReconnectWaitTimeGetter = reconnectWaitTimeGetter; _receiveBuffer = new byte[1024]; _startStopLock = new object(); }