public WorkshopCardIdentification(byte[] data)
 {
     CardIssuingMemberState      = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 1, 1)));
     CardNumber                  = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, 2, 0x10));
     CardIssuingAuthorityName    = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 0x12, 0x24));
     CardIssueDate               = BinaryHelper.ToDate(BinaryHelper.SubByte(data, 0x36, 4));
     CardValidityBegin           = BinaryHelper.ToDate(BinaryHelper.SubByte(data, 0x3a, 4));
     CardExpiryDate              = BinaryHelper.ToDate(BinaryHelper.SubByte(data, 0x3e, 4));
     WorkshopName                = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 0x42, 0x24));
     WorkshopAddress             = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 0x66, 0x24));
     CardHolderSurname           = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 0x8a, 0x24));
     CardHolderFirstNames        = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 0xae, 0x24));
     CardHolderPreferredLanguage = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, 210, 2));
 }
Exemple #2
0
        public CurrentUsageData(byte[] data)
        {
            SessionOpenTime = BinaryHelper.ToDate(BinaryHelper.SubByte(data, 1, 4));
            if (SessionOpenTime == BinaryHelper.ToDate(new byte[] { 0, 0, 0, 0 }))
            {
                SessionOpenTime = null;
            }

            VehicleRegistrationNation = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 5, 1)));
            VehicleRegistrationNumber = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 6, 14));
            if (VehicleRegistrationNumber == BinaryHelper.ToISOString(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }))
            {
                VehicleRegistrationNumber = null;
            }
        }
Exemple #3
0
        private void LoadCardData(ICollection <TachographCardData> data)
        {
            int activityDataLength = 13776;

            var applicationIdentification = data.FirstOrDefault(c => c.HexString == "0501" || c.HexString == "0");

            if (applicationIdentification != null)
            {
                ApplicationIdentification = new ApplicationIdentification(applicationIdentification.Data);
                activityDataLength        = ApplicationIdentification.ActivityStructureLength;
            }

            if (SmartCardType == SmartCardType.DriverCard)
            {
                PopulateData(() => DriverCardIdentification, data, "0520");
                PopulateData(() => DriverCard, data, "050E");
                PopulateData(() => DrivingLicenseInformation, data, "0521");
            }
            else if (SmartCardType == SmartCardType.WorkshopCard)
            {
                PopulateData(() => WorkshopCardIdentification, data, "0520");
                PopulateData(() => WorkshopCardDownload, data, "0509");

                var calibration = data.FirstOrDefault(c => c.HexString == "050A" || c.HexString == "0");
                if (calibration != null)
                {
                    CalibrationData = new CalibrationData(BinaryHelper.SubByte(calibration.Data, 4, calibration.Data.Length - 3));
                }
            }

            PopulateData(() => EventsData, data, "0502");
            PopulateData(() => FaultsData, data, "0503");

            var activityData = data.FirstOrDefault(c => c.HexString == "0504" || c.HexString == "0");

            if (activityData != null)
            {
                ActivityData = new ActivityData(activityData.Data, activityDataLength);
            }

            PopulateData(() => VehiclesUsed, data, "0505");
            PopulateData(() => PlacesData, data, "0506");
            PopulateData(() => CurrentUsageData, data, "0507");
            PopulateData(() => ControlActivityData, data, "0508");
            PopulateData(() => SpecificConditions, data, "0522");
        }
