Beispiel #1
0
        private void OpenSerialInput(string COMPort, int BaudRate, int NumberOfChannels)
        {
            if (Input != null)
            {
                Input.Stop();
            }

            if (COMPort == null || COMPort == "")
            {
                ShowError("Illegal COM Port name: " + COMPort);
                return;
            }

            SerialInput SerialInput = null;

            try
            {
                SerialInput = new SerialInput();
                SerialInput.Connect(COMPort, BaudRate, NumberOfChannels);
            }
            catch (Exception ex)
            {
                if (SerialInput != null)
                {
                    SerialInput.Stop();
                }

                ShowError("Unable to open Serial Port " + COMPort + "\n" + ex.Message);
                return;
            }

            Input = SerialInput;
            Input.Start();
        }
Beispiel #2
0
        private void OpenSerialInput(string COMPort, int BaudRate, int NumberOfChannels)
        {
            if (Input != null)
                Input.Stop();

            if (COMPort == null || COMPort == "")
            {
                ShowError("Illegal COM Port name: " + COMPort);
                return;
            }

            SerialInput SerialInput = null;
            try
            {
                SerialInput = new SerialInput();
                SerialInput.Connect(COMPort, BaudRate, NumberOfChannels);
            }
            catch (Exception ex)
            {
                if (SerialInput != null)
                    SerialInput.Stop();

                ShowError("Unable to open Serial Port " + COMPort + "\n" + ex.Message);
                return;
            }

            Input = SerialInput;
            Input.Start();
        }