public void Dispose() { if (SerialPortAgent == null) { return; } if (SerialPortAgent.IsOpen) { Close(); } SerialPortAgent.Dispose(); }
public void Open(Transport configuration) { if (IsOpen) { throw new InvalidOperationException("The port is already open."); } if (SerialPortAgent != null) { SerialPortAgent.Dispose(); SerialPortAgent = null; } SerialPortAgent = new SerialPortAgent(configuration); Open(); }