Esempio n. 1
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8103_0x0057 jT808_0x8103_0x0057 = new JT808_0x8103_0x0057();

            jT808_0x8103_0x0057.ParamId     = reader.ReadUInt32();
            jT808_0x8103_0x0057.ParamLength = reader.ReadByte();
            jT808_0x8103_0x0057.ParamValue  = reader.ReadUInt32();
            writer.WriteNumber($"[{ jT808_0x8103_0x0057.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0057.ParamId);
            writer.WriteNumber($"[{jT808_0x8103_0x0057.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0057.ParamLength);
            writer.WriteNumber($"[{ jT808_0x8103_0x0057.ParamValue.ReadNumber()}]参数值[连续驾驶时间门限s]", jT808_0x8103_0x0057.ParamValue);
        }
        public JT808_0x0900_0xF7 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x0900_0xF7 value = new JT808_0x0900_0xF7();

            value.USBMessageCount = reader.ReadByte();
            if (value.USBMessageCount > 0)
            {
                value.USBMessages = new List <JT808_0x0900_0xF7_USB>();
                for (int i = 0; i < value.USBMessageCount; i++)
                {
                    JT808_0x0900_0xF7_USB item = new JT808_0x0900_0xF7_USB();
                    item.USBID            = reader.ReadByte();
                    item.MessageLength    = reader.ReadByte();
                    item.WorkingCondition = reader.ReadByte();
                    item.AlarmStatus      = reader.ReadUInt32();
                    value.USBMessages.Add(item);
                }
            }
            return(value);
        }
