@@ -304,6 +304,15 @@ JT808Serializer DT2JT808Serializer = new JT808Serializer(DT2JT808Config); | |||
[可以参考Simples的Demo11](https://github.com/SmallChi/JT808/blob/master/src/JT808.Protocol.Test/Simples/Demo11.cs) | |||
### 举个栗子12 | |||
场景: | |||
由于粤标的设备厂家自定义的附加信息长度可以为四4个字节的,所以需要兼容。 | |||
[可以参考Simples的Demo12](https://github.com/SmallChi/JT808/blob/master/src/JT808.Protocol.Test/Simples/Demo12.cs) | |||
>注意:只适用于已知的设备厂家协议才行 | |||
## NuGet安装 | |||
| Package Name| Version| Preview Version |Downloads|Remark| | |||
@@ -60,7 +60,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||
VehicleState = 19 | |||
}); | |||
var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); | |||
Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C00001807151010106420000000010C0605120A0B100F1100070000000D0000000E191211183100001334343434343434191210183100030200", hex); | |||
Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C0000180715101010642F000000010C0605120A0B100F1100070000000D0000000E191211183100001334343434343434191210183100030200", hex); | |||
} | |||
[Fact] | |||
public void Deserialize() | |||
@@ -55,12 +55,12 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||
VehicleState = 19 | |||
}); | |||
var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); | |||
Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C0000180715101010671A000000010C09081100070000000D0000000E191211183100001334343434343434191210183100030200", hex); | |||
Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C0000180715101010672A000000010C09081100070000000D0000000E191211183100001334343434343434191210183100030200", hex); | |||
} | |||
[Fact] | |||
public void Deserialize() | |||
{ | |||
var jT808UploadLocationRequest = JT808Serializer.Deserialize<JT808_0x0200>("000000010000000200BA7F0E07E4F11C0028003C0000180715101010671A000000010C09081100070000000D0000000E191211183100001334343434343434191210183100030200".ToHexBytes()); | |||
var jT808UploadLocationRequest = JT808Serializer.Deserialize<JT808_0x0200>("000000010000000200BA7F0E07E4F11C0028003C0000180715101010672A000000010C09081100070000000D0000000E191211183100001334343434343434191210183100030200".ToHexBytes()); | |||
jT808UploadLocationRequest.JT808LocationAttachData.TryGetValue(JT808_JTActiveSafety_Constants.JT808_0X0200_0x67, out var value); | |||
JT808_0x0200_0x67 jT808_0X0200_0X67 = value as JT808_0x0200_0x67; | |||
Assert.Equal(1u, jT808_0X0200_0X67.AlarmId); | |||
@@ -73,7 +73,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||
Assert.Equal(8, jT808_0X0200_0X67.AlarmLevel); | |||
Assert.Equal(9, jT808_0X0200_0X67.AlarmOrEventType); | |||
Assert.Equal(0x67, jT808_0X0200_0X67.AttachInfoId); | |||
Assert.Equal(26, jT808_0X0200_0X67.AttachInfoLength); | |||
Assert.Equal(42, jT808_0X0200_0X67.AttachInfoLength); | |||
Assert.Equal(12, jT808_0X0200_0X67.FlagState); | |||
Assert.Equal(13, jT808_0X0200_0X67.Latitude); | |||
Assert.Equal(14, jT808_0X0200_0X67.Longitude); | |||
@@ -22,7 +22,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
/// <summary> | |||
/// 高级驾驶辅助系统报警信息附加长度 | |||
/// </summary> | |||
public override byte AttachInfoLength { get; set; } = 32; | |||
public override byte AttachInfoLength { get; set; } | |||
/// <summary> | |||
/// 报警ID | |||
/// </summary> | |||
@@ -315,7 +315,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x64 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.Skip(1, out int AttachInfoLengthPosition); | |||
writer.WriteUInt32(value.AlarmId); | |||
writer.WriteByte(value.FlagState); | |||
writer.WriteByte(value.AlarmOrEventType); | |||
@@ -339,6 +339,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
writer.WriteByte(value.AlarmIdentification.SN); | |||
writer.WriteByte(value.AlarmIdentification.AttachCount); | |||
writer.WriteByte(value.AlarmIdentification.Retain); | |||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AttachInfoLengthPosition - 1), AttachInfoLengthPosition); | |||
} | |||
} | |||
} |
@@ -22,7 +22,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
/// <summary> | |||
/// 驾驶员状态监测系统报警信息长度 | |||
/// </summary> | |||
public override byte AttachInfoLength { get; set; } = 47; | |||
public override byte AttachInfoLength { get; set; } | |||
/// <summary> | |||
/// 报警ID | |||
/// </summary> | |||
@@ -264,7 +264,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x65 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.Skip(1, out int AttachInfoLengthPosition); | |||
writer.WriteUInt32(value.AlarmId); | |||
writer.WriteByte(value.FlagState); | |||
writer.WriteByte(value.AlarmOrEventType); | |||
@@ -290,6 +290,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
writer.WriteByte(value.AlarmIdentification.SN); | |||
writer.WriteByte(value.AlarmIdentification.AttachCount); | |||
writer.WriteByte(value.AlarmIdentification.Retain); | |||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AttachInfoLengthPosition - 1), AttachInfoLengthPosition); | |||
} | |||
} | |||
} |
@@ -22,7 +22,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
/// <summary> | |||
/// 盲区监测系统报警信息长度 | |||
/// </summary> | |||
public override byte AttachInfoLength { get; set; } = 26; | |||
public override byte AttachInfoLength { get; set; } | |||
/// <summary> | |||
/// 报警ID | |||
/// </summary> | |||
@@ -254,7 +254,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x67 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.Skip(1, out int AttachInfoLengthPosition); | |||
writer.WriteUInt32(value.AlarmId); | |||
writer.WriteByte(value.FlagState); | |||
writer.WriteByte(value.AlarmOrEventType); | |||
@@ -274,6 +274,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||
writer.WriteByte(value.AlarmIdentification.SN); | |||
writer.WriteByte(value.AlarmIdentification.AttachCount); | |||
writer.WriteByte(value.AlarmIdentification.Retain); | |||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AttachInfoLengthPosition - 1), AttachInfoLengthPosition); | |||
} | |||
} | |||
} |
@@ -0,0 +1,57 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT808.Protocol.Extensions.YueBiao.Enums | |||
{ | |||
/// <summary> | |||
/// 升级状态 | |||
/// </summary> | |||
public enum JT808UpgradeStatus:byte | |||
{ | |||
/// <summary> | |||
/// 固件下载中 | |||
/// </summary> | |||
固件下载中 = 0x01, | |||
/// <summary> | |||
/// 固件下载成功 | |||
/// </summary> | |||
固件下载成功 = 0x02, | |||
/// <summary> | |||
/// 固件下载失败 | |||
/// </summary> | |||
固件下载失败 = 0x03, | |||
/// <summary> | |||
/// 固件安装中 | |||
/// </summary> | |||
固件安装中 = 0x04, | |||
/// <summary> | |||
/// 安装成功 | |||
/// </summary> | |||
安装成功 = 0x05, | |||
/// <summary> | |||
/// 安装失败 | |||
/// </summary> | |||
安装失败 = 0x06, | |||
/// <summary> | |||
/// 未找到目标设备 | |||
/// </summary> | |||
未找到目标设备 = 0x07, | |||
/// <summary> | |||
/// 硬件型号不支持 | |||
/// </summary> | |||
硬件型号不支持 = 0x08, | |||
/// <summary> | |||
/// 软件版本相同 | |||
/// </summary> | |||
软件版本相同 = 0x09, | |||
/// <summary> | |||
/// 软件版本不支持 | |||
/// </summary> | |||
软件版本不支持 = 0x0a, | |||
/// <summary> | |||
/// 其他 | |||
/// </summary> | |||
其他 = 0x0b, | |||
} | |||
} |
@@ -29,5 +29,9 @@ namespace JT808.Protocol.Extensions.YueBiao.Enums | |||
/// 文件上传完成消息应答 | |||
/// </summary> | |||
文件上传完成消息应答 = 0x9212, | |||
/// <summary> | |||
/// 终端升级进度上报 | |||
/// </summary> | |||
终端升级进度上报 = 0x1FC4, | |||
} | |||
} |
@@ -46,6 +46,66 @@ | |||
不修改参数 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus"> | |||
<summary> | |||
升级状态 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.固件下载中"> | |||
<summary> | |||
固件下载中 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.固件下载成功"> | |||
<summary> | |||
固件下载成功 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.固件下载失败"> | |||
<summary> | |||
固件下载失败 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.固件安装中"> | |||
<summary> | |||
固件安装中 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.安装成功"> | |||
<summary> | |||
安装成功 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.安装失败"> | |||
<summary> | |||
安装失败 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.未找到目标设备"> | |||
<summary> | |||
未找到目标设备 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.硬件型号不支持"> | |||
<summary> | |||
硬件型号不支持 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.软件版本相同"> | |||
<summary> | |||
软件版本相同 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.软件版本不支持"> | |||
<summary> | |||
软件版本不支持 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808UpgradeStatus.其他"> | |||
<summary> | |||
其他 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.Extensions.YueBiao.Enums.JT808_YueBiao_MsgId"> | |||
<summary> | |||
主动安全消息Id | |||
@@ -76,6 +136,11 @@ | |||
文件上传完成消息应答 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.Enums.JT808_YueBiao_MsgId.终端升级进度上报"> | |||
<summary> | |||
终端升级进度上报 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.Extensions.YueBiao.Enums.PhotoResolutionType"> | |||
<summary> | |||
拍照分辨率 | |||
@@ -261,6 +326,12 @@ | |||
盲区监测系统参数设置 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.JT808_YueBiao_Constants.JT808_0X8103_0xF370"> | |||
<summary> | |||
智能视频协议版本信息 | |||
引入此智能视频协议版本信息方便平台进行版本控制初始版本是 1,每次修订版本号都会递增 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Extensions.YueBiao.JT808_YueBiao_Constants.JT808_0X0900_0xF7"> | |||
<summary> | |||
状态查询 | |||
@@ -971,6 +1042,72 @@ | |||
<param name="value"></param> | |||
<param name="config"></param> | |||
</member> | |||
<member name="T:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4"> | |||
<summary> | |||
终端升级进度上报 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.Description"> | |||
<summary> | |||
终端升级进度上报 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.MsgId"> | |||
<summary> | |||
终端升级进度上报 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.MsgNum"> | |||
<summary> | |||
流水号 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.UpgradeType"> | |||
<summary> | |||
升级类型 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.UpgradeStatus"> | |||
<summary> | |||
升级状态 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.UploadProgress"> | |||
<summary> | |||
升级进度 | |||
0-100 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.ErrorCode"> | |||
<summary> | |||
错误码 | |||
由厂家自定义 | |||
</summary> | |||
</member> | |||
<member name="M:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.Analyze(JT808.Protocol.MessagePack.JT808MessagePackReader@,System.Text.Json.Utf8JsonWriter,JT808.Protocol.IJT808Config)"> | |||
<summary> | |||
</summary> | |||
<param name="reader"></param> | |||
<param name="writer"></param> | |||
<param name="config"></param> | |||
</member> | |||
<member name="M:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.Deserialize(JT808.Protocol.MessagePack.JT808MessagePackReader@,JT808.Protocol.IJT808Config)"> | |||
<summary> | |||
</summary> | |||
<param name="reader"></param> | |||
<param name="config"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4.Serialize(JT808.Protocol.MessagePack.JT808MessagePackWriter@,JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x1FC4,JT808.Protocol.IJT808Config)"> | |||
<summary> | |||
</summary> | |||
<param name="writer"></param> | |||
<param name="value"></param> | |||
<param name="config"></param> | |||
</member> | |||
<member name="T:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF364"> | |||
<summary> | |||
高级驾驶辅助系统参数 | |||
@@ -1589,6 +1726,53 @@ | |||
<param name="value"></param> | |||
<param name="config"></param> | |||
</member> | |||
<member name="T:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370"> | |||
<summary> | |||
智能视频协议版本信息 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370.ParamId"> | |||
<summary> | |||
系统参数Id | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370.ParamLength"> | |||
<summary> | |||
参数长度 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370.SmartVideoProtocolVersion"> | |||
<summary> | |||
智能视频协议版本信息 | |||
引入此智能视频协议版本信息方便平台进行版本控制初始版本是 | |||
1,每次修订版本号都会递增* | |||
注:只支持获取,不支持设置 | |||
</summary> | |||
</member> | |||
<member name="M:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370.Analyze(JT808.Protocol.MessagePack.JT808MessagePackReader@,System.Text.Json.Utf8JsonWriter,JT808.Protocol.IJT808Config)"> | |||
<summary> | |||
</summary> | |||
<param name="reader"></param> | |||
<param name="writer"></param> | |||
<param name="config"></param> | |||
</member> | |||
<member name="M:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370.Deserialize(JT808.Protocol.MessagePack.JT808MessagePackReader@,JT808.Protocol.IJT808Config)"> | |||
<summary> | |||
</summary> | |||
<param name="reader"></param> | |||
<param name="config"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370.Serialize(JT808.Protocol.MessagePack.JT808MessagePackWriter@,JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8103_0xF370,JT808.Protocol.IJT808Config)"> | |||
<summary> | |||
</summary> | |||
<param name="writer"></param> | |||
<param name="value"></param> | |||
<param name="config"></param> | |||
</member> | |||
<member name="T:JT808.Protocol.Extensions.YueBiao.MessageBody.JT808_0x8900_0xF7"> | |||
<summary> | |||
状态查询 | |||
@@ -42,6 +42,11 @@ namespace JT808.Protocol.Extensions.YueBiao | |||
/// </summary> | |||
public const uint JT808_0X8103_0xF367 = 0xF367; | |||
/// <summary> | |||
/// 智能视频协议版本信息 | |||
/// 引入此智能视频协议版本信息方便平台进行版本控制初始版本是 1,每次修订版本号都会递增 | |||
/// </summary> | |||
public const uint JT808_0X8103_0xF370 = 0xF370; | |||
/// <summary> | |||
/// 状态查询 | |||
/// </summary> | |||
public const byte JT808_0X0900_0xF7 = 0xF7; | |||
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 高级驾驶辅助系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x64 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x64>, IJT808Analyze | |||
public class JT808_0x0200_0x64 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x64>, IJT808Analyze,IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 高级驾驶辅助系统报警信息Id | |||
@@ -22,7 +22,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 高级驾驶辅助系统报警信息附加长度 | |||
/// </summary> | |||
public override byte AttachInfoLength { get; set; } = 32; | |||
public override byte AttachInfoLength { get; set; } = 73; | |||
/// <summary> | |||
/// 报警ID | |||
/// </summary> | |||
@@ -322,7 +322,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x64 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.Skip(1, out int AttachInfoLengthPosition); | |||
writer.WriteUInt32(value.AlarmId); | |||
writer.WriteByte(value.FlagState); | |||
writer.WriteByte(value.AlarmOrEventType); | |||
@@ -347,6 +347,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
writer.WriteByte(value.AlarmIdentification.AttachCount); | |||
writer.WriteByte(value.AlarmIdentification.Retain1); | |||
writer.WriteByte(value.AlarmIdentification.Retain2); | |||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AttachInfoLengthPosition - 1), AttachInfoLengthPosition); | |||
} | |||
} | |||
} |
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 驾驶员状态监测系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x65 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x65>, IJT808Analyze | |||
public class JT808_0x0200_0x65 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x65>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 驾驶员状态监测系统报警信息Id | |||
@@ -283,7 +283,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x65 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.Skip(1, out int AttachInfoLengthPosition); | |||
writer.WriteUInt32(value.AlarmId); | |||
writer.WriteByte(value.FlagState); | |||
writer.WriteByte(value.AlarmOrEventType); | |||
@@ -310,6 +310,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
writer.WriteByte(value.AlarmIdentification.AttachCount); | |||
writer.WriteByte(value.AlarmIdentification.Retain1); | |||
writer.WriteByte(value.AlarmIdentification.Retain2); | |||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AttachInfoLengthPosition - 1), AttachInfoLengthPosition); | |||
} | |||
} | |||
} |
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 胎压监测系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x66 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x66>, IJT808Analyze | |||
public class JT808_0x0200_0x66 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x66>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 胎压监测系统报警信息Id | |||
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 盲区监测系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x67 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x67>, IJT808Analyze | |||
public class JT808_0x0200_0x67 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x67>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 盲区监测系统报警信息Id | |||
@@ -257,7 +257,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x67 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.Skip(1, out int AttachInfoLengthPosition); | |||
writer.WriteUInt32(value.AlarmId); | |||
writer.WriteByte(value.FlagState); | |||
writer.WriteByte(value.AlarmOrEventType); | |||
@@ -278,6 +278,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
writer.WriteByte(value.AlarmIdentification.AttachCount); | |||
writer.WriteByte(value.AlarmIdentification.Retain1); | |||
writer.WriteByte(value.AlarmIdentification.Retain2); | |||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - AttachInfoLengthPosition - 1), AttachInfoLengthPosition); | |||
} | |||
} | |||
} |
@@ -14,7 +14,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 透传数据 | |||
/// </summary> | |||
public class JT808_0x0900_0xF7 : JT808_0x0900_BodyBase, IJT808MessagePackFormatter<JT808_0x0900_0xF7>, IJT808Analyze | |||
public class JT808_0x0900_0xF7 : JT808_0x0900_BodyBase, IJT808MessagePackFormatter<JT808_0x0900_0xF7>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 透传类型 | |||
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 透传数据 | |||
/// </summary> | |||
public class JT808_0x0900_0xF8 : JT808_0x0900_BodyBase, IJT808MessagePackFormatter<JT808_0x0900_0xF8>, IJT808Analyze | |||
public class JT808_0x0900_0xF8 : JT808_0x0900_BodyBase, IJT808MessagePackFormatter<JT808_0x0900_0xF8>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 透传类型 | |||
@@ -8,7 +8,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 文件信息上传 | |||
/// </summary> | |||
public class JT808_0x1211 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1211>, IJT808Analyze | |||
public class JT808_0x1211 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1211>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 文件信息上传 | |||
@@ -8,7 +8,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 文件上传完成消息 | |||
/// </summary> | |||
public class JT808_0x1212 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1212>, IJT808Analyze | |||
public class JT808_0x1212 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1212>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 文件上传完成消息 | |||
@@ -0,0 +1,99 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions.YueBiao.Enums; | |||
using JT808.Protocol.Extensions.YueBiao.Metadata; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System.Collections.Generic; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
{ | |||
/// <summary> | |||
/// 终端升级进度上报 | |||
/// </summary> | |||
public class JT808_0x1FC4 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x1FC4>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 终端升级进度上报 | |||
/// </summary> | |||
public override string Description => "终端升级进度上报"; | |||
/// <summary> | |||
/// 终端升级进度上报 | |||
/// </summary> | |||
public override ushort MsgId => JT808_YueBiao_MsgId.终端升级进度上报.ToUInt16Value(); | |||
/// <summary> | |||
/// 流水号 | |||
/// </summary> | |||
public ushort MsgNum { get; set; } | |||
/// <summary> | |||
/// 升级类型 | |||
/// </summary> | |||
public JT808UpgradeType UpgradeType { get; set; } | |||
/// <summary> | |||
/// 升级状态 | |||
/// </summary> | |||
public JT808UpgradeStatus UpgradeStatus { get; set; } | |||
/// <summary> | |||
/// 升级进度 | |||
/// 0-100 | |||
/// </summary> | |||
public byte UploadProgress { get; set; } | |||
/// <summary> | |||
/// 错误码 | |||
/// 由厂家自定义 | |||
/// </summary> | |||
public byte ErrorCode { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="reader"></param> | |||
/// <param name="writer"></param> | |||
/// <param name="config"></param> | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x1FC4 value = new JT808_0x1FC4(); | |||
value.MsgNum = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{value.MsgNum.ReadNumber()}]流水号", value.MsgNum); | |||
value.UpgradeType = (JT808UpgradeType)reader.ReadByte(); | |||
writer.WriteString($"[{value.UpgradeType.ToByteValue().ReadNumber()}]升级类型", value.UpgradeType.ToString()); | |||
value.UpgradeStatus = (JT808UpgradeStatus)reader.ReadByte(); | |||
writer.WriteString($"[{value.UpgradeStatus.ToByteValue().ReadNumber()}]升级状态", value.UpgradeStatus.ToString()); | |||
value.UploadProgress = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.UploadProgress.ReadNumber()}]升级进度", UploadProgress); | |||
value.ErrorCode = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.ErrorCode.ReadNumber()}]错误码", ErrorCode); | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="reader"></param> | |||
/// <param name="config"></param> | |||
/// <returns></returns> | |||
public JT808_0x1FC4 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x1FC4 value = new JT808_0x1FC4(); | |||
value.MsgNum = reader.ReadUInt16(); | |||
value.UpgradeType = (JT808UpgradeType)reader.ReadByte(); | |||
value.UpgradeStatus = (JT808UpgradeStatus)reader.ReadByte(); | |||
value.UploadProgress = reader.ReadByte(); | |||
value.ErrorCode = reader.ReadByte(); | |||
return value; | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="writer"></param> | |||
/// <param name="value"></param> | |||
/// <param name="config"></param> | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1FC4 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
writer.WriteByte(value.UpgradeType.ToByteValue()); | |||
writer.WriteByte(value.UpgradeStatus.ToByteValue()); | |||
writer.WriteByte(value.UploadProgress); | |||
writer.WriteByte(value.ErrorCode); | |||
} | |||
} | |||
} |
@@ -11,7 +11,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 高级驾驶辅助系统参数 | |||
/// </summary> | |||
public class JT808_0x8103_0xF364 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF364>, IJT808Analyze | |||
public class JT808_0x8103_0xF364 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF364>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 高级驾驶辅助系统参数 | |||
@@ -11,7 +11,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 驾驶员状态监测系统参数 | |||
/// </summary> | |||
public class JT808_0x8103_0xF365 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF365>, IJT808Analyze | |||
public class JT808_0x8103_0xF365 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF365>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 驾驶员状态监测系统参数 | |||
@@ -9,7 +9,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 胎压监测系统参数 | |||
/// </summary> | |||
public class JT808_0x8103_0xF366 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF366>, IJT808Analyze | |||
public class JT808_0x8103_0xF366 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF366>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 胎压监测系统参数Id | |||
@@ -9,7 +9,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 盲区监测系统参数 | |||
/// </summary> | |||
public class JT808_0x8103_0xF367 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF367>, IJT808Analyze | |||
public class JT808_0x8103_0xF367 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF367>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 盲区监测系统参数Id | |||
@@ -0,0 +1,72 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
{ | |||
/// <summary> | |||
/// 智能视频协议版本信息 | |||
/// </summary> | |||
public class JT808_0x8103_0xF370 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF370>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 系统参数Id | |||
/// </summary> | |||
public override uint ParamId { get; set; } = JT808_YueBiao_Constants.JT808_0X8103_0xF370; | |||
/// <summary> | |||
/// 参数长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 1; | |||
/// <summary> | |||
/// 智能视频协议版本信息 | |||
/// 引入此智能视频协议版本信息方便平台进行版本控制初始版本是 | |||
/// 1,每次修订版本号都会递增* | |||
/// 注:只支持获取,不支持设置 | |||
/// </summary> | |||
public byte SmartVideoProtocolVersion { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="reader"></param> | |||
/// <param name="writer"></param> | |||
/// <param name="config"></param> | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x8103_0xF370 value = new JT808_0x8103_0xF370(); | |||
value.ParamId = reader.ReadUInt32(); | |||
value.ParamLength = reader.ReadByte(); | |||
writer.WriteNumber($"[{ value.ParamId.ReadNumber()}]参数ID", value.ParamId); | |||
writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]参数长度", value.ParamLength); | |||
value.SmartVideoProtocolVersion = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.SmartVideoProtocolVersion.ReadNumber()}]智能视频协议版本信息", value.SmartVideoProtocolVersion); | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="reader"></param> | |||
/// <param name="config"></param> | |||
/// <returns></returns> | |||
public JT808_0x8103_0xF370 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0xF370 value = new JT808_0x8103_0xF370(); | |||
value.ParamId = reader.ReadUInt32(); | |||
value.ParamLength = reader.ReadByte(); | |||
value.SmartVideoProtocolVersion = reader.ReadByte(); | |||
return value; | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="writer"></param> | |||
/// <param name="value"></param> | |||
/// <param name="config"></param> | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0xF370 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteByte(value.SmartVideoProtocolVersion); | |||
} | |||
} | |||
} |
@@ -10,7 +10,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 状态查询 | |||
/// </summary> | |||
public class JT808_0x8900_0xF7 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF7>, IJT808Analyze | |||
public class JT808_0x8900_0xF7 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF7>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 查询基本信息类型 | |||
@@ -10,7 +10,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 信息查询 | |||
/// </summary> | |||
public class JT808_0x8900_0xF8 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF8>, IJT808Analyze | |||
public class JT808_0x8900_0xF8 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF8>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 查询基本信息透传类型 | |||
@@ -10,7 +10,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 报警附件上传指令 | |||
/// </summary> | |||
public class JT808_0x9208: JT808Bodies, IJT808MessagePackFormatter<JT808_0x9208>, IJT808Analyze | |||
public class JT808_0x9208: JT808Bodies, IJT808MessagePackFormatter<JT808_0x9208>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// Description | |||
@@ -10,7 +10,7 @@ namespace JT808.Protocol.Extensions.YueBiao.MessageBody | |||
/// <summary> | |||
/// 文件上传完成消息应答 | |||
/// </summary> | |||
public class JT808_0x9212: JT808Bodies, IJT808MessagePackFormatter<JT808_0x9212>, IJT808Analyze | |||
public class JT808_0x9212: JT808Bodies, IJT808MessagePackFormatter<JT808_0x9212>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
/// <summary> | |||
/// 文件上传完成消息应答 | |||
@@ -33,7 +33,8 @@ | |||
<Compile Include="Extensions\JT808HexExtensionsTest.cs" /> | |||
<Compile Include="Extensions\JT808PackageExtensionsTest.cs" /> | |||
<Compile Include="Extensions\JT808ValidationExtensionsTest.cs" /> | |||
<Compile Include="MessageBody\JT808LocationAttachExtensions\JT808LocationAttachImpl0x06.cs" /> | |||
<Compile Include="MessageBody\JT808LocationAttachExtensions\JT808LocationAttachImpl0x62.cs" /> | |||
<Compile Include="MessageBody\JT808LocationAttachExtensions\JT808LocationAttachImpl0x61.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0001Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0002Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0003Test.cs" /> | |||
@@ -0,0 +1,34 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Test.JT808LocationAttach | |||
{ | |||
/// <summary> | |||
/// 自定义附加信息 | |||
/// data-byte[]-256 | |||
/// </summary> | |||
public class JT808LocationAttachImpl0x62 : JT808_0x0200_CustomBodyBase, IJT808MessagePackFormatter<JT808LocationAttachImpl0x62> | |||
{ | |||
public override byte AttachInfoId { get; set; } = 0x62; | |||
public override uint AttachInfoLengthExtend { get; set; } = 256; | |||
public override byte AttachInfoLength { get; set; } | |||
public byte[] Data { get; set; } | |||
public JT808LocationAttachImpl0x62 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808LocationAttachImpl0x62 jT808LocationAttachImpl0x62 = new JT808LocationAttachImpl0x62(); | |||
jT808LocationAttachImpl0x62.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x62.AttachInfoLengthExtend = reader.ReadUInt32(); | |||
jT808LocationAttachImpl0x62.Data = reader.ReadArray((int)jT808LocationAttachImpl0x62.AttachInfoLengthExtend).ToArray(); | |||
return jT808LocationAttachImpl0x62; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808LocationAttachImpl0x62 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteUInt32((uint)value.Data.Length); | |||
writer.WriteArray(value.Data); | |||
} | |||
} | |||
} |
@@ -0,0 +1,96 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.Internal; | |||
using JT808.Protocol.Extensions; | |||
using Microsoft.Extensions.DependencyInjection; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using Xunit; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.MessagePack; | |||
using System.Text.Json; | |||
using JT808.Protocol.MessageBody.CarDVR; | |||
using System.Linq; | |||
using JT808.Protocol.Test.JT808LocationAttach; | |||
namespace JT808.Protocol.Test.Simples | |||
{ | |||
public class Demo12 | |||
{ | |||
JT808Serializer JT808Serializer; | |||
public Demo12() | |||
{ | |||
IJT808Config jT808Config = new DefaultGlobalConfig(); | |||
jT808Config.JT808_0X0200_Custom_Factory.SetMap<JT808LocationAttachImpl0x62>(); | |||
JT808Serializer = new JT808Serializer(jT808Config); | |||
} | |||
[Fact] | |||
public void Test1() | |||
{ | |||
JT808Package jT808Package = new JT808Package(); | |||
jT808Package.Header = new JT808Header | |||
{ | |||
MsgId = Enums.JT808MsgId.位置信息汇报.ToUInt16Value(), | |||
ManualMsgNum = 1, | |||
TerminalPhoneNo = "1122334455", | |||
}; | |||
JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200 | |||
{ | |||
AlarmFlag = 1, | |||
Altitude = 40, | |||
GPSTime = DateTime.Parse("2021-05-31 18:17:10"), | |||
Lat = 12222222, | |||
Lng = 132444444, | |||
Speed = 60, | |||
Direction = 0, | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>(), | |||
JT808CustomLocationAttachData = new Dictionary<byte, JT808_0x0200_CustomBodyBase>() | |||
}; | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
jT808UploadLocationRequest.JT808CustomLocationAttachData.Add(0x62, new JT808LocationAttachImpl0x62 | |||
{ | |||
Data=new byte[256] | |||
}); | |||
jT808Package.Bodies = jT808UploadLocationRequest; | |||
var hex = JT808Serializer.Serialize(jT808Package).ToHexString(); | |||
Assert.Equal("7E0200012B0011223344550001000000010000000200BA7F0E07E4F11C0028003C000021053118171001040000006402020037620000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000D57E", hex); | |||
} | |||
[Fact] | |||
public void Test2() | |||
{ | |||
byte[] bytes = "7E0200012B0011223344550001000000010000000200BA7F0E07E4F11C0028003C000021053118171001040000006402020037620000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000D57E".ToHexBytes(); | |||
var jT808Package = JT808Serializer.Deserialize<JT808Package>(bytes); | |||
Assert.Equal(Enums.JT808MsgId.位置信息汇报.ToValue(), jT808Package.Header.MsgId); | |||
Assert.Equal(1u, jT808Package.Header.MsgNum); | |||
Assert.Equal("1122334455", jT808Package.Header.TerminalPhoneNo); | |||
JT808_0x0200 jT808UploadLocationRequest = (JT808_0x0200)jT808Package.Bodies; | |||
Assert.Equal(1u, jT808UploadLocationRequest.AlarmFlag); | |||
Assert.Equal(40u, jT808UploadLocationRequest.Altitude); | |||
Assert.Equal(DateTime.Parse("2021-05-31 18:17:10"), jT808UploadLocationRequest.GPSTime); | |||
Assert.Equal(12222222, jT808UploadLocationRequest.Lat); | |||
Assert.Equal(132444444, jT808UploadLocationRequest.Lng); | |||
Assert.Equal(60, jT808UploadLocationRequest.Speed); | |||
Assert.Equal(2u, jT808UploadLocationRequest.StatusFlag); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
var jT808LocationAttachImpl0X62 = (JT808LocationAttachImpl0x62)jT808UploadLocationRequest.JT808CustomLocationAttachData[0x62]; | |||
Assert.Equal(0x62, jT808LocationAttachImpl0X62.AttachInfoId); | |||
Assert.Equal(new byte[256], jT808LocationAttachImpl0X62.Data); | |||
Assert.Equal(256u, jT808LocationAttachImpl0X62.AttachInfoLengthExtend); | |||
Assert.Equal(0, jT808LocationAttachImpl0X62.AttachInfoLength); | |||
} | |||
} | |||
} |
@@ -8,14 +8,30 @@ | |||
/// <summary> | |||
/// 成功 | |||
/// </summary> | |||
成功 = 0, | |||
成功 = 0x00, | |||
/// <summary> | |||
/// 失败 | |||
/// </summary> | |||
失败 = 1, | |||
失败 = 0x01, | |||
/// <summary> | |||
/// 取消 | |||
/// </summary> | |||
取消 = 2, | |||
取消 = 0x02, | |||
/// <summary> | |||
/// 粤标主动安全-未找到目标设备 | |||
/// </summary> | |||
未找到目标设备 = 0x10, | |||
/// <summary> | |||
/// 粤标主动安全-硬件型号不支持 | |||
/// </summary> | |||
硬件型号不支持 = 0x11, | |||
/// <summary> | |||
/// 粤标主动安全-软件版本相同 | |||
/// </summary> | |||
软件版本相同 = 0x12, | |||
/// <summary> | |||
/// 粤标主动安全-软件版本不支持 | |||
/// </summary> | |||
软件版本不支持 = 0x13 | |||
} | |||
} |
@@ -12,10 +12,26 @@ | |||
/// <summary> | |||
/// 道路运输证IC卡读卡器 | |||
/// </summary> | |||
道路运输证IC卡读卡器 = 12, | |||
道路运输证IC卡读卡器 = 0x0C, | |||
/// <summary> | |||
/// 北斗卫星定位模块 | |||
/// </summary> | |||
北斗卫星定位模块 = 52, | |||
北斗卫星定位模块 = 0x34, | |||
/// <summary> | |||
/// 粤标主动安全-高级驾驶辅助系统 | |||
/// </summary> | |||
高级驾驶辅助系统 = 0x64, | |||
/// <summary> | |||
/// 粤标主动安全-驾驶状态监控系统 | |||
/// </summary> | |||
驾驶状态监控系统 = 0x65, | |||
/// <summary> | |||
/// 粤标主动安全-胎压监测系统 | |||
/// </summary> | |||
胎压监测系统 = 0x66, | |||
/// <summary> | |||
/// 粤标主动安全-盲点监测系统 | |||
/// </summary> | |||
盲点监测系统 = 0x67, | |||
} | |||
} |
@@ -1531,6 +1531,26 @@ | |||
取消 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeResult.未找到目标设备"> | |||
<summary> | |||
粤标主动安全-未找到目标设备 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeResult.硬件型号不支持"> | |||
<summary> | |||
粤标主动安全-硬件型号不支持 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeResult.软件版本相同"> | |||
<summary> | |||
粤标主动安全-软件版本相同 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeResult.软件版本不支持"> | |||
<summary> | |||
粤标主动安全-软件版本不支持 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.Enums.JT808UpgradeType"> | |||
<summary> | |||
升级类型 | |||
@@ -1551,6 +1571,26 @@ | |||
北斗卫星定位模块 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeType.高级驾驶辅助系统"> | |||
<summary> | |||
粤标主动安全-高级驾驶辅助系统 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeType.驾驶状态监控系统"> | |||
<summary> | |||
粤标主动安全-驾驶状态监控系统 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeType.胎压监测系统"> | |||
<summary> | |||
粤标主动安全-胎压监测系统 | |||
</summary> | |||
</member> | |||
<member name="F:JT808.Protocol.Enums.JT808UpgradeType.盲点监测系统"> | |||
<summary> | |||
粤标主动安全-盲点监测系统 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.Enums.JT808Version"> | |||
<summary> | |||
JT808版本号 | |||
@@ -9726,13 +9766,6 @@ | |||
附加信息长度 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x0200_BodyBase.AttachInfoLengthExtend"> | |||
<summary> | |||
附加信息长度扩展 | |||
4个字节 | |||
注意:只适用于已知的协议才行 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x0200_CustomBodyBase"> | |||
<summary> | |||
自定义位置附加信息 | |||
@@ -9748,6 +9781,13 @@ | |||
自定义附加信息长度 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x0200_CustomBodyBase.AttachInfoLengthExtend"> | |||
<summary> | |||
附加信息长度扩展 | |||
4个字节 | |||
注意:只适用于已知的协议才行 | |||
</summary> | |||
</member> | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x0201"> | |||
<summary> | |||
位置信息查询应答 | |||
@@ -15169,6 +15209,7 @@ | |||
<member name="T:JT808.Protocol.MessageBody.JT808_0x8105"> | |||
<summary> | |||
终端控制 | |||
todo:重搞终端控制,加入自定义扩展 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8105.MsgId"> | |||
@@ -15295,7 +15336,7 @@ | |||
<summary> | |||
连接到指定服务器时限 | |||
单位:分(min),值非 0 后的有效期截止前,终端应连回原地址。 | |||
若值为 0,则表示一直连接指 定服务器 | |||
若值为 0,则表示一直连接指 定服务器 | |||
</summary> | |||
</member> | |||
<member name="M:JT808.Protocol.MessageBody.JT808_0x8105.CommandParams.ToString"> | |||
@@ -16895,6 +16936,7 @@ | |||
<summary> | |||
保存标志 | |||
1:保存;0:实时上传 | |||
仅主机拍照时有效 | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.MessageBody.JT808_0x8801.Resolution"> | |||
@@ -17,11 +17,5 @@ namespace JT808.Protocol.MessageBody | |||
/// 附加信息长度 | |||
/// </summary> | |||
public abstract byte AttachInfoLength { get; set; } | |||
/// <summary> | |||
/// 附加信息长度扩展 | |||
/// 4个字节 | |||
/// 注意:只适用于已知的协议才行 | |||
/// </summary> | |||
public virtual uint AttachInfoLengthExtend { get; set; } | |||
} | |||
} |
@@ -16,5 +16,11 @@ namespace JT808.Protocol.MessageBody | |||
/// 自定义附加信息长度 | |||
/// </summary> | |||
public abstract byte AttachInfoLength { get; set; } | |||
/// <summary> | |||
/// 附加信息长度扩展 | |||
/// 4个字节 | |||
/// 注意:只适用于已知的协议才行 | |||
/// </summary> | |||
public virtual uint AttachInfoLengthExtend { get; set; } | |||
} | |||
} |
@@ -3,12 +3,14 @@ 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 | |||
{ | |||
/// <summary> | |||
/// 终端控制 | |||
/// todo:重搞终端控制,加入自定义扩展 | |||
/// </summary> | |||
public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8105>, IJT808Analyze, IJT808_2019_Version | |||
{ | |||
@@ -270,9 +272,12 @@ namespace JT808.Protocol.MessageBody | |||
/// <summary> | |||
/// 连接到指定服务器时限 | |||
/// 单位:分(min),值非 0 后的有效期截止前,终端应连回原地址。 | |||
/// 若值为 0,则表示一直连接指 定服务器 | |||
/// 若值为 0,则表示一直连接指 定服务器 | |||
/// </summary> | |||
public ushort? ConnectTimeLimit { get; set; } | |||
public List<object> Ext { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
@@ -38,6 +38,7 @@ namespace JT808.Protocol.MessageBody | |||
/// <summary> | |||
/// 保存标志 | |||
/// 1:保存;0:实时上传 | |||
/// 仅主机拍照时有效 | |||
/// </summary> | |||
public byte SaveFlag { get; set; } | |||
/// <summary> | |||