コード例 #1
0
        public void Dispose()
        {
            if (SerialPortAgent == null)
            {
                return;
            }

            if (SerialPortAgent.IsOpen)
            {
                Close();
            }

            SerialPortAgent.Dispose();
        }
コード例 #2
0
        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();
        }