Esempio n. 3
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8103_0x0103 jT808_0x8103_0x0103 = new JT808_0x8103_0x0103();

            jT808_0x8103_0x0103.ParamId     = reader.ReadUInt32();
            jT808_0x8103_0x0103.ParamLength = reader.ReadByte();
            jT808_0x8103_0x0103.ParamValue  = reader.ReadUInt16();
            writer.WriteNumber($"[{ jT808_0x8103_0x0103.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0103.ParamId);
            writer.WriteNumber($"[{jT808_0x8103_0x0103.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0103.ParamLength);
            writer.WriteNumber($"[{ jT808_0x8103_0x0103.ParamValue.ReadNumber()}]参数值[CAN 总线通道2,上传时间间隔(s),0 表示不上传]", jT808_0x8103_0x0103.ParamValue);
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8001 value = new JT808_0x8001();

            value.MsgNum = reader.ReadUInt16();
            writer.WriteNumber($"[{value.MsgNum.ReadNumber()}]应答消息流水号", value.MsgNum);
            value.AckMsgId = reader.ReadUInt16();
            writer.WriteNumber($"[{value.AckMsgId.ReadNumber()}]应答消息Id", value.AckMsgId);
            value.JT808PlatformResult = (JT808PlatformResult)reader.ReadByte();
            writer.WriteNumber($"[{((byte)value.JT808PlatformResult).ReadNumber()}]结果-{value.JT808PlatformResult.ToString()}", (byte)value.JT808PlatformResult);
        }
Esempio n. 5
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8103_0x0020 jT808_0x8103_0x0020 = new JT808_0x8103_0x0020();

            jT808_0x8103_0x0020.ParamId     = reader.ReadUInt32();
            jT808_0x8103_0x0020.ParamLength = reader.ReadByte();
            jT808_0x8103_0x0020.ParamValue  = reader.ReadUInt32();
            writer.WriteNumber($"[{ jT808_0x8103_0x0020.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0020.ParamId);
            writer.WriteNumber($"[{jT808_0x8103_0x0020.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0020.ParamLength);
            writer.WriteNumber($"[{ jT808_0x8103_0x0020.ParamValue.ReadNumber()}]参数值[位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报]", jT808_0x8103_0x0020.ParamValue);
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public JT808_0x8600 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x8600 jT808_0X8600 = new JT808_0x8600();

            jT808_0X8600.SettingAreaProperty = reader.ReadByte();
            jT808_0X8600.AreaCount           = reader.ReadByte();
            jT808_0X8600.AreaItems           = new List <JT808CircleAreaProperty>();
            for (var i = 0; i < jT808_0X8600.AreaCount; i++)
            {
                JT808CircleAreaProperty jT808CircleAreaProperty = new JT808CircleAreaProperty();
                jT808CircleAreaProperty.AreaId         = reader.ReadUInt32();
                jT808CircleAreaProperty.AreaProperty   = reader.ReadUInt16();
                jT808CircleAreaProperty.CenterPointLat = reader.ReadUInt32();
                jT808CircleAreaProperty.CenterPointLng = reader.ReadUInt32();
                jT808CircleAreaProperty.Radius         = reader.ReadUInt32();
                ReadOnlySpan <char> areaProperty16Bit = Convert.ToString(jT808CircleAreaProperty.AreaProperty, 2).PadLeft(16, '0').AsSpan();
                bool bit0Flag = areaProperty16Bit.Slice(areaProperty16Bit.Length - 1).ToString().Equals("0");
                if (!bit0Flag)
                {
                    jT808CircleAreaProperty.StartTime = reader.ReadDateTime_yyMMddHHmmss();
                    jT808CircleAreaProperty.EndTime   = reader.ReadDateTime_yyMMddHHmmss();
                }
                bool bit1Flag = areaProperty16Bit.Slice(areaProperty16Bit.Length - 2, 1).ToString().Equals("0");
                if (!bit1Flag)
                {
                    jT808CircleAreaProperty.HighestSpeed      = reader.ReadUInt16();
                    jT808CircleAreaProperty.OverspeedDuration = reader.ReadByte();
                    if (reader.Version == JT808Version.JTT2019)
                    {
                        jT808CircleAreaProperty.NightMaximumSpeed = reader.ReadUInt16();
                    }
                }
                if (reader.Version == JT808Version.JTT2019)
                {
                    jT808CircleAreaProperty.NameLength = reader.ReadUInt16();
                    jT808CircleAreaProperty.AreaName   = reader.ReadString(jT808CircleAreaProperty.NameLength);
                }
                jT808_0X8600.AreaItems.Add(jT808CircleAreaProperty);
            }
            return(jT808_0X8600);
        }
Esempio n. 7
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8B01 value = new JT808_0x8B01();

            value.GprsId = reader.ReadUInt32();
            writer.WriteNumber($"[{value.GprsId.ReadNumber()}]线路编号", value.GprsId);
            value.GuideBoard = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.GuideBoard.Length}]路牌", value.GuideBoard);
            value.TrainNumber = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.TrainNumber.Length}]车次编号", value.TrainNumber);
            value.SelfId = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.SelfId.Length}]车辆编号", value.SelfId);
            value.TrafficType = reader.ReadByte();
            writer.WriteNumber($"[{value.TrafficType.ReadNumber()}]业务类型-{Enum.GetName(typeof(TrafficType), value.TrafficType)}", value.TrafficType);
            value.DispatchType = reader.ReadByte();
            writer.WriteNumber($"[{value.DispatchType.ReadNumber()}]调度类型-{Enum.GetName(typeof(DispatchType), value.DispatchType)}", value.DispatchType);
            value.DriverId = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.DriverId.Length}]驾驶员编号", value.DriverId);
            value.DriverName = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.DriverName.Length}]驾驶员姓名", value.DriverName);
            value.AttendantId1 = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.AttendantId1.Length}]乘务员1编号", value.AttendantId1);
            value.AttendantId2 = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.AttendantId2.Length}]乘务员2编号", value.AttendantId2);
            value.StartTime = reader.ReadDateTime6();
            writer.WriteString($"[{value.StartTime:yyMMddHHmmss}]起始时间", value.StartTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.EndTime = reader.ReadDateTime6();
            writer.WriteString($"[{value.EndTime:yyMMddHHmmss}]终止时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss"));
            value.StartStationId = reader.ReadUInt32();
            writer.WriteNumber($"[{value.StartStationId.ReadNumber()}]起始站点编号", value.StartStationId);
            value.StartStationName = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.StartStationName.Length}]起始场站车站名称", value.StartStationName);
            value.EndStationId = reader.ReadUInt32();
            writer.WriteNumber($"[{value.EndStationId.ReadNumber()}]终止站点编号", value.EndStationId);
            value.EndStationName = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.EndStationName.Length}]终止场站车站名称", value.EndStationName);
            value.Additional = reader.ReadStringEndChar0();
            writer.WriteString($"[Length:{value.Additional.Length}]附加内容", value.Additional);
            value.Time = reader.ReadDateTime6();
            writer.WriteString($"[{value.Time:yyMMddHHmmss}]发送通知的时间", value.Time.ToString("yyyy-MM-dd HH:mm:ss"));
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public JT808_0x8401 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x8401 jT808_0X8401 = new JT808_0x8401();

            jT808_0X8401.SettingTelephoneBook = (JT808SettingTelephoneBook)reader.ReadByte();
            jT808_0X8401.ContactCount         = reader.ReadByte();
            List <JT808ContactProperty> jT808_0X8401s = new List <JT808ContactProperty>();

            for (var i = 0; i < jT808_0X8401.ContactCount; i++)
            {
                JT808ContactProperty jT808ContactProperty = new JT808ContactProperty();
                jT808ContactProperty.TelephoneBookContactType = (JT808TelephoneBookContactType)reader.ReadByte();
                jT808ContactProperty.PhoneNumberLength        = reader.ReadByte();
                jT808ContactProperty.PhoneNumber   = reader.ReadString(jT808ContactProperty.PhoneNumberLength);
                jT808ContactProperty.ContactLength = reader.ReadByte();
                jT808ContactProperty.Contact       = reader.ReadString(jT808ContactProperty.ContactLength);
                jT808_0X8401s.Add(jT808ContactProperty);
            }
            jT808_0X8401.JT808ContactProperties = jT808_0X8401s;
            return(jT808_0X8401);
        }
