@@ -1,4 +1,4 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<TargetFramework>netcoreapp2.1</TargetFramework> | <TargetFramework>netcoreapp2.1</TargetFramework> | ||||
@@ -0,0 +1,20 @@ | |||||
using JT809.Protocol.JT809Extensions; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
namespace JT809.Protocol.Test.JT809Extensions | |||||
{ | |||||
public class JT809BinaryExtensionsTest | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
string vno = "粤A12345"; | |||||
byte[] bytes = JT809BinaryExtensions.encoding.GetBytes(vno); | |||||
Assert.Equal(7,vno.Length); | |||||
Assert.Equal(8, bytes.Length); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
using JT809.Protocol; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
namespace JT809.Protocol.Test.JT809MessageBody | |||||
{ | |||||
public class JT809_0x1006Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,44 @@ | |||||
using JT809.Protocol; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JT809.Protocol.JT809SubMessageBody; | |||||
namespace JT809.Protocol.Test.JT809MessageBody | |||||
{ | |||||
public class JT809_0x1300Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JT809_0x1300 jT809Bodies = new JT809_0x1300(); | |||||
jT809Bodies.SubBusinessType = JT809Enums.JT809SubBusinessType.UP_PLATFORM_MSG_POST_QUERY_ACK; | |||||
jT809Bodies.JT809SubBodies = new JT809_0x1300_0x1301 | |||||
{ | |||||
ObjectID="111", | |||||
InfoContent= "22ha22", | |||||
InfoID= 1234, | |||||
ObjectType= JT809Enums.JT809_0x1301_ObjectType.当前连接的下级平台 | |||||
}; | |||||
var hex = JT809Serializer.Serialize(jT809Bodies).ToHexString(); | |||||
//"13 01 00 00 00 1B 01 31 31 31 00 00 00 00 00 00 00 00 00 00 00 04 D2 00 00 00 06 32 32 68 61 32 32" | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
var bytes = "13 01 00 00 00 1B 01 31 31 31 00 00 00 00 00 00 00 00 00 00 00 04 D2 00 00 00 06 32 32 68 61 32 32".ToHexBytes(); | |||||
JT809_0x1300 jT809Bodies = JT809Serializer.Deserialize<JT809_0x1300>(bytes); | |||||
Assert.Equal(JT809Enums.JT809SubBusinessType.UP_PLATFORM_MSG_POST_QUERY_ACK, jT809Bodies.SubBusinessType); | |||||
JT809_0x1300_0x1301 jT809SubBodies = (JT809_0x1300_0x1301)jT809Bodies.JT809SubBodies; | |||||
Assert.Equal("111", jT809SubBodies.ObjectID); | |||||
Assert.Equal("22ha22", jT809SubBodies.InfoContent); | |||||
Assert.Equal((uint)1234, jT809SubBodies.InfoID); | |||||
Assert.Equal(JT809Enums.JT809_0x1301_ObjectType.当前连接的下级平台, jT809SubBodies.ObjectType); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using JT809.Protocol; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JT809.Protocol.JT809SubMessageBody; | |||||
namespace JT809.Protocol.Test.JT809MessageBody | |||||
{ | |||||
public class JT809_0x1600Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JT809_0x1600 jT809Bodies = new JT809_0x1600(); | |||||
jT809Bodies.VehicleNo = "粤A12345"; | |||||
jT809Bodies.VehicleColor = JT809Enums.JT809VehicleColorType.蓝色; | |||||
jT809Bodies.SubBusinessType = JT809Enums.JT809SubBusinessType.UP_BASE_MSG_VEHICLE_ADDED_ACK; | |||||
jT809Bodies.JT809SubBodies = new JT809_0x1600_0x1601 | |||||
{ | |||||
CarInfo = "什么鬼" | |||||
}; | |||||
var hex = JT809Serializer.Serialize(jT809Bodies).ToHexString(); | |||||
//"D4 C1 41 31 32 33 34 35 00 00 00 00 00 00 00 00 00 00 00 00 00 01 16 01 00 00 00 06 CA B2 C3 B4 B9 ED" | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
var bytes = "D4 C1 41 31 32 33 34 35 00 00 00 00 00 00 00 00 00 00 00 00 00 01 16 01 00 00 00 06 CA B2 C3 B4 B9 ED".ToHexBytes(); | |||||
JT809_0x1600 jT809Bodies = JT809Serializer.Deserialize<JT809_0x1600>(bytes); | |||||
Assert.Equal("粤A12345", jT809Bodies.VehicleNo); | |||||
Assert.Equal(JT809Enums.JT809VehicleColorType.蓝色, jT809Bodies.VehicleColor); | |||||
Assert.Equal(JT809Enums.JT809SubBusinessType.UP_BASE_MSG_VEHICLE_ADDED_ACK, jT809Bodies.SubBusinessType); | |||||
Assert.Equal("什么鬼", ((JT809_0x1600_0x1601)jT809Bodies.JT809SubBodies).CarInfo); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JT809.Protocol; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809SubMessageBody; | |||||
namespace JT809.Protocol.Test.JT809SubMessageBody | |||||
{ | |||||
public class JT809_0x1300_0x1301Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JT809_0x1300_0x1301 jT809_0x1300_0x1301 = new JT809_0x1300_0x1301 | |||||
{ | |||||
ObjectID = "111", | |||||
InfoContent = "22ha22", | |||||
InfoID = 1234, | |||||
ObjectType = JT809Enums.JT809_0x1301_ObjectType.当前连接的下级平台 | |||||
}; | |||||
var hex = JT809Serializer.Serialize(jT809_0x1300_0x1301).ToHexString(); | |||||
//"01 31 31 31 00 00 00 00 00 00 00 00 00 00 00 04 D2 00 00 00 06 32 32 68 61 32 32" | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
var bytes = "01 31 31 31 00 00 00 00 00 00 00 00 00 00 00 04 D2 00 00 00 06 32 32 68 61 32 32".ToHexBytes(); | |||||
JT809_0x1300_0x1301 jT809_0x1300_0x1301 = JT809Serializer.Deserialize<JT809_0x1300_0x1301>(bytes); | |||||
Assert.Equal("111", jT809_0x1300_0x1301.ObjectID); | |||||
Assert.Equal("22ha22", jT809_0x1300_0x1301.InfoContent); | |||||
Assert.Equal((uint)1234, jT809_0x1300_0x1301.InfoID); | |||||
Assert.Equal(JT809Enums.JT809_0x1301_ObjectType.当前连接的下级平台, jT809_0x1300_0x1301.ObjectType); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JT809.Protocol; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809SubMessageBody; | |||||
namespace JT809.Protocol.Test.JT809SubMessageBody | |||||
{ | |||||
public class JT809_0x1400_0x1402Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JT809_0x1400_0x1402 jT809_0x1400_0x1402 = new JT809_0x1400_0x1402 | |||||
{ | |||||
WarnSrc= JT809Enums.JT809WarnSrc.车载终端, | |||||
WarnType = 18, | |||||
WarnTime=DateTime.Parse("2018-09-26"), | |||||
InfoContent = "gfdf454553", | |||||
InfoID = 3344, | |||||
}; | |||||
var hex = JT809Serializer.Serialize(jT809_0x1400_0x1402).ToHexString(); | |||||
// "00 00 12 00 00 00 00 5B AA 5B 80 00 00 0D 10 00 00 00 0A 67 66 64 66 34 35 34 35 35 33" | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
var bytes = "00 00 12 00 00 00 00 5B AA 5B 80 00 00 0D 10 00 00 00 0A 67 66 64 66 34 35 34 35 35 33".ToHexBytes(); | |||||
JT809_0x1400_0x1402 jT809_0x1400_0x1402 = JT809Serializer.Deserialize<JT809_0x1400_0x1402>(bytes); | |||||
Assert.Equal(JT809Enums.JT809WarnSrc.车载终端, jT809_0x1400_0x1402.WarnSrc); | |||||
Assert.Equal("gfdf454553", jT809_0x1400_0x1402.InfoContent); | |||||
Assert.Equal((uint)18, jT809_0x1400_0x1402.WarnType); | |||||
Assert.Equal((uint)3344, jT809_0x1400_0x1402.InfoID); | |||||
Assert.Equal((uint)10, jT809_0x1400_0x1402.InfoLength); | |||||
Assert.Equal(DateTime.Parse("2018-09-26"), jT809_0x1400_0x1402.WarnTime); | |||||
} | |||||
} | |||||
} |
@@ -3,6 +3,13 @@ | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<TargetFramework>netstandard2.0</TargetFramework> | <TargetFramework>netstandard2.0</TargetFramework> | ||||
<LangVersion>latest</LangVersion> | <LangVersion>latest</LangVersion> | ||||
<Copyright>Copyright 2016-2018.</Copyright> | |||||
<Authors>SmallChi</Authors> | |||||
<PackageId>JT809</PackageId> | |||||
<Product>JT809</Product> | |||||
<Description>JT809</Description> | |||||
<PackageReleaseNotes>JT809</PackageReleaseNotes> | |||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||||
@@ -39,15 +46,12 @@ | |||||
<Compile Include="JT809Enums\JT809BusinessType.cs" /> | <Compile Include="JT809Enums\JT809BusinessType.cs" /> | ||||
<Compile Include="JT809Enums\JT809SubBusinessType.cs" /> | <Compile Include="JT809Enums\JT809SubBusinessType.cs" /> | ||||
<Compile Include="JT809Enums\JT809VehicleColorType.cs" /> | <Compile Include="JT809Enums\JT809VehicleColorType.cs" /> | ||||
<Compile Include="JT809Enums\JT809WarnSrc.cs" /> | |||||
<Compile Include="JT809Enums\JT809_0x1502_PhotoRspFlag.cs" /> | <Compile Include="JT809Enums\JT809_0x1502_PhotoRspFlag.cs" /> | ||||
<Compile Include="JT809Enums\JT809_0x1501_Result.cs" /> | <Compile Include="JT809Enums\JT809_0x1501_Result.cs" /> | ||||
<Compile Include="JT809Enums\JT809_0x1505_Result.cs" /> | <Compile Include="JT809Enums\JT809_0x1505_Result.cs" /> | ||||
<Compile Include="JT809Enums\JT809_0x1503_Result.cs" /> | <Compile Include="JT809Enums\JT809_0x1503_Result.cs" /> | ||||
<Compile Include="JT809Enums\JT809_0x9403_WarnSrc.cs" /> | |||||
<Compile Include="JT809Enums\JT809_0x9402_WarnSrc.cs" /> | |||||
<Compile Include="JT809Enums\JT809_0x9401_WarnSrc.cs" /> | |||||
<Compile Include="JT809Enums\JT809_0x1403_Result.cs" /> | <Compile Include="JT809Enums\JT809_0x1403_Result.cs" /> | ||||
<Compile Include="JT809Enums\JT809_0x1402_WarnSrc.cs" /> | |||||
<Compile Include="JT809Enums\JT809_0x1401_Result.cs" /> | <Compile Include="JT809Enums\JT809_0x1401_Result.cs" /> | ||||
<Compile Include="JT809Enums\JT809_0x1002_Result.cs" /> | <Compile Include="JT809Enums\JT809_0x1002_Result.cs" /> | ||||
<Compile Include="JT809Enums\JT809_0x1007_ErrorCode.cs" /> | <Compile Include="JT809Enums\JT809_0x1007_ErrorCode.cs" /> | ||||
@@ -1,10 +1,33 @@ | |||||
using System; | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace JT809.Protocol | namespace JT809.Protocol | ||||
{ | { | ||||
public abstract class JT809Bodies | |||||
public abstract class JT809Bodies | |||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } = JT809VehicleColorType.其他; | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } = JT809SubBusinessType.None; | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -9,6 +9,7 @@ namespace JT809.Protocol.JT809Enums | |||||
///</summary> | ///</summary> | ||||
public enum JT809SubBusinessType : ushort | public enum JT809SubBusinessType : ushort | ||||
{ | { | ||||
None=0x0000, | |||||
#region 主链路动态信息交换消息 UP_EXG_MSG | #region 主链路动态信息交换消息 UP_EXG_MSG | ||||
/// <summary> | /// <summary> | ||||
/// 上传车辆注册信息 | /// 上传车辆注册信息 | ||||
@@ -7,7 +7,7 @@ namespace JT809.Protocol.JT809Enums | |||||
/// <summary> | /// <summary> | ||||
/// 报警信息来源 | /// 报警信息来源 | ||||
/// </summary> | /// </summary> | ||||
public enum JT809_0x1402_WarnSrc : byte | |||||
public enum JT809WarnSrc : byte | |||||
{ | { | ||||
车载终端 = 0x00, | 车载终端 = 0x00, | ||||
企业监控平台 = 0x01, | 企业监控平台 = 0x01, |
@@ -1,17 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Enums | |||||
{ | |||||
/// <summary> | |||||
/// 报警信息来源 | |||||
/// </summary> | |||||
public enum JT809_0x9401_WarnSrc : byte | |||||
{ | |||||
车载终端 = 0x00, | |||||
企业监控平台 = 0x01, | |||||
政府监管平台 = 0x02, | |||||
其他 =0x09 | |||||
} | |||||
} |
@@ -1,17 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Enums | |||||
{ | |||||
/// <summary> | |||||
/// 报警信息来源 | |||||
/// </summary> | |||||
public enum JT809_0x9402_WarnSrc : byte | |||||
{ | |||||
车载终端 = 0x00, | |||||
企业监控平台 = 0x01, | |||||
政府监管平台 = 0x02, | |||||
其他 =0x09 | |||||
} | |||||
} |
@@ -1,17 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Enums | |||||
{ | |||||
/// <summary> | |||||
/// 报警信息来源 | |||||
/// </summary> | |||||
public enum JT809_0x9403_WarnSrc : byte | |||||
{ | |||||
车载终端 = 0x00, | |||||
企业监控平台 = 0x01, | |||||
政府监管平台 = 0x02, | |||||
其他 =0x09 | |||||
} | |||||
} |
@@ -43,7 +43,7 @@ namespace JT809.Protocol.JT809Extensions | |||||
} | } | ||||
} | } | ||||
private static Encoding encoding; | |||||
public static Encoding encoding; | |||||
public static int ReadBCD32(this byte data, byte dig) | public static int ReadBCD32(this byte data, byte dig) | ||||
{ | { | ||||
@@ -2,48 +2,47 @@ | |||||
using JT809.Protocol.JT809Enums; | using JT809.Protocol.JT809Enums; | ||||
using JT809.Protocol.JT809Exceptions; | using JT809.Protocol.JT809Exceptions; | ||||
using JT809.Protocol.JT809Extensions; | using JT809.Protocol.JT809Extensions; | ||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | using System; | ||||
using System.Buffers; | using System.Buffers; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
namespace JT809.Protocol.JT809Formatters | |||||
{ | { | ||||
public class JT809_0x1006Formatter : IJT809Formatter<JT809_0x1006> | |||||
public class JT809BodiesFormatter<TJT809Bodies> : IJT809Formatter<TJT809Bodies> | |||||
where TJT809Bodies: JT809Bodies,new () | |||||
{ | { | ||||
public JT809_0x1006 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
public TJT809Bodies Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | { | ||||
int offset = 0; | int offset = 0; | ||||
JT809_0x1006 jT809_0X1006 = new JT809_0x1006(); | |||||
jT809_0X1006.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X1006.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X1006.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X1006.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
TJT809Bodies jT809Bodies = new TJT809Bodies(); | |||||
jT809Bodies.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809Bodies.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809Bodies.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809Bodies.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | ||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X1006.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809Bodies.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | if (jT809SubBodiesTypeAttribute == null) | ||||
{ | { | ||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X1006.SubBusinessType.ToString()}"); | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809Bodies.SubBusinessType.ToString()}"); | |||||
} | } | ||||
try | try | ||||
{ | { | ||||
jT809_0X1006.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X1006.DataLength), out readSize); | |||||
jT809Bodies.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809Bodies.DataLength), out readSize); | |||||
} | } | ||||
catch | catch | ||||
{ | { | ||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X1006.SubBusinessType.ToString()}"); | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809Bodies.SubBusinessType.ToString()}"); | |||||
} | } | ||||
readSize = offset; | readSize = offset; | ||||
return jT809_0X1006; | |||||
return jT809Bodies; | |||||
} | } | ||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1006 value) | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, TJT809Bodies value) | |||||
{ | { | ||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | ||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | ||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | ||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | ||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | ||||
if (jT809SubBodiesTypeAttribute == null) | if (jT809SubBodiesTypeAttribute == null) | ||||
@@ -52,7 +51,11 @@ namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
} | } | ||||
try | try | ||||
{ | { | ||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
// 先写入内容,然后在根据内容反写内容长度 | |||||
offset = offset + 4; | |||||
int contentOffset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset - 4, (uint)(contentOffset- offset)); | |||||
offset = contentOffset; | |||||
} | } | ||||
catch | catch | ||||
{ | { |
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x1200Formatter : IJT809Formatter<JT809_0x1200> | |||||
{ | |||||
public JT809_0x1200 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x1200 jT809_0X1200 = new JT809_0x1200(); | |||||
jT809_0X1200.VehicleNo =JT809BinaryExtensions.ReadStringLittle(bytes, ref offset,21); | |||||
jT809_0X1200.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X1200.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X1200.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X1200.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X1200.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X1200.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X1200.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X1200.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X1200; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1200 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -39,7 +39,7 @@ namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1300 value) | public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1300 value) | ||||
{ | { | ||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | ||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | ||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | ||||
if (jT809SubBodiesTypeAttribute == null) | if (jT809SubBodiesTypeAttribute == null) | ||||
@@ -48,7 +48,11 @@ namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
} | } | ||||
try | try | ||||
{ | { | ||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
// 先写入内容,然后在根据内容反写内容长度 | |||||
offset = offset + 4; | |||||
int contentOffset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset - 4, (uint)(contentOffset - offset)); | |||||
offset = contentOffset; | |||||
} | } | ||||
catch | catch | ||||
{ | { | ||||
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x1400Formatter : IJT809Formatter<JT809_0x1400> | |||||
{ | |||||
public JT809_0x1400 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x1400 jT809_0X1400 = new JT809_0x1400(); | |||||
jT809_0X1400.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X1400.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X1400.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X1400.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X1400.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X1400.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X1400.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X1400.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X1400.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X1400; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1400 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x1500Formatter : IJT809Formatter<JT809_0x1500> | |||||
{ | |||||
public JT809_0x1500 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x1500 jT809_0X1500 = new JT809_0x1500(); | |||||
jT809_0X1500.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X1500.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X1500.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X1500.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X1500.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X1500.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X1500.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X1500.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X1500.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X1500; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1500 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x1600Formatter : IJT809Formatter<JT809_0x1600> | |||||
{ | |||||
public JT809_0x1600 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x1600 jT809_0X1600 = new JT809_0x1600(); | |||||
jT809_0X1600.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X1600.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X1600.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X1600.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X1600.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X1600.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X1600.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X1600.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X1600.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X1600; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1600 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x9200Formatter : IJT809Formatter<JT809_0x9200> | |||||
{ | |||||
public JT809_0x9200 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x9200 jT809_0X9200 = new JT809_0x9200(); | |||||
jT809_0X9200.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X9200.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9200.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X9200.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X9200.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X9200.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X9200.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X9200.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X9200.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X9200; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9200 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -39,7 +39,7 @@ namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9300 value) | public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9300 value) | ||||
{ | { | ||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | ||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | //JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | ||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | ||||
if (jT809SubBodiesTypeAttribute == null) | if (jT809SubBodiesTypeAttribute == null) | ||||
@@ -48,7 +48,11 @@ namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
} | } | ||||
try | try | ||||
{ | { | ||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
// 先写入内容,然后在根据内容反写内容长度 | |||||
offset = offset + 4; | |||||
int contentOffset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset - 4, (uint)(contentOffset - offset)); | |||||
offset = contentOffset; | |||||
} | } | ||||
catch | catch | ||||
{ | { | ||||
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x9400Formatter : IJT809Formatter<JT809_0x9400> | |||||
{ | |||||
public JT809_0x9400 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x9400 jT809_0X9400 = new JT809_0x9400(); | |||||
jT809_0X9400.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X9400.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9400.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X9400.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X9400.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X9400.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X9400.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X9400.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X9400.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X9400; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9400 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x9500Formatter : IJT809Formatter<JT809_0x9500> | |||||
{ | |||||
public JT809_0x9500 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x9500 jT809_0X9500 = new JT809_0x9500(); | |||||
jT809_0X9500.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X9500.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9500.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X9500.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X9500.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X9500.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X9500.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X9500.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X9500.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X9500; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9500 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -1,64 +0,0 @@ | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Exceptions; | |||||
using JT809.Protocol.JT809Extensions; | |||||
using JT809.Protocol.JT809MessageBody; | |||||
using System; | |||||
using System.Buffers; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters | |||||
{ | |||||
public class JT809_0x9600Formatter : IJT809Formatter<JT809_0x9600> | |||||
{ | |||||
public JT809_0x9600 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JT809_0x9600 jT809_0X9600 = new JT809_0x9600(); | |||||
jT809_0X9600.VehicleNo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 21); | |||||
jT809_0X9600.VehicleColor = (JT809VehicleColorType)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9600.SubBusinessType = (JT809SubBusinessType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
jT809_0X9600.DataLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = jT809_0X9600.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{jT809_0X9600.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
jT809_0X9600.JT809SubBodies = JT809FormatterResolverExtensions.JT809DynamicDeserialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), bytes.Slice(offset, (int)jT809_0X9600.DataLength), out readSize); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{jT809_0X9600.SubBusinessType.ToString()}"); | |||||
} | |||||
readSize = offset; | |||||
return jT809_0X9600; | |||||
} | |||||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9600 value) | |||||
{ | |||||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.VehicleNo, 21); | |||||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehicleColor); | |||||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, (ushort)value.SubBusinessType); | |||||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.DataLength); | |||||
//JT809.Protocol.JT809Enums.JT809BusinessType 映射对应消息特性 | |||||
JT809BodiesTypeAttribute jT809SubBodiesTypeAttribute = value.SubBusinessType.GetAttribute<JT809BodiesTypeAttribute>(); | |||||
if (jT809SubBodiesTypeAttribute == null) | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.GetAttributeError, $"JT809BodiesTypeAttribute Not Found>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
try | |||||
{ | |||||
offset = JT809FormatterResolverExtensions.JT809DynamicSerialize(JT809FormatterExtensions.GetFormatter(jT809SubBodiesTypeAttribute.JT809BodiesType), memoryOwner, offset, value.JT809SubBodies); | |||||
} | |||||
catch | |||||
{ | |||||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -13,7 +13,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||||
{ | { | ||||
int offset = 0; | int offset = 0; | ||||
JT809_0x1400_0x1402 jT809_0X1400_0X1402 = new JT809_0x1400_0x1402(); | JT809_0x1400_0x1402 jT809_0X1400_0X1402 = new JT809_0x1400_0x1402(); | ||||
jT809_0X1400_0X1402.WarnSrc = (JT809Enums.JT809_0x1402_WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X1400_0X1402.WarnSrc = (JT809Enums.JT809WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X1400_0X1402.WarnType= JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | jT809_0X1400_0X1402.WarnType= JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | ||||
jT809_0X1400_0X1402.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | jT809_0X1400_0X1402.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | ||||
jT809_0X1400_0X1402.InfoID= JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | jT809_0X1400_0X1402.InfoID= JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | ||||
@@ -13,7 +13,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||||
{ | { | ||||
int offset = 0; | int offset = 0; | ||||
JT809_0x9400_0x9401 jT809_0X9400_0X9401 = new JT809_0x9400_0x9401(); | JT809_0x9400_0x9401 jT809_0X9400_0X9401 = new JT809_0x9400_0x9401(); | ||||
jT809_0X9400_0X9401.WarnSrc = (JT809Enums.JT809_0x9401_WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9400_0X9401.WarnSrc = (JT809Enums.JT809WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9400_0X9401.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | jT809_0X9400_0X9401.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | ||||
jT809_0X9400_0X9401.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | jT809_0X9400_0X9401.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | ||||
jT809_0X9400_0X9401.SupervisionID = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | jT809_0X9400_0X9401.SupervisionID = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | ||||
@@ -13,7 +13,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||||
{ | { | ||||
int offset = 0; | int offset = 0; | ||||
JT809_0x9400_0x9402 jT809_0X9400_0X9402 = new JT809_0x9400_0x9402(); | JT809_0x9400_0x9402 jT809_0X9400_0X9402 = new JT809_0x9400_0x9402(); | ||||
jT809_0X9400_0X9402.WarnSrc = (JT809Enums.JT809_0x9402_WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9400_0X9402.WarnSrc = (JT809Enums.JT809WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9400_0X9402.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | jT809_0X9400_0X9402.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | ||||
jT809_0X9400_0X9402.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | jT809_0X9400_0X9402.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | ||||
jT809_0X9400_0X9402.WarnLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | jT809_0X9400_0X9402.WarnLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | ||||
@@ -13,7 +13,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||||
{ | { | ||||
int offset = 0; | int offset = 0; | ||||
JT809_0x9400_0x9403 jT809_0X9400_0X9403 = new JT809_0x9400_0x9403(); | JT809_0x9400_0x9403 jT809_0X9400_0X9403 = new JT809_0x9400_0x9403(); | ||||
jT809_0X9400_0X9403.WarnSrc = (JT809Enums.JT809_0x9403_WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9400_0X9403.WarnSrc = (JT809Enums.JT809WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jT809_0X9400_0X9403.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | jT809_0X9400_0X9403.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | ||||
jT809_0X9400_0X9403.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | jT809_0X9400_0X9403.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); | ||||
jT809_0X9400_0X9403.WarnLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | jT809_0X9400_0X9403.WarnLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | ||||
@@ -1,7 +1,5 @@ | |||||
using JT809.Protocol.JT809Enums; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Formatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -15,25 +13,6 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT809_0x1006:JT809Bodies | public class JT809_0x1006:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,9 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Formatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -14,28 +11,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:UP_EXG_MSG</para> | /// <para>业务数据类型标识:UP_EXG_MSG</para> | ||||
/// <para>描述:下级平台向上级平台发送车辆动态信息交换业务数据包</para> | /// <para>描述:下级平台向上级平台发送车辆动态信息交换业务数据包</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x1200Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x1200>))] | |||||
public class JT809_0x1200:JT809Bodies | public class JT809_0x1200:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,7 +1,6 @@ | |||||
using JT809.Protocol.JT809Enums; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Formatters; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -12,19 +11,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:UP_PLATFORM_MSG</para> | /// <para>业务数据类型标识:UP_PLATFORM_MSG</para> | ||||
/// <para>描述:下级平台向上级平台发送平台间交互信息</para> | /// <para>描述:下级平台向上级平台发送平台间交互信息</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x1300Formatter))] | |||||
public class JT809_0x1300:JT809Bodies | public class JT809_0x1300:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,9 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Formatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -15,28 +12,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:UP_WARN_MSG</para> | /// <para>业务数据类型标识:UP_WARN_MSG</para> | ||||
/// <para>描述:下级平台向上级平台发送车辆报警信息业务</para> | /// <para>描述:下级平台向上级平台发送车辆报警信息业务</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x1400Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x1400>))] | |||||
public class JT809_0x1400:JT809Bodies | public class JT809_0x1400:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,9 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Formatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -14,28 +11,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:UP_CTRL_MSG</para> | /// <para>业务数据类型标识:UP_CTRL_MSG</para> | ||||
/// <para>描述:下级平台向上级平台发送车辆监管业务</para> | /// <para>描述:下级平台向上级平台发送车辆监管业务</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x1500Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x1500>))] | |||||
public class JT809_0x1500:JT809Bodies | public class JT809_0x1500:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,9 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Formatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -14,28 +11,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>消息方向:下级平台往上级平台</para> | /// <para>消息方向:下级平台往上级平台</para> | ||||
/// <para>描述:下级平台向上级平台发送车辆睁态信息交换业务</para> | /// <para>描述:下级平台向上级平台发送车辆睁态信息交换业务</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x1600Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x1600>))] | |||||
public class JT809_0x1600:JT809Bodies | public class JT809_0x1600:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,9 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Formatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -14,28 +11,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:DOWN_EXG_MSG</para> | /// <para>业务数据类型标识:DOWN_EXG_MSG</para> | ||||
/// <para>描述:上级平台作为客户端向下级平台服务端发送车辆动态信息交换业务</para> | /// <para>描述:上级平台作为客户端向下级平台服务端发送车辆动态信息交换业务</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x9200Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x9200>))] | |||||
public class JT809_0x9200:JT809Bodies | public class JT809_0x9200:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,9 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | ||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -17,17 +14,6 @@ namespace JT809.Protocol.JT809MessageBody | |||||
[JT809Formatter(typeof(JT809_0x9300Formatter))] | [JT809Formatter(typeof(JT809_0x9300Formatter))] | ||||
public class JT809_0x9300:JT809Bodies | public class JT809_0x9300:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,5 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | using JT809.Protocol.JT809Enums; | ||||
using JT809.Protocol.JT809Formatters; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -14,28 +15,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:DOWN_WARN_MSG</para> | /// <para>业务数据类型标识:DOWN_WARN_MSG</para> | ||||
/// <para>描述:上级平台向下级平台发送报瞥信息业务</para> | /// <para>描述:上级平台向下级平台发送报瞥信息业务</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x9400Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x9400>))] | |||||
public class JT809_0x9400:JT809Bodies | public class JT809_0x9400:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,9 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using JT809.Protocol.JT809Formatters; | |||||
namespace JT809.Protocol.JT809MessageBody | namespace JT809.Protocol.JT809MessageBody | ||||
{ | { | ||||
@@ -14,28 +11,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:DOWN_CTRL_MSG</para> | /// <para>业务数据类型标识:DOWN_CTRL_MSG</para> | ||||
/// <para>描述:上级平台向下级平台发送车辆监监管业务</para> | /// <para>描述:上级平台向下级平台发送车辆监监管业务</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x9500Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x9500>))] | |||||
public class JT809_0x9500:JT809Bodies | public class JT809_0x9500:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,5 +1,6 @@ | |||||
using JT809.Protocol.JT809Attributes; | using JT809.Protocol.JT809Attributes; | ||||
using JT809.Protocol.JT809Enums; | using JT809.Protocol.JT809Enums; | ||||
using JT809.Protocol.JT809Formatters; | |||||
using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | using JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -14,28 +15,9 @@ namespace JT809.Protocol.JT809MessageBody | |||||
/// <para>业务数据类型标识:DOWN_BASE_MSG</para> | /// <para>业务数据类型标识:DOWN_BASE_MSG</para> | ||||
/// <para>描述:上级平台向下级平台发送车辆静态信息交换业务</para> | /// <para>描述:上级平台向下级平台发送车辆静态信息交换业务</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x9600Formatter))] | |||||
[JT809Formatter(typeof(JT809BodiesFormatter<JT809_0x9600>))] | |||||
public class JT809_0x9600:JT809Bodies | public class JT809_0x9600:JT809Bodies | ||||
{ | { | ||||
/// <summary> | |||||
/// 车牌号 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车辆颜色 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 子业务类型标识 | |||||
/// </summary> | |||||
public JT809SubBusinessType SubBusinessType { get; set; } | |||||
/// <summary> | |||||
/// 后续数据长度 | |||||
/// </summary> | |||||
public uint DataLength { get; set; } | |||||
/// <summary> | |||||
/// 子业务数据体 | |||||
/// </summary> | |||||
public JT809SubBodies JT809SubBodies { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,4 +1,6 @@ | |||||
using System; | |||||
using JT809.Protocol.JT809Attributes; | |||||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
@@ -8,6 +10,7 @@ namespace JT809.Protocol.JT809SubMessageBody | |||||
/// 主动上报驾驶员身份信息消息 | /// 主动上报驾驶员身份信息消息 | ||||
/// <para>子业务类型标识:UP_EXG_MSG_REPORT_DRIVER_INFO</para> | /// <para>子业务类型标识:UP_EXG_MSG_REPORT_DRIVER_INFO</para> | ||||
/// </summary> | /// </summary> | ||||
[JT809Formatter(typeof(JT809_0x1200_0x120CFormatter))] | |||||
public class JT809_0x1200_0x120C:JT809SubBodies | public class JT809_0x1200_0x120C:JT809SubBodies | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
@@ -19,7 +19,7 @@ namespace JT809.Protocol.JT809SubMessageBody | |||||
/// <summary> | /// <summary> | ||||
/// 报警信息来源 | /// 报警信息来源 | ||||
/// </summary> | /// </summary> | ||||
public JT809_0x1402_WarnSrc WarnSrc { get; set; } | |||||
public JT809WarnSrc WarnSrc { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 报警类型 | /// 报警类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -18,7 +18,7 @@ namespace JT809.Protocol.JT809SubMessageBody | |||||
/// <summary> | /// <summary> | ||||
/// 报警信息来源 | /// 报警信息来源 | ||||
/// </summary> | /// </summary> | ||||
public JT809_0x9401_WarnSrc WarnSrc { get; set; } | |||||
public JT809WarnSrc WarnSrc { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 报警类型 | /// 报警类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -19,7 +19,7 @@ namespace JT809.Protocol.JT809SubMessageBody | |||||
/// <summary> | /// <summary> | ||||
/// 报警信息来源 | /// 报警信息来源 | ||||
/// </summary> | /// </summary> | ||||
public JT809_0x9402_WarnSrc WarnSrc { get; set; } | |||||
public JT809WarnSrc WarnSrc { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 报警类型 | /// 报警类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -19,7 +19,7 @@ namespace JT809.Protocol.JT809SubMessageBody | |||||
/// <summary> | /// <summary> | ||||
/// 报警信息来源 | /// 报警信息来源 | ||||
/// </summary> | /// </summary> | ||||
public JT809_0x9403_WarnSrc WarnSrc { get; set; } | |||||
public JT809WarnSrc WarnSrc { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 报警类型 | /// 报警类型 | ||||
/// </summary> | /// </summary> | ||||