@@ -43,7 +43,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
FileSize=10 | FileSize=10 | ||||
} | } | ||||
}, | }, | ||||
TerminalID = "4444444", | |||||
MakerID = "4444444", | |||||
InfoType = 0 | InfoType = 0 | ||||
}; | }; | ||||
var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); | var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); | ||||
@@ -68,9 +68,14 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
Assert.Equal(9, jT808UploadLocationRequest.AttachInfos[1].FileNameLength); | Assert.Equal(9, jT808UploadLocationRequest.AttachInfos[1].FileNameLength); | ||||
Assert.Equal(10u, jT808UploadLocationRequest.AttachInfos[1].FileSize); | Assert.Equal(10u, jT808UploadLocationRequest.AttachInfos[1].FileSize); | ||||
Assert.Equal("4444444", jT808UploadLocationRequest.TerminalID); | |||||
Assert.Equal("4444444", jT808UploadLocationRequest.MakerID); | |||||
Assert.Equal(0, jT808UploadLocationRequest.InfoType); | Assert.Equal(0, jT808UploadLocationRequest.InfoType); | ||||
} | } | ||||
[Fact] | |||||
public void Json() | |||||
{ | |||||
var json = JT808Serializer.Analyze<JT808_0x1210>("3434343434343434343434343434191210183100030201313131313131313131313131313131313131313131313131313131313131313100020866696C656E616D65000000090966696C656E616D65310000000A".ToHexBytes()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -40,5 +40,11 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
Assert.Equal(2, jT808UploadLocationRequest.FileType); | Assert.Equal(2, jT808UploadLocationRequest.FileType); | ||||
Assert.Equal("FileName".Length, jT808UploadLocationRequest.FileNameLength); | Assert.Equal("FileName".Length, jT808UploadLocationRequest.FileNameLength); | ||||
} | } | ||||
[Fact] | |||||
public void Json() | |||||
{ | |||||
var json = JT808Serializer.Analyze<JT808_0x1211>("0846696C654E616D650200000001".ToHexBytes()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -60,5 +60,10 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
Assert.Equal("999999999999", jT808_0x8103_0xF366.TyreSpecificationType); | Assert.Equal("999999999999", jT808_0x8103_0xF366.TyreSpecificationType); | ||||
Assert.Equal(10, jT808_0x8103_0xF366.VoltageThreshold); | Assert.Equal(10, jT808_0x8103_0xF366.VoltageThreshold); | ||||
} | } | ||||
[Fact] | |||||
public void Json() | |||||
{ | |||||
var json = JT808Serializer.Analyze<JT808_0x8103>("010000F366243939393939393939393939390008000400060005000300020001000A0007010203040506".ToHexBytes()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -42,5 +42,10 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
Assert.Equal(1, jT808_0x8103_0xF367.LateralRearApproachAlarmTimeThreshold); | Assert.Equal(1, jT808_0x8103_0xF367.LateralRearApproachAlarmTimeThreshold); | ||||
Assert.Equal(2, jT808_0x8103_0xF367.RearApproachAlarmTimeThreshold); | Assert.Equal(2, jT808_0x8103_0xF367.RearApproachAlarmTimeThreshold); | ||||
} | } | ||||
[Fact] | |||||
public void Json() | |||||
{ | |||||
var json = JT808Serializer.Analyze<JT808_0x8103>("010000F367020201".ToHexBytes()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -37,5 +37,10 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
Assert.Equal(2, jT808UploadLocationRequest.USBCount); | Assert.Equal(2, jT808UploadLocationRequest.USBCount); | ||||
Assert.Equal(new List<byte> { 1, 2 }.ToArray().ToHexString(), jT808UploadLocationRequest.MultipleUSB.ToArray().ToHexString()); | Assert.Equal(new List<byte> { 1, 2 }.ToArray().ToHexString(), jT808UploadLocationRequest.MultipleUSB.ToArray().ToHexString()); | ||||
} | } | ||||
[Fact] | |||||
public void Json() | |||||
{ | |||||
var json = JT808Serializer.Analyze<JT808_0x8900_0xF7>("020102".ToHexBytes()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -54,5 +54,11 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
Assert.Equal(5000, jT808UploadLocationRequest.AttachmentServerIPTcpPort); | Assert.Equal(5000, jT808UploadLocationRequest.AttachmentServerIPTcpPort); | ||||
Assert.Equal(5001, jT808UploadLocationRequest.AttachmentServerIPUdpPort); | Assert.Equal(5001, jT808UploadLocationRequest.AttachmentServerIPUdpPort); | ||||
} | } | ||||
[Fact] | |||||
public void Json() | |||||
{ | |||||
var json = JT808Serializer.Analyze<JT808_0x9208>("0B3139322E3136382E312E311388138934343434343434191210183100030201313131313131313131313131313131313131313131313131313131313131313100000000000000000000000000000000".ToHexBytes()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -57,5 +57,10 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
Assert.Equal(30u, jT808UploadLocationRequest.DataPackages[1].Length); | Assert.Equal(30u, jT808UploadLocationRequest.DataPackages[1].Length); | ||||
Assert.Equal(40u, jT808UploadLocationRequest.DataPackages[1].Offset); | Assert.Equal(40u, jT808UploadLocationRequest.DataPackages[1].Offset); | ||||
} | } | ||||
[Fact] | |||||
public void Json() | |||||
{ | |||||
var json = JT808Serializer.Analyze<JT808_0x9212>("0846696C654E616D65010202000000140000000A000000280000001E".ToHexBytes()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -389,9 +389,9 @@ | |||||
报警附件信息消息 | 报警附件信息消息 | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:JT808.Protocol.Extensions.JTActiveSafety.MessageBody.JT808_0x1210.TerminalID"> | |||||
<member name="P:JT808.Protocol.Extensions.JTActiveSafety.MessageBody.JT808_0x1210.MakerID"> | |||||
<summary> | <summary> | ||||
终端ID | |||||
制造商Id | |||||
7 个字节,由大写字母和数字组成,此终端ID 由制造商自行定义,位数不足时,后补“0x00” | 7 个字节,由大写字母和数字组成,此终端ID 由制造商自行定义,位数不足时,后补“0x00” | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
@@ -246,15 +246,14 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | ||||
writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | ||||
writer.WriteEndObject(); | writer.WriteEndObject(); | ||||
value.AlarmIdentification = new AlarmIdentificationProperty | |||||
{ | |||||
TerminalID = reader.ReadString(7), | |||||
Time = reader.ReadDateTime6(), | |||||
SN = reader.ReadByte(), | |||||
AttachCount = reader.ReadByte(), | |||||
Retain = reader.ReadByte() | |||||
}; | |||||
writer.WriteString($"[{value.AlarmIdentification.TerminalID}]终端ID", value.AlarmIdentification.TerminalID); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty(); | |||||
string terminalIDHex = reader.ReadVirtualArray(7).ToArray().ToHexString(); | |||||
value.AlarmIdentification.TerminalID = reader.ReadString(7); | |||||
value.AlarmIdentification.Time = reader.ReadDateTime6(); | |||||
value.AlarmIdentification.SN = reader.ReadByte(); | |||||
value.AlarmIdentification.AttachCount = reader.ReadByte(); | |||||
value.AlarmIdentification.Retain = reader.ReadByte(); | |||||
writer.WriteString($"[{terminalIDHex}]终端ID", value.AlarmIdentification.TerminalID); | |||||
writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | ||||
@@ -202,15 +202,14 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | ||||
writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | ||||
writer.WriteEndObject(); | writer.WriteEndObject(); | ||||
value.AlarmIdentification = new AlarmIdentificationProperty | |||||
{ | |||||
TerminalID = reader.ReadString(7), | |||||
Time = reader.ReadDateTime6(), | |||||
SN = reader.ReadByte(), | |||||
AttachCount = reader.ReadByte(), | |||||
Retain = reader.ReadByte() | |||||
}; | |||||
writer.WriteString($"[{value.AlarmIdentification.TerminalID}]终端ID", value.AlarmIdentification.TerminalID); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty(); | |||||
string terminalIDHex = reader.ReadVirtualArray(7).ToArray().ToHexString(); | |||||
value.AlarmIdentification.TerminalID = reader.ReadString(7); | |||||
value.AlarmIdentification.Time = reader.ReadDateTime6(); | |||||
value.AlarmIdentification.SN = reader.ReadByte(); | |||||
value.AlarmIdentification.AttachCount = reader.ReadByte(); | |||||
value.AlarmIdentification.Retain = reader.ReadByte(); | |||||
writer.WriteString($"[{terminalIDHex}]终端ID", value.AlarmIdentification.TerminalID); | |||||
writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | ||||
@@ -119,15 +119,14 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | ||||
writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | ||||
writer.WriteEndObject(); | writer.WriteEndObject(); | ||||
value.AlarmIdentification = new AlarmIdentificationProperty | |||||
{ | |||||
TerminalID = reader.ReadString(7), | |||||
Time = reader.ReadDateTime6(), | |||||
SN = reader.ReadByte(), | |||||
AttachCount = reader.ReadByte(), | |||||
Retain = reader.ReadByte() | |||||
}; | |||||
writer.WriteString($"[{value.AlarmIdentification.TerminalID}]终端ID", value.AlarmIdentification.TerminalID); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty(); | |||||
string terminalIDHex = reader.ReadVirtualArray(7).ToArray().ToHexString(); | |||||
value.AlarmIdentification.TerminalID = reader.ReadString(7); | |||||
value.AlarmIdentification.Time = reader.ReadDateTime6(); | |||||
value.AlarmIdentification.SN = reader.ReadByte(); | |||||
value.AlarmIdentification.AttachCount = reader.ReadByte(); | |||||
value.AlarmIdentification.Retain = reader.ReadByte(); | |||||
writer.WriteString($"[{terminalIDHex}]终端ID", value.AlarmIdentification.TerminalID); | |||||
writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | ||||
@@ -190,15 +190,14 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | writer.WriteString($"[{vehicleStateBits[1]}]Bit14自定义", vehicleStateBits[1].ToString()); | ||||
writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | writer.WriteString($"[{vehicleStateBits[0]}]Bit15自定义", vehicleStateBits[0].ToString()); | ||||
writer.WriteEndObject(); | writer.WriteEndObject(); | ||||
value.AlarmIdentification = new AlarmIdentificationProperty | |||||
{ | |||||
TerminalID = reader.ReadString(7), | |||||
Time = reader.ReadDateTime6(), | |||||
SN = reader.ReadByte(), | |||||
AttachCount = reader.ReadByte(), | |||||
Retain = reader.ReadByte() | |||||
}; | |||||
writer.WriteString($"[{value.AlarmIdentification.TerminalID}]终端ID", value.AlarmIdentification.TerminalID); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty(); | |||||
string terminalIDHex = reader.ReadVirtualArray(7).ToArray().ToHexString(); | |||||
value.AlarmIdentification.TerminalID = reader.ReadString(7); | |||||
value.AlarmIdentification.Time = reader.ReadDateTime6(); | |||||
value.AlarmIdentification.SN = reader.ReadByte(); | |||||
value.AlarmIdentification.AttachCount = reader.ReadByte(); | |||||
value.AlarmIdentification.Retain = reader.ReadByte(); | |||||
writer.WriteString($"[{terminalIDHex}]终端ID", value.AlarmIdentification.TerminalID); | |||||
writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | ||||
writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | ||||
@@ -71,7 +71,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
writer.WriteNumber($"[{item.CustomerCodeLength.ReadNumber()}]客户代码长度", item.CustomerCodeLength); | writer.WriteNumber($"[{item.CustomerCodeLength.ReadNumber()}]客户代码长度", item.CustomerCodeLength); | ||||
string customerCodeHex = reader.ReadVirtualArray(item.CustomerCodeLength).ToArray().ToHexString(); | string customerCodeHex = reader.ReadVirtualArray(item.CustomerCodeLength).ToArray().ToHexString(); | ||||
item.CustomerCode = reader.ReadString(item.CustomerCodeLength); | item.CustomerCode = reader.ReadString(item.CustomerCodeLength); | ||||
writer.WriteString($"[{customerCodeHex}]设备ID", item.CustomerCode); | |||||
writer.WriteString($"[{customerCodeHex}]客户代码", item.CustomerCode); | |||||
writer.WriteEndObject(); | writer.WriteEndObject(); | ||||
} | } | ||||
@@ -1,22 +1,24 @@ | |||||
using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 报警附件信息消息 | /// 报警附件信息消息 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x1210:JT808Bodies, IJT808MessagePackFormatter<JT808_0x1210> | |||||
public class JT808_0x1210: JT808Bodies, IJT808MessagePackFormatter<JT808_0x1210>, IJT808Analyze | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 终端ID | |||||
/// 制造商Id | |||||
/// 7 个字节,由大写字母和数字组成,此终端ID 由制造商自行定义,位数不足时,后补“0x00” | /// 7 个字节,由大写字母和数字组成,此终端ID 由制造商自行定义,位数不足时,后补“0x00” | ||||
/// </summary> | /// </summary> | ||||
public string TerminalID { get; set; } | |||||
public string MakerID { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 报警标识号 | /// 报警标识号 | ||||
/// </summary> | /// </summary> | ||||
@@ -45,11 +47,56 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
public override string Description => "报警附件信息消息"; | public override string Description => "报警附件信息消息"; | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x1210 value = new JT808_0x1210(); | |||||
string makerIdHex=reader.ReadVirtualArray(7).ToArray().ToHexString(); | |||||
value.MakerID = reader.ReadString(7); | |||||
writer.WriteString($"[{makerIdHex}]制造商Id", value.MakerID); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty(); | |||||
string terminalIDHex = reader.ReadVirtualArray(7).ToArray().ToHexString(); | |||||
value.AlarmIdentification.TerminalID = reader.ReadString(7); | |||||
value.AlarmIdentification.Time = reader.ReadDateTime6(); | |||||
value.AlarmIdentification.SN = reader.ReadByte(); | |||||
value.AlarmIdentification.AttachCount = reader.ReadByte(); | |||||
value.AlarmIdentification.Retain = reader.ReadByte(); | |||||
writer.WriteString($"[{terminalIDHex}]终端ID", value.AlarmIdentification.TerminalID); | |||||
writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | |||||
writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | |||||
writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | |||||
writer.WriteNumber($"[{value.AlarmIdentification.Retain.ReadNumber()}]预留", value.AlarmIdentification.Retain); | |||||
string alarmIdHex = reader.ReadVirtualArray(32).ToArray().ToHexString(); | |||||
value.AlarmId = reader.ReadString(32); | |||||
writer.WriteString($"[{alarmIdHex}]平台给报警分配的唯一编号", value.AlarmId); | |||||
value.InfoType = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.InfoType.ReadNumber()}]信息类型", value.InfoType); | |||||
value.AttachCount = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.AttachCount.ReadNumber()}]附件数量", value.AttachCount); | |||||
if (value.AttachCount > 0) | |||||
{ | |||||
writer.WriteStartArray("附件信息列表"); | |||||
for (int i = 0; i < value.AttachCount; i++) | |||||
{ | |||||
writer.WriteStartObject(); | |||||
AttachProperty attachProperty = new AttachProperty(); | |||||
attachProperty.FileNameLength = reader.ReadByte(); | |||||
writer.WriteNumber($"[{attachProperty.FileNameLength.ReadNumber()}]文件名称长度", attachProperty.FileNameLength); | |||||
string fileNameHex = reader.ReadVirtualArray(attachProperty.FileNameLength).ToArray().ToHexString(); | |||||
attachProperty.FileName = reader.ReadString(attachProperty.FileNameLength); | |||||
writer.WriteString($"[{fileNameHex}]文件名称", attachProperty.FileName); | |||||
attachProperty.FileSize = reader.ReadUInt32(); | |||||
writer.WriteNumber($"[{ attachProperty.FileSize.ReadNumber()}]文件大小", attachProperty.FileSize); | |||||
writer.WriteEndObject(); | |||||
} | |||||
writer.WriteEndArray(); | |||||
} | |||||
} | |||||
public JT808_0x1210 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x1210 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x1210 jT808_0X1210 = new JT808_0x1210(); | |||||
jT808_0X1210.TerminalID = reader.ReadString(7); | |||||
jT808_0X1210.AlarmIdentification = new AlarmIdentificationProperty | |||||
JT808_0x1210 value = new JT808_0x1210(); | |||||
value.MakerID = reader.ReadString(7); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty | |||||
{ | { | ||||
TerminalID = reader.ReadString(7), | TerminalID = reader.ReadString(7), | ||||
Time = reader.ReadDateTime6(), | Time = reader.ReadDateTime6(), | ||||
@@ -57,27 +104,27 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
AttachCount = reader.ReadByte(), | AttachCount = reader.ReadByte(), | ||||
Retain = reader.ReadByte() | Retain = reader.ReadByte() | ||||
}; | }; | ||||
jT808_0X1210.AlarmId = reader.ReadString(32); | |||||
jT808_0X1210.InfoType = reader.ReadByte(); | |||||
jT808_0X1210.AttachCount = reader.ReadByte(); | |||||
if (jT808_0X1210.AttachCount > 0) | |||||
value.AlarmId = reader.ReadString(32); | |||||
value.InfoType = reader.ReadByte(); | |||||
value.AttachCount = reader.ReadByte(); | |||||
if (value.AttachCount > 0) | |||||
{ | { | ||||
jT808_0X1210.AttachInfos = new List<AttachProperty>(); | |||||
for (int i = 0; i < jT808_0X1210.AttachCount; i++) | |||||
value.AttachInfos = new List<AttachProperty>(); | |||||
for (int i = 0; i < value.AttachCount; i++) | |||||
{ | { | ||||
AttachProperty attachProperty = new AttachProperty(); | AttachProperty attachProperty = new AttachProperty(); | ||||
attachProperty.FileNameLength = reader.ReadByte(); | attachProperty.FileNameLength = reader.ReadByte(); | ||||
attachProperty.FileName = reader.ReadString(attachProperty.FileNameLength); | attachProperty.FileName = reader.ReadString(attachProperty.FileNameLength); | ||||
attachProperty.FileSize = reader.ReadUInt32(); | attachProperty.FileSize = reader.ReadUInt32(); | ||||
jT808_0X1210.AttachInfos.Add(attachProperty); | |||||
value.AttachInfos.Add(attachProperty); | |||||
} | } | ||||
} | } | ||||
return jT808_0X1210; | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1210 value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1210 value, IJT808Config config) | ||||
{ | { | ||||
writer.WriteString(value.TerminalID.PadRight(7, '0')); | |||||
writer.WriteString(value.MakerID.PadRight(7, '0')); | |||||
if (value.AlarmIdentification == null) | if (value.AlarmIdentification == null) | ||||
{ | { | ||||
throw new NullReferenceException($"{nameof(AlarmIdentificationProperty)}不为空"); | throw new NullReferenceException($"{nameof(AlarmIdentificationProperty)}不为空"); | ||||
@@ -1,12 +1,14 @@ | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 文件信息上传 | /// 文件信息上传 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x1211 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1211> | |||||
public class JT808_0x1211 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1211>, IJT808Analyze | |||||
{ | { | ||||
public override string Description => "文件信息上传"; | public override string Description => "文件信息上传"; | ||||
/// <summary> | /// <summary> | ||||
@@ -29,14 +31,28 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
public override ushort MsgId => 0x1211; | public override ushort MsgId => 0x1211; | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x1211 value = new JT808_0x1211(); | |||||
value.FileNameLength = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.FileNameLength.ReadNumber()}]文件名称长度", value.FileNameLength); | |||||
string fileNameHex = reader.ReadVirtualArray(value.FileNameLength).ToArray().ToHexString(); | |||||
value.FileName = reader.ReadString(value.FileNameLength); | |||||
writer.WriteString($"[{fileNameHex}]文件名称", value.FileName); | |||||
value.FileType = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.FileType.ReadNumber()}]文件类型", value.FileType); | |||||
value.FileSize = reader.ReadUInt32(); | |||||
writer.WriteNumber($"[{value.FileSize.ReadNumber()}]文件大小", value.FileSize); | |||||
} | |||||
public JT808_0x1211 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x1211 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x1211 jT808_0X1211 = new JT808_0x1211(); | |||||
jT808_0X1211.FileNameLength = reader.ReadByte(); | |||||
jT808_0X1211.FileName = reader.ReadString(jT808_0X1211.FileNameLength); | |||||
jT808_0X1211.FileType = reader.ReadByte(); | |||||
jT808_0X1211.FileSize = reader.ReadUInt32(); | |||||
return jT808_0X1211; | |||||
JT808_0x1211 value = new JT808_0x1211(); | |||||
value.FileNameLength = reader.ReadByte(); | |||||
value.FileName = reader.ReadString(value.FileNameLength); | |||||
value.FileType = reader.ReadByte(); | |||||
value.FileSize = reader.ReadUInt32(); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1211 value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1211 value, IJT808Config config) | ||||
@@ -1,12 +1,14 @@ | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 文件上传完成消息 | /// 文件上传完成消息 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x1212 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1212> | |||||
public class JT808_0x1212 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1212>, IJT808Analyze | |||||
{ | { | ||||
public override string Description => "文件上传完成消息"; | public override string Description => "文件上传完成消息"; | ||||
/// <summary> | /// <summary> | ||||
@@ -28,14 +30,28 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
public uint FileSize { get; set; } | public uint FileSize { get; set; } | ||||
public override ushort MsgId => 0x1212; | public override ushort MsgId => 0x1212; | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x1212 value = new JT808_0x1212(); | |||||
value.FileNameLength = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.FileNameLength.ReadNumber()}]文件名称长度", value.FileNameLength); | |||||
string fileNameHex = reader.ReadVirtualArray(value.FileNameLength).ToArray().ToHexString(); | |||||
value.FileName = reader.ReadString(value.FileNameLength); | |||||
writer.WriteString($"[{fileNameHex}]文件名称", value.FileName); | |||||
value.FileType = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.FileType.ReadNumber()}]文件类型", value.FileType); | |||||
value.FileSize = reader.ReadUInt32(); | |||||
writer.WriteNumber($"[{value.FileSize.ReadNumber()}]文件大小", value.FileSize); | |||||
} | |||||
public JT808_0x1212 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x1212 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x1212 jT808_0X1212 = new JT808_0x1212(); | |||||
jT808_0X1212.FileNameLength = reader.ReadByte(); | |||||
jT808_0X1212.FileName = reader.ReadString(jT808_0X1212.FileNameLength); | |||||
jT808_0X1212.FileType = reader.ReadByte(); | |||||
jT808_0X1212.FileSize = reader.ReadUInt32(); | |||||
return jT808_0X1212; | |||||
JT808_0x1212 value = new JT808_0x1212(); | |||||
value.FileNameLength = reader.ReadByte(); | |||||
value.FileName = reader.ReadString(value.FileNameLength); | |||||
value.FileType = reader.ReadByte(); | |||||
value.FileSize = reader.ReadUInt32(); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1212 value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1212 value, IJT808Config config) | ||||
@@ -1,13 +1,15 @@ | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessageBody; | using JT808.Protocol.MessageBody; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 胎压监测系统参数 | /// 胎压监测系统参数 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8103_0xF366 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF366> | |||||
public class JT808_0x8103_0xF366 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF366>, IJT808Analyze | |||||
{ | { | ||||
public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF366; | public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF366; | ||||
public override byte ParamLength { get; set; } = 46; | public override byte ParamLength { get; set; } = 46; | ||||
@@ -56,23 +58,55 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public byte[] Retain { get; set; } = new byte[6]; | public byte[] Retain { get; set; } = new byte[6]; | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x8103_0xF366 value = new JT808_0x8103_0xF366(); | |||||
value.ParamId = reader.ReadUInt32(); | |||||
value.ParamLength = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数ID", value.ParamId); | |||||
writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]参数长度", value.ParamLength); | |||||
string tyreSpecificationTypeHex = reader.ReadVirtualArray(12).ToArray().ToHexString(); | |||||
value.TyreSpecificationType = reader.ReadString(12); | |||||
writer.WriteString($"[{tyreSpecificationTypeHex}]轮胎规格型号", value.TyreSpecificationType); | |||||
value.TyrePressureUnit = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.TyrePressureUnit.ReadNumber()}]胎压单位", value.TyrePressureUnit); | |||||
value.NormalFetalPressure = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.NormalFetalPressure.ReadNumber()}]正常胎压值", value.NormalFetalPressure); | |||||
value.ThresholdUnbalancedTirePressure = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.ThresholdUnbalancedTirePressure.ReadNumber()}]胎压不平衡门限", value.ThresholdUnbalancedTirePressure); | |||||
value.SlowLeakageThreshold = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.SlowLeakageThreshold.ReadNumber()}]慢漏气门限", value.SlowLeakageThreshold); | |||||
value.LowVoltageThreshold = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.LowVoltageThreshold.ReadNumber()}]低压阈值", value.LowVoltageThreshold); | |||||
value.HighVoltageThreshold = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.HighVoltageThreshold.ReadNumber()}]高压阈值", value.HighVoltageThreshold); | |||||
value.HighTemperatureThreshold = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.HighTemperatureThreshold.ReadNumber()}]高温阈值", value.HighTemperatureThreshold); | |||||
value.VoltageThreshold = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.VoltageThreshold.ReadNumber()}]电压阈值", value.VoltageThreshold); | |||||
value.TimedReportingInterval = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.TimedReportingInterval.ReadNumber()}]定时上报时间间隔", value.TimedReportingInterval); | |||||
value.Retain = reader.ReadArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||||
writer.WriteString("保留项", value.Retain.ToHexString()); | |||||
} | |||||
public JT808_0x8103_0xF366 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x8103_0xF366 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x8103_0xF366 jT808_0X8103_0XF366 = new JT808_0x8103_0xF366(); | |||||
jT808_0X8103_0XF366.ParamId = reader.ReadUInt32(); | |||||
jT808_0X8103_0XF366.ParamLength = reader.ReadByte(); | |||||
jT808_0X8103_0XF366.TyreSpecificationType = reader.ReadString(12); | |||||
jT808_0X8103_0XF366.TyrePressureUnit = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.NormalFetalPressure = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.ThresholdUnbalancedTirePressure = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.SlowLeakageThreshold = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.LowVoltageThreshold = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.HighVoltageThreshold = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.HighTemperatureThreshold = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.VoltageThreshold = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.TimedReportingInterval = reader.ReadUInt16(); | |||||
jT808_0X8103_0XF366.Retain = reader.ReadArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||||
return jT808_0X8103_0XF366; | |||||
JT808_0x8103_0xF366 value = new JT808_0x8103_0xF366(); | |||||
value.ParamId = reader.ReadUInt32(); | |||||
value.ParamLength = reader.ReadByte(); | |||||
value.TyreSpecificationType = reader.ReadString(12); | |||||
value.TyrePressureUnit = reader.ReadUInt16(); | |||||
value.NormalFetalPressure = reader.ReadUInt16(); | |||||
value.ThresholdUnbalancedTirePressure = reader.ReadUInt16(); | |||||
value.SlowLeakageThreshold = reader.ReadUInt16(); | |||||
value.LowVoltageThreshold = reader.ReadUInt16(); | |||||
value.HighVoltageThreshold = reader.ReadUInt16(); | |||||
value.HighTemperatureThreshold = reader.ReadUInt16(); | |||||
value.VoltageThreshold = reader.ReadUInt16(); | |||||
value.TimedReportingInterval = reader.ReadUInt16(); | |||||
value.Retain = reader.ReadArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0xF366 value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0xF366 value, IJT808Config config) | ||||
@@ -1,13 +1,15 @@ | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessageBody; | using JT808.Protocol.MessageBody; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 盲区监测系统参数 | /// 盲区监测系统参数 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8103_0xF367 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF367> | |||||
public class JT808_0x8103_0xF367 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF367>, IJT808Analyze | |||||
{ | { | ||||
public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF367; | public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF367; | ||||
public override byte ParamLength { get; set; } = 2; | public override byte ParamLength { get; set; } = 2; | ||||
@@ -20,14 +22,27 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public byte LateralRearApproachAlarmTimeThreshold { get; set; } | public byte LateralRearApproachAlarmTimeThreshold { get; set; } | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x8103_0xF367 value = new JT808_0x8103_0xF367(); | |||||
value.ParamId = reader.ReadUInt32(); | |||||
value.ParamLength = reader.ReadByte(); | |||||
writer.WriteNumber($"[{ value.ParamId.ReadNumber()}]参数ID", value.ParamId); | |||||
writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]参数长度", value.ParamLength); | |||||
value.RearApproachAlarmTimeThreshold = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.RearApproachAlarmTimeThreshold.ReadNumber()}]后方接近报警时间阈值", value.RearApproachAlarmTimeThreshold); | |||||
value.LateralRearApproachAlarmTimeThreshold = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.LateralRearApproachAlarmTimeThreshold.ReadNumber()}]侧后方接近报警时间阈值", value.LateralRearApproachAlarmTimeThreshold); | |||||
} | |||||
public JT808_0x8103_0xF367 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x8103_0xF367 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x8103_0xF367 jT808_0X8103_0XF367 = new JT808_0x8103_0xF367(); | |||||
jT808_0X8103_0XF367.ParamId = reader.ReadUInt32(); | |||||
jT808_0X8103_0XF367.ParamLength = reader.ReadByte(); | |||||
jT808_0X8103_0XF367.RearApproachAlarmTimeThreshold = reader.ReadByte(); | |||||
jT808_0X8103_0XF367.LateralRearApproachAlarmTimeThreshold = reader.ReadByte(); | |||||
return jT808_0X8103_0XF367; | |||||
JT808_0x8103_0xF367 value = new JT808_0x8103_0xF367(); | |||||
value.ParamId = reader.ReadUInt32(); | |||||
value.ParamLength = reader.ReadByte(); | |||||
value.RearApproachAlarmTimeThreshold = reader.ReadByte(); | |||||
value.LateralRearApproachAlarmTimeThreshold = reader.ReadByte(); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0xF367 value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0xF367 value, IJT808Config config) | ||||
@@ -1,14 +1,16 @@ | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessageBody; | using JT808.Protocol.MessageBody; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 查询基本信息 | /// 查询基本信息 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8900_0xF7 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF7> | |||||
public class JT808_0x8900_0xF7 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF7>, IJT808Analyze | |||||
{ | { | ||||
public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF7; | public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF7; | ||||
/// <summary> | /// <summary> | ||||
@@ -20,6 +22,25 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public List<byte> MultipleUSB { get; set; } | public List<byte> MultipleUSB { get; set; } | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x8900_0xF7 value = new JT808_0x8900_0xF7(); | |||||
value.USBCount = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.USBCount.ReadNumber()}]外设ID列表总数", value.USBCount); | |||||
if (value.USBCount > 0) | |||||
{ | |||||
writer.WriteStartArray("外设ID列表"); | |||||
for (int i = 0; i < value.USBCount; i++) | |||||
{ | |||||
writer.WriteStartObject(); | |||||
byte usbId = reader.ReadByte(); | |||||
writer.WriteNumber($"[{usbId.ReadNumber()}]外设ID", usbId); | |||||
writer.WriteEndObject(); | |||||
} | |||||
writer.WriteEndArray(); | |||||
} | |||||
} | |||||
public JT808_0x8900_0xF7 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x8900_0xF7 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x8900_0xF7 value = new JT808_0x8900_0xF7(); | JT808_0x8900_0xF7 value = new JT808_0x8900_0xF7(); | ||||
@@ -1,14 +1,16 @@ | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessageBody; | using JT808.Protocol.MessageBody; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 查询基本信息 | /// 查询基本信息 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8900_0xF8 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF8> | |||||
public class JT808_0x8900_0xF8 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF8>, IJT808Analyze | |||||
{ | { | ||||
public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF8; | public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF8; | ||||
/// <summary> | /// <summary> | ||||
@@ -20,6 +22,25 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public List<byte> MultipleUSB { get; set; } | public List<byte> MultipleUSB { get; set; } | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x8900_0xF8 value = new JT808_0x8900_0xF8(); | |||||
value.USBCount = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.USBCount.ReadNumber()}]外设ID列表总数", value.USBCount); | |||||
if (value.USBCount > 0) | |||||
{ | |||||
writer.WriteStartArray("外设ID列表"); | |||||
for (int i = 0; i < value.USBCount; i++) | |||||
{ | |||||
writer.WriteStartObject(); | |||||
byte usbId = reader.ReadByte(); | |||||
writer.WriteNumber($"[{usbId.ReadNumber()}]外设ID", usbId); | |||||
writer.WriteEndObject(); | |||||
} | |||||
writer.WriteEndArray(); | |||||
} | |||||
} | |||||
public JT808_0x8900_0xF8 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x8900_0xF8 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x8900_0xF8 value = new JT808_0x8900_0xF8(); | JT808_0x8900_0xF8 value = new JT808_0x8900_0xF8(); | ||||
@@ -1,14 +1,16 @@ | |||||
using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System; | using System; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 报警附件上传指令 | /// 报警附件上传指令 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x9208:JT808Bodies, IJT808MessagePackFormatter<JT808_0x9208> | |||||
public class JT808_0x9208: JT808Bodies, IJT808MessagePackFormatter<JT808_0x9208>, IJT808Analyze | |||||
{ | { | ||||
public override string Description => "报警附件上传指令"; | public override string Description => "报警附件上传指令"; | ||||
public byte AttachmentServerIPLength { get; set; } | public byte AttachmentServerIPLength { get; set; } | ||||
@@ -31,14 +33,45 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
public override ushort MsgId => 0x9208; | public override ushort MsgId => 0x9208; | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x9208 value = new JT808_0x9208(); | |||||
value.AttachmentServerIPLength = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.AttachmentServerIPLength.ReadNumber()}]服务IP地址长度", value.AttachmentServerIPLength); | |||||
string attachmentServerIPHex = reader.ReadVirtualArray(value.AttachmentServerIPLength).ToArray().ToHexString(); | |||||
value.AttachmentServerIP = reader.ReadString(value.AttachmentServerIPLength); | |||||
writer.WriteString($"[{AttachmentServerIP}]服务IP地址", value.AttachmentServerIP); | |||||
value.AttachmentServerIPTcpPort = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.AttachmentServerIPTcpPort.ReadNumber()}]TCP端口", value.AttachmentServerIPTcpPort); | |||||
value.AttachmentServerIPUdpPort = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{value.AttachmentServerIPUdpPort.ReadNumber()}]UDP端口", value.AttachmentServerIPUdpPort); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty(); | |||||
string terminalIDHex = reader.ReadVirtualArray(7).ToArray().ToHexString(); | |||||
value.AlarmIdentification.TerminalID = reader.ReadString(7); | |||||
value.AlarmIdentification.Time = reader.ReadDateTime6(); | |||||
value.AlarmIdentification.SN = reader.ReadByte(); | |||||
value.AlarmIdentification.AttachCount = reader.ReadByte(); | |||||
value.AlarmIdentification.Retain = reader.ReadByte(); | |||||
writer.WriteString($"[{terminalIDHex}]终端ID", value.AlarmIdentification.TerminalID); | |||||
writer.WriteString($"[{value.AlarmIdentification.Time.ToString("yyMMddHHmmss")}]日期时间", value.AlarmIdentification.Time.ToString("yyyy-MM-dd HH:mm:ss")); | |||||
writer.WriteNumber($"[{value.AlarmIdentification.SN.ReadNumber()}]序号", value.AlarmIdentification.SN); | |||||
writer.WriteNumber($"[{value.AlarmIdentification.AttachCount.ReadNumber()}]附件数量", value.AlarmIdentification.AttachCount); | |||||
writer.WriteNumber($"[{value.AlarmIdentification.Retain.ReadNumber()}]预留", value.AlarmIdentification.Retain); | |||||
string alarmIdHex = reader.ReadVirtualArray(32).ToArray().ToHexString(); | |||||
value.AlarmId = reader.ReadString(32); | |||||
writer.WriteString($"[{alarmIdHex}]平台给报警分配的唯一编号", value.AlarmId); | |||||
string retainHex = reader.ReadVirtualArray(16).ToArray().ToHexString(); | |||||
writer.WriteString($"预留", retainHex); | |||||
} | |||||
public JT808_0x9208 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x9208 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x9208 jT808_0X9208 = new JT808_0x9208(); | |||||
jT808_0X9208.AttachmentServerIPLength = reader.ReadByte(); | |||||
jT808_0X9208.AttachmentServerIP = reader.ReadString(jT808_0X9208.AttachmentServerIPLength); | |||||
jT808_0X9208.AttachmentServerIPTcpPort = reader.ReadUInt16(); | |||||
jT808_0X9208.AttachmentServerIPUdpPort = reader.ReadUInt16(); | |||||
jT808_0X9208.AlarmIdentification = new AlarmIdentificationProperty | |||||
JT808_0x9208 value = new JT808_0x9208(); | |||||
value.AttachmentServerIPLength = reader.ReadByte(); | |||||
value.AttachmentServerIP = reader.ReadString(value.AttachmentServerIPLength); | |||||
value.AttachmentServerIPTcpPort = reader.ReadUInt16(); | |||||
value.AttachmentServerIPUdpPort = reader.ReadUInt16(); | |||||
value.AlarmIdentification = new AlarmIdentificationProperty | |||||
{ | { | ||||
TerminalID = reader.ReadString(7), | TerminalID = reader.ReadString(7), | ||||
Time = reader.ReadDateTime6(), | Time = reader.ReadDateTime6(), | ||||
@@ -46,9 +79,9 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
AttachCount = reader.ReadByte(), | AttachCount = reader.ReadByte(), | ||||
Retain = reader.ReadByte() | Retain = reader.ReadByte() | ||||
}; | }; | ||||
jT808_0X9208.AlarmId = reader.ReadString(32); | |||||
jT808_0X9208.Retain = reader.ReadArray(16).ToArray(); | |||||
return jT808_0X9208; | |||||
value.AlarmId = reader.ReadString(32); | |||||
value.Retain = reader.ReadArray(16).ToArray(); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9208 value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9208 value, IJT808Config config) | ||||
@@ -1,14 +1,16 @@ | |||||
using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 文件上传完成消息应答 | /// 文件上传完成消息应答 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x9212:JT808Bodies, IJT808MessagePackFormatter<JT808_0x9212> | |||||
public class JT808_0x9212: JT808Bodies, IJT808MessagePackFormatter<JT808_0x9212>, IJT808Analyze | |||||
{ | { | ||||
public override string Description => "文件上传完成消息应答"; | public override string Description => "文件上传完成消息应答"; | ||||
/// <summary> | /// <summary> | ||||
@@ -39,26 +41,57 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
public override ushort MsgId => 0x9212; | public override ushort MsgId => 0x9212; | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
JT808_0x9212 value = new JT808_0x9212(); | |||||
value.FileNameLength = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.FileNameLength.ReadNumber()}]文件名称长度", value.FileNameLength); | |||||
string fileNameHex = reader.ReadVirtualArray(value.FileNameLength).ToArray().ToHexString(); | |||||
value.FileName = reader.ReadString(value.FileNameLength); | |||||
writer.WriteString($"[{fileNameHex}]文件名称", value.FileName); | |||||
value.FileType = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.FileType.ReadNumber()}]文件类型", value.FileType); | |||||
value.UploadResult = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.UploadResult.ReadNumber()}]上传结果", value.UploadResult); | |||||
value.DataPackageCount = reader.ReadByte(); | |||||
writer.WriteNumber($"[{value.DataPackageCount.ReadNumber()}]补传数据包数量", value.DataPackageCount); | |||||
if (value.DataPackageCount > 0) | |||||
{ | |||||
writer.WriteStartArray("补传数据包列表"); | |||||
for (int i = 0; i < value.DataPackageCount; i++) | |||||
{ | |||||
writer.WriteStartObject(); | |||||
DataPackageProperty dataPackageProperty = new DataPackageProperty(); | |||||
dataPackageProperty.Offset = reader.ReadUInt32(); | |||||
writer.WriteNumber($"[{dataPackageProperty.Offset.ReadNumber()}]数据偏移量", dataPackageProperty.Offset); | |||||
dataPackageProperty.Length = reader.ReadUInt32(); | |||||
writer.WriteNumber($"[{dataPackageProperty.Length.ReadNumber()}]数据长度", dataPackageProperty.Length); | |||||
writer.WriteEndObject(); | |||||
} | |||||
writer.WriteEndArray(); | |||||
} | |||||
} | |||||
public JT808_0x9212 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x9212 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x9212 jT808_0X9212 = new JT808_0x9212(); | |||||
jT808_0X9212.FileNameLength = reader.ReadByte(); | |||||
jT808_0X9212.FileName = reader.ReadString(jT808_0X9212.FileNameLength); | |||||
jT808_0X9212.FileType = reader.ReadByte(); | |||||
jT808_0X9212.UploadResult = reader.ReadByte(); | |||||
jT808_0X9212.DataPackageCount = reader.ReadByte(); | |||||
if (jT808_0X9212.DataPackageCount > 0) | |||||
JT808_0x9212 value = new JT808_0x9212(); | |||||
value.FileNameLength = reader.ReadByte(); | |||||
value.FileName = reader.ReadString(value.FileNameLength); | |||||
value.FileType = reader.ReadByte(); | |||||
value.UploadResult = reader.ReadByte(); | |||||
value.DataPackageCount = reader.ReadByte(); | |||||
if (value.DataPackageCount > 0) | |||||
{ | { | ||||
jT808_0X9212.DataPackages = new List<DataPackageProperty>(); | |||||
for (int i = 0; i < jT808_0X9212.DataPackageCount; i++) | |||||
value.DataPackages = new List<DataPackageProperty>(); | |||||
for (int i = 0; i < value.DataPackageCount; i++) | |||||
{ | { | ||||
DataPackageProperty dataPackageProperty = new DataPackageProperty(); | DataPackageProperty dataPackageProperty = new DataPackageProperty(); | ||||
dataPackageProperty.Offset = reader.ReadUInt32(); | dataPackageProperty.Offset = reader.ReadUInt32(); | ||||
dataPackageProperty.Length = reader.ReadUInt32(); | dataPackageProperty.Length = reader.ReadUInt32(); | ||||
jT808_0X9212.DataPackages.Add(dataPackageProperty); | |||||
value.DataPackages.Add(dataPackageProperty); | |||||
} | } | ||||
} | } | ||||
return jT808_0X9212; | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9212 value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9212 value, IJT808Config config) | ||||