Esempio n. 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public JT808_0x9208 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x9208 value = new JT808_0x9208();

            value.AttachmentServerIPLength  = reader.ReadByte();
            value.AttachmentServerIP        = reader.ReadString(value.AttachmentServerIPLength);
            value.AttachmentServerIPTcpPort = reader.ReadUInt16();
            value.AttachmentServerIPUdpPort = reader.ReadUInt16();
            value.AlarmIdentification       = new AlarmIdentificationProperty
            {
                TerminalId  = reader.ReadString(30),
                Time        = reader.ReadDateTime_yyMMddHHmmss(),
                SN          = reader.ReadByte(),
                AttachCount = reader.ReadByte(),
                Retain1     = reader.ReadByte(),
                Retain2     = reader.ReadByte()
            };
            value.AlarmId = reader.ReadString(32);
            value.Retain  = reader.ReadArray(16).ToArray();
            return(value);
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            var replyMsgNum    = reader.ReadUInt16();
            var replyMsgId     = reader.ReadUInt16();
            var terminalResult = reader.ReadByte();
            var test           = reader.ReadUInt16();

            writer.WriteNumber($"[{replyMsgNum.ReadNumber()}]应答流水号", replyMsgNum);
            writer.WriteNumber($"[{replyMsgId.ReadNumber()}]应答消息Id", replyMsgId);
            writer.WriteString($"[{terminalResult.ReadNumber()}]结果", ((JT808TerminalResult)terminalResult).ToString());
            writer.WriteNumber($"[{test.ReadNumber()}]测试", test);
        }
Esempio n. 12
0
        public JT808_0x8106 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x8106 jT808_0X8106 = new JT808_0x8106();

            jT808_0X8106.ParameterCount = reader.ReadByte();
            jT808_0X8106.Parameters     = new uint[jT808_0X8106.ParameterCount];
            for (int i = 0; i < jT808_0X8106.ParameterCount; i++)
            {
                jT808_0X8106.Parameters.SetValue(reader.ReadUInt32(), i);
            }
            return(jT808_0X8106);
        }
Esempio n. 13
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8803 value = new JT808_0x8803();

            value.MultimediaType    = reader.ReadByte();
            value.ChannelId         = reader.ReadByte();
            value.EventItemCoding   = reader.ReadByte();
            value.StartTime         = reader.ReadDateTime6();
            value.EndTime           = reader.ReadDateTime6();
            value.MultimediaDeleted = reader.ReadByte();
            JT808MultimediaType    multimediaType    = (JT808MultimediaType)value.MultimediaType;
            JT808EventItemCoding   eventItemCoding   = (JT808EventItemCoding)value.EventItemCoding;
            JT808MultimediaDeleted multimediaDeleted = (JT808MultimediaDeleted)value.MultimediaDeleted;

            writer.WriteNumber($"[{ value.MultimediaType.ReadNumber()}]多媒体类型-{multimediaType.ToString()}", value.MultimediaType);
            writer.WriteNumber($"[{ value.ChannelId.ReadNumber()}]通道ID", value.ChannelId);
            writer.WriteNumber($"[{ value.EventItemCoding.ReadNumber()}]事件项编码-{eventItemCoding.ToString()}", value.EventItemCoding);
            writer.WriteString($"[{ value.StartTime.ToString("yyMMddHHmmss")}]起始时间", value.StartTime.ToString("yyyy-MM-dd HH:mm:ss"));
            writer.WriteString($"[{ value.EndTime.ToString("yyMMddHHmmss")}]结束时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss"));
            writer.WriteNumber($"[{ value.MultimediaDeleted.ReadNumber()}]删除标志-{multimediaDeleted.ToString()}", value.MultimediaDeleted);
        }
