@@ -1,7 +1,7 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFrameworks>net472;netcoreapp3.0;</TargetFrameworks> | |||
<TargetFramework>netcoreapp3.0</TargetFramework> | |||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
<OutputType>Exe</OutputType> | |||
@@ -14,8 +14,8 @@ | |||
<None Remove="ReportTest\**" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" /> | |||
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.11.5" /> | |||
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" /> | |||
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.12.0" /> | |||
<PackageReference Include="NETStandard.Library" Version="2.0.3" /> | |||
<PackageReference Include="System.Buffers" Version="4.5.0" /> | |||
<PackageReference Include="System.Memory" Version="4.5.3" /> | |||
@@ -33,6 +33,7 @@ | |||
<Compile Include="MessageBody\JT808_0x0003Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0100Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0102Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0104Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0107Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0108Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x0200Test.cs" /> | |||
@@ -57,6 +58,8 @@ | |||
<Compile Include="MessageBody\JT808_0x8001Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8003Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8100Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8103CustomIdExtensions\JT808_0x8103_0x0075.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8103Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8104Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8105Test.cs" /> | |||
<Compile Include="MessageBody\JT808_0x8106Test.cs" /> | |||
@@ -1,26 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Test.MessageBody.JT808_0X8900_BodiesImpl; | |||
using System; | |||
namespace JT808.Protocol.Test.MessageBody.JT808Formatters | |||
{ | |||
public class JT808_0X8900_Test_BodiesImplFormatter : IJT808MessagePackFormatter<JT808_0X8900_Test_BodiesImpl> | |||
{ | |||
public JT808_0X8900_Test_BodiesImpl Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0X8900_Test_BodiesImpl jT808_0X8900_Test_BodiesImpl = new JT808_0X8900_Test_BodiesImpl(); | |||
jT808_0X8900_Test_BodiesImpl.Id = reader.ReadUInt32(); | |||
jT808_0X8900_Test_BodiesImpl.Sex = reader.ReadByte(); | |||
return jT808_0X8900_Test_BodiesImpl; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0X8900_Test_BodiesImpl value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.Id); | |||
writer.WriteByte(value.Sex); | |||
} | |||
} | |||
} |
@@ -1,32 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Test.JT808LocationAttach; | |||
using System; | |||
namespace JT808.Protocol.Test.JT808Formatters.MessageBodyFormatters.JT808LocationAttach | |||
{ | |||
public class JT808_0x0200_0x06Formatter : IJT808MessagePackFormatter<JT808LocationAttachImpl0x06> | |||
{ | |||
public JT808LocationAttachImpl0x06 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808LocationAttachImpl0x06 jT808LocationAttachImpl0x06 = new JT808LocationAttachImpl0x06(); | |||
jT808LocationAttachImpl0x06.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x06.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x06.Age = reader.ReadInt32(); | |||
jT808LocationAttachImpl0x06.Gender = reader.ReadByte(); | |||
jT808LocationAttachImpl0x06.UserName = reader.ReadRemainStringContent(); | |||
return jT808LocationAttachImpl0x06; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808LocationAttachImpl0x06 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteInt32(value.Age); | |||
writer.WriteByte(value.Gender); | |||
writer.WriteString(value.UserName); | |||
} | |||
} | |||
} |
@@ -1,30 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Test.MessageBody.JT808_0x0701BodiesImpl; | |||
using System; | |||
namespace JT808.Protocol.Test.MessageBody.JT808Formatters | |||
{ | |||
public class JT808_0x0701TestBodiesImplFormatter : IJT808MessagePackFormatter<JT808_0x0701TestBodiesImpl> | |||
{ | |||
public JT808_0x0701TestBodiesImpl Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0701TestBodiesImpl jT808_0X0701TestBodiesImpl = new JT808_0x0701TestBodiesImpl(); | |||
jT808_0X0701TestBodiesImpl.Id = reader.ReadUInt32(); | |||
jT808_0X0701TestBodiesImpl.UserNameLength = reader.ReadUInt16(); | |||
jT808_0X0701TestBodiesImpl.UserName = reader.ReadString(jT808_0X0701TestBodiesImpl.UserNameLength); | |||
return jT808_0X0701TestBodiesImpl; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0701TestBodiesImpl value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.Id); | |||
writer.Skip(2,out int position); | |||
writer.WriteString(value.UserName); | |||
int strLength = writer.GetCurrentPosition() - position - 2; | |||
writer.WriteUInt16Return((ushort)strLength, position); | |||
} | |||
} | |||
} |
@@ -1,24 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Test.JT808_0x0900_BodiesImpl; | |||
using System; | |||
namespace JT808.Protocol.Test.MessageBody.JT808Formatters | |||
{ | |||
public class JT808_0x0900_0x83Formatter : IJT808MessagePackFormatter<JT808_0x0900_0x83> | |||
{ | |||
public JT808_0x0900_0x83 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0900_0x83 jT808PassthroughType0x83 = new JT808_0x0900_0x83(); | |||
jT808PassthroughType0x83.PassthroughContent = reader.ReadRemainStringContent(); | |||
return jT808PassthroughType0x83; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0900_0x83 value, IJT808Config config) | |||
{ | |||
writer.WriteString(value.PassthroughContent); | |||
} | |||
} | |||
} |
@@ -1,51 +0,0 @@ | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Test.MessageBody.JT808_0x8103CustomIdExtensions; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT808.Protocol.Test.MessageBody.JT808Formatters | |||
{ | |||
public class JT808_0x8103_0x0075_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0075> | |||
{ | |||
public JT808_0x8103_0x0075 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0075 jT808_0X8103_0X0075 = new JT808_0x8103_0x0075(); | |||
jT808_0X8103_0X0075.ParamId = reader.ReadUInt32(); | |||
jT808_0X8103_0X0075.ParamLength = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_EncodeMode = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_Resolution = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_KF_Interval = reader.ReadUInt16(); | |||
jT808_0X8103_0X0075.RTS_Target_FPS = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_Target_CodeRate = reader.ReadUInt32(); | |||
jT808_0X8103_0X0075.StreamStore_EncodeMode = reader.ReadByte(); | |||
jT808_0X8103_0X0075.StreamStore_Resolution = reader.ReadByte(); | |||
jT808_0X8103_0X0075.StreamStore_KF_Interval = reader.ReadUInt16(); | |||
jT808_0X8103_0X0075.StreamStore_Target_FPS = reader.ReadByte(); | |||
jT808_0X8103_0X0075.StreamStore_Target_CodeRate = reader.ReadUInt32(); | |||
jT808_0X8103_0X0075.OSD = reader.ReadUInt16(); | |||
jT808_0X8103_0X0075.AudioOutputEnabled = reader.ReadByte(); | |||
return jT808_0X8103_0X0075; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0075 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteByte(value.RTS_EncodeMode); | |||
writer.WriteByte(value.RTS_Resolution); | |||
writer.WriteUInt16(value.RTS_KF_Interval); | |||
writer.WriteByte(value.RTS_Target_FPS); | |||
writer.WriteUInt32(value.RTS_Target_CodeRate); | |||
writer.WriteByte(value.StreamStore_EncodeMode); | |||
writer.WriteByte(value.StreamStore_Resolution); | |||
writer.WriteUInt16(value.StreamStore_KF_Interval); | |||
writer.WriteByte(value.StreamStore_Target_FPS); | |||
writer.WriteUInt32(value.StreamStore_Target_CodeRate); | |||
writer.WriteUInt16(value.OSD); | |||
writer.WriteByte(value.AudioOutputEnabled); | |||
} | |||
} | |||
} |
@@ -1,6 +1,7 @@ | |||
using JT808.Protocol.Attributes; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Test.MessageBody.JT808Formatters; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
@@ -11,8 +12,7 @@ namespace JT808.Protocol.Test.MessageBody.JT808_0x8103CustomIdExtensions | |||
/// 音视频参数设置 | |||
/// 0x8103_0x0075 | |||
/// </summary> | |||
[JT808Formatter(typeof(JT808_0x8103_0x0075_Formatter))] | |||
public class JT808_0x8103_0x0075 : JT808_0x8103_CustomBodyBase | |||
public class JT808_0x8103_0x0075 : JT808_0x8103_CustomBodyBase, IJT808MessagePackFormatter<JT808_0x8103_0x0075> | |||
{ | |||
public override uint ParamId { get; set; } = 0x0075; | |||
/// <summary> | |||
@@ -73,5 +73,43 @@ namespace JT808.Protocol.Test.MessageBody.JT808_0x8103CustomIdExtensions | |||
///1:启用 | |||
/// </summary> | |||
public byte AudioOutputEnabled { get; set; } | |||
public JT808_0x8103_0x0075 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0075 jT808_0X8103_0X0075 = new JT808_0x8103_0x0075(); | |||
jT808_0X8103_0X0075.ParamId = reader.ReadUInt32(); | |||
jT808_0X8103_0X0075.ParamLength = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_EncodeMode = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_Resolution = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_KF_Interval = reader.ReadUInt16(); | |||
jT808_0X8103_0X0075.RTS_Target_FPS = reader.ReadByte(); | |||
jT808_0X8103_0X0075.RTS_Target_CodeRate = reader.ReadUInt32(); | |||
jT808_0X8103_0X0075.StreamStore_EncodeMode = reader.ReadByte(); | |||
jT808_0X8103_0X0075.StreamStore_Resolution = reader.ReadByte(); | |||
jT808_0X8103_0X0075.StreamStore_KF_Interval = reader.ReadUInt16(); | |||
jT808_0X8103_0X0075.StreamStore_Target_FPS = reader.ReadByte(); | |||
jT808_0X8103_0X0075.StreamStore_Target_CodeRate = reader.ReadUInt32(); | |||
jT808_0X8103_0X0075.OSD = reader.ReadUInt16(); | |||
jT808_0X8103_0X0075.AudioOutputEnabled = reader.ReadByte(); | |||
return jT808_0X8103_0X0075; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0075 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteByte(value.RTS_EncodeMode); | |||
writer.WriteByte(value.RTS_Resolution); | |||
writer.WriteUInt16(value.RTS_KF_Interval); | |||
writer.WriteByte(value.RTS_Target_FPS); | |||
writer.WriteUInt32(value.RTS_Target_CodeRate); | |||
writer.WriteByte(value.StreamStore_EncodeMode); | |||
writer.WriteByte(value.StreamStore_Resolution); | |||
writer.WriteUInt16(value.StreamStore_KF_Interval); | |||
writer.WriteByte(value.StreamStore_Target_FPS); | |||
writer.WriteUInt32(value.StreamStore_Target_CodeRate); | |||
writer.WriteUInt16(value.OSD); | |||
writer.WriteByte(value.AudioOutputEnabled); | |||
} | |||
} | |||
} |
@@ -132,17 +132,17 @@ namespace JT808.Protocol.Test.MessageBody | |||
CustomParamList = new List<JT808_0x8103_CustomBodyBase> { | |||
new JT808_0x8103_0x0075() { | |||
AudioOutputEnabled=1, | |||
OSD=2, | |||
RTS_EncodeMode=3, | |||
RTS_KF_Interval=4, | |||
RTS_Resolution=5, | |||
RTS_Target_CodeRate=6, | |||
RTS_Target_FPS=7, | |||
StreamStore_EncodeMode=8, | |||
StreamStore_KF_Interval=9, | |||
StreamStore_Resolution=10, | |||
StreamStore_Target_CodeRate=11, | |||
StreamStore_Target_FPS=12 | |||
OSD=2, | |||
RTS_EncodeMode=3, | |||
RTS_KF_Interval=4, | |||
RTS_Resolution=5, | |||
RTS_Target_CodeRate=6, | |||
RTS_Target_FPS=7, | |||
StreamStore_EncodeMode=8, | |||
StreamStore_KF_Interval=9, | |||
StreamStore_Resolution=10, | |||
StreamStore_Target_CodeRate=11, | |||
StreamStore_Target_FPS=12 | |||
} | |||
} | |||
}; | |||
@@ -64,7 +64,6 @@ namespace JT808.Protocol.Enums | |||
[JT808BodiesType(typeof(JT808_0x0102))] | |||
[JT808MsgIdDescription("0x0102", "终端鉴权")] | |||
终端鉴权 = 0x0102, | |||
#warning 设置终端参数 查询终端参数 查询终端参数应答 | |||
/// <summary> | |||
/// 设置终端参数 | |||
/// 0x8103 | |||
@@ -89,23 +89,23 @@ namespace JT808.Protocol.Extensions | |||
{ | |||
return Create<JT808.Protocol.MessageBody.JT808_0x0102>(msgId,terminalPhoneNo,bodies); | |||
} | |||
///// <summary> | |||
///// 0x0104 - 查询终端参数应答 | |||
///// auto-generated | |||
///// </summary> | |||
// public static JT808Package Create_查询终端参数应答(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x0104 bodies) | |||
//{ | |||
// return Create<JT808.Protocol.MessageBody.JT808_0x0104>(msgId,terminalPhoneNo,bodies); | |||
//} | |||
/// <summary> | |||
/// 0x0104 - 查询终端参数应答 | |||
/// auto-generated | |||
/// </summary> | |||
public static JT808Package Create_查询终端参数应答(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x0104 bodies) | |||
{ | |||
return Create<JT808.Protocol.MessageBody.JT808_0x0104>(msgId,terminalPhoneNo,bodies); | |||
} | |||
/// <summary> | |||
/// 0x0104 - 查询终端参数应答 | |||
/// auto-generated | |||
/// </summary> | |||
// public static JT808Package Create(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x0104 bodies) | |||
//{ | |||
// return Create<JT808.Protocol.MessageBody.JT808_0x0104>(msgId,terminalPhoneNo,bodies); | |||
//} | |||
public static JT808Package Create(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x0104 bodies) | |||
{ | |||
return Create<JT808.Protocol.MessageBody.JT808_0x0104>(msgId,terminalPhoneNo,bodies); | |||
} | |||
/// <summary> | |||
/// 0x0107 - 查询终端属性应答 | |||
/// auto-generated | |||
@@ -464,22 +464,39 @@ namespace JT808.Protocol.Extensions | |||
return Create<JT808.Protocol.MessageBody.JT808_0x8100>(msgId,terminalPhoneNo,bodies); | |||
} | |||
/// <summary> | |||
/// 0x8103 - 设置终端参数 | |||
/// auto-generated | |||
/// </summary> | |||
public static JT808Package Create_设置终端参数(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x8103 bodies) | |||
{ | |||
return Create<JT808.Protocol.MessageBody.JT808_0x8103>(msgId,terminalPhoneNo,bodies); | |||
} | |||
/// <summary> | |||
/// 0x8103 - 设置终端参数 | |||
/// auto-generated | |||
/// </summary> | |||
public static JT808Package Create(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x8103 bodies) | |||
{ | |||
return Create<JT808.Protocol.MessageBody.JT808_0x8103>(msgId,terminalPhoneNo,bodies); | |||
} | |||
/// <summary> | |||
/// 0x8104 - 查询终端参数 | |||
/// auto-generated | |||
/// </summary> | |||
// public static JT808Package Create_查询终端参数(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x8104 bodies) | |||
//{ | |||
// return Create<JT808.Protocol.MessageBody.JT808_0x8104>(msgId,terminalPhoneNo,bodies); | |||
//} | |||
public static JT808Package Create_查询终端参数(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x8104 bodies) | |||
{ | |||
return Create<JT808.Protocol.MessageBody.JT808_0x8104>(msgId,terminalPhoneNo,bodies); | |||
} | |||
/// <summary> | |||
/// 0x8104 - 查询终端参数 | |||
/// auto-generated | |||
/// </summary> | |||
// public static JT808Package Create(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x8104 bodies) | |||
//{ | |||
// return Create<JT808.Protocol.MessageBody.JT808_0x8104>(msgId,terminalPhoneNo,bodies); | |||
//} | |||
public static JT808Package Create(this JT808MsgId msgId, string terminalPhoneNo,JT808.Protocol.MessageBody.JT808_0x8104 bodies) | |||
{ | |||
return Create<JT808.Protocol.MessageBody.JT808_0x8104>(msgId,terminalPhoneNo,bodies); | |||
} | |||
/// <summary> | |||
/// 0x8105 - 终端控制 | |||
/// auto-generated | |||
@@ -1,56 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using System; | |||
using System.Buffers.Binary; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters | |||
{ | |||
/// <summary> | |||
/// JT808头部序列化器 | |||
/// </summary> | |||
public class JT808HeaderFormatter : IJT808MessagePackFormatter<JT808Header> | |||
{ | |||
public static readonly JT808HeaderFormatter Instance = new JT808HeaderFormatter(); | |||
public JT808Header Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808Header jT808Header = new JT808Header(); | |||
// 1.消息ID | |||
jT808Header.MsgId = reader.ReadUInt16(); | |||
// 2.消息体属性 | |||
jT808Header.MessageBodyProperty = new JT808HeaderMessageBodyProperty(reader.ReadUInt16()); | |||
// 3.终端手机号 | |||
jT808Header.TerminalPhoneNo = reader.ReadBCD(config.TerminalPhoneNoLength, config.Trim); | |||
jT808Header.MsgNum = reader.ReadUInt16(); | |||
// 4.判断有无分包 | |||
if (jT808Header.MessageBodyProperty.IsPackage) | |||
{ | |||
//5.读取消息包总数 | |||
jT808Header.PackgeCount = reader.ReadUInt16(); | |||
//6.读取消息包序号 | |||
jT808Header.PackageIndex = reader.ReadUInt16(); | |||
} | |||
return jT808Header; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808Header value, IJT808Config config) | |||
{ | |||
// 1.消息ID | |||
writer.WriteUInt16(value.MsgId); | |||
// 2.消息体属性 | |||
writer.WriteUInt16(value.MessageBodyProperty.Wrap()); | |||
// 3.终端手机号 | |||
writer.WriteBCD(value.TerminalPhoneNo, config.TerminalPhoneNoLength); | |||
// 4.消息流水号 | |||
writer.WriteUInt16(value.MsgNum); | |||
// 5.判断是否分包 | |||
if (value.MessageBodyProperty.IsPackage) | |||
{ | |||
// 6.消息包总数 | |||
writer.WriteUInt16(value.PackgeCount); | |||
// 7.消息包序号 | |||
writer.WriteUInt16(value.PackageIndex); | |||
} | |||
} | |||
} | |||
} |
@@ -1,65 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Exceptions; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
namespace JT808.Protocol.Formatters | |||
{ | |||
public class JT808HeaderPackageFormatter : IJT808MessagePackFormatter<JT808HeaderPackage> | |||
{ | |||
public static readonly JT808HeaderPackageFormatter Instance = new JT808HeaderPackageFormatter(); | |||
public JT808HeaderPackage Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
// 1. 验证校验和 | |||
if (!config.SkipCRCCode) | |||
{ | |||
if (!reader.CheckXorCodeVali) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.CheckCodeNotEqual, $"{reader.RealCheckXorCode}!={reader.CalculateCheckXorCode}"); | |||
} | |||
} | |||
JT808HeaderPackage jT808Package = new JT808HeaderPackage(); | |||
// ---------------开始解包-------------- | |||
// 2.读取起始位置 | |||
jT808Package.Begin = reader.ReadStart(); | |||
// 3.读取头部信息 | |||
jT808Package.Header = new JT808Header(); | |||
// 3.1.读取消息Id | |||
jT808Package.Header.MsgId = reader.ReadUInt16(); | |||
// 3.2.读取消息体属性 | |||
ushort messageBodyPropertyValue = reader.ReadUInt16(); | |||
// 3.2.1.解包消息体属性 | |||
jT808Package.Header.MessageBodyProperty = new JT808HeaderMessageBodyProperty(messageBodyPropertyValue); | |||
// 3.3.读取终端手机号 | |||
jT808Package.Header.TerminalPhoneNo = reader.ReadBCD(config.TerminalPhoneNoLength, config.Trim); | |||
// 3.4.读取消息流水号 | |||
jT808Package.Header.MsgNum = reader.ReadUInt16(); | |||
// 3.5.判断有无分包 | |||
if (jT808Package.Header.MessageBodyProperty.IsPackage) | |||
{ | |||
//3.5.1.读取消息包总数 | |||
jT808Package.Header.PackgeCount = reader.ReadUInt16(); | |||
//3.5.2.读取消息包序号 | |||
jT808Package.Header.PackageIndex = reader.ReadUInt16(); | |||
} | |||
// 4.处理数据体 | |||
// 4.1.判断有无数据体 | |||
if (jT808Package.Header.MessageBodyProperty.DataLength > 0) | |||
{ | |||
jT808Package.Bodies = reader.ReadContent().ToArray(); | |||
} | |||
// 5.读取校验码 | |||
jT808Package.CheckCode = reader.ReadByte(); | |||
// 6.读取终止位置 | |||
jT808Package.End = reader.ReadEnd(); | |||
// ---------------解包完成-------------- | |||
return jT808Package; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808HeaderPackage value, IJT808Config config) | |||
{ | |||
throw new NotImplementedException("只适用反序列化"); | |||
} | |||
} | |||
} |
@@ -1,156 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Exceptions; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
namespace JT808.Protocol.Formatters | |||
{ | |||
/// <summary> | |||
/// JT808包序列化器 | |||
/// </summary> | |||
public class JT808PackageFormatter : IJT808MessagePackFormatter<JT808Package> | |||
{ | |||
public static readonly JT808PackageFormatter Instance = new JT808PackageFormatter(); | |||
public JT808Package Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
// 1. 验证校验和 | |||
if (!config.SkipCRCCode) | |||
{ | |||
if (!reader.CheckXorCodeVali) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.CheckCodeNotEqual, $"{reader.RealCheckXorCode}!={reader.CalculateCheckXorCode}"); | |||
} | |||
} | |||
JT808Package jT808Package = new JT808Package(); | |||
// ---------------开始解包-------------- | |||
// 2.读取起始位置 | |||
jT808Package.Begin = reader.ReadStart(); | |||
// 3.读取头部信息 | |||
jT808Package.Header = new JT808Header(); | |||
// 3.1.读取消息Id | |||
jT808Package.Header.MsgId = reader.ReadUInt16(); | |||
// 3.2.读取消息体属性 | |||
jT808Package.Header.MessageBodyProperty=new JT808HeaderMessageBodyProperty(reader.ReadUInt16()); | |||
// 3.3.读取终端手机号 | |||
jT808Package.Header.TerminalPhoneNo = reader.ReadBCD(config.TerminalPhoneNoLength, config.Trim); | |||
// 3.4.读取消息流水号 | |||
jT808Package.Header.MsgNum= reader.ReadUInt16(); | |||
// 3.5.判断有无分包 | |||
if (jT808Package.Header.MessageBodyProperty.IsPackage) | |||
{ | |||
//3.5.1.读取消息包总数 | |||
jT808Package.Header.PackgeCount = reader.ReadUInt16(); | |||
//3.5.2.读取消息包序号 | |||
jT808Package.Header.PackageIndex = reader.ReadUInt16(); | |||
} | |||
// 4.处理数据体 | |||
// 4.1.判断有无数据体 | |||
if (jT808Package.Header.MessageBodyProperty.DataLength > 0) | |||
{ | |||
Type jT808BodiesImplType = config.MsgIdFactory.GetBodiesImplTypeByMsgId(jT808Package.Header.MsgId, jT808Package.Header.TerminalPhoneNo); | |||
if (jT808BodiesImplType != null) | |||
{ | |||
if (jT808Package.Header.MessageBodyProperty.IsPackage) | |||
{ | |||
if (jT808Package.Header.PackageIndex > 1) | |||
{ | |||
try | |||
{ | |||
//4.2处理第二包之后的分包数据消息体 | |||
jT808Package.Bodies = JT808SplitPackageBodiesFormatter.Instance.Deserialize(ref reader, config); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.BodiesParseError, ex); | |||
} | |||
} | |||
else | |||
{ | |||
try | |||
{ | |||
//4.2.处理消息体 | |||
jT808Package.Bodies = JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize( | |||
config.GetMessagePackFormatterByType(jT808BodiesImplType), | |||
ref reader, config); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.BodiesParseError, ex); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
try | |||
{ | |||
//4.2.处理消息体 | |||
jT808Package.Bodies = JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize( | |||
config.GetMessagePackFormatterByType(jT808BodiesImplType), | |||
ref reader, config); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.BodiesParseError, ex); | |||
} | |||
} | |||
} | |||
} | |||
// 5.读取校验码 | |||
jT808Package.CheckCode = reader.ReadByte(); | |||
// 6.读取终止位置 | |||
jT808Package.End = reader.ReadEnd(); | |||
// ---------------解包完成-------------- | |||
return jT808Package; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808Package value, IJT808Config config) | |||
{ | |||
// ---------------开始组包-------------- | |||
// 1.起始符 | |||
writer.WriteStart(); | |||
// 2.写入头部 //部分有带数据体的长度,那么先跳过写入头部部分 | |||
// 2.1.消息ID | |||
writer.WriteUInt16(value.Header.MsgId); | |||
// 2.2.消息体属性(包含消息体长度所以先跳过) | |||
writer.Skip(2,out int msgBodiesPropertyPosition); | |||
// 2.3.终端手机号 (写死大陆手机号码) | |||
writer.WriteBCD(value.Header.TerminalPhoneNo, config.TerminalPhoneNoLength); | |||
value.Header.MsgNum = value.Header.MsgNum > 0 ? value.Header.MsgNum : config.MsgSNDistributed.Increment(); | |||
// 2.4.消息流水号 | |||
writer.WriteUInt16(value.Header.MsgNum); | |||
// 2.5.判断是否分包 | |||
if (value.Header.MessageBodyProperty.IsPackage) | |||
{ | |||
// 2.5.1.消息包总数 | |||
writer.WriteUInt16(value.Header.PackgeCount); | |||
// 2.5.2.消息包序号 | |||
writer.WriteUInt16(value.Header.PackageIndex); | |||
} | |||
int headerLength = writer.GetCurrentPosition(); | |||
// 3.处理数据体部分 | |||
if (value.Bodies != null) | |||
{ | |||
if (!value.Bodies.SkipSerialization) | |||
{ | |||
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize( | |||
config.GetMessagePackFormatterByType(value.Bodies.GetType()), | |||
ref writer, value.Bodies, | |||
config); | |||
} | |||
} | |||
// 3.1.处理数据体长度 | |||
value.Header.MessageBodyProperty=new JT808HeaderMessageBodyProperty((ushort)(writer.GetCurrentPosition() - headerLength)); | |||
// 2.2.回写消息体属性 | |||
writer.WriteUInt16Return(value.Header.MessageBodyProperty.Wrap(), msgBodiesPropertyPosition); | |||
// 4.校验码 | |||
writer.WriteXor(); | |||
// 5.终止符 | |||
writer.WriteEnd(); | |||
// 6.编码 | |||
writer.WriteEncode(); | |||
// ---------------组包结束-------------- | |||
} | |||
} | |||
} |
@@ -1,25 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using System; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters | |||
{ | |||
public class JT808SplitPackageBodiesFormatter : IJT808MessagePackFormatter<JT808SplitPackageBodies> | |||
{ | |||
public static readonly JT808SplitPackageBodiesFormatter Instance = new JT808SplitPackageBodiesFormatter(); | |||
public JT808SplitPackageBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808SplitPackageBodies jT808SplitPackageBodies = new JT808SplitPackageBodies | |||
{ | |||
Data = reader.ReadContent().ToArray() | |||
}; | |||
return jT808SplitPackageBodies; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808SplitPackageBodies value, IJT808Config config) | |||
{ | |||
writer.WriteArray(value.Data); | |||
} | |||
} | |||
} |
@@ -1,26 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0001_Formatter :IJT808MessagePackFormatter<JT808_0x0001> | |||
{ | |||
public JT808_0x0001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0001 jT808_0X0001 = new JT808_0x0001(); | |||
jT808_0X0001.MsgNum = reader.ReadUInt16(); | |||
jT808_0X0001.MsgId = reader.ReadUInt16(); | |||
jT808_0X0001.JT808TerminalResult = (JT808TerminalResult)reader.ReadByte(); | |||
return jT808_0X0001; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0001 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
writer.WriteUInt16(value.MsgId); | |||
writer.WriteByte((byte)value.JT808TerminalResult); | |||
} | |||
} | |||
} |
@@ -1,35 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0100_Formatter : IJT808MessagePackFormatter<JT808_0x0100> | |||
{ | |||
public JT808_0x0100 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0100 jT808_0X0100 = new JT808_0x0100(); | |||
jT808_0X0100.AreaID = reader.ReadUInt16(); | |||
jT808_0X0100.CityOrCountyId = reader.ReadUInt16(); | |||
jT808_0X0100.MakerId = reader.ReadString(5); | |||
jT808_0X0100.TerminalModel = reader.ReadString(20); | |||
jT808_0X0100.TerminalId = reader.ReadString(7); | |||
jT808_0X0100.PlateColor = reader.ReadByte(); | |||
jT808_0X0100.PlateNo = reader.ReadRemainStringContent(); | |||
return jT808_0X0100; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0100 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.AreaID); | |||
writer.WriteUInt16(value.CityOrCountyId); | |||
writer.WriteString(value.MakerId.PadRight(5, '0')); | |||
writer.WriteString(value.TerminalModel.PadRight(20, '0')); | |||
writer.WriteString(value.TerminalId.PadRight(7, '0')); | |||
writer.WriteByte(value.PlateColor); | |||
writer.WriteString(value.PlateNo); | |||
} | |||
} | |||
} |
@@ -1,22 +0,0 @@ | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0102_Formatter : IJT808MessagePackFormatter<JT808_0x0102> | |||
{ | |||
public JT808_0x0102 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0102 jT808_0X0102 = new JT808_0x0102(); | |||
jT808_0X0102.Code = reader.ReadRemainStringContent(); | |||
return jT808_0X0102; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0102 value, IJT808Config config) | |||
{ | |||
writer.WriteString(value.Code); | |||
} | |||
} | |||
} |
@@ -1,48 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using System.Collections.Generic; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0104_Formatter : IJT808MessagePackFormatter<JT808_0x0104> | |||
{ | |||
public JT808_0x0104 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0104 jT808_0x0104 = new JT808_0x0104(); | |||
jT808_0x0104.MsgNum = reader.ReadUInt16(); | |||
jT808_0x0104.AnswerParamsCount = reader.ReadByte(); | |||
for (int i = 0; i < jT808_0x0104.AnswerParamsCount; i++) | |||
{ | |||
var paramId = reader.ReadVirtualUInt32();//参数ID | |||
if (config.JT808_0X8103_Factory.ParamMethods.TryGetValue(paramId, out Type type)) | |||
{ | |||
if (jT808_0x0104.ParamList != null) | |||
{ | |||
jT808_0x0104.ParamList.Add(JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize( | |||
config.GetMessagePackFormatterByType(type), ref reader, config)); | |||
} | |||
else | |||
{ | |||
jT808_0x0104.ParamList = new List<JT808_0x8103_BodyBase> { JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize( | |||
config.GetMessagePackFormatterByType(type), ref reader, config) }; | |||
} | |||
} | |||
} | |||
return jT808_0x0104; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0104 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
writer.WriteByte(value.AnswerParamsCount); | |||
foreach (var item in value.ParamList) | |||
{ | |||
object obj = config.GetMessagePackFormatterByType(item.GetType()); | |||
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(obj, ref writer,item, config); | |||
} | |||
} | |||
} | |||
} |
@@ -1,43 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0107_Formatter : IJT808MessagePackFormatter<JT808_0x0107> | |||
{ | |||
public JT808_0x0107 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0107 jT808_0X0107 = new JT808_0x0107(); | |||
jT808_0X0107.TerminalType = reader.ReadUInt16(); | |||
jT808_0X0107.MakerId = reader.ReadString(5); | |||
jT808_0X0107.TerminalModel = reader.ReadString(20); | |||
jT808_0X0107.TerminalId = reader.ReadString(7); | |||
jT808_0X0107.Terminal_SIM_ICCID = reader.ReadBCD(10, config.Trim); | |||
jT808_0X0107.Terminal_Hardware_Version_Length = reader.ReadByte(); | |||
jT808_0X0107.Terminal_Hardware_Version_Num = reader.ReadString(jT808_0X0107.Terminal_Hardware_Version_Length); | |||
jT808_0X0107.Terminal_Firmware_Version_Length = reader.ReadByte(); | |||
jT808_0X0107.Terminal_Firmware_Version_Num = reader.ReadString(jT808_0X0107.Terminal_Firmware_Version_Length); | |||
jT808_0X0107.GNSSModule = reader.ReadByte(); | |||
jT808_0X0107.CommunicationModule = reader.ReadByte(); | |||
return jT808_0X0107; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0107 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.TerminalType); | |||
writer.WriteString(value.MakerId.PadRight(5, '0')); | |||
writer.WriteString(value.TerminalModel.PadRight(20, '0')); | |||
writer.WriteString(value.TerminalId.PadRight(7, '0')); | |||
writer.WriteBCD(value.Terminal_SIM_ICCID, 10); | |||
writer.WriteByte((byte)value.Terminal_Hardware_Version_Num.Length); | |||
writer.WriteString(value.Terminal_Hardware_Version_Num); | |||
writer.WriteByte((byte)value.Terminal_Firmware_Version_Num.Length); | |||
writer.WriteString(value.Terminal_Firmware_Version_Num); | |||
writer.WriteByte(value.GNSSModule); | |||
writer.WriteByte(value.CommunicationModule); | |||
} | |||
} | |||
} |
@@ -1,26 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0108_Formatter : IJT808MessagePackFormatter<JT808_0x0108> | |||
{ | |||
public JT808_0x0108 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0108 jT808_0X0108 = new JT808_0x0108(); | |||
jT808_0X0108.UpgradeType = (JT808UpgradeType)reader.ReadByte(); | |||
jT808_0X0108.UpgradeResult = (JT808UpgradeResult)reader.ReadByte(); | |||
return jT808_0X0108; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0108 value, IJT808Config config) | |||
{ | |||
writer.WriteByte((byte)value.UpgradeType); | |||
writer.WriteByte((byte)value.UpgradeResult); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x01_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x01> | |||
{ | |||
public JT808_0x0200_0x01 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x01 jT808LocationAttachImpl0X01 = new JT808_0x0200_0x01(); | |||
jT808LocationAttachImpl0X01.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0X01.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0X01.Mileage = reader.ReadInt32(); | |||
return jT808LocationAttachImpl0X01; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x01 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteInt32(value.Mileage); | |||
} | |||
} | |||
} |
@@ -1,25 +0,0 @@ | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x02_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x02> | |||
{ | |||
public JT808_0x0200_0x02 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x02 jT808LocationAttachImpl0X02 = new JT808_0x0200_0x02(); | |||
jT808LocationAttachImpl0X02.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0X02.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0X02.Oil = reader.ReadUInt16(); | |||
return jT808LocationAttachImpl0X02; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x02 value, IJT808Config config) | |||
{ | |||
writer.WriteByte( value.AttachInfoId); | |||
writer.WriteByte( value.AttachInfoLength); | |||
writer.WriteUInt16( value.Oil); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x03_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x03> | |||
{ | |||
public JT808_0x0200_0x03 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x03 jT808LocationAttachImpl0x03 = new JT808_0x0200_0x03(); | |||
jT808LocationAttachImpl0x03.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x03.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x03.Speed = reader.ReadUInt16(); | |||
return jT808LocationAttachImpl0x03; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x03 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteUInt16(value.Speed); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x04_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x04> | |||
{ | |||
public JT808_0x0200_0x04 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x04 jT808LocationAttachImpl0x04 = new JT808_0x0200_0x04(); | |||
jT808LocationAttachImpl0x04.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x04.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x04.EventId = reader.ReadUInt16(); | |||
return jT808LocationAttachImpl0x04; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x04 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteUInt16(value.EventId); | |||
} | |||
} | |||
} |
@@ -1,36 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x11_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x11> | |||
{ | |||
public JT808_0x0200_0x11 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x11 jT808LocationAttachImpl0x11 = new JT808_0x0200_0x11(); | |||
jT808LocationAttachImpl0x11.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x11.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x11.JT808PositionType = (JT808PositionType)reader.ReadByte(); | |||
if(jT808LocationAttachImpl0x11.JT808PositionType != JT808PositionType.无特定位置) | |||
{ | |||
jT808LocationAttachImpl0x11.AreaId = reader.ReadInt32(); | |||
} | |||
return jT808LocationAttachImpl0x11; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x11 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteByte((byte)value.JT808PositionType); | |||
if (value.JT808PositionType != JT808PositionType.无特定位置) | |||
{ | |||
writer.WriteInt32(value.AreaId); | |||
} | |||
} | |||
} | |||
} |
@@ -1,32 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x12_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x12> | |||
{ | |||
public JT808_0x0200_0x12 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x12 jT808LocationAttachImpl0x12 = new JT808_0x0200_0x12(); | |||
jT808LocationAttachImpl0x12.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x12.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x12.JT808PositionType = (JT808PositionType)reader.ReadByte(); | |||
jT808LocationAttachImpl0x12.AreaId = reader.ReadInt32(); | |||
jT808LocationAttachImpl0x12.Direction = (JT808DirectionType)reader.ReadByte(); | |||
return jT808LocationAttachImpl0x12; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x12 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteByte((byte)value.JT808PositionType); | |||
writer.WriteInt32(value.AreaId); | |||
writer.WriteByte((byte)value.Direction); | |||
} | |||
} | |||
} |
@@ -1,32 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x13_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x13> | |||
{ | |||
public JT808_0x0200_0x13 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x13 jT808LocationAttachImpl0x13 = new JT808_0x0200_0x13(); | |||
jT808LocationAttachImpl0x13.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x13.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x13.DrivenRouteId = reader.ReadInt32(); | |||
jT808LocationAttachImpl0x13.Time = reader.ReadUInt16(); | |||
jT808LocationAttachImpl0x13.DrivenRoute = (JT808DrivenRouteType)reader.ReadByte(); | |||
return jT808LocationAttachImpl0x13; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x13 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteInt32(value.DrivenRouteId); | |||
writer.WriteUInt16(value.Time); | |||
writer.WriteByte((byte)value.DrivenRoute); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x25_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x25> | |||
{ | |||
public JT808_0x0200_0x25 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x25 jT808LocationAttachImpl0x13 = new JT808_0x0200_0x25(); | |||
jT808LocationAttachImpl0x13.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x13.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x13.CarSignalStatus = reader.ReadInt32(); | |||
return jT808LocationAttachImpl0x13; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x25 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteInt32(value.CarSignalStatus); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x2A_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x2A> | |||
{ | |||
public JT808_0x0200_0x2A Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x2A jT808LocationAttachImpl0X2A = new JT808_0x0200_0x2A(); | |||
jT808LocationAttachImpl0X2A.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0X2A.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0X2A.IOStatus = reader.ReadUInt16(); | |||
return jT808LocationAttachImpl0X2A; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x2A value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteUInt16(value.IOStatus); | |||
} | |||
} | |||
} |
@@ -1,28 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x2B_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x2B> | |||
{ | |||
public JT808_0x0200_0x2B Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x2B jT808LocationAttachImpl0x2B = new JT808_0x0200_0x2B(); | |||
jT808LocationAttachImpl0x2B.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x2B.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x2B.Analog = reader.ReadInt32(); | |||
return jT808LocationAttachImpl0x2B; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x2B value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteInt32(value.Analog); | |||
} | |||
} | |||
} | |||
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x30_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x30> | |||
{ | |||
public JT808_0x0200_0x30 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x30 jT808LocationAttachImpl0x30 = new JT808_0x0200_0x30(); | |||
jT808LocationAttachImpl0x30.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x30.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x30.WiFiSignalStrength = reader.ReadByte(); | |||
return jT808LocationAttachImpl0x30; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x30 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteByte(value.WiFiSignalStrength); | |||
} | |||
} | |||
} |
@@ -1,26 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_0x31_Formatter : IJT808MessagePackFormatter<JT808_0x0200_0x31> | |||
{ | |||
public JT808_0x0200_0x31 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x31 jT808LocationAttachImpl0x31 = new JT808_0x0200_0x31(); | |||
jT808LocationAttachImpl0x31.AttachInfoId = reader.ReadByte(); | |||
jT808LocationAttachImpl0x31.AttachInfoLength = reader.ReadByte(); | |||
jT808LocationAttachImpl0x31.GNSSCount = reader.ReadByte(); | |||
return jT808LocationAttachImpl0x31; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x31 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.AttachInfoId); | |||
writer.WriteByte(value.AttachInfoLength); | |||
writer.WriteByte(value.GNSSCount); | |||
} | |||
} | |||
} |
@@ -1,150 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Metadata; | |||
using JT808.Protocol.MessageBody; | |||
using System; | |||
using System.Collections.Generic; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
using JT808.Protocol.Exceptions; | |||
using JT808.Protocol.Enums; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0200_Formatter : IJT808MessagePackFormatter<JT808_0x0200> | |||
{ | |||
public JT808_0x0200 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0200 jT808_0X0200 = new JT808_0x0200(); | |||
jT808_0X0200.AlarmFlag = reader.ReadUInt32(); | |||
jT808_0X0200.StatusFlag = reader.ReadUInt32(); | |||
if (((jT808_0X0200.StatusFlag >> 28) & 1) == 1) | |||
{ //南纬 268435456 0x10000000 | |||
jT808_0X0200.Lat = (int)reader.ReadUInt32(); | |||
} | |||
else | |||
{ | |||
jT808_0X0200.Lat = reader.ReadInt32(); | |||
} | |||
if (((jT808_0X0200.StatusFlag >> 27) & 1) == 1) | |||
{ //西经 134217728 0x8000000 | |||
jT808_0X0200.Lng = (int)reader.ReadUInt32(); | |||
} | |||
else | |||
{ | |||
jT808_0X0200.Lng = reader.ReadInt32(); | |||
} | |||
jT808_0X0200.Altitude = reader.ReadUInt16(); | |||
jT808_0X0200.Speed = reader.ReadUInt16(); | |||
jT808_0X0200.Direction = reader.ReadUInt16(); | |||
jT808_0X0200.GPSTime = reader.ReadDateTime6(); | |||
// 位置附加信息 | |||
jT808_0X0200.JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>(); | |||
jT808_0X0200.JT808CustomLocationAttachOriginalData = new Dictionary<byte, byte[]>(); | |||
jT808_0X0200.JT808UnknownLocationAttachOriginalData = new Dictionary<byte, byte[]>(); | |||
while (reader.ReadCurrentRemainContentLength()>0) | |||
{ | |||
try | |||
{ | |||
ReadOnlySpan<byte> attachSpan= reader.GetVirtualReadOnlySpan(2); | |||
byte attachId = attachSpan[0]; | |||
byte attachLen = attachSpan[1]; | |||
if (config.JT808_0X0200_Factory.JT808LocationAttachMethod.TryGetValue(attachId, out Type jT808LocationAttachType)) | |||
{ | |||
object attachImplObj = config.GetMessagePackFormatterByType(jT808LocationAttachType); | |||
dynamic attachImpl = JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize(attachImplObj,ref reader, config); | |||
jT808_0X0200.JT808LocationAttachData.Add(attachImpl.AttachInfoId, attachImpl); | |||
} | |||
else if (config.JT808_0X0200_Custom_Factory.AttachIds.Contains(attachId)) | |||
{ | |||
reader.Skip(2); | |||
jT808_0X0200.JT808CustomLocationAttachOriginalData.Add(attachId, reader.ReadArray(reader.ReaderCount-2, attachLen+2).ToArray()); | |||
reader.Skip(attachLen); | |||
} | |||
else | |||
{ | |||
reader.Skip(2); | |||
jT808_0X0200.JT808UnknownLocationAttachOriginalData.Add(attachId, reader.ReadArray(reader.ReaderCount-2, attachLen+2).ToArray()); | |||
reader.Skip(attachLen); | |||
} | |||
} | |||
catch | |||
{ | |||
try | |||
{ | |||
byte attachId = reader.ReadByte(); | |||
byte attachLen = reader.ReadByte(); | |||
jT808_0X0200.JT808UnknownLocationAttachOriginalData.Add(attachId, reader.ReadArray(reader.ReaderCount - 2, attachLen+2).ToArray()); | |||
reader.Skip(attachLen); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw; | |||
} | |||
} | |||
} | |||
return jT808_0X0200; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.AlarmFlag); | |||
writer.WriteUInt32(value.StatusFlag); | |||
//0x10000000 南纬 134217728 | |||
//0x8000000 西经 268435456 | |||
//0x18000000 南纬-西经 134217728+268435456 | |||
if (((value.StatusFlag >> 28) & 1) == 1) | |||
{ | |||
uint lat=(uint)value.Lat; | |||
writer.WriteUInt32(lat); | |||
} | |||
else | |||
{ | |||
if (value.Lat < 0) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.LatOrLngError, $"Lat {nameof(JT808_0x0200.StatusFlag)} ({value.StatusFlag}>>28) !=1"); | |||
} | |||
writer.WriteInt32(value.Lat); | |||
} | |||
if (((value.StatusFlag >> 27) & 1) == 1) | |||
{ | |||
uint lng = (uint)value.Lng; | |||
writer.WriteUInt32(lng); | |||
} | |||
else | |||
{ | |||
if (value.Lng < 0) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.LatOrLngError, $"Lng {nameof(JT808_0x0200.StatusFlag)} ({value.StatusFlag}>>29) !=1"); | |||
} | |||
writer.WriteInt32(value.Lng); | |||
} | |||
writer.WriteUInt16(value.Altitude); | |||
writer.WriteUInt16(value.Speed); | |||
writer.WriteUInt16(value.Direction); | |||
writer.WriteDateTime6(value.GPSTime); | |||
if (value.JT808LocationAttachData != null && value.JT808LocationAttachData.Count > 0) | |||
{ | |||
foreach (var item in value.JT808LocationAttachData) | |||
{ | |||
try | |||
{ | |||
object attachImplObj = config.GetMessagePackFormatterByType(item.Value.GetType()); | |||
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(attachImplObj, ref writer,item.Value, config); | |||
} | |||
catch | |||
{ | |||
} | |||
} | |||
} | |||
if (value.JT808CustomLocationAttachData != null && value.JT808CustomLocationAttachData.Count > 0) | |||
{ | |||
foreach (var item in value.JT808CustomLocationAttachData) | |||
{ | |||
object attachImplObj = config.GetMessagePackFormatterByType(item.Value.GetType()); | |||
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(attachImplObj, ref writer, item.Value, config); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -1,25 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0201_Formatter : IJT808MessagePackFormatter<JT808_0x0201> | |||
{ | |||
public JT808_0x0201 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0201 jT808_0X0201 = new JT808_0x0201(); | |||
jT808_0X0201.MsgNum = reader.ReadUInt16(); | |||
jT808_0X0201.Position = config.GetMessagePackFormatter<JT808_0x0200>().Deserialize(ref reader, config); | |||
return jT808_0X0201; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0201 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
config.GetMessagePackFormatter<JT808_0x0200>().Serialize(ref writer,value.Position, config); | |||
} | |||
} | |||
} |
@@ -1,22 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0301_Formatter : IJT808MessagePackFormatter<JT808_0x0301> | |||
{ | |||
public JT808_0x0301 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0301 jT808_0X0301 = new JT808_0x0301(); | |||
jT808_0X0301.EventId = reader.ReadByte(); | |||
return jT808_0X0301; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0301 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.EventId); | |||
} | |||
} | |||
} |
@@ -1,24 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0302_Formatter : IJT808MessagePackFormatter<JT808_0x0302> | |||
{ | |||
public JT808_0x0302 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0302 jT808_0X0302 = new JT808_0x0302(); | |||
jT808_0X0302.ReplySNo = reader.ReadUInt16(); | |||
jT808_0X0302.AnswerId = reader.ReadByte(); | |||
return jT808_0X0302; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0302 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.ReplySNo); | |||
writer.WriteByte(value.AnswerId); | |||
} | |||
} | |||
} |
@@ -1,25 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0303_Formatter : IJT808MessagePackFormatter<JT808_0x0303> | |||
{ | |||
public JT808_0x0303 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0303 jT808_0X0303 = new JT808_0x0303(); | |||
jT808_0X0303.InformationType = reader.ReadByte(); | |||
jT808_0X0303.Flag = reader.ReadByte(); | |||
return jT808_0X0303; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0303 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.InformationType); | |||
writer.WriteByte(value.Flag); | |||
} | |||
} | |||
} |
@@ -1,25 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0500_Formatter : IJT808MessagePackFormatter<JT808_0x0500> | |||
{ | |||
public JT808_0x0500 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0500 jT808_0X0500 = new JT808_0x0500(); | |||
jT808_0X0500.MsgNum = reader.ReadUInt16(); | |||
jT808_0X0500.JT808_0x0200 = config.GetMessagePackFormatter<JT808_0x0200>().Deserialize(ref reader, config); | |||
return jT808_0X0500; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0500 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
config.GetMessagePackFormatter<JT808_0x0200>().Serialize(ref writer, value.JT808_0x0200, config); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0701_Formatter : IJT808MessagePackFormatter<JT808_0x0701> | |||
{ | |||
public JT808_0x0701 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0701 jT808_0X0701 = new JT808_0x0701(); | |||
jT808_0X0701.ElectronicWaybillLength = reader.ReadUInt32(); | |||
jT808_0X0701.ElectronicContent = reader.ReadArray((int)jT808_0X0701.ElectronicWaybillLength).ToArray(); | |||
return jT808_0X0701; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0701 value, IJT808Config config) | |||
{ | |||
writer.Skip(4, out int skipPosition); | |||
object obj = config.GetMessagePackFormatterByType(value.ElectronicContentObj.GetType()); | |||
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(obj, ref writer, value.ElectronicContentObj, config); | |||
int contentLength=writer.GetCurrentPosition()- skipPosition-4; | |||
writer.WriteInt32Return(contentLength, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,52 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0702_Formatter : IJT808MessagePackFormatter<JT808_0x0702> | |||
{ | |||
public JT808_0x0702 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0702 jT808_0X0702 = new JT808_0x0702(); | |||
jT808_0X0702.IC_Card_Status = (JT808ICCardStatus)reader.ReadByte(); | |||
jT808_0X0702.IC_Card_PlugDateTime = reader.ReadDateTime6(); | |||
if (jT808_0X0702.IC_Card_Status == JT808ICCardStatus.从业资格证IC卡插入_驾驶员上班) | |||
{ | |||
jT808_0X0702.IC_Card_ReadResult = (JT808ICCardReadResult)reader.ReadByte(); | |||
if (jT808_0X0702.IC_Card_ReadResult == JT808ICCardReadResult.IC卡读卡成功) | |||
{ | |||
jT808_0X0702.DriverUserNameLength = reader.ReadByte(); | |||
jT808_0X0702.DriverUserName = reader.ReadString( jT808_0X0702.DriverUserNameLength); | |||
jT808_0X0702.QualificationCode = reader.ReadString(20); | |||
jT808_0X0702.LicenseIssuingLength = reader.ReadByte(); | |||
jT808_0X0702.LicenseIssuing = reader.ReadString(jT808_0X0702.LicenseIssuingLength); | |||
jT808_0X0702.CertificateExpiresDate = reader.ReadDateTime4(); | |||
} | |||
} | |||
return jT808_0X0702; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0702 value, IJT808Config config) | |||
{ | |||
writer.WriteByte((byte)value.IC_Card_Status); | |||
writer.WriteDateTime6(value.IC_Card_PlugDateTime); | |||
if (value.IC_Card_Status == JT808ICCardStatus.从业资格证IC卡插入_驾驶员上班) | |||
{ | |||
writer.WriteByte((byte)value.IC_Card_ReadResult); | |||
if (value.IC_Card_ReadResult == JT808ICCardReadResult.IC卡读卡成功) | |||
{ | |||
writer.WriteByte((byte)value.DriverUserName.Length); | |||
writer.WriteString(value.DriverUserName); | |||
writer.WriteString( value.QualificationCode.PadRight(20, '0')); | |||
writer.WriteByte((byte)value.LicenseIssuing.Length); | |||
writer.WriteString(value.LicenseIssuing); | |||
writer.WriteDateTime4(value.CertificateExpiresDate); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -1,56 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using System.Collections.Generic; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0704_Formatter : IJT808MessagePackFormatter<JT808_0x0704> | |||
{ | |||
public JT808_0x0704 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0704 jT808_0X0704 = new JT808_0x0704(); | |||
jT808_0X0704.Count = reader.ReadUInt16(); | |||
jT808_0X0704.LocationType = (JT808_0x0704.BatchLocationType)reader.ReadByte(); | |||
List<JT808_0x0200> jT808_0X0200s = new List<JT808_0x0200>(); | |||
for (int i = 0; i < jT808_0X0704.Count; i++) | |||
{ | |||
int buflen = reader.ReadUInt16(); | |||
try | |||
{ | |||
JT808MessagePackReader tmpReader = new JT808MessagePackReader(reader.ReadArray(buflen)); | |||
JT808_0x0200 jT808_0X0200 = config.GetMessagePackFormatter<JT808_0x0200>().Deserialize(ref tmpReader, config); | |||
jT808_0X0200s.Add(jT808_0X0200); | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
} | |||
jT808_0X0704.Positions = jT808_0X0200s; | |||
return jT808_0X0704; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0704 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.Count); | |||
writer.WriteByte((byte)value.LocationType); | |||
foreach (var item in value?.Positions) | |||
{ | |||
try | |||
{ | |||
writer.Skip(2, out int position); | |||
config.GetMessagePackFormatter<JT808_0x0200>().Serialize(ref writer, item, config); | |||
ushort length = (ushort)(writer.GetCurrentPosition() - position - 2); | |||
writer.WriteUInt16Return(length, position); | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -1,60 +0,0 @@ | |||
using JT808.Protocol.Exceptions; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Metadata; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using System.Collections.Generic; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0705_Formatter : IJT808MessagePackFormatter<JT808_0x0705> | |||
{ | |||
public JT808_0x0705 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0705 jT808_0X0705 = new JT808_0x0705(); | |||
jT808_0X0705.CanItemCount = reader.ReadUInt16(); | |||
jT808_0X0705.FirstCanReceiveTime = reader.ReadDateTime5(); | |||
jT808_0X0705.CanItems = new List<JT808CanProperty>(); | |||
for (var i = 0; i < jT808_0X0705.CanItemCount; i++) | |||
{ | |||
JT808CanProperty jT808CanProperty = new JT808CanProperty(); | |||
jT808CanProperty.CanId = reader.ReadArray(4).ToArray(); | |||
if (jT808CanProperty.CanId.Length != 4) | |||
{ | |||
throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(jT808CanProperty.CanId)}->4"); | |||
} | |||
jT808CanProperty.CanData = reader.ReadArray(8).ToArray(); | |||
if (jT808CanProperty.CanData.Length != 8) | |||
{ | |||
throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(jT808CanProperty.CanData)}->8"); | |||
} | |||
jT808_0X0705.CanItems.Add(jT808CanProperty); | |||
} | |||
return jT808_0X0705; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0705 value, IJT808Config config) | |||
{ | |||
if (value.CanItems != null && value.CanItems.Count > 0) | |||
{ | |||
writer.WriteUInt16((ushort)value.CanItems.Count); | |||
writer.WriteDateTime5(value.FirstCanReceiveTime); | |||
foreach (var item in value.CanItems) | |||
{ | |||
if (item.CanId.Length != 4) | |||
{ | |||
throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(item.CanId)}->4"); | |||
} | |||
writer.WriteArray(item.CanId); | |||
if (item.CanData.Length != 8) | |||
{ | |||
throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(item.CanData)}->8"); | |||
} | |||
writer.WriteArray(item.CanData); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -1,31 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0800_Formatter : IJT808MessagePackFormatter<JT808_0x0800> | |||
{ | |||
public JT808_0x0800 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0800 jT808_0X0800 = new JT808_0x0800(); | |||
jT808_0X0800.MultimediaId = reader.ReadUInt32(); | |||
jT808_0X0800.MultimediaType = reader.ReadByte(); | |||
jT808_0X0800.MultimediaCodingFormat = reader.ReadByte(); | |||
jT808_0X0800.EventItemCoding = reader.ReadByte(); | |||
jT808_0X0800.ChannelId = reader.ReadByte(); | |||
return jT808_0X0800; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0800 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.MultimediaId); | |||
writer.WriteByte(value.MultimediaType); | |||
writer.WriteByte(value.MultimediaCodingFormat); | |||
writer.WriteByte(value.EventItemCoding); | |||
writer.WriteByte(value.ChannelId); | |||
} | |||
} | |||
} |
@@ -1,36 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0801_Formatter : IJT808MessagePackFormatter<JT808_0x0801> | |||
{ | |||
public JT808_0x0801 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0801 jT808_0X0801 = new JT808_0x0801(); | |||
jT808_0X0801.MultimediaId = reader.ReadUInt32(); | |||
jT808_0X0801.MultimediaType = reader.ReadByte(); | |||
jT808_0X0801.MultimediaCodingFormat = reader.ReadByte(); | |||
jT808_0X0801.EventItemCoding = reader.ReadByte(); | |||
jT808_0X0801.ChannelId = reader.ReadByte(); | |||
JT808MessagePackReader positionReader = new JT808MessagePackReader(reader.ReadArray(28)); | |||
jT808_0X0801.Position = config.GetMessagePackFormatter<JT808_0x0200>().Deserialize(ref positionReader, config); | |||
jT808_0X0801.MultimediaDataPackage = reader.ReadContent().ToArray(); | |||
return jT808_0X0801; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0801 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.MultimediaId); | |||
writer.WriteByte(value.MultimediaType); | |||
writer.WriteByte(value.MultimediaCodingFormat); | |||
writer.WriteByte(value.EventItemCoding); | |||
writer.WriteByte(value.ChannelId); | |||
config.GetMessagePackFormatter<JT808_0x0200>().Serialize(ref writer, value.Position, config); | |||
writer.WriteArray(value.MultimediaDataPackage); | |||
} | |||
} | |||
} |
@@ -1,47 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using System.Collections.Generic; | |||
using JT808.Protocol.Metadata; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0802_Formatter : IJT808MessagePackFormatter<JT808_0x0802> | |||
{ | |||
public JT808_0x0802 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0802 JT808_0x0802 = new JT808_0x0802(); | |||
JT808_0x0802.MsgNum = reader.ReadUInt16(); | |||
JT808_0x0802.MultimediaItemCount = reader.ReadUInt16(); | |||
JT808_0x0802.MultimediaSearchItems = new List<JT808MultimediaSearchProperty>(); | |||
for (var i = 0; i < JT808_0x0802.MultimediaItemCount; i++) | |||
{ | |||
JT808MultimediaSearchProperty jT808MultimediaSearchProperty = new JT808MultimediaSearchProperty(); | |||
jT808MultimediaSearchProperty.MultimediaId = reader.ReadUInt32(); | |||
jT808MultimediaSearchProperty.MultimediaType = reader.ReadByte(); | |||
jT808MultimediaSearchProperty.ChannelId = reader.ReadByte(); | |||
jT808MultimediaSearchProperty.EventItemCoding = reader.ReadByte(); | |||
JT808MessagePackReader positionReader = new JT808MessagePackReader(reader.ReadArray(28)); | |||
jT808MultimediaSearchProperty.Position = config.GetMessagePackFormatter<JT808_0x0200>().Deserialize(ref positionReader, config); | |||
JT808_0x0802.MultimediaSearchItems.Add(jT808MultimediaSearchProperty); | |||
} | |||
return JT808_0x0802; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0802 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
writer.WriteUInt16((ushort)value.MultimediaSearchItems.Count); | |||
foreach (var item in value.MultimediaSearchItems) | |||
{ | |||
writer.WriteUInt32(item.MultimediaId); | |||
writer.WriteByte(item.MultimediaType); | |||
writer.WriteByte(item.ChannelId); | |||
writer.WriteByte(item.EventItemCoding); | |||
config.GetMessagePackFormatter<JT808_0x0200>().Serialize(ref writer,item.Position, config); | |||
} | |||
} | |||
} | |||
} |
@@ -1,38 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using System.Collections.Generic; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0805_Formatter : IJT808MessagePackFormatter<JT808_0x0805> | |||
{ | |||
public JT808_0x0805 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0805 jT808_0X0805 = new JT808_0x0805(); | |||
jT808_0X0805.MsgNum = reader.ReadUInt16(); | |||
jT808_0X0805.Result = reader.ReadByte(); | |||
jT808_0X0805.MultimediaIdCount = reader.ReadUInt16(); | |||
jT808_0X0805.MultimediaIds = new List<uint>(); | |||
for (var i = 0; i < jT808_0X0805.MultimediaIdCount; i++) | |||
{ | |||
uint id = reader.ReadUInt32(); | |||
jT808_0X0805.MultimediaIds.Add(id); | |||
} | |||
return jT808_0X0805; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0805 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
writer.WriteByte(value.Result); | |||
writer.WriteUInt16((ushort)value.MultimediaIds.Count); | |||
foreach (var item in value.MultimediaIds) | |||
{ | |||
writer.WriteUInt32(item); | |||
} | |||
} | |||
} | |||
} |
@@ -1,26 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0900_Formatter : IJT808MessagePackFormatter<JT808_0x0900> | |||
{ | |||
public JT808_0x0900 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0900 jT808_0X0900 = new JT808_0x0900(); | |||
jT808_0X0900.PassthroughType = reader.ReadByte(); | |||
jT808_0X0900.PassthroughData = reader.ReadContent().ToArray(); ; | |||
return jT808_0X0900; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0900 value, IJT808Config config) | |||
{ | |||
writer.WriteByte(value.PassthroughType); | |||
object obj = config.GetMessagePackFormatterByType(value.JT808_0x0900_BodyBase.GetType()); | |||
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(obj, ref writer, value.JT808_0x0900_BodyBase, config); | |||
} | |||
} | |||
} |
@@ -1,28 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0901_Formatter : IJT808MessagePackFormatter<JT808_0x0901> | |||
{ | |||
public JT808_0x0901 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0901 jT808_0X0901 = new JT808_0x0901(); | |||
var compressMessageLength = reader.ReadUInt32(); | |||
var data = reader.ReadArray((int)compressMessageLength); | |||
jT808_0X0901.UnCompressMessage = config.Compress.Decompress(data.ToArray()); | |||
jT808_0X0901.UnCompressMessageLength = (uint)jT808_0X0901.UnCompressMessage.Length; | |||
return jT808_0X0901; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0901 value, IJT808Config config) | |||
{ | |||
var data = config.Compress.Compress(value.UnCompressMessage); | |||
writer.WriteUInt32((uint)data.Length); | |||
writer.WriteArray(data); | |||
} | |||
} | |||
} |
@@ -1,36 +0,0 @@ | |||
using JT808.Protocol.Exceptions; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x0A00_Formatter : IJT808MessagePackFormatter<JT808_0x0A00> | |||
{ | |||
public JT808_0x0A00 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x0A00 jT808_0X0A00 = new JT808_0x0A00 | |||
{ | |||
E = reader.ReadUInt32(), | |||
N = reader.ReadArray(128).ToArray() | |||
}; | |||
if (jT808_0X0A00.N.Length != 128) | |||
{ | |||
throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(jT808_0X0A00.N)}->128"); | |||
} | |||
return jT808_0X0A00; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0A00 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.E); | |||
if (value.N.Length != 128) | |||
{ | |||
throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(value.N)}->128"); | |||
} | |||
writer.WriteArray(value.N); | |||
} | |||
} | |||
} |
@@ -1,28 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8001_Formatter : IJT808MessagePackFormatter<JT808_0x8001> | |||
{ | |||
public JT808_0x8001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8001 jT808_0X8001 = new JT808_0x8001(); | |||
jT808_0X8001.MsgNum = reader.ReadUInt16(); | |||
jT808_0X8001.MsgId = reader.ReadUInt16(); | |||
jT808_0X8001.JT808PlatformResult = (JT808PlatformResult)reader.ReadByte(); | |||
return jT808_0X8001; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8001 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
writer.WriteUInt16(value.MsgId); | |||
writer.WriteByte((byte)value.JT808PlatformResult); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8003_Formatter : IJT808MessagePackFormatter<JT808_0x8003> | |||
{ | |||
public JT808_0x8003 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8003 jT808_0X8003 = new JT808_0x8003(); | |||
jT808_0X8003.OriginalMsgNum = reader.ReadUInt16(); | |||
jT808_0X8003.AgainPackageCount = reader.ReadByte(); | |||
jT808_0X8003.AgainPackageData = reader.ReadArray(jT808_0X8003.AgainPackageCount * 2).ToArray(); | |||
return jT808_0X8003; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8003 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.OriginalMsgNum); | |||
writer.WriteByte((byte)(value.AgainPackageData.Length / 2)); | |||
writer.WriteArray(value.AgainPackageData); | |||
} | |||
} | |||
} |
@@ -1,36 +0,0 @@ | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8100_Formatter : IJT808MessagePackFormatter<JT808_0x8100> | |||
{ | |||
public JT808_0x8100 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8100 jT808_0X8100 = new JT808_0x8100(); | |||
jT808_0X8100.MsgNum = reader.ReadUInt16(); | |||
jT808_0X8100.JT808TerminalRegisterResult = (JT808TerminalRegisterResult)reader.ReadByte(); | |||
// 只有在成功后才有该字段 | |||
if (jT808_0X8100.JT808TerminalRegisterResult == JT808TerminalRegisterResult.成功) | |||
{ | |||
jT808_0X8100.Code = reader.ReadRemainStringContent(); | |||
} | |||
return jT808_0X8100; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8100 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt16(value.MsgNum); | |||
writer.WriteByte((byte)value.JT808TerminalRegisterResult); | |||
// 只有在成功后才有该字段 | |||
if (value.JT808TerminalRegisterResult == JT808TerminalRegisterResult.成功) | |||
{ | |||
writer.WriteString(value.Code); | |||
} | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0001_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0001> | |||
{ | |||
public JT808_0x8103_0x0001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0001 jT808_0x8103_0x0001 = new JT808_0x8103_0x0001(); | |||
jT808_0x8103_0x0001.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0001.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0001.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0001; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0001 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0002_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0002> | |||
{ | |||
public JT808_0x8103_0x0002 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0002 jT808_0x8103_0x0002 = new JT808_0x8103_0x0002(); | |||
jT808_0x8103_0x0002.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0002.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0002.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0002; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0002 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0003_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0003> | |||
{ | |||
public JT808_0x8103_0x0003 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0003 jT808_0x8103_0x0003 = new JT808_0x8103_0x0003(); | |||
jT808_0x8103_0x0003.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0003.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0003.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0003; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0003 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0004_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0004> | |||
{ | |||
public JT808_0x8103_0x0004 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0004 jT808_0x8103_0x0004 = new JT808_0x8103_0x0004(); | |||
jT808_0x8103_0x0004.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0004.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0004.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0004; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0004 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0005_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0005> | |||
{ | |||
public JT808_0x8103_0x0005 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0005 jT808_0x8103_0x0005 = new JT808_0x8103_0x0005(); | |||
jT808_0x8103_0x0005.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0005.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0005.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0005; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0005 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0006_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0006> | |||
{ | |||
public JT808_0x8103_0x0006 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0006 jT808_0x8103_0x0006 = new JT808_0x8103_0x0006(); | |||
jT808_0x8103_0x0006.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0006.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0006.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0006; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0006 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0007_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0007> | |||
{ | |||
public JT808_0x8103_0x0007 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0007 jT808_0x8103_0x0007 = new JT808_0x8103_0x0007(); | |||
jT808_0x8103_0x0007.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0007.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0007.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0007; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0007 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0010_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0010> | |||
{ | |||
public JT808_0x8103_0x0010 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0010 jT808_0x8103_0x0010 = new JT808_0x8103_0x0010(); | |||
jT808_0x8103_0x0010.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0010.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0010.ParamValue = reader.ReadString(jT808_0x8103_0x0010.ParamLength); | |||
return jT808_0x8103_0x0010; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0010 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0011_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0011> | |||
{ | |||
public JT808_0x8103_0x0011 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0011 jT808_0x8103_0x0011 = new JT808_0x8103_0x0011(); | |||
jT808_0x8103_0x0011.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0011.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0011.ParamValue = reader.ReadString( jT808_0x8103_0x0011.ParamLength); | |||
return jT808_0x8103_0x0011; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0011 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0012_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0012> | |||
{ | |||
public JT808_0x8103_0x0012 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0012 jT808_0x8103_0x0012 = new JT808_0x8103_0x0012(); | |||
jT808_0x8103_0x0012.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0012.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0012.ParamValue = reader.ReadString(jT808_0x8103_0x0012.ParamLength); | |||
return jT808_0x8103_0x0012; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0012 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0013_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0013> | |||
{ | |||
public JT808_0x8103_0x0013 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0013 jT808_0x8103_0x0013 = new JT808_0x8103_0x0013(); | |||
jT808_0x8103_0x0013.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0013.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0013.ParamValue = reader.ReadString(jT808_0x8103_0x0013.ParamLength); | |||
return jT808_0x8103_0x0013; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0013 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0014_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0014> | |||
{ | |||
public JT808_0x8103_0x0014 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0014 jT808_0x8103_0x0014 = new JT808_0x8103_0x0014(); | |||
jT808_0x8103_0x0014.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0014.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0014.ParamValue = reader.ReadString( jT808_0x8103_0x0014.ParamLength); | |||
return jT808_0x8103_0x0014; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0014 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0015_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0015> | |||
{ | |||
public JT808_0x8103_0x0015 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0015 jT808_0x8103_0x0015 = new JT808_0x8103_0x0015(); | |||
jT808_0x8103_0x0015.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0015.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0015.ParamValue = reader.ReadString(jT808_0x8103_0x0015.ParamLength); | |||
return jT808_0x8103_0x0015; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0015 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0016_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0016> | |||
{ | |||
public JT808_0x8103_0x0016 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0016 jT808_0x8103_0x0016 = new JT808_0x8103_0x0016(); | |||
jT808_0x8103_0x0016.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0016.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0016.ParamValue = reader.ReadString(jT808_0x8103_0x0016.ParamLength); | |||
return jT808_0x8103_0x0016; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0016 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0017_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0017> | |||
{ | |||
public JT808_0x8103_0x0017 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0017 jT808_0x8103_0x0017 = new JT808_0x8103_0x0017(); | |||
jT808_0x8103_0x0017.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0017.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0017.ParamValue = reader.ReadString(jT808_0x8103_0x0017.ParamLength); | |||
return jT808_0x8103_0x0017; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0017 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0018_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0018> | |||
{ | |||
public JT808_0x8103_0x0018 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0018 jT808_0x8103_0x0018 = new JT808_0x8103_0x0018(); | |||
jT808_0x8103_0x0018.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0018.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0018.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0018; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0018 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0019_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0019> | |||
{ | |||
public JT808_0x8103_0x0019 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0019 jT808_0x8103_0x0019 = new JT808_0x8103_0x0019(); | |||
jT808_0x8103_0x0019.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0019.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0019.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0019; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0019 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x001A_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x001A> | |||
{ | |||
public JT808_0x8103_0x001A Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x001A jT808_0x8103_0x001A = new JT808_0x8103_0x001A(); | |||
jT808_0x8103_0x001A.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x001A.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x001A.ParamValue = reader.ReadString( jT808_0x8103_0x001A.ParamLength); | |||
return jT808_0x8103_0x001A; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001A value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x001B_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x001B> | |||
{ | |||
public JT808_0x8103_0x001B Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x001B jT808_0x8103_0x001B = new JT808_0x8103_0x001B(); | |||
jT808_0x8103_0x001B.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x001B.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x001B.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x001B; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001B value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x001C_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x001C> | |||
{ | |||
public JT808_0x8103_0x001C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x001C jT808_0x8103_0x001C = new JT808_0x8103_0x001C(); | |||
jT808_0x8103_0x001C.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x001C.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x001C.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x001C; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001C value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x001D_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x001D> | |||
{ | |||
public JT808_0x8103_0x001D Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x001D jT808_0x8103_0x001D = new JT808_0x8103_0x001D(); | |||
jT808_0x8103_0x001D.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x001D.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x001D.ParamValue = reader.ReadString(jT808_0x8103_0x001D.ParamLength); | |||
return jT808_0x8103_0x001D; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x001D value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0020_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0020> | |||
{ | |||
public JT808_0x8103_0x0020 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0020 jT808_0x8103_0x0020 = new JT808_0x8103_0x0020(); | |||
jT808_0x8103_0x0020.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0020.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0020.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0020; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0020 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using System; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0021_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0021> | |||
{ | |||
public JT808_0x8103_0x0021 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0021 jT808_0x8103_0x0021 = new JT808_0x8103_0x0021(); | |||
jT808_0x8103_0x0021.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0021.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0021.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0021; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0021 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0022_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0022> | |||
{ | |||
public JT808_0x8103_0x0022 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0022 jT808_0x8103_0x0022 = new JT808_0x8103_0x0022(); | |||
jT808_0x8103_0x0022.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0022.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0022.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0022; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0022 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0027_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0027> | |||
{ | |||
public JT808_0x8103_0x0027 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0027 jT808_0x8103_0x0027 = new JT808_0x8103_0x0027(); | |||
jT808_0x8103_0x0027.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0027.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0027.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0027; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0027 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0028_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0028> | |||
{ | |||
public JT808_0x8103_0x0028 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0028 jT808_0x8103_0x0028 = new JT808_0x8103_0x0028(); | |||
jT808_0x8103_0x0028.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0028.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0028.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0028; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0028 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0029_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0029> | |||
{ | |||
public JT808_0x8103_0x0029 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0029 jT808_0x8103_0x0029 = new JT808_0x8103_0x0029(); | |||
jT808_0x8103_0x0029.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0029.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0029.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0029; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0029 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x002C_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x002C> | |||
{ | |||
public JT808_0x8103_0x002C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x002C jT808_0x8103_0x002C = new JT808_0x8103_0x002C(); | |||
jT808_0x8103_0x002C.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x002C.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x002C.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x002C; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002C value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x002D_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x002D> | |||
{ | |||
public JT808_0x8103_0x002D Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x002D jT808_0x8103_0x002D = new JT808_0x8103_0x002D(); | |||
jT808_0x8103_0x002D.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x002D.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x002D.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x002D; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002D value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x002E_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x002E> | |||
{ | |||
public JT808_0x8103_0x002E Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x002E jT808_0x8103_0x002E = new JT808_0x8103_0x002E(); | |||
jT808_0x8103_0x002E.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x002E.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x002E.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x002E; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002E value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x002F_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x002F> | |||
{ | |||
public JT808_0x8103_0x002F Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x002F jT808_0x8103_0x002F = new JT808_0x8103_0x002F(); | |||
jT808_0x8103_0x002F.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x002F.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x002F.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x002F; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x002F value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0030_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0030> | |||
{ | |||
public JT808_0x8103_0x0030 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0030 jT808_0x8103_0x0030 = new JT808_0x8103_0x0030(); | |||
jT808_0x8103_0x0030.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0030.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0030.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0030; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0030 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0031_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0031> | |||
{ | |||
public JT808_0x8103_0x0031 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0031 jT808_0x8103_0x0031 = new JT808_0x8103_0x0031(); | |||
jT808_0x8103_0x0031.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0031.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0031.ParamValue = reader.ReadUInt16(); | |||
return jT808_0x8103_0x0031; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0031 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt16(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0040_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0040> | |||
{ | |||
public JT808_0x8103_0x0040 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0040 jT808_0x8103_0x0040 = new JT808_0x8103_0x0040(); | |||
jT808_0x8103_0x0040.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0040.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0040.ParamValue = reader.ReadString( jT808_0x8103_0x0040.ParamLength); | |||
return jT808_0x8103_0x0040; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0040 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0041_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0041> | |||
{ | |||
public JT808_0x8103_0x0041 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0041 jT808_0x8103_0x0041 = new JT808_0x8103_0x0041(); | |||
jT808_0x8103_0x0041.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0041.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0041.ParamValue = reader.ReadString( jT808_0x8103_0x0041.ParamLength); | |||
return jT808_0x8103_0x0041; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0041 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0042_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0042> | |||
{ | |||
public JT808_0x8103_0x0042 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0042 jT808_0x8103_0x0042 = new JT808_0x8103_0x0042(); | |||
jT808_0x8103_0x0042.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0042.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0042.ParamValue = reader.ReadString(jT808_0x8103_0x0042.ParamLength); | |||
return jT808_0x8103_0x0042; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0042 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0043_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0043> | |||
{ | |||
public JT808_0x8103_0x0043 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0043 jT808_0x8103_0x0043 = new JT808_0x8103_0x0043(); | |||
jT808_0x8103_0x0043.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0043.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0043.ParamValue = reader.ReadString(jT808_0x8103_0x0043.ParamLength); | |||
return jT808_0x8103_0x0043; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0043 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0044_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0044> | |||
{ | |||
public JT808_0x8103_0x0044 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0044 jT808_0x8103_0x0044 = new JT808_0x8103_0x0044(); | |||
jT808_0x8103_0x0044.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0044.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0044.ParamValue = reader.ReadString(jT808_0x8103_0x0044.ParamLength); | |||
return jT808_0x8103_0x0044; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0044 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0045_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0045> | |||
{ | |||
public JT808_0x8103_0x0045 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0045 jT808_0x8103_0x0045 = new JT808_0x8103_0x0045(); | |||
jT808_0x8103_0x0045.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0045.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0045.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0045; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0045 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0046_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0046> | |||
{ | |||
public JT808_0x8103_0x0046 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0046 jT808_0x8103_0x0046 = new JT808_0x8103_0x0046(); | |||
jT808_0x8103_0x0046.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0046.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0046.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0046; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0046 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0047_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0047> | |||
{ | |||
public JT808_0x8103_0x0047 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0047 jT808_0x8103_0x0047 = new JT808_0x8103_0x0047(); | |||
jT808_0x8103_0x0047.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0047.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0047.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0047; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0047 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0048_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0048> | |||
{ | |||
public JT808_0x8103_0x0048 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0048 jT808_0x8103_0x0048 = new JT808_0x8103_0x0048(); | |||
jT808_0x8103_0x0048.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0048.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0048.ParamValue = reader.ReadString(jT808_0x8103_0x0048.ParamLength); | |||
return jT808_0x8103_0x0048; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0048 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0049_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0049> | |||
{ | |||
public JT808_0x8103_0x0049 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0049 jT808_0x8103_0x0049 = new JT808_0x8103_0x0049(); | |||
jT808_0x8103_0x0049.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0049.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0049.ParamValue = reader.ReadString( jT808_0x8103_0x0049.ParamLength); | |||
return jT808_0x8103_0x0049; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0049 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.Skip(1, out int skipPosition); | |||
writer.WriteString(value.ParamValue); | |||
int length = writer.GetCurrentPosition() - skipPosition - 1; | |||
writer.WriteByteReturn((byte)length, skipPosition); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0050_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0050> | |||
{ | |||
public JT808_0x8103_0x0050 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0050 jT808_0x8103_0x0050 = new JT808_0x8103_0x0050(); | |||
jT808_0x8103_0x0050.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0050.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0050.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0050; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0050 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0051_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0051> | |||
{ | |||
public JT808_0x8103_0x0051 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0051 jT808_0x8103_0x0051 = new JT808_0x8103_0x0051(); | |||
jT808_0x8103_0x0051.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0051.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0051.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0051; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0051 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0052_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0052> | |||
{ | |||
public JT808_0x8103_0x0052 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0052 jT808_0x8103_0x0052 = new JT808_0x8103_0x0052(); | |||
jT808_0x8103_0x0052.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0052.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0052.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0052; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0052 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
using JT808.Protocol.Extensions; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public class JT808_0x8103_0x0053_Formatter : IJT808MessagePackFormatter<JT808_0x8103_0x0053> | |||
{ | |||
public JT808_0x8103_0x0053 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
JT808_0x8103_0x0053 jT808_0x8103_0x0053 = new JT808_0x8103_0x0053(); | |||
jT808_0x8103_0x0053.ParamId = reader.ReadUInt32(); | |||
jT808_0x8103_0x0053.ParamLength = reader.ReadByte(); | |||
jT808_0x8103_0x0053.ParamValue = reader.ReadUInt32(); | |||
return jT808_0x8103_0x0053; | |||
} | |||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0053 value, IJT808Config config) | |||
{ | |||
writer.WriteUInt32(value.ParamId); | |||
writer.WriteByte(value.ParamLength); | |||
writer.WriteUInt32(value.ParamValue); | |||
} | |||
} | |||
} |