Exemplo n.º 1
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)]);
            }
        }
Exemplo n.º 2
0
        public void OBD_DTC_Queue_Add(CMD_F_OBD_DTC new_dtc, byte lamp_status)
        {
            uint dtc = (uint)new_dtc.DTC;

            OBD_DTC_Data_Queue.Enqueue(new DTC_Data((byte)(dtc >> 8), (byte)(dtc & 0xff), lamp_status));
        }