diff --git a/README.md b/README.md
index b561727..5435e63 100644
--- a/README.md
+++ b/README.md
@@ -316,7 +316,7 @@ Platform=AnyCpu Server=False Toolchain=.NET Core 3.0
| 6 | 0x8100 | √ | √ | 终端注册应答 |
| 7 | 0x0003 | √ | √ | 终端注销 |
| 8 | 0x0102 | √ | √ | 终端鉴权 |修改|
-| 9 | 0x8103 | √ | x | 设置终端参数 |修改且增加|
+| 9 | 0x8103 | √ | √ | 设置终端参数 |修改且增加|
| 10 | 0x8104 | √ | √ | 查询终端参数 |
| 11 | 0x0104 | √ | √ | 查询终端参数应答 |
| 12 | 0x8105 | √ | √ | 终端控制 |
@@ -325,19 +325,19 @@ Platform=AnyCpu Server=False Toolchain=.NET Core 3.0
| 15 | 0x0107 | √ | √ | 查询终端属性应答 |
| 16 | 0x8108 | √ | √ | 下发终端升级包 |
| 17 | 0x0108 | √ | √ | 终端升级结果通知 |
-| 18 | 0x0200 | √ | √ | 位置信息汇报 |
+| 18 | 0x0200 | √ | √ | 位置信息汇报 |增加附加信息|
| 19 | 0x8201 | √ | √ | 位置信息查询 |
| 20 | 0x0201 | √ | √ | 位置信息查询应答 |
| 21 | 0x8202 | √ | √ | 临时位置跟踪控制 |
| 22 | 0x8203 | √ | √ | 人工确认报警消息 |
| 23 | 0x8300 | √ | √ | 文本信息下发 |
-| 24 | 0x8301 | √ | √ | 事件设置 |
-| 25 | 0x0301 | √ | √ | 事件报告 |
-| 26 | 0x8302 | √ | √ | 提问下发 |
-| 27 | 0x0302 | √ | √ | 提问应答 |
-| 28 | 0x8303 | √ | √ | 信息点播菜单设置 |
-| 29 | 0x0303 | √ | √ | 信息点播/取消 |
-| 30 | 0x8304 | √ | √ | 信息服务 |
+| 24 | 0x8301 | √ | √ | 事件设置 |删除|
+| 25 | 0x0301 | √ | √ | 事件报告 |删除|
+| 26 | 0x8302 | √ | √ | 提问下发 |删除|
+| 27 | 0x0302 | √ | √ | 提问应答 |删除|
+| 28 | 0x8303 | √ | √ | 信息点播菜单设置 |删除|
+| 29 | 0x0303 | √ | √ | 信息点播/取消 |删除|
+| 30 | 0x8304 | √ | √ | 信息服务 |删除|
| 31 | 0x8400 | √ | √ | 电话回拨 |
| 32 | 0x8401 | √ | √ | 设置电话本 |
| 33 | 0x8500 | √ | √ | 车辆控制 |
@@ -378,3 +378,4 @@ Platform=AnyCpu Server=False Toolchain=.NET Core 3.0
| 68 | 0x0004 | √ | √ | 查询服务器时间请求 |新增|
| 69 | 0x8004 | √ | √ | 查询服务器时间应答 |新增|
| 70 | 0x0005 | √ | √ | 终端补传分包请求 |新增|
+| 71 | 0x8204 | √ | √ | 链路检测 |新增|
diff --git a/doc/JTT.808-2019.PDF b/doc/JTT.808-2019.PDF
index 7ea6824..ef4ecd1 100644
Binary files a/doc/JTT.808-2019.PDF and b/doc/JTT.808-2019.PDF differ
diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x8103Test.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x8103Test.cs
index ee6eb77..2e68d8a 100644
--- a/src/JT808.Protocol.Test/MessageBody/JT808_0x8103Test.cs
+++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x8103Test.cs
@@ -162,5 +162,7 @@ namespace JT808.Protocol.Test.MessageBody
Assert.Equal(customParams, Newtonsoft.Json.JsonConvert.SerializeObject(jT808_0X8103.CustomParamList));
}
+
+
}
}
diff --git a/src/JT808.Protocol.Test/MessagePack/JT808MessagePackWriterTest.cs b/src/JT808.Protocol.Test/MessagePack/JT808MessagePackWriterTest.cs
index b7722e5..10c87c7 100644
--- a/src/JT808.Protocol.Test/MessagePack/JT808MessagePackWriterTest.cs
+++ b/src/JT808.Protocol.Test/MessagePack/JT808MessagePackWriterTest.cs
@@ -6,6 +6,7 @@ using System.Text;
using Xunit;
using System.Buffers;
using JT808.Protocol.Enums;
+using System.Buffers.Binary;
namespace JT808.Protocol.Test.MessagePack
{
@@ -468,5 +469,16 @@ namespace JT808.Protocol.Test.MessagePack
msgpackWriter.Version = JT808Version.JTT2019;
Assert.Equal(JT808Version.JTT2019, msgpackWriter.Version);
}
+
+ [Fact]
+ public void WriteInt16Test1()
+ {
+ byte[] array1 = new byte[2];
+ byte[] array2= new byte[2];
+ BinaryPrimitives.WriteInt16BigEndian(array1, -1233);
+ short a = -1233;
+ BinaryPrimitives.WriteUInt16BigEndian(array2, (ushort)a);
+ Assert.Equal(array1, array2);
+ }
}
}
diff --git a/src/JT808.Protocol/Interfaces/IJT808_2019_Version.cs b/src/JT808.Protocol/Interfaces/IJT808_2019_Version.cs
new file mode 100644
index 0000000..aa2ba24
--- /dev/null
+++ b/src/JT808.Protocol/Interfaces/IJT808_2019_Version.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace JT808.Protocol.Interfaces
+{
+ ///
+ /// 只用来标识2019版本增删改情况
+ ///
+ public interface IJT808_2019_Version
+ {
+ }
+}
diff --git a/src/JT808.Protocol/JT808.Protocol.csproj b/src/JT808.Protocol/JT808.Protocol.csproj
index 983c0a7..00607e3 100644
--- a/src/JT808.Protocol/JT808.Protocol.csproj
+++ b/src/JT808.Protocol/JT808.Protocol.csproj
@@ -65,13 +65,13 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/JT808.Protocol/JT808.Protocol.xml b/src/JT808.Protocol/JT808.Protocol.xml
index 5ec4efd..b96303f 100644
--- a/src/JT808.Protocol/JT808.Protocol.xml
+++ b/src/JT808.Protocol/JT808.Protocol.xml
@@ -1661,6 +1661,11 @@
注意:处理808的分包读取完流需要先进行转义在进行分包
+
+
+ 只用来标识2019版本增删改情况
+
+
消息流水号
@@ -2538,26 +2543,29 @@
制造商 ID
- 5 个字节,终端制造商编码
+ 2013版本 5 个字节,终端制造商编码
+ 2019版本 11 个字节,终端制造商编码
终端型号
- BYTE[20]
- 20 个字节,此终端型号由制造商自行定义,位数不足时,后补“0X00”。
+ BYTE[20] 20 个字节,此终端型号由制造商自行定义,位数不足时,后补“0X00”。
+ 2019版本
+ BYTE[30] 30 个字节,此终端型号由制造商自行定义,位数不足时,后补“0X00”。
终端ID
- BYTE[7]
- 7 个字节,由大写字母和数字组成,此终端 ID 由制造商自行定义,位数不足时,后补“0X00”
+ BYTE[7] 7 个字节,由大写字母和数字组成,此终端 ID 由制造商自行定义,位数不足时,后补“0X00”
+ 2019版本
+ BYTE[30] 30 个字节,由大写字母和数字组成,此终端 ID 由制造商自行定义,位数不足时,后补“0X00”
- 终端 SIM 卡 ICCID
+ 终端 SIM 卡 ICCID
BCD[10]
@@ -2729,6 +2737,28 @@
需要人工确认报警事件的 ID,从 1 开始计数
+
+
+ 胎压
+ 2019版本
+
+
+
+
+ 胎压
+
+
+
+
+ 胎压
+ 2019版本
+
+
+
+
+ 车厢温度
+
+
超速报警附加信息
@@ -3694,6 +3724,70 @@
驾驶员未登录汇报时间间隔,单位为秒(s),>0
+
+
+ 从服务器APN。该值为空时,终端应使用主服务器相同配置
+ 2019版本
+
+
+
+
+ 数据 长度
+
+
+
+
+
+
+
+
+
+ 从服务器无线通信拨号用户名。该值为空时,终端应使用主服务器相同配置
+ 2019版本
+
+
+
+
+ 数据 长度
+
+
+
+
+
+
+
+
+
+ 从服务器无线通信拨号密码。该值为空,终端应使用主服务器相同配置
+ 2019版本
+
+
+
+
+ 数据 长度
+
+
+
+
+
+
+
+
+
+ 从服务器无线通信拨号密码。该值为空,终端应使用主服务器相同配置
+ 2019版本
+
+
+
+
+ 数据 长度
+
+
+
+
+
+
+
休眠时汇报时间间隔,单位为秒(s),>0
@@ -3821,6 +3915,21 @@
电子围栏半径(非法位移阈值),单位为米
+
+
+ 违规行驶时段范围
+
+
+
+
+ 数据 长度
+
+
+
+
+ 电子围栏半径(非法位移阈值),单位为米
+
+
监控平台电话号码
@@ -4768,7 +4877,8 @@
制造商 ID
- 5 个字节,终端制造商编码
+ 2013版本 5 个字节,终端制造商编码
+ 2019版本 11 个字节,终端制造商编码
@@ -4835,6 +4945,12 @@
人工确认报警类型
+
+
+ 链路检测
+ 2019版本
+
+
文本信息下发
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0004.cs b/src/JT808.Protocol/MessageBody/JT808_0x0004.cs
index 2bd9e48..cee0e31 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0004.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0004.cs
@@ -1,10 +1,12 @@
-namespace JT808.Protocol.MessageBody
+using JT808.Protocol.Interfaces;
+
+namespace JT808.Protocol.MessageBody
{
///
/// 查询服务器时间请求
/// 2019版本
///
- public class JT808_0x0004 : JT808Bodies
+ public class JT808_0x0004 : JT808Bodies, IJT808_2019_Version
{
///
/// 跳过数据体序列化
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0005.cs b/src/JT808.Protocol/MessageBody/JT808_0x0005.cs
index c5a9867..fece5fb 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0005.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0005.cs
@@ -1,4 +1,5 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
namespace JT808.Protocol.MessageBody
@@ -7,7 +8,7 @@ namespace JT808.Protocol.MessageBody
/// 终端补传分包请求
/// 2019版本
///
- public class JT808_0x0005 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x0005 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0005;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0100.cs b/src/JT808.Protocol/MessageBody/JT808_0x0100.cs
index 94b83d0..f910b99 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0100.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0100.cs
@@ -1,5 +1,6 @@
using JT808.Protocol.Enums;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
namespace JT808.Protocol.MessageBody
@@ -7,7 +8,7 @@ namespace JT808.Protocol.MessageBody
///
/// 终端注册
///
- public class JT808_0x0100 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x0100 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0100;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0102.cs b/src/JT808.Protocol/MessageBody/JT808_0x0102.cs
index 97570ce..f1fb49f 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0102.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0102.cs
@@ -1,5 +1,6 @@
using JT808.Protocol.Enums;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
namespace JT808.Protocol.MessageBody
@@ -7,7 +8,7 @@ namespace JT808.Protocol.MessageBody
///
/// 终端鉴权
///
- public class JT808_0x0102 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x0102 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0102;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0107.cs b/src/JT808.Protocol/MessageBody/JT808_0x0107.cs
index 2dfbc64..7046225 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0107.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0107.cs
@@ -1,4 +1,6 @@
-using JT808.Protocol.Formatters;
+using JT808.Protocol.Enums;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
namespace JT808.Protocol.MessageBody
@@ -6,7 +8,7 @@ namespace JT808.Protocol.MessageBody
///
/// 查询终端属性应答
///
- public class JT808_0x0107 : JT808Bodies,IJT808MessagePackFormatter
+ public class JT808_0x0107 : JT808Bodies,IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0107;
///
@@ -21,23 +23,26 @@ namespace JT808.Protocol.MessageBody
public ushort TerminalType { get; set; }
///
/// 制造商 ID
- /// 5 个字节,终端制造商编码
+ /// 2013版本 5 个字节,终端制造商编码
+ /// 2019版本 11 个字节,终端制造商编码
///
public string MakerId { get; set; }
///
/// 终端型号
- /// BYTE[20]
- /// 20 个字节,此终端型号由制造商自行定义,位数不足时,后补“0X00”。
+ /// BYTE[20] 20 个字节,此终端型号由制造商自行定义,位数不足时,后补“0X00”。
+ /// 2019版本
+ /// BYTE[30] 30 个字节,此终端型号由制造商自行定义,位数不足时,后补“0X00”。
///
public string TerminalModel { get; set; }
///
/// 终端ID
- /// BYTE[7]
- /// 7 个字节,由大写字母和数字组成,此终端 ID 由制造商自行定义,位数不足时,后补“0X00”
+ /// BYTE[7] 7 个字节,由大写字母和数字组成,此终端 ID 由制造商自行定义,位数不足时,后补“0X00”
+ /// 2019版本
+ /// BYTE[30] 30 个字节,由大写字母和数字组成,此终端 ID 由制造商自行定义,位数不足时,后补“0X00”
///
public string TerminalId { get; set; }
///
- /// 终端 SIM 卡 ICCID
+ /// 终端 SIM 卡 ICCID
/// BCD[10]
///
public string Terminal_SIM_ICCID { get; set; }
@@ -81,9 +86,18 @@ namespace JT808.Protocol.MessageBody
{
JT808_0x0107 jT808_0X0107 = new JT808_0x0107();
jT808_0X0107.TerminalType = reader.ReadUInt16();
- jT808_0X0107.MakerId = reader.ReadString(5);
- jT808_0X0107.TerminalModel = reader.ReadString(20);
- jT808_0X0107.TerminalId = reader.ReadString(7);
+ if(reader.Version== JT808Version.JTT2019)
+ {
+ jT808_0X0107.MakerId = reader.ReadString(11);
+ jT808_0X0107.TerminalModel = reader.ReadString(30);
+ jT808_0X0107.TerminalId = reader.ReadString(30);
+ }
+ else
+ {
+ jT808_0X0107.MakerId = reader.ReadString(5);
+ jT808_0X0107.TerminalModel = reader.ReadString(20);
+ jT808_0X0107.TerminalId = reader.ReadString(7);
+ }
jT808_0X0107.Terminal_SIM_ICCID = reader.ReadBCD(10, config.Trim);
jT808_0X0107.Terminal_Hardware_Version_Length = reader.ReadByte();
jT808_0X0107.Terminal_Hardware_Version_Num = reader.ReadString(jT808_0X0107.Terminal_Hardware_Version_Length);
@@ -97,9 +111,18 @@ namespace JT808.Protocol.MessageBody
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0107 value, IJT808Config config)
{
writer.WriteUInt16(value.TerminalType);
- writer.WriteString(value.MakerId.PadRight(5, '0'));
- writer.WriteString(value.TerminalModel.PadRight(20, '0'));
- writer.WriteString(value.TerminalId.PadRight(7, '0'));
+ if (writer.Version == JT808Version.JTT2019)
+ {
+ writer.WriteString(value.MakerId.PadLeft(11, '0'));
+ writer.WriteString(value.TerminalModel.PadLeft(30, '0'));
+ writer.WriteString(value.TerminalId.PadLeft(30, '0'));
+ }
+ else
+ {
+ writer.WriteString(value.MakerId.PadRight(5, '0'));
+ writer.WriteString(value.TerminalModel.PadRight(20, '0'));
+ writer.WriteString(value.TerminalId.PadRight(7, '0'));
+ }
writer.WriteBCD(value.Terminal_SIM_ICCID, 10);
writer.WriteByte((byte)value.Terminal_Hardware_Version_Num.Length);
writer.WriteString(value.Terminal_Hardware_Version_Num);
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0200_0x05.cs b/src/JT808.Protocol/MessageBody/JT808_0x0200_0x05.cs
new file mode 100644
index 0000000..9794fb5
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0200_0x05.cs
@@ -0,0 +1,37 @@
+using JT808.Protocol.Attributes;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 胎压
+ /// 2019版本
+ ///
+ public class JT808_0x0200_0x05 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ ///
+ /// 胎压
+ ///
+ public string TirePressure { get; set; }
+ public override byte AttachInfoId { get; set; } = 0x05;
+ public override byte AttachInfoLength { get; set; } = 30;
+
+ public JT808_0x0200_0x05 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x0200_0x05 value = new JT808_0x0200_0x05();
+ value.AttachInfoId = reader.ReadByte();
+ value.AttachInfoLength = reader.ReadByte();
+ value.TirePressure = reader.ReadString(value.AttachInfoLength);
+ return value;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x05 value, IJT808Config config)
+ {
+ writer.WriteByte(value.AttachInfoId);
+ writer.WriteByte(value.AttachInfoLength);
+ writer.WriteString(value.TirePressure);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0200_0x06.cs b/src/JT808.Protocol/MessageBody/JT808_0x0200_0x06.cs
new file mode 100644
index 0000000..2e21478
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0200_0x06.cs
@@ -0,0 +1,37 @@
+using JT808.Protocol.Attributes;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 胎压
+ /// 2019版本
+ ///
+ public class JT808_0x0200_0x06 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ ///
+ /// 车厢温度
+ ///
+ public short CarTemperature { get; set; }
+ public override byte AttachInfoId { get; set; } = 0x05;
+ public override byte AttachInfoLength { get; set; } = 2;
+
+ public JT808_0x0200_0x06 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x0200_0x06 value = new JT808_0x0200_0x06();
+ value.AttachInfoId = reader.ReadByte();
+ value.AttachInfoLength = reader.ReadByte();
+ value.CarTemperature =reader.ReadInt16();
+ return value;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x06 value, IJT808Config config)
+ {
+ writer.WriteByte(value.AttachInfoId);
+ writer.WriteByte(value.AttachInfoLength);
+ writer.WriteInt16(value.CarTemperature);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0301.cs b/src/JT808.Protocol/MessageBody/JT808_0x0301.cs
index 3986f87..6a0bb97 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0301.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0301.cs
@@ -1,5 +1,7 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
+using System;
namespace JT808.Protocol.MessageBody
{
@@ -7,7 +9,8 @@ namespace JT808.Protocol.MessageBody
/// 事件报告
/// 0x0301
///
- public class JT808_0x0301 : JT808Bodies, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作删除")]
+ public class JT808_0x0301 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0301;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0302.cs b/src/JT808.Protocol/MessageBody/JT808_0x0302.cs
index 58cc27c..73eb5bd 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0302.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0302.cs
@@ -1,6 +1,8 @@
using JT808.Protocol.Attributes;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
+using System;
namespace JT808.Protocol.MessageBody
{
@@ -8,7 +10,8 @@ namespace JT808.Protocol.MessageBody
/// 提问应答
/// 0x0302
///
- public class JT808_0x0302 : JT808Bodies, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作删除")]
+ public class JT808_0x0302 : JT808Bodies, IJT808MessagePackFormatter,IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0302;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0303.cs b/src/JT808.Protocol/MessageBody/JT808_0x0303.cs
index 1f194c9..022b61a 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0303.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0303.cs
@@ -1,5 +1,7 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
+using System;
namespace JT808.Protocol.MessageBody
{
@@ -7,7 +9,8 @@ namespace JT808.Protocol.MessageBody
/// 信息点播/取消
/// 0x0303
///
- public class JT808_0x0303 : JT808Bodies, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作删除")]
+ public class JT808_0x0303 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0303;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8004.cs b/src/JT808.Protocol/MessageBody/JT808_0x8004.cs
index b15fe7c..0a58ffb 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8004.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8004.cs
@@ -1,4 +1,5 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using System;
@@ -8,7 +9,7 @@ namespace JT808.Protocol.MessageBody
/// 查询服务器时间应答
/// 2019版本
///
- public class JT808_0x8004 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x8004 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8004;
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs
index 2ac12b5..41cf582 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0018.cs
@@ -1,13 +1,16 @@
using JT808.Protocol.Attributes;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
+using System;
namespace JT808.Protocol.MessageBody
{
///
/// 服务器 TCP 端口
///
- public class JT808_0x8103_0x0018 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作为保留")]
+ public class JT808_0x8103_0x0018 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override uint ParamId { get; set; } = 0x0018;
///
@@ -20,11 +23,11 @@ namespace JT808.Protocol.MessageBody
public uint ParamValue { get; set; }
public JT808_0x8103_0x0018 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
{
- JT808_0x8103_0x0018 jT808_0x8103_0x0018 = new JT808_0x8103_0x0018();
- jT808_0x8103_0x0018.ParamId = reader.ReadUInt32();
- jT808_0x8103_0x0018.ParamLength = reader.ReadByte();
- jT808_0x8103_0x0018.ParamValue = reader.ReadUInt32();
- return jT808_0x8103_0x0018;
+ JT808_0x8103_0x0018 value = new JT808_0x8103_0x0018();
+ value.ParamId = reader.ReadUInt32();
+ value.ParamLength = reader.ReadByte();
+ value.ParamValue = reader.ReadUInt32();
+ return value;
}
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0018 value, IJT808Config config)
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs
index e030a7f..f3bac0e 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0019.cs
@@ -1,13 +1,16 @@
using JT808.Protocol.Attributes;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
+using System;
namespace JT808.Protocol.MessageBody
{
///
/// 服务器 UDP 端口
///
- public class JT808_0x8103_0x0019 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作为保留")]
+ public class JT808_0x8103_0x0019 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override uint ParamId { get; set; } = 0x0019;
///
@@ -20,11 +23,11 @@ namespace JT808.Protocol.MessageBody
public uint ParamValue { get; set; }
public JT808_0x8103_0x0019 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
{
- JT808_0x8103_0x0019 jT808_0x8103_0x0019 = new JT808_0x8103_0x0019();
- jT808_0x8103_0x0019.ParamId = reader.ReadUInt32();
- jT808_0x8103_0x0019.ParamLength = reader.ReadByte();
- jT808_0x8103_0x0019.ParamValue = reader.ReadUInt32();
- return jT808_0x8103_0x0019;
+ JT808_0x8103_0x0019 value = new JT808_0x8103_0x0019();
+ value.ParamId = reader.ReadUInt32();
+ value.ParamLength = reader.ReadByte();
+ value.ParamValue = reader.ReadUInt32();
+ return value;
}
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0019 value, IJT808Config config)
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0023.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0023.cs
new file mode 100644
index 0000000..c4e4e0b
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0023.cs
@@ -0,0 +1,41 @@
+using JT808.Protocol.Attributes;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 从服务器APN。该值为空时,终端应使用主服务器相同配置
+ /// 2019版本
+ ///
+ public class JT808_0x8103_0x0023 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ public override uint ParamId { get; set; } = 0x0023;
+ ///
+ /// 数据 长度
+ ///
+ public override byte ParamLength { get; set; }
+ ///
+ ///
+ ///
+ public string ParamValue { get; set; }
+ public JT808_0x8103_0x0023 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x8103_0x0023 value = new JT808_0x8103_0x0023();
+ value.ParamId = reader.ReadUInt32();
+ value.ParamLength = reader.ReadByte();
+ value.ParamValue = reader.ReadString(value.ParamLength);
+ return value;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0023 value, IJT808Config config)
+ {
+ writer.WriteUInt32(value.ParamId);
+ writer.Skip(1, out int skipPosition);
+ writer.WriteString(value.ParamValue);
+ int length = writer.GetCurrentPosition() - skipPosition - 1;
+ writer.WriteByteReturn((byte)length, skipPosition);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0024.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0024.cs
new file mode 100644
index 0000000..c2c2d33
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0024.cs
@@ -0,0 +1,41 @@
+using JT808.Protocol.Attributes;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 从服务器无线通信拨号用户名。该值为空时,终端应使用主服务器相同配置
+ /// 2019版本
+ ///
+ public class JT808_0x8103_0x0024 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ public override uint ParamId { get; set; } = 0x0024;
+ ///
+ /// 数据 长度
+ ///
+ public override byte ParamLength { get; set; }
+ ///
+ ///
+ ///
+ public string ParamValue { get; set; }
+ public JT808_0x8103_0x0024 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x8103_0x0024 jT808_0x8103_0x0024 = new JT808_0x8103_0x0024();
+ jT808_0x8103_0x0024.ParamId = reader.ReadUInt32();
+ jT808_0x8103_0x0024.ParamLength = reader.ReadByte();
+ jT808_0x8103_0x0024.ParamValue = reader.ReadString(jT808_0x8103_0x0024.ParamLength);
+ return jT808_0x8103_0x0024;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0024 value, IJT808Config config)
+ {
+ writer.WriteUInt32(value.ParamId);
+ writer.Skip(1, out int skipPosition);
+ writer.WriteString(value.ParamValue);
+ int length = writer.GetCurrentPosition() - skipPosition - 1;
+ writer.WriteByteReturn((byte)length, skipPosition);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0025.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0025.cs
new file mode 100644
index 0000000..7ea75db
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0025.cs
@@ -0,0 +1,41 @@
+using JT808.Protocol.Attributes;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 从服务器无线通信拨号密码。该值为空,终端应使用主服务器相同配置
+ /// 2019版本
+ ///
+ public class JT808_0x8103_0x0025 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ public override uint ParamId { get; set; } = 0x0025;
+ ///
+ /// 数据 长度
+ ///
+ public override byte ParamLength { get; set; }
+ ///
+ ///
+ ///
+ public string ParamValue { get; set; }
+ public JT808_0x8103_0x0025 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x8103_0x0025 jT808_0x8103_0x0025 = new JT808_0x8103_0x0025();
+ jT808_0x8103_0x0025.ParamId = reader.ReadUInt32();
+ jT808_0x8103_0x0025.ParamLength = reader.ReadByte();
+ jT808_0x8103_0x0025.ParamValue = reader.ReadString(jT808_0x8103_0x0025.ParamLength);
+ return jT808_0x8103_0x0025;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0025 value, IJT808Config config)
+ {
+ writer.WriteUInt32(value.ParamId);
+ writer.Skip(1, out int skipPosition);
+ writer.WriteString(value.ParamValue);
+ int length = writer.GetCurrentPosition() - skipPosition - 1;
+ writer.WriteByteReturn((byte)length, skipPosition);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0026.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0026.cs
new file mode 100644
index 0000000..7be08f5
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0026.cs
@@ -0,0 +1,41 @@
+using JT808.Protocol.Attributes;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 从服务器无线通信拨号密码。该值为空,终端应使用主服务器相同配置
+ /// 2019版本
+ ///
+ public class JT808_0x8103_0x0026 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ public override uint ParamId { get; set; } = 0x0026;
+ ///
+ /// 数据 长度
+ ///
+ public override byte ParamLength { get; set; }
+ ///
+ ///
+ ///
+ public string ParamValue { get; set; }
+ public JT808_0x8103_0x0026 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x8103_0x0026 value = new JT808_0x8103_0x0026();
+ value.ParamId = reader.ReadUInt32();
+ value.ParamLength = reader.ReadByte();
+ value.ParamValue = reader.ReadString(value.ParamLength);
+ return value;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0026 value, IJT808Config config)
+ {
+ writer.WriteUInt32(value.ParamId);
+ writer.Skip(1, out int skipPosition);
+ writer.WriteString(value.ParamValue);
+ int length = writer.GetCurrentPosition() - skipPosition - 1;
+ writer.WriteByteReturn((byte)length, skipPosition);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0032.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0032.cs
new file mode 100644
index 0000000..00fa008
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0032.cs
@@ -0,0 +1,38 @@
+using JT808.Protocol.Attributes;
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 违规行驶时段范围
+ ///
+ public class JT808_0x8103_0x0032 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ public override uint ParamId { get; set; } = 0x0032;
+ ///
+ /// 数据 长度
+ ///
+ public override byte ParamLength { get; set; } = 4;
+ ///
+ /// 电子围栏半径(非法位移阈值),单位为米
+ ///
+ public byte[] ParamValue { get; set; }
+ public JT808_0x8103_0x0032 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x8103_0x0032 value = new JT808_0x8103_0x0032();
+ value.ParamId = reader.ReadUInt32();
+ value.ParamLength = reader.ReadByte();
+ value.ParamValue = reader.ReadArray(4).ToArray();
+ return value;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0032 value, IJT808Config config)
+ {
+ writer.WriteUInt32(value.ParamId);
+ writer.WriteByte(value.ParamLength);
+ writer.WriteArray(value.ParamValue);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs
index 95ab737..ceb2b6b 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8103_0x0084.cs
@@ -1,5 +1,6 @@
using JT808.Protocol.Attributes;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
namespace JT808.Protocol.MessageBody
@@ -7,7 +8,7 @@ namespace JT808.Protocol.MessageBody
///
/// 车牌颜色,按照 JT/T415-2006 的 5.4.12
///
- public class JT808_0x8103_0x0084 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter
+ public class JT808_0x8103_0x0084 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override uint ParamId { get; set; } = 0x0084;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8105.cs b/src/JT808.Protocol/MessageBody/JT808_0x8105.cs
index 682846c..7817f72 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8105.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8105.cs
@@ -1,4 +1,5 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using System;
@@ -7,7 +8,7 @@ namespace JT808.Protocol.MessageBody
///
/// 终端控制
///
- public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8105;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8108.cs b/src/JT808.Protocol/MessageBody/JT808_0x8108.cs
index 0662dfc..0909548 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8108.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8108.cs
@@ -1,5 +1,6 @@
using JT808.Protocol.Enums;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
namespace JT808.Protocol.MessageBody
@@ -7,7 +8,7 @@ namespace JT808.Protocol.MessageBody
///
/// 下发终端升级包
///
- public class JT808_0x8108 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x8108 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8108;
///
@@ -16,7 +17,8 @@ namespace JT808.Protocol.MessageBody
public JT808UpgradeType UpgradeType { get; set; }
///
/// 制造商 ID
- /// 5 个字节,终端制造商编码
+ /// 2013版本 5 个字节,终端制造商编码
+ /// 2019版本 11 个字节,终端制造商编码
///
public string MakerId { get; set; }
///
@@ -40,7 +42,14 @@ namespace JT808.Protocol.MessageBody
{
JT808_0x8108 jT808_0X8108 = new JT808_0x8108();
jT808_0X8108.UpgradeType = (JT808UpgradeType)reader.ReadByte();
- jT808_0X8108.MakerId = reader.ReadString(5);
+ if (reader.Version == JT808Version.JTT2019)
+ {
+ jT808_0X8108.MakerId = reader.ReadString(11);
+ }
+ else
+ {
+ jT808_0X8108.MakerId = reader.ReadString(5);
+ }
jT808_0X8108.VersionNumLength = reader.ReadByte();
jT808_0X8108.VersionNum = reader.ReadString(jT808_0X8108.VersionNumLength);
jT808_0X8108.UpgradePackageLength = reader.ReadInt32();
@@ -51,7 +60,14 @@ namespace JT808.Protocol.MessageBody
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8108 value, IJT808Config config)
{
writer.WriteByte((byte)value.UpgradeType);
- writer.WriteString(value.MakerId.PadRight(5, '0'));
+ if (writer.Version == JT808Version.JTT2019)
+ {
+ writer.WriteString(value.MakerId.PadLeft(11, '0'));
+ }
+ else
+ {
+ writer.WriteString(value.MakerId.PadRight(5, '0'));
+ }
writer.WriteByte((byte)value.VersionNum.Length);
writer.WriteString(value.VersionNum);
writer.WriteInt32(value.UpgradePackage.Length);
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8204.cs b/src/JT808.Protocol/MessageBody/JT808_0x8204.cs
new file mode 100644
index 0000000..2c6cfba
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8204.cs
@@ -0,0 +1,17 @@
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 链路检测
+ /// 2019版本
+ ///
+ public class JT808_0x8204 : JT808Bodies, IJT808_2019_Version
+ {
+ public override ushort MsgId { get; } = 0x8204;
+
+ public override bool SkipSerialization { get; set; } = true;
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8301.cs b/src/JT808.Protocol/MessageBody/JT808_0x8301.cs
index 7be097e..28bc748 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8301.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8301.cs
@@ -1,6 +1,8 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using JT808.Protocol.Metadata;
+using System;
using System.Collections.Generic;
namespace JT808.Protocol.MessageBody
@@ -9,7 +11,8 @@ namespace JT808.Protocol.MessageBody
/// 事件设置
/// 0x8301
///
- public class JT808_0x8301 : JT808Bodies, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作删除")]
+ public class JT808_0x8301 : JT808Bodies, IJT808MessagePackFormatter,IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8301;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8302.cs b/src/JT808.Protocol/MessageBody/JT808_0x8302.cs
index 158a1a2..9da475d 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8302.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8302.cs
@@ -1,4 +1,5 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using System;
using System.Collections.Generic;
@@ -9,7 +10,8 @@ namespace JT808.Protocol.MessageBody
/// 提问下发
/// 0x8302
///
- public class JT808_0x8302 : JT808Bodies, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作删除")]
+ public class JT808_0x8302 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8302;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8303.cs b/src/JT808.Protocol/MessageBody/JT808_0x8303.cs
index 6fb81f7..9b7b6ca 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8303.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8303.cs
@@ -1,6 +1,8 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using JT808.Protocol.Metadata;
+using System;
using System.Collections.Generic;
namespace JT808.Protocol.MessageBody
@@ -9,7 +11,8 @@ namespace JT808.Protocol.MessageBody
/// 信息点播菜单设置
/// 0x8303
///
- public class JT808_0x8303 : JT808Bodies, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作删除")]
+ public class JT808_0x8303 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8303;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8304.cs b/src/JT808.Protocol/MessageBody/JT808_0x8304.cs
index ca613ee..5d67744 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8304.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8304.cs
@@ -1,5 +1,7 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
+using System;
namespace JT808.Protocol.MessageBody
{
@@ -7,7 +9,8 @@ namespace JT808.Protocol.MessageBody
/// 信息服务
/// 0x8304
///
- public class JT808_0x8304 : JT808Bodies, IJT808MessagePackFormatter
+ [Obsolete("2019版本已作删除")]
+ public class JT808_0x8304 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8304;
///
diff --git a/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs b/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs
index f90012d..05248dd 100644
--- a/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs
+++ b/src/JT808.Protocol/MessagePack/JT808MessagePackReader.cs
@@ -128,6 +128,10 @@ namespace JT808.Protocol.MessagePack
public bool CheckXorCodeVali => _checkXorCodeVali;
public byte ReadStart()=> ReadByte();
public byte ReadEnd()=> ReadByte();
+ public short ReadInt16()
+ {
+ return BinaryPrimitives.ReadInt16BigEndian(GetReadOnlySpan(2));
+ }
public ushort ReadUInt16()
{
return BinaryPrimitives.ReadUInt16BigEndian(GetReadOnlySpan(2));
diff --git a/src/JT808.Protocol/MessagePack/JT808MessagePackWriter.cs b/src/JT808.Protocol/MessagePack/JT808MessagePackWriter.cs
index 490e7d1..eb8dad6 100644
--- a/src/JT808.Protocol/MessagePack/JT808MessagePackWriter.cs
+++ b/src/JT808.Protocol/MessagePack/JT808MessagePackWriter.cs
@@ -70,6 +70,11 @@ namespace JT808.Protocol.MessagePack
span[0] = value;
writer.Advance(1);
}
+ public void WriteInt16(short value)
+ {
+ BinaryPrimitives.WriteInt16BigEndian(writer.Free, value);
+ writer.Advance(2);
+ }
public void WriteUInt16(ushort value)
{
BinaryPrimitives.WriteUInt16BigEndian(writer.Free, value);