Esempio n. 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public JT808_0x8603 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x8603 jT808_0X8603 = new JT808_0x8603();

            jT808_0X8603.AreaCount = reader.ReadByte();
            jT808_0X8603.AreaIds   = new List <uint>();
            for (var i = 0; i < jT808_0X8603.AreaCount; i++)
            {
                jT808_0X8603.AreaIds.Add(reader.ReadUInt32());
            }
            return(jT808_0X8603);
        }
Esempio n. 15
0
        public void ReadNumericalTest()
        {
            byte[] bytes = "7E 01 00 10 00 00 00 20 00 00 00 40 7E".ToHexBytes();
            JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes);

            Assert.Equal(JT808Package.BeginFlag, jT808MessagePackReader.ReadStart());
            Assert.Equal(0x01, jT808MessagePackReader.ReadByte());
            Assert.Equal(16, jT808MessagePackReader.ReadUInt16());
            Assert.Equal(32, jT808MessagePackReader.ReadInt32());
            Assert.Equal((uint)64, jT808MessagePackReader.ReadUInt32());
            Assert.Equal(JT808Package.EndFlag, jT808MessagePackReader.ReadEnd());
        }
Esempio n. 16
0
        public JT808_0x0B09 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x0B09 value = new JT808_0x0B09();

            value.GprsId = reader.ReadUInt32();
            var length = reader.ReadCurrentRemainContentLength() - 7;

            value.WorkerId    = reader.ReadString(length);
            value.RequestCode = reader.ReadByte();
            value.Time        = reader.ReadDateTime6();
            return(value);
        }
Esempio n. 17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8400 value = new JT808_0x8400();

            value.CallBack = (JT808CallBackType)reader.ReadByte();
            writer.WriteNumber($"[{((byte)value.CallBack).ReadNumber()}]{value.CallBack.ToString()}", (byte)value.CallBack);
            // 最长为 20 字节
            var pnoBuffer = reader.ReadVirtualArray(reader.ReadCurrentRemainContentLength()).ToArray();

            value.PhoneNumber = reader.ReadRemainStringContent();
            writer.WriteString($"[{pnoBuffer.ToHexString()}]电话号码", value.PhoneNumber);
        }
Esempio n. 18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8701 value = new JT808_0x8701();

            writer.WriteStartObject("行驶记录参数下传命令");
            value.CommandId = reader.ReadByte();
            writer.WriteString($"[{value.CommandId.ReadNumber()}]命令字", ((JT808CarDVRCommandID)value.CommandId).ToString());
            writer.WriteStartObject(((JT808CarDVRCommandID)value.CommandId).ToString());
            JT808CarDVRSerializer.JT808CarDVRDownPackage.Analyze(ref reader, writer, config);
            writer.WriteEndObject();
            writer.WriteEndObject();
        }
Esempio n. 19
0
        public JT808_0x1210 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x1210 value = new JT808_0x1210();

            value.MakerID             = reader.ReadString(7);
            value.AlarmIdentification = new AlarmIdentificationProperty
            {
                TerminalID  = reader.ReadString(7),
                Time        = reader.ReadDateTime6(),
                SN          = reader.ReadByte(),
                AttachCount = reader.ReadByte(),
                Retain      = reader.ReadByte()
            };
            value.AlarmId     = reader.ReadString(32);
            value.InfoType    = reader.ReadByte();
            value.AttachCount = reader.ReadByte();
            if (value.AttachCount > 0)
            {
                value.AttachInfos = new List <AttachProperty>();
                for (int i = 0; i < value.AttachCount; i++)
                {
                    AttachProperty attachProperty = new AttachProperty();
                    attachProperty.FileNameLength = reader.ReadByte();
                    attachProperty.FileName       = reader.ReadString(attachProperty.FileNameLength);
                    attachProperty.FileSize       = reader.ReadUInt32();
                    value.AttachInfos.Add(attachProperty);
                }
            }
            return(value);
        }
