Exemple #1
0
        private void buttonSetBaudRate_Click(object sender, EventArgs e)
        {
            byte fBaud = (byte)comboBoxBaud.SelectedIndex;

            if (fBaud > 2)
            {
                fBaud = (byte)(fBaud + 2);
            }
            try
            {
                ErrorsCatcher.errorName = RWDev.SetBaudRate(ref RWDev.comAddress, fBaud, RWDev.frmComPortIndex);
                if (ErrorsCatcher.errorName != 0)
                {
                    string strLog = "Set baud rate failed " + ErrorsCatcher.GetReturnCodeDesc(ErrorsCatcher.errorName) + Environment.NewLine;
                    richTextBoxLogs.AppendText(strLog);
                    return;
                }
                else
                {
                    string strLog = "Set baud rate success" + Environment.NewLine;
                    richTextBoxLogs.AppendText(strLog);
                }
            }
            catch
            {
                richTextBoxLogs.AppendText("Set baud rate failed" + Environment.NewLine);
            }
        }