From 381eccec6478ca113a7cf5ffc391e1ffe6bf3b0b Mon Sep 17 00:00:00 2001 From: "SmallChi(Koike)" <564952747@qq.com> Date: Wed, 11 Dec 2024 10:19:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=B9=E6=8D=AE2019?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=20MarkId=20=E5=AD=97=E8=8A=82=E5=92=8C22013?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=B8=80=E6=A0=B7=E9=83=BD=E6=98=AF5?= =?UTF-8?q?=E4=B8=AA=E5=AD=97=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JT808.Protocol/JT808.Protocol.xml | 3 +- .../MessageBody/JT808_0x0107.cs | 33 ++++--------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/JT808.Protocol/JT808.Protocol.xml b/src/JT808.Protocol/JT808.Protocol.xml index af8e06e2..718bbbc8 100644 --- a/src/JT808.Protocol/JT808.Protocol.xml +++ b/src/JT808.Protocol/JT808.Protocol.xml @@ -9443,8 +9443,7 @@ 制造商 ID - 2013版本 5 个字节,终端制造商编码 - 2019版本 11 个字节,终端制造商编码 + 2013版本 5 个字节,终端制造商编码 diff --git a/src/JT808.Protocol/MessageBody/JT808_0x0107.cs b/src/JT808.Protocol/MessageBody/JT808_0x0107.cs index 5f70e9ef..14157815 100644 --- a/src/JT808.Protocol/MessageBody/JT808_0x0107.cs +++ b/src/JT808.Protocol/MessageBody/JT808_0x0107.cs @@ -39,8 +39,7 @@ public class JT808_0x0107 : JT808MessagePackFormatter, JT808Bodies public ushort TerminalType { get; set; } /// /// 制造商 ID - /// 2013版本 5 个字节,终端制造商编码 - /// 2019版本 11 个字节,终端制造商编码 + /// 2013版本 5 个字节,终端制造商编码 /// public string MakerId { get; set; } /// @@ -107,18 +106,9 @@ public override JT808_0x0107 Deserialize(ref JT808MessagePackReader reader, IJT8 { JT808_0x0107 jT808_0X0107 = new JT808_0x0107(); jT808_0X0107.TerminalType = reader.ReadUInt16(); - if(reader.Version== JT808Version.JTT2019) - { - jT808_0X0107.MakerId = reader.ReadString(11); - jT808_0X0107.TerminalModel = reader.ReadString(30); - jT808_0X0107.TerminalId = reader.ReadString(30); - } - else - { - jT808_0X0107.MakerId = reader.ReadString(5); - jT808_0X0107.TerminalModel = reader.ReadString(20); - jT808_0X0107.TerminalId = reader.ReadString(7); - } + jT808_0X0107.MakerId = reader.ReadString(5); + jT808_0X0107.TerminalModel = reader.ReadString(20); + jT808_0X0107.TerminalId = reader.ReadString(7); jT808_0X0107.Terminal_SIM_ICCID = reader.ReadBCD(20, config.Trim); jT808_0X0107.Terminal_Hardware_Version_Length = reader.ReadByte(); jT808_0X0107.Terminal_Hardware_Version_Num = reader.ReadString(jT808_0X0107.Terminal_Hardware_Version_Length); @@ -137,18 +127,9 @@ public override JT808_0x0107 Deserialize(ref JT808MessagePackReader reader, IJT8 public override void Serialize(ref JT808MessagePackWriter writer, JT808_0x0107 value, IJT808Config config) { writer.WriteUInt16(value.TerminalType); - if (writer.Version == JT808Version.JTT2019) - { - writer.WriteString(value.MakerId.PadRight(11, '\0').ValiString(nameof(value.MakerId),11)); - writer.WriteString(value.TerminalModel.PadRight(30, '\0').ValiString(nameof(value.TerminalModel), 30)); - writer.WriteString(value.TerminalId.PadRight(30, '\0').ValiString(nameof(value.TerminalId), 30)); - } - else - { - writer.WriteString(value.MakerId.PadRight(5, '\0').ValiString(nameof(value.MakerId), 5)); - writer.WriteString(value.TerminalModel.PadRight(20, '\0').ValiString(nameof(value.TerminalModel), 20)); - writer.WriteString(value.TerminalId.PadRight(7, '\0').ValiString(nameof(value.TerminalId), 7)); - } + writer.WriteString(value.MakerId.PadRight(5, '\0').ValiString(nameof(value.MakerId), 5)); + writer.WriteString(value.TerminalModel.PadRight(20, '\0').ValiString(nameof(value.TerminalModel), 20)); + writer.WriteString(value.TerminalId.PadRight(7, '\0').ValiString(nameof(value.TerminalId), 7)); writer.WriteBCD(value.Terminal_SIM_ICCID.ValiString(nameof(value.Terminal_SIM_ICCID), 20), 20); writer.WriteByte((byte)value.Terminal_Hardware_Version_Num.Length); writer.WriteString(value.Terminal_Hardware_Version_Num);