private void PortOptionsUpdate(ISerialPortOptions options) { _serialPort.PortName = options.Address; _serialPort.BaudRate = (int)options.BaudRate; _serialPort.Parity = (System.IO.Ports.Parity)options.Parity; _serialPort.DataBits = options.DataBits; _serialPort.StopBits = (System.IO.Ports.StopBits)options.StopBits; _serialPort.ParityReplace = options.ParityReplace; _serialPort.DiscardNull = options.DiscardNull; _serialPort.DtrEnable = options.DtrEnable; _serialPort.Handshake = (System.IO.Ports.Handshake)options.Handshake; _serialPort.ReadBufferSize = options.ReadBufferSize; _serialPort.ReadTimeout = options.ReadTimeout; _serialPort.ReceivedBytesThreshold = options.ReceivedBytesThreshold; _serialPort.RtsEnable = options.RtsEnable; _serialPort.WriteBufferSize = options.WriteBufferSize; _serialPort.WriteTimeout = options.WriteTimeout; }
public SerialPort(ISerialPortOptions options, Action <object, IOptionsBase> onOptionsUpdate) : base(options, onOptionsUpdate) { OptionsUpdate += PortOptionsUpdate; _serialPort = new System.IO.Ports.SerialPort(options.Address); }
public SerialPort(ISerialPortOptions options) : this(options, null) { }