Exemple #4
0
        public static TachographCard Read(byte[] data, Stream stream)
        {
            using (BinaryReader binaryReader = new BinaryReader(stream))
            {
                string str  = BinaryHelper.BytesToHexString(binaryReader.ReadBytes(2));
                int    num1 = checked ((int)BinaryHelper.BytesToLong(binaryReader.ReadBytes(1)));
                int    num2 = checked ((int)BinaryHelper.BytesToLong(binaryReader.ReadBytes(2)));

                if (Operators.CompareString(str, "0002", false) == 0 & num1 == 0 & num2 == 25 | Operators.CompareString(str, "0501", false) == 0 & num1 == 0 & num2 == 10 | Operators.CompareString(str, "7606", false) == 0)
                {
                    var tachographCard = new TachographCard();
                    tachographCard.LoadData(data);
                    return(tachographCard);
                }

                throw new InvalidOperationException("File was not recognised.");
            }
        }
        public SpecificConditions(byte[] data)
        {
            Items = new List <SpecificConditionsDataItem>();

            for (int i = 0; i <= (data.Length / 5) - 1; i++)
            {
                if (BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (5 * i) + 1, 4)) != 0L)
                {
                    SpecificConditionsDataItem item = new SpecificConditionsDataItem
                    {
                        EntryTime = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (5 * i) + 1, 4)),
                        Type      = LookupTableHelper.GetLookupItem <SpecificConditionLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (5 * i) + 5, 1)))
                    };

                    Items.Add(item);
                }
            }
        }
Exemple #6
0
        public ActivityData(byte[] data, int activityDataLength)
        {
            Items = new List <ActivityDataItem>();

            int length = (int)BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 1, 2));
            int num2   = (int)BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 3, 2));

            data = BinaryHelper.SubByte(data, 5, data.Length - 4);
            if (length > 0)
            {
                byte[] buffer  = BinaryHelper.SubByte(data, length + 1, data.Length - length);
                byte[] buffer2 = BinaryHelper.SubByte(data, 1, length);
                data = BinaryHelper.JoinBytes(buffer, buffer2);
            }
            num2 = ((num2 - length) + activityDataLength) % activityDataLength;
            int  num4 = (int)BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 3, 2));
            int  num5 = 0;
            bool flag = true;

            while (flag & (num4 > 0))
            {
                ActivityDataItem activityDataItem = new ActivityDataItem
                {
                    RecordDate           = BinaryHelper.ToDate(BinaryHelper.SubByte(data, num5 + 5, 4)),
                    DailyPresenceCounter = BinaryHelper.BCDToString(BinaryHelper.SubByte(data, num5 + 9, 2))
                };

                if (activityDataItem.DailyPresenceCounter == BinaryHelper.BCDToString(BinaryHelper.SubByte(data, num2 + 9, 2)))
                {
                    flag = false;
                }

                activityDataItem.DayDistance = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, num5 + 11, 2));
                activityDataItem.ChangeItems = GetActivityChangeData(BinaryHelper.SubByte(data, num5 + 13, num4 - 12), activityDataItem.DailyPresenceCounter);

                if (flag)
                {
                    num5 += num4;
                    num4  = (int)BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, num5 + 3, 2));
                }

                Items.Add(activityDataItem);
            }
        }
Exemple #7
0
        private static ICollection <TachographCardData> ReadFile(byte[] data)
        {
            List <TachographCardData> result = new List <TachographCardData>();

            using (MemoryStream memoryStream = new MemoryStream())
            {
                memoryStream.Write(data, 0, data.Length);
                memoryStream.Position = 0;

                using (BinaryReader binaryReader = new BinaryReader(memoryStream))
                {
                    int count;
                    for (int index = 0; (long)index < binaryReader.BaseStream.Length; index = checked (index + 5 + count))
                    {
                        string str = BinaryHelper.BytesToHexString(binaryReader.ReadBytes(2));
                        if (Operators.CompareString(str, "7606", false) == 0)
                        {
                            str = BinaryHelper.BytesToHexString(binaryReader.ReadBytes(2));
                            checked
                            {
                                index += 2;
                            }
                        }
                        LookupItem description = LookupTableHelper.GetLookupItem <TachographCardContentsLookupTable>(str);
                        int        num         = checked ((int)BinaryHelper.BytesToLong(binaryReader.ReadBytes(1)));
                        count = checked ((int)BinaryHelper.BytesToLong(binaryReader.ReadBytes(2)));

                        result.Add(new TachographCardData
                        {
                            HexString   = str,
                            Count       = count,
                            Data        = binaryReader.ReadBytes(count),
                            Description = num == 1 ? "Signature" : description == null ? "" : description.Value,
                            Number      = num
                        });
                    }
                }
            }
            return(result);
        }
