Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();
            m_obdInterface = new OBDInterface();
            m_obdInterface.OnConnect += new OBDInterface.__Delegate_OnConnect(On_OBD2_Connect);
            m_obdInterface.OnDisconnect += new OBDInterface.__Delegate_OnDisconnect(On_OBD2_Disconnect);
            if (m_obdInterface.GetActiveProfile() != null)
                panelVehicle.Text = m_obdInterface.GetActiveProfile().ToString();

            if (m_obdInterface.GetCommSettings() != null)
            {
                if (m_obdInterface.GetCommSettings().AutoDetect)
                    panelComPort.Text = "Auto-Detect";
                else
                    panelComPort.Text = "COM" + m_obdInterface.GetCommSettings().ComPort.ToString();
            }
            SetDescriptiveToolTips();
            m_formStart = new CommForm(m_obdInterface);
            m_formMonitorTests = new TestForm(m_obdInterface);
            m_formDTC = new DTCForm(m_obdInterface);
            m_formFreezeFrames = new FreezeFramesForm(m_obdInterface);
            m_formOxygenSensors = new OxygenSensorsForm(m_obdInterface);
            m_formSensorGrid = new SensorMonitorForm(m_obdInterface);
            m_formSensorChart = new ScopeForm(m_obdInterface);
            m_formTrack = new TrackForm(m_obdInterface);
            m_formDyno = new DynoForm(m_obdInterface);
            m_formFuelEconomy = new FuelEconomyForm(m_obdInterface);
            m_formTerminal = new TerminalForm(m_obdInterface);
            m_formReport = new ReportGeneratorForm(m_obdInterface);
            m_formCommLog = new CommLogForm();
            toolBarButtonStart.Pushed = true;
            SetActiveForm(m_formStart);
        }
Beispiel #2
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            comboProfile.Enabled      = false;
            btnManageProfiles.Enabled = false;
            btnConnect.Enabled        = false;
            btnDisconnect.Enabled     = true;
            picCheck1.Image           = picBlankBox.Image;
            picCheck2.Image           = picBlankBox.Image;
            picCheck3.Image           = picBlankBox.Image;
            picCheck4.Image           = picBlankBox.Image;
            m_obdInterface.SaveActiveProfile((VehicleProfile)comboProfile.SelectedItem);
            m_obdInterface.logItem("ProScan v5.9");
            m_obdInterface.logItem("Connection Procedure Initiated");
            if (m_obdInterface.GetCommSettings().AutoDetect)
            {
                m_obdInterface.logItem("   Automatic Hardware Detection: ON");
            }
            else
            {
                m_obdInterface.logItem("   Automatic Hardware Detection: OFF");
            }
            int    baudRate = m_obdInterface.GetCommSettings().BaudRate;
            string strMsg   = string.Format("   Baud Rate: {0}", baudRate);

            m_obdInterface.logItem(strMsg);
            string str2 = string.Format("   Default Port: {0}", m_obdInterface.GetCommSettings().ComPortName);

            m_obdInterface.logItem(str2);
            switch (m_obdInterface.GetCommSettings().HardwareIndex)
            {
            case 0:
                m_obdInterface.logItem("   Interface: Auto-Detect");
                break;

            case 1:
                m_obdInterface.logItem("   Interface: ELM327");
                break;

            case 2:
                m_obdInterface.logItem("   Interface: ELM320");
                break;

            case 3:
                m_obdInterface.logItem("   Interface: ELM322");
                break;

            case 4:
                m_obdInterface.logItem("   Interface: ELM323");
                break;
            }
            string[] strArray      = new string[] { "Automatic", "SAE J1850 PWM (41.6 Kbaud)", "SAE J1850 VPW (10.4 Kbaud)", "ISO 9141-2 (5 baud init, 10.4 Kbaud)", "ISO 14230-4 KWP (5 baud init, 10.4 Kbaud)", "ISO 14230-4 KWP (fast init, 10.4 Kbaud)", "ISO 15765-4 CAN (11 bit ID, 500 Kbaud)", "ISO 15765-4 CAN (29 bit ID, 500 Kbaud)", "ISO 15765-4 CAN (11 bit ID, 250 Kbaud)", "ISO 15765-4 CAN (29 bit ID, 250 Kbaud)" };
            int      protocolIndex = m_obdInterface.GetCommSettings().ProtocolIndex;
            string   str           = string.Format("   Protocol: {0}", strArray[protocolIndex]);

            m_obdInterface.logItem(str);
            if (m_obdInterface.GetCommSettings().DoInitialization)
            {
                m_obdInterface.logItem("   Initialize: YES");
            }
            else
            {
                m_obdInterface.logItem("   Initialize: NO");
            }
            ThreadPool.QueueUserWorkItem(new WaitCallback(ConnectThreadNew));
        }