/// <summary> /// Read error stack from ecu /// </summary> /// <returns></returns> public bool ReadFromEcu() { byte[] ReadBuffer; int PosInBuffer = 0; if (mProtocol.ReadErrorStack(out ReadBuffer) == ReturnValue.NoError) { // parse //mProtocol.GetMaxErrorNumber(); mMinuteOfFirstAppear = new UInt32[MAX_NUMBER_OF_ERRORS]; mMinuteOfLastAppear = new UInt32[MAX_NUMBER_OF_ERRORS]; mMinuteOfAppearedUntil = new UInt32[MAX_NUMBER_OF_ERRORS]; mNumberOfAppearances = new UInt16[MAX_NUMBER_OF_ERRORS]; for (PosInBuffer = 0; PosInBuffer < (MAX_NUMBER_OF_ERRORS * 11); PosInBuffer += 11) { mMinuteOfFirstAppear[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 2]; mMinuteOfFirstAppear[PosInBuffer / 11] *= 256; mMinuteOfFirstAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 1]; mMinuteOfFirstAppear[PosInBuffer / 11] *= 256; mMinuteOfFirstAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 0]; mMinuteOfLastAppear[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 5]; mMinuteOfLastAppear[PosInBuffer / 11] *= 256; mMinuteOfLastAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 4]; mMinuteOfLastAppear[PosInBuffer / 11] *= 256; mMinuteOfLastAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 3]; mMinuteOfAppearedUntil[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 8]; mMinuteOfAppearedUntil[PosInBuffer / 11] *= 256; mMinuteOfAppearedUntil[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 7]; mMinuteOfAppearedUntil[PosInBuffer / 11] *= 256; mMinuteOfAppearedUntil[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 6]; mNumberOfAppearances[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 10]; mNumberOfAppearances[PosInBuffer / 11] *= 256; mNumberOfAppearances[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 9]; } mBehaveMaskNewSet = new byte[2]; mBehaveMaskSet = new byte[2]; mBehaveMaskActive = new byte[2]; mBehaveMaskReset = new byte[2]; mBehaveMaskNewReset = new byte[2]; mBehaveMaskNewSet[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskNewSet[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskSet[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskSet[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskActive[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskActive[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskReset[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskReset[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskNewReset[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskNewReset[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet = new byte[8]; mErrorMaskSet = new byte[8]; mErrorMaskActual = new byte[8]; mErrorMaskActive = new byte[8]; mErrorMaskReset = new byte[8]; mErrorMaskNewReset = new byte[8]; mErrorMaskSet[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskSet[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskSet[2] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskSet[3] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskSet[4] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskSet[5] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskSet[6] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskSet[7] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[2] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[3] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[4] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[5] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[6] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskReset[7] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[2] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[3] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[4] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[5] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[6] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActual[7] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[2] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[3] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[4] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[5] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[6] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskActive[7] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[2] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[3] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[4] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[5] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[6] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewSet[7] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[2] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[3] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[4] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[5] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[6] = ReadBuffer[PosInBuffer]; PosInBuffer++; mErrorMaskNewReset[7] = ReadBuffer[PosInBuffer]; //PosInBuffer++; return(true); } else { return(false); } }
/// <summary>Read error stack from ecu</summary> /// <returns>True on success</returns> public bool ReadFromEcu() { byte[] ReadBuffer; int PosInBuffer = 0; if (mProtocol.ReadErrorStack(out ReadBuffer) == ReturnValue.NoError) { // parse mMinuteOfFirstAppear = new UInt32[MAX_NUMBER_OF_ERRORS]; mMinuteOfLastAppear = new UInt32[MAX_NUMBER_OF_ERRORS]; mMinuteOfAppearedUntil = new UInt32[MAX_NUMBER_OF_ERRORS]; mNumberOfAppearances = new UInt16[MAX_NUMBER_OF_ERRORS]; for (PosInBuffer = 0; PosInBuffer < (MAX_NUMBER_OF_ERRORS * 11); PosInBuffer += 11) { mMinuteOfFirstAppear[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 2]; mMinuteOfFirstAppear[PosInBuffer / 11] *= 256; mMinuteOfFirstAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 1]; mMinuteOfFirstAppear[PosInBuffer / 11] *= 256; mMinuteOfFirstAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 0]; mMinuteOfLastAppear[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 5]; mMinuteOfLastAppear[PosInBuffer / 11] *= 256; mMinuteOfLastAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 4]; mMinuteOfLastAppear[PosInBuffer / 11] *= 256; mMinuteOfLastAppear[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 3]; mMinuteOfAppearedUntil[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 8]; mMinuteOfAppearedUntil[PosInBuffer / 11] *= 256; mMinuteOfAppearedUntil[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 7]; mMinuteOfAppearedUntil[PosInBuffer / 11] *= 256; mMinuteOfAppearedUntil[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 6]; mNumberOfAppearances[PosInBuffer / 11] = ReadBuffer[PosInBuffer + 10]; mNumberOfAppearances[PosInBuffer / 11] *= 256; mNumberOfAppearances[PosInBuffer / 11] += ReadBuffer[PosInBuffer + 9]; } mBehaveMaskNewSet = new byte[2]; mBehaveMaskSet = new byte[2]; mBehaveMaskActive = new byte[2]; mBehaveMaskReset = new byte[2]; mBehaveMaskNewReset = new byte[2]; mBehaveMaskNewSet[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskNewSet[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskSet[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskSet[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskActive[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskActive[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskReset[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskReset[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskNewReset[0] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBehaveMaskNewReset[1] = ReadBuffer[PosInBuffer]; PosInBuffer++; mBitmaskErrorSet = BitConverter.ToUInt64(ReadBuffer, PosInBuffer); PosInBuffer = PosInBuffer + 8; mBitmaskErrorReset = BitConverter.ToUInt64(ReadBuffer, PosInBuffer); PosInBuffer = PosInBuffer + 8; mBitmaskErrorActual = BitConverter.ToUInt64(ReadBuffer, PosInBuffer); PosInBuffer = PosInBuffer + 8; mBitmaskErrorActive = BitConverter.ToUInt64(ReadBuffer, PosInBuffer); PosInBuffer = PosInBuffer + 8; mBitmaskErrorNewSet = BitConverter.ToUInt64(ReadBuffer, PosInBuffer); PosInBuffer = PosInBuffer + 8; mBitmaskErrorNewReset = BitConverter.ToUInt64(ReadBuffer, PosInBuffer); PosInBuffer = PosInBuffer + 8; return(true); } else { return(false); } }