Exemple #8
0
        public CalibrationData(byte[] data)
        {
            Items = new List <CalibrationDataItem>();

            for (int i = 0; i <= data.Length / 0x69 - 1; i++)
            {
                if (BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x69 * i) + 1, 1)) != 0L)
                {
                    CalibrationDataItem item = new CalibrationDataItem
                    {
                        CalibrationPurpose             = LookupTableHelper.GetLookupItem <CalibrationPurposeLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (0x69 * i) + 1, 1))),
                        VehicleIdentificationNumber    = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, (0x69 * i) + 2, 0x11)),
                        VehicleRegistrationNation      = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (0x69 * i) + 0x13, 1))),
                        VehicleRegistrationNumber      = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, (0x69 * i) + 20, 14)),
                        WVehicleCharacteristicConstant = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x69 * i) + 0x22, 2)),
                        KConstantOfRecordingEquipment  = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x69 * i) + 0x24, 2)),
                        LTyreCircumference             = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x69 * i) + 0x26, 2)),
                        TyreSize            = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, (0x69 * i) + 40, 15)),
                        AuthorisedSpeed     = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x69 * i) + 0x37, 1)),
                        OldOdometerValue    = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x69 * i) + 0x38, 3)),
                        NewOdometerValue    = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x69 * i) + 0x3b, 3)),
                        OldTimeValue        = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (0x69 * i) + 0x3e, 4)),
                        NewTimeValue        = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (0x69 * i) + 0x42, 4)),
                        NextCalibrationDate = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (0x69 * i) + 70, 4)),
                        VUPartNumber        = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, (0x69 * i) + 0x4a, 0x10)),
                        VUSerialNumber      = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 90, 4)),
                        VUMonthYear         = BinaryHelper.BCDToString(BinaryHelper.SubByte(data, 0x5e, 2)),
                        VUType                 = LookupTableHelper.GetLookupItem <EquipmentTypeLookupTable>(BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 0x60, 1)).ToString()),
                        VUManufacturerCode     = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 0x61, 1)),
                        SensorSerialNumber     = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 0x62, 4)),
                        SensorMonthYear        = BinaryHelper.BCDToString(BinaryHelper.SubByte(data, 0x66, 2)),
                        SensorType             = LookupTableHelper.GetLookupItem <EquipmentTypeLookupTable>(BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 0x68, 1)).ToString()),
                        SensorManufacturerCode = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 0x69, 1))
                    };

                    Items.Add(item);
                }
            }
        }
        public FaultsData(byte[] data)
        {
            Items = new List <FaultsDataItem>();

            for (int i = 0; i <= (data.Length / 0x18) - 1; i++)
            {
                if (BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x18 * i) + 1, 1)) != 0L)
                {
                    FaultsDataItem item = new FaultsDataItem
                    {
                        Type      = LookupTableHelper.GetLookupItem <EventFaultTypeLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (0x18 * i) + 1, 1))),
                        BeginTime = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (0x18 * i) + 2, 4))
                    };

                    if (item.BeginTime == BinaryHelper.ToDate(new byte[] { 0, 0, 0, 0 }))
                    {
                        item.BeginTime = null;
                    }

                    item.EndTime = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (0x18 * i) + 6, 4));
                    item.VehicleRegistrationNation = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (0x18 * i) + 10, 1)));
                    item.VehicleRegistrationNumber = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, (0x18 * i) + 11, 14));

                    Items.Add(item);
                }
            }
        }
