@@ -53,5 +53,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(100, JT808Bodies.MsgNum); | |||
Assert.Equal(Enums.JT808PlatformResult.成功, JT808Bodies.JT808PlatformResult); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
var bytes = "7E 80 01 00 05 01 23 45 67 89 00 00 0A 00 64 02 00 00 61 7E".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808Package>(bytes); | |||
} | |||
} | |||
} |
@@ -29,5 +29,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(new byte[] { 0x01, 0x02, 0x02, 0x03 }, jT808_0X8003.AgainPackageData); | |||
Assert.Equal(2, jT808_0X8003.AgainPackageCount); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
var bytes = "04D20201020203".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8003>(bytes); | |||
} | |||
} | |||
} |
@@ -27,5 +27,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
JT808_0x8004 jT808_0X8004 = JT808Serializer.Deserialize<JT808_0x8004>(bytes); | |||
Assert.Equal(DateTime.Parse("2019-11-26 15:58:50"), jT808_0X8004.Time); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
var bytes = "191126155850".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8004>(bytes); | |||
} | |||
} | |||
} |
@@ -138,5 +138,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(100, JT808Bodies.AckMsgNum); | |||
Assert.Equal(Enums.JT808TerminalRegisterResult.成功, JT808Bodies.JT808TerminalRegisterResult); | |||
} | |||
[Fact] | |||
public void Test7() | |||
{ | |||
var bytes = "7E 81 00 00 13 01 23 45 67 89 00 00 0A 00 64 00 7A 73 73 64 61 66 32 33 31 32 34 73 66 64 73 63 3B 7E".ToHexBytes(); | |||
string json = JT808Serializer.Analyze(bytes); | |||
} | |||
} | |||
} |
@@ -2,6 +2,7 @@ | |||
using JT808.Protocol.MessageBody; | |||
using System; | |||
using Xunit; | |||
using static JT808.Protocol.MessageBody.JT808_0x8105; | |||
namespace JT808.Protocol.Test.MessageBody | |||
{ | |||
@@ -70,6 +71,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(60, (UInt16)JT808_0x8105.CommandValue.ConnectTimeLimit); | |||
} | |||
[Fact] | |||
public void Test1_2() | |||
{ | |||
var bytes = "7E8105004B012345678900000101313B544B4E616D653B544B3B544B3132333B7777772E62616964752E636F6D3B383830363B333330363B31323334353B636F64653B322E303B312E303B7777772E544B2E636F6D3B3630227E".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808Package>(bytes); | |||
} | |||
[Fact] | |||
public void Test2() | |||
@@ -28,5 +28,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(2, jT808_0X8106.ParameterCount); | |||
Assert.Equal(new uint[] { 0x0001, 0x0002 }, jT808_0X8106.Parameters); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
byte[] bytes = "020000000100000002".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8106>(bytes); | |||
} | |||
} | |||
} |
@@ -33,5 +33,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal("qscvhiuytrew", jT808_0X8108.VersionNum); | |||
Assert.Equal(new byte[] { 1, 2, 3, 4, 5 }, jT808_0X8108.UpgradePackage); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
byte[] bytes = "34 61 73 64 66 67 0C 71 73 63 76 68 69 75 79 74 72 65 77 00 00 00 05 01 02 03 04 05".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8108>(bytes); | |||
} | |||
} | |||
} |
@@ -27,5 +27,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(69, jT808_0X8108.Interval); | |||
Assert.Equal(123, jT808_0X8108.LocationTrackingValidity); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
byte[] bytes = "00 45 00 00 00 7B".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8202>(bytes); | |||
} | |||
} | |||
} |
@@ -27,5 +27,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(5554, jT808_0X8203.AlarmMsgNum); | |||
Assert.Equal((uint)123, jT808_0X8203.ManualConfirmAlarmType); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
byte[] bytes = "15B20000007B".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8203>(bytes); | |||
} | |||
} | |||
} |
@@ -76,5 +76,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(5, jT808TextSend.TextFlag); | |||
Assert.Equal(1, jT808TextSend.TextType); | |||
} | |||
[Fact] | |||
public void Test_2019_3() | |||
{ | |||
byte[] bytes = "7E8300400E010000000001234567890000010501736D616C6C63686920353138417E".ToHexBytes(); | |||
string json = JT808Serializer.Analyze(bytes); | |||
} | |||
} | |||
} |
@@ -48,5 +48,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(6, jT808_0X8301.EventItems[1].EventContentLength); | |||
Assert.Equal("789456", jT808_0X8301.EventItems[1].EventContent); | |||
} | |||
[Fact] | |||
public void Test1_2() | |||
{ | |||
byte[] bytes = "000201063132333435360206373839343536".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8301>(bytes); | |||
} | |||
} | |||
} |
@@ -59,5 +59,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(127, jT808_0X8302.Answers[1].Id); | |||
Assert.Equal("123457", jT808_0X8302.Answers[1].Content); | |||
} | |||
[Fact] | |||
public void Test1_2() | |||
{ | |||
byte[] bytes = "0107736464646166668000063132333435367F0006313233343537".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8302>(bytes); | |||
} | |||
} | |||
} |
@@ -47,5 +47,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal("smallchi2", jT808_0X8303.InformationItems[1].InformationName); | |||
Assert.Equal(9, jT808_0X8303.InformationItems[1].InformationLength); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
byte[] bytes = "00020B0009736D616C6C63686931160009736D616C6C63686932".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8303>(bytes); | |||
} | |||
} | |||
} |
@@ -28,5 +28,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal("信息内容", jT808_0X8304.InformationContent); | |||
Assert.Equal(8, jT808_0X8304.InformationLength); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
byte[] bytes = "7B0008D0C5CFA2C4DAC8DD".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8304>(bytes); | |||
} | |||
} | |||
} |
@@ -27,5 +27,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(Enums.JT808CallBackType.普通通话, jT808_0X8400.CallBack); | |||
Assert.Equal("12345679810", jT808_0X8400.PhoneNumber); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
var bytes = "00 31 32 33 34 35 36 37 39 38 31 30".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8400>(bytes); | |||
} | |||
} | |||
} |
@@ -52,5 +52,12 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal("koike", jT808_0X8401.JT808ContactProperties[1].Contact); | |||
} | |||
[Fact] | |||
public void Test3() | |||
{ | |||
var bytes = "02 02 01 0C 31 33 34 35 36 73 6D 61 6C 6C 63 68 08 73 6D 61 6C 6C 63 68 69 03 0B 6B 6F 69 6B 65 31 32 33 34 35 36 05 6B 6F 69 6B 65".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8401>(bytes); | |||
} | |||
} | |||
} |
@@ -80,6 +80,13 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(0xF001, jT808_0x8500_0xF001.ControlTypeId); | |||
Assert.Equal(1, jT808_0x8500_0xF001.ControlTypeParameter); | |||
} | |||
[Fact] | |||
public void Test_2019_3() | |||
{ | |||
var bytes = "0002000100F00101".ToHexBytes(); | |||
string json = JT808Serializer.Analyze<JT808_0x8500>(bytes, JT808Version.JTT2019); | |||
} | |||
} | |||
/// <summary> | |||
@@ -4284,11 +4284,22 @@ | |||
平台通用应答 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8001.MsgNum"> | |||
<summary> | |||
应答消息流水号 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8001.AckMsgId"> | |||
<summary> | |||
应答消息Id | |||
<see cref="T:JT808.Protocol.Enums.JT808MsgId"/> | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8001.JT808PlatformResult"> | |||
<summary> | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x8003"> | |||
<summary> | |||
补传分包请求 | |||
@@ -5753,12 +5764,12 @@ | |||
命令参数 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.CommandParams"> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams"> | |||
<summary> | |||
命令参数 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.ConnectionControl"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.ConnectionControl"> | |||
<summary> | |||
连接控制 | |||
0:切换到指定监管平台服务器,连接到该服务器后即进入应急状态, | |||
@@ -5766,70 +5777,70 @@ | |||
1:切换回原缺省监控平台服务器,并恢复正常状态。 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.DialPointName"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.DialPointName"> | |||
<summary> | |||
拨号点名称 | |||
一般为服务器 APN,无线通信拨号访问点,若网络制式为 CDMA,则该值为 PPP 连接拨号号码 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.DialUserName"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.DialUserName"> | |||
<summary> | |||
拨号用户名 | |||
服务器无线通信拨号用户名 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.DialPwd"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.DialPwd"> | |||
<summary> | |||
拨号密码 | |||
服务器无线通信拨号密码 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.ServerUrl"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.ServerUrl"> | |||
<summary> | |||
服务器地址 | |||
服务器地址;IP 或域名 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.TCPPort"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.TCPPort"> | |||
<summary> | |||
TCP端口 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.UDPPort"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.UDPPort"> | |||
<summary> | |||
UDP端口 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.ManufacturerCode"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.ManufacturerCode"> | |||
<summary> | |||
制造商 ID BYTE[5] | |||
制造商ID | |||
终端制造商编码 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.MonitoringPlatformAuthenticationCode"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.MonitoringPlatformAuthenticationCode"> | |||
<summary> | |||
监管平台鉴权码 | |||
监管平台下发的鉴权码,仅用于终端连接到监管平台之后的鉴权,终端连接回原监控平台还用原鉴权码 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.HardwareVersion"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.HardwareVersion"> | |||
<summary> | |||
硬件版本 | |||
终端的硬件版本号,由制造商自定 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.FirmwareVersion"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.FirmwareVersion"> | |||
<summary> | |||
固件版本 | |||
终端的固件版本号,由制造商自定 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.URL"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.URL"> | |||
<summary> | |||
URL 地址 完整 URL 地址 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.CommandParams.ConnectTimeLimit"> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.ConnectTimeLimit"> | |||
<summary> | |||
连接到指定服务器时限 | |||
单位:分(min),值非 0 后的有效期截止前,终端应连回原地址。 | |||
@@ -6886,7 +6897,7 @@ | |||
</member> | |||
<member name="P:JT808.Protocol.Metadata.JT808ContactProperty.Contact"> | |||
<summary> | |||
经 GBK 编码 | |||
联系人 经 GBK 编码 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.Metadata.JT808EventProperty"> | |||
@@ -1,29 +1,51 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 平台通用应答 | |||
/// </summary> | |||
public class JT808_0x8001 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8001> | |||
public class JT808_0x8001 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8001>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8001; | |||
public override string Description => "平台通用应答"; | |||
/// <summary> | |||
/// 应答消息流水号 | |||
/// </summary> | |||
public ushort MsgNum { get; set; } | |||
/// <summary> | |||
/// 应答消息Id | |||
/// <see cref="JT808.Protocol.Enums.JT808MsgId"/> | |||
/// </summary> | |||
public ushort AckMsgId { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public JT808PlatformResult JT808PlatformResult { get; set; } | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8001 value = new JT808_0x8001(); | |||
value.MsgNum = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{value.MsgNum.ReadNumber()}]应答消息流水号", value.MsgNum); | |||
value.AckMsgId = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{value.AckMsgId.ReadNumber()}]应答消息Id", value.AckMsgId); | |||
value.JT808PlatformResult = (JT808PlatformResult)reader.ReadByte(); | |||
writer.WriteNumber($"[{((byte)value.JT808PlatformResult).ReadNumber()}]结果-{value.JT808PlatformResult.ToString()}", (byte)value.JT808PlatformResult); | |||
} | |||
public JT808_0x8001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8001 jT808_0X8001 = new JT808_0x8001(); | |||
jT808_0X8001.MsgNum = reader.ReadUInt16(); | |||
jT808_0X8001.AckMsgId = reader.ReadUInt16(); | |||
jT808_0X8001.JT808PlatformResult = (JT808PlatformResult)reader.ReadByte(); | |||
return jT808_0X8001; | |||
JT808_0x8001 value = new JT808_0x8001(); | |||
value.MsgNum = reader.ReadUInt16(); | |||
value.AckMsgId = reader.ReadUInt16(); | |||
value.JT808PlatformResult = (JT808PlatformResult)reader.ReadByte(); | |||
return value; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8001 value, IJT808Config config) | |||
@@ -1,5 +1,8 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 补传分包请求 | |||
/// 0x8003 | |||
/// </summary> | |||
public class JT808_0x8003 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8003> | |||
public class JT808_0x8003 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8003>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8003; | |||
public override string Description => "补传分包请求"; | |||
@@ -27,13 +30,32 @@ namespace JT808.Protocol.MessageBody | |||
/// 重传包序号顺序排列,如“包 ID1 包 ID2......包 IDn”。 | |||
/// </summary> | |||
public byte[] AgainPackageData { get; set; } | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8003 value = new JT808_0x8003(); | |||
value.OriginalMsgNum = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{value.OriginalMsgNum.ReadNumber()}]原始消息流水号", value.OriginalMsgNum); | |||
value.AgainPackageCount = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.AgainPackageCount.ReadNumber()}]重传包总数", value.AgainPackageCount); | |||
writer.WriteStartArray("重传包ID列表"); | |||
for(int i=0;i< value.AgainPackageCount; i++) | |||
{ | |||
writer.WriteStartObject(); | |||
var idBuffer=reader.ReadArray(2).ToArray(); | |||
writer.WriteString($"Id{i+1}", idBuffer.ToHexString()); | |||
writer.WriteEndObject(); | |||
} | |||
writer.WriteEndArray(); | |||
} | |||
public JT808_0x8003 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8003 jT808_0X8003 = new JT808_0x8003(); | |||
jT808_0X8003.OriginalMsgNum = reader.ReadUInt16(); | |||
jT808_0X8003.AgainPackageCount = reader.ReadByte(); | |||
jT808_0X8003.AgainPackageData = reader.ReadArray(jT808_0X8003.AgainPackageCount * 2).ToArray(); | |||
return jT808_0X8003; | |||
JT808_0x8003 value = new JT808_0x8003(); | |||
value.OriginalMsgNum = reader.ReadUInt16(); | |||
value.AgainPackageCount = reader.ReadByte(); | |||
value.AgainPackageData = reader.ReadArray(value.AgainPackageCount * 2).ToArray(); | |||
return value; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8003 value, IJT808Config config) | |||
@@ -2,6 +2,7 @@ | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -9,13 +10,19 @@ namespace JT808.Protocol.MessageBody | |||
/// 查询服务器时间应答 | |||
/// 2019版本 | |||
/// </summary> | |||
public class JT808_0x8004 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8004>, IJT808_2019_Version | |||
public class JT808_0x8004 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8004>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8004; | |||
public override string Description => "查询服务器时间应答"; | |||
public DateTime Time { get; set; } = DateTime.Now; | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
var datetime= reader.ReadDateTime6(); | |||
writer.WriteString($"[{ datetime.ToString("yyMMddHHmmss")}]查询服务器时间应答", datetime.ToString("yyyy-MM-dd HH:mm:ss")); | |||
} | |||
public JT808_0x8004 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8004 value = new JT808_0x8004(); | |||
@@ -1,13 +1,16 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 终端注册应答 | |||
/// </summary> | |||
public class JT808_0x8100 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8100> | |||
public class JT808_0x8100 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8100>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8100; | |||
public override string Description => "终端注册应答"; | |||
@@ -28,17 +31,33 @@ namespace JT808.Protocol.MessageBody | |||
/// </summary> | |||
public string Code { get; set; } | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8100 value = new JT808_0x8100(); | |||
value.AckMsgNum = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{ value.AckMsgNum.ReadNumber()}]应答流水号", value.AckMsgNum); | |||
value.JT808TerminalRegisterResult = (JT808TerminalRegisterResult)reader.ReadByte(); | |||
writer.WriteNumber($"[{ ((byte)value.JT808TerminalRegisterResult).ReadNumber()}]结果-{value.JT808TerminalRegisterResult.ToString()}", (byte)value.JT808TerminalRegisterResult); | |||
// 只有在成功后才有该字段 | |||
if (value.JT808TerminalRegisterResult == JT808TerminalRegisterResult.成功) | |||
{ | |||
var codeBuffer = reader.ReadVirtualArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||
value.Code = reader.ReadRemainStringContent(); | |||
writer.WriteString($"[{codeBuffer.ToHexString()}]鉴权码", value.Code); | |||
} | |||
} | |||
public JT808_0x8100 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8100 jT808_0X8100 = new JT808_0x8100(); | |||
jT808_0X8100.AckMsgNum = reader.ReadUInt16(); | |||
jT808_0X8100.JT808TerminalRegisterResult = (JT808TerminalRegisterResult)reader.ReadByte(); | |||
JT808_0x8100 value = new JT808_0x8100(); | |||
value.AckMsgNum = reader.ReadUInt16(); | |||
value.JT808TerminalRegisterResult = (JT808TerminalRegisterResult)reader.ReadByte(); | |||
// 只有在成功后才有该字段 | |||
if (jT808_0X8100.JT808TerminalRegisterResult == JT808TerminalRegisterResult.成功) | |||
if (value.JT808TerminalRegisterResult == JT808TerminalRegisterResult.成功) | |||
{ | |||
jT808_0X8100.Code = reader.ReadRemainStringContent(); | |||
value.Code = reader.ReadRemainStringContent(); | |||
} | |||
return jT808_0X8100; | |||
return value; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8100 value, IJT808Config config) | |||
@@ -1,14 +1,16 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 终端控制 | |||
/// </summary> | |||
public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8105>, IJT808_2019_Version | |||
public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8105>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8105; | |||
public override string Description => "终端控制"; | |||
@@ -43,135 +45,272 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteString(value.CommandValue.ToString()); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 命令参数 | |||
/// </summary> | |||
public class CommandParams | |||
{ | |||
/// <summary> | |||
/// 连接控制 | |||
/// 0:切换到指定监管平台服务器,连接到该服务器后即进入应急状态, | |||
///此状态下仅有下发控制指令的监管平台可发送包括短信在内的控制指令; | |||
///1:切换回原缺省监控平台服务器,并恢复正常状态。 | |||
/// </summary> | |||
public byte? ConnectionControl { get; set; } | |||
/// <summary> | |||
/// 拨号点名称 | |||
/// 一般为服务器 APN,无线通信拨号访问点,若网络制式为 CDMA,则该值为 PPP 连接拨号号码 | |||
/// </summary> | |||
public string DialPointName { get; set; } | |||
/// <summary> | |||
/// 拨号用户名 | |||
/// 服务器无线通信拨号用户名 | |||
/// </summary> | |||
public string DialUserName { get; set; } | |||
/// <summary> | |||
/// 拨号密码 | |||
/// 服务器无线通信拨号密码 | |||
/// </summary> | |||
public string DialPwd { get; set; } | |||
/// <summary> | |||
/// 服务器地址 | |||
/// 服务器地址;IP 或域名 | |||
/// </summary> | |||
public string ServerUrl { get; set; } | |||
/// <summary> | |||
/// TCP端口 | |||
/// </summary> | |||
public UInt16? TCPPort { get; set; } | |||
/// <summary> | |||
/// UDP端口 | |||
/// </summary> | |||
public UInt16? UDPPort { get; set; } | |||
/// <summary> | |||
/// 制造商 ID BYTE[5] | |||
/// 终端制造商编码 | |||
/// </summary> | |||
public long? ManufacturerCode { get; set; } | |||
/// <summary> | |||
/// 监管平台鉴权码 | |||
/// 监管平台下发的鉴权码,仅用于终端连接到监管平台之后的鉴权,终端连接回原监控平台还用原鉴权码 | |||
/// </summary> | |||
public string MonitoringPlatformAuthenticationCode { get; set; } | |||
/// <summary> | |||
/// 硬件版本 | |||
/// 终端的硬件版本号,由制造商自定 | |||
/// </summary> | |||
public string HardwareVersion { get; set; } | |||
/// <summary> | |||
/// 固件版本 | |||
/// 终端的固件版本号,由制造商自定 | |||
/// </summary> | |||
public string FirmwareVersion { get; set; } | |||
/// <summary> | |||
/// URL 地址 完整 URL 地址 | |||
/// </summary> | |||
public string URL { get; set; } | |||
/// <summary> | |||
/// 连接到指定服务器时限 | |||
/// 单位:分(min),值非 0 后的有效期截止前,终端应连回原地址。 | |||
/// 若值为 0,则表示一直连接指 定服务器 | |||
/// </summary> | |||
public UInt16? ConnectTimeLimit { get; set; } | |||
public override string ToString() | |||
{ | |||
return $"{ConnectionControl};{DialPointName};{DialUserName};{DialPwd};{ServerUrl};{TCPPort};{UDPPort};{ManufacturerCode};{MonitoringPlatformAuthenticationCode};{HardwareVersion};{FirmwareVersion};{URL};{ConnectTimeLimit}"; | |||
} | |||
public void SetCommandParams(string commandValue) | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
var values = commandValue.Split(';'); | |||
if (!string.IsNullOrEmpty(values[0])) | |||
{ | |||
ConnectionControl = byte.Parse(values[0]); | |||
} | |||
if (!string.IsNullOrEmpty(values[1])) | |||
{ | |||
DialPointName = values[1]; | |||
} | |||
if (!string.IsNullOrEmpty(values[2])) | |||
{ | |||
DialUserName = values[2]; | |||
} | |||
if (!string.IsNullOrEmpty(values[3])) | |||
{ | |||
DialPwd = values[3]; | |||
} | |||
if (!string.IsNullOrEmpty(values[4])) | |||
{ | |||
ServerUrl = values[4]; | |||
} | |||
if (!string.IsNullOrEmpty(values[5])) | |||
{ | |||
TCPPort = UInt16.Parse(values[5]); | |||
} | |||
if (!string.IsNullOrEmpty(values[6])) | |||
{ | |||
UDPPort = UInt16.Parse(values[6]); | |||
} | |||
if (!string.IsNullOrEmpty(values[7])) | |||
{ | |||
ManufacturerCode = long.Parse(values[7]); | |||
} | |||
if (!string.IsNullOrEmpty(values[8])) | |||
{ | |||
MonitoringPlatformAuthenticationCode = values[8]; | |||
} | |||
if (!string.IsNullOrEmpty(values[9])) | |||
JT808_0x8105 value = new JT808_0x8105 | |||
{ | |||
HardwareVersion = values[9]; | |||
} | |||
if (!string.IsNullOrEmpty(values[10])) | |||
CommandWord = reader.ReadByte() | |||
}; | |||
writer.WriteNumber($"[{ value.CommandWord.ReadNumber()}]命令字", value.CommandWord); | |||
if (value.CommandWord == 1 || value.CommandWord == 2) | |||
{ | |||
FirmwareVersion = values[10]; | |||
value.CommandValue = new CommandParams(); | |||
var commandValueBuffer = reader.ReadVirtualArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||
string commandValue=reader.ReadRemainStringContent(); | |||
writer.WriteString($"[{ commandValueBuffer.ToHexString()}]命令参数", commandValue); | |||
writer.WriteStartObject("命令参数对象"); | |||
var values = commandValue.Split(';'); | |||
if (!string.IsNullOrEmpty(values[0])) | |||
{ | |||
var connectionControl = byte.Parse(values[0]); | |||
writer.WriteNumber("连接控制", connectionControl); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("连接控制"); | |||
} | |||
if (!string.IsNullOrEmpty(values[1])) | |||
{ | |||
var dialPointName = values[1]; | |||
writer.WriteString("拨号点名称", dialPointName); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("拨号点名称"); | |||
} | |||
if (!string.IsNullOrEmpty(values[2])) | |||
{ | |||
var dialUserName = values[2]; | |||
writer.WriteString("拨号用户名", dialUserName); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("拨号用户名"); | |||
} | |||
if (!string.IsNullOrEmpty(values[3])) | |||
{ | |||
var dialPwd = values[3]; | |||
writer.WriteString("拨号密码", dialPwd); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("拨号密码"); | |||
} | |||
if (!string.IsNullOrEmpty(values[4])) | |||
{ | |||
var serverUrl = values[4]; | |||
writer.WriteString("服务器地址", serverUrl); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("服务器地址"); | |||
} | |||
if (!string.IsNullOrEmpty(values[5])) | |||
{ | |||
var tcpPort = ushort.Parse(values[5]); | |||
writer.WriteNumber("TCP端口", tcpPort); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("TCP端口"); | |||
} | |||
if (!string.IsNullOrEmpty(values[6])) | |||
{ | |||
var udpPort = ushort.Parse(values[6]); | |||
writer.WriteNumber("UDP端口", udpPort); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("UDP端口"); | |||
} | |||
if (!string.IsNullOrEmpty(values[7])) | |||
{ | |||
var manufacturerCode = long.Parse(values[7]); | |||
writer.WriteNumber("制造商ID", manufacturerCode); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("制造商ID"); | |||
} | |||
if (!string.IsNullOrEmpty(values[8])) | |||
{ | |||
var monitoringPlatformAuthenticationCode = values[8]; | |||
writer.WriteString("监管平台鉴权码", monitoringPlatformAuthenticationCode); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("监管平台鉴权码"); | |||
} | |||
if (!string.IsNullOrEmpty(values[9])) | |||
{ | |||
var hardwareVersion = values[9]; | |||
writer.WriteString("硬件版本号", hardwareVersion); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("硬件版本号"); | |||
} | |||
if (!string.IsNullOrEmpty(values[10])) | |||
{ | |||
var firmwareVersion = values[10]; | |||
writer.WriteString("固件版本号", firmwareVersion); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("固件版本号"); | |||
} | |||
if (!string.IsNullOrEmpty(values[11])) | |||
{ | |||
var url = values[11]; | |||
writer.WriteString("URL地址", url); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("URL地址"); | |||
} | |||
if (!string.IsNullOrEmpty(values[12])) | |||
{ | |||
var connectTimeLimit = ushort.Parse(values[12]); | |||
writer.WriteNumber("连接到指定服务器时限", connectTimeLimit); | |||
} | |||
else | |||
{ | |||
writer.WriteNull("连接到指定服务器时限"); | |||
} | |||
writer.WriteEndObject(); | |||
} | |||
if (!string.IsNullOrEmpty(values[11])) | |||
} | |||
/// <summary> | |||
/// 命令参数 | |||
/// </summary> | |||
public class CommandParams | |||
{ | |||
/// <summary> | |||
/// 连接控制 | |||
/// 0:切换到指定监管平台服务器,连接到该服务器后即进入应急状态, | |||
///此状态下仅有下发控制指令的监管平台可发送包括短信在内的控制指令; | |||
///1:切换回原缺省监控平台服务器,并恢复正常状态。 | |||
/// </summary> | |||
public byte? ConnectionControl { get; set; } | |||
/// <summary> | |||
/// 拨号点名称 | |||
/// 一般为服务器 APN,无线通信拨号访问点,若网络制式为 CDMA,则该值为 PPP 连接拨号号码 | |||
/// </summary> | |||
public string DialPointName { get; set; } | |||
/// <summary> | |||
/// 拨号用户名 | |||
/// 服务器无线通信拨号用户名 | |||
/// </summary> | |||
public string DialUserName { get; set; } | |||
/// <summary> | |||
/// 拨号密码 | |||
/// 服务器无线通信拨号密码 | |||
/// </summary> | |||
public string DialPwd { get; set; } | |||
/// <summary> | |||
/// 服务器地址 | |||
/// 服务器地址;IP 或域名 | |||
/// </summary> | |||
public string ServerUrl { get; set; } | |||
/// <summary> | |||
/// TCP端口 | |||
/// </summary> | |||
public ushort? TCPPort { get; set; } | |||
/// <summary> | |||
/// UDP端口 | |||
/// </summary> | |||
public ushort? UDPPort { get; set; } | |||
/// <summary> | |||
/// 制造商ID | |||
/// 终端制造商编码 | |||
/// </summary> | |||
public long? ManufacturerCode { get; set; } | |||
/// <summary> | |||
/// 监管平台鉴权码 | |||
/// 监管平台下发的鉴权码,仅用于终端连接到监管平台之后的鉴权,终端连接回原监控平台还用原鉴权码 | |||
/// </summary> | |||
public string MonitoringPlatformAuthenticationCode { get; set; } | |||
/// <summary> | |||
/// 硬件版本 | |||
/// 终端的硬件版本号,由制造商自定 | |||
/// </summary> | |||
public string HardwareVersion { get; set; } | |||
/// <summary> | |||
/// 固件版本 | |||
/// 终端的固件版本号,由制造商自定 | |||
/// </summary> | |||
public string FirmwareVersion { get; set; } | |||
/// <summary> | |||
/// URL 地址 完整 URL 地址 | |||
/// </summary> | |||
public string URL { get; set; } | |||
/// <summary> | |||
/// 连接到指定服务器时限 | |||
/// 单位:分(min),值非 0 后的有效期截止前,终端应连回原地址。 | |||
/// 若值为 0,则表示一直连接指 定服务器 | |||
/// </summary> | |||
public ushort? ConnectTimeLimit { get; set; } | |||
public override string ToString() | |||
{ | |||
URL = values[11]; | |||
return $"{ConnectionControl};{DialPointName};{DialUserName};{DialPwd};{ServerUrl};{TCPPort};{UDPPort};{ManufacturerCode};{MonitoringPlatformAuthenticationCode};{HardwareVersion};{FirmwareVersion};{URL};{ConnectTimeLimit}"; | |||
} | |||
if (!string.IsNullOrEmpty(values[12])) | |||
public void SetCommandParams(string commandValue) | |||
{ | |||
ConnectTimeLimit = UInt16.Parse(values[12]); | |||
var values = commandValue.Split(';'); | |||
if (!string.IsNullOrEmpty(values[0])) | |||
{ | |||
ConnectionControl = byte.Parse(values[0]); | |||
} | |||
if (!string.IsNullOrEmpty(values[1])) | |||
{ | |||
DialPointName = values[1]; | |||
} | |||
if (!string.IsNullOrEmpty(values[2])) | |||
{ | |||
DialUserName = values[2]; | |||
} | |||
if (!string.IsNullOrEmpty(values[3])) | |||
{ | |||
DialPwd = values[3]; | |||
} | |||
if (!string.IsNullOrEmpty(values[4])) | |||
{ | |||
ServerUrl = values[4]; | |||
} | |||
if (!string.IsNullOrEmpty(values[5])) | |||
{ | |||
TCPPort = ushort.Parse(values[5]); | |||
} | |||
if (!string.IsNullOrEmpty(values[6])) | |||
{ | |||
UDPPort = ushort.Parse(values[6]); | |||
} | |||
if (!string.IsNullOrEmpty(values[7])) | |||
{ | |||
ManufacturerCode = long.Parse(values[7]); | |||
} | |||
if (!string.IsNullOrEmpty(values[8])) | |||
{ | |||
MonitoringPlatformAuthenticationCode = values[8]; | |||
} | |||
if (!string.IsNullOrEmpty(values[9])) | |||
{ | |||
HardwareVersion = values[9]; | |||
} | |||
if (!string.IsNullOrEmpty(values[10])) | |||
{ | |||
FirmwareVersion = values[10]; | |||
} | |||
if (!string.IsNullOrEmpty(values[11])) | |||
{ | |||
URL = values[11]; | |||
} | |||
if (!string.IsNullOrEmpty(values[12])) | |||
{ | |||
ConnectTimeLimit = ushort.Parse(values[12]); | |||
} | |||
} | |||
} | |||
} | |||
@@ -1,6 +1,9 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -8,7 +11,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 查询指定终端参数 | |||
/// 0x8106 | |||
/// </summary> | |||
public class JT808_0x8106 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8106> | |||
public class JT808_0x8106 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8106>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8106; | |||
public override string Description => "查询指定终端参数"; | |||
@@ -43,6 +46,20 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteUInt32(value.Parameters[i]); | |||
} | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8106 value = new JT808_0x8106(); | |||
value.ParameterCount = reader.ReadByte(); | |||
writer.WriteNumber($"[{ value.ParameterCount.ReadNumber()}]参数总数", value.ParameterCount); | |||
writer.WriteStartArray("参数ID列表"); | |||
for (int i = 0; i < value.ParameterCount; i++) | |||
{ | |||
writer.WriteStartObject(); | |||
uint parameterId = reader.ReadUInt32(); | |||
writer.WriteNumber($"[{parameterId.ReadNumber()}]Id{i+1}",parameterId); | |||
writer.WriteEndObject(); | |||
} | |||
writer.WriteEndArray(); | |||
} | |||
} | |||
} |
@@ -1,14 +1,16 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 下发终端升级包 | |||
/// </summary> | |||
public class JT808_0x8108 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8108>, IJT808_2019_Version | |||
public class JT808_0x8108 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8108>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8108; | |||
@@ -75,5 +77,33 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteInt32(value.UpgradePackage.Length); | |||
writer.WriteArray(value.UpgradePackage); | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8108 value = new JT808_0x8108(); | |||
value.UpgradeType = (JT808UpgradeType)reader.ReadByte(); | |||
writer.WriteNumber($"[{ ((byte)value.UpgradeType).ReadNumber()}]升级类型-{value.UpgradeType.ToString()}", (byte)value.UpgradeType); | |||
if (reader.Version == JT808Version.JTT2019) | |||
{ | |||
var makerIdBuffer = reader.ReadVirtualArray(11).ToArray(); | |||
value.MakerId = reader.ReadString(11); | |||
writer.WriteString($"[{makerIdBuffer.ToHexString()}]制造商ID", value.MakerId); | |||
} | |||
else | |||
{ | |||
var makerIdBuffer = reader.ReadVirtualArray(5).ToArray(); | |||
value.MakerId = reader.ReadString(5); | |||
writer.WriteString($"[{makerIdBuffer.ToHexString()}]制造商ID", value.MakerId); | |||
} | |||
value.VersionNumLength = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.VersionNumLength.ReadNumber()}]版本号长度",value.VersionNumLength); | |||
var versionNumBuffer = reader.ReadVirtualArray(value.VersionNumLength).ToArray(); | |||
value.VersionNum = reader.ReadString(value.VersionNumLength); | |||
writer.WriteString($"[{versionNumBuffer.ToHexString()}]版本号", value.VersionNum); | |||
value.UpgradePackageLength = reader.ReadInt32(); | |||
writer.WriteNumber($"[{value.UpgradePackageLength.ReadNumber()}]升级数据包长度", value.UpgradePackageLength); | |||
value.UpgradePackage = reader.ReadArray(value.UpgradePackageLength).ToArray(); | |||
writer.WriteString($"升级数据包", value.UpgradePackage.ToHexString()); | |||
} | |||
} | |||
} |
@@ -1,12 +1,15 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 临时位置跟踪控制 | |||
/// </summary> | |||
public class JT808_0x8202 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8202> | |||
public class JT808_0x8202 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8202>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8202; | |||
@@ -22,6 +25,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 单位为秒(s),终端在接收到位置跟踪控制消息后,在有效期截止时间之前,依据消息中的时间间隔发送位置汇报 | |||
/// </summary> | |||
public int LocationTrackingValidity { get; set; } | |||
public JT808_0x8202 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8202 jT808_0X8202 = new JT808_0x8202(); | |||
@@ -35,5 +39,14 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteUInt16(value.Interval); | |||
writer.WriteInt32(value.LocationTrackingValidity); | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8202 value = new JT808_0x8202(); | |||
value.Interval = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{ value.Interval.ReadNumber()}]时间间隔", value.Interval); | |||
value.LocationTrackingValidity = reader.ReadInt32(); | |||
writer.WriteNumber($"[{ value.LocationTrackingValidity.ReadNumber()}]位置跟踪有效期", value.LocationTrackingValidity); | |||
} | |||
} | |||
} |
@@ -1,5 +1,8 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -7,7 +10,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 人工确认报警消息 | |||
/// 0x8203 | |||
/// </summary> | |||
public class JT808_0x8203 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8203> | |||
public class JT808_0x8203 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8203>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8203; | |||
public override string Description => "人工确认报警消息"; | |||
@@ -34,5 +37,14 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteUInt16(value.AlarmMsgNum); | |||
writer.WriteUInt32(value.ManualConfirmAlarmType); | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8203 value = new JT808_0x8203(); | |||
value.AlarmMsgNum = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{ value.AlarmMsgNum.ReadNumber()}]报警消息流水号", value.AlarmMsgNum); | |||
value.ManualConfirmAlarmType = reader.ReadUInt32(); | |||
writer.WriteNumber($"[{ value.ManualConfirmAlarmType.ReadNumber()}]人工确认报警类型", value.ManualConfirmAlarmType); | |||
} | |||
} | |||
} |
@@ -1,15 +1,17 @@ | |||
using JT808.Protocol.Attributes; | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 文本信息下发 | |||
/// </summary> | |||
public class JT808_0x8300 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8300>, IJT808_2019_Version | |||
public class JT808_0x8300 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8300>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8300; | |||
public override string Description => "文本信息下发"; | |||
@@ -50,5 +52,20 @@ namespace JT808.Protocol.MessageBody | |||
} | |||
writer.WriteString(value.TextInfo); | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8300 jT808_0X8300 = new JT808_0x8300(); | |||
jT808_0X8300.TextFlag = reader.ReadByte(); | |||
writer.WriteNumber($"[{ jT808_0X8300.TextFlag.ReadNumber()}]文本信息标志位", jT808_0X8300.TextFlag); | |||
if (reader.Version == JT808Version.JTT2019) | |||
{ | |||
jT808_0X8300.TextType = reader.ReadByte(); | |||
writer.WriteNumber($"[{ jT808_0X8300.TextType.ReadNumber()}]文本类型-{(jT808_0X8300.TextType==1? "通知":"服务")}", jT808_0X8300.TextType); | |||
} | |||
var txtBuffer = reader.ReadVirtualArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||
jT808_0X8300.TextInfo = reader.ReadRemainStringContent(); | |||
writer.WriteString($"[{txtBuffer.ToHexString()}]答案内容", jT808_0X8300.TextInfo); | |||
} | |||
} | |||
} |
@@ -1,9 +1,11 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Metadata; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -12,7 +14,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 0x8301 | |||
/// </summary> | |||
[Obsolete("2019版本已作删除")] | |||
public class JT808_0x8301 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8301>,IJT808_2019_Version | |||
public class JT808_0x8301 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8301>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8301; | |||
public override string Description => "事件设置"; | |||
@@ -64,5 +66,30 @@ namespace JT808.Protocol.MessageBody | |||
} | |||
} | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8301 value = new JT808_0x8301(); | |||
value.SettingType = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.SettingType.ReadNumber()}]设置类型", value.SettingType); | |||
value.SettingCount = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.SettingCount.ReadNumber()}]设置总数", value.SettingCount); | |||
writer.WriteStartArray("事件项"); | |||
for (var i = 0; i < value.SettingCount; i++) | |||
{ | |||
writer.WriteStartObject(); | |||
JT808EventProperty jT808EventProperty = new JT808EventProperty(); | |||
jT808EventProperty.EventId = reader.ReadByte(); | |||
writer.WriteNumber($"[{jT808EventProperty.EventId.ReadNumber()}]事件ID ", jT808EventProperty.EventId); | |||
jT808EventProperty.EventContentLength = reader.ReadByte(); | |||
writer.WriteNumber($"[{jT808EventProperty.EventContentLength.ReadNumber()}]事件内容长度", jT808EventProperty.EventContentLength); | |||
var eventContenBuffer = reader.ReadVirtualArray(jT808EventProperty.EventContentLength).ToArray(); | |||
jT808EventProperty.EventContent = reader.ReadString(jT808EventProperty.EventContentLength); | |||
writer.WriteString($"[{eventContenBuffer.ToHexString()}]事件内容", jT808EventProperty.EventContent); | |||
writer.WriteEndObject(); | |||
} | |||
writer.WriteEndArray(); | |||
} | |||
} | |||
} |
@@ -1,8 +1,10 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -11,7 +13,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 0x8302 | |||
/// </summary> | |||
[Obsolete("2019版本已作删除")] | |||
public class JT808_0x8302 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8302>, IJT808_2019_Version | |||
public class JT808_0x8302 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8302>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8302; | |||
public override string Description => "提问下发"; | |||
@@ -97,5 +99,32 @@ namespace JT808.Protocol.MessageBody | |||
} | |||
} | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8302 value = new JT808_0x8302(); | |||
value.Flag = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.Flag.ReadNumber()}]标志", value.Flag); | |||
value.IssueContentLength = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.IssueContentLength.ReadNumber()}]问题内容长度", value.IssueContentLength); | |||
var issueBuffer= reader.ReadVirtualArray(value.IssueContentLength).ToArray(); | |||
value.Issue = reader.ReadString(value.IssueContentLength); | |||
writer.WriteString($"[{issueBuffer.ToHexString()}]问题文本", value.Issue); | |||
writer.WriteStartArray("候选答案列表"); | |||
while (reader.ReadCurrentRemainContentLength() > 0) | |||
{ | |||
writer.WriteStartObject(); | |||
JT808_0x8302.Answer answer = new JT808_0x8302.Answer(); | |||
answer.Id = reader.ReadByte(); | |||
writer.WriteNumber($"[{answer.Id.ReadNumber()}]答案ID", answer.Id); | |||
answer.ContentLength = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{answer.ContentLength.ReadNumber()}]答案内容长度", answer.ContentLength); | |||
var answerBuffer = reader.ReadVirtualArray(answer.ContentLength).ToArray(); | |||
answer.Content = reader.ReadString(answer.ContentLength); | |||
writer.WriteString($"[{answerBuffer.ToHexString()}]答案内容", answer.Content); | |||
writer.WriteEndObject(); | |||
} | |||
writer.WriteEndArray(); | |||
} | |||
} | |||
} |
@@ -1,9 +1,11 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Metadata; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -12,7 +14,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 0x8303 | |||
/// </summary> | |||
[Obsolete("2019版本已作删除")] | |||
public class JT808_0x8303 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8303>, IJT808_2019_Version | |||
public class JT808_0x8303 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8303>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8303; | |||
public override string Description => "信息点播菜单设置"; | |||
@@ -30,6 +32,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 信息项列表 | |||
/// </summary> | |||
public List<JT808InformationItemProperty> InformationItems { get; set; } | |||
public JT808_0x8303 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8303 jT808_0X8303 = new JT808_0x8303(); | |||
@@ -61,5 +64,29 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteUInt16Return(length, position); | |||
} | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8303 value = new JT808_0x8303(); | |||
value.SettingType = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.SettingType.ReadNumber()}]设置类型", value.SettingType); | |||
value.InformationItemCount = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.InformationItemCount.ReadNumber()}]信息项总数", value.InformationItemCount); | |||
writer.WriteStartArray("信息项列表"); | |||
for (var i = 0; i < value.InformationItemCount; i++) | |||
{ | |||
writer.WriteStartObject(); | |||
JT808InformationItemProperty jT808InformationItemProperty = new JT808InformationItemProperty(); | |||
jT808InformationItemProperty.InformationType = reader.ReadByte(); | |||
writer.WriteNumber($"[{jT808InformationItemProperty.InformationType.ReadNumber()}]信息类型", jT808InformationItemProperty.InformationType); | |||
jT808InformationItemProperty.InformationLength = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{jT808InformationItemProperty.InformationLength.ReadNumber()}]信息名称长度", jT808InformationItemProperty.InformationLength); | |||
var infoBuffer = reader.ReadVirtualArray(jT808InformationItemProperty.InformationLength).ToArray(); | |||
jT808InformationItemProperty.InformationName = reader.ReadString(jT808InformationItemProperty.InformationLength); | |||
writer.WriteString($"[{infoBuffer.ToHexString()}]信息名称", jT808InformationItemProperty.InformationName); | |||
writer.WriteEndObject(); | |||
} | |||
writer.WriteEndArray(); | |||
} | |||
} | |||
} |
@@ -1,7 +1,9 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
@@ -10,7 +12,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 0x8304 | |||
/// </summary> | |||
[Obsolete("2019版本已作删除")] | |||
public class JT808_0x8304 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8304>, IJT808_2019_Version | |||
public class JT808_0x8304 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8304>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8304; | |||
public override string Description => "信息服务"; | |||
@@ -45,6 +47,16 @@ namespace JT808.Protocol.MessageBody | |||
ushort length = (ushort)(writer.GetCurrentPosition() - position - 2); | |||
writer.WriteUInt16Return(length, position); | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8304 value = new JT808_0x8304(); | |||
value.InformationType = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.InformationType.ReadNumber()}]信息类型", value.InformationType); | |||
value.InformationLength = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{value.InformationLength.ReadNumber()}]信息长度", value.InformationLength); | |||
var infoBuffer = reader.ReadVirtualArray(value.InformationLength).ToArray(); | |||
value.InformationContent = reader.ReadString(value.InformationLength); | |||
writer.WriteString($"[{infoBuffer.ToHexString()}]信息内容", value.InformationContent); | |||
} | |||
} | |||
} |
@@ -1,13 +1,16 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 电话回拨 | |||
/// </summary> | |||
public class JT808_0x8400 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8400> | |||
public class JT808_0x8400 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8400>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8400; | |||
public override string Description => "电话回拨"; | |||
@@ -35,5 +38,16 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteByte((byte)value.CallBack); | |||
writer.WriteString(value.PhoneNumber); | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8400 value = new JT808_0x8400(); | |||
value.CallBack = (JT808CallBackType)reader.ReadByte(); | |||
writer.WriteNumber($"[{((byte)value.CallBack).ReadNumber()}]{value.CallBack.ToString()}", (byte)value.CallBack); | |||
// 最长为 20 字节 | |||
var pnoBuffer = reader.ReadVirtualArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||
value.PhoneNumber = reader.ReadRemainStringContent(); | |||
writer.WriteString($"[{pnoBuffer.ToHexString()}]电话号码", value.PhoneNumber); | |||
} | |||
} | |||
} |
@@ -1,15 +1,18 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Metadata; | |||
using System.Collections.Generic; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 设置电话本 | |||
/// </summary> | |||
public class JT808_0x8401 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8401> | |||
public class JT808_0x8401 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8401>, IJT808Analyze | |||
{ | |||
public override ushort MsgId { get; } = 0x8401; | |||
public override string Description => "设置电话本"; | |||
@@ -25,6 +28,7 @@ namespace JT808.Protocol.MessageBody | |||
/// 联系人项 | |||
/// </summary> | |||
public IList<JT808ContactProperty> JT808ContactProperties { get; set; } | |||
public JT808_0x8401 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8401 jT808_0X8401 = new JT808_0x8401(); | |||
@@ -58,5 +62,34 @@ namespace JT808.Protocol.MessageBody | |||
writer.WriteString(item.Contact); | |||
} | |||
} | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8401 value = new JT808_0x8401(); | |||
value.SettingTelephoneBook = (JT808SettingTelephoneBook)reader.ReadByte(); | |||
writer.WriteNumber($"[{((byte)value.SettingTelephoneBook).ReadNumber()}]设置类型",(byte) value.SettingTelephoneBook); | |||
value.ContactCount = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.ContactCount.ReadNumber()}]联系人总数", value.ContactCount); | |||
writer.WriteStartArray("联系人项"); | |||
for (var i = 0; i < value.ContactCount; i++) | |||
{ | |||
writer.WriteStartObject(); | |||
JT808ContactProperty jT808ContactProperty = new JT808ContactProperty(); | |||
jT808ContactProperty.TelephoneBookContactType = (JT808TelephoneBookContactType)reader.ReadByte(); | |||
writer.WriteNumber($"[{((byte)jT808ContactProperty.TelephoneBookContactType).ReadNumber()}]{jT808ContactProperty.TelephoneBookContactType.ToString()}", (byte)jT808ContactProperty.TelephoneBookContactType); | |||
jT808ContactProperty.PhoneNumberLength = reader.ReadByte(); | |||
writer.WriteNumber($"[{jT808ContactProperty.PhoneNumberLength.ReadNumber()}]号码长度", jT808ContactProperty.PhoneNumberLength); | |||
var pnoBuffer = reader.ReadVirtualArray(jT808ContactProperty.PhoneNumberLength); | |||
jT808ContactProperty.PhoneNumber = reader.ReadString(jT808ContactProperty.PhoneNumberLength); | |||
writer.WriteString($"[{pnoBuffer.ToArray().ToHexString()}]电话号码", jT808ContactProperty.PhoneNumber); | |||
jT808ContactProperty.ContactLength = reader.ReadByte(); | |||
writer.WriteNumber($"[{jT808ContactProperty.ContactLength.ReadNumber()}]联系人长度", jT808ContactProperty.ContactLength); | |||
var contactBuffer = reader.ReadVirtualArray(jT808ContactProperty.ContactLength); | |||
jT808ContactProperty.Contact = reader.ReadString(jT808ContactProperty.ContactLength); | |||
writer.WriteString($"[{contactBuffer.ToArray().ToHexString()}]联系人", jT808ContactProperty.Contact); | |||
writer.WriteEndObject(); | |||
} | |||
writer.WriteEndArray(); | |||
} | |||
} | |||
} |
@@ -4,13 +4,14 @@ using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Collections.Generic; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 车辆控制 | |||
/// </summary> | |||
public class JT808_0x8500 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8500>, IJT808_2019_Version | |||
public class JT808_0x8500 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8500>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
public override ushort MsgId { get; } = 0x8500; | |||
public override string Description => "车辆控制"; | |||
@@ -34,6 +35,24 @@ namespace JT808.Protocol.MessageBody | |||
/// </summary> | |||
public List<JT808_0x8500_ControlType> ControlTypes { get; set; } | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8500 value = new JT808_0x8500(); | |||
if (reader.Version == JT808Version.JTT2019) | |||
{ | |||
value.ControlTypeCount = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{ value.ControlTypeCount.ReadNumber()}]控制类型数量", value.ControlTypeCount); | |||
//todo:待完善 | |||
value.ControlTypeBuffer = reader.ReadArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||
writer.WriteString($"控制类型", value.ControlTypeBuffer.ToHexString()); | |||
} | |||
else | |||
{ | |||
value.ControlFlag = reader.ReadByte(); | |||
writer.WriteNumber($"[{ value.ControlFlag.ReadNumber()}]控制标志", value.ControlFlag); | |||
} | |||
} | |||
public JT808_0x8500 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8500 value = new JT808_0x8500(); | |||
@@ -1,21 +1,32 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 控制类型 | |||
/// </summary> | |||
public class JT808_0x8500_0x0001 : JT808_0x8500_ControlType, IJT808MessagePackFormatter<JT808_0x8500_0x0001> | |||
public class JT808_0x8500_0x0001 : JT808_0x8500_ControlType, IJT808MessagePackFormatter<JT808_0x8500_0x0001>, IJT808Analyze | |||
{ | |||
public override ushort ControlTypeId { get; set; } = 0x0001; | |||
public byte ControlTypeParameter { get; set; } | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8500_0x0001 value = new JT808_0x8500_0x0001(); | |||
value.ControlTypeId = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{ value.ControlTypeId.ReadNumber()}]控制类型Id", value.ControlTypeId); | |||
value.ControlTypeParameter = reader.ReadByte(); | |||
writer.WriteNumber($"[{ value.ControlTypeParameter.ReadNumber()}]控制类型参数", value.ControlTypeParameter); | |||
} | |||
public JT808_0x8500_0x0001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8500_0x0001 value = new JT808_0x8500_0x0001(); | |||
@@ -24,7 +24,7 @@ namespace JT808.Protocol.Metadata | |||
/// </summary> | |||
public byte ContactLength { get; set; } | |||
/// <summary> | |||
/// 经 GBK 编码 | |||
/// 联系人 经 GBK 编码 | |||
/// </summary> | |||
public string Contact { get; set; } | |||
} | |||