Skip to content

Setting a new baudrate with SetPort(...) doesn't work #18

Description

Hi All,

I tried to set a new baudrate with SetPort() methode, but it doesn't work.
Indeed, SetPort() test if a change occured for portName only, but not the other parameters.
I suggest the following changes

public void SetPort(string portName, int baudRate = 115200, StopBits stopBits = StopBits.One, Parity parity = Parity.None, DataBits dataBits = DataBits.Eight)
{
	if (_portName != portName || _baudRate != baudRate || stopBits != _stopBits || parity != _parity || dataBits != _dataBits)
	{
		// set to error so that the connection watcher will reconnect
		// using the new port
		gotReadWriteError = true;
		logger.Trace("Port parameter changed (port name / baudrate / stopbits / parity / databits) = " + portName + " / " + baudRate + " / " + stopBits + " / " + parity + " / " + dataBits);
	}
	_portName = portName;
	_baudRate = baudRate;
	_stopBits = stopBits;
	_parity = parity;
	_dataBits = dataBits;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions