Beispiel #1
0
        private void SettingsForm_Load(object sender, EventArgs e)
        {
            try
            {
                for (int iComPort = 0; iComPort < 50; ++iComPort)
                {
                    if (CommBase.isPortAvailable(iComPort))
                    {
                        comboPorts.Items.Add("COM" + iComPort.ToString());
                    }
                }

                if (CommBase.isPortAvailable(m_preferences.ComPort))
                {
                    comboPorts.SelectedItem = m_preferences.ComPortName;
                }
                else if (comboPorts.Items.Count > 0)
                {
                    comboPorts.SelectedIndex = 0;
                }

                comboHardware.SelectedIndex = m_preferences.HardwareIndexInt;
                comboBaud.SelectedIndex     = m_preferences.BaudRateIndex;

                foreach (string item in Preferences.ProtocolNames)
                {
                    comboProtocol.Items.Add(item);
                }

                comboProtocol.SelectedIndex   = m_preferences.ProtocolIndexInt;
                comboInitialize.SelectedIndex = !m_preferences.DoInitialization ? 1 : 0;
                if (m_preferences.AutoDetect)
                {
                    checkBoxAutoDetect.Checked = true;
                }
                else
                {
                    checkBoxAutoDetect.Checked = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
        public override bool Initialize()
        {
            try
            {
                if (m_CommELM.Online)
                {
                    return(true);
                }

                for (int iPort = 0; iPort < 100; ++iPort)
                {
                    if (CommBase.IsPortAvailable(iPort) == CommBase.PortStatus.Available &&
                        (Initialize(iPort, 38400) || Initialize(iPort, 115200) || Initialize(iPort, 9600))
                        )
                    {
                        return(true);
                    }
                }
            }
            catch { }
            return(false);
        }
Beispiel #3
0
 public void setRxTerminator(CommBase.ASCII chr)
 {
     OBDCommELM.m_asciiRxTerm = chr;
 }
Beispiel #4
0
 public void SetStandard(string Port, int Baud, CommBase.Handshake Hs)
 {
     dataBits = 8;
     stopBits = CommBase.StopBits.one;
     parity = CommBase.Parity.none;
     port = Port;
     baudRate = Baud;
     switch (Hs)
     {
         case CommBase.Handshake.none:
             txFlowCTS = false;
             txFlowDSR = false;
             txFlowX = false;
             rxFlowX = false;
             useRTS = CommBase.HSOutput.online;
             useDTR = CommBase.HSOutput.online;
             txWhenRxXoff = true;
             rxGateDSR = false;
             break;
         case CommBase.Handshake.XonXoff:
             txFlowCTS = false;
             txFlowDSR = false;
             txFlowX = true;
             rxFlowX = true;
             useRTS = CommBase.HSOutput.online;
             useDTR = CommBase.HSOutput.online;
             txWhenRxXoff = true;
             rxGateDSR = false;
             XonChar = CommBase.ASCII.DC1;
             XoffChar = CommBase.ASCII.DC3;
             break;
         case CommBase.Handshake.CtsRts:
             txFlowCTS = true;
             txFlowDSR = false;
             txFlowX = false;
             rxFlowX = false;
             useRTS = CommBase.HSOutput.handshake;
             useDTR = CommBase.HSOutput.online;
             txWhenRxXoff = true;
             rxGateDSR = false;
             break;
         case CommBase.Handshake.DsrDtr:
             txFlowCTS = false;
             txFlowDSR = true;
             txFlowX = false;
             rxFlowX = false;
             useRTS = CommBase.HSOutput.online;
             useDTR = CommBase.HSOutput.handshake;
             txWhenRxXoff = true;
             rxGateDSR = false;
             break;
     }
 }
Beispiel #5
0
 protected virtual void OnStatusChange(CommBase.ModemStatus mask, CommBase.ModemStatus state)
 {
 }