Esempio n. 20
0
        public JT808_0x0200_0x66 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x0200_0x66 jT808_0X0200_0X66 = new JT808_0x0200_0x66();

            jT808_0X0200_0X66.AttachInfoId        = reader.ReadByte();
            jT808_0X0200_0X66.AttachInfoLength    = reader.ReadByte();
            jT808_0X0200_0X66.AlarmId             = reader.ReadUInt32();
            jT808_0X0200_0X66.FlagState           = reader.ReadByte();
            jT808_0X0200_0X66.Speed               = reader.ReadByte();
            jT808_0X0200_0X66.Altitude            = reader.ReadUInt16();
            jT808_0X0200_0X66.Latitude            = (int)reader.ReadUInt32();
            jT808_0X0200_0X66.Longitude           = (int)reader.ReadUInt32();
            jT808_0X0200_0X66.AlarmTime           = reader.ReadDateTime6();
            jT808_0X0200_0X66.VehicleState        = reader.ReadUInt16();
            jT808_0X0200_0X66.AlarmIdentification = JT808_AlarmIdentificationProperty_Formatter.Instance.Deserialize(ref reader, config);
            jT808_0X0200_0X66.AlarmOrEventCount   = reader.ReadByte();
            if (jT808_0X0200_0X66.AlarmOrEventCount > 0)
            {
                jT808_0X0200_0X66.AlarmOrEvents = new List <AlarmOrEventProperty>();
                for (int i = 0; i < jT808_0X0200_0X66.AlarmOrEventCount; i++)
                {
                    AlarmOrEventProperty alarmOrEventProperty = new AlarmOrEventProperty();
                    alarmOrEventProperty.TirePressureAlarmPosition = reader.ReadByte();
                    alarmOrEventProperty.AlarmOrEventType          = reader.ReadUInt16();
                    alarmOrEventProperty.TirePressure    = reader.ReadUInt16();
                    alarmOrEventProperty.TireTemperature = reader.ReadUInt16();
                    alarmOrEventProperty.BatteryLevel    = reader.ReadUInt16();
                    jT808_0X0200_0X66.AlarmOrEvents.Add(alarmOrEventProperty);
                }
            }
            return(jT808_0X0200_0X66);
        }
Esempio n. 21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x0900_0xF7 value = new JT808_0x0900_0xF7();

            value.USBMessageCount = reader.ReadByte();
            writer.WriteNumber($"[{value.USBMessageCount.ReadNumber()}]消息列表总数", value.USBMessageCount);
            if (value.USBMessageCount > 0)
            {
                writer.WriteStartArray("消息列表");
                for (int i = 0; i < value.USBMessageCount; i++)
                {
                    writer.WriteStartObject();
                    JT808_0x0900_0xF7_USB item = new JT808_0x0900_0xF7_USB();
                    item.USBID = reader.ReadByte();
                    writer.WriteNumber($"[{item.USBID.ReadNumber()}]外设ID", item.USBID);
                    item.MessageLength = reader.ReadByte();
                    writer.WriteNumber($"[{item.MessageLength.ReadNumber()}]消息长度", item.MessageLength);
                    item.WorkingCondition = reader.ReadByte();
                    var workingCondition = (WorkingConditionType)item.WorkingCondition;
                    writer.WriteNumber($"[{item.WorkingCondition.ReadNumber()}]工作状态-{workingCondition.ToString()}", item.WorkingCondition);
                    item.AlarmStatus = reader.ReadUInt32();
                    writer.WriteNumber($"[{item.AlarmStatus.ReadNumber()}]报警状态", item.AlarmStatus);
                    var alarmStatusBits = Convert.ToString(item.AlarmStatus, 2).PadLeft(32, '0').Reverse().ToArray().AsSpan();
                    writer.WriteStartObject($"报警状态对象[{alarmStatusBits.ToString()}]");
                    writer.WriteString($"[bit12~bit31]预留", alarmStatusBits.Slice(12).ToString());
                    writer.WriteString($"]bit11]定位模块异常", alarmStatusBits[11].ToString());
                    writer.WriteString($"[bit10]通讯模块异常", alarmStatusBits[10].ToString());
                    writer.WriteString($"[bit6~bit9]预留", alarmStatusBits.Slice(6, 4).ToString());
                    writer.WriteString($"[bit5]电池异常", alarmStatusBits[5].ToString());
                    writer.WriteString($"[bit4]扬声器异常", alarmStatusBits[4].ToString());
                    writer.WriteString($"[bit3]红外补光异常", alarmStatusBits[3].ToString());
                    writer.WriteString($"[bit2]辅存储器异常", alarmStatusBits[2].ToString());
                    writer.WriteString($"[bit1]主存储器异常", alarmStatusBits[1].ToString());
                    writer.WriteString($"[bit0]摄像头异常", alarmStatusBits[0].ToString());
                    writer.WriteEndObject();
                    writer.WriteEndObject();
                }
                writer.WriteEndArray();
            }
        }
