Exemple #1
0
        public void UpdateTests()
        {
            progressBar.Minimum     = 0;
            progressBar.Maximum     = 25;
            gridConTests.Visible    = false;
            gridNonConTests.Visible = false;
            OBDParameterValue value;

            value             = m_obd2Interface.getValue("SAE.MISFIRE_SUPPORT", true);
            progressBar.Value = 1;
            TestStatus status = m_arrayListConTests[0] as TestStatus;

            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.MISFIRE_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.FUEL_SUPPORT", true);
            progressBar.Value = 2;
            status            = m_arrayListConTests[1] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.FUEL_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.CCM_SUPPORT", true);
            progressBar.Value = 3;
            status            = m_arrayListConTests[2] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.CCM_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.CAT_SUPPORT", true);
            progressBar.Value = 4;
            status            = m_arrayListNonConTests[0] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.CAT_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.HCAT_SUPPORT", true);
            progressBar.Value = 5;
            status            = m_arrayListNonConTests[1] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.HCAT_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.EVAP_SUPPORT", true);
            progressBar.Value = 6;
            status            = m_arrayListNonConTests[2] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.EVAP_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.AIR_SUPPORT", true);
            progressBar.Value = 7;
            status            = m_arrayListNonConTests[3] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.AIR_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.AC_SUPPORT", true);
            progressBar.Value = 8;
            status            = m_arrayListNonConTests[4] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.AC_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.O2_SUPPORT", true);
            progressBar.Value = 9;
            status            = m_arrayListNonConTests[5] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.O2_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.O2HTR_SUPPORT", true);
            progressBar.Value = 10;
            status            = m_arrayListNonConTests[6] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.O2HTR_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            value             = m_obd2Interface.getValue("SAE.EGR_SUPPORT", true);
            progressBar.Value = 11;
            status            = m_arrayListNonConTests[7] as TestStatus;
            if (!value.ErrorDetected)
            {
                if (!value.BoolValue)
                {
                    status.Status = "Not Supported";
                }
                else
                {
                    value = m_obd2Interface.getValue("SAE.EGR_STATUS", true);
                    if (!value.ErrorDetected)
                    {
                        status.Status = value.BoolValue ? "Complete" : "Incomplete";
                    }
                    else
                    {
                        status.Status = "ERROR";
                    }
                }
            }
            else
            {
                status.Status = "ERROR";
            }

            gridConTests.Visible    = true;
            gridNonConTests.Visible = true;
            if (m_obd2Interface.isParameterSupported("SAE.FUEL1_STATUS"))
            {
                value = m_obd2Interface.getValue("SAE.FUEL1_STATUS", true);
                progressBar.Value++;
                lblFuel1.Text = value.ErrorDetected ? "ERROR" : value.StringValue;
            }
            else
            {
                lblFuel1.Text = "Not Supported";
            }

            if (m_obd2Interface.isParameterSupported("SAE.FUEL2_STATUS"))
            {
                value = m_obd2Interface.getValue("SAE.FUEL2_STATUS", true);
                progressBar.Value++;
                lblFuel2.Text = value.ErrorDetected ? "ERROR" : value.StringValue;
            }
            else
            {
                lblFuel2.Text = "Not Supported";
            }

            if (m_obd2Interface.isParameterSupported("SAE.PTO_STATUS"))
            {
                value = m_obd2Interface.getValue("SAE.PTO_STATUS", true);
                progressBar.Value++;
                lblPTO.Text = value.ErrorDetected ? "ERROR" : value.StringValue;
            }
            else
            {
                lblPTO.Text = "Not Supported";
            }

            if (m_obd2Interface.isParameterSupported("SAE.SECAIR_STATUS"))
            {
                value = m_obd2Interface.getValue("SAE.SECAIR_STATUS", true);
                progressBar.Value++;
                lblAir.Text = value.ErrorDetected ? "ERROR" : value.StringValue;
            }
            else
            {
                lblAir.Text = "Not Supported";
            }

            if (m_obd2Interface.isParameterSupported("SAE.OBD_TYPE"))
            {
                value = m_obd2Interface.getValue("SAE.OBD_TYPE", true);
                progressBar.Value++;
                lblOBD.Text = value.ErrorDetected ? "ERROR" : value.StringValue;
            }
            else
            {
                lblOBD.Text = "Not Supported";
            }

            string str = "";

            if (m_obd2Interface.isParameterSupported("SAE.O2B1S1A_PRESENT"))
            {
                value = m_obd2Interface.getValue("SAE.O2B1S1A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 1 Sensor 1\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B1S2A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 1 Sensor 2\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B1S3A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 1 Sensor 3\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B1S4A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 1 Sensor 4\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B2S1A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 2 Sensor 1\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B2S2A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 2 Sensor 2\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B2S3A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 2 Sensor 3\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B2S4A_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 2 Sensor 4\n";
                }
            }

            if (m_obd2Interface.isParameterSupported("SAE.O2B1S1B_PRESENT"))
            {
                value = m_obd2Interface.getValue("SAE.O2B1S1B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 1 Sensor 1\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B1S2B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 1 Sensor 2\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B2S1B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 2 Sensor 1\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B2S2B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 2 Sensor 2\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B3S1B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 3 Sensor 1\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B3S2B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 3 Sensor 2\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B4S1B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 4 Sensor 1\n";
                }

                value = m_obd2Interface.getValue("SAE.O2B4S2B_PRESENT", true);
                progressBar.Value++;
                if (!value.ErrorDetected && value.BoolValue)
                {
                    str = str + "Bank 4 Sensor 2\n";
                }
            }
            lblOxygen.Text = str;
            progressBar.Value++;
            if (m_obd2Interface.getDevice() == 1)
            {
                value = m_obd2Interface.getValue("ELM.BATTERY_VOLTAGE", true);
                if (!value.ErrorDetected)
                {
                    lblBattery.Text = value.DoubleValue.ToString() + " V";
                }
            }
            else
            {
                lblBattery.Text = "Not Supported";
            }
            progressBar.Value = progressBar.Maximum;
        }