From aaa83079016d131ebd32d876cf2419fa968a3b7e Mon Sep 17 00:00:00 2001 From: waterliu99 Date: Wed, 15 Apr 2020 19:04:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A02019=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/JT809SubBusinessType.cs | 2 +- .../Enums/JT809_0x920A_UploadFlag.cs | 12 +++++++ src/JT809.Protocol/JT809.Protocol.csproj | 1 + .../SubMessageBody/JT809_0x1400_0x1402.cs | 2 +- .../SubMessageBody/JT809_0x1400_0x1413.cs | 2 +- .../SubMessageBody/JT809_0x9200_0x920A.cs | 31 +++++++++++++++++-- 6 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 src/JT809.Protocol/Enums/JT809_0x920A_UploadFlag.cs diff --git a/src/JT809.Protocol/Enums/JT809SubBusinessType.cs b/src/JT809.Protocol/Enums/JT809SubBusinessType.cs index bf09830..6e38fc2 100644 --- a/src/JT809.Protocol/Enums/JT809SubBusinessType.cs +++ b/src/JT809.Protocol/Enums/JT809SubBusinessType.cs @@ -214,7 +214,7 @@ namespace JT809.Protocol.Enums [Description("车辆行驶线路请求应答")] [JT809BodiesType(typeof(JT809_0x9200_0x920D))] [JT809SubBusinessTypeDescription("DOWN_BASE_MSG_DRVLINE_ACK", "车辆行驶线路请求应答", JT809BusinessType.从链路车辆动态信息交换业务)] - 车辆行驶线路请求应答 = 0x920B, + 车辆行驶线路请求应答 = 0x920D, #endregion #region 主链路平台信息交互消息 UP_PLATFORM_MSG diff --git a/src/JT809.Protocol/Enums/JT809_0x920A_UploadFlag.cs b/src/JT809.Protocol/Enums/JT809_0x920A_UploadFlag.cs new file mode 100644 index 0000000..174f50e --- /dev/null +++ b/src/JT809.Protocol/Enums/JT809_0x920A_UploadFlag.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT809.Protocol.Enums +{ + public enum JT809_0x920A_UploadFlag:byte + { + 最近收到的消息=0x00, + 从终端获取=0x01 + } +} diff --git a/src/JT809.Protocol/JT809.Protocol.csproj b/src/JT809.Protocol/JT809.Protocol.csproj index b9c1f55..48eb60f 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/SubMessageBody/JT809_0x1400_0x1402.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1400_0x1402.cs index 58195fe..362af58 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1400_0x1402.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1400_0x1402.cs @@ -82,7 +82,7 @@ namespace JT809.Protocol.SubMessageBody } value.WarnType = (JT809WarnType)reader.ReadUInt16(); value.WarnTime = reader.ReadUTCDateTime(); - if (config.Version != JT809Version.JTT2013) + if (config.Version == JT809Version.JTT2013) { value.InfoID = reader.ReadUInt32(); } diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1400_0x1413.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1400_0x1413.cs index 4c59778..8c4351a 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x1400_0x1413.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1400_0x1413.cs @@ -15,7 +15,7 @@ namespace JT809.Protocol.SubMessageBody /// public class JT809_0x1400_0x1413 : JT809SubBodies, IJT809MessagePackFormatter, IJT809_2019_Version { - public override ushort SubMsgId => JT809SubBusinessType.主动上报报警处理结果消息.ToUInt16Value(); + public override ushort SubMsgId => JT809SubBusinessType.上报报警督办请求消息.ToUInt16Value(); public override string Description => "上报报警督办请求消息"; /// diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x920A.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x920A.cs index 6a7d3bf..f8ce63b 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x920A.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9200_0x920A.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,34 @@ namespace JT809.Protocol.SubMessageBody /// 上报车辆驾驶员身份识别信息请求 /// 子业务类型标识:DOWN_EXG_MSG_REPORT_DRIVER_INFO /// - public class JT809_0x9200_0x920A:JT809SubBodies - { + public class JT809_0x9200_0x920A: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 JT809_0x920A_UploadFlag Flag { get; set; } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x920A value, IJT809Config config) + { + if (config.Version == JT809Version.JTT2019) + { + writer.WriteByte((byte)value.Flag); + } + } + + public JT809_0x9200_0x920A Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + var value = new JT809_0x9200_0x920A(); + if (config.Version == JT809Version.JTT2019) + { + value.Flag = (JT809_0x920A_UploadFlag)reader.ReadByte(); + } + return value; + } } } From 639993de2e4118300812d9caa85566f09226962c Mon Sep 17 00:00:00 2001 From: waterliu99 Date: Thu, 16 Apr 2020 09:31:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?0x9504=E5=85=BC=E5=AE=B9=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JT809_0x9500_0x9504Test.cs | 2 +- .../SubMessageBody/JT809_0x9500_0x9504.cs | 75 +++++++++++++++++-- 2 files changed, 70 insertions(+), 7 deletions(-) diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9504Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9504Test.cs index 43e277f..a0d6765 100644 --- a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9504Test.cs +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9504Test.cs @@ -22,7 +22,7 @@ namespace JT809.Protocol.Test.JT809SubMessageBody Command= JT809CommandType.采集记录仪事故疑点记录, StartTime=DateTime.Parse("2018-09-27 20:00:20"), EndTime=DateTime.Parse("2018-09-27 23:00:20"), - //Max=5556 + Max=5556 }; var hex = JT809Serializer.Serialize(jT809_0X9500_0X9504).ToHexString(); //"10 18 09 27 20 00 20 18 09 27 23 00 20 15 B4" diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9504.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9504.cs index c12a805..baefd01 100644 --- a/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9504.cs +++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9504.cs @@ -29,21 +29,84 @@ namespace JT809.Protocol.SubMessageBody /// 命令字ID /// public JT809CommandType Command { get; set; } + /// + /// 最大数据数 + /// + public ushort Max { get; set; } public JT809_0x9500_0x9504 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) { var value = new JT809_0x9500_0x9504(); - value.StartTime = reader.ReadUTCDateTime(); - value.EndTime = reader.ReadUTCDateTime(); - value.Command = (JT809CommandType)reader.ReadByte(); + if(config.Version == JT809Version.JTT2019){ + value.StartTime = reader.ReadUTCDateTime(); + value.EndTime = reader.ReadUTCDateTime(); + value.Command = (JT809CommandType)reader.ReadByte(); + } + else { + value.Command = (JT809CommandType)reader.ReadByte(); + switch (value.Command) + { + case JT809CommandType.记录仪标准版本: + case JT809CommandType.当前驾驶人信息: + case JT809CommandType.记录仪时间: + case JT809CommandType.记录仪累计行驶里程: + case JT809CommandType.记录仪脉冲系数: + case JT809CommandType.车辆信息: + case JT809CommandType.记录仪状态信号配置信息: + case JT809CommandType.记录仪唯一性编号: + break; + case JT809CommandType.采集记录仪行驶记录: + case JT809CommandType.采集记录仪位置信息记录: + case JT809CommandType.采集记录仪事故疑点记录: + case JT809CommandType.采集记录仪超时驾驶记录: + case JT809CommandType.采集记录仪驾驶人身份记录: + case JT809CommandType.采集记录仪外部供电记录: + case JT809CommandType.采集记录仪参数修改记录: + case JT809CommandType.采集记录仪速度状态日志: + value.StartTime = reader.ReadDateTime6(); + value.EndTime = reader.ReadDateTime6(); + value.Max = reader.ReadUInt16(); + break; + } + } return value; } public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9500_0x9504 value, IJT809Config config) { - writer.WriteUTCDateTime(value.StartTime); - writer.WriteUTCDateTime(value.EndTime); - writer.WriteByte((byte)value.Command); + if (config.Version == JT809Version.JTT2019) + { + writer.WriteUTCDateTime(value.StartTime); + writer.WriteUTCDateTime(value.EndTime); + writer.WriteByte((byte)value.Command); + } + else { + writer.WriteByte((byte)value.Command); + switch (value.Command) + { + case JT809CommandType.记录仪标准版本: + case JT809CommandType.当前驾驶人信息: + case JT809CommandType.记录仪时间: + case JT809CommandType.记录仪累计行驶里程: + case JT809CommandType.记录仪脉冲系数: + case JT809CommandType.车辆信息: + case JT809CommandType.记录仪状态信号配置信息: + case JT809CommandType.记录仪唯一性编号: + break; + case JT809CommandType.采集记录仪行驶记录: + case JT809CommandType.采集记录仪位置信息记录: + case JT809CommandType.采集记录仪事故疑点记录: + case JT809CommandType.采集记录仪超时驾驶记录: + case JT809CommandType.采集记录仪驾驶人身份记录: + case JT809CommandType.采集记录仪外部供电记录: + case JT809CommandType.采集记录仪参数修改记录: + case JT809CommandType.采集记录仪速度状态日志: + writer.WriteDateTime6(value.StartTime); + writer.WriteDateTime6(value.EndTime); + writer.WriteUInt16(value.Max); + break; + } + } } } }