示例#1
0
        private void Scan_DTC_from_UI(KWP_2000_Process kwp2000)
        {
            // CheckBox lut of UI must be listed accroding to its byte/bit index.

            uint byte_bit_index;

            byte_bit_index = 0;
            foreach (var item in abs_lut)
            {
                if (item.Checked == true)
                {
                    // If CheckBox is checked, treat it as Lamp_ON_Failure_Set
                    kwp2000.ABS_DTC_Queue_Add(ABS_DTC_Table.Find_ABS_DTC((byte_bit_index / 8), (byte_bit_index % 8)), KWP_2000_Process.Lamp_ON_Failure_Set);
                }
                byte_bit_index++;
            }

            byte_bit_index = 0;
            foreach (var item in obd_lut)
            {
                if (item.Checked == true)
                {
                    // If CheckBox is checked, treat it as Lamp_ON_Failure_Set
                    kwp2000.OBD_DTC_Queue_Add(OBD_DTC_Table.Find_OBD_DTC((byte_bit_index / 8), (byte_bit_index % 8)), KWP_2000_Process.Lamp_ON_Failure_Set);
                }
                byte_bit_index++;
            }
        }
示例#2
0
        //
        private void Use_Random_DTC(KWP_2000_Process kwp2000)
        {
            Random rs = new Random();
            Byte   DTC_no;

            DTC_no = (byte)(rs.Next(10));
            DTC_no = (byte)((DTC_no <= KWP_2000_Process.ReadDiagnosticCodesByStatus_MaxNumberOfDTC) ? DTC_no : 0);
            for (int no = 0; no < DTC_no; no++)
            {
                CMD_E_ABS_DTC random_dtc = ABS_DTC_Table.Find_ABS_DTC(rs.Next(ABS_DTC_Table.Count()));
                kwp2000.ABS_DTC_Queue_Add(random_dtc, (byte)kwp2000.dtc_status_table[rs.Next(kwp2000.dtc_status_table.Length)]);
            }
            // for OBD
            DTC_no = (byte)(rs.Next(10));
            DTC_no = (byte)((DTC_no <= KWP_2000_Process.ReadDiagnosticCodesByStatus_MaxNumberOfDTC) ? DTC_no : 0);
            for (int no = 0; no < DTC_no; no++)
            {
                CMD_F_OBD_DTC random_dtc = OBD_DTC_Table.Find_OBD_DTC(rs.Next(OBD_DTC_Table.Count()));
                kwp2000.OBD_DTC_Queue_Add(random_dtc, (byte)kwp2000.dtc_status_table_for_obd[rs.Next(kwp2000.dtc_status_table_for_obd.Length)]);
            }
        }