示例#1
0
        public JT808_0x0702 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x0702 value = new JT808_0x0702();

            value.IC_Card_Status       = (JT808ICCardStatus)reader.ReadByte();
            value.IC_Card_PlugDateTime = reader.ReadDateTime6();
            if (value.IC_Card_Status == JT808ICCardStatus.从业资格证IC卡插入_驾驶员上班)
            {
                value.IC_Card_ReadResult = (JT808ICCardReadResult)reader.ReadByte();
                if (value.IC_Card_ReadResult == JT808ICCardReadResult.IC卡读卡成功)
                {
                    value.DriverUserNameLength   = reader.ReadByte();
                    value.DriverUserName         = reader.ReadString(value.DriverUserNameLength);
                    value.QualificationCode      = reader.ReadString(20);
                    value.LicenseIssuingLength   = reader.ReadByte();
                    value.LicenseIssuing         = reader.ReadString(value.LicenseIssuingLength);
                    value.CertificateExpiresDate = reader.ReadDateTime4();
                    if (reader.Version == JT808Version.JTT2019)
                    {
                        value.DriverIdentityCard = reader.ReadString(20);
                    }
                }
            }
            return(value);
        }
示例#2
0
        public void ReadDateTimeTest()
        {
            byte[] bytes = "7E 07 E3 06 19 23 23 23 00 7B 19 06 19 23 23 23 7E".ToHexBytes();
            JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes);

            Assert.Equal(JT808Package.BeginFlag, jT808MessagePackReader.ReadStart());
            Assert.Equal(DateTime.Parse("2019-06-19"), jT808MessagePackReader.ReadDateTime4());
            Assert.Equal(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 23, 23, 123), jT808MessagePackReader.ReadDateTime5());
            Assert.Equal(DateTime.Parse("2019-06-19 23:23:23"), jT808MessagePackReader.ReadDateTime6());
            Assert.Equal(JT808Package.EndFlag, jT808MessagePackReader.ReadEnd());
        }
示例#3
0
        public JT808_0x0702 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x0702 jT808_0X0702 = new JT808_0x0702();

            jT808_0X0702.IC_Card_Status       = (JT808ICCardStatus)reader.ReadByte();
            jT808_0X0702.IC_Card_PlugDateTime = reader.ReadDateTime6();
            if (jT808_0X0702.IC_Card_Status == JT808ICCardStatus.从业资格证IC卡插入_驾驶员上班)
            {
                jT808_0X0702.IC_Card_ReadResult = (JT808ICCardReadResult)reader.ReadByte();
                if (jT808_0X0702.IC_Card_ReadResult == JT808ICCardReadResult.IC卡读卡成功)
                {
                    jT808_0X0702.DriverUserNameLength   = reader.ReadByte();
                    jT808_0X0702.DriverUserName         = reader.ReadString(jT808_0X0702.DriverUserNameLength);
                    jT808_0X0702.QualificationCode      = reader.ReadString(20);
                    jT808_0X0702.LicenseIssuingLength   = reader.ReadByte();
                    jT808_0X0702.LicenseIssuing         = reader.ReadString(jT808_0X0702.LicenseIssuingLength);
                    jT808_0X0702.CertificateExpiresDate = reader.ReadDateTime4();
                }
            }
            return(jT808_0X0702);
        }
示例#4
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x0702 value = new JT808_0x0702();

            value.IC_Card_Status = (JT808ICCardStatus)reader.ReadByte();
            writer.WriteNumber($"[{((byte)value.IC_Card_Status).ReadNumber()}]状态-{value.IC_Card_Status.ToString()}", (byte)value.IC_Card_Status);
            value.IC_Card_PlugDateTime = reader.ReadDateTime6();
            writer.WriteString($"[{value.IC_Card_PlugDateTime.ToString("yyMMddHHmmss")}]插拔卡时间", value.IC_Card_PlugDateTime.ToString("yyyy-MM-dd HH:mm:ss"));
            if (value.IC_Card_Status == JT808ICCardStatus.从业资格证IC卡插入_驾驶员上班)
            {
                value.IC_Card_ReadResult = (JT808ICCardReadResult)reader.ReadByte();
                writer.WriteNumber($"[{((byte)value.IC_Card_ReadResult).ReadNumber()}]IC卡读取结果-{value.IC_Card_ReadResult.ToString()}", (byte)value.IC_Card_ReadResult);
                if (value.IC_Card_ReadResult == JT808ICCardReadResult.IC卡读卡成功)
                {
                    value.DriverUserNameLength = reader.ReadByte();
                    writer.WriteNumber($"[{value.DriverUserNameLength.ReadNumber()}]驾驶员姓名长度", value.DriverUserNameLength);
                    var driverUserNameBuffer = reader.ReadVirtualArray(value.DriverUserNameLength);
                    value.DriverUserName = reader.ReadString(value.DriverUserNameLength);
                    writer.WriteString($"[{driverUserNameBuffer.ToArray().ToHexString()}]驾驶员姓名", value.DriverUserName);
                    var qualificationCodeBuffer = reader.ReadVirtualArray(20);
                    value.QualificationCode = reader.ReadString(20);
                    writer.WriteString($"[{qualificationCodeBuffer.ToArray().ToHexString()}]从业资格证编码", value.QualificationCode);
                    value.LicenseIssuingLength = reader.ReadByte();
                    writer.WriteNumber($"[{value.LicenseIssuingLength.ReadNumber()}]发证机构名称长度", value.LicenseIssuingLength);
                    var licenseIssuingLengtheBuffer = reader.ReadVirtualArray(value.LicenseIssuingLength);
                    value.LicenseIssuing = reader.ReadString(value.LicenseIssuingLength);
                    writer.WriteString($"[{licenseIssuingLengtheBuffer.ToArray().ToHexString()}]发证机构名称", value.LicenseIssuing);
                    value.CertificateExpiresDate = reader.ReadDateTime4();
                    writer.WriteString($"[{value.CertificateExpiresDate.ToString("yyMMdd")}]插拔卡时间", value.CertificateExpiresDate.ToString("yyyy-MM-dd"));
                    if (reader.Version == JT808Version.JTT2019)
                    {
                        var driverIdentityCardBuffer = reader.ReadVirtualArray(20);
                        value.DriverIdentityCard = reader.ReadString(20);
                        writer.WriteString($"[{driverIdentityCardBuffer.ToArray().ToHexString()}]驾驶员身份证号", value.DriverIdentityCard);
                    }
                }
            }
        }