コード例 #1
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     // We can add a port if there is one free
     if (slavePortsList.Count < CustomDefs.MAX_NB_OF_SLAVE_PORTS - 1)
     {
         SlavePort slavePort   = new SlavePort(mux);
         int       iPortNumber = 1 + GetLastPortNumberInList();
         slavePort.serialPort.PortName = "COM" + iPortNumber;
         slavePortsList.Add(slavePort);
         SortPortsInBoxes();
         // Select the new port to edit it
         comboBoxSlavePortEdit.SelectedIndex = comboBoxSlavePortEdit.Items.Count - 1;
     }
 }
コード例 #2
0
 private void DisplayPortCharacteristics()
 {
     if (iSelectedPortIndex >= 0)
     {
         SlavePort slavePort = slavePortsList[iSelectedPortIndex];
         textBoxSlavePortName.Text                = slavePort.serialPort.PortName;
         comboBoxSlaveLinkType.Text               = slavePort.GetLinkType();
         numericUpDownSlavePortBaudrate.Value     = slavePort.serialPort.BaudRate;
         comboBoxSlavePortEofDetection.Text       = slavePort.eofDetection;
         numericUpDownSlavePortTimeout.Value      = slavePort.GetPacketTimeoutValue();
         numericUpDownSlavePortPacketLength.Value = slavePort.iPacketLength;
     }
     else
     {
         TraceLogger.ErrorTrace("iSelectedPortIndex is empty");
     }
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: ehnet247/UartMuxDemux
        private void LoadSlavePortsList()
        {
            slavePortsList = new List <SlavePort>();
            for (int iPortIndex = 0; iPortIndex < CustomDefs.MAX_NB_OF_SLAVE_PORTS - 1; iPortIndex++)
            {
                string strStoredPortName = Settings.Default.aSlavePortsNames[iPortIndex];
                if (strStoredPortName.StartsWith("COM"))
                {
                    SlavePort NewSp = new SlavePort(mux);
                    NewSp.serialPort.PortName = Settings.Default.aSlavePortsNames[iPortIndex];
                    NewSp.SetLinkType(Settings.Default.aSlavePortsLinkType[iPortIndex]);
                    NewSp.eofDetection = Settings.Default.aSlavePortsEoFDetectionMode[iPortIndex];
                    NewSp.SetPacketTimeoutValue(Convert.ToInt32(Settings.Default.aSlavePortsTimeout[iPortIndex]));
                    NewSp.iPacketLength = Convert.ToInt32(Settings.Default.aSlavePortsPacketLength[iPortIndex]);

                    slavePortsList.Add(NewSp);
                }
            }
            TraceLogger.EventTrace("SlavePortsList loaded");
        }