Exemple #1
0
 /// <summary>
 /// Read date / time of first apperance
 /// </summary>
 /// <param name="ErrorNo">Identifier of error (error number)</param>
 /// <returns>Date and time of first apperance</returns>
 public DateTime GetFirstAppear(byte ErrorNo)
 {
     if (ErrorNo < MAX_NUMBER_OF_ERRORS)
     {
         return(mProtocol.GetDateTimeFromMinute(mMinuteOfFirstAppear[ErrorNo]));
     }
     else
     {
         throw new ArgumentOutOfRangeException("HJS.ECU.Diag.GetFirstAppear: ErrorNo must be < " + MAX_NUMBER_OF_ERRORS);
     }
 }
Exemple #2
0
        /// <summary>Import one flash block from ECU</summary>
        /// <param name="Data">Referece to target byte array</param>
        /// <param name="protocol">Reference to protocol to connected ECU</param>
        public void ImportSector(ref byte[] Data, ref ProtocolBase protocol)
        {
            if (mRowLength == 0)
            {
                return;
            }
            // parse 1 32-K-Sektor

            //file
            string[] ValueString = new string[1 + (mRowLength - 1) / 2];
            int      FilledData  = 32768 / mRowLength;

            FilledData = FilledData * mRowLength;
            int ItemCount = mItem.Length;

            for (UInt16 ByteInData = 0; ByteInData < FilledData; ByteInData += mRowLength)
            {
                if (mRowLength > 3)
                {
                    // ignore empty or erased items
                    if (((Data[ByteInData] == 0x00) &&
                         (Data[ByteInData + 1] == 0x00) &&
                         (Data[ByteInData + 2] == 0x00) &&
                         (Data[ByteInData + 3] == 0x00) &&
                         (Data[ByteInData + 4] == 0x00))
                        ||
                        ((Data[ByteInData] == 0xFF) &&
                         (Data[ByteInData + 1] == 0xFF) &&
                         (Data[ByteInData + 2] == 0xFF) &&
                         (Data[ByteInData + 3] == 0xFF) &&
                         (Data[ByteInData + 4] == 0xFF)))
                    {
                        // ignore this item
                    }
                    else
                    {
                        Array.Resize(ref mItem, ItemCount + 1);
                        mItem[ItemCount] = new AcquisitionItem();

                        // date time
                        UInt32   MinuteSinceProgramming = (UInt32)(((Data[ByteInData + 2] * 256) + Data[ByteInData + 1]) * 256) + Data[ByteInData];
                        DateTime RowTime = protocol.GetDateTimeFromMinute(MinuteSinceProgramming);
                        // string nach locale zeit?
                        ValueString[0]          = RowTime.ToString(); //.ToString("s");
                        mItem[ItemCount].Row[0] = ValueString[0];
                        //for (int i = 0; i <= ((mRowLength - 1) / 2) - 1; i++)
                        for (int i = 0; i < mHead.Length; i++)
                        {
                            ValueString[i + 1] = protocol.GetValueString(mValuePosition[i],
                                                                         (UInt16)((Data[ByteInData + 4 + (i * 2)] * 256) + Data[ByteInData + 3 + (i * 2)]));
                            mItem[ItemCount].Row[i + 1] = ValueString[i + 1];
                        }
                        ItemCount++;
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>Import error ring sector from byte array</summary>
        /// <param name="Data">Raw byte array</param>
        /// <param name="protocol">Reference to active protocol object</param>
        public void ImportSector(ref byte[] Data, ref ProtocolBase protocol)
        {
            int ItemCount = mItem.Length;

            for (UInt16 ByteInData = 0; ByteInData < (32768 - 12); ByteInData += 12)
            {
                if ((ByteInData % 4096) > (4096 - 12))
                {
                    // import only 12-byte-rows in each 4k block
                    ByteInData += (UInt16)(4096 % 12);
                }
                else
                {
                    // ignore empty or erased items
                    if (/*((Data[ByteInData] == 0x00)
                         * && (Data[ByteInData + 1] == 0x00)
                         * && (Data[ByteInData + 2] == 0x00)
                         * && (Data[ByteInData + 3] == 0x00)
                         * && (Data[ByteInData + 4] == 0x00))
                         ||*/
                        ((Data[ByteInData] == 0xFF) &&
                         (Data[ByteInData + 1] == 0xFF) &&
                         (Data[ByteInData + 2] == 0xFF) &&
                         (Data[ByteInData + 3] == 0xFF) &&
                         (Data[ByteInData + 4] == 0xFF)))
                    {
                        // ignore this item
                    }
                    else
                    {
                        Array.Resize(ref mItem, ItemCount + 1);
                        mItem[ItemCount] = new ErrorRingItem();

                        // date time
                        UInt32 MinuteSinceProgramming = (UInt32)(((Data[ByteInData + 2] * 256) + Data[ByteInData + 1]) * 256) + Data[ByteInData];
                        mItem[ItemCount].Date = protocol.GetDateTimeFromMinute(MinuteSinceProgramming);

                        mItem[ItemCount].TaskId  = Data[ByteInData + 3];
                        mItem[ItemCount].LfdNo   = Data[ByteInData + 4];
                        mItem[ItemCount].ErrorNo = Data[ByteInData + 5];
                        mItem[ItemCount].Wert1   = (UInt16)((Data[ByteInData + 7] * 256) + Data[ByteInData + 6]);
                        mItem[ItemCount].Wert2   = (UInt16)((Data[ByteInData + 9] * 256) + Data[ByteInData + 8]);
                        mItem[ItemCount].Wert3   = (UInt16)((Data[ByteInData + 11] * 256) + Data[ByteInData + 10]);
                        ItemCount++;
                    }
                }
            }
        }