diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj b/src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj index 4ff0696..ab254d4 100644 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj +++ b/src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj @@ -5,8 +5,8 @@ - - + + all diff --git a/src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs b/src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs index e98a5c8..d252555 100644 --- a/src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs +++ b/src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs @@ -12,47 +12,8 @@ namespace JT809.Protocol.Extensions.JT1078 public static IJT809Builder AddJT1078Configure(this IJT809Builder iJT809Builder) { iJT809Builder.Config.Register(Assembly.GetExecutingAssembly()); -#warning 不知道是不是jt1078协议的809结构有问题,先按交换的格式(少了数据交换的头部) - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.主链路时效口令业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.时效口令上报消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.时效口令请求消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.主链路实时音视频业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.实时音视频请求应答消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输应答消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.主链路远程录像检索业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.查询音视频资源目录应答消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.主链路远程录像回放业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像回放请求应答消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像回放控制应答消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.主链路远程录像下载业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像下载请求应答消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像下载通知消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像下载控制应答消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.从链路时效口令业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.时效口令请求应答消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.从链路实时音视频业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.实时音视频请求消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.从链路远程录像检索业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息应答消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.查询音视频资源目录请求消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.从链路远程录像回放业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像回放请求消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像回放控制消息); - - iJT809Builder.Config.BusinessTypeFactory.SetMap((ushort)JT809_JT1078_BusinessType.从链路远程录像下载业务类); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像下载请求消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像下载完成通知应答消息); - iJT809Builder.Config.SubBusinessTypeFactory.SetMap((ushort)JT809_JT1078_SubBusinessType.远程录像下载控制消息); + iJT809Builder.Config.BusinessTypeFactory.Register(Assembly.GetExecutingAssembly()); + iJT809Builder.Config.SubBusinessTypeFactory.Register(Assembly.GetExecutingAssembly()); return iJT809Builder; } } diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1700_0x1701_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1700_0x1701_Formatter.cs deleted file mode 100644 index 490b1bb..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1700_0x1701_Formatter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1700_0x1701_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1700_0x1701 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1700_0x1701 jT808_JT1078_0X1701 = new JT809_JT1078_0x1700_0x1701(); - jT808_JT1078_0X1701.PlateFormId = reader.ReadArray(11).ToArray(); - jT808_JT1078_0X1701.AuthorizeCode1 = reader.ReadArray(64).ToArray(); - jT808_JT1078_0X1701.AuthorizeCode2 = reader.ReadArray(64).ToArray(); - return jT808_JT1078_0X1701; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1700_0x1701 value, IJT809Config config) - { - writer.WriteArray(value.PlateFormId); - writer.WriteArray(value.AuthorizeCode1); - writer.WriteArray(value.AuthorizeCode2); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1700_0x1702_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1700_0x1702_Formatter.cs deleted file mode 100644 index 1baf11c..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1700_0x1702_Formatter.cs +++ /dev/null @@ -1,22 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1700_0x1702_Formatter : IJT809MessagePackFormatter - { - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1700_0x1702 value, IJT809Config config) - { - - } - - public JT809_JT1078_0x1700_0x1702 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - return new JT809_JT1078_0x1700_0x1702(); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1800_0x1801_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1800_0x1801_Formatter.cs deleted file mode 100644 index 7436eb1..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1800_0x1801_Formatter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1800_0x1801_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1800_0x1801 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1800_0x1801 jT808_JT1078_0x1800_0x1801 = new JT809_JT1078_0x1800_0x1801(); - jT808_JT1078_0x1800_0x1801.Result = reader.ReadByte(); - jT808_JT1078_0x1800_0x1801.ServerIp = reader.ReadString(32); - jT808_JT1078_0x1800_0x1801.ServerPort = reader.ReadUInt16(); - return jT808_JT1078_0x1800_0x1801; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800_0x1801 value, IJT809Config config) - { - writer.WriteByte(value.Result); - writer.WriteStringPadLeft(value.ServerIp,32); - writer.WriteUInt16(value.ServerPort); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1800_0x1802_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1800_0x1802_Formatter.cs deleted file mode 100644 index f930c3a..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1800_0x1802_Formatter.cs +++ /dev/null @@ -1,24 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1800_0x1802_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1800_0x1802 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1800_0x1802 jT808_JT1078_0x1800_0x1802 = new JT809_JT1078_0x1800_0x1802(); - jT808_JT1078_0x1800_0x1802.Result = reader.ReadByte(); - return jT808_JT1078_0x1800_0x1802; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800_0x1802 value, IJT809Config config) - { - writer.WriteByte(value.Result); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1901_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1901_Formatter.cs deleted file mode 100644 index 8f124ae..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1901_Formatter.cs +++ /dev/null @@ -1,43 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1900_0x1901_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1900_0x1901 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1900_0x1901 jT808_JT1078_0x1900_0x1901 = new JT809_JT1078_0x1900_0x1901(); - jT808_JT1078_0x1900_0x1901.ItemNum=reader.ReadUInt32(); - if (jT808_JT1078_0x1900_0x1901.ItemNum > 0) - { - List jT808_JT1078_0x1900_0x1901_RecordList = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < jT808_JT1078_0x1900_0x1901.ItemNum; i++) - { - var jT808_JT1078_0x1900_0x1901_Record = formatter.Deserialize(ref reader, config); - jT808_JT1078_0x1900_0x1901_RecordList.Add(jT808_JT1078_0x1900_0x1901_Record); - } - jT808_JT1078_0x1900_0x1901.ItemList = jT808_JT1078_0x1900_0x1901_RecordList; - } - return jT808_JT1078_0x1900_0x1901; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_0x1901 value, IJT809Config config) - { - writer.WriteUInt32(value.ItemNum); - if (value.ItemList.Count > 0) - { - var formatter = config.GetMessagePackFormatter(); - foreach (var item in value.ItemList) - { - formatter.Serialize(ref writer, item, config); - } - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1901_Record_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1901_Record_Formatter.cs deleted file mode 100644 index 5116aa0..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1901_Record_Formatter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1900_0x1901_Record_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1900_Record Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1900_Record jT808_JT1078_0x1900_0x1901_Record = new JT809_JT1078_0x1900_Record(); - jT808_JT1078_0x1900_0x1901_Record.ChannelId = reader.ReadByte(); - jT808_JT1078_0x1900_0x1901_Record.StartTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x1900_0x1901_Record.EndTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x1900_0x1901_Record.AlarmType = reader.ReadUInt64(); - jT808_JT1078_0x1900_0x1901_Record.AVItemType = reader.ReadByte(); - jT808_JT1078_0x1900_0x1901_Record.StreamType = reader.ReadByte(); - jT808_JT1078_0x1900_0x1901_Record.MemType = reader.ReadByte(); - jT808_JT1078_0x1900_0x1901_Record.FileSize = reader.ReadUInt32(); - return jT808_JT1078_0x1900_0x1901_Record; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_Record value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteUTCDateTime(value.StartTime); - writer.WriteUTCDateTime(value.EndTime); - writer.WriteUInt64(value.AlarmType); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteUInt32(value.FileSize); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1902_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1902_Formatter.cs deleted file mode 100644 index 6527131..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1900_0x1902_Formatter.cs +++ /dev/null @@ -1,45 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1900_0x1902_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1900_0x1902 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1900_0x1902 jT808_JT1078_0x1900_0x1902 = new JT809_JT1078_0x1900_0x1902(); - jT808_JT1078_0x1900_0x1902.Result = reader.ReadByte(); - jT808_JT1078_0x1900_0x1902.ItemNum = reader.ReadUInt32(); - if (jT808_JT1078_0x1900_0x1902.ItemNum > 0) - { - List jT808_JT1078_0x1900_0x1901_RecordList = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < jT808_JT1078_0x1900_0x1902.ItemNum; i++) - { - var jT808_JT1078_0x1900_0x1901_Record = formatter.Deserialize(ref reader, config); - jT808_JT1078_0x1900_0x1901_RecordList.Add(jT808_JT1078_0x1900_0x1901_Record); - } - jT808_JT1078_0x1900_0x1902.ItemList = jT808_JT1078_0x1900_0x1901_RecordList; - } - return jT808_JT1078_0x1900_0x1902; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_0x1902 value, IJT809Config config) - { - writer.WriteByte(value.Result); - writer.WriteUInt32(value.ItemNum); - if (value.ItemList.Count > 0) - { - var formatter = config.GetMessagePackFormatter(); - foreach (var item in value.ItemList) - { - formatter.Serialize(ref writer, item, config); - } - } - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1A00_0x1A01_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1A00_0x1A01_Formatter.cs deleted file mode 100644 index 9b85060..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1A00_0x1A01_Formatter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1A00_0x1A01_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1A00_0x1A01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1A00_0x1A01 jT808_JT1078_0x1A00_0x1A01 = new JT809_JT1078_0x1A00_0x1A01(); - jT808_JT1078_0x1A00_0x1A01.ServerIp = reader.ReadString(32); - jT808_JT1078_0x1A00_0x1A01.ServerPort = reader.ReadUInt16(); - jT808_JT1078_0x1A00_0x1A01.Result = reader.ReadByte(); - return jT808_JT1078_0x1A00_0x1A01; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00_0x1A01 value, IJT809Config config) - { - writer.WriteStringPadLeft(value.ServerIp, 32); - writer.WriteUInt16(value.ServerPort); - writer.WriteByte(value.Result); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1A00_0x1A02_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1A00_0x1A02_Formatter.cs deleted file mode 100644 index be91c39..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1A00_0x1A02_Formatter.cs +++ /dev/null @@ -1,24 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1A00_0x1A02_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1A00_0x1A02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1A00_0x1A02 jT808_JT1078_0x1A00_0x1A02 = new JT809_JT1078_0x1A00_0x1A02(); - jT808_JT1078_0x1A00_0x1A02.Result = reader.ReadByte(); - return jT808_JT1078_0x1A00_0x1A02; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00_0x1A02 value, IJT809Config config) - { - writer.WriteByte(value.Result); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B01_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B01_Formatter.cs deleted file mode 100644 index dc180f2..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B01_Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1B00_0x1B01_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1B00_0x1B01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B01 jT808_JT1078_0x1B00_0x1B01 = new JT809_JT1078_0x1B00_0x1B01(); - jT808_JT1078_0x1B00_0x1B01.Result = reader.ReadByte(); - jT808_JT1078_0x1B00_0x1B01.SessionId = reader.ReadUInt16(); - return jT808_JT1078_0x1B00_0x1B01; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B01 value, IJT809Config config) - { - writer.WriteByte(value.Result); - writer.WriteUInt16(value.SessionId); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B02_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B02_Formatter.cs deleted file mode 100644 index 4d95056..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B02_Formatter.cs +++ /dev/null @@ -1,36 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1B00_0x1B02_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1B00_0x1B02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B02 jT808_JT1078_0x1B00_0x1B02 = new JT809_JT1078_0x1B00_0x1B02(); - jT808_JT1078_0x1B00_0x1B02.Result = reader.ReadByte(); - jT808_JT1078_0x1B00_0x1B02.SessionId = reader.ReadUInt16(); - jT808_JT1078_0x1B00_0x1B02.ServerIp = reader.ReadString(32); - jT808_JT1078_0x1B00_0x1B02.TcpPort = reader.ReadUInt16(); - jT808_JT1078_0x1B00_0x1B02.UserName = reader.ReadString(49); - jT808_JT1078_0x1B00_0x1B02.Password = reader.ReadString(22); - jT808_JT1078_0x1B00_0x1B02.FilePath = reader.ReadString(200); - return jT808_JT1078_0x1B00_0x1B02; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B02 value, IJT809Config config) - { - writer.WriteByte(value.Result); - writer.WriteUInt16(value.SessionId); - writer.WriteStringPadLeft(value.ServerIp, 32); - writer.WriteUInt16(value.TcpPort); - writer.WriteStringPadLeft(value.UserName, 49); - writer.WriteStringPadLeft(value.Password, 22); - writer.WriteStringPadLeft(value.FilePath, 200); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B03_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B03_Formatter.cs deleted file mode 100644 index cd0c6da..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x1B00_0x1B03_Formatter.cs +++ /dev/null @@ -1,24 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x1B00_0x1B03_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x1B00_0x1B03 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B03 jT808_JT1078_0x1B00_0x1B01 = new JT809_JT1078_0x1B00_0x1B03(); - jT808_JT1078_0x1B00_0x1B01.Result = reader.ReadByte(); - return jT808_JT1078_0x1B00_0x1B01; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B03 value, IJT809Config config) - { - writer.WriteByte(value.Result); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9700_0x9702_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9700_0x9702_Formatter.cs deleted file mode 100644 index 08ef42f..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9700_0x9702_Formatter.cs +++ /dev/null @@ -1,22 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9700_0x9702_Formatter : IJT809MessagePackFormatter - { - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9700_0x9702 value, IJT809Config config) - { - - } - - public JT809_JT1078_0x9700_0x9702 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - return new JT809_JT1078_0x9700_0x9702(); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9800_0x9801_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9800_0x9801_Formatter.cs deleted file mode 100644 index de5dc2d..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9800_0x9801_Formatter.cs +++ /dev/null @@ -1,30 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9800_0x9801_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9800_0x9801 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9800_0x9801 jT808_JT1078_0x9800_0x9801 = new JT809_JT1078_0x9800_0x9801(); - jT808_JT1078_0x9800_0x9801.ChannelId = reader.ReadByte(); - jT808_JT1078_0x9800_0x9801.AVitemType = reader.ReadByte(); - jT808_JT1078_0x9800_0x9801.AuthorizeCode = reader.ReadArray(64).ToArray(); - jT808_JT1078_0x9800_0x9801.GnssData = reader.ReadArray(36).ToArray(); - return jT808_JT1078_0x9800_0x9801; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800_0x9801 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteByte(value.AVitemType); - writer.WriteArray(value.AuthorizeCode); - writer.WriteArray(value.GnssData); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9800_0x9802_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9800_0x9802_Formatter.cs deleted file mode 100644 index 97fc5ad..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9800_0x9802_Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9800_0x9802_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9800_0x9802 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9800_0x9802 jT808_JT1078_0x9800_0x9802 = new JT809_JT1078_0x9800_0x9802(); - jT808_JT1078_0x9800_0x9802.ChannelId = reader.ReadByte(); - jT808_JT1078_0x9800_0x9802.AVitemType = reader.ReadByte(); - return jT808_JT1078_0x9800_0x9802; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800_0x9802 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteByte(value.AVitemType); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9900_0x9901_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9900_0x9901_Formatter.cs deleted file mode 100644 index a6b9cdc..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9900_0x9901_Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9900_0x9901_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9900_0x9901 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9900_0x9901 jT808_JT1078_0x9900_0x9901 = new JT809_JT1078_0x9900_0x9901(); - jT808_JT1078_0x9900_0x9901.Result = reader.ReadByte(); - jT808_JT1078_0x9900_0x9901.ItemNumber = reader.ReadByte(); - return jT808_JT1078_0x9900_0x9901; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900_0x9901 value, IJT809Config config) - { - writer.WriteByte(value.Result); - writer.WriteByte(value.ItemNumber); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9900_0x9902_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9900_0x9902_Formatter.cs deleted file mode 100644 index edfed9a..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9900_0x9902_Formatter.cs +++ /dev/null @@ -1,41 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9900_0x9902_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9900_0x9902 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9900_0x9902 jT808_JT1078_0x9900_0x9902 = new JT809_JT1078_0x9900_0x9902(); - jT808_JT1078_0x9900_0x9902.ChannelId = reader.ReadByte(); -#warning 此处时间8个字节,暂使用utc时间代替 - jT808_JT1078_0x9900_0x9902.StartTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x9900_0x9902.EndTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x9900_0x9902.AlarmType = reader.ReadUInt64(); - jT808_JT1078_0x9900_0x9902.AVItemType = reader.ReadByte(); - jT808_JT1078_0x9900_0x9902.StreamType = reader.ReadByte(); - jT808_JT1078_0x9900_0x9902.MemType = reader.ReadByte(); - jT808_JT1078_0x9900_0x9902.AuthorizeCode = reader.ReadArray(64).ToArray(); - jT808_JT1078_0x9900_0x9902.GnssData = reader.ReadArray(36).ToArray(); - return jT808_JT1078_0x9900_0x9902; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900_0x9902 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteUTCDateTime(value.StartTime); - writer.WriteUTCDateTime(value.EndTime); - writer.WriteUInt64(value.AlarmType); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteArray(value.AuthorizeCode); - writer.WriteArray(value.GnssData); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9A00_0x9A01_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9A00_0x9A01_Formatter.cs deleted file mode 100644 index ca8d7c9..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9A00_0x9A01_Formatter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9A00_0x9A01_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9A00_0x9A01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9A00_0x9A01 jT808_JT1078_0x9A00_0x9A01 = new JT809_JT1078_0x9A00_0x9A01(); - jT808_JT1078_0x9A00_0x9A01.ChannelId = reader.ReadByte(); - jT808_JT1078_0x9A00_0x9A01.AVItemType = reader.ReadByte(); - jT808_JT1078_0x9A00_0x9A01.StreamType = reader.ReadByte(); - jT808_JT1078_0x9A00_0x9A01.MemType = reader.ReadByte(); - jT808_JT1078_0x9A00_0x9A01.PlayBackStartTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x9A00_0x9A01.PlayBackEndTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x9A00_0x9A01.AuthorizeCode = reader.ReadArray(64).ToArray(); - jT808_JT1078_0x9A00_0x9A01.GnssData = reader.ReadArray(36).ToArray(); - return jT808_JT1078_0x9A00_0x9A01; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00_0x9A01 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteUTCDateTime(value.PlayBackStartTime); - writer.WriteUTCDateTime(value.PlayBackEndTime); - writer.WriteArray(value.AuthorizeCode); - writer.WriteArray(value.GnssData); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9A00_0x9A02_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9A00_0x9A02_Formatter.cs deleted file mode 100644 index 0821743..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9A00_0x9A02_Formatter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9A00_0x9A02_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9A00_0x9A02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9A00_0x9A02 jT808_JT1078_0x9A00_0x9A02 = new JT809_JT1078_0x9A00_0x9A02(); - jT808_JT1078_0x9A00_0x9A02.ControlType = reader.ReadByte(); - jT808_JT1078_0x9A00_0x9A02.FastTime = reader.ReadByte(); - jT808_JT1078_0x9A00_0x9A02.DateTime = reader.ReadUTCDateTime(); - return jT808_JT1078_0x9A00_0x9A02; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00_0x9A02 value, IJT809Config config) - { - writer.WriteByte(value.ControlType); - writer.WriteByte(value.FastTime); - writer.WriteUTCDateTime(value.DateTime); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B01_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B01_Formatter.cs deleted file mode 100644 index d9577a1..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B01_Formatter.cs +++ /dev/null @@ -1,42 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9B00_0x9B01_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9B00_0x9B01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B01 jT808_JT1078_0x9B00_0x9B01 = new JT809_JT1078_0x9B00_0x9B01(); - jT808_JT1078_0x9B00_0x9B01.ChannelId = reader.ReadByte(); - jT808_JT1078_0x9B00_0x9B01.StartTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x9B00_0x9B01.EndTime = reader.ReadUTCDateTime(); - jT808_JT1078_0x9B00_0x9B01.AlarmType = reader.ReadUInt64(); - jT808_JT1078_0x9B00_0x9B01.AVItemType = reader.ReadByte(); - jT808_JT1078_0x9B00_0x9B01.StreamType = reader.ReadByte(); - jT808_JT1078_0x9B00_0x9B01.MemType = reader.ReadByte(); - jT808_JT1078_0x9B00_0x9B01.FileSize = reader.ReadUInt32(); - jT808_JT1078_0x9B00_0x9B01.AuthorizeCode = reader.ReadArray(64).ToArray(); - jT808_JT1078_0x9B00_0x9B01.GnssData = reader.ReadArray(36).ToArray(); - return jT808_JT1078_0x9B00_0x9B01; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B01 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteUTCDateTime(value.StartTime); - writer.WriteUTCDateTime(value.EndTime); - writer.WriteUInt64(value.AlarmType); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteUInt32(value.FileSize); - writer.WriteArray(value.AuthorizeCode); - writer.WriteArray(value.GnssData); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B02_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B02_Formatter.cs deleted file mode 100644 index d5d2a86..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B02_Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9B00_0x9B02_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9B00_0x9B02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B02 jT808_JT1078_0x9B00_0x9B02 = new JT809_JT1078_0x9B00_0x9B02(); - jT808_JT1078_0x9B00_0x9B02.Result = reader.ReadByte(); - jT808_JT1078_0x9B00_0x9B02.SessionId = reader.ReadUInt16(); - return jT808_JT1078_0x9B00_0x9B02; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B02 value, IJT809Config config) - { - writer.WriteByte(value.Result); - writer.WriteUInt16(value.SessionId); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj index ad46298..6ecefec 100644 --- a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj +++ b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj @@ -19,6 +19,14 @@ LICENSE + + JT809.Protocol.Extensions.JT1078.xml + + + + JT809.Protocol.Extensions.JT1078.xml + + True @@ -27,7 +35,7 @@ - + diff --git a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml new file mode 100644 index 0000000..c13acbb --- /dev/null +++ b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml @@ -0,0 +1,746 @@ + + + + JT809.Protocol.Extensions.JT1078 + + + + + 主链路时效口令业务类 + UP_AUTHORIZE_MSG + + + + + 从链路时效口令业务类 + DOWN_AUTHORIZE_MSG + + + + + 主链路实时音视频业务类 + UP_REALVIDEO_MSG + + + + + 从链路实时音视频业务类 + DOWN_REALVIDEO_MSG + + + + + 主链路远程录像检索业务类 + UP_SEARCH_MSG + + + + + 从链路远程录像检索业务类 + DOWN_SEARCH_MSG + + + + + 主链路远程录像回放业务类 + UP_PLAYBACK_MSG + + + + + 从链路远程录像回放业务类 + DOWN_PLAYBACK_MSG + + + + + 主链路远程录像下载业务类 + UP_DOWNLOAD_MSG + + + + + 从链路远程录像下载业务类 + DOWN_DOWNLOAD_MSG + + + + + 时效口令上报消息 + UP_AUTHRIZE_MSG_STARTUP + + + + + 时效口令请求消息 + UP_AUTHRIZE_MSG_STARTUP_REQ + + + + + 时效口令请求应答消息 + DOWN_AUTHRIZE_MSG_STARTUP_REQ_ACK + + + + + 实时音视频请求应答消息 + UP_REALVIDEO_MSG_STARTUP_ACK + + + + + 主动请求停止实时音视频传输应答消息 + UP_REALVIDEO_MSG_END_ACK + + + + + 实时音视频请求消息 + DOWN_REALVIDEO_MSG_STARTUP + + + + + 主动请求停止实时音视频传输消息 + DOWN_REALVIDEO_MSG_END + + + + + 主动上传音视频资源目录信息消息 + UP_FILELIST_MSG + + + + + 查询音视频资源目录应答消息 + UP_REALVIDEO_FILELIST_REQ_ACK + + + + + 主动上传音视频资源目录信息应答消息 + DOWN_FILELIST_MSG_ACK + + + + + 查询音视频资源目录请求消息 + DOWN_REALVIDEO_FILELIST_REQ + + + + + 远程录像回放请求应答消息 + UP_PLAYBACK_MSG_STARTUP_ACK + + + + + 远程录像回放控制应答消息 + UP_PLAYBACK_MSG_CONTROL_ACK + + + + + 远程录像回放请求消息 + DOWN_PLAYBACK_MSG_STARTUP + + + + + 远程录像回放控制消息 + DOWN_PLAYBACK_MSG_CONTROL + + + + + 远程录像下载请求应答消息 + UP_DOWNLOAD_MSG_STARTUP_ACK + + + + + 远程录像下载通知消息 + UP_DOWNLOAD_MSG_END_INFORM + + + + + 远程录像下载控制应答消息 + UP_DOWNLOAD_MSG_CONTROL_ACK + + + + + 远程录像下载请求消息 + DOWN_DOWNLOAD_MSG_STARTUP + + + + + 远程录像下载完成通知应答消息 + UP_DWONLOAD_MSG_END_INFORM_ACK + + + + + 远程录像下载控制消息 + DWON_DOWNLOAD_MSG_CONTROL + + + + + 主链路时效口令交互消息 + + + + + 时效口令上报消息 + + + + + 企业视频监控平台唯一编码,平台所属企业行政区域代码+平台公共编号 + + + + + 归属地区政府平台使用的时效口令 + + + + + 跨域地区政府平台使用的时效口令 + + + + + 时效口令请求消息 + + + + + 主链路实时音视频交互消息 + + + + + 实时音视频请求应答消息 + + + + + 应答结果 + + + + + 企业视频服务器ip地址 + 32 + + + + + 企业视频服务器端口号 + + + + + 主动请求停止实时音视频传输应答消息 + + + + + 应答结果 + + + + + 主链路远程录像检索交互消息 + + + + + 主动上传音视频资源目录信息消息 + + + + + 资源目录项数目 + + + + + 资源目录项列表 + + + + + 查询音视频资源目录应答消息 + + + + + 应答结果 + + + + + 资源目录项数目 + + + + + 资源目录项列表 + 与JT808_JT1078_0x1900_0x1901共用同一个子类 + + + + + 上传音视频资源目录项 + + + + + 逻辑通道号 + + + + + UTC时间 开始 + + + + + UTC时间 结束 + + + + + 报警标志物 + + + + + 音视频类型 + + + + + 码流类型 + + + + + 存储器类型 + + + + + 文件大小 + + + + + 主链路远程录像回放交互消息 + + + + + 远程录像回放请求应答消息 + + + + + 企业视频服务器ip地址 + 32 + + + + + 企业视频服务器端口号 + + + + + 应答结果 + + + + + 远程录像回放控制应答消息 + + + + + 应答结果 + + + + + 主链路远程录像下载交互消息 + + + + + 远程录像下载请求应答消息 + + + + + 应答结果 + + + + + 对应平台文件上传消息的流水号 + + + + + 远程录像下载通知消息 + + + + + 应答结果 + + + + + 对应平台文件上传消息的流水号 + + + + + FTP服务器ip地址 + + + + + FTP服务器端口 + + + + + FTP用户名 + 49 + + + + + FTP密码 + 22 + + + + + 文件存储路径 + 200 + + + + + 远程录像下载控制应答消息 + + + + + 应答结果 + + + + + 从链路时效口令交互消息 + + + + + 时效口令请求应答消息 + + + + + 从链路实时音视频交互信息 + + + + + 实时音视频请求消息 + + + + + 逻辑通道号 + + + + + 音视频类型 + + + + + 时效口令 + + + + + 车辆进入跨域地区后5min之内的任何位置,仅跨域访问请求时使用此字段 + + + + + 主动请求停止实时音视频传输消息 + + + + + 逻辑通道号 + + + + + 音视频类型 + + + + + 从链路远程录像检索交互消息 + + + + + 主动上传音视频资源目录信息应答消息 + + + + + 应答结果 + + + + + 资源目录总数 + + + + + 查询音视频资源目录请求消息 + + + + + 逻辑通道号 + + + + + 起始时间 + + + + + 终止时间 + + + + + 报警类型 + + + + + 音视频类型 + + + + + 码流类型 + + + + + 存储器类型 + + + + + 时效口令 + 64 + + + + + 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 + 36 + + + + + 从链路远程录像回放交互消息 + + + + + 远程录像回放请求消息 + + + + + 逻辑通道号 + + + + + 音视频类型 + + + + + 码流类型 + + + + + 存储器类型 + + + + + 回放起始时间 + + + + + 回放结束时间 + + + + + 时效口令 + 64 + + + + + 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 + 36 + + + + + 远程录像回放控制消息 + + + + + 控制类型 + + + + + 快进或倒退倍数 + + + + + 拖动位置 + + + + + 从链路远程录像下载交互消息 + + + + + 远程录像下载请求消息 + + + + + 逻辑通道号 + + + + + 起始时间 + + + + + 终止时间 + + + + + 报警类型 + + + + + 音视频类型 + + + + + 码流类型 + + + + + 存储器类型 + + + + + 文件大小 byte + + + + + 时效口令 + 64 + + + + + 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 + 36 + + + + + 远程录像下载完成通知应答消息 + + + + + 应答结果 + + + + + 对应平台文件上传消息的流水号 + + + + + 远程录像下载控制消息 + + + + + 对应平台文件上传消息的流水号 + + + + + 控制类型 + + + + diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs index 29ef4d3..26ad5f7 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs @@ -1,5 +1,8 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,9 +12,68 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 主链路时效口令交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x1700 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x1700 : JT809ExchangeMessageBodies,IJT809MessagePackFormatter { + public override ushort MsgId { get; }=JT809_JT1078_BusinessType.主链路时效口令业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; + + public override string Description { get; }= "主链路时效口令交互消息"; + + public JT809_JT1078_0x1700 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1700 value = new JT809_JT1078_0x1700(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1700 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs index 50e11c7..cd6a687 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs @@ -1,5 +1,6 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,8 +10,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 时效口令上报消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1700_0x1701_Formatter))] - public class JT809_JT1078_0x1700_0x1701 : JT809SubBodies + public class JT809_JT1078_0x1700_0x1701 : JT809SubBodies,IJT809MessagePackFormatter { /// /// 企业视频监控平台唯一编码,平台所属企业行政区域代码+平台公共编号 @@ -24,5 +24,25 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 跨域地区政府平台使用的时效口令 /// public byte[] AuthorizeCode2 { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.时效口令上报消息.ToUInt16Value(); + + public override string Description { get; }= "时效口令上报消息"; + + public JT809_JT1078_0x1700_0x1701 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1700_0x1701 jT808_JT1078_0X1701 = new JT809_JT1078_0x1700_0x1701(); + jT808_JT1078_0X1701.PlateFormId = reader.ReadArray(11).ToArray(); + jT808_JT1078_0X1701.AuthorizeCode1 = reader.ReadArray(64).ToArray(); + jT808_JT1078_0X1701.AuthorizeCode2 = reader.ReadArray(64).ToArray(); + return jT808_JT1078_0X1701; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1700_0x1701 value, IJT809Config config) + { + writer.WriteArray(value.PlateFormId); + writer.WriteArray(value.AuthorizeCode1); + writer.WriteArray(value.AuthorizeCode2); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs index c2ee189..00128f4 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs @@ -1,5 +1,4 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; using System; using System.Collections.Generic; using System.Text; @@ -9,9 +8,12 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 时效口令请求消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1700_0x1702_Formatter))] public class JT809_JT1078_0x1700_0x1702 : JT809SubBodies { - + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.时效口令请求消息.ToUInt16Value(); + + public override string Description => "时效口令请求消息"; + + public override bool SkipSerialization { get; set; } = true; } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs index 98e8a63..8452cd6 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs @@ -1,5 +1,7 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,9 +11,68 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 主链路实时音视频交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x1800 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x1800 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } + public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; + + public override string Description { get; } = "主链路实时音视频交互消息"; + + public JT809_JT1078_0x1800 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1800 value = new JT809_JT1078_0x1800(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs index dc67303..1c55619 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs @@ -1,5 +1,6 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,8 +10,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 实时音视频请求应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1800_0x1801_Formatter))] - public class JT809_JT1078_0x1800_0x1801 : JT809SubBodies + public class JT809_JT1078_0x1800_0x1801 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 @@ -25,5 +25,25 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 企业视频服务器端口号 /// public ushort ServerPort { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.实时音视频请求应答消息.ToUInt16Value(); + + public override string Description { get; } = "实时音视频请求应答消息"; + + public JT809_JT1078_0x1800_0x1801 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1800_0x1801 jT808_JT1078_0x1800_0x1801 = new JT809_JT1078_0x1800_0x1801(); + jT808_JT1078_0x1800_0x1801.Result = reader.ReadByte(); + jT808_JT1078_0x1800_0x1801.ServerIp = reader.ReadString(32); + jT808_JT1078_0x1800_0x1801.ServerPort = reader.ReadUInt16(); + return jT808_JT1078_0x1800_0x1801; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800_0x1801 value, IJT809Config config) + { + writer.WriteByte(value.Result); + writer.WriteStringPadLeft(value.ServerIp, 32); + writer.WriteUInt16(value.ServerPort); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs index d836f57..732b789 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs @@ -1,5 +1,6 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,12 +10,27 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 主动请求停止实时音视频传输应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1800_0x1802_Formatter))] - public class JT809_JT1078_0x1800_0x1802 : JT809SubBodies + public class JT809_JT1078_0x1800_0x1802 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 /// public byte Result { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输应答消息.ToUInt16Value(); + + public override string Description { get; } = "主动请求停止实时音视频传输应答消息"; + + public JT809_JT1078_0x1800_0x1802 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1800_0x1802 jT808_JT1078_0x1800_0x1802 = new JT809_JT1078_0x1800_0x1802(); + jT808_JT1078_0x1800_0x1802.Result = reader.ReadByte(); + return jT808_JT1078_0x1800_0x1802; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800_0x1802 value, IJT809Config config) + { + writer.WriteByte(value.Result); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs index 52dcb18..dee85a7 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs @@ -1,5 +1,8 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,9 +12,68 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 主链路远程录像检索交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x1900 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x1900 : JT809ExchangeMessageBodies,IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.主链路远程录像检索业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; + + public override string Description { get; } = "主链路远程录像检索交互消息"; + + public JT809_JT1078_0x1900 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1900 value = new JT809_JT1078_0x1900(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs index f41b48b..9521ad6 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs @@ -1,16 +1,14 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System.Collections.Generic; -using System.Text; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 主动上传音视频资源目录信息消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1900_0x1901_Formatter))] - public class JT809_JT1078_0x1900_0x1901 : JT809SubBodies + public class JT809_JT1078_0x1900_0x1901 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 资源目录项数目 @@ -20,5 +18,40 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 资源目录项列表 /// public List ItemList { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息消息.ToUInt16Value(); + + public override string Description { get; } = "主动上传音视频资源目录信息消息"; + + public JT809_JT1078_0x1900_0x1901 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1900_0x1901 jT808_JT1078_0x1900_0x1901 = new JT809_JT1078_0x1900_0x1901(); + jT808_JT1078_0x1900_0x1901.ItemNum = reader.ReadUInt32(); + if (jT808_JT1078_0x1900_0x1901.ItemNum > 0) + { + List jT808_JT1078_0x1900_0x1901_RecordList = new List(); + var formatter = config.GetMessagePackFormatter(); + for (int i = 0; i < jT808_JT1078_0x1900_0x1901.ItemNum; i++) + { + var jT808_JT1078_0x1900_0x1901_Record = formatter.Deserialize(ref reader, config); + jT808_JT1078_0x1900_0x1901_RecordList.Add(jT808_JT1078_0x1900_0x1901_Record); + } + jT808_JT1078_0x1900_0x1901.ItemList = jT808_JT1078_0x1900_0x1901_RecordList; + } + return jT808_JT1078_0x1900_0x1901; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_0x1901 value, IJT809Config config) + { + writer.WriteUInt32(value.ItemNum); + if (value.ItemList.Count > 0) + { + var formatter = config.GetMessagePackFormatter(); + foreach (var item in value.ItemList) + { + formatter.Serialize(ref writer, item, config); + } + } + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs index 3b704e8..b37c2ad 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs @@ -1,16 +1,14 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System.Collections.Generic; -using System.Text; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 查询音视频资源目录应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1900_0x1902_Formatter))] - public class JT809_JT1078_0x1900_0x1902 : JT809SubBodies + public class JT809_JT1078_0x1900_0x1902 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 @@ -25,5 +23,42 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 与JT808_JT1078_0x1900_0x1901共用同一个子类 /// public List ItemList { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.查询音视频资源目录应答消息.ToUInt16Value(); + + public override string Description { get; } = "查询音视频资源目录应答消息"; + + public JT809_JT1078_0x1900_0x1902 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1900_0x1902 jT808_JT1078_0x1900_0x1902 = new JT809_JT1078_0x1900_0x1902(); + jT808_JT1078_0x1900_0x1902.Result = reader.ReadByte(); + jT808_JT1078_0x1900_0x1902.ItemNum = reader.ReadUInt32(); + if (jT808_JT1078_0x1900_0x1902.ItemNum > 0) + { + List jT808_JT1078_0x1900_0x1901_RecordList = new List(); + var formatter = config.GetMessagePackFormatter(); + for (int i = 0; i < jT808_JT1078_0x1900_0x1902.ItemNum; i++) + { + var jT808_JT1078_0x1900_0x1901_Record = formatter.Deserialize(ref reader, config); + jT808_JT1078_0x1900_0x1901_RecordList.Add(jT808_JT1078_0x1900_0x1901_Record); + } + jT808_JT1078_0x1900_0x1902.ItemList = jT808_JT1078_0x1900_0x1901_RecordList; + } + return jT808_JT1078_0x1900_0x1902; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_0x1902 value, IJT809Config config) + { + writer.WriteByte(value.Result); + writer.WriteUInt32(value.ItemNum); + if (value.ItemList.Count > 0) + { + var formatter = config.GetMessagePackFormatter(); + foreach (var item in value.ItemList) + { + formatter.Serialize(ref writer, item, config); + } + } + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs index 91471aa..f4869e7 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs @@ -1,5 +1,5 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,8 +9,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 上传音视频资源目录项 /// - [JT809Formatter(typeof(JT809_JT1078_0x1900_0x1901_Record_Formatter))] - public class JT809_JT1078_0x1900_Record + public class JT809_JT1078_0x1900_Record : IJT809MessagePackFormatter { /// /// 逻辑通道号 @@ -27,7 +26,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 报警标志物 /// - public UInt64 AlarmType { get; set; } + public ulong AlarmType { get; set; } /// /// 音视频类型 /// @@ -44,5 +43,30 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 文件大小 /// public uint FileSize { get; set; } + public JT809_JT1078_0x1900_Record Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1900_Record jT808_JT1078_0x1900_0x1901_Record = new JT809_JT1078_0x1900_Record(); + jT808_JT1078_0x1900_0x1901_Record.ChannelId = reader.ReadByte(); + jT808_JT1078_0x1900_0x1901_Record.StartTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x1900_0x1901_Record.EndTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x1900_0x1901_Record.AlarmType = reader.ReadUInt64(); + jT808_JT1078_0x1900_0x1901_Record.AVItemType = reader.ReadByte(); + jT808_JT1078_0x1900_0x1901_Record.StreamType = reader.ReadByte(); + jT808_JT1078_0x1900_0x1901_Record.MemType = reader.ReadByte(); + jT808_JT1078_0x1900_0x1901_Record.FileSize = reader.ReadUInt32(); + return jT808_JT1078_0x1900_0x1901_Record; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_Record value, IJT809Config config) + { + writer.WriteByte(value.ChannelId); + writer.WriteUTCDateTime(value.StartTime); + writer.WriteUTCDateTime(value.EndTime); + writer.WriteUInt64(value.AlarmType); + writer.WriteByte(value.AVItemType); + writer.WriteByte(value.StreamType); + writer.WriteByte(value.MemType); + writer.WriteUInt32(value.FileSize); + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs index e506f8a..605f619 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs @@ -1,17 +1,76 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 主链路远程录像回放交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x1A00 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x1A00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.主链路远程录像回放业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; + + public override string Description { get; } = "主链路远程录像回放交互消息"; + + public JT809_JT1078_0x1A00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1A00 value = new JT809_JT1078_0x1A00(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs index afcb9df..5d0fac2 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs @@ -1,5 +1,6 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,8 +10,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 远程录像回放请求应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1A00_0x1A01_Formatter))] - public class JT809_JT1078_0x1A00_0x1A01 : JT809SubBodies + public class JT809_JT1078_0x1A00_0x1A01 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 企业视频服务器ip地址 @@ -25,5 +25,25 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 应答结果 /// public byte Result { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放请求应答消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像回放请求应答消息"; + + public JT809_JT1078_0x1A00_0x1A01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1A00_0x1A01 jT808_JT1078_0x1A00_0x1A01 = new JT809_JT1078_0x1A00_0x1A01(); + jT808_JT1078_0x1A00_0x1A01.ServerIp = reader.ReadString(32); + jT808_JT1078_0x1A00_0x1A01.ServerPort = reader.ReadUInt16(); + jT808_JT1078_0x1A00_0x1A01.Result = reader.ReadByte(); + return jT808_JT1078_0x1A00_0x1A01; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00_0x1A01 value, IJT809Config config) + { + writer.WriteStringPadLeft(value.ServerIp, 32); + writer.WriteUInt16(value.ServerPort); + writer.WriteByte(value.Result); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs index 5e7dc2e..b4c8b32 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs @@ -1,20 +1,33 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 远程录像回放控制应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1A00_0x1A02_Formatter))] - public class JT809_JT1078_0x1A00_0x1A02 : JT809SubBodies + public class JT809_JT1078_0x1A00_0x1A02 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 /// public byte Result { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放控制应答消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像回放控制应答消息"; + + public JT809_JT1078_0x1A00_0x1A02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1A00_0x1A02 jT808_JT1078_0x1A00_0x1A02 = new JT809_JT1078_0x1A00_0x1A02(); + jT808_JT1078_0x1A00_0x1A02.Result = reader.ReadByte(); + return jT808_JT1078_0x1A00_0x1A02; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00_0x1A02 value, IJT809Config config) + { + writer.WriteByte(value.Result); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs index 6c61496..0a37b2d 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs @@ -1,17 +1,77 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 主链路远程录像下载交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x1B00 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x1B00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.主链路远程录像下载业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; + + public override string Description { get; } = "主链路远程录像下载交互消息"; + + + public JT809_JT1078_0x1B00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1B00 value = new JT809_JT1078_0x1B00(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs index b4ec493..fa75990 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs @@ -1,5 +1,6 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,8 +10,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 远程录像下载请求应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1B00_0x1B01_Formatter))] - public class JT809_JT1078_0x1B00_0x1B01 : JT809SubBodies + public class JT809_JT1078_0x1B00_0x1B01 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 @@ -20,5 +20,23 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 对应平台文件上传消息的流水号 /// public ushort SessionId { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载请求应答消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像下载请求应答消息"; + + public JT809_JT1078_0x1B00_0x1B01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1B00_0x1B01 jT808_JT1078_0x1B00_0x1B01 = new JT809_JT1078_0x1B00_0x1B01(); + jT808_JT1078_0x1B00_0x1B01.Result = reader.ReadByte(); + jT808_JT1078_0x1B00_0x1B01.SessionId = reader.ReadUInt16(); + return jT808_JT1078_0x1B00_0x1B01; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B01 value, IJT809Config config) + { + writer.WriteByte(value.Result); + writer.WriteUInt16(value.SessionId); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs index 519ce6b..0faf8e0 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs @@ -1,16 +1,13 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 远程录像下载通知消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1B00_0x1B02_Formatter))] - public class JT809_JT1078_0x1B00_0x1B02 : JT809SubBodies + public class JT809_JT1078_0x1B00_0x1B02 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 @@ -43,5 +40,33 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 200 /// public string FilePath { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载通知消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像下载通知消息"; + + public JT809_JT1078_0x1B00_0x1B02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1B00_0x1B02 jT808_JT1078_0x1B00_0x1B02 = new JT809_JT1078_0x1B00_0x1B02(); + jT808_JT1078_0x1B00_0x1B02.Result = reader.ReadByte(); + jT808_JT1078_0x1B00_0x1B02.SessionId = reader.ReadUInt16(); + jT808_JT1078_0x1B00_0x1B02.ServerIp = reader.ReadString(32); + jT808_JT1078_0x1B00_0x1B02.TcpPort = reader.ReadUInt16(); + jT808_JT1078_0x1B00_0x1B02.UserName = reader.ReadString(49); + jT808_JT1078_0x1B00_0x1B02.Password = reader.ReadString(22); + jT808_JT1078_0x1B00_0x1B02.FilePath = reader.ReadString(200); + return jT808_JT1078_0x1B00_0x1B02; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B02 value, IJT809Config config) + { + writer.WriteByte(value.Result); + writer.WriteUInt16(value.SessionId); + writer.WriteStringPadLeft(value.ServerIp, 32); + writer.WriteUInt16(value.TcpPort); + writer.WriteStringPadLeft(value.UserName, 49); + writer.WriteStringPadLeft(value.Password, 22); + writer.WriteStringPadLeft(value.FilePath, 200); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs index 3593768..a9d3292 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs @@ -1,20 +1,33 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 远程录像下载控制应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x1B00_0x1B03_Formatter))] - public class JT809_JT1078_0x1B00_0x1B03 : JT809SubBodies + public class JT809_JT1078_0x1B00_0x1B03 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 /// public byte Result { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载控制应答消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像下载控制应答消息"; + + public JT809_JT1078_0x1B00_0x1B03 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x1B00_0x1B03 jT808_JT1078_0x1B00_0x1B01 = new JT809_JT1078_0x1B00_0x1B03(); + jT808_JT1078_0x1B00_0x1B01.Result = reader.ReadByte(); + return jT808_JT1078_0x1B00_0x1B01; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B03 value, IJT809Config config) + { + writer.WriteByte(value.Result); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs index c8d2356..67b7e58 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs @@ -1,17 +1,76 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 从链路时效口令交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x9700 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x9700 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路时效口令业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; + + public override string Description { get; } = "从链路时效口令交互消息"; + + public JT809_JT1078_0x9700 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9700 value = new JT809_JT1078_0x9700(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9700 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs index 43240a9..e93e1e3 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs @@ -1,17 +1,16 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 时效口令请求应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9700_0x9702_Formatter))] public class JT809_JT1078_0x9700_0x9702 : JT809SubBodies { + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.时效口令请求应答消息.ToUInt16Value(); + public override string Description { get; } = "时效口令请求应答消息"; + + public override bool SkipSerialization { get; set; } = true; } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs index 0a4e61a..a4989d4 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs @@ -1,17 +1,76 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 从链路实时音视频交互信息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x9800 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x9800 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路实时音视频业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; + + public override string Description { get; } = "从链路实时音视频交互信息"; + + public JT809_JT1078_0x9800 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9800 value = new JT809_JT1078_0x9800(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs index 1c2a93c..cf61c9d 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs @@ -1,16 +1,13 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 实时音视频请求消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9800_0x9801_Formatter))] - public class JT809_JT1078_0x9800_0x9801 : JT809SubBodies + public class JT809_JT1078_0x9800_0x9801 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 逻辑通道号 @@ -28,5 +25,27 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 车辆进入跨域地区后5min之内的任何位置,仅跨域访问请求时使用此字段 /// public byte[] GnssData { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.实时音视频请求消息.ToUInt16Value(); + + public override string Description { get; } = "实时音视频请求消息"; + + public JT809_JT1078_0x9800_0x9801 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9800_0x9801 jT808_JT1078_0x9800_0x9801 = new JT809_JT1078_0x9800_0x9801(); + jT808_JT1078_0x9800_0x9801.ChannelId = reader.ReadByte(); + jT808_JT1078_0x9800_0x9801.AVitemType = reader.ReadByte(); + jT808_JT1078_0x9800_0x9801.AuthorizeCode = reader.ReadArray(64).ToArray(); + jT808_JT1078_0x9800_0x9801.GnssData = reader.ReadArray(36).ToArray(); + return jT808_JT1078_0x9800_0x9801; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800_0x9801 value, IJT809Config config) + { + writer.WriteByte(value.ChannelId); + writer.WriteByte(value.AVitemType); + writer.WriteArray(value.AuthorizeCode); + writer.WriteArray(value.GnssData); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs index 2c72bc7..8ab9a48 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs @@ -1,16 +1,13 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 主动请求停止实时音视频传输消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9800_0x9802_Formatter))] - public class JT809_JT1078_0x9800_0x9802 : JT809SubBodies + public class JT809_JT1078_0x9800_0x9802 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 逻辑通道号 @@ -20,5 +17,23 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 音视频类型 /// public byte AVitemType { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输消息.ToUInt16Value(); + + public override string Description { get; } = "主动请求停止实时音视频传输消息"; + + public JT809_JT1078_0x9800_0x9802 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9800_0x9802 jT808_JT1078_0x9800_0x9802 = new JT809_JT1078_0x9800_0x9802(); + jT808_JT1078_0x9800_0x9802.ChannelId = reader.ReadByte(); + jT808_JT1078_0x9800_0x9802.AVitemType = reader.ReadByte(); + return jT808_JT1078_0x9800_0x9802; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800_0x9802 value, IJT809Config config) + { + writer.WriteByte(value.ChannelId); + writer.WriteByte(value.AVitemType); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs index 0ba950c..2f8abf5 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs @@ -1,17 +1,76 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 从链路远程录像检索交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x9900 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x9900 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路远程录像检索业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; + + public override string Description { get; } = "从链路远程录像检索交互消息"; + + public JT809_JT1078_0x9900 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9900 value = new JT809_JT1078_0x9900(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs index 8299fc9..2f92955 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs @@ -1,16 +1,13 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 主动上传音视频资源目录信息应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9900_0x9901_Formatter))] - public class JT809_JT1078_0x9900_0x9901 : JT809SubBodies + public class JT809_JT1078_0x9900_0x9901 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 应答结果 @@ -20,5 +17,23 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 资源目录总数 /// public byte ItemNumber { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息应答消息.ToUInt16Value(); + + public override string Description { get; } = "主动上传音视频资源目录信息应答消息"; + + public JT809_JT1078_0x9900_0x9901 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9900_0x9901 jT808_JT1078_0x9900_0x9901 = new JT809_JT1078_0x9900_0x9901(); + jT808_JT1078_0x9900_0x9901.Result = reader.ReadByte(); + jT808_JT1078_0x9900_0x9901.ItemNumber = reader.ReadByte(); + return jT808_JT1078_0x9900_0x9901; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900_0x9901 value, IJT809Config config) + { + writer.WriteByte(value.Result); + writer.WriteByte(value.ItemNumber); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs index 606ccc4..46b2821 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs @@ -1,16 +1,14 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; -using System.Collections.Generic; -using System.Text; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 查询音视频资源目录请求消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9900_0x9902_Formatter))] - public class JT809_JT1078_0x9900_0x9902 : JT809SubBodies + public class JT809_JT1078_0x9900_0x9902 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 逻辑通道号 @@ -27,7 +25,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 报警类型 /// - public UInt64 AlarmType { get; set; } + public ulong AlarmType { get; set; } /// /// 音视频类型 /// @@ -50,5 +48,38 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 36 /// public byte[] GnssData { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.查询音视频资源目录请求消息.ToUInt16Value(); + + public override string Description { get; } = "查询音视频资源目录请求消息"; + + public JT809_JT1078_0x9900_0x9902 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9900_0x9902 jT808_JT1078_0x9900_0x9902 = new JT809_JT1078_0x9900_0x9902(); + jT808_JT1078_0x9900_0x9902.ChannelId = reader.ReadByte(); +#warning 此处时间8个字节,暂使用utc时间代替 + jT808_JT1078_0x9900_0x9902.StartTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x9900_0x9902.EndTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x9900_0x9902.AlarmType = reader.ReadUInt64(); + jT808_JT1078_0x9900_0x9902.AVItemType = reader.ReadByte(); + jT808_JT1078_0x9900_0x9902.StreamType = reader.ReadByte(); + jT808_JT1078_0x9900_0x9902.MemType = reader.ReadByte(); + jT808_JT1078_0x9900_0x9902.AuthorizeCode = reader.ReadArray(64).ToArray(); + jT808_JT1078_0x9900_0x9902.GnssData = reader.ReadArray(36).ToArray(); + return jT808_JT1078_0x9900_0x9902; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900_0x9902 value, IJT809Config config) + { + writer.WriteByte(value.ChannelId); + writer.WriteUTCDateTime(value.StartTime); + writer.WriteUTCDateTime(value.EndTime); + writer.WriteUInt64(value.AlarmType); + writer.WriteByte(value.AVItemType); + writer.WriteByte(value.StreamType); + writer.WriteByte(value.MemType); + writer.WriteArray(value.AuthorizeCode); + writer.WriteArray(value.GnssData); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs index 7b2ac4d..8448fa4 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs @@ -1,17 +1,76 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 从链路远程录像回放交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x9A00 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x9A00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路远程录像回放业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; + + public override string Description { get; } = "从链路远程录像回放交互消息"; + + public JT809_JT1078_0x9A00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9A00 value = new JT809_JT1078_0x9A00(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs index 3d36426..9028654 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs @@ -1,16 +1,14 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; -using System.Collections.Generic; -using System.Text; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 远程录像回放请求消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9A00_0x9A01_Formatter))] - public class JT809_JT1078_0x9A00_0x9A01 : JT809SubBodies + public class JT809_JT1078_0x9A00_0x9A01 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 逻辑通道号 @@ -46,5 +44,35 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 36 /// public byte[] GnssData { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放请求消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像回放请求消息"; + + public JT809_JT1078_0x9A00_0x9A01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9A00_0x9A01 jT808_JT1078_0x9A00_0x9A01 = new JT809_JT1078_0x9A00_0x9A01(); + jT808_JT1078_0x9A00_0x9A01.ChannelId = reader.ReadByte(); + jT808_JT1078_0x9A00_0x9A01.AVItemType = reader.ReadByte(); + jT808_JT1078_0x9A00_0x9A01.StreamType = reader.ReadByte(); + jT808_JT1078_0x9A00_0x9A01.MemType = reader.ReadByte(); + jT808_JT1078_0x9A00_0x9A01.PlayBackStartTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x9A00_0x9A01.PlayBackEndTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x9A00_0x9A01.AuthorizeCode = reader.ReadArray(64).ToArray(); + jT808_JT1078_0x9A00_0x9A01.GnssData = reader.ReadArray(36).ToArray(); + return jT808_JT1078_0x9A00_0x9A01; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00_0x9A01 value, IJT809Config config) + { + writer.WriteByte(value.ChannelId); + writer.WriteByte(value.AVItemType); + writer.WriteByte(value.StreamType); + writer.WriteByte(value.MemType); + writer.WriteUTCDateTime(value.PlayBackStartTime); + writer.WriteUTCDateTime(value.PlayBackEndTime); + writer.WriteArray(value.AuthorizeCode); + writer.WriteArray(value.GnssData); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs index 77d083f..13fd3fd 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs @@ -1,16 +1,14 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; -using System.Collections.Generic; -using System.Text; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 远程录像回放控制消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9A00_0x9A02_Formatter))] - public class JT809_JT1078_0x9A00_0x9A02 : JT809SubBodies + public class JT809_JT1078_0x9A00_0x9A02 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 控制类型 @@ -24,5 +22,24 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 拖动位置 /// public DateTime DateTime { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放控制消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像回放控制消息"; + public JT809_JT1078_0x9A00_0x9A02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9A00_0x9A02 jT808_JT1078_0x9A00_0x9A02 = new JT809_JT1078_0x9A00_0x9A02(); + jT808_JT1078_0x9A00_0x9A02.ControlType = reader.ReadByte(); + jT808_JT1078_0x9A00_0x9A02.FastTime = reader.ReadByte(); + jT808_JT1078_0x9A00_0x9A02.DateTime = reader.ReadUTCDateTime(); + return jT808_JT1078_0x9A00_0x9A02; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00_0x9A02 value, IJT809Config config) + { + writer.WriteByte(value.ControlType); + writer.WriteByte(value.FastTime); + writer.WriteUTCDateTime(value.DateTime); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs index a9fdff7..21ae9ad 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs @@ -1,5 +1,8 @@ -using JT809.Protocol.Attributes; +using JT809.Protocol.Enums; +using JT809.Protocol.Exceptions; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,9 +12,68 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 从链路远程录像下载交互消息 /// - [JT809Formatter(typeof(JT809BodiesFormatter))] - public class JT809_JT1078_0x9B00 : JT809ExchangeMessageBodies + public class JT809_JT1078_0x9B00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter { + public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路远程录像下载业务类.ToUInt16Value(); + public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; + + public override string Description { get; } = "从链路远程录像下载交互消息"; + + public JT809_JT1078_0x9B00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9B00 value = new JT809_JT1078_0x9B00(); + value.VehicleNo = reader.ReadString(21); + value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); + value.SubBusinessType = reader.ReadUInt16(); + value.DataLength = reader.ReadUInt32(); + try + { + if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) + { + if (instance is JT809SubBodies subBodies) + { + if (!subBodies.SkipSerialization) + { + value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( + instance, + ref reader, config); + } + } + } + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + return value; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00 value, IJT809Config config) + { + writer.WriteStringPadRight(value.VehicleNo, 21); + writer.WriteByte((byte)value.VehicleColor); + writer.WriteUInt16(value.SubBusinessType); + try + { + // 先写入内容,然后在根据内容反写内容长度 + writer.Skip(4, out int subContentLengthPosition); + if (value.SubBodies != null) + { + if (!value.SubBodies.SkipSerialization) + { + JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( + value.SubBodies, + ref writer, value.SubBodies, + config); + } + } + writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); + } + catch + { + throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); + } + } } } diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs index d872b6c..5b727aa 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs @@ -1,5 +1,8 @@ using JT809.Protocol.Attributes; +using JT809.Protocol.Extensions.JT1078.Enums; using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,8 +12,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 远程录像下载请求消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9B00_0x9B01_Formatter))] - public class JT809_JT1078_0x9B00_0x9B01 : JT809SubBodies + public class JT809_JT1078_0x9B00_0x9B01 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 逻辑通道号 @@ -27,7 +29,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 报警类型 /// - public UInt64 AlarmType { get; set; } + public ulong AlarmType { get; set; } /// /// 音视频类型 /// @@ -54,5 +56,38 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 36 /// public byte[] GnssData { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载请求消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像下载请求消息"; + public JT809_JT1078_0x9B00_0x9B01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9B00_0x9B01 jT808_JT1078_0x9B00_0x9B01 = new JT809_JT1078_0x9B00_0x9B01(); + jT808_JT1078_0x9B00_0x9B01.ChannelId = reader.ReadByte(); + jT808_JT1078_0x9B00_0x9B01.StartTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x9B00_0x9B01.EndTime = reader.ReadUTCDateTime(); + jT808_JT1078_0x9B00_0x9B01.AlarmType = reader.ReadUInt64(); + jT808_JT1078_0x9B00_0x9B01.AVItemType = reader.ReadByte(); + jT808_JT1078_0x9B00_0x9B01.StreamType = reader.ReadByte(); + jT808_JT1078_0x9B00_0x9B01.MemType = reader.ReadByte(); + jT808_JT1078_0x9B00_0x9B01.FileSize = reader.ReadUInt32(); + jT808_JT1078_0x9B00_0x9B01.AuthorizeCode = reader.ReadArray(64).ToArray(); + jT808_JT1078_0x9B00_0x9B01.GnssData = reader.ReadArray(36).ToArray(); + return jT808_JT1078_0x9B00_0x9B01; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B01 value, IJT809Config config) + { + writer.WriteByte(value.ChannelId); + writer.WriteUTCDateTime(value.StartTime); + writer.WriteUTCDateTime(value.EndTime); + writer.WriteUInt64(value.AlarmType); + writer.WriteByte(value.AVItemType); + writer.WriteByte(value.StreamType); + writer.WriteByte(value.MemType); + writer.WriteUInt32(value.FileSize); + writer.WriteArray(value.AuthorizeCode); + writer.WriteArray(value.GnssData); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs index cf26bf2..6d3d8f8 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs @@ -1,16 +1,13 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; -using System; -using System.Collections.Generic; -using System.Text; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; namespace JT809.Protocol.Extensions.JT1078.MessageBody { /// /// 远程录像下载完成通知应答消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9B00_0x9B02_Formatter))] - public class JT809_JT1078_0x9B00_0x9B02 : JT809SubBodies + public class JT809_JT1078_0x9B00_0x9B02 : JT809SubBodies,IJT809MessagePackFormatter { /// /// 应答结果 @@ -20,5 +17,23 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 对应平台文件上传消息的流水号 /// public ushort SessionId { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载完成通知应答消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像下载完成通知应答消息"; + + public JT809_JT1078_0x9B00_0x9B02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9B00_0x9B02 jT808_JT1078_0x9B00_0x9B02 = new JT809_JT1078_0x9B00_0x9B02(); + jT808_JT1078_0x9B00_0x9B02.Result = reader.ReadByte(); + jT808_JT1078_0x9B00_0x9B02.SessionId = reader.ReadUInt16(); + return jT808_JT1078_0x9B00_0x9B02; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B02 value, IJT809Config config) + { + writer.WriteByte(value.Result); + writer.WriteUInt16(value.SessionId); + } } } \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs index c4e8f67..d1fb96a 100644 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs +++ b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs @@ -1,5 +1,6 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Formatters; +using JT809.Protocol.Extensions.JT1078.Enums; +using JT809.Protocol.Formatters; +using JT809.Protocol.MessagePack; using System; using System.Collections.Generic; using System.Text; @@ -9,8 +10,7 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// /// 远程录像下载控制消息 /// - [JT809Formatter(typeof(JT809_JT1078_0x9B00_0x9B03_Formatter))] - public class JT809_JT1078_0x9B00_0x9B03 : JT809SubBodies + public class JT809_JT1078_0x9B00_0x9B03 : JT809SubBodies, IJT809MessagePackFormatter { /// /// 对应平台文件上传消息的流水号 @@ -20,5 +20,23 @@ namespace JT809.Protocol.Extensions.JT1078.MessageBody /// 控制类型 /// public byte Type { get; set; } + + public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载控制消息.ToUInt16Value(); + + public override string Description { get; } = "远程录像下载控制消息"; + + public JT809_JT1078_0x9B00_0x9B03 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) + { + JT809_JT1078_0x9B00_0x9B03 jT808_JT1078_0x9B00_0x9B03 = new JT809_JT1078_0x9B00_0x9B03(); + jT808_JT1078_0x9B00_0x9B03.SessionId = reader.ReadUInt16(); + jT808_JT1078_0x9B00_0x9B03.Type = reader.ReadByte(); + return jT808_JT1078_0x9B00_0x9B03; + } + + public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B03 value, IJT809Config config) + { + writer.WriteUInt16(value.SessionId); + writer.WriteByte(value.Type); + } } } \ No newline at end of file