diff --git a/src/JT809.Protocol/Enums/JT809SubBusinessType.cs b/src/JT809.Protocol/Enums/JT809SubBusinessType.cs index bf09830..c7d4ea5 100644 --- a/src/JT809.Protocol/Enums/JT809SubBusinessType.cs +++ b/src/JT809.Protocol/Enums/JT809SubBusinessType.cs @@ -116,10 +116,19 @@ namespace JT809.Protocol.Enums [JT809SubBusinessTypeDescription("UP_EXG_MSG_DRVLINE_INFO", "主动上报车辆行驶路线信息", JT809BusinessType.主链路车辆动态信息交换业务)] 主动上报车辆行驶路线信息 = 0x120E, - + #endregion #region 从链路动态信息交换消息 DOWN_EXG_MSG + /// + ///车辆注册信息应答消息 + ///DOWN_EXG_MSG_REGISTER_ACK + /// + [Description("车辆注册信息应答消息")] + [JT809BodiesType(typeof(JT809_0x9200_0x9201))] + [JT809SubBusinessTypeDescription("DOWN_EXG_MSG_REGISTER_ACK", "车辆注册信息应答消息", JT809BusinessType.从链路车辆动态信息交换业务)] + 车辆注册信息应答消息 = 0x9201, + /// ///交换车辆定位信息 ///DOWN_EXG_MSG_CAR_LOCATION @@ -168,13 +177,13 @@ namespace JT809.Protocol.Enums [JT809SubBusinessTypeDescription("DOWN_EXG_MSG_APPLY_FOR_MONITOR_STARTUP_ACK", "申请交换指定车辆定位信息应答", JT809BusinessType.从链路车辆动态信息交换业务)] 申请交换指定车辆定位信息应答 = 0x9207, /// - ///取消交换指定车辆定位信息应答 + ///取消交换指定车辆定位信息应答or取消申请交换指定车辆定位信息应答消息 ///DOWN_EXG_MSG_APPLY_FOR_MONITOR_END_ACK /// - [Description("取消交换指定车辆定位信息应答")] + [Description("取消交换指定车辆定位信息应答or取消申请交换指定车辆定位信息应答消息")] [JT809BodiesType(typeof(JT809_0x9200_0x9208))] [JT809SubBusinessTypeDescription("DOWN_EXG_MSG_APPLY_FOR_MONITOR_END_ACK", "取消交换指定车辆定位信息应答", JT809BusinessType.从链路车辆动态信息交换业务)] - 取消交换指定车辆定位信息应答 = 0x9208, + 取消交换指定车辆定位信息应答or取消申请交换指定车辆定位信息应答消息 = 0x9208, /// ///补发车辆定位信息应答 ///DOWN_EXG_MSG_APPLY_HISGNSSDATA_ACK diff --git a/src/JT809.Protocol/Enums/JT809_0x9201_Result.cs b/src/JT809.Protocol/Enums/JT809_0x9201_Result.cs new file mode 100644 index 0000000..9d87073 --- /dev/null +++ b/src/JT809.Protocol/Enums/JT809_0x9201_Result.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT809.Protocol.Enums +{ + /// + /// 处理结果 + /// + public enum JT809_0x9201_Result : byte + { + 完成注册_加注释=0x00, + 审核通过_完成注册= 0x01, + 信息错误_未完成注册= 0x02, + 审核没通过_未完成注册= 0x03 + } +} diff --git a/src/JT809.Protocol/JT809.Protocol.csproj b/src/JT809.Protocol/JT809.Protocol.csproj index b9c1f55..9f90829 100644 --- a/src/JT809.Protocol/JT809.Protocol.csproj +++ b/src/JT809.Protocol/JT809.Protocol.csproj @@ -78,6 +78,7 @@ + diff --git a/src/JT809.Protocol/Metadata/JT809VehiclePositionProperties_2019.cs b/src/JT809.Protocol/Metadata/JT809VehiclePositionProperties_2019.cs index f2ee1d7..5b9ab7c 100644 --- a/src/JT809.Protocol/Metadata/JT809VehiclePositionProperties_2019.cs +++ b/src/JT809.Protocol/Metadata/JT809VehiclePositionProperties_2019.cs @@ -1,4 +1,5 @@ -using System; +using JT809.Protocol.Enums; +using System; using System.Collections.Generic; using System.Text; @@ -9,7 +10,7 @@ namespace JT809.Protocol.Metadata /// /// 是否使用国测局批准的地图保密插件进行加密 1 已加密 0未加密 /// - public byte Encrypt { get; set; } + public JT809_VehiclePositionEncrypt Encrypt { get; set; } /// /// 车辆定位信息数据长度 /// @@ -22,7 +23,7 @@ namespace JT809.Protocol.Metadata /// /// 监控平台唯一编码,由平台所在地行政区域代码和平台编码组成 /// - public byte[] PlatformId1 { get; set; } + public byte[] PlatformId1 { get; set; } = new byte[11]; /// /// 报警状态,二进制标识 0 正常 1表示报警 /// 具体定义按照808-2019中表18的规定 @@ -32,7 +33,7 @@ namespace JT809.Protocol.Metadata /// 市级监控平台唯一编码,由平台所在地行政区域代码和平台编码组成 /// 未填写时,全填0,无市级平台应由省级平台全填1 /// - public byte[] PlatformId2 { get; set; } + public byte[] PlatformId2 { get; set; } = new byte[11]; /// /// 报警状态,二进制标识 0 正常 1表示报警 /// 具体定义按照808-2019中表18的规定 @@ -42,7 +43,7 @@ namespace JT809.Protocol.Metadata /// 省级监控平台唯一编码,由平台所在地行政区域代码和平台编码组成 /// 未填写时,全填0 /// - public byte[] PlatformId3 { get; set; } + public byte[] PlatformId3 { get; set; } = new byte[11]; /// /// 报警状态,二进制标识 0 正常 1表示报警 /// 具体定义按照808-2019中表18的规定 diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1205.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1205.cs index 1293cc3..02648e7 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1205.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1205.cs @@ -1,5 +1,8 @@ using JT809.Protocol.Enums; using JT809.Protocol.Extensions; +using JT809.Protocol.Formatters; +using JT809.Protocol.Interfaces; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -11,12 +14,38 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:UP_EXG_ MSG_ RETURN_ STARTUP ACK /// 描述:本条消息是下级平台对上级平台下发的 DOWN_EXG_ MSG_ RETURN_STARTUP 消息的应答消息 /// - public class JT809_0x1200_0x1205:JT809SubBodies + public class JT809_0x1200_0x1205:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.启动车辆定位信息交换应答消息.ToUInt16Value(); public override string Description => "启动车辆定位信息交换应答消息"; - public override bool SkipSerialization => true; + public override bool SkipSerialization => false; + /// + /// 对应启动车辆定位信息交换请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应启动车辆定位信息交换请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + + public JT809_0x1200_0x1205 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + var value = new JT809_0x1200_0x1205(); + if (config.Version == JT809Version.JTT2019) { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x1205 value, IJT809Config config) + { + if (config.Version == JT809Version.JTT2019) { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } + } } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1206.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1206.cs index 85d5091..7dfcd9e 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1206.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x1206.cs @@ -1,5 +1,8 @@ using JT809.Protocol.Enums; using JT809.Protocol.Extensions; +using JT809.Protocol.Formatters; +using JT809.Protocol.Interfaces; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -10,12 +13,40 @@ namespace JT809.Protocol.SubMessageBody /// 结束车辆定位信息交换应答消息 /// 子业务类型标识:UP_EXG_MSG_RETURN_END_ACK /// - public class JT809_0x1200_0x1206:JT809SubBodies + public class JT809_0x1200_0x1206:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.结束车辆定位信息交换应答消息.ToUInt16Value(); public override string Description => "结束车辆定位信息交换应答消息"; - public override bool SkipSerialization => true; + public override bool SkipSerialization => false; + /// + /// 对应结束车辆定位信息交换请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应结束车辆定位信息交换请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + + public JT809_0x1200_0x1206 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + var value = new JT809_0x1200_0x1206(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x1206 value, IJT809Config config) + { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } + } } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120A.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120A.cs index 60895e3..cf4eb92 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120A.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120A.cs @@ -2,6 +2,8 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; +using System; namespace JT809.Protocol.SubMessageBody { @@ -10,12 +12,20 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:UP_EXG_MSG_REPORT_DRIVER_INFO_ACK /// 描述:下级平台应答上级平台发送的上报驾驶员身份识别信息请求消息,上传指定车辆的驾驶员身份识别信息数据 /// - public class JT809_0x1200_0x120A:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1200_0x120A:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.上报驾驶员身份识别信息应答消息.ToUInt16Value(); public override string Description => "上报驾驶员身份识别信息应答消息"; /// + /// 对应上报驾驶员身份请求信息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应上报驾驶员身份请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 驾驶员姓名 /// public string DriverName { get; set; } @@ -31,23 +41,43 @@ namespace JT809.Protocol.SubMessageBody /// 发证机构名称(备用) /// public string OrgName { get; set; } + /// + /// 证件有效期,时分秒均用0表示 + /// + public DateTime ValidDate { get; set; } public JT809_0x1200_0x120A Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { JT809_0x1200_0x120A jT809_0X1200_0X120A = new JT809_0x1200_0x120A(); + if (config.Version == JT809Version.JTT2019) { + jT809_0X1200_0X120A.SourceDataType = reader.ReadUInt16(); + jT809_0X1200_0X120A.SourceMsgSn = reader.ReadUInt32(); + } jT809_0X1200_0X120A.DriverName = reader.ReadString(16); jT809_0X1200_0X120A.DriverID = reader.ReadString(20); jT809_0X1200_0X120A.Licence = reader.ReadString(40); jT809_0X1200_0X120A.OrgName = reader.ReadString(200); + if (config.Version == JT809Version.JTT2019) { + jT809_0X1200_0X120A.ValidDate = reader.ReadUTCDateTime(); + } return jT809_0X1200_0X120A; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x120A value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteStringPadRight(value.DriverName, 16); writer.WriteStringPadRight(value.DriverID, 20); writer.WriteStringPadRight(value.Licence, 40); writer.WriteStringPadRight(value.OrgName, 200); + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUTCDateTime(value.ValidDate); + } } } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120B.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120B.cs index dbb789a..b1fb052 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120B.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120B.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -10,12 +11,20 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:UP_CXG_MSG_TAKE_EWAYBILL_ACK /// 描述:下级平台应答上级平台发送的上报车辆电子运单请求消息,向上级平台上传车辆当前电子运单 /// - public class JT809_0x1200_0x120B:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1200_0x120B:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.上报车辆电子运单应答消息.ToUInt16Value(); public override string Description => "上报车辆电子运单应答消息"; /// + /// 对应上报车辆电子运单源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应上报车辆电子运单源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 电子运单数据体长度 /// public uint EwaybillLength { get; set; } @@ -25,14 +34,24 @@ namespace JT809.Protocol.SubMessageBody public string EwaybillInfo { get; set; } public JT809_0x1200_0x120B Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x1200_0x120B jT809_0X1200_0X120B = new JT809_0x1200_0x120B(); - jT809_0X1200_0X120B.EwaybillLength = reader.ReadUInt32(); - jT809_0X1200_0X120B.EwaybillInfo = reader.ReadString((int)jT809_0X1200_0X120B.EwaybillLength); - return jT809_0X1200_0X120B; + var value = new JT809_0x1200_0x120B(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + value.EwaybillLength = reader.ReadUInt32(); + value.EwaybillInfo = reader.ReadString((int)value.EwaybillLength); + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x120B value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteUInt32((uint)value.EwaybillInfo.Length); writer.WriteString(value.EwaybillInfo); } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120C.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120C.cs index 339a538..0b806a3 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120C.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120C.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -9,7 +10,7 @@ namespace JT809.Protocol.SubMessageBody /// 主动上报驾驶员身份信息消息 /// 子业务类型标识:UP_EXG_MSG_REPORT_DRIVER_INFO /// - public class JT809_0x1200_0x120C:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1200_0x120C:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.主动上报驾驶员身份信息消息.ToUInt16Value(); diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120D.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120D.cs index 493b6ac..b55f094 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120D.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1200_0x120D.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -9,7 +10,7 @@ namespace JT809.Protocol.SubMessageBody /// 主动上报车辆电子运单信息 /// 子业务类型标识:UP_EXG_MSG_REPORT_EWAYBILL_INFO /// - public class JT809_0x1200_0x120D:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1200_0x120D:JT809SubBodies, IJT809MessagePackFormatter,IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.主动上报车辆电子运单信息.ToUInt16Value(); diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1300_0x1302.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1300_0x1302.cs index aa8141b..9b819f1 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1300_0x1302.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1300_0x1302.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -10,25 +11,48 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:UP_PLATFORM_MSG_INFO_ACK /// 描述:下级平台收到上级平台发送的下发平台间报文请求消息后,发送应答消息 /// - public class JT809_0x1300_0x1302:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1300_0x1302:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.下发平台间报文应答消息.ToUInt16Value(); public override string Description => "下发平台间报文应答消息"; /// + /// 对应下发平台间报文请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应下发平台间报文请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 信息ID /// public uint InfoID { get; set; } public JT809_0x1300_0x1302 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x1300_0x1302 jT809_0X1200_0X1302 = new JT809_0x1300_0x1302(); - jT809_0X1200_0X1302.InfoID = reader.ReadUInt32(); - return jT809_0X1200_0X1302; + JT809_0x1300_0x1302 value = new JT809_0x1300_0x1302(); + if (config.Version == JT809Version.JTT2019) { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + else + { + value.InfoID = reader.ReadUInt32(); + } + + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1300_0x1302 value, IJT809Config config) { - writer.WriteUInt32(value.InfoID); + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } + else { + writer.WriteUInt32(value.InfoID); + } } } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1503.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1503.cs index 3b6f055..3340f56 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1503.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1503.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -10,12 +11,20 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:UP_CTRL_MSG_TEXT_INFO_ACK /// 描述:下级平台应答上级平台下发的报文是否成功到达指定车辆 /// - public class JT809_0x1500_0x1503:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1500_0x1503:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.下发车辆报文应答消息.ToUInt16Value(); public override string Description => "下发车辆报文应答消息"; /// + /// 对应下发车辆报文请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应下发车辆报文请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 消息ID /// 对应“下发车辆报文请求消息”中的MSG_ID /// @@ -26,15 +35,32 @@ namespace JT809.Protocol.SubMessageBody public JT809_0x1503_Result Result { get; set; } public JT809_0x1500_0x1503 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x1500_0x1503 jT809_0X1500_0X1503 = new JT809_0x1500_0x1503(); - jT809_0X1500_0X1503.MsgID = reader.ReadUInt32(); - jT809_0X1500_0X1503.Result = (JT809_0x1503_Result)reader.ReadByte(); - return jT809_0X1500_0X1503; + JT809_0x1500_0x1503 value = new JT809_0x1500_0x1503(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + else + { + value.MsgID = reader.ReadUInt32(); + } + + value.Result = (JT809_0x1503_Result)reader.ReadByte(); + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1500_0x1503 value, IJT809Config config) { - writer.WriteUInt32(value.MsgID); + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } + else + { + writer.WriteUInt32(value.MsgID); + } writer.WriteByte((byte)value.Result); } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1504.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1504.cs index dc3ab68..e28c09b 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1504.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1504.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -10,12 +11,21 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:UP_CTRL_MSG_TAKE_T'RAVEL_ACK /// 描述:下级平台应答上级平台下发的上报车辆行驶记录请求消息,将车辆行驶记录数据上传至上级平台 /// - public class JT809_0x1500_0x1504:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1500_0x1504:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version + { { public override ushort SubMsgId => JT809SubBusinessType.上报车辆行驶记录应答消息.ToUInt16Value(); public override string Description => "上报车辆行驶记录应答消息"; /// + /// 对应上报车辆行驶记录请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应上报车辆行驶记录请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 命令字 /// public JT809CommandType CommandType { get; set; } @@ -29,15 +39,26 @@ namespace JT809.Protocol.SubMessageBody public string TraveldataInfo { get; set; } public JT809_0x1500_0x1504 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x1500_0x1504 jT809_0X1500_0X1504 = new JT809_0x1500_0x1504(); - jT809_0X1500_0X1504.CommandType = (JT809CommandType)reader.ReadByte(); - jT809_0X1500_0X1504.TraveldataLength = reader.ReadUInt32(); - jT809_0X1500_0X1504.TraveldataInfo = reader.ReadString((int)jT809_0X1500_0X1504.TraveldataLength); - return jT809_0X1500_0X1504; + JT809_0x1500_0x1504 value = new JT809_0x1500_0x1504(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + value.CommandType = (JT809CommandType)reader.ReadByte(); + value.TraveldataLength = reader.ReadUInt32(); + value.TraveldataInfo = reader.ReadString((int)value.TraveldataLength); + + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1500_0x1504 value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteByte((byte)value.CommandType); // 先计算内容长度(汉字为两个字节) writer.Skip(4, out int lengthPosition); diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1505.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1505.cs index d6bc82c..3c0b929 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1505.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1505.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -10,24 +11,42 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识: UP_CTRL_MSG_EMERGENCY_MONITORING_ACK /// 描述:下级平台应答上级平台下发的车辆应急接入监管平台请求消息应答 /// - public class JT809_0x1500_0x1505:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1500_0x1505:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.车辆应急接入监管平台应答消息.ToUInt16Value(); public override string Description => "车辆应急接入监管平台应答消息"; /// + /// 对应车辆应急接入监管平台请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应车辆应急接入监管平台请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 应答结果 /// public JT809_0x1505_Result Result { get; set; } public JT809_0x1500_0x1505 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x1500_0x1505 jT809_0X1500_0X1505 = new JT809_0x1500_0x1505(); - jT809_0X1500_0X1505.Result = (JT809_0x1505_Result)reader.ReadByte(); - return jT809_0X1500_0X1505; + JT809_0x1500_0x1505 value = new JT809_0x1500_0x1505(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + value.Result = (JT809_0x1505_Result)reader.ReadByte(); + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1500_0x1505 value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteByte((byte)value.Result); } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1600_0x1601.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1600_0x1601.cs index bc7b3a5..32f10e0 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1600_0x1601.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1600_0x1601.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -10,24 +11,42 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:UP_BASE_MSG_VEHICLE_ADDED_ACK /// 描述:上级平台应答下级平台发送的补报车辆静态信息清求消息 /// - public class JT809_0x1600_0x1601:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x1600_0x1601:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.补报车辆静态信息应答.ToUInt16Value(); public override string Description => "补报车辆静态信息应答"; /// + /// 对应补报车辆静态信息请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应补报车辆静态信息请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 车辆信息 /// public string CarInfo { get; set; } public JT809_0x1600_0x1601 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x1600_0x1601 jT809_0X9600_0X1601 = new JT809_0x1600_0x1601(); - jT809_0X9600_0X1601.CarInfo = reader.ReadRemainStringContent(); - return jT809_0X9600_0X1601; + JT809_0x1600_0x1601 value = new JT809_0x1600_0x1601(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + value.CarInfo = reader.ReadRemainStringContent(); + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1600_0x1601 value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteString(value.CarInfo); } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9201.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9201.cs new file mode 100644 index 0000000..647e952 --- /dev/null +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9201.cs @@ -0,0 +1,42 @@ +using JT809.Protocol.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; +using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; + +namespace JT809.Protocol.SubMessageBody +{ + /// + /// 车辆注册信息应答消息 + /// 子业务类型标识:DOWN_EXG_MSG_REGISTER_ACK + /// 描述:上级平台在收到下级平台上报的车辆注册信息后,向下级平台发送车辆注册应答消息 + /// + public class JT809_0x9200_0x9201:JT809SubBodies, IJT809MessagePackFormatter,IJT809_2019_Version + { + public override ushort SubMsgId => JT809SubBusinessType.车辆注册信息应答消息.ToUInt16Value(); + + public override string Description => "车辆注册信息应答消息"; + /// + /// 车辆注册信息消息源报文序号 + /// + public uint MsgSn { get; set; } + /// + /// 处理结果 + /// + public JT809_0x9201_Result Result { get; set; } + + public JT809_0x9200_0x9201 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + var value = new JT809_0x9200_0x9201(); + value.MsgSn = reader.ReadUInt32(); + value.Result = (JT809_0x9201_Result)reader.ReadByte(); + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x9201 value, IJT809Config config) + { + writer.WriteUInt32(value.MsgSn); + writer.WriteByte((byte)value.Result); + } + } +} diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9202.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9202.cs index 25367c3..440b969 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9202.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9202.cs @@ -3,6 +3,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Metadata; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -11,60 +12,90 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:DOWN_EXG_MSG_CAR_LOCATION /// 描述:上级平台通过该消息不间断地向车辆驶入区域所属的下级平台发送车辆定位信息,直到该车驶离该区域 /// - public class JT809_0x9200_0x9202:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x9200_0x9202:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.交换车辆定位信息消息.ToUInt16Value(); public override string Description => "交换车辆定位信息消息"; - public JT809_0x9200_0x9202() - { - VehiclePosition = new JT809VehiclePositionProperties(); - } /// /// 车辆定位信息 /// public JT809VehiclePositionProperties VehiclePosition { get; set; } + public JT809VehiclePositionProperties_2019 GNSSData { get; set; } + public JT809_0x9200_0x9202 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { JT809_0x9200_0x9202 jT809_0X1200_0x9202 = new JT809_0x9200_0x9202(); - jT809_0X1200_0x9202.VehiclePosition.Encrypt = (JT809_VehiclePositionEncrypt)reader.ReadByte(); - jT809_0X1200_0x9202.VehiclePosition.Day = reader.ReadByte(); - jT809_0X1200_0x9202.VehiclePosition.Month = reader.ReadByte(); - jT809_0X1200_0x9202.VehiclePosition.Year = reader.ReadUInt16(); - jT809_0X1200_0x9202.VehiclePosition.Hour = reader.ReadByte(); - jT809_0X1200_0x9202.VehiclePosition.Minute = reader.ReadByte(); - jT809_0X1200_0x9202.VehiclePosition.Second = reader.ReadByte(); - jT809_0X1200_0x9202.VehiclePosition.Lon = reader.ReadUInt32(); - jT809_0X1200_0x9202.VehiclePosition.Lat = reader.ReadUInt32(); - jT809_0X1200_0x9202.VehiclePosition.Vec1 = reader.ReadUInt16(); - jT809_0X1200_0x9202.VehiclePosition.Vec2 = reader.ReadUInt16(); - jT809_0X1200_0x9202.VehiclePosition.Vec3 = reader.ReadUInt32(); - jT809_0X1200_0x9202.VehiclePosition.Direction = reader.ReadUInt16(); - jT809_0X1200_0x9202.VehiclePosition.Altitude = reader.ReadUInt16(); - jT809_0X1200_0x9202.VehiclePosition.State = reader.ReadUInt32(); - jT809_0X1200_0x9202.VehiclePosition.Alarm = reader.ReadUInt32(); + if (config.Version == JT809Version.JTT2013) + { + jT809_0X1200_0x9202.VehiclePosition = new JT809VehiclePositionProperties(); + jT809_0X1200_0x9202.VehiclePosition.Encrypt = (JT809_VehiclePositionEncrypt)reader.ReadByte(); + jT809_0X1200_0x9202.VehiclePosition.Day = reader.ReadByte(); + jT809_0X1200_0x9202.VehiclePosition.Month = reader.ReadByte(); + jT809_0X1200_0x9202.VehiclePosition.Year = reader.ReadUInt16(); + jT809_0X1200_0x9202.VehiclePosition.Hour = reader.ReadByte(); + jT809_0X1200_0x9202.VehiclePosition.Minute = reader.ReadByte(); + jT809_0X1200_0x9202.VehiclePosition.Second = reader.ReadByte(); + jT809_0X1200_0x9202.VehiclePosition.Lon = reader.ReadUInt32(); + jT809_0X1200_0x9202.VehiclePosition.Lat = reader.ReadUInt32(); + jT809_0X1200_0x9202.VehiclePosition.Vec1 = reader.ReadUInt16(); + jT809_0X1200_0x9202.VehiclePosition.Vec2 = reader.ReadUInt16(); + jT809_0X1200_0x9202.VehiclePosition.Vec3 = reader.ReadUInt32(); + jT809_0X1200_0x9202.VehiclePosition.Direction = reader.ReadUInt16(); + jT809_0X1200_0x9202.VehiclePosition.Altitude = reader.ReadUInt16(); + jT809_0X1200_0x9202.VehiclePosition.State = reader.ReadUInt32(); + jT809_0X1200_0x9202.VehiclePosition.Alarm = reader.ReadUInt32(); + } + else + { + jT809_0X1200_0x9202.GNSSData = new JT809VehiclePositionProperties_2019(); + jT809_0X1200_0x9202.GNSSData.Encrypt = (JT809_VehiclePositionEncrypt)reader.ReadByte(); + jT809_0X1200_0x9202.GNSSData.DataLength = reader.ReadUInt32(); + jT809_0X1200_0x9202.GNSSData.GnssData = reader.ReadArray((int)jT809_0X1200_0x9202.GNSSData.DataLength).ToArray(); + jT809_0X1200_0x9202.GNSSData.PlatformId1 = reader.ReadArray(11).ToArray(); + jT809_0X1200_0x9202.GNSSData.Alarm1 = reader.ReadUInt32(); + jT809_0X1200_0x9202.GNSSData.PlatformId2 = reader.ReadArray(11).ToArray(); + jT809_0X1200_0x9202.GNSSData.Alarm2 = reader.ReadUInt32(); + jT809_0X1200_0x9202.GNSSData.PlatformId3 = reader.ReadArray(11).ToArray(); + jT809_0X1200_0x9202.GNSSData.Alarm3 = reader.ReadUInt32(); + } return jT809_0X1200_0x9202; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x9202 value, IJT809Config config) { - writer.WriteByte((byte)value.VehiclePosition.Encrypt); - writer.WriteByte(value.VehiclePosition.Day); - writer.WriteByte(value.VehiclePosition.Month); - writer.WriteUInt16(value.VehiclePosition.Year); - writer.WriteByte(value.VehiclePosition.Hour); - writer.WriteByte(value.VehiclePosition.Minute); - writer.WriteByte(value.VehiclePosition.Second); - writer.WriteUInt32(value.VehiclePosition.Lon); - writer.WriteUInt32(value.VehiclePosition.Lat); - writer.WriteUInt16(value.VehiclePosition.Vec1); - writer.WriteUInt16(value.VehiclePosition.Vec2); - writer.WriteUInt32(value.VehiclePosition.Vec3); - writer.WriteUInt16(value.VehiclePosition.Direction); - writer.WriteUInt16(value.VehiclePosition.Altitude); - writer.WriteUInt32(value.VehiclePosition.State); - writer.WriteUInt32(value.VehiclePosition.Alarm); + if (config.Version == JT809Version.JTT2013) + { + writer.WriteByte((byte)value.VehiclePosition.Encrypt); + writer.WriteByte(value.VehiclePosition.Day); + writer.WriteByte(value.VehiclePosition.Month); + writer.WriteUInt16(value.VehiclePosition.Year); + writer.WriteByte(value.VehiclePosition.Hour); + writer.WriteByte(value.VehiclePosition.Minute); + writer.WriteByte(value.VehiclePosition.Second); + writer.WriteUInt32(value.VehiclePosition.Lon); + writer.WriteUInt32(value.VehiclePosition.Lat); + writer.WriteUInt16(value.VehiclePosition.Vec1); + writer.WriteUInt16(value.VehiclePosition.Vec2); + writer.WriteUInt32(value.VehiclePosition.Vec3); + writer.WriteUInt16(value.VehiclePosition.Direction); + writer.WriteUInt16(value.VehiclePosition.Altitude); + writer.WriteUInt32(value.VehiclePosition.State); + writer.WriteUInt32(value.VehiclePosition.Alarm); + } + else { + writer.WriteByte((byte)value.GNSSData.Encrypt); + writer.Skip(4, out int position); + writer.WriteArray(value.GNSSData.GnssData); + writer.WriteArray(value.GNSSData.PlatformId1); + writer.WriteUInt32(value.GNSSData.Alarm1); + writer.WriteArray(value.GNSSData.PlatformId2); + writer.WriteUInt32(value.GNSSData.Alarm2); + writer.WriteArray(value.GNSSData.PlatformId3); + writer.WriteUInt32(value.GNSSData.Alarm3); + writer.WriteUInt32Return((uint)(writer.GetCurrentPosition() - position-4), position); + } } } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9207.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9207.cs index 13c2393..cdd5379 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9207.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9207.cs @@ -2,6 +2,7 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { @@ -10,24 +11,42 @@ namespace JT809.Protocol.SubMessageBody /// 子业务类型标识:DOWN_EXG_MSG_APPLY_FOR_MONITOR_STARTUP_ACK /// 描述:应答下级平台申请交换指定车辆定位信息,请求消息."即 UP_EXG_MSG_APPLY_FOR_MONITOR_STARTUP /// - public class JT809_0x9200_0x9207:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x9200_0x9207:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.申请交换指定车辆定位信息应答.ToUInt16Value(); public override string Description => "申请交换指定车辆定位信息应答"; /// + /// 对应申请交换指定车辆定位信息请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应申请交换指定车辆定位信息请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 返回结果 /// public JT809_0x9207_Result Result { get; set; } public JT809_0x9200_0x9207 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x9200_0x9207 jT809_0X1200_0x9207 = new JT809_0x9200_0x9207(); - jT809_0X1200_0x9207.Result = (JT809_0x9207_Result)reader.ReadByte(); - return jT809_0X1200_0x9207; + var value = new JT809_0x9200_0x9207(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + value.Result = (JT809_0x9207_Result)reader.ReadByte(); + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x9207 value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteByte((byte)value.Result); } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9208.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9208.cs index 3d54ea6..55479d2 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9208.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9208.cs @@ -2,18 +2,27 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { /// - /// 取消交换指定车辆定位信息应答 + /// 取消交换指定车辆定位信息应答or取消申请交换指定车辆定位信息应答消息 /// 子业务类型标识:DOWN_EXG_MSG_APPLY_FOR_MONITOR_END_ACK /// - public class JT809_0x9200_0x9208:JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x9200_0x9208:JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { - public override ushort SubMsgId => JT809SubBusinessType.取消交换指定车辆定位信息应答.ToUInt16Value(); + public override ushort SubMsgId => JT809SubBusinessType.取消交换指定车辆定位信息应答or取消申请交换指定车辆定位信息应答消息.ToUInt16Value(); - public override string Description => "取消交换指定车辆定位信息应答"; + public override string Description => "取消交换指定车辆定位信息应答or取消申请交换指定车辆定位信息应答消息"; + /// + /// 对应取消申请交换指定车辆定位信息请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应取消申请交换指定车辆定位信息请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } /// /// 返回结果 /// @@ -21,13 +30,23 @@ namespace JT809.Protocol.SubMessageBody public JT809_0x9200_0x9208 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x9200_0x9208 jT809_0X1200_0x9208 = new JT809_0x9200_0x9208(); - jT809_0X1200_0x9208.Result = (JT809_0x9208_Result)reader.ReadByte(); - return jT809_0X1200_0x9208; + var value = new JT809_0x9200_0x9208(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + value.Result = (JT809_0x9208_Result)reader.ReadByte(); + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x9208 value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteByte((byte)value.Result); } } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9209.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9209.cs index f0eb36c..9db6349 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9209.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x9209.cs @@ -2,32 +2,51 @@ using JT809.Protocol.Formatters; using JT809.Protocol.MessagePack; using JT809.Protocol.Extensions; +using JT809.Protocol.Interfaces; namespace JT809.Protocol.SubMessageBody { /// /// 补发车辆定位信息应答 - /// 子业务类型标识:DOWN_EXG_MSG_APPLY_FOR_MONITOR_END_ACK + /// 子业务类型标识:DOWN_EXG_MSG_APPLY_HISGNSSDATA_ACK /// - public class JT809_0x9200_0x9209: JT809SubBodies, IJT809MessagePackFormatter + public class JT809_0x9200_0x9209: JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { public override ushort SubMsgId => JT809SubBusinessType.补发车辆定位信息应答.ToUInt16Value(); public override string Description => "补发车辆定位信息应答"; /// + /// 对应补发车辆定位信息请求消息源子业务类型标识 + /// + public ushort SourceDataType { get; set; } + /// + /// 对应补发车辆定位信息请求消息源报文序列号 + /// + public uint SourceMsgSn { get; set; } + /// /// 返回结果 /// public JT809_0x9209_Result Result { get; set; } public JT809_0x9200_0x9209 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { - JT809_0x9200_0x9209 jT809_0X1200_0x9209 = new JT809_0x9200_0x9209(); - jT809_0X1200_0x9209.Result = (JT809_0x9209_Result)reader.ReadByte(); - return jT809_0X1200_0x9209; + var value = new JT809_0x9200_0x9209(); + if (config.Version == JT809Version.JTT2019) + { + value.SourceDataType = reader.ReadUInt16(); + value.SourceMsgSn = reader.ReadUInt32(); + } + value.Result = (JT809_0x9209_Result)reader.ReadByte(); + return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x9209 value, IJT809Config config) { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUInt16(value.SourceDataType); + writer.WriteUInt32(value.SourceMsgSn); + } writer.WriteByte((byte)value.Result); } }