diff --git a/README.md b/README.md
index 036f52e..d283401 100644
--- a/README.md
+++ b/README.md
@@ -354,15 +354,15 @@ Platform=AnyCpu Server=False Toolchain=.NET Core 3.0
| 44 | 0x0700 | x | 不开发 | 行驶记录仪数据上传 |不开发
| 45 | 0x8701 | x | 不开发 | 行驶记录仪参数下传命令 |不开发
| 46 | 0x0701 | √ | √ | 电子运单上报 |
-| 47 | 0x0702 | √ | √ | 驾驶员身份信息采集上报 |
+| 47 | 0x0702 | √ | √ | 驾驶员身份信息采集上报 |修改|
| 48 | 0x8702 | √ | 消息体为空| 上报驾驶员身份信息请求 |
-| 49 | 0x0704 | √ | √ | 定位数据批量上传 |
-| 50 | 0x0705 | √ | √ | CAN 总线数据上传 |
+| 49 | 0x0704 | √ | √ | 定位数据批量上传 |修改|
+| 50 | 0x0705 | √ | √ | CAN 总线数据上传 |修改|
| 51 | 0x0800 | √ | √ | 多媒体事件信息上传 |
-| 52 | 0x0801 | √ | √ | 多媒体数据上传 |
+| 52 | 0x0801 | √ | √ | 多媒体数据上传 |修改|
| 53 | 0x8800 | √ | √ | 多媒体数据上传应答 |
-| 54 | 0x8801 | √ | √ | 摄像头立即拍摄命令 |
-| 55 | 0x0805 | √ | √ | 摄像头立即拍摄命令应答 |
+| 54 | 0x8801 | √ | √ | 摄像头立即拍摄命令 |修改|
+| 55 | 0x0805 | √ | √ | 摄像头立即拍摄命令应答 |修改|
| 56 | 0x8802 | √ | √ | 存储多媒体数据检索 |
| 57 | 0x0802 | √ | √ | 存储多媒体数据检索应答 |
| 58 | 0x8803 | √ | √ | 存储多媒体数据上传 |
@@ -379,3 +379,5 @@ Platform=AnyCpu Server=False Toolchain=.NET Core 3.0
| 69 | 0x8004 | √ | √ | 查询服务器时间应答 |新增|
| 70 | 0x0005 | √ | √ | 终端补传分包请求 |新增|
| 71 | 0x8204 | √ | √ | 链路检测 |新增|
+| 72 | 0x8608 | √ | √ | 查询区域或线路数据 |新增|
+| 73 | 0x0608 | √ | √ | 查询区域或线路数据应答 |新增|
diff --git a/doc/JTT.808-2019.PDF b/doc/JTT.808-2019.PDF
index 0afe24d..29af9c3 100644
Binary files a/doc/JTT.808-2019.PDF and b/doc/JTT.808-2019.PDF differ
diff --git a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj
index bd982a9..bbb2735 100644
--- a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj
+++ b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj
@@ -82,6 +82,8 @@
+
+
diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x0608Test.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x0608Test.cs
new file mode 100644
index 0000000..db1edbb
--- /dev/null
+++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x0608Test.cs
@@ -0,0 +1,38 @@
+using JT808.Protocol.Extensions;
+using JT808.Protocol.MessageBody;
+using System;
+using System.Collections.Generic;
+using Xunit;
+using JT808.Protocol.Metadata;
+
+namespace JT808.Protocol.Test.MessageBody
+{
+ public class JT808_0x0608Test
+ {
+ JT808Serializer JT808Serializer = new JT808Serializer();
+
+ [Fact]
+ public void Test1()
+ {
+ JT808_0x0608 value = new JT808_0x0608
+ {
+ QueryType=1,
+ Ids=new List() { 1,2,3}
+ };
+ var hex = JT808Serializer.Serialize(value).ToHexString();
+ Assert.Equal("0100000003000000010000000200000003", hex);
+ }
+
+ [Fact]
+ public void Test2()
+ {
+ byte[] bytes = "0100000003000000010000000200000003".ToHexBytes();
+ JT808_0x0608 value = JT808Serializer.Deserialize(bytes);
+ Assert.Equal(1, value.QueryType);
+ Assert.Equal(3u, value.Count);
+ Assert.Equal(1u, value.Ids[0]);
+ Assert.Equal(2u, value.Ids[1]);
+ Assert.Equal(3u, value.Ids[2]);
+ }
+ }
+}
diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x0702Test.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x0702Test.cs
index b824bfc..bfeb216 100644
--- a/src/JT808.Protocol.Test/MessageBody/JT808_0x0702Test.cs
+++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x0702Test.cs
@@ -84,5 +84,39 @@ namespace JT808.Protocol.Test.MessageBody
Assert.Equal("qwertx", jT808_0X0702.LicenseIssuing);
Assert.Equal(DateTime.Parse("2018-08-16"), jT808_0X0702.CertificateExpiresDate);
}
+
+ [Fact]
+ public void Test_2019_1()
+ {
+ JT808_0x0702 jT808_0X0702 = new JT808_0x0702
+ {
+ IC_Card_Status = JT808ICCardStatus.从业资格证IC卡插入_驾驶员上班,
+ IC_Card_PlugDateTime = DateTime.Parse("2019-12-01 11:11:11"),
+ IC_Card_ReadResult = JT808ICCardReadResult.IC卡读卡成功,
+ DriverUserName = "koike",
+ QualificationCode = "qwe123456aaa",
+ LicenseIssuing = "qwertx",
+ CertificateExpiresDate = DateTime.Parse("2019-12-01"),
+ DriverIdentityCard="12345678901234567"
+ };
+ var hex = JT808Serializer.Serialize(jT808_0X0702, JT808Version.JTT2019).ToHexString();
+ Assert.Equal("0119120111111100056B6F696B6571776531323334353661616130303030303030300671776572747807E312013132333435363738393031323334353637303030", hex);
+
+ }
+
+ [Fact]
+ public void Test_2019_2()
+ {
+ byte[] bytes = "0119120111111100056B6F696B6571776531323334353661616130303030303030300671776572747807E312013132333435363738393031323334353637303030".ToHexBytes();
+ JT808_0x0702 jT808_0X0702 = JT808Serializer.Deserialize(bytes, JT808Version.JTT2019);
+ Assert.Equal(JT808ICCardStatus.从业资格证IC卡插入_驾驶员上班, jT808_0X0702.IC_Card_Status);
+ Assert.Equal(DateTime.Parse("2019-12-01 11:11:11"), jT808_0X0702.IC_Card_PlugDateTime);
+ Assert.Equal(JT808ICCardReadResult.IC卡读卡成功, jT808_0X0702.IC_Card_ReadResult);
+ Assert.Equal("koike", jT808_0X0702.DriverUserName);
+ Assert.Equal("qwe123456aaa00000000", jT808_0X0702.QualificationCode);
+ Assert.Equal("qwertx", jT808_0X0702.LicenseIssuing);
+ Assert.Equal(DateTime.Parse("2019-12-01"), jT808_0X0702.CertificateExpiresDate);
+ Assert.Equal("12345678901234567000", jT808_0X0702.DriverIdentityCard);
+ }
}
}
diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x0705Test.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x0705Test.cs
index 5a5ac2f..f2762b7 100644
--- a/src/JT808.Protocol.Test/MessageBody/JT808_0x0705Test.cs
+++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x0705Test.cs
@@ -20,32 +20,32 @@ namespace JT808.Protocol.Test.MessageBody
};
jT808_0X0705.CanItems.Add(new JT808CanProperty()
{
- CanId = new byte[] { 0x01, 0x02, 0x03, 0x04 },
+ CanId = 0x0120304,
CanData = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 },
});
jT808_0X0705.CanItems.Add(new JT808CanProperty()
{
- CanId = new byte[] { 0x05, 0x06, 0x07, 0x08 },
+ CanId = 0x05060708,
CanData = new byte[] { 0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 },
});
var hex = JT808Serializer.Serialize(jT808_0X0705).ToHexString();
- Assert.Equal("0002200005015E010203040102030401020304050607080103040506070801", hex);
+ Assert.Equal("0002200005015E001203040102030401020304050607080103040506070801", hex);
}
[Fact]
public void Test2()
{
- byte[] bytes = "0002200005015E010203040102030401020304050607080103040506070801".ToHexBytes();
+ byte[] bytes = "0002200005015E001203040102030401020304050607080103040506070801".ToHexBytes();
JT808_0x0705 jT808_0X0705 = JT808Serializer.Deserialize(bytes);
Assert.Equal(2, jT808_0X0705.CanItemCount);
Assert.Equal(DateTime.Parse("20:00:05.350"), jT808_0X0705.FirstCanReceiveTime);
- Assert.Equal(new byte[] { 0x01, 0x02, 0x03, 0x04 }, jT808_0X0705.CanItems[0].CanId);
+ Assert.Equal(0x0120304u, jT808_0X0705.CanItems[0].CanId);
Assert.Equal(new byte[] { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 }, jT808_0X0705.CanItems[0].CanData);
- Assert.Equal(new byte[] { 0x05, 0x06, 0x07, 0x08 }, jT808_0X0705.CanItems[1].CanId);
+ Assert.Equal(0x05060708u , jT808_0X0705.CanItems[1].CanId);
Assert.Equal(new byte[] { 0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 }, jT808_0X0705.CanItems[1].CanData);
}
}
diff --git a/src/JT808.Protocol.Test/MessageBody/JT808_0x8608Test.cs b/src/JT808.Protocol.Test/MessageBody/JT808_0x8608Test.cs
new file mode 100644
index 0000000..a61e57f
--- /dev/null
+++ b/src/JT808.Protocol.Test/MessageBody/JT808_0x8608Test.cs
@@ -0,0 +1,58 @@
+using JT808.Protocol.Extensions;
+using JT808.Protocol.MessageBody;
+using System;
+using System.Collections.Generic;
+using Xunit;
+using JT808.Protocol.Metadata;
+
+namespace JT808.Protocol.Test.MessageBody
+{
+ public class JT808_0x8608Test
+ {
+ JT808Serializer JT808Serializer = new JT808Serializer();
+
+ [Fact]
+ public void Test1()
+ {
+ JT808_0x8608 value = new JT808_0x8608
+ {
+ QueryType=0,
+ Ids=new List() { 1,2,3}
+ };
+ var hex = JT808Serializer.Serialize(value).ToHexString();
+ Assert.Equal("0000000003000000010000000200000003", hex);
+ }
+
+ [Fact]
+ public void Test2()
+ {
+ byte[] bytes = "0000000003000000010000000200000003".ToHexBytes();
+ JT808_0x8608 value = JT808Serializer.Deserialize(bytes);
+ Assert.Equal(0, value.QueryType);
+ Assert.Equal(3u, value.Count);
+ Assert.Equal(1u, value.Ids[0]);
+ Assert.Equal(2u, value.Ids[1]);
+ Assert.Equal(3u, value.Ids[2]);
+ }
+
+ [Fact]
+ public void Test3()
+ {
+ JT808_0x8608 value = new JT808_0x8608
+ {
+ QueryType = 1
+ };
+ var hex = JT808Serializer.Serialize(value).ToHexString();
+ Assert.Equal("0100000000", hex);
+ }
+
+ [Fact]
+ public void Test4()
+ {
+ byte[] bytes = "0100000000".ToHexBytes();
+ JT808_0x8608 value = JT808Serializer.Deserialize(bytes);
+ Assert.Equal(1, value.QueryType);
+ Assert.Equal(0u, value.Count);
+ }
+ }
+}
diff --git a/src/JT808.Protocol/JT808.Protocol.xml b/src/JT808.Protocol/JT808.Protocol.xml
index 1c693ee..9719a0c 100644
--- a/src/JT808.Protocol/JT808.Protocol.xml
+++ b/src/JT808.Protocol/JT808.Protocol.xml
@@ -2944,6 +2944,26 @@
位置信息汇报消息体
+
+
+ 查询区域或线路数据应答
+
+
+
+
+ 查询类型
+
+
+
+
+ 查询的区域或线路的ID数量
+
+
+
+
+ 查询的区域或线路的ID
+
+
电子运单上报
@@ -3028,6 +3048,12 @@
证件有效期 BCD[4]
+
+
+ 驾驶员身份证号 长度20 不足补0
+ 2019版本
+
+
定位数据批量上传
@@ -5391,6 +5417,29 @@
区域ID集合
+
+
+ 查询区域或线路数据
+ 0x8608
+ 2019版本
+
+
+
+
+ 查询类型
+
+
+
+
+ 查询的区域或线路的ID数量
+ 0表示查询所有区域或线路数据,大于0表示后面跟随要查询的区域或线路的ID数量
+
+
+
+
+ 查询的区域或线路的ID
+
+
上报驾驶员身份信息请求
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0608.cs b/src/JT808.Protocol/MessageBody/JT808_0x0608.cs
new file mode 100644
index 0000000..2e95263
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0608.cs
@@ -0,0 +1,60 @@
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+using System.Collections.Generic;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 查询区域或线路数据应答
+ ///
+ public class JT808_0x0608 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ public override ushort MsgId { get; } = 0x0608;
+ ///
+ /// 查询类型
+ ///
+ public byte QueryType { get; set; }
+ ///
+ /// 查询的区域或线路的ID数量
+ ///
+ public uint Count { get; set; }
+
+ ///
+ /// 查询的区域或线路的ID
+ ///
+ public List Ids { get; set; }
+ public JT808_0x0608 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x0608 value = new JT808_0x0608();
+ value.QueryType = reader.ReadByte();
+ value.Count = reader.ReadUInt32();
+ if (value.Count > 0)
+ {
+ value.Ids = new List();
+ for (int i = 0; i < value.Count; i++)
+ {
+ value.Ids.Add(reader.ReadUInt32());
+ }
+ }
+ return value;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0608 value, IJT808Config config)
+ {
+ writer.WriteByte(value.QueryType);
+ if (value.Ids != null && value.Ids.Count > 0)
+ {
+ writer.WriteUInt32((uint)value.Ids.Count);
+ foreach (var item in value.Ids)
+ {
+ writer.WriteUInt32(item);
+ }
+ }
+ else
+ {
+ writer.WriteUInt32(0);
+ }
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0702.cs b/src/JT808.Protocol/MessageBody/JT808_0x0702.cs
index a11f3c9..6c6aa01 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0702.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0702.cs
@@ -1,5 +1,6 @@
using JT808.Protocol.Enums;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using System;
@@ -8,7 +9,7 @@ namespace JT808.Protocol.MessageBody
///
/// 驾驶员身份信息采集上报
///
- public class JT808_0x0702 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x0702 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0702;
///
@@ -58,6 +59,11 @@ namespace JT808.Protocol.MessageBody
/// 证件有效期 BCD[4]
///
public DateTime CertificateExpiresDate { get; set; }
+ ///
+ /// 驾驶员身份证号 长度20 不足补0
+ /// 2019版本
+ ///
+ public string DriverIdentityCard { get; set; }
public JT808_0x0702 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
{
JT808_0x0702 jT808_0X0702 = new JT808_0x0702();
@@ -74,6 +80,10 @@ namespace JT808.Protocol.MessageBody
jT808_0X0702.LicenseIssuingLength = reader.ReadByte();
jT808_0X0702.LicenseIssuing = reader.ReadString(jT808_0X0702.LicenseIssuingLength);
jT808_0X0702.CertificateExpiresDate = reader.ReadDateTime4();
+ if(reader.Version== JT808Version.JTT2019)
+ {
+ jT808_0X0702.DriverIdentityCard = reader.ReadString(20);
+ }
}
}
return jT808_0X0702;
@@ -94,6 +104,10 @@ namespace JT808.Protocol.MessageBody
writer.WriteByte((byte)value.LicenseIssuing.Length);
writer.WriteString(value.LicenseIssuing);
writer.WriteDateTime4(value.CertificateExpiresDate);
+ if (writer.Version == JT808Version.JTT2019)
+ {
+ writer.WriteString(value.DriverIdentityCard.PadRight(20,'0'));
+ }
}
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0705.cs b/src/JT808.Protocol/MessageBody/JT808_0x0705.cs
index de67494..72d428f 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0705.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0705.cs
@@ -1,5 +1,6 @@
using JT808.Protocol.Exceptions;
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using JT808.Protocol.Metadata;
using System;
@@ -11,7 +12,7 @@ namespace JT808.Protocol.MessageBody
/// CAN 总线数据上传
/// 0x0705
///
- public class JT808_0x0705 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x0705 : JT808Bodies, IJT808MessagePackFormatter,IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0705;
///
@@ -38,11 +39,7 @@ namespace JT808.Protocol.MessageBody
for (var i = 0; i < jT808_0X0705.CanItemCount; i++)
{
JT808CanProperty jT808CanProperty = new JT808CanProperty();
- jT808CanProperty.CanId = reader.ReadArray(4).ToArray();
- if (jT808CanProperty.CanId.Length != 4)
- {
- throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(jT808CanProperty.CanId)}->4");
- }
+ jT808CanProperty.CanId = reader.ReadUInt32();
jT808CanProperty.CanData = reader.ReadArray(8).ToArray();
if (jT808CanProperty.CanData.Length != 8)
{
@@ -61,11 +58,7 @@ namespace JT808.Protocol.MessageBody
writer.WriteDateTime5(value.FirstCanReceiveTime);
foreach (var item in value.CanItems)
{
- if (item.CanId.Length != 4)
- {
- throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(item.CanId)}->4");
- }
- writer.WriteArray(item.CanId);
+ writer.WriteUInt32(item.CanId);
if (item.CanData.Length != 8)
{
throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(item.CanData)}->8");
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0801.cs b/src/JT808.Protocol/MessageBody/JT808_0x0801.cs
index 4711c0e..69c292a 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0801.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0801.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
@@ -8,7 +9,7 @@ namespace JT808.Protocol.MessageBody
/// 多媒体数据上传
/// 0x0801
///
- public class JT808_0x0801 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x0801 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0801;
///
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0805.cs b/src/JT808.Protocol/MessageBody/JT808_0x0805.cs
index 1f34698..b32a1d3 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x0805.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x0805.cs
@@ -1,4 +1,5 @@
using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
using JT808.Protocol.MessagePack;
using System.Collections.Generic;
@@ -8,7 +9,7 @@ namespace JT808.Protocol.MessageBody
/// 摄像头立即拍摄命令应答
/// 0x0805
///
- public class JT808_0x0805 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x0805 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x0805;
///
@@ -36,12 +37,15 @@ namespace JT808.Protocol.MessageBody
JT808_0x0805 jT808_0X0805 = new JT808_0x0805();
jT808_0X0805.ReplyMsgNum = reader.ReadUInt16();
jT808_0X0805.Result = reader.ReadByte();
- jT808_0X0805.MultimediaIdCount = reader.ReadUInt16();
- jT808_0X0805.MultimediaIds = new List();
- for (var i = 0; i < jT808_0X0805.MultimediaIdCount; i++)
+ if (jT808_0X0805.Result == 0)
{
- uint id = reader.ReadUInt32();
- jT808_0X0805.MultimediaIds.Add(id);
+ jT808_0X0805.MultimediaIdCount = reader.ReadUInt16();
+ jT808_0X0805.MultimediaIds = new List();
+ for (var i = 0; i < jT808_0X0805.MultimediaIdCount; i++)
+ {
+ uint id = reader.ReadUInt32();
+ jT808_0X0805.MultimediaIds.Add(id);
+ }
}
return jT808_0X0805;
}
@@ -50,10 +54,13 @@ namespace JT808.Protocol.MessageBody
{
writer.WriteUInt16(value.ReplyMsgNum);
writer.WriteByte(value.Result);
- writer.WriteUInt16((ushort)value.MultimediaIds.Count);
- foreach (var item in value.MultimediaIds)
+ if (value.Result == 0)
{
- writer.WriteUInt32(item);
+ writer.WriteUInt16((ushort)value.MultimediaIds.Count);
+ foreach (var item in value.MultimediaIds)
+ {
+ writer.WriteUInt32(item);
+ }
}
}
}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8608.cs b/src/JT808.Protocol/MessageBody/JT808_0x8608.cs
new file mode 100644
index 0000000..ae16130
--- /dev/null
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8608.cs
@@ -0,0 +1,64 @@
+using JT808.Protocol.Formatters;
+using JT808.Protocol.Interfaces;
+using JT808.Protocol.MessagePack;
+using System.Collections.Generic;
+
+namespace JT808.Protocol.MessageBody
+{
+ ///
+ /// 查询区域或线路数据
+ /// 0x8608
+ /// 2019版本
+ ///
+ public class JT808_0x8608 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
+ {
+ public override ushort MsgId { get; } = 0x8608;
+ ///
+ /// 查询类型
+ ///
+ public byte QueryType { get; set; }
+ ///
+ /// 查询的区域或线路的ID数量
+ /// 0表示查询所有区域或线路数据,大于0表示后面跟随要查询的区域或线路的ID数量
+ ///
+ public uint Count { get; set; }
+
+ ///
+ /// 查询的区域或线路的ID
+ ///
+ public List Ids { get; set; }
+
+ public JT808_0x8608 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
+ {
+ JT808_0x8608 value = new JT808_0x8608();
+ value.QueryType = reader.ReadByte();
+ value.Count = reader.ReadUInt32();
+ if (value.Count > 0)
+ {
+ value.Ids = new List();
+ for(int i = 0; i < value.Count; i++)
+ {
+ value.Ids.Add(reader.ReadUInt32());
+ }
+ }
+ return value;
+ }
+
+ public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8608 value, IJT808Config config)
+ {
+ writer.WriteByte(value.QueryType);
+ if(value.Ids!=null && value.Ids.Count > 0)
+ {
+ writer.WriteUInt32((uint)value.Ids.Count);
+ foreach(var item in value.Ids)
+ {
+ writer.WriteUInt32(item);
+ }
+ }
+ else
+ {
+ writer.WriteUInt32(0);
+ }
+ }
+ }
+}
diff --git a/src/JT808.Protocol/MessageBody/JT808_0x8801.cs b/src/JT808.Protocol/MessageBody/JT808_0x8801.cs
index c13122a..3b5820c 100644
--- a/src/JT808.Protocol/MessageBody/JT808_0x8801.cs
+++ b/src/JT808.Protocol/MessageBody/JT808_0x8801.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
/// 摄像头立即拍摄命令
/// 0x8801
///
- public class JT808_0x8801 : JT808Bodies, IJT808MessagePackFormatter
+ public class JT808_0x8801 : JT808Bodies, IJT808MessagePackFormatter, IJT808_2019_Version
{
public override ushort MsgId { get; } = 0x8801;
///
diff --git a/src/JT808.Protocol/Metadata/JT808CanProperty.cs b/src/JT808.Protocol/Metadata/JT808CanProperty.cs
index 6129081..1c8eef9 100644
--- a/src/JT808.Protocol/Metadata/JT808CanProperty.cs
+++ b/src/JT808.Protocol/Metadata/JT808CanProperty.cs
@@ -1,15 +1,17 @@
-namespace JT808.Protocol.Metadata
+using JT808.Protocol.Interfaces;
+
+namespace JT808.Protocol.Metadata
{
///
/// Can属性
///
- public struct JT808CanProperty
+ public struct JT808CanProperty: IJT808_2019_Version
{
///
/// CAN ID
/// 4
///
- public byte[] CanId { get; set; }
+ public uint CanId { get; set; }
///
/// CAN 数据
/// 8