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 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));
        }
Exemple #3
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 #4
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);
                }
            }
        }