Пример #1
0
        /// <summary>
        /// open the serial connection to the target device
        /// </summary>
        /// <param name="serialPortName">the serial port to connect with</param>
        public void Open(string serialPortName)
        {
            // init and open port
            DB($"opening serial port at {serialPortName} with {BRN_BAUD_RATE} baud...");
            serial = new SerialPortWrapper(serialPortName, BRN_BAUD_RATE);
            serial.RegisterHandlers();
            serial.Open();

            // check port is now open
            if (!serial.IsOpen)
            {
                throw new InvalidOperationException("Serial port could not be opened!");
            }
        }