Exemple #10
0
        private static ICollection <ActivityChangeDataItem> GetActivityChangeData(byte[] data, string dailyPresenceCounter)
        {
            List <ActivityChangeDataItem> result = new List <ActivityChangeDataItem>();

            int changeDataLength = data.Length / 2;

            int counter = changeDataLength - 1;

            for (int i = 0; i <= counter; i++)
            {
                ActivityChangeDataItem changeDataItem = new ActivityChangeDataItem();
                changeDataItem.DailyPresenceCounter = dailyPresenceCounter;
                changeDataItem.Slot       = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x80L) == 0x80L, "Co-Driver", "Driver")).ToString();
                changeDataItem.CardStatus = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x20L) == 0x20L, "Not Inserted", "Inserted")).ToString();

                if (changeDataItem.CardStatus == "Inserted")
                {
                    changeDataItem.DrivingStatus = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x40L) == 0x40L, "Crew", "Single")).ToString();
                }
                else
                {
                    changeDataItem.DrivingStatus = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x40L) == 0x40L, "Known", "Unknown")).ToString();
                }

                if (changeDataItem.DrivingStatus == "Not Inserted" || changeDataItem.DrivingStatus == "Unknown")
                {
                    changeDataItem.Activity = "";
                }
                else
                {
                    switch (((int)(BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x18L)))
                    {
                    case 0:
                        changeDataItem.Activity = "Rest";
                        break;

                    case 8:
                        changeDataItem.Activity = "Available";
                        break;

                    case 0x10:
                        changeDataItem.Activity = "Work";
                        break;

                    case 0x18:
                        changeDataItem.Activity = "Drive";
                        break;
                    }
                }

                changeDataItem.Time = DateAndTime.DateAdd(DateInterval.Minute, BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 2)) & 0x7ffL, new DateTime(SqlDateTime.MinValue.Value.Year, SqlDateTime.MinValue.Value.Month, SqlDateTime.MinValue.Value.Day));
                result.Add(changeDataItem);
            }

            return(result);
        }
 public ApplicationIdentification(byte[] data)
 {
     TypeOfTachographCardID     = LookupTableHelper.GetLookupItem <EquipmentTypeLookupTable>(BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 1, 1)).ToString());
     CardStructureVersion       = BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 2, 2));
     NumberOfEventsPerType      = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 4, 1)).ToString();
     NumberOfFaultsPerType      = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 5, 1)).ToString();
     ActivityStructureLength    = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 6, 2)).ToString().ToInt32();
     NumberOfCardVehicleRecords = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 8, 2)).ToString();
     NumberOfCardPlaceRecords   = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 10, 1)).ToString();
 }
        public IntegratedCircuitCard(byte[] data)
        {
            ClockStop    = BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 1, 1));
            SerialNumber = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 2, 4)).ToString();
            MonthYear    = BinaryHelper.BCDToString(BinaryHelper.SubByte(data, 6, 2));

            Type                  = LookupTableHelper.GetLookupItem <EquipmentTypeLookupTable>(BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 8, 1)).ToString());
            ManufacturerCode      = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 9, 1)).ToString();
            CardApprovalNumber    = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, 10, 8));
            CardPersonaliserID    = BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 18, 1));
            EmbedderICAssemblerID = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, 19, 5));
            ICIdentifier          = BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 24, 2));
        }
        public ControlActivityData(byte[] data)
        {
            string left = "";

            int num = (int)BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 1, 1));

            if (num == 0)
            {
                left = "No Activity";
            }
            else
            {
                if ((num & 0x10) == 0x10)
                {
                    left = left + "Card Downloaded";
                }
                if ((num & 0x20) == 0x20)
                {
                    left = left + Conversions.ToString(Interaction.IIf(Operators.CompareString(left, "", false) > 0, ", ", "")) + "VU Downloaded";
                }
                if ((num & 0x40) == 0x40)
                {
                    left = left + Conversions.ToString(Interaction.IIf(Operators.CompareString(left, "", false) > 0, ", ", "")) + "Printing Done";
                }
                if ((num & 0x80) == 0x80)
                {
                    left = left + Conversions.ToString(Interaction.IIf(Operators.CompareString(left, "", false) > 0, ", ", "")) + "Display Used";
                }
            }

            ControlType = left;
            ControlTime = BinaryHelper.ToDate(BinaryHelper.SubByte(data, 2, 4));

            CardType = LookupTableHelper.GetLookupItem <EquipmentTypeLookupTable>(BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, 6, 1)).ToString());
            CardIssuingMemberState    = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 7, 1)));
            CardNumber                = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 8, 0x10));
            VehicleRegistrationNation = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 0x18, 1)));
            VehicleRegistrationNumber = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 0x19, 14));

            DateTime?downloadPeriodBegin = BinaryHelper.ToDate(BinaryHelper.SubByte(data, 0x27, 4));

            if (downloadPeriodBegin == BinaryHelper.ToDate(new byte[] { 0, 0, 0, 0 }))
            {
                downloadPeriodBegin = null;
            }
            ControlDownloadPeriodBegin = downloadPeriodBegin;

            DateTime?downloadPeriodEnd = BinaryHelper.ToDate(BinaryHelper.SubByte(data, 0x2b, 4));

            if (downloadPeriodEnd == BinaryHelper.ToDate(new byte[] { 0, 0, 0, 0 }))
            {
                downloadPeriodEnd = null;
            }
            ControlDownloadPeriodEnd = downloadPeriodEnd;
        }
        public PlacesData(byte[] data)
        {
            Items = new List <PlacesDataItem>();

            for (int i = 0; i <= (data.Length / 10) - 1; i++)
            {
                if (BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (10 * i) + 1, 4)) == 0L)
                {
                    continue;
                }

                PlacesDataItem item = new PlacesDataItem
                {
                    EntryTime = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (10 * i) + 1, 4))
                };

                long num4 = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (10 * i) + 5, 1));
                if (num4 <= 5L && num4 >= 0L)
                {
                    switch ((int)num4)
                    {
                    case 0:
                        item.EntryTypeDailyWorkPeriod = "Begin";
                        break;

                    case 1:
                        item.EntryTypeDailyWorkPeriod = "End";
                        break;

                    case 2:
                        item.EntryTypeDailyWorkPeriod = "Begin (manual)";
                        break;

                    case 3:
                        item.EntryTypeDailyWorkPeriod = "End (manual)";
                        break;

                    case 4:
                        item.EntryTypeDailyWorkPeriod = "Begin (assumed)";
                        break;

                    case 5:
                        item.EntryTypeDailyWorkPeriod = "End (assumed)";
                        break;
                    }
                }

                item.DailyWorkPeriodCountry = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (10 * i) + 6, 1)));
                item.DailyWorkPeriodRegion  = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (10 * i) + 7, 1)));
                item.VehicleOdometerValue   = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (10 * i) + 8, 3));

                Items.Add(item);
            }
        }
        public VehiclesUsed(byte[] data)
        {
            Items = new List <VehiclesUsedItem>();

            for (int i = 0; i <= (data.Length / 0x1f) - 1; i++)
            {
                if (string.Compare(Strings.Trim(BinaryHelper.ToISOString(BinaryHelper.SubByte(data, (0x1f * i) + 0x10, 14))), "") != 0)
                {
                    VehiclesUsedItem item = new VehiclesUsedItem
                    {
                        OdometerBegin = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x1f * i) + 1, 3)),
                        OdometerEnd   = BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (0x1f * i) + 4, 3))
                    };

                    if (item.OdometerEnd == BinaryHelper.BytesToLong(new byte[] { 0xff, 0xff, 0xff }))
                    {
                        item.OdometerEnd = null;
                    }

                    item.FirstUse = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (0x1f * i) + 7, 4));
                    item.LastUse  = BinaryHelper.ToDate(BinaryHelper.SubByte(data, (0x1f * i) + 11, 4));

                    if (item.LastUse == BinaryHelper.ToDate(new byte[] { 0xff, 0xff, 0xff, 0xff }))
                    {
                        item.LastUse = null;
                    }

                    item.RegistrationNation = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, (0x1f * i) + 15, 1)));
                    item.RegistrationNumber = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, (0x1f * i) + 0x10, 14));
                    item.VUDataBlockCounter = BinaryHelper.BCDToString(BinaryHelper.SubByte(data, (0x1f * i) + 30, 2));

                    Items.Add(item);
                }
            }
        }
 public DrivingLicenseInformation(byte[] data)
 {
     IssuingAuthority = BinaryHelper.ToISOString(BinaryHelper.SubByte(data, 1, 0x24));
     IssuingNation    = LookupTableHelper.GetLookupItem <NationLookupTable>(BinaryHelper.BytesToHexString(BinaryHelper.SubByte(data, 0x25, 1)));
     Number           = BinaryHelper.DecodeString(BinaryHelper.SubByte(data, 0x26, 0x10));
 }