From 47f2575f92b5db29612bf06d286973e48bda4ef9 Mon Sep 17 00:00:00 2001
From: SmallChi <564952747@qq.com>
Date: Tue, 25 Sep 2018 14:56:30 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B9=B3=E5=8F=B0=E9=97=B4?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BA=A4=E4=BA=92=E7=B1=BB=E4=B8=BB/?=
=?UTF-8?q?=E4=BB=8E=E9=93=BE=E8=B7=AF=E5=B9=B3=E5=8F=B0=E9=97=B4=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E4=BA=A4=E4=BA=92=E6=B6=88=E6=81=AF=E5=8F=8A=E5=AD=90?=
=?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=B6=88=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 20 ++++++-
src/JT809.Protocol/JT809.Protocol.csproj | 3 +
.../JT809Enums/JT809BusinessType.cs | 3 +
.../JT809Enums/JT809SubBusinessType.cs | 4 ++
.../JT809Enums/JT809_0x1301_ObjectType.cs | 16 +++++
.../JT809Enums/JT809_0x9301_ObjectType.cs | 16 +++++
.../JT809Enums/JT809_0x9302_ObjectType.cs | 23 +++++++
.../JT809_0x1300Formatter.cs | 60 +++++++++++++++++++
.../JT809_0x9300Formatter.cs | 60 +++++++++++++++++++
.../JT809_0x1300_0x1301Formatter.cs | 38 ++++++++++++
.../JT809_0x1300_0x1302Formatter.cs | 27 +++++++++
.../JT809_0x9300_0x9301Formatter.cs | 38 ++++++++++++
.../JT809_0x9300_0x9302Formatter.cs | 38 ++++++++++++
.../JT809MessageBody/JT809_0x1300.cs | 30 ++++++++++
.../JT809MessageBody/JT809_0x9300.cs | 33 ++++++++++
.../JT809_0x1300_0x1301.cs | 39 ++++++++++++
.../JT809_0x1300_0x1302.cs | 22 +++++++
.../JT809_0x9300_0x9301.cs | 39 ++++++++++++
.../JT809_0x9300_0x9302.cs | 39 ++++++++++++
19 files changed, 547 insertions(+), 1 deletion(-)
create mode 100644 src/JT809.Protocol/JT809Enums/JT809_0x1301_ObjectType.cs
create mode 100644 src/JT809.Protocol/JT809Enums/JT809_0x9301_ObjectType.cs
create mode 100644 src/JT809.Protocol/JT809Enums/JT809_0x9302_ObjectType.cs
create mode 100644 src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x1300Formatter.cs
create mode 100644 src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x9300Formatter.cs
create mode 100644 src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1301Formatter.cs
create mode 100644 src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1302Formatter.cs
create mode 100644 src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9301Formatter.cs
create mode 100644 src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9302Formatter.cs
create mode 100644 src/JT809.Protocol/JT809MessageBody/JT809_0x1300.cs
create mode 100644 src/JT809.Protocol/JT809MessageBody/JT809_0x9300.cs
create mode 100644 src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1301.cs
create mode 100644 src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1302.cs
create mode 100644 src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9301.cs
create mode 100644 src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9302.cs
diff --git a/README.md b/README.md
index 043295a..5823ef9 100644
--- a/README.md
+++ b/README.md
@@ -71,4 +71,22 @@
| 8 | 0x9208 | √ | 取消申请交换指定车辆定位信息应答消息 |
| 9 | 0x9209 | √ | 补发车辆定位信息应答消息 |
| 10 | 0x920A | √ | 上报驾驶员身份识别信息请求消息 |
-| 11 | 0x920B | √ | 上报车辆电子运单请求消息 |
\ No newline at end of file
+| 11 | 0x920B | √ | 上报车辆电子运单请求消息 |
+
+### 平台间信息交互类
+
+#### 主链路平台间信息交互消息
+
+|序号|消息ID|完成情况|消息体名称|
+|:------:|:------:|:------:|:------:|
+| 1 | 0x1300 | √ | 主链路平台间信息交互消息 |
+| 2 | 0x1301 | √ | 平台查岗应答消息 |
+| 3 | 0x1302 | √ | 下发平台间报文应答消息 |
+
+#### 从链路平台间信息交互消息
+
+|序号|消息ID|完成情况|消息体名称|
+|:------:|:------:|:------:|:------:|
+| 1 | 0x9300 | √ | 从链路平台间信息交互消息 |
+| 2 | 0x9301 | √ | 平台查岗请求 |
+| 3 | 0x9302 | √ | 下发平台间报文请求 |
\ No newline at end of file
diff --git a/src/JT809.Protocol/JT809.Protocol.csproj b/src/JT809.Protocol/JT809.Protocol.csproj
index 0db14cb..f041121 100644
--- a/src/JT809.Protocol/JT809.Protocol.csproj
+++ b/src/JT809.Protocol/JT809.Protocol.csproj
@@ -40,6 +40,9 @@
+
+
+
diff --git a/src/JT809.Protocol/JT809Enums/JT809BusinessType.cs b/src/JT809.Protocol/JT809Enums/JT809BusinessType.cs
index 9fa329c..d6466b8 100644
--- a/src/JT809.Protocol/JT809Enums/JT809BusinessType.cs
+++ b/src/JT809.Protocol/JT809Enums/JT809BusinessType.cs
@@ -137,11 +137,13 @@ namespace JT809.Protocol.JT809Enums
///主链路平台间信息交互消息
///
[Description("主链路平台间信息交互消息")]
+ [JT809BodiesType(typeof(JT809_0x1300))]
UP_PLATFORM_MSG = 0x1300,
///
///从链路平台间信息交互消息
///
[Description("从链路平台间信息交互消息")]
+ [JT809BodiesType(typeof(JT809_0x9300))]
DOWN_PLATFORM_MSG = 0x9300,
#endregion
#region 车辆报警信息交互类
@@ -156,6 +158,7 @@ namespace JT809.Protocol.JT809Enums
[Description("从链路报警信息交互消息")]
DOWN_WARN_MSG = 0x9400,
#endregion
+
#region 车辆监管类
///
///主链路车辆监管消息
diff --git a/src/JT809.Protocol/JT809Enums/JT809SubBusinessType.cs b/src/JT809.Protocol/JT809Enums/JT809SubBusinessType.cs
index f07a12b..d127715 100644
--- a/src/JT809.Protocol/JT809Enums/JT809SubBusinessType.cs
+++ b/src/JT809.Protocol/JT809Enums/JT809SubBusinessType.cs
@@ -152,11 +152,13 @@ namespace JT809.Protocol.JT809Enums
///平台查岗应答
///
[Description("平台查岗应答")]
+ [JT809BodiesType(typeof(JT809_0x1300_0x1301))]
UP_PLATFORM_MSG_POST_QUERY_ACK = 0x1301,
///
///下发平台间报文应答
///
[Description("下发平台间报文应答")]
+ [JT809BodiesType(typeof(JT809_0x1300_0x1302))]
UP_PLATFORM_MSG_INFO_ACK = 0x1302,
#endregion
@@ -165,11 +167,13 @@ namespace JT809.Protocol.JT809Enums
///平台查岗请求
///
[Description("平台查岗请求")]
+ [JT809BodiesType(typeof(JT809_0x9300_0x9301))]
DOWN_PLATFORM_MSG_POST_QUERY_REQ = 0x9301,
///
///下发平台间报文请求
///
[Description("下发平台间报文请求")]
+ [JT809BodiesType(typeof(JT809_0x9300_0x9302))]
DOWN_PLATFORM_MSG_INFO_REQ = 0x9302,
#endregion
diff --git a/src/JT809.Protocol/JT809Enums/JT809_0x1301_ObjectType.cs b/src/JT809.Protocol/JT809Enums/JT809_0x1301_ObjectType.cs
new file mode 100644
index 0000000..24c0e04
--- /dev/null
+++ b/src/JT809.Protocol/JT809Enums/JT809_0x1301_ObjectType.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Enums
+{
+ ///
+ /// 查岗对象的类型
+ ///
+ public enum JT809_0x1301_ObjectType:byte
+ {
+ 当前连接的下级平台=0x01,
+ 下级平台所属单一业户=0x02,
+ 下级平台所属所有业户=0x03
+ }
+}
diff --git a/src/JT809.Protocol/JT809Enums/JT809_0x9301_ObjectType.cs b/src/JT809.Protocol/JT809Enums/JT809_0x9301_ObjectType.cs
new file mode 100644
index 0000000..4fe11e3
--- /dev/null
+++ b/src/JT809.Protocol/JT809Enums/JT809_0x9301_ObjectType.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Enums
+{
+ ///
+ /// 查岗对象的类型
+ ///
+ public enum JT809_0x9301_ObjectType : byte
+ {
+ 当前连接的下级平台=0x01,
+ 下级平台所属单一业户=0x02,
+ 下级平台所属所有业户=0x03
+ }
+}
diff --git a/src/JT809.Protocol/JT809Enums/JT809_0x9302_ObjectType.cs b/src/JT809.Protocol/JT809Enums/JT809_0x9302_ObjectType.cs
new file mode 100644
index 0000000..4668e58
--- /dev/null
+++ b/src/JT809.Protocol/JT809Enums/JT809_0x9302_ObjectType.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Enums
+{
+ ///
+ /// 查岗对象的类型
+ ///
+ public enum JT809_0x9302_ObjectType : byte
+ {
+ 下级平台所属单一平台 = 0x00,
+ 当前连接的下级平台 = 0x01,
+ 下级平台所属单一业户 = 0x02,
+ 下级平台所属所有业户 = 0x03,
+ 下级平台所属所有平台 = 0x04,
+ 下级平台所属所有平台和业户 = 0x05,
+ 下级平台所属所有政府监管平台_含监控端 = 0x06,
+ 下级平台所属所有企业监控平台 = 0x07,
+ 下级平台所属所有经营性企业监控平台 = 0x08,
+ 下级平台所属所有非经营性企业监控平台 = 0x09,
+ }
+}
diff --git a/src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x1300Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x1300Formatter.cs
new file mode 100644
index 0000000..fb4ea0d
--- /dev/null
+++ b/src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x1300Formatter.cs
@@ -0,0 +1,60 @@
+using JT809.Protocol.JT809Attributes;
+using JT809.Protocol.JT809Enums;
+using JT809.Protocol.JT809Exceptions;
+using JT809.Protocol.JT809Extensions;
+using JT809.Protocol.JT809MessageBody;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters
+{
+ public class JT809_0x1300Formatter : IJT809Formatter
+ {
+ public JT809_0x1300 Deserialize(ReadOnlySpan bytes, out int readSize)
+ {
+ int offset = 0;
+ JT809_0x1300 jT809_0X1300 = new JT809_0x1300();
+ jT809_0X1300.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset);
+ jT809_0X1300.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性
+ JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X1300.SubBusinessType.GetAttribute();
+ if (jT809SubBodiesTypeAttribute == null)
+ {
+ throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X1300.SubBusinessType.ToString()}");
+ }
+ try
+ {
+ jT809_0X1300.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X1300.DataLength), out readSize);
+ }
+ catch
+ {
+ throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X1300.SubBusinessType.ToString()}");
+ }
+ readSize = offset;
+ return jT809_0X1300;
+ }
+
+ public int Serialize(IMemoryOwner memoryOwner, int offset, JT809_0x1300 value)
+ {
+ offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType);
+ offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength);
+ //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性
+ JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute();
+ if (jT809SubBodiesTypeAttribute == null)
+ {
+ throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}");
+ }
+ try
+ {
+ offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies);
+ }
+ catch
+ {
+ throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}");
+ }
+ return offset;
+ }
+ }
+}
diff --git a/src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x9300Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x9300Formatter.cs
new file mode 100644
index 0000000..32d786d
--- /dev/null
+++ b/src/JT809.Protocol/JT809Formatters/JT809MessageBodyFormatters/JT809_0x9300Formatter.cs
@@ -0,0 +1,60 @@
+using JT809.Protocol.JT809Attributes;
+using JT809.Protocol.JT809Enums;
+using JT809.Protocol.JT809Exceptions;
+using JT809.Protocol.JT809Extensions;
+using JT809.Protocol.JT809MessageBody;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters
+{
+ public class JT809_0x9300Formatter : IJT809Formatter
+ {
+ public JT809_0x9300 Deserialize(ReadOnlySpan bytes, out int readSize)
+ {
+ int offset = 0;
+ JT809_0x9300 jT809_0X9300 = new JT809_0x9300();
+ jT809_0X9300.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset);
+ jT809_0X9300.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性
+ JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X9300.SubBusinessType.GetAttribute();
+ if (jT809SubBodiesTypeAttribute == null)
+ {
+ throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X9300.SubBusinessType.ToString()}");
+ }
+ try
+ {
+ jT809_0X9300.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X9300.DataLength), out readSize);
+ }
+ catch
+ {
+ throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X9300.SubBusinessType.ToString()}");
+ }
+ readSize = offset;
+ return jT809_0X9300;
+ }
+
+ public int Serialize(IMemoryOwner memoryOwner, int offset, JT809_0x9300 value)
+ {
+ offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType);
+ offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength);
+ //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性
+ JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute();
+ if (jT809SubBodiesTypeAttribute == null)
+ {
+ throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}");
+ }
+ try
+ {
+ offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies);
+ }
+ catch
+ {
+ throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}");
+ }
+ return offset;
+ }
+ }
+}
diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1301Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1301Formatter.cs
new file mode 100644
index 0000000..dedf0c8
--- /dev/null
+++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1301Formatter.cs
@@ -0,0 +1,38 @@
+using JT809.Protocol.JT809Extensions;
+using JT809.Protocol.JT809SubMessageBody;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters
+{
+ public class JT809_0x1300_0x1301Formatter : IJT809Formatter
+ {
+ public JT809_0x1300_0x1301 Deserialize(ReadOnlySpan bytes, out int readSize)
+ {
+ int offset = 0;
+ JT809_0x1300_0x1301 jT809_0X1200_0X1301 = new JT809_0x1300_0x1301();
+ jT809_0X1200_0X1301.ObjectType = (JT809Enums.JT809_0x1301_ObjectType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset);
+ jT809_0X1200_0X1301.ObjectID = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 12);
+ jT809_0X1200_0X1301.InfoID = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ jT809_0X1200_0X1301.InfoLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ jT809_0X1200_0X1301.InfoContent = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, (int)jT809_0X1200_0X1301.InfoLength);
+ readSize = offset;
+ return jT809_0X1200_0X1301;
+ }
+
+ public int Serialize(IMemoryOwner memoryOwner, int offset, JT809_0x1300_0x1301 value)
+ {
+ offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.ObjectType);
+ offset += JT809BinaryExtensions.WriteStringPadRightLittle(memoryOwner, offset, value.ObjectID, 12);
+ offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.InfoID);
+ // 先计算内容长度(汉字为两个字节)
+ offset += 4;
+ int byteLength = JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.InfoContent);
+ JT809BinaryExtensions.WriteInt32Little(memoryOwner, offset - 4, byteLength);
+ offset += byteLength;
+ return offset;
+ }
+ }
+}
diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1302Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1302Formatter.cs
new file mode 100644
index 0000000..639e076
--- /dev/null
+++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1300_0x1302Formatter.cs
@@ -0,0 +1,27 @@
+using JT809.Protocol.JT809Extensions;
+using JT809.Protocol.JT809SubMessageBody;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters
+{
+ public class JT809_0x1300_0x1302Formatter : IJT809Formatter
+ {
+ public JT809_0x1300_0x1302 Deserialize(ReadOnlySpan bytes, out int readSize)
+ {
+ int offset = 0;
+ JT809_0x1300_0x1302 jT809_0X1200_0X1302 = new JT809_0x1300_0x1302();
+ jT809_0X1200_0X1302.InfoID = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ readSize = offset;
+ return jT809_0X1200_0X1302;
+ }
+
+ public int Serialize(IMemoryOwner memoryOwner, int offset, JT809_0x1300_0x1302 value)
+ {
+ offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.InfoID);
+ return offset;
+ }
+ }
+}
diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9301Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9301Formatter.cs
new file mode 100644
index 0000000..03d025f
--- /dev/null
+++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9301Formatter.cs
@@ -0,0 +1,38 @@
+using JT809.Protocol.JT809Extensions;
+using JT809.Protocol.JT809SubMessageBody;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters
+{
+ public class JT809_0x9300_0x9301Formatter : IJT809Formatter
+ {
+ public JT809_0x9300_0x9301 Deserialize(ReadOnlySpan bytes, out int readSize)
+ {
+ int offset = 0;
+ JT809_0x9300_0x9301 jT809_0X9300_0X9301 = new JT809_0x9300_0x9301();
+ jT809_0X9300_0X9301.ObjectType = (JT809Enums.JT809_0x9301_ObjectType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset);
+ jT809_0X9300_0X9301.ObjectID = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 12);
+ jT809_0X9300_0X9301.InfoID = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ jT809_0X9300_0X9301.InfoLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ jT809_0X9300_0X9301.InfoContent = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, (int)jT809_0X9300_0X9301.InfoLength);
+ readSize = offset;
+ return jT809_0X9300_0X9301;
+ }
+
+ public int Serialize(IMemoryOwner memoryOwner, int offset, JT809_0x9300_0x9301 value)
+ {
+ offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.ObjectType);
+ offset += JT809BinaryExtensions.WriteStringPadRightLittle(memoryOwner, offset, value.ObjectID, 12);
+ offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.InfoID);
+ // 先计算内容长度(汉字为两个字节)
+ offset += 4;
+ int byteLength = JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.InfoContent);
+ JT809BinaryExtensions.WriteInt32Little(memoryOwner, offset - 4, byteLength);
+ offset += byteLength;
+ return offset;
+ }
+ }
+}
diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9302Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9302Formatter.cs
new file mode 100644
index 0000000..2da3210
--- /dev/null
+++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9300_0x9302Formatter.cs
@@ -0,0 +1,38 @@
+using JT809.Protocol.JT809Extensions;
+using JT809.Protocol.JT809SubMessageBody;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters
+{
+ public class JT809_0x9300_0x9302Formatter : IJT809Formatter
+ {
+ public JT809_0x9300_0x9302 Deserialize(ReadOnlySpan bytes, out int readSize)
+ {
+ int offset = 0;
+ JT809_0x9300_0x9302 jT809_0X9300_0X9302 = new JT809_0x9300_0x9302();
+ jT809_0X9300_0X9302.ObjectType = (JT809Enums.JT809_0x9302_ObjectType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset);
+ jT809_0X9300_0X9302.ObjectID = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 12);
+ jT809_0X9300_0X9302.InfoID = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ jT809_0X9300_0X9302.InfoLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset);
+ jT809_0X9300_0X9302.InfoContent = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, (int)jT809_0X9300_0X9302.InfoLength);
+ readSize = offset;
+ return jT809_0X9300_0X9302;
+ }
+
+ public int Serialize(IMemoryOwner memoryOwner, int offset, JT809_0x9300_0x9302 value)
+ {
+ offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.ObjectType);
+ offset += JT809BinaryExtensions.WriteStringPadRightLittle(memoryOwner, offset, value.ObjectID, 12);
+ offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.InfoID);
+ // 先计算内容长度(汉字为两个字节)
+ offset += 4;
+ int byteLength = JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.InfoContent);
+ JT809BinaryExtensions.WriteInt32Little(memoryOwner, offset - 4, byteLength);
+ offset += byteLength;
+ return offset;
+ }
+ }
+}
diff --git a/src/JT809.Protocol/JT809MessageBody/JT809_0x1300.cs b/src/JT809.Protocol/JT809MessageBody/JT809_0x1300.cs
new file mode 100644
index 0000000..3136f9c
--- /dev/null
+++ b/src/JT809.Protocol/JT809MessageBody/JT809_0x1300.cs
@@ -0,0 +1,30 @@
+using JT809.Protocol.JT809Enums;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809MessageBody
+{
+ ///
+ /// 主链路平台间信息交互消息
+ /// 链路类型:主链路
+ /// 消息方向:下级平台往上级平台
+ /// 业务数据类型标识:UP_PLATFORM_MSG
+ /// 描述:下级平台向上级平台发送平台间交互信息
+ ///
+ public class JT809_0x1300:JT809Bodies
+ {
+ ///
+ /// 子业务类型标识
+ ///
+ public JT809SubBusinessType SubBusinessType { get; set; }
+ ///
+ /// 后续数据长度
+ ///
+ public uint DataLength { get; set; }
+ ///
+ /// 子业务数据体
+ ///
+ public JT809SubBodies JT809SubBodies { get; set; }
+ }
+}
diff --git a/src/JT809.Protocol/JT809MessageBody/JT809_0x9300.cs b/src/JT809.Protocol/JT809MessageBody/JT809_0x9300.cs
new file mode 100644
index 0000000..e1642be
--- /dev/null
+++ b/src/JT809.Protocol/JT809MessageBody/JT809_0x9300.cs
@@ -0,0 +1,33 @@
+using JT809.Protocol.JT809Attributes;
+using JT809.Protocol.JT809Enums;
+using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809MessageBody
+{
+ ///
+ /// 从链路平台间信息交互业务
+ /// 链路类型:从链路
+ /// 消息方向:上级平台往下级平台
+ /// 业务数据类型标识:DOWN_PLATFORM_MSG
+ /// 描述:上级平台向下级平台发送平台问交互信息
+ ///
+ [JT809Formatter(typeof(JT809_0x9300Formatter))]
+ public class JT809_0x9300:JT809Bodies
+ {
+ ///
+ /// 子业务类型标识
+ ///
+ public JT809SubBusinessType SubBusinessType { get; set; }
+ ///
+ /// 后续数据长度
+ ///
+ public uint DataLength { get; set; }
+ ///
+ /// 子业务数据体
+ ///
+ public JT809SubBodies JT809SubBodies { get; set; }
+ }
+}
diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1301.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1301.cs
new file mode 100644
index 0000000..f413f82
--- /dev/null
+++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1301.cs
@@ -0,0 +1,39 @@
+using JT809.Protocol.JT809Attributes;
+using JT809.Protocol.JT809Enums;
+using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809SubMessageBody
+{
+ ///
+ /// 平台查岗应答消息
+ /// 子业务类型标识:UP_PLATFORM_MSG_POST_QUERY_ACK
+ /// 描述:下级平台应答上级平台发送的不定期平台查岗消息
+ ///
+ [JT809Formatter(typeof(JT809_0x1300_0x1301Formatter))]
+ public class JT809_0x1300_0x1301:JT809SubBodies
+ {
+ ///
+ /// 查岗对象的类型
+ ///
+ public JT809_0x1301_ObjectType ObjectType { get; set; }
+ ///
+ /// 查岗对象的ID
+ ///
+ public string ObjectID { get; set; }
+ ///
+ /// 信息ID
+ ///
+ public uint InfoID { get; set; }
+ ///
+ /// 数据长度
+ ///
+ public uint InfoLength { get; set; }
+ ///
+ /// 应答内容
+ ///
+ public string InfoContent { get; set; }
+ }
+}
diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1302.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1302.cs
new file mode 100644
index 0000000..1171e73
--- /dev/null
+++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1300_0x1302.cs
@@ -0,0 +1,22 @@
+using JT809.Protocol.JT809Attributes;
+using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809SubMessageBody
+{
+ ///
+ /// 下发平台间报文应答消息
+ /// 子业务类型标识:UP_PLATFORM_MSG_INFO_ACK
+ /// 描述:下级平台收到上级平台发送的下发平台间报文请求消息后,发送应答消息
+ ///
+ [JT809Formatter(typeof(JT809_0x1300_0x1302Formatter))]
+ public class JT809_0x1300_0x1302:JT809SubBodies
+ {
+ ///
+ /// 信息ID
+ ///
+ public uint InfoID { get; set; }
+ }
+}
diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9301.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9301.cs
new file mode 100644
index 0000000..d39933c
--- /dev/null
+++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9301.cs
@@ -0,0 +1,39 @@
+using JT809.Protocol.JT809Attributes;
+using JT809.Protocol.JT809Enums;
+using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809SubMessageBody
+{
+ ///
+ /// 平台查岗请求
+ /// 子业务类型标识:DOWN_PLATFORM-MSG_POST_QUERY_REQ
+ /// 描述:上级平台不定期向下级平台发送平台查岗信息
+ ///
+ [JT809Formatter(typeof(JT809_0x9300_0x9301Formatter))]
+ public class JT809_0x9300_0x9301:JT809SubBodies
+ {
+ ///
+ /// 查岗对象的类型
+ ///
+ public JT809_0x9301_ObjectType ObjectType { get; set; }
+ ///
+ /// 查岗对象的ID
+ ///
+ public string ObjectID { get; set; }
+ ///
+ /// 信息ID
+ ///
+ public uint InfoID { get; set; }
+ ///
+ /// 数据长度
+ ///
+ public uint InfoLength { get; set; }
+ ///
+ /// 应答内容
+ ///
+ public string InfoContent { get; set; }
+ }
+}
diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9302.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9302.cs
new file mode 100644
index 0000000..fe72dac
--- /dev/null
+++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9300_0x9302.cs
@@ -0,0 +1,39 @@
+using JT809.Protocol.JT809Attributes;
+using JT809.Protocol.JT809Enums;
+using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT809.Protocol.JT809SubMessageBody
+{
+ ///
+ /// 下发平台间报文请求
+ /// 子业务类型标识:DOWN_PLATFORM_MSG_INFO_REQ
+ /// 描述:上级平台不定期向下级平台下发平台间报文
+ ///
+ [JT809Formatter(typeof(JT809_0x9300_0x9302Formatter))]
+ public class JT809_0x9300_0x9302:JT809SubBodies
+ {
+ ///
+ /// 查岗对象的类型
+ ///
+ public JT809_0x9302_ObjectType ObjectType { get; set; }
+ ///
+ /// 查岗对象的ID
+ ///
+ public string ObjectID { get; set; }
+ ///
+ /// 信息ID
+ ///
+ public uint InfoID { get; set; }
+ ///
+ /// 数据长度
+ ///
+ public uint InfoLength { get; set; }
+ ///
+ /// 应答内容
+ ///
+ public string InfoContent { get; set; }
+ }
+}