Esempio n. 22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8103_0x0013 jT808_0x8103_0x0013 = new JT808_0x8103_0x0013();

            jT808_0x8103_0x0013.ParamId     = reader.ReadUInt32();
            jT808_0x8103_0x0013.ParamLength = reader.ReadByte();
            var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0013.ParamLength);

            jT808_0x8103_0x0013.ParamValue = reader.ReadString(jT808_0x8103_0x0013.ParamLength);
            writer.WriteNumber($"[{ jT808_0x8103_0x0013.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0013.ParamId);
            writer.WriteNumber($"[{jT808_0x8103_0x0013.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0013.ParamLength);
            writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值[主服务器地址IP]", jT808_0x8103_0x0013.ParamValue);
        }
Esempio n. 23
0
        public JT808_0x9212 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x9212 value = new JT808_0x9212();

            value.FileNameLength   = reader.ReadByte();
            value.FileName         = reader.ReadString(value.FileNameLength);
            value.FileType         = reader.ReadByte();
            value.UploadResult     = reader.ReadByte();
            value.DataPackageCount = reader.ReadByte();
            if (value.DataPackageCount > 0)
            {
                value.DataPackages = new List <DataPackageProperty>();
                for (int i = 0; i < value.DataPackageCount; i++)
                {
                    DataPackageProperty dataPackageProperty = new DataPackageProperty();
                    dataPackageProperty.Offset = reader.ReadUInt32();
                    dataPackageProperty.Length = reader.ReadUInt32();
                    value.DataPackages.Add(dataPackageProperty);
                }
            }
            return(value);
        }
Esempio n. 24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x0200_0x14 value = new JT808_0x0200_0x14();

            value.AttachInfoId = reader.ReadByte();
            writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId);
            value.AttachInfoLength = reader.ReadByte();
            writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength);
            value.VideoRelateAlarm = reader.ReadUInt32();
            writer.WriteNumber($"[{value.VideoRelateAlarm.ReadNumber()}]视频相关报警", value.VideoRelateAlarm);
            var videoRelateAlarmFlags = JT808EnumExtensions.GetEnumTypes <VideoRelateAlarmType>(value.VideoRelateAlarm, 32);

            if (videoRelateAlarmFlags.Any())
            {
                writer.WriteStartArray("视频报警集合");
                foreach (var item in videoRelateAlarmFlags)
                {
                    writer.WriteStringValue(item.ToString());
                }
                writer.WriteEndArray();
            }
        }
Esempio n. 25
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x0801 value = new JT808_0x0801();

            value.MultimediaId = reader.ReadUInt32();
            writer.WriteNumber($"[{value.MultimediaId.ReadNumber()}]多媒体ID", value.MultimediaId);
            value.MultimediaType = reader.ReadByte();
            writer.WriteNumber($"[{value.MultimediaType.ReadNumber()}]多媒体类型-{((JT808MultimediaType)value.MultimediaType).ToString()}", value.MultimediaType);
            value.MultimediaCodingFormat = reader.ReadByte();
            writer.WriteNumber($"[{value.MultimediaCodingFormat.ReadNumber()}]多媒体格式编码-{((JT808MultimediaCodingFormat)value.MultimediaCodingFormat).ToString()}", value.MultimediaCodingFormat);
            value.EventItemCoding = reader.ReadByte();
            writer.WriteNumber($"[{value.EventItemCoding.ReadNumber()}]事件项编码-{((JT808EventItemCoding)value.EventItemCoding).ToString()}", value.MultimediaCodingFormat);
            value.ChannelId = reader.ReadByte();
            writer.WriteNumber($"[{value.ChannelId.ReadNumber()}]通道ID", value.ChannelId);
            JT808MessagePackReader positionReader = new JT808MessagePackReader(reader.ReadArray(28));

            writer.WriteStartObject("位置基本信息");
            config.GetAnalyze <JT808_0x0200>().Analyze(ref positionReader, writer, config);
            writer.WriteEndObject();
            value.MultimediaDataPackage = reader.ReadContent().ToArray();
            writer.WriteString($"多媒体数据包", value.MultimediaDataPackage.ToHexString());
        }
