@@ -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 | √ | √ | 查询区域或线路数据应答 |新增| |
@@ -82,6 +82,8 @@ | |||
<Compile Include="MessageBody\JT808_0x8603Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8604Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8605Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0608Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8608Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8606Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8800Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8801Test.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<uint>() { 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<JT808_0x0608>(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]); | |||
} | |||
} | |||
} |
@@ -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<JT808_0x0702>(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); | |||
} | |||
} | |||
} |
@@ -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<JT808_0x0705>(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); | |||
} | |||
} | |||
@@ -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<uint>() { 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<JT808_0x8608>(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<JT808_0x8608>(bytes); | |||
Assert.Equal(1, value.QueryType); | |||
Assert.Equal(0u, value.Count); | |||
} | |||
} | |||
} |
@@ -2944,6 +2944,26 @@ | |||
位置信息汇报消息体 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x0608"> | |||
<summary> | |||
查询区域或线路数据应答 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x0608.QueryType"> | |||
<summary> | |||
查询类型 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x0608.Count"> | |||
<summary> | |||
查询的区域或线路的ID数量 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x0608.Ids"> | |||
<summary> | |||
查询的区域或线路的ID | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x0701"> | |||
<summary> | |||
电子运单上报 | |||
@@ -3028,6 +3048,12 @@ | |||
证件有效期 BCD[4] | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x0702.DriverIdentityCard"> | |||
<summary> | |||
驾驶员身份证号 长度20 不足补0 | |||
2019版本 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x0704"> | |||
<summary> | |||
定位数据批量上传 | |||
@@ -5391,6 +5417,29 @@ | |||
区域ID集合 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x8608"> | |||
<summary> | |||
查询区域或线路数据 | |||
0x8608 | |||
2019版本 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8608.QueryType"> | |||
<summary> | |||
查询类型 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8608.Count"> | |||
<summary> | |||
查询的区域或线路的ID数量 | |||
0表示查询所有区域或线路数据,大于0表示后面跟随要查询的区域或线路的ID数量 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8608.Ids"> | |||
<summary> | |||
查询的区域或线路的ID | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x8702"> | |||
<summary> | |||
上报驾驶员身份信息请求 | |||
@@ -0,0 +1,60 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Collections.Generic; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 查询区域或线路数据应答 | |||
/// </summary> | |||
public class JT808_0x0608 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0608>, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x0608; | |||
/// <summary> | |||
/// 查询类型 | |||
/// </summary> | |||
public byte QueryType { get; set; } | |||
/// <summary> | |||
/// 查询的区域或线路的ID数量 | |||
/// </summary> | |||
public uint Count { get; set; } | |||
/// <summary> | |||
/// 查询的区域或线路的ID | |||
/// </summary> | |||
public List<uint> 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<uint>(); | |||
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); | |||
} | |||
} | |||
} | |||
} |
@@ -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 | |||
/// <summary> | |||
/// 驾驶员身份信息采集上报 | |||
/// </summary> | |||
public class JT808_0x0702 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0702> | |||
public class JT808_0x0702 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0702>, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x0702; | |||
/// <summary> | |||
@@ -58,6 +59,11 @@ namespace JT808.Protocol.MessageBody | |||
/// 证件有效期 BCD[4] | |||
/// </summary> | |||
public DateTime CertificateExpiresDate { get; set; } | |||
/// <summary> | |||
/// 驾驶员身份证号 长度20 不足补0 | |||
/// 2019版本 | |||
/// </summary> | |||
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')); | |||
} | |||
} | |||
} | |||
} | |||
@@ -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 | |||
/// </summary> | |||
public class JT808_0x0705 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0705> | |||
public class JT808_0x0705 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0705>,IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x0705; | |||
/// <summary> | |||
@@ -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"); | |||
@@ -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 | |||
/// </summary> | |||
public class JT808_0x0801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0801> | |||
public class JT808_0x0801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0801>, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x0801; | |||
/// <summary> | |||
@@ -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 | |||
/// </summary> | |||
public class JT808_0x0805 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0805> | |||
public class JT808_0x0805 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0805>, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x0805; | |||
/// <summary> | |||
@@ -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<uint>(); | |||
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<uint>(); | |||
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); | |||
} | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,64 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Collections.Generic; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 查询区域或线路数据 | |||
/// 0x8608 | |||
/// 2019版本 | |||
/// </summary> | |||
public class JT808_0x8608 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8608>, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8608; | |||
/// <summary> | |||
/// 查询类型 | |||
/// </summary> | |||
public byte QueryType { get; set; } | |||
/// <summary> | |||
/// 查询的区域或线路的ID数量 | |||
/// 0表示查询所有区域或线路数据,大于0表示后面跟随要查询的区域或线路的ID数量 | |||
/// </summary> | |||
public uint Count { get; set; } | |||
/// <summary> | |||
/// 查询的区域或线路的ID | |||
/// </summary> | |||
public List<uint> 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<uint>(); | |||
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); | |||
} | |||
} | |||
} | |||
} |
@@ -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 | |||
/// </summary> | |||
public class JT808_0x8801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8801> | |||
public class JT808_0x8801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8801>, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8801; | |||
/// <summary> | |||
@@ -1,15 +1,17 @@ | |||
namespace JT808.Protocol.Metadata | |||
using JT808.Protocol.Interfaces; | |||
namespace JT808.Protocol.Metadata | |||
{ | |||
/// <summary> | |||
/// Can属性 | |||
/// </summary> | |||
public struct JT808CanProperty | |||
public struct JT808CanProperty: IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// CAN ID | |||
/// 4 | |||
/// </summary> | |||
public byte[] CanId { get; set; } | |||
public uint CanId { get; set; } | |||
/// <summary> | |||
/// CAN 数据 | |||
/// 8 | |||