From 76ea898d7bbb67e4f436074713f467275ab50780 Mon Sep 17 00:00:00 2001
From: "SmallChi(Koike)" <564952747@qq.com>
Date: Fri, 3 Jan 2020 16:42:33 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=AE=8C=E6=88=90=E5=8D=8F=E8=AE=AE?=
=?UTF-8?q?=E5=BC=80=E5=8F=91=E7=9A=84=E5=90=8C=E6=97=B6=EF=BC=8C=E6=8A=8A?=
=?UTF-8?q?=E5=AF=B9=E5=BA=94=E5=8D=8F=E8=AE=AE=E7=9A=84=E5=88=86=E6=9E=90?=
=?UTF-8?q?=E5=B7=A5=E5=85=B7=E4=B9=9F=E5=81=9A=E5=A5=BD=E3=80=82=201.?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=8F=E8=AE=AE=E5=88=86=E6=9E=90=E5=B7=A5?=
=?UTF-8?q?=E5=85=B7=E6=8E=A5=E5=8F=A3=202.=E5=A2=9E=E5=8A=A0=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E6=8F=8F=E8=BF=B0=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Extensions/JT808HexExtensionsTest.cs | 52 ++++++
.../JT808.Protocol.Test.csproj | 1 +
.../MessageBody/JT808_0x0001Test.cs | 8 +
.../MessageBody/JT808_0x9999.cs | 2 +
src/JT808.Protocol.Test/Simples/Demo6.cs | 5 +
.../Extensions/JT808ConfigExtensions.cs | 12 ++
.../Extensions/JT808HexExtensions.cs | 54 +++++-
.../Interfaces/IJT808Analyze.cs | 11 ++
.../Interfaces/IJT808Description.cs | 11 ++
src/JT808.Protocol/JT808.Protocol.csproj | 5 +-
src/JT808.Protocol/JT808Bodies.cs | 8 +-
src/JT808.Protocol/JT808Package.cs | 167 +++++++++++++++++-
src/JT808.Protocol/JT808Serializer.cs | 95 ++++++++++
src/JT808.Protocol/JT808SplitPackageBodies.cs | 2 +
.../MessageBody/JT808_0x0001.cs | 18 +-
.../MessageBody/JT808_0x0002.cs | 2 +
.../MessageBody/JT808_0x0003.cs | 2 +
.../MessageBody/JT808_0x0004.cs | 2 +
.../MessageBody/JT808_0x0005.cs | 1 +
.../MessageBody/JT808_0x0100.cs | 1 +
.../MessageBody/JT808_0x0102.cs | 1 +
.../MessageBody/JT808_0x0104.cs | 1 +
.../MessageBody/JT808_0x0107.cs | 2 +
.../MessageBody/JT808_0x0108.cs | 1 +
.../MessageBody/JT808_0x0200.cs | 1 +
.../MessageBody/JT808_0x0201.cs | 1 +
.../MessageBody/JT808_0x0301.cs | 1 +
.../MessageBody/JT808_0x0302.cs | 1 +
.../MessageBody/JT808_0x0303.cs | 1 +
.../MessageBody/JT808_0x0500.cs | 1 +
.../MessageBody/JT808_0x0608.cs | 1 +
.../MessageBody/JT808_0x0701.cs | 1 +
.../MessageBody/JT808_0x0702.cs | 1 +
.../MessageBody/JT808_0x0704.cs | 1 +
.../MessageBody/JT808_0x0705.cs | 1 +
.../MessageBody/JT808_0x0800.cs | 4 +-
.../MessageBody/JT808_0x0801.cs | 4 +-
.../MessageBody/JT808_0x0802.cs | 1 +
.../MessageBody/JT808_0x0805.cs | 1 +
.../MessageBody/JT808_0x0900.cs | 1 +
.../MessageBody/JT808_0x0901.cs | 1 +
.../MessageBody/JT808_0x0A00.cs | 1 +
.../MessageBody/JT808_0x8001.cs | 4 +-
.../MessageBody/JT808_0x8003.cs | 1 +
.../MessageBody/JT808_0x8004.cs | 1 +
.../MessageBody/JT808_0x8100.cs | 1 +
.../MessageBody/JT808_0x8103.cs | 1 +
.../MessageBody/JT808_0x8104.cs | 1 +
.../MessageBody/JT808_0x8105.cs | 1 +
.../MessageBody/JT808_0x8106.cs | 1 +
.../MessageBody/JT808_0x8107.cs | 2 +
.../MessageBody/JT808_0x8108.cs | 2 +
.../MessageBody/JT808_0x8201.cs | 2 +
.../MessageBody/JT808_0x8202.cs | 2 +
.../MessageBody/JT808_0x8203.cs | 1 +
.../MessageBody/JT808_0x8204.cs | 2 +
.../MessageBody/JT808_0x8300.cs | 1 +
.../MessageBody/JT808_0x8301.cs | 1 +
.../MessageBody/JT808_0x8302.cs | 1 +
.../MessageBody/JT808_0x8303.cs | 1 +
.../MessageBody/JT808_0x8304.cs | 1 +
.../MessageBody/JT808_0x8400.cs | 1 +
.../MessageBody/JT808_0x8401.cs | 1 +
.../MessageBody/JT808_0x8500.cs | 1 +
.../MessageBody/JT808_0x8600.cs | 1 +
.../MessageBody/JT808_0x8601.cs | 1 +
.../MessageBody/JT808_0x8602.cs | 1 +
.../MessageBody/JT808_0x8603.cs | 1 +
.../MessageBody/JT808_0x8604.cs | 1 +
.../MessageBody/JT808_0x8605.cs | 1 +
.../MessageBody/JT808_0x8606.cs | 1 +
.../MessageBody/JT808_0x8607.cs | 1 +
.../MessageBody/JT808_0x8608.cs | 1 +
.../MessageBody/JT808_0x8702.cs | 1 +
.../MessageBody/JT808_0x8800.cs | 1 +
.../MessageBody/JT808_0x8801.cs | 1 +
.../MessageBody/JT808_0x8802.cs | 1 +
.../MessageBody/JT808_0x8803.cs | 1 +
.../MessageBody/JT808_0x8804.cs | 1 +
.../MessageBody/JT808_0x8805.cs | 1 +
.../MessageBody/JT808_0x8900.cs | 1 +
.../MessageBody/JT808_0x8A00.cs | 1 +
.../MessagePack/JT808MessagePackReader.cs | 5 +
83 files changed, 519 insertions(+), 22 deletions(-)
create mode 100644 src/JT808.Protocol.Test/Extensions/JT808HexExtensionsTest.cs
create mode 100644 src/JT808.Protocol/Interfaces/IJT808Analyze.cs
create mode 100644 src/JT808.Protocol/Interfaces/IJT808Description.cs
diff --git a/src/JT808.Protocol.Test/Extensions/JT808HexExtensionsTest.cs b/src/JT808.Protocol.Test/Extensions/JT808HexExtensionsTest.cs
new file mode 100644
index 0000000..28bfa8a
--- /dev/null
+++ b/src/JT808.Protocol.Test/Extensions/JT808HexExtensionsTest.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Xunit;
+using JT808.Protocol.Extensions;
+
+namespace JT808.Protocol.Test.Extensions
+{
+ public class JT808HexExtensionsTest
+ {
+ [Fact]
+ public void Test1()
+ {
+ ushort a1 = 512;
+ string hex1 = a1.ReadNumber();
+ Assert.Equal("0200", hex1);
+
+ byte a2 = 126;
+ string hex2 = a2.ReadNumber();
+ Assert.Equal("7E", hex2);
+
+ ushort a3 = 126;
+ string hex3 = a3.ReadNumber();
+ Assert.Equal("007E", hex3);
+
+ short a4 = 126;
+ string hex4 = a4.ReadNumber();
+ Assert.Equal("007E", hex4);
+
+ int a5 = 126;
+ string hex5 = a5.ReadNumber();
+ Assert.Equal("0000007E", hex5);
+
+ uint a6 = 126;
+ string hex6 = a6.ReadNumber();
+ Assert.Equal("0000007E", hex6);
+
+
+ long a7 = 126;
+ string hex7 = a7.ReadNumber();
+ Assert.Equal("000000000000007E", hex7);
+
+ ulong a8 = 126;
+ string hex8 = a8.ReadNumber();
+ Assert.Equal("000000000000007E", hex8);
+
+ ulong a9 = 191204091818;
+ string hex9 = a9.ReadNumber("D12");
+ Assert.Equal("191204091818", hex9);
+ }
+ }
+}
diff --git a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj
index 07c5b0c..7325d2c 100644
--- a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj
+++ b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj
@@ -26,6 +26,7 @@
+
diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x0001Test.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x0001Test.cs
index 30c7196..911c38e 100644
--- a/src/JT808.Protocol.Test/MessageBody/JT808_0x0001Test.cs
+++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x0001Test.cs
@@ -44,5 +44,13 @@ namespace JT808.Protocol.Test.MessageBody
Assert.Equal(1000, JT808Bodies.ReplyMsgNum);
Assert.Equal(Enums.JT808TerminalResult.Success, JT808Bodies.JT808TerminalResult);
}
+
+ [Fact]
+ public void Test3()
+ {
+ var bytes = "7E 00 01 00 05 01 23 45 67 89 00 04 B3 03 E8 00 02 00 D3 7E".ToHexBytes();
+ string json = JT808Serializer.Analyze(bytes);
+ //{"[7E]\u5F00\u59CB":126,"[0001]\u6D88\u606FId":1,"\u6D88\u606F\u4F53\u5C5E\u6027\u5BF9\u8C61":{"[0000000000000101]\u6D88\u606F\u4F53\u5C5E\u6027":5,"[0]\u4FDD\u7559":0,"[0]\u4FDD\u7559":0,"[0]\u662F\u5426\u5206\u5305":false,"[000]\u6570\u636E\u52A0\u5BC6":"None","[000000101]\u6D88\u606F\u4F53\u957F\u5EA6":5},"[12345678900]\u7EC8\u7AEF\u624B\u673A\u53F7":"12345678900","[04B3]\u6D88\u606F\u6D41\u6C34\u53F7":1203,"\u6570\u636E\u4F53\u5BF9\u8C61":{"\u7EC8\u7AEF\u901A\u7528\u5E94\u7B54":"03E8000200","[03E8]\u5E94\u7B54\u6D41\u6C34\u53F7":1000,"[0002]\u5E94\u7B54\u6D88\u606FId":2,"[0]\u7ED3\u679C":"Success"},"[D3]\u6821\u9A8C\u7801":211,"[D3]\u7ED3\u675F":211}
+ }
}
}
diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x9999.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x9999.cs
index 5e819b6..0c64e56 100644
--- a/src/JT808.Protocol.Test/MessageBody/JT808_0x9999.cs
+++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x9999.cs
@@ -12,6 +12,8 @@ namespace JT808.Protocol.Test.MessageBody
public override ushort MsgId => 0x9999;
+ public override string Description => "自定义消息";
+
public JT808_0x9999 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
{
JT808_0x9999 jT808_0X9999 = new JT808_0x9999();
diff --git a/src/JT808.Protocol.Test/Simples/Demo6.cs b/src/JT808.Protocol.Test/Simples/Demo6.cs
index 0fed1c8..4d30007 100644
--- a/src/JT808.Protocol.Test/Simples/Demo6.cs
+++ b/src/JT808.Protocol.Test/Simples/Demo6.cs
@@ -148,6 +148,8 @@ namespace JT808.Protocol.Test.Simples
public override ushort MsgId => 0x91;
+ public override string Description =>"DT1Demo6";
+
public DT1Demo6 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
{
DT1Demo6 dT1Demo6 = new DT1Demo6();
@@ -169,6 +171,9 @@ namespace JT808.Protocol.Test.Simples
public byte Sex2 { get; set; }
public ushort Age2 { get; set; }
+
+ public override string Description => "DT2Demo6";
+
public DT2Demo6 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
{
DT2Demo6 dT2Demo6 = new DT2Demo6();
diff --git a/src/JT808.Protocol/Extensions/JT808ConfigExtensions.cs b/src/JT808.Protocol/Extensions/JT808ConfigExtensions.cs
index d785da0..0329eef 100644
--- a/src/JT808.Protocol/Extensions/JT808ConfigExtensions.cs
+++ b/src/JT808.Protocol/Extensions/JT808ConfigExtensions.cs
@@ -18,10 +18,22 @@ namespace JT808.Protocol
}
return formatter;
}
+ public static object GetAnalyzeByType(this IJT808Config jT808Config, Type type)
+ {
+ if (!jT808Config.FormatterFactory.FormatterDict.TryGetValue(type.GUID, out var analyze))
+ {
+ throw new JT808Exception(JT808ErrorCode.NotGlobalRegisterFormatterAssembly, type.FullName);
+ }
+ return analyze;
+ }
public static IJT808MessagePackFormatter GetMessagePackFormatter(this IJT808Config jT808Config)
{
return (IJT808MessagePackFormatter)GetMessagePackFormatterByType(jT808Config,typeof(T));
}
+ public static IJT808Analyze GetAnalyze(this IJT808Config jT808Config)
+ {
+ return (IJT808Analyze)GetAnalyzeByType(jT808Config, typeof(T));
+ }
public static JT808Serializer GetSerializer(this IJT808Config jT808Config)
{
if(!jT808SerializerDict.TryGetValue(jT808Config.ConfigId,out var serializer))
diff --git a/src/JT808.Protocol/Extensions/JT808HexExtensions.cs b/src/JT808.Protocol/Extensions/JT808HexExtensions.cs
index 8248bd5..5d5ad72 100644
--- a/src/JT808.Protocol/Extensions/JT808HexExtensions.cs
+++ b/src/JT808.Protocol/Extensions/JT808HexExtensions.cs
@@ -71,12 +71,54 @@ namespace JT808.Protocol.Extensions
return hex;
}
- ///
- /// Copyright (c) Microsoft. All rights reserved.
- /// Licensed under the MIT license. See LICENSE file in the project root for full license information.
- ///
- ///
-
+ public static string ReadNumber(this byte value, string format = "X1")
+ {
+ return value.ToString(format);
+ }
+ public static string ReadNumber(this int value, string format = "X8")
+ {
+ return value.ToString(format);
+ }
+ public static string ReadNumber(this uint value, string format = "X8")
+ {
+ return value.ToString(format);
+ }
+ public static string ReadNumber(this long value, string format = "X16")
+ {
+ return value.ToString(format);
+ }
+ public static string ReadNumber(this ulong value, string format="X16")
+ {
+ return value.ToString(format);
+ }
+ public static string ReadNumber(this short value, string format = "X4")
+ {
+ return value.ToString(format);
+ }
+ public static string ReadNumber(this ushort value, string format = "X4")
+ {
+ return value.ToString(format);
+ }
+ public static ReadOnlySpan ReadBinary(this ushort value)
+ {
+ return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan();
+ }
+ public static ReadOnlySpan ReadBinary(this short value)
+ {
+ return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan();
+ }
+ public static ReadOnlySpan ReadBinary(this uint value)
+ {
+ return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan();
+ }
+ public static ReadOnlySpan ReadBinary(this int value)
+ {
+ return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan();
+ }
+ public static ReadOnlySpan ReadBinary(this byte value)
+ {
+ return System.Convert.ToString(value, 2).PadLeft(8, '0').AsSpan();
+ }
}
public static class HexUtil
diff --git a/src/JT808.Protocol/Interfaces/IJT808Analyze.cs b/src/JT808.Protocol/Interfaces/IJT808Analyze.cs
new file mode 100644
index 0000000..0aae2b9
--- /dev/null
+++ b/src/JT808.Protocol/Interfaces/IJT808Analyze.cs
@@ -0,0 +1,11 @@
+using JT808.Protocol.MessagePack;
+using System;
+using System.Text.Json;
+
+namespace JT808.Protocol.Interfaces
+{
+ public interface IJT808Analyze
+ {
+ void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config);
+ }
+}
diff --git a/src/JT808.Protocol/Interfaces/IJT808Description.cs b/src/JT808.Protocol/Interfaces/IJT808Description.cs
new file mode 100644
index 0000000..0c80379
--- /dev/null
+++ b/src/JT808.Protocol/Interfaces/IJT808Description.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT808.Protocol.Interfaces
+{
+ public interface IJT808Description
+ {
+ string Description { get;}
+ }
+}
diff --git a/src/JT808.Protocol/JT808.Protocol.csproj b/src/JT808.Protocol/JT808.Protocol.csproj
index 7a196e9..6e195aa 100644
--- a/src/JT808.Protocol/JT808.Protocol.csproj
+++ b/src/JT808.Protocol/JT808.Protocol.csproj
@@ -14,7 +14,7 @@
https://github.com/SmallChi/JT808/blob/master/LICENSE
https://github.com/SmallChi/JT808/blob/master/LICENSE
false
- 2.2.3
+ 2.3.0-preview1
LICENSE
@@ -57,7 +57,7 @@
-
+
@@ -72,6 +72,7 @@
+
diff --git a/src/JT808.Protocol/JT808Bodies.cs b/src/JT808.Protocol/JT808Bodies.cs
index 1f6499d..953b4fd 100644
--- a/src/JT808.Protocol/JT808Bodies.cs
+++ b/src/JT808.Protocol/JT808Bodies.cs
@@ -1,6 +1,8 @@
-namespace JT808.Protocol
+using JT808.Protocol.Interfaces;
+
+namespace JT808.Protocol
{
- public abstract class JT808Bodies
+ public abstract class JT808Bodies: IJT808Description
{
///
/// 跳过数据体序列化
@@ -10,5 +12,7 @@
public virtual bool SkipSerialization { get; set; } = false;
public abstract ushort MsgId { get;}
+
+ public abstract string Description { get; }
}
}
diff --git a/src/JT808.Protocol/JT808Package.cs b/src/JT808.Protocol/JT808Package.cs
index 05e25a0..be065c0 100644
--- a/src/JT808.Protocol/JT808Package.cs
+++ b/src/JT808.Protocol/JT808Package.cs
@@ -1,17 +1,18 @@
-using JT808.Protocol.Attributes;
-using JT808.Protocol.Enums;
+using JT808.Protocol.Enums;
using JT808.Protocol.Exceptions;
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
{
///
/// JT808数据包
///
- public class JT808Package:IJT808MessagePackFormatter
+ public class JT808Package:IJT808MessagePackFormatter, IJT808Analyze
{
///
/// 起始符
@@ -170,7 +171,6 @@ namespace JT808.Protocol
}
}
}
-
// 5.读取校验码
jT808Package.CheckCode = reader.ReadByte();
// 6.读取终止位置
@@ -246,5 +246,164 @@ namespace JT808.Protocol
writer.WriteEncode();
// ---------------组包结束--------------
}
+
+ public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
+ {
+ // ---------------开始解析对象--------------
+ writer.WriteStartObject();
+ // 1. 验证校验和
+ if (!reader.CheckXorCodeVali)
+ {
+ writer.WriteString("检验和错误", $"{reader.RealCheckXorCode}!={reader.CalculateCheckXorCode}");
+ }
+ // 2.读取起始位置
+ byte start = reader.ReadEnd();
+ writer.WriteNumber($"[{start.ReadNumber()}]开始", start);
+ var msgid = reader.ReadUInt16();
+ writer.WriteNumber($"[{msgid.ReadNumber()}]消息Id", msgid);
+ ushort messageBodyPropertyValue = reader.ReadUInt16();
+ var headerMessageBodyProperty=new JT808HeaderMessageBodyProperty(messageBodyPropertyValue);
+ //消息体属性对象 开始
+ writer.WriteStartObject("消息体属性对象");
+ ReadOnlySpan messageBodyPropertyReadOnlySpan = messageBodyPropertyValue.ReadBinary();
+ writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan.ToString()}]消息体属性", messageBodyPropertyValue);
+ if (headerMessageBodyProperty.VersionFlag)
+ {
+ writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan[0]}]保留", 0);
+ writer.WriteBoolean($"[{messageBodyPropertyReadOnlySpan[1]}]协议版本标识", headerMessageBodyProperty.VersionFlag);
+ writer.WriteBoolean($"[{messageBodyPropertyReadOnlySpan.Slice(2,1).ToString()}]是否分包", headerMessageBodyProperty.IsPackage);
+ writer.WriteString($"[{messageBodyPropertyReadOnlySpan.Slice(3,3).ToString()}]数据加密", headerMessageBodyProperty.Encrypt.ToString());
+ writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan.Slice(7).ToString()}]消息体长度", headerMessageBodyProperty.DataLength);
+ //消息体属性对象 结束
+ writer.WriteEndObject();
+ //2019版本
+ var protocolVersion = reader.ReadByte();
+ writer.WriteNumber($"[{protocolVersion.ReadNumber()}]协议版本号(2019)", protocolVersion);
+ // 3.4.读取终端手机号
+ var terminalPhoneNo = reader.ReadBCD(20, config.Trim);
+ writer.WriteString($"[{terminalPhoneNo}]终端手机号", terminalPhoneNo);
+ }
+ else
+ {
+ writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan[0]}]保留", 0);
+ writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan[1]}]保留", 0);
+ writer.WriteBoolean($"[{messageBodyPropertyReadOnlySpan.Slice(2, 1).ToString()}]是否分包", headerMessageBodyProperty.IsPackage);
+ writer.WriteString($"[{messageBodyPropertyReadOnlySpan.Slice(3, 3).ToString()}]数据加密", headerMessageBodyProperty.Encrypt.ToString());
+ writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan.Slice(7).ToString()}]消息体长度", headerMessageBodyProperty.DataLength);
+ writer.WriteEndObject();
+ //2013版本
+ // 3.3.读取终端手机号
+ var terminalPhoneNo = reader.ReadBCD(config.TerminalPhoneNoLength, config.Trim);
+ //消息体属性对象 结束
+ writer.WriteString($"[{terminalPhoneNo}]终端手机号", terminalPhoneNo);
+ }
+ // 3.4.读取消息流水号
+ var msgNum = reader.ReadUInt16();
+ writer.WriteNumber($"[{msgNum.ReadNumber()}]消息流水号", msgNum);
+ // 3.5.判断有无分包
+ uint packgeCount=0, packageIndex=0;
+ if (headerMessageBodyProperty.IsPackage)
+ {
+ //3.5.1.读取消息包总数
+ packgeCount = reader.ReadUInt16();
+ writer.WriteNumber($"[{packgeCount.ReadNumber()}]消息包总数", packgeCount);
+ //3.5.2.读取消息包序号
+ packageIndex = reader.ReadUInt16();
+ writer.WriteNumber($"[{packageIndex.ReadNumber()}]消息包序号", packageIndex);
+ }
+ // 4.处理数据体
+ // 4.1.判断有无数据体
+ if (headerMessageBodyProperty.DataLength > 0)
+ {
+ if (config.MsgIdFactory.TryGetValue(msgid, out object instance))
+ {
+ //数据体属性对象 开始
+ writer.WriteStartObject("数据体对象");
+ string description = "数据体";
+ if (instance is IJT808Description jT808Description)
+ {
+ //4.2.处理消息体
+ description = jT808Description.Description;
+ }
+ if (headerMessageBodyProperty.IsPackage)
+ {
+ if (packageIndex > 1)
+ {
+ try
+ {
+ //4.2处理第二包之后的分包数据消息体
+ writer.WriteString($"[分包]数据体", reader.ReadContent().ToArray().ToHexString());
+ }
+ catch (Exception ex)
+ {
+ writer.WriteString($"[分包]数据体异常", ex.StackTrace);
+ }
+ }
+ else
+ {
+ try
+ {
+ writer.WriteString($"[分包]{description}", reader.ReadVirtualArray(headerMessageBodyProperty.DataLength).ToArray().ToHexString());
+ if (instance is IJT808Analyze analyze)
+ {
+ //4.2.处理消息体
+ analyze.Analyze(ref reader, writer, config);
+ }
+ }
+ catch (Exception ex)
+ {
+ writer.WriteString($"[分包]数据体异常", ex.StackTrace);
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ writer.WriteString($"{description}", reader.ReadVirtualArray(headerMessageBodyProperty.DataLength).ToArray().ToHexString());
+ if (instance is IJT808Analyze analyze)
+ {
+ //4.2.处理消息体
+ analyze.Analyze(ref reader, writer, config);
+ }
+ }
+ catch (Exception ex)
+ {
+ writer.WriteString($"数据体异常", ex.StackTrace);
+ }
+ }
+ //数据体属性对象 结束
+ writer.WriteEndObject();
+ }
+ }
+ else
+ {
+ if (config.MsgIdFactory.TryGetValue(msgid, out object instance))
+ {
+ //数据体属性对象 开始
+ writer.WriteStartObject("数据体对象");
+ string description = "[Null]数据体";
+ if (instance is IJT808Description jT808Description)
+ {
+ //4.2.处理消息体
+ description = jT808Description.Description;
+ }
+ writer.WriteNull(description);
+ //数据体属性对象 结束
+ writer.WriteEndObject();
+ }
+ else
+ {
+ writer.WriteNull($"[Null]数据体");
+ }
+ }
+ // 5.读取校验码
+ reader.ReadByte();
+ writer.WriteNumber($"[{reader.RealCheckXorCode.ReadNumber()}]校验码", reader.RealCheckXorCode);
+ // 6.读取终止位置
+ byte end = reader.ReadEnd();
+ writer.WriteNumber($"[{end.ReadNumber()}]结束", end);
+ writer.WriteEndObject();
+ }
}
}
diff --git a/src/JT808.Protocol/JT808Serializer.cs b/src/JT808.Protocol/JT808Serializer.cs
index 7df4ede..77d66e1 100644
--- a/src/JT808.Protocol/JT808Serializer.cs
+++ b/src/JT808.Protocol/JT808Serializer.cs
@@ -5,6 +5,9 @@ using JT808.Protocol.Interfaces;
using JT808.Protocol.Internal;
using JT808.Protocol.MessagePack;
using System;
+using System.IO;
+using System.Text;
+using System.Text.Json;
namespace JT808.Protocol
{
@@ -161,5 +164,97 @@ namespace JT808.Protocol
JT808ArrayPool.Return(buffer);
}
}
+
+ public string Analyze(ReadOnlySpan bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096)
+ {
+ byte[] buffer = JT808ArrayPool.Rent(minBufferSize);
+ try
+ {
+ JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version);
+ jT808MessagePackReader.Decode(buffer);
+ using(MemoryStream memoryStream = new MemoryStream())
+ using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options))
+ {
+ jT808Package.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config);
+ utf8JsonWriter.Flush();
+ string value = Encoding.UTF8.GetString(memoryStream.ToArray());
+ return value;
+ }
+ }
+ finally
+ {
+ JT808ArrayPool.Return(buffer);
+ }
+ }
+
+ public string Analyze(ReadOnlySpan bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096)
+ {
+ byte[] buffer = JT808ArrayPool.Rent(minBufferSize);
+ byte[] buffer1 = JT808ArrayPool.Rent(minBufferSize);
+ try
+ {
+
+ JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version);
+ if (CheckPackageType(typeof(T)))
+ jT808MessagePackReader.Decode(buffer);
+ var analyze = jT808Config.GetAnalyze();
+ using (MemoryStream memoryStream = new MemoryStream(buffer1))
+ using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options))
+ {
+ analyze.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config);
+ utf8JsonWriter.Flush();
+ return utf8JsonWriter.ToString();
+ }
+ }
+ finally
+ {
+ JT808ArrayPool.Return(buffer);
+ JT808ArrayPool.Return(buffer1);
+ }
+ }
+
+ public byte[] AnalyzeJsonBuffer(ReadOnlySpan bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096)
+ {
+ byte[] buffer = JT808ArrayPool.Rent(minBufferSize);
+ try
+ {
+ JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version);
+ jT808MessagePackReader.Decode(buffer);
+ using (MemoryStream memoryStream = new MemoryStream())
+ using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options))
+ {
+ jT808Package.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config);
+ utf8JsonWriter.Flush();
+ return memoryStream.ToArray();
+ }
+ }
+ finally
+ {
+ JT808ArrayPool.Return(buffer);
+ }
+ }
+
+ public byte[] AnalyzeJsonBuffer(ReadOnlySpan bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096)
+ {
+ byte[] buffer = JT808ArrayPool.Rent(minBufferSize);
+ try
+ {
+ JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version);
+ if (CheckPackageType(typeof(T)))
+ jT808MessagePackReader.Decode(buffer);
+ var analyze = jT808Config.GetAnalyze();
+ using (MemoryStream memoryStream = new MemoryStream())
+ using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options))
+ {
+ analyze.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config);
+ utf8JsonWriter.Flush();
+ return memoryStream.ToArray();
+ }
+ }
+ finally
+ {
+ JT808ArrayPool.Return(buffer);
+ }
+ }
}
}
diff --git a/src/JT808.Protocol/JT808SplitPackageBodies.cs b/src/JT808.Protocol/JT808SplitPackageBodies.cs
index 494b575..1a81e3c 100644
--- a/src/JT808.Protocol/JT808SplitPackageBodies.cs
+++ b/src/JT808.Protocol/JT808SplitPackageBodies.cs
@@ -14,6 +14,8 @@ namespace JT808.Protocol
public override ushort MsgId => 0xFFFF;
+ public override string Description => "统一分包数据体";
+
public JT808SplitPackageBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
{
JT808SplitPackageBodies jT808SplitPackageBodies = new JT808SplitPackageBodies
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0001.cs b/src/JT808.Protocol/MessageBody/JT808_0x0001.cs
index e30733b..73d598f 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0001.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0001.cs
@@ -1,15 +1,19 @@
using JT808.Protocol.Enums;
using JT808.Protocol.MessagePack;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using System.Text.Json;
+using JT808.Protocol.Extensions;
namespace JT808.Protocol.MessageBody
{
///
/// 终端通用应答
///
- public class JT808_0x0001 : JT808Bodies,IJT808MessagePackFormatter
+ public class JT808_0x0001 : JT808Bodies,IJT808MessagePackFormatter, IJT808Analyze
{
- public override ushort MsgId { get; } = 0x0001;
+ public override ushort MsgId => 0x0001;
+ public override string Description => "终端通用应答";
///
/// 应答流水号
/// 对应的平台消息的流水号
@@ -43,5 +47,15 @@ namespace JT808.Protocol.MessageBody
writer.WriteUInt16(value.ReplyMsgId);
writer.WriteByte((byte)value.JT808TerminalResult);
}
+
+ public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
+ {
+ var replyMsgNum = reader.ReadUInt16();
+ var replyMsgId = reader.ReadUInt16();
+ var terminalResult = reader.ReadByte();
+ writer.WriteNumber($"[{replyMsgNum.ReadNumber()}]应答流水号", replyMsgNum);
+ writer.WriteNumber($"[{replyMsgId.ReadNumber()}]应答消息Id", replyMsgId);
+ writer.WriteString($"[{terminalResult.ReadNumber()}]结果", ((JT808TerminalResult)terminalResult).ToString());
+ }
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0002.cs b/src/JT808.Protocol/MessageBody/JT808_0x0002.cs
index 5c3897d..1460fb4 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0002.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0002.cs
@@ -7,5 +7,7 @@
{
public override bool SkipSerialization { get; set; } = true;
public override ushort MsgId { get; } = 0x0002;
+
+ public override string Description => "终端心跳";
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0003.cs b/src/JT808.Protocol/MessageBody/JT808_0x0003.cs
index c40c6de..fa7c088 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0003.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0003.cs
@@ -11,5 +11,7 @@
public override bool SkipSerialization { get; set; } = true;
public override ushort MsgId { get; } = 0x0003;
+
+ public override string Description => "终端注销请求";
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0004.cs b/src/JT808.Protocol/MessageBody/JT808_0x0004.cs
index cee0e31..444947a 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0004.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0004.cs
@@ -14,5 +14,7 @@ namespace JT808.Protocol.MessageBody
public override bool SkipSerialization { get; set; } = true;
public override ushort MsgId { get; } = 0x0004;
+
+ public override string Description => "查询服务器时间请求";
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0005.cs b/src/JT808.Protocol/MessageBody/JT808_0x0005.cs
index fece5fb..93d8642 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0005.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0005.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0005 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0005;
+ public override string Description => "终端补传分包请求";
///
/// 原始消息流水号
/// 对应要求补传的原始消息第一包的消息流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0100.cs b/src/JT808.Protocol/MessageBody/JT808_0x0100.cs
index f910b99..5d33c1c 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0100.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0100.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0100 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0100;
+ public override string Description => "终端注册";
///
/// 省域 ID
/// 标示终端安装车辆所在的省域,0 保留,由平台取默
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0102.cs b/src/JT808.Protocol/MessageBody/JT808_0x0102.cs
index f1fb49f..a203772 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0102.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0102.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0102 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0102;
+ public override string Description => "终端鉴权";
///
/// 鉴权码
/// 鉴权码内容 2019版本
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0104.cs b/src/JT808.Protocol/MessageBody/JT808_0x0104.cs
index f518539..d7aaac2 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0104.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0104.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0104 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0104;
+ public override string Description => "查询终端参数应答";
///
/// 应答流水号
/// 查询指定终端参数的流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0107.cs b/src/JT808.Protocol/MessageBody/JT808_0x0107.cs
index 7046225..dffdde3 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0107.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0107.cs
@@ -11,6 +11,8 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0107 : JT808Bodies,IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0107;
+
+ public override string Description => "查询终端属性应答";
///
/// 终端类型
/// bit0,0:不适用客运车辆,1:适用客运车辆;
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0108.cs b/src/JT808.Protocol/MessageBody/JT808_0x0108.cs
index 139b742..1c1f633 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0108.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0108.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0108 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0108;
+ public override string Description => "终端升级结果通知";
///
/// 升级类型
/// 0:终端,12:道路运输证 IC 卡读卡器,52:北斗卫星定位模块
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0200.cs b/src/JT808.Protocol/MessageBody/JT808_0x0200.cs
index de8e3c2..11c844b 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0200.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0200.cs
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0200 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0200;
+ public override string Description => "位置信息汇报";
///
/// 报警标志
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0201.cs b/src/JT808.Protocol/MessageBody/JT808_0x0201.cs
index 978e140..25d0142 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0201.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0201.cs
@@ -9,6 +9,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0201 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0201;
+ public override string Description => "位置信息查询应答";
///
/// 应答流水号
/// 对应的终端注册消息的流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0301.cs b/src/JT808.Protocol/MessageBody/JT808_0x0301.cs
index 6a0bb97..fc6c605 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0301.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0301.cs
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0301 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0301;
+ public override string Description => "事件报告";
///
/// 事件 ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0302.cs b/src/JT808.Protocol/MessageBody/JT808_0x0302.cs
index 73eb5bd..fa11004 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0302.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0302.cs
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0302 : JT808Bodies, IJT808MessagePackFormatter,IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0302;
+ public override string Description => "提问应答";
///
/// 应答流水号
/// 对应的提问下发消息的流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0303.cs b/src/JT808.Protocol/MessageBody/JT808_0x0303.cs
index 022b61a..90600d5 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0303.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0303.cs
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0303 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0303;
+ public override string Description => "信息点播_取消";
///
/// 信息类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0500.cs b/src/JT808.Protocol/MessageBody/JT808_0x0500.cs
index fd17390..1bc272e 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0500.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0500.cs
@@ -9,6 +9,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0500 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0500;
+ public override string Description => "车辆控制应答";
///
/// 应答流水号
/// 对应的终端注册消息的流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0608.cs b/src/JT808.Protocol/MessageBody/JT808_0x0608.cs
index 2e95263..fca63ca 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0608.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0608.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0608 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0608;
+ public override string Description => "查询区域或线路数据应答";
///
/// 查询类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0701.cs b/src/JT808.Protocol/MessageBody/JT808_0x0701.cs
index ec12c91..addd7b1 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0701.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0701.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0701 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0701;
+ public override string Description => "电子运单上报";
///
/// 电子运单长度
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0702.cs b/src/JT808.Protocol/MessageBody/JT808_0x0702.cs
index 6c6aa01..3715d83 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0702.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0702.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0702 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0702;
+ public override string Description => "驾驶员身份信息采集上报";
///
/// 状态
/// 0x01:从业资格证 IC 卡插入(驾驶员上班);
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0704.cs b/src/JT808.Protocol/MessageBody/JT808_0x0704.cs
index 6b96b59..b40f035 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0704.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0704.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0704 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0704;
+ public override string Description => "定位数据批量上传";
///
/// 数据项个数
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0705.cs b/src/JT808.Protocol/MessageBody/JT808_0x0705.cs
index 72d428f..f816e64 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0705.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0705.cs
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0705 : JT808Bodies, IJT808MessagePackFormatter,IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0705;
+ public override string Description => "CAN总线数据上传";
///
/// 数据项个数
/// 包含的 CAN 总线数据项个数,>0
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0800.cs b/src/JT808.Protocol/MessageBody/JT808_0x0800.cs
index 6fc48aa..2e1ca8b 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0800.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0800.cs
@@ -1,5 +1,4 @@
-using JT808.Protocol.Attributes;
-using JT808.Protocol.Formatters;
+using JT808.Protocol.Formatters;
using JT808.Protocol.MessagePack;
namespace JT808.Protocol.MessageBody
@@ -11,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0800 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0800;
+ public override string Description => "多媒体事件信息上传";
///
/// 多媒体数据 ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0801.cs b/src/JT808.Protocol/MessageBody/JT808_0x0801.cs
index 69c292a..4decbba 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0801.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0801.cs
@@ -1,5 +1,4 @@
-using JT808.Protocol.Attributes;
-using JT808.Protocol.Formatters;
+using JT808.Protocol.Formatters;
using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
@@ -12,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0801 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0801;
+ public override string Description => "多媒体数据上传";
///
/// 多媒体 ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0802.cs b/src/JT808.Protocol/MessageBody/JT808_0x0802.cs
index 3ede9fc..f108791 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0802.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0802.cs
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0802 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0802;
+ public override string Description => "存储多媒体数据检索应答";
///
/// 应答流水号
/// 对应的多媒体数据检索消息的流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0805.cs b/src/JT808.Protocol/MessageBody/JT808_0x0805.cs
index b32a1d3..c2a4a07 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0805.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0805.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0805 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0805;
+ public override string Description => "摄像头立即拍摄命令应答";
///
/// 应答流水号
/// 对应平台摄像头立即拍摄命令的消息流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0900.cs b/src/JT808.Protocol/MessageBody/JT808_0x0900.cs
index 84c51ef..3b9d75c 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0900.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0900.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0900 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0900;
+ public override string Description => "数据上行透传";
///
/// 透传消息类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0901.cs b/src/JT808.Protocol/MessageBody/JT808_0x0901.cs
index cf0d10a..7dcd81f 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0901.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0901.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0901 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0901;
+ public override string Description => "数据压缩上报";
///
/// 未压缩消息长度
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0A00.cs b/src/JT808.Protocol/MessageBody/JT808_0x0A00.cs
index 4382b70..37d978f 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0A00.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0A00.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x0A00 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x0A00;
+ public override string Description => "终端RSA公钥";
///
/// e
/// 终端 RSA 公钥{e,n}中的 e
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8001.cs b/src/JT808.Protocol/MessageBody/JT808_0x8001.cs
index a44069e..adf5183 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8001.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8001.cs
@@ -1,5 +1,4 @@
-using JT808.Protocol.Attributes;
-using JT808.Protocol.Enums;
+using JT808.Protocol.Enums;
using JT808.Protocol.Formatters;
using JT808.Protocol.MessagePack;
@@ -11,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8001 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8001;
+ public override string Description => "平台通用应答";
public ushort MsgNum { get; set; }
///
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8003.cs b/src/JT808.Protocol/MessageBody/JT808_0x8003.cs
index 7d8edae..4c49465 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8003.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8003.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8003 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8003;
+ public override string Description => "补传分包请求";
///
/// 原始消息流水号
/// 对应要求补传的原始消息第一包的消息流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8004.cs b/src/JT808.Protocol/MessageBody/JT808_0x8004.cs
index 0a58ffb..83e38f1 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8004.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8004.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8004 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8004;
+ public override string Description => "查询服务器时间应答";
public DateTime Time { get; set; } = DateTime.Now;
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8100.cs b/src/JT808.Protocol/MessageBody/JT808_0x8100.cs
index 8b3b6a6..1b0b2c6 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8100.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8100.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8100 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8100;
+ public override string Description => "终端注册应答";
///
/// 应答流水号
/// 对应的终端注册消息的流水号
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103.cs
index 41e9dc5..264041d 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8103.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103.cs
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8103 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8103;
+ public override string Description => "设置终端参数";
///
/// 参数总数
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8104.cs b/src/JT808.Protocol/MessageBody/JT808_0x8104.cs
index 2123de2..c09ad90 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8104.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8104.cs
@@ -6,6 +6,7 @@
public class JT808_0x8104 : JT808Bodies
{
public override ushort MsgId { get; } = 0x8104;
+ public override string Description => "查询终端参数";
///
/// 跳过数据体序列化
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8105.cs b/src/JT808.Protocol/MessageBody/JT808_0x8105.cs
index 7817f72..4f04061 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8105.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8105.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8105;
+ public override string Description => "终端控制";
///
/// 命令字
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8106.cs b/src/JT808.Protocol/MessageBody/JT808_0x8106.cs
index d255aa9..742ced1 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8106.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8106.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8106 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8106;
+ public override string Description => "查询指定终端参数";
///
/// 参数总数
/// 参数总数为 n
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8107.cs b/src/JT808.Protocol/MessageBody/JT808_0x8107.cs
index e15f167..8673626 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8107.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8107.cs
@@ -10,5 +10,7 @@
/// 跳过数据体序列化
///
public override bool SkipSerialization { get; set; } = true;
+
+ public override string Description => "查询终端属性";
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8108.cs b/src/JT808.Protocol/MessageBody/JT808_0x8108.cs
index 0909548..1c6036c 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8108.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8108.cs
@@ -11,6 +11,8 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8108 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8108;
+
+ public override string Description => "下发终端升级包";
///
/// 升级类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8201.cs b/src/JT808.Protocol/MessageBody/JT808_0x8201.cs
index 87877d2..b59ee85 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8201.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8201.cs
@@ -10,5 +10,7 @@
/// 跳过数据体序列化
///
public override bool SkipSerialization { get; set; } = true;
+
+ public override string Description => "位置信息查询";
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8202.cs b/src/JT808.Protocol/MessageBody/JT808_0x8202.cs
index d1439f3..1b8edb7 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8202.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8202.cs
@@ -9,6 +9,8 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8202 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8202;
+
+ public override string Description => "临时位置跟踪控制";
///
/// 时间间隔
/// 单位为秒(s),0 则停止跟踪。停止跟踪无需带后继字段
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8203.cs b/src/JT808.Protocol/MessageBody/JT808_0x8203.cs
index 733d842..32c2504 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8203.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8203.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8203 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8203;
+ public override string Description => "人工确认报警消息";
///
/// 报警消息流水号
/// 需人工确认的报警消息流水号,0 表示该报警类型所有消息
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8204.cs b/src/JT808.Protocol/MessageBody/JT808_0x8204.cs
index 2c6cfba..c4679fd 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8204.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8204.cs
@@ -13,5 +13,7 @@ namespace JT808.Protocol.MessageBody
public override ushort MsgId { get; } = 0x8204;
public override bool SkipSerialization { get; set; } = true;
+
+ public override string Description => "链路检测";
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8300.cs b/src/JT808.Protocol/MessageBody/JT808_0x8300.cs
index f80a52f..af32c00 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8300.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8300.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8300 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8300;
+ public override string Description => "文本信息下发";
///
/// 文本信息标志位含义见 表 38
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8301.cs b/src/JT808.Protocol/MessageBody/JT808_0x8301.cs
index 28bc748..dd40024 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8301.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8301.cs
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8301 : JT808Bodies, IJT808MessagePackFormatter,IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8301;
+ public override string Description => "事件设置";
///
/// 设置类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8302.cs b/src/JT808.Protocol/MessageBody/JT808_0x8302.cs
index 9da475d..812928d 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8302.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8302.cs
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8302 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8302;
+ public override string Description => "提问下发";
///
/// 标志
/// 提问下发标志位定义
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8303.cs b/src/JT808.Protocol/MessageBody/JT808_0x8303.cs
index 9b7b6ca..2cd5a33 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8303.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8303.cs
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8303 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8303;
+ public override string Description => "信息点播菜单设置";
///
/// 设置类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8304.cs b/src/JT808.Protocol/MessageBody/JT808_0x8304.cs
index 5d67744..f5502d4 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8304.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8304.cs
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8304 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8304;
+ public override string Description => "信息服务";
///
/// 信息类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8400.cs b/src/JT808.Protocol/MessageBody/JT808_0x8400.cs
index 2795e2e..e7c08b1 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8400.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8400.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8400 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8400;
+ public override string Description => "电话回拨";
///
/// 0:普通通话;1:监听
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8401.cs b/src/JT808.Protocol/MessageBody/JT808_0x8401.cs
index 4905e6f..465f7e4 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8401.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8401.cs
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8401 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8401;
+ public override string Description => "设置电话本";
///
/// 设置类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8500.cs b/src/JT808.Protocol/MessageBody/JT808_0x8500.cs
index 5f85269..92ef3c8 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8500.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8500.cs
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8500 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8500;
+ public override string Description => "车辆控制";
///
/// 控制标志
/// 控制指令标志位数据格式
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8600.cs b/src/JT808.Protocol/MessageBody/JT808_0x8600.cs
index 63fc9e1..390dfed 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8600.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8600.cs
@@ -16,6 +16,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8600 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8600;
+ public override string Description => "设置圆形区域";
///
/// 设置属性
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8601.cs b/src/JT808.Protocol/MessageBody/JT808_0x8601.cs
index c130bed..f08bdad 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8601.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8601.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8601 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8601;
+ public override string Description => "删除圆形区域";
///
/// 区域数
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8602.cs b/src/JT808.Protocol/MessageBody/JT808_0x8602.cs
index 4ae2ddb..36d2c32 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8602.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8602.cs
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8602 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8602;
+ public override string Description => "设置矩形区域";
///
/// 设置属性
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8603.cs b/src/JT808.Protocol/MessageBody/JT808_0x8603.cs
index 5c5e2dc..c38cfc3 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8603.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8603.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8603 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8603;
+ public override string Description => "删除矩形区域";
///
/// 区域数
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8604.cs b/src/JT808.Protocol/MessageBody/JT808_0x8604.cs
index 46c65b0..3c9be9a 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8604.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8604.cs
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8604 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8604;
+ public override string Description => "设置多边形区域";
///
/// 区域 ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8605.cs b/src/JT808.Protocol/MessageBody/JT808_0x8605.cs
index 9c92201..fa375ac 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8605.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8605.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8605 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8605;
+ public override string Description => "删除多边形区域";
///
/// 区域数
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8606.cs b/src/JT808.Protocol/MessageBody/JT808_0x8606.cs
index c4a0791..f759853 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8606.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8606.cs
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8606 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8606;
+ public override string Description => "设置路线";
///
/// 路线 ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8607.cs b/src/JT808.Protocol/MessageBody/JT808_0x8607.cs
index 466e727..e6afe14 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8607.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8607.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8607 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8607;
+ public override string Description => "删除路线";
///
/// 区域数
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8608.cs b/src/JT808.Protocol/MessageBody/JT808_0x8608.cs
index ae16130..039294a 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8608.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8608.cs
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8608 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8608;
+ public override string Description => "查询区域或线路数据";
///
/// 查询类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8702.cs b/src/JT808.Protocol/MessageBody/JT808_0x8702.cs
index e7b1d9f..374b9f9 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8702.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8702.cs
@@ -6,6 +6,7 @@
public class JT808_0x8702 : JT808Bodies
{
public override ushort MsgId { get; } = 0x8702;
+ public override string Description => "上报驾驶员身份信息请求";
///
/// 跳过数据体序列化
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8800.cs b/src/JT808.Protocol/MessageBody/JT808_0x8800.cs
index c6e17ee..2b36b6b 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8800.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8800.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8800 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8800;
+ public override string Description => "多媒体数据上传应答";
///
/// 多媒体ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8801.cs b/src/JT808.Protocol/MessageBody/JT808_0x8801.cs
index 3b5820c..148039f 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8801.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8801.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8801 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8801;
+ public override string Description => "摄像头立即拍摄命令";
///
/// 通道 ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8802.cs b/src/JT808.Protocol/MessageBody/JT808_0x8802.cs
index 6664739..6a31c31 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8802.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8802.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8802 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8802;
+ public override string Description => "存储多媒体数据检索";
///
/// 多媒体类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8803.cs b/src/JT808.Protocol/MessageBody/JT808_0x8803.cs
index 8a2d851..f0a3422 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8803.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8803.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8803 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8803;
+ public override string Description => "存储多媒体数据上传命令";
///
/// 多媒体类型
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8804.cs b/src/JT808.Protocol/MessageBody/JT808_0x8804.cs
index ea044a9..6d64696 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8804.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8804.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8804 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8804;
+ public override string Description => "录音开始命令";
///
/// 录音命令
/// 0:停止录音;0x01:开始录音;
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8805.cs b/src/JT808.Protocol/MessageBody/JT808_0x8805.cs
index cf56b20..bdc3f00 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8805.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8805.cs
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8805 : JT808Bodies, IJT808MessagePackFormatter,IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8805;
+ public override string Description => "单条存储多媒体数据检索上传命令";
///
/// 多媒体ID
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8900.cs b/src/JT808.Protocol/MessageBody/JT808_0x8900.cs
index 3283377..aac01ac 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8900.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8900.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8900 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8900;
+ public override string Description => "数据下行透传";
///
/// 透传消息类型
/// 透传消息类型定义见 表 93
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8A00.cs b/src/JT808.Protocol/MessageBody/JT808_0x8A00.cs
index 5cf4d2f..b56c328 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8A00.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8A00.cs
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody
public class JT808_0x8A00 : JT808Bodies, IJT808MessagePackFormatter
{
public override ushort MsgId { get; } = 0x8A00;
+ public override string Description => "平台RSA公钥";
///
/// e
/// 平台 RSA 公钥{e,n}中的 e
diff --git a/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs b/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs
index 05248dd..3778b97 100644
--- a/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs
+++ b/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs
@@ -160,6 +160,10 @@ namespace JT808.Protocol.MessagePack
{
return GetVirtualReadOnlySpan(1)[0];
}
+ public ReadOnlySpan ReadVirtualArray(int count)
+ {
+ return GetVirtualReadOnlySpan(count);
+ }
public ushort ReadVirtualUInt16()
{
return BinaryPrimitives.ReadUInt16BigEndian(GetVirtualReadOnlySpan(2));
@@ -229,6 +233,7 @@ namespace JT808.Protocol.MessagePack
string hex = HexUtil.DoHexDump(readOnlySpan, 0, len);
return hex;
}
+
///
/// yyMMddHHmmss
///