Esempio n. 26
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8B05 value = new JT808_0x8B05();

            value.Response = reader.ReadByte();
            writer.WriteNumber($"[{value.Response.ReadNumber()}]业务请求结果", value.Response);
            value.Time = reader.ReadDateTime6();
            writer.WriteString($"[{value.Time:yyMMddHHmmss}]应答时间", value.Time.ToString("yyyy-MM-dd HH:mm:ss"));
            var virtualHex = reader.ReadVirtualArray(reader.ReadCurrentRemainContentLength());

            value.Additional = reader.ReadRemainStringContent();
            writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]附加内容", value.Additional);
        }
Esempio n. 27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8304 value = new JT808_0x8304();

            value.InformationType = reader.ReadByte();
            writer.WriteNumber($"[{value.InformationType.ReadNumber()}]信息类型", value.InformationType);
            value.InformationLength = reader.ReadUInt16();
            writer.WriteNumber($"[{value.InformationLength.ReadNumber()}]信息长度", value.InformationLength);
            var infoBuffer = reader.ReadVirtualArray(value.InformationLength).ToArray();

            value.InformationContent = reader.ReadString(value.InformationLength);
            writer.WriteString($"[{infoBuffer.ToHexString()}]信息内容", value.InformationContent);
        }
Esempio n. 28
0
        public JT808_0x8103_0x0076 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x8103_0x0076 jT808_0X8103_0X0076 = new JT808_0x8103_0x0076();

            jT808_0X8103_0X0076.ParamId           = reader.ReadUInt32();
            jT808_0X8103_0X0076.ParamLength       = reader.ReadByte();
            jT808_0X8103_0X0076.AVChannelTotal    = reader.ReadByte();
            jT808_0X8103_0X0076.AudioChannelTotal = reader.ReadByte();
            jT808_0X8103_0X0076.VudioChannelTotal = reader.ReadByte();
            var channelTotal = jT808_0X8103_0X0076.AVChannelTotal + jT808_0X8103_0X0076.AudioChannelTotal + jT808_0X8103_0X0076.VudioChannelTotal;//通道总数

            if (channelTotal > 0)
            {
                jT808_0X8103_0X0076.AVChannelRefTables = new List <JT808_0x8103_0x0076_AVChannelRefTable>();
                var formatter = config.GetMessagePackFormatter <JT808_0x8103_0x0076_AVChannelRefTable>();
                for (int i = 0; i < channelTotal; i++)
                {
                    jT808_0X8103_0X0076.AVChannelRefTables.Add(formatter.Deserialize(ref reader, config));
                }
            }
            return(jT808_0X8103_0X0076);
        }
Esempio n. 29
0
        public JT808_0x8100 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x8100 jT808_0X8100 = new JT808_0x8100();

            jT808_0X8100.MsgNum = reader.ReadUInt16();
            jT808_0X8100.JT808TerminalRegisterResult = (JT808TerminalRegisterResult)reader.ReadByte();
            // 只有在成功后才有该字段
            if (jT808_0X8100.JT808TerminalRegisterResult == JT808TerminalRegisterResult.成功)
            {
                jT808_0X8100.Code = reader.ReadRemainStringContent();
            }
            return(jT808_0X8100);
        }
Esempio n. 30
0
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x8B02 value = new JT808_0x8B02();

            value.GprsId = reader.ReadUInt32();
            writer.WriteNumber($"[{value.GprsId.ReadNumber()}]线路编号", value.GprsId);
            value.TrafficType = reader.ReadByte();
            writer.WriteNumber($"[{value.TrafficType.ReadNumber()}]业务类型-{Enum.GetName(typeof(TrafficType), value.TrafficType)}", value.TrafficType);
            var virtualHex = reader.ReadVirtualArray(reader.ReadCurrentRemainContentLength());

            value.Additional = reader.ReadRemainStringContent();
            writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]附加内容", value.Additional);
        }