From 6bf904224ea0715e4dfd8965da448af466e77cc1 Mon Sep 17 00:00:00 2001 From: waterliu99 Date: Sun, 19 Jan 2020 17:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=8F=E8=AE=AE=20json?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=EF=BC=8C=E5=8F=8A0104=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MessageBody/JT808_0x0104Test.cs | 22 ++++++++++++++ .../MessageBody/JT808_0x0104.cs | 30 +++++++++++++++++-- .../MessageBody/JT808_0x8103_0x0001.cs | 18 +++++++++-- .../MessageBody/JT808_0x8103_0x0002.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0003.cs | 18 +++++++++-- .../MessageBody/JT808_0x8103_0x0004.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0005.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0006.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0007.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0010.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0011.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0012.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0013.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0014.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0015.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0016.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0017.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0018.cs | 16 +++++++++- .../MessageBody/JT808_0x8103_0x0019.cs | 16 +++++++++- .../MessageBody/JT808_0x8103_0x001A.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x001B.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x001C.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x001D.cs | 20 +++++++++++-- .../MessageBody/JT808_0x8103_0x0020.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0021.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0022.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0023.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0024.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0025.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0026.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0027.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0028.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x0029.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x002C.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x002D.cs | 16 +++++++++- .../MessageBody/JT808_0x8103_0x002E.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_0x002F.cs | 19 ++++++++++-- .../MessageBody/JT808_0x8103_BodyBase.cs | 5 +++- 38 files changed, 651 insertions(+), 70 deletions(-) diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x0104Test.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x0104Test.cs index 7da6f77..4167e1f 100644 --- a/src/JT808.Protocol.Test/MessageBody/JT808_0x0104Test.cs +++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x0104Test.cs @@ -85,11 +85,33 @@ namespace JT808.Protocol.Test.MessageBody } } }; + var hex0x0104 = JT808Serializer.Serialize(new JT808_0x0104 + { + MsgNum = 20, + AnswerParamsCount = 2, + ParamList = new List { + new JT808_0x8103_0x0001() { + ParamId=0x0001, + ParamLength=4, + ParamValue=10 + }, + new JT808_0x8103_0x0013(){ + ParamId=0x0013, + ParamValue="www.baidu.com" + } + } + }).ToHexString(); var hex = JT808Serializer.Serialize(jT808Package).ToHexString(); //7E0104001E000123456789000A00140200000001040000000A000000130F7777772E62616964752E636F6DF07E //7E0104001E000123456789000A00140200000001040000000A000000130D7777772E62616964752E636F6DF27E Assert.Equal("7E0104001E000123456789000A00140200000001040000000A000000130D7777772E62616964752E636F6DF27E", hex); } + [Fact] + public void Test3() + { + byte[] bodys = "00140200000001040000000A000000130D7777772E62616964752E636F6D".ToHexBytes(); + string json = JT808Serializer.Analyze(bodys); + } [Fact] public void Test2_1() diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0104.cs b/src/JT808.Protocol/MessageBody/JT808_0x0104.cs index d7aaac2..10bbcd2 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x0104.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x0104.cs @@ -1,15 +1,18 @@ -using JT808.Protocol.Extensions; +using JT808.Protocol.Enums; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; using System; using System.Collections.Generic; +using System.Text.Json; namespace JT808.Protocol.MessageBody { /// /// 查询终端参数应答 /// - public class JT808_0x0104 : JT808Bodies, IJT808MessagePackFormatter + public class JT808_0x0104 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override ushort MsgId { get; } = 0x0104; public override string Description => "查询终端参数应答"; @@ -60,5 +63,28 @@ namespace JT808.Protocol.MessageBody JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(obj, ref writer, item, config); } } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x0104 jT808_0x0104 = new JT808_0x0104(); + jT808_0x0104.MsgNum = reader.ReadUInt16(); + jT808_0x0104.AnswerParamsCount = reader.ReadByte(); + writer.WriteNumber($"[{jT808_0x0104.MsgNum.ReadNumber()}]应答流水号", jT808_0x0104.MsgNum); + writer.WriteNumber($"[{ jT808_0x0104.AnswerParamsCount.ReadNumber()}]应答参数个数", jT808_0x0104.AnswerParamsCount); + writer.WriteStartArray($"参数列表"); + for (int i = 0; i < jT808_0x0104.AnswerParamsCount; i++) + { + writer.WriteStartObject(); + var paramId = reader.ReadVirtualUInt32();//参数ID + if (config.JT808_0X8103_Factory.Map.TryGetValue(paramId, out object instance)) + { + if (instance is IJT808Analyze analyze) { + analyze.Analyze(ref reader, writer, config); + } + } + writer.WriteEndObject(); + } + writer.WriteEndArray(); + } } } diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs index 1a1bc1e..75f78a7 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0001.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// 终端心跳发送间隔,单位为秒(s) /// 0x8103_0x0001 /// - public class JT808_0x8103_0x0001 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0001 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0001; /// @@ -20,6 +23,17 @@ namespace JT808.Protocol.MessageBody /// public uint ParamValue { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0001 jT808_0x8103_0x0001 = new JT808_0x8103_0x0001(); + jT808_0x8103_0x0001.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0001.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0001.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0001.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0001.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0001.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0001.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0001.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0001.ParamValue); + } + public JT808_0x8103_0x0001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0001 jT808_0x8103_0x0001 = new JT808_0x8103_0x0001(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs index 67d62e8..0940274 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0002.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// TCP 消息应答超时时间,单位为秒(s) /// 0x8103_0x0002 /// - public class JT808_0x8103_0x0002 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0002 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0002; /// @@ -19,6 +22,18 @@ namespace JT808.Protocol.MessageBody /// TCP 消息应答超时时间,单位为秒(s) /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0002 jT808_0x8103_0x0002 = new JT808_0x8103_0x0002(); + jT808_0x8103_0x0002.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0002.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0002.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0002.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0002.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0002.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0002.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0002.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0002.ParamValue); + } + public JT808_0x8103_0x0002 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0002 jT808_0x8103_0x0002 = new JT808_0x8103_0x0002(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs index 7ef249a..fd4c45d 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0003.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// TCP 消息重传次数 /// 0x8103_0x0003 /// - public class JT808_0x8103_0x0003 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0003 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0003; /// @@ -20,6 +23,17 @@ namespace JT808.Protocol.MessageBody /// public uint ParamValue { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0003 jT808_0x8103_0x0003 = new JT808_0x8103_0x0003(); + jT808_0x8103_0x0003.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0003.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0003.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0003.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0003.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0003.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0003.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0003.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0003.ParamValue); + } + public JT808_0x8103_0x0003 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0003 jT808_0x8103_0x0003 = new JT808_0x8103_0x0003(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs index ddce8fa..d94bdc1 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0004.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// UDP 消息应答超时时间,单位为秒(s) /// 0x8103_0x0004 /// - public class JT808_0x8103_0x0004 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0004 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0004; /// @@ -19,6 +22,18 @@ namespace JT808.Protocol.MessageBody /// UDP 消息应答超时时间,单位为秒(s) /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0004 jT808_0x8103_0x0004 = new JT808_0x8103_0x0004(); + jT808_0x8103_0x0004.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0004.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0004.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0004.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0004.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0004.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0004.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0004.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0004.ParamValue); + } + public JT808_0x8103_0x0004 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0004 jT808_0x8103_0x0004 = new JT808_0x8103_0x0004(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs index 4a61ae8..3fc833b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0005.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// UDP 消息重传次数 /// 0x8103_0x0005 /// - public class JT808_0x8103_0x0005 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0005 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0005; /// @@ -19,6 +22,18 @@ namespace JT808.Protocol.MessageBody /// UDP 消息重传次数 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0005 jT808_0x8103_0x0005 = new JT808_0x8103_0x0005(); + jT808_0x8103_0x0005.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0005.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0005.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0005.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0005.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0005.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0005.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0005.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0005.ParamValue); + } + public JT808_0x8103_0x0005 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0005 jT808_0x8103_0x0005 = new JT808_0x8103_0x0005(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs index 4e1b506..89e1058 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0006.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// SMS 消息应答超时时间,单位为秒(s) /// 0x8103_0x0006 /// - public class JT808_0x8103_0x0006 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0006 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0006; /// @@ -19,6 +22,18 @@ namespace JT808.Protocol.MessageBody /// SMS 消息应答超时时间,单位为秒(s) /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0006 jT808_0x8103_0x0006 = new JT808_0x8103_0x0006(); + jT808_0x8103_0x0006.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0006.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0006.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0006.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0006.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0006.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0006.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0006.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0006.ParamValue); + } + public JT808_0x8103_0x0006 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0006 jT808_0x8103_0x0006 = new JT808_0x8103_0x0006(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs index e04bbb2..cd454be 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0007.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// SMS 消息重传次数 /// 0x8103_0x0007 /// - public class JT808_0x8103_0x0007 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0007 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0007; /// @@ -19,6 +22,18 @@ namespace JT808.Protocol.MessageBody /// SMS 消息重传次数 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0007 jT808_0x8103_0x0007 = new JT808_0x8103_0x0007(); + jT808_0x8103_0x0007.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0007.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0007.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0007.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0007.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0007.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0007.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0007.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0007.ParamValue); + } + public JT808_0x8103_0x0007 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0007 jT808_0x8103_0x0007 = new JT808_0x8103_0x0007(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs index ede685b..448c730 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0010.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 /// - public class JT808_0x8103_0x0010 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0010 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0010; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0010 jT808_0x8103_0x0010 = new JT808_0x8103_0x0010(); + jT808_0x8103_0x0010.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0010.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0010.ParamLength); + jT808_0x8103_0x0010.ParamValue = reader.ReadString(jT808_0x8103_0x0010.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0010.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0010.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0010.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0010.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0010.ParamValue); + } + public JT808_0x8103_0x0010 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0010 jT808_0x8103_0x0010 = new JT808_0x8103_0x0010(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs index 7584bc4..8603054 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0011.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 主服务器无线通信拨号用户名 /// - public class JT808_0x8103_0x0011 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0011 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0011; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 主服务器无线通信拨号用户名 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0011 jT808_0x8103_0x0011 = new JT808_0x8103_0x0011(); + jT808_0x8103_0x0011.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0011.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0011.ParamLength); + jT808_0x8103_0x0011.ParamValue = reader.ReadString(jT808_0x8103_0x0011.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0011.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0011.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0011.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0011.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0011.ParamValue); + } + public JT808_0x8103_0x0011 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0011 jT808_0x8103_0x0011 = new JT808_0x8103_0x0011(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs index 0e9bf6c..5e1b348 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0012.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 主服务器无线通信拨号密码 /// - public class JT808_0x8103_0x0012 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0012 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0012; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 主服务器无线通信拨号密码 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0012 jT808_0x8103_0x0012 = new JT808_0x8103_0x0012(); + jT808_0x8103_0x0012.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0012.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0012.ParamLength); + jT808_0x8103_0x0012.ParamValue = reader.ReadString(jT808_0x8103_0x0012.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0012.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0012.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0012.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0012.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0012.ParamValue); + } + public JT808_0x8103_0x0012 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0012 jT808_0x8103_0x0012 = new JT808_0x8103_0x0012(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs index b88c841..c4939a9 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0013.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 主服务器地址,IP 或域名 /// - public class JT808_0x8103_0x0013 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0013 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0013; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 主服务器地址,IP 或域名 /// public string ParamValue { get; set; } + + 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()}]参数值", jT808_0x8103_0x0013.ParamValue); + } + public JT808_0x8103_0x0013 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0013 jT808_0x8103_0x0013 = new JT808_0x8103_0x0013(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs index 79c6661..e5be113 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0014.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 备份服务器 APN,无线通信拨号访问点 /// - public class JT808_0x8103_0x0014 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0014 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0014; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 备份服务器 APN,无线通信拨号访问点 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0014 jT808_0x8103_0x0014 = new JT808_0x8103_0x0014(); + jT808_0x8103_0x0014.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0014.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0014.ParamLength); + jT808_0x8103_0x0014.ParamValue = reader.ReadString(jT808_0x8103_0x0014.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0014.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0014.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0014.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0014.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0014.ParamValue); + } + public JT808_0x8103_0x0014 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0014 jT808_0x8103_0x0014 = new JT808_0x8103_0x0014(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs index 19a6664..1b026ff 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0015.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 备份服务器无线通信拨号用户名 /// - public class JT808_0x8103_0x0015 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0015 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0015; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 备份服务器无线通信拨号用户名 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0015 jT808_0x8103_0x0015 = new JT808_0x8103_0x0015(); + jT808_0x8103_0x0015.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0015.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0015.ParamLength); + jT808_0x8103_0x0015.ParamValue = reader.ReadString(jT808_0x8103_0x0015.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0015.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0015.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0015.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0015.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0015.ParamValue); + } + public JT808_0x8103_0x0015 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0015 jT808_0x8103_0x0015 = new JT808_0x8103_0x0015(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs index e3dd443..2b8bb62 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0016.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 备份服务器无线通信拨号密码 /// - public class JT808_0x8103_0x0016 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0016 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0016; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 备份服务器无线通信拨号密码 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0016 jT808_0x8103_0x0016 = new JT808_0x8103_0x0016(); + jT808_0x8103_0x0016.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0016.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0016.ParamLength); + jT808_0x8103_0x0016.ParamValue = reader.ReadString(jT808_0x8103_0x0016.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0016.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0016.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0016.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0016.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0016.ParamValue); + } + public JT808_0x8103_0x0016 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0016 jT808_0x8103_0x0016 = new JT808_0x8103_0x0016(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs index 1cfc3eb..89b28e9 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0017.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 备份服务器地址,IP 或域名 /// - public class JT808_0x8103_0x0017 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0017 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0017; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 备份服务器地址,IP 或域名 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0017 jT808_0x8103_0x0017 = new JT808_0x8103_0x0017(); + jT808_0x8103_0x0017.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0017.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0017.ParamLength); + jT808_0x8103_0x0017.ParamValue = reader.ReadString(jT808_0x8103_0x0017.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0017.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0017.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0017.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0017.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0017.ParamValue); + } + public JT808_0x8103_0x0017 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0017 jT808_0x8103_0x0017 = new JT808_0x8103_0x0017(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs index 41cf582..8cddd85 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs @@ -1,8 +1,10 @@ using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; using System; +using System.Text.Json; namespace JT808.Protocol.MessageBody { @@ -10,7 +12,7 @@ namespace JT808.Protocol.MessageBody /// 服务器 TCP 端口 /// [Obsolete("2019版本已作为保留")] - public class JT808_0x8103_0x0018 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version + public class JT808_0x8103_0x0018 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version, IJT808Analyze { public override uint ParamId { get; set; } = 0x0018; /// @@ -21,6 +23,18 @@ namespace JT808.Protocol.MessageBody ///服务器 TCP 端口 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0018 value = new JT808_0x8103_0x0018(); + value.ParamId = reader.ReadUInt32(); + value.ParamLength = reader.ReadByte(); + value.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ value.ParamId.ReadNumber()}]参数ID", value.ParamId); + writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]参数长度", value.ParamLength); + writer.WriteNumber($"[{ value.ParamValue.ReadNumber()}]参数值", value.ParamValue); + } + public JT808_0x8103_0x0018 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0018 value = new JT808_0x8103_0x0018(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs index f3bac0e..9dbfeb8 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs @@ -1,8 +1,10 @@ using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; using System; +using System.Text.Json; namespace JT808.Protocol.MessageBody { @@ -10,7 +12,7 @@ namespace JT808.Protocol.MessageBody /// 服务器 UDP 端口 /// [Obsolete("2019版本已作为保留")] - public class JT808_0x8103_0x0019 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version + public class JT808_0x8103_0x0019 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version, IJT808Analyze { public override uint ParamId { get; set; } = 0x0019; /// @@ -21,6 +23,18 @@ namespace JT808.Protocol.MessageBody ///服务器 TCP 端口 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0019 value = new JT808_0x8103_0x0019(); + value.ParamId = reader.ReadUInt32(); + value.ParamLength = reader.ReadByte(); + value.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ value.ParamId.ReadNumber()}]参数ID", value.ParamId); + writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]参数长度", value.ParamLength); + writer.WriteNumber($"[{ value.ParamValue.ReadNumber()}]参数值", value.ParamValue); + } + public JT808_0x8103_0x0019 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0019 value = new JT808_0x8103_0x0019(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs index d4e115d..dc101a5 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001A.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 道路运输证 IC 卡认证主服务器 IP 地址或域名 /// - public class JT808_0x8103_0x001A : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x001A : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x001A; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 道路运输证 IC 卡认证主服务器 IP 地址或域名 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x001A jT808_0x8103_0x001A = new JT808_0x8103_0x001A(); + jT808_0x8103_0x001A.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001A.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x001A.ParamLength); + jT808_0x8103_0x001A.ParamValue = reader.ReadString(jT808_0x8103_0x001A.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x001A.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x001A.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x001A.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x001A.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x001A.ParamValue); + } + public JT808_0x8103_0x001A Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x001A jT808_0x8103_0x001A = new JT808_0x8103_0x001A(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs index 900fd9f..dd3b76b 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001B.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 道路运输证 IC 卡认证主服务器 TCP 端口 /// - public class JT808_0x8103_0x001B : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x001B : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x001B; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody ///道路运输证 IC 卡认证主服务器 TCP 端口 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x001B jT808_0x8103_0x001B = new JT808_0x8103_0x001B(); + jT808_0x8103_0x001B.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001B.ParamLength = reader.ReadByte(); + jT808_0x8103_0x001B.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x001B.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x001B.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x001B.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x001B.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x001B.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x001B.ParamValue); + } + public JT808_0x8103_0x001B Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x001B jT808_0x8103_0x001B = new JT808_0x8103_0x001B(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs index 4693e59..2cc6f6a 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001C.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 道路运输证 IC 卡认证主服务器 UDP 端口 /// - public class JT808_0x8103_0x001C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x001C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x001C; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody ///道路运输证 IC 卡认证主服务器 UDP 端口 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x001C jT808_0x8103_0x001C = new JT808_0x8103_0x001C(); + jT808_0x8103_0x001C.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001C.ParamLength = reader.ReadByte(); + jT808_0x8103_0x001C.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x001C.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x001C.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x001C.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x001C.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x001C.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x001C.ParamValue); + } + public JT808_0x8103_0x001C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x001C jT808_0x8103_0x001C = new JT808_0x8103_0x001C(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs index 5ff09c1..9253208 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x001D.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 /// - public class JT808_0x8103_0x001D : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x001D : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x001D; /// @@ -18,6 +21,19 @@ namespace JT808.Protocol.MessageBody /// 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x001D jT808_0x8103_0x001D = new JT808_0x8103_0x001D(); + jT808_0x8103_0x001D.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x001D.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x001D.ParamLength); + jT808_0x8103_0x001D.ParamValue = reader.ReadString(jT808_0x8103_0x001D.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x001D.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x001D.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x001D.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x001D.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x001D.ParamValue); + } + public JT808_0x8103_0x001D Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x001D jT808_0x8103_0x001D = new JT808_0x8103_0x001D(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs index 6d6919a..f319563 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0020.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 /// - public class JT808_0x8103_0x0020 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0020 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0020; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 /// public uint ParamValue { get; set; } + + 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()}]参数值", jT808_0x8103_0x0020.ParamValue); + } + public JT808_0x8103_0x0020 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0020 jT808_0x8103_0x0020 = new JT808_0x8103_0x0020(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs index bf3d87d..24753d6 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0021.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 /// - public class JT808_0x8103_0x0021 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0021 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0021; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0021 jT808_0x8103_0x0021 = new JT808_0x8103_0x0021(); + jT808_0x8103_0x0021.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0021.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0021.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0021.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0021.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0021.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0021.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0021.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0021.ParamValue); + } + public JT808_0x8103_0x0021 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0021 jT808_0x8103_0x0021 = new JT808_0x8103_0x0021(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs index ca5ba4e..79cac75 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0022.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 驾驶员未登录汇报时间间隔,单位为秒(s),>0 /// - public class JT808_0x8103_0x0022 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0022 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0022; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 驾驶员未登录汇报时间间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0022 jT808_0x8103_0x0022 = new JT808_0x8103_0x0022(); + jT808_0x8103_0x0022.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0022.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0022.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0022.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0022.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0022.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0022.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0022.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0022.ParamValue); + } + public JT808_0x8103_0x0022 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0022 jT808_0x8103_0x0022 = new JT808_0x8103_0x0022(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0023.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0023.cs index c4e4e0b..d53654c 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0023.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0023.cs @@ -1,4 +1,6 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; @@ -9,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// 从服务器APN。该值为空时,终端应使用主服务器相同配置 /// 2019版本 /// - public class JT808_0x8103_0x0023 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version + public class JT808_0x8103_0x0023 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version, IJT808Analyze { public override uint ParamId { get; set; } = 0x0023; /// @@ -20,6 +22,19 @@ namespace JT808.Protocol.MessageBody /// /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0023 value = new JT808_0x8103_0x0023(); + value.ParamId = reader.ReadUInt32(); + value.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(value.ParamLength); + value.ParamValue = reader.ReadString(value.ParamLength); + writer.WriteNumber($"[{ value.ParamId.ReadNumber()}]参数ID", value.ParamId); + writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]参数长度", value.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", value.ParamValue); + } + public JT808_0x8103_0x0023 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0023 value = new JT808_0x8103_0x0023(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0024.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0024.cs index c2c2d33..f313b2a 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0024.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0024.cs @@ -1,4 +1,6 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; @@ -9,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// 从服务器无线通信拨号用户名。该值为空时,终端应使用主服务器相同配置 /// 2019版本 /// - public class JT808_0x8103_0x0024 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version + public class JT808_0x8103_0x0024 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version, IJT808Analyze { public override uint ParamId { get; set; } = 0x0024; /// @@ -20,6 +22,19 @@ namespace JT808.Protocol.MessageBody /// /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0024 jT808_0x8103_0x0024 = new JT808_0x8103_0x0024(); + jT808_0x8103_0x0024.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0024.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0024.ParamLength); + jT808_0x8103_0x0024.ParamValue = reader.ReadString(jT808_0x8103_0x0024.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0024.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0024.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0024.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0024.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0024.ParamValue); + } + public JT808_0x8103_0x0024 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0024 jT808_0x8103_0x0024 = new JT808_0x8103_0x0024(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0025.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0025.cs index 7ea75db..bedd4bf 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0025.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0025.cs @@ -1,4 +1,6 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; @@ -9,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// 从服务器无线通信拨号密码。该值为空,终端应使用主服务器相同配置 /// 2019版本 /// - public class JT808_0x8103_0x0025 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version + public class JT808_0x8103_0x0025 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version, IJT808Analyze { public override uint ParamId { get; set; } = 0x0025; /// @@ -20,6 +22,19 @@ namespace JT808.Protocol.MessageBody /// /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0025 jT808_0x8103_0x0025 = new JT808_0x8103_0x0025(); + jT808_0x8103_0x0025.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0025.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(jT808_0x8103_0x0025.ParamLength); + jT808_0x8103_0x0025.ParamValue = reader.ReadString(jT808_0x8103_0x0025.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0025.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0025.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0025.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0025.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", jT808_0x8103_0x0025.ParamValue); + } + public JT808_0x8103_0x0025 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0025 jT808_0x8103_0x0025 = new JT808_0x8103_0x0025(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0026.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0026.cs index 7be08f5..fb8cb52 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0026.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0026.cs @@ -1,4 +1,6 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; @@ -9,7 +11,7 @@ namespace JT808.Protocol.MessageBody /// 从服务器无线通信拨号密码。该值为空,终端应使用主服务器相同配置 /// 2019版本 /// - public class JT808_0x8103_0x0026 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version + public class JT808_0x8103_0x0026 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version, IJT808Analyze { public override uint ParamId { get; set; } = 0x0026; /// @@ -20,6 +22,19 @@ namespace JT808.Protocol.MessageBody /// /// public string ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0026 value = new JT808_0x8103_0x0026(); + value.ParamId = reader.ReadUInt32(); + value.ParamLength = reader.ReadByte(); + var paramValue = reader.ReadVirtualArray(value.ParamLength); + value.ParamValue = reader.ReadString(value.ParamLength); + writer.WriteNumber($"[{ value.ParamId.ReadNumber()}]参数ID", value.ParamId); + writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]参数长度", value.ParamLength); + writer.WriteString($"[{paramValue.ToArray().ToHexString()}]参数值", value.ParamValue); + } + public JT808_0x8103_0x0026 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0026 value = new JT808_0x8103_0x0026(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs index 8a4d441..2f4ced2 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0027.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 休眠时汇报时间间隔,单位为秒(s),>0 /// - public class JT808_0x8103_0x0027 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0027 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0027; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 休眠时汇报时间间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0027 jT808_0x8103_0x0027 = new JT808_0x8103_0x0027(); + jT808_0x8103_0x0027.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0027.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0027.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0027.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0027.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0027.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0027.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0027.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0027.ParamValue); + } + public JT808_0x8103_0x0027 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0027 jT808_0x8103_0x0027 = new JT808_0x8103_0x0027(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs index 79cf7cc..ad48b81 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0028.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 紧急报警时汇报时间间隔,单位为秒(s),>0 /// - public class JT808_0x8103_0x0028 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0028 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0028; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 紧急报警时汇报时间间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0028 jT808_0x8103_0x0028 = new JT808_0x8103_0x0028(); + jT808_0x8103_0x0028.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0028.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0028.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0028.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0028.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0028.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0028.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0028.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0028.ParamValue); + } + public JT808_0x8103_0x0028 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0028 jT808_0x8103_0x0028 = new JT808_0x8103_0x0028(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs index 06e7de2..d8fa0e0 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0029.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 缺省时间汇报间隔,单位为秒(s),>0 /// - public class JT808_0x8103_0x0029 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0029 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0029; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 缺省时间汇报间隔,单位为秒(s),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x0029 jT808_0x8103_0x0029 = new JT808_0x8103_0x0029(); + jT808_0x8103_0x0029.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x0029.ParamLength = reader.ReadByte(); + jT808_0x8103_0x0029.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x0029.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x0029.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x0029.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x0029.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x0029.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x0029.ParamValue); + } + public JT808_0x8103_0x0029 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x0029 jT808_0x8103_0x0029 = new JT808_0x8103_0x0029(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs index dfba47c..966f48c 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002C.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 缺省距离汇报间隔,单位为米(m),>0 /// - public class JT808_0x8103_0x002C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x002C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x002C; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 缺省距离汇报间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x002C jT808_0x8103_0x002C = new JT808_0x8103_0x002C(); + jT808_0x8103_0x002C.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002C.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002C.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x002C.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x002C.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x002C.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x002C.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x002C.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x002C.ParamValue); + } + public JT808_0x8103_0x002C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x002C jT808_0x8103_0x002C = new JT808_0x8103_0x002C(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs index 58c533d..e54c3dd 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002D.cs @@ -1,13 +1,16 @@ using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; +using System.Text.Json; namespace JT808.Protocol.MessageBody { /// /// 驾驶员未登录汇报距离间隔,单位为米(m),>0 /// - public class JT808_0x8103_0x002D : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x002D : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x002D; /// @@ -18,6 +21,17 @@ namespace JT808.Protocol.MessageBody /// 驾驶员未登录汇报距离间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x002D jT808_0x8103_0x002D = new JT808_0x8103_0x002D(); + jT808_0x8103_0x002D.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002D.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002D.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x002D.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x002D.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x002D.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x002D.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x002D.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x002D.ParamValue); + } public JT808_0x8103_0x002D Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x002D jT808_0x8103_0x002D = new JT808_0x8103_0x002D(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs index b6cd597..71f42df 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002E.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 休眠时汇报距离间隔,单位为米(m),>0 /// - public class JT808_0x8103_0x002E : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x002E : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x002E; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 休眠时汇报距离间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x002E jT808_0x8103_0x002E = new JT808_0x8103_0x002E(); + jT808_0x8103_0x002E.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002E.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002E.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x002E.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x002E.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x002E.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x002E.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x002E.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x002E.ParamValue); + } + public JT808_0x8103_0x002E Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x002E jT808_0x8103_0x002E = new JT808_0x8103_0x002E(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs index 65e8d92..d8ec2a8 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x002F.cs @@ -1,5 +1,8 @@ -using JT808.Protocol.Attributes; +using System.Text.Json; +using JT808.Protocol.Attributes; +using JT808.Protocol.Extensions; using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; namespace JT808.Protocol.MessageBody @@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody /// /// 紧急报警时汇报距离间隔,单位为米(m),>0 /// - public class JT808_0x8103_0x002F : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x002F : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x002F; /// @@ -18,6 +21,18 @@ namespace JT808.Protocol.MessageBody /// 紧急报警时汇报距离间隔,单位为米(m),>0 /// public uint ParamValue { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x8103_0x002F jT808_0x8103_0x002F = new JT808_0x8103_0x002F(); + jT808_0x8103_0x002F.ParamId = reader.ReadUInt32(); + jT808_0x8103_0x002F.ParamLength = reader.ReadByte(); + jT808_0x8103_0x002F.ParamValue = reader.ReadUInt32(); + writer.WriteNumber($"[{ jT808_0x8103_0x002F.ParamId.ReadNumber()}]参数ID", jT808_0x8103_0x002F.ParamId); + writer.WriteNumber($"[{jT808_0x8103_0x002F.ParamLength.ReadNumber()}]参数长度", jT808_0x8103_0x002F.ParamLength); + writer.WriteNumber($"[{ jT808_0x8103_0x002F.ParamValue.ReadNumber()}]参数值", jT808_0x8103_0x002F.ParamValue); + } + public JT808_0x8103_0x002F Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x8103_0x002F jT808_0x8103_0x002F = new JT808_0x8103_0x002F(); diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_BodyBase.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_BodyBase.cs index c0f7116..471a570 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x8103_BodyBase.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_BodyBase.cs @@ -1,5 +1,8 @@ -using System; +using JT808.Protocol.Interfaces; +using JT808.Protocol.MessagePack; +using System; using System.Collections.Generic; +using System.Text.Json; namespace JT808.Protocol.MessageBody {