@@ -1,6 +1,11 @@ | |||||
using JT808.Protocol.Enums; | using JT808.Protocol.Enums; | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Interfaces; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Diagnostics; | |||||
using System.Linq; | |||||
using System.Reflection; | |||||
using Xunit; | using Xunit; | ||||
namespace JT808.Protocol.Test.Extensions | namespace JT808.Protocol.Test.Extensions | ||||
{ | { | ||||
@@ -8,8 +13,7 @@ namespace JT808.Protocol.Test.Extensions | |||||
{ | { | ||||
[Fact] | [Fact] | ||||
public void Test1() | public void Test1() | ||||
{ | { | ||||
var list0 = JT808EnumExtensions.GetEnumTypes<JT808.Protocol.Enums.JT808Alarm>(5, 32); | var list0 = JT808EnumExtensions.GetEnumTypes<JT808.Protocol.Enums.JT808Alarm>(5, 32); | ||||
var list1 = JT808EnumExtensions.GetEnumTypes<JT808.Protocol.Enums.JT808Alarm>(16, 32); | var list1 = JT808EnumExtensions.GetEnumTypes<JT808.Protocol.Enums.JT808Alarm>(16, 32); | ||||
var list2 = JT808EnumExtensions.GetEnumTypes<JT808.Protocol.Enums.JT808Alarm>(18, 32); | var list2 = JT808EnumExtensions.GetEnumTypes<JT808.Protocol.Enums.JT808Alarm>(18, 32); | ||||
@@ -24,5 +28,31 @@ namespace JT808.Protocol.Test.Extensions | |||||
Assert.Equal(list4, new List<JT808Alarm>() { JT808Alarm.紧急报警_触动报警开关后触发, JT808Alarm.超速报警,JT808Alarm.疲劳驾驶, JT808Alarm.危险预警, JT808Alarm.GNSS模块发生故障 }); | Assert.Equal(list4, new List<JT808Alarm>() { JT808Alarm.紧急报警_触动报警开关后触发, JT808Alarm.超速报警,JT808Alarm.疲劳驾驶, JT808Alarm.危险预警, JT808Alarm.GNSS模块发生故障 }); | ||||
Assert.Equal(list5, new List<JT808Alarm>() { JT808Alarm.紧急报警_触动报警开关后触发, JT808Alarm.超速报警, JT808Alarm.疲劳驾驶, JT808Alarm.危险预警, JT808Alarm.GNSS模块发生故障, JT808Alarm.非法开门报警 }); | Assert.Equal(list5, new List<JT808Alarm>() { JT808Alarm.紧急报警_触动报警开关后触发, JT808Alarm.超速报警, JT808Alarm.疲劳驾驶, JT808Alarm.危险预警, JT808Alarm.GNSS模块发生故障, JT808Alarm.非法开门报警 }); | ||||
} | } | ||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
var types = Enum.GetNames(typeof(JT808MsgId)); | |||||
var bodyTypes = Assembly.GetAssembly(typeof(JT808Package)).GetTypes().Where(w => w.BaseType == typeof(JT808Bodies)).ToList(); | |||||
Assert.Equal(types.Length, bodyTypes.Count); | |||||
} | |||||
[Fact] | |||||
public void Test3() | |||||
{ | |||||
var types = Enum.GetNames(typeof(JT808MsgId)); | |||||
var bodyTypes = Assembly.GetAssembly(typeof(JT808Package)).GetTypes().Where(w => w.BaseType == typeof(JT808Bodies)).ToList(); | |||||
foreach (var type in bodyTypes) | |||||
{ | |||||
var instance = Activator.CreateInstance(type); | |||||
if(instance is JT808Bodies jT808Bodies) | |||||
{ | |||||
string code = $"0x{jT808Bodies.MsgId.ToString("X2").PadLeft(4, '0')}"; | |||||
string name = jT808Bodies.Description; | |||||
Debug.WriteLine(type.FullName); | |||||
} | |||||
} | |||||
Assert.Equal(types.Length, bodyTypes.Count); | |||||
} | |||||
} | } | ||||
} | } |
@@ -0,0 +1,77 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Exceptions; | |||||
using JT808.Protocol.Extensions; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using Xunit; | |||||
namespace JT808.Protocol.Test.Extensions | |||||
{ | |||||
public class JT808ValidationExtensionsTest | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
string str = "SmallChi"; | |||||
str.ValiString(nameof(str), 8); | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
string str = "SmallChi"; | |||||
var ex=Assert.Throws<JT808Exception>(() => | |||||
{ | |||||
str.ValiString(nameof(str),4); | |||||
}); | |||||
Assert.Equal(JT808ErrorCode.VailLength, ex.ErrorCode); | |||||
Assert.Equal("str:8>fixed[4]", ex.Message); | |||||
} | |||||
[Fact] | |||||
public void Test3() | |||||
{ | |||||
string str = "SmallChi"; | |||||
var ex = Assert.Throws<JT808Exception>(() => | |||||
{ | |||||
str.ValiString(nameof(str), 16); | |||||
}); | |||||
Assert.Equal(JT808ErrorCode.NotEnoughLength, ex.ErrorCode); | |||||
Assert.Equal("str:8<fixed[16]", ex.Message); | |||||
} | |||||
[Fact] | |||||
public void Test4() | |||||
{ | |||||
byte[] arr = new byte[7]; | |||||
arr.ValiBytes(nameof(arr), 7); | |||||
} | |||||
[Fact] | |||||
public void Test5() | |||||
{ | |||||
byte[] arr = new byte[7]; | |||||
var ex = Assert.Throws<JT808Exception>(() => | |||||
{ | |||||
arr.ValiBytes(nameof(arr), 6); | |||||
}); | |||||
Assert.Equal(JT808ErrorCode.VailLength, ex.ErrorCode); | |||||
Assert.Equal("arr:7>fixed[6]", ex.Message); | |||||
} | |||||
[Fact] | |||||
public void Test6() | |||||
{ | |||||
byte[] arr = new byte[7]; | |||||
var ex = Assert.Throws<JT808Exception>(() => | |||||
{ | |||||
arr.ValiBytes(nameof(arr), 8); | |||||
}); | |||||
Assert.Equal(JT808ErrorCode.NotEnoughLength, ex.ErrorCode); | |||||
Assert.Equal("arr:7<fixed[8]", ex.Message); | |||||
} | |||||
} | |||||
} |
@@ -32,6 +32,7 @@ | |||||
<Compile Include="Extensions\JT808EnumExtensionsTest.cs" /> | <Compile Include="Extensions\JT808EnumExtensionsTest.cs" /> | ||||
<Compile Include="Extensions\JT808HexExtensionsTest.cs" /> | <Compile Include="Extensions\JT808HexExtensionsTest.cs" /> | ||||
<Compile Include="Extensions\JT808PackageExtensionsTest.cs" /> | <Compile Include="Extensions\JT808PackageExtensionsTest.cs" /> | ||||
<Compile Include="Extensions\JT808ValidationExtensionsTest.cs" /> | |||||
<Compile Include="MessageBody\JT808LocationAttachExtensions\JT808LocationAttachImpl0x06.cs" /> | <Compile Include="MessageBody\JT808LocationAttachExtensions\JT808LocationAttachImpl0x06.cs" /> | ||||
<Compile Include="MessageBody\JT808_0x0001Test.cs" /> | <Compile Include="MessageBody\JT808_0x0001Test.cs" /> | ||||
<Compile Include="MessageBody\JT808_0x0002Test.cs" /> | <Compile Include="MessageBody\JT808_0x0002Test.cs" /> | ||||
@@ -47,7 +47,7 @@ namespace JT808.Protocol.Test | |||||
{ | { | ||||
ReplyMsgId = Enums.JT808MsgId.终端心跳.ToUInt16Value(), | ReplyMsgId = Enums.JT808MsgId.终端心跳.ToUInt16Value(), | ||||
ReplyMsgNum = 1000, | ReplyMsgNum = 1000, | ||||
JT808TerminalResult = Enums.JT808TerminalResult.Success | TerminalResult = Enums.JT808TerminalResult.Success | ||||
} | } | ||||
}; | }; | ||||
var hexSpan = jT808Serializer.SerializeReadOnlySpan(jT808Package); | var hexSpan = jT808Serializer.SerializeReadOnlySpan(jT808Package); | ||||
@@ -23,7 +23,7 @@ namespace JT808.Protocol.Test.MessageBody | |||||
{ | { | ||||
ReplyMsgId = Enums.JT808MsgId.终端心跳.ToUInt16Value(), | ReplyMsgId = Enums.JT808MsgId.终端心跳.ToUInt16Value(), | ||||
ReplyMsgNum = 1000, | ReplyMsgNum = 1000, | ||||
JT808TerminalResult = Enums.JT808TerminalResult.Success | TerminalResult = Enums.JT808TerminalResult.Success | ||||
} | } | ||||
}; | }; | ||||
//"7E 00 01 00 05 01 23 45 67 89 00 04 B3 03 E8 00 02 00 D3 7E" | //"7E 00 01 00 05 01 23 45 67 89 00 04 B3 03 E8 00 02 00 D3 7E" | ||||
@@ -42,7 +42,7 @@ namespace JT808.Protocol.Test.MessageBody | |||||
JT808_0x0001 JT808Bodies = (JT808_0x0001)jT808Package.Bodies; | JT808_0x0001 JT808Bodies = (JT808_0x0001)jT808Package.Bodies; | ||||
Assert.Equal(Enums.JT808MsgId.终端心跳.ToUInt16Value(), JT808Bodies.ReplyMsgId); | Assert.Equal(Enums.JT808MsgId.终端心跳.ToUInt16Value(), JT808Bodies.ReplyMsgId); | ||||
Assert.Equal(1000, JT808Bodies.ReplyMsgNum); | Assert.Equal(1000, JT808Bodies.ReplyMsgNum); | ||||
Assert.Equal(Enums.JT808TerminalResult.Success, JT808Bodies.JT808TerminalResult); | Assert.Equal(Enums.JT808TerminalResult.Success, JT808Bodies.TerminalResult); | ||||
} | } | ||||
[Fact] | [Fact] | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
@@ -9,7 +9,7 @@ using System.Text; | |||||
using Xunit; | using Xunit; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using JT808.Protocol.Attributes; | |||||
using Newtonsoft.Json.Linq; | using Newtonsoft.Json.Linq; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using JT808.Protocol.Internal; | using JT808.Protocol.Internal; | ||||
@@ -10,7 +10,7 @@ using Xunit; | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Internal; | using JT808.Protocol.Internal; | ||||
namespace JT808.Protocol.Test.Simples | namespace JT808.Protocol.Test.Simples | ||||
@@ -1,14 +0,0 @@ | |||||
using System; | |||||
namespace JT808.Protocol.Attributes | |||||
{ | |||||
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | |||||
public sealed class JT808BodiesTypeAttribute : Attribute | |||||
{ | |||||
public JT808BodiesTypeAttribute(Type jT808BodiesType) | |||||
{ | |||||
JT808BodiesType = jT808BodiesType; | |||||
} | |||||
public Type JT808BodiesType { get; } | |||||
} | |||||
} |
@@ -1,20 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Attributes | |||||
{ | |||||
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | |||||
public sealed class JT808MsgIdDescriptionAttribute : Attribute | |||||
{ | |||||
public string Code { get; set; } | |||||
public string Name { get; set; } | |||||
public JT808MsgIdDescriptionAttribute(string code, string name) | |||||
{ | |||||
Code = code; | |||||
Name = name; | |||||
} | |||||
} | |||||
} |
@@ -3,7 +3,8 @@ | |||||
namespace JT808.Protocol.Buffers | namespace JT808.Protocol.Buffers | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// <see cref="System.Buffers.Writer"/> | /// | ||||
/// ref System.Buffers.Writer | |||||
/// </summary> | /// </summary> | ||||
ref partial struct JT808BufferWriter | ref partial struct JT808BufferWriter | ||||
{ | { | ||||
@@ -7,6 +7,9 @@ using System.Text; | |||||
namespace JT808.Protocol | namespace JT808.Protocol | ||||
{ | { | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public static class DependencyInjectionExtensions | public static class DependencyInjectionExtensions | ||||
{ | { | ||||
public static IJT808Builder AddJT808Configure(this IServiceCollection services, IJT808Config jT808Config) | public static IJT808Builder AddJT808Configure(this IServiceCollection services, IJT808Config jT808Config) | ||||
@@ -3,11 +3,11 @@ | |||||
public enum JT808ErrorCode | public enum JT808ErrorCode | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 校验和不相等 | /// JT808校验和不相等 | ||||
/// </summary> | /// </summary> | ||||
CheckCodeNotEqual = 1001, | CheckCodeNotEqual = 1001, | ||||
/// <summary> | /// <summary> | ||||
/// 校验和不相等 | /// JT19056校验和不相等 | ||||
/// </summary> | /// </summary> | ||||
CarDVRCheckCodeNotEqual = 1002, | CarDVRCheckCodeNotEqual = 1002, | ||||
/// <summary> | /// <summary> | ||||
@@ -18,7 +18,10 @@ | |||||
/// 消息体解析错误 | /// 消息体解析错误 | ||||
/// </summary> | /// </summary> | ||||
BodiesParseError = 1004, | BodiesParseError = 1004, | ||||
GetAttributeError = 1005, | /// <summary> | ||||
/// 验证长度 | |||||
/// </summary> | |||||
VailLength = 1005, | |||||
/// <summary> | /// <summary> | ||||
/// 没有实现对应的类型 | /// 没有实现对应的类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -29,7 +32,7 @@ | |||||
NotEnoughLength = 1007, | NotEnoughLength = 1007, | ||||
/// <summary> | /// <summary> | ||||
/// 没有全局注册格式化器 | /// 没有全局注册格式化器 | ||||
/// <see cref="JT808.Protocol.Formatters.IJT808MessagePackFormatter<T>"/> | /// IJT808MessagePackFormatter | ||||
/// </summary> | /// </summary> | ||||
NotGlobalRegisterFormatterAssembly = 1008, | NotGlobalRegisterFormatterAssembly = 1008, | ||||
/// <summary> | /// <summary> | ||||
@@ -1,5 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | using JT808.Protocol.MessageBody; | ||||
using JT808.Protocol.MessageBody; | |||||
namespace JT808.Protocol.Enums | namespace JT808.Protocol.Enums | ||||
{ | { | ||||
@@ -12,498 +11,356 @@ namespace JT808.Protocol.Enums | |||||
/// 终端通用应答 | /// 终端通用应答 | ||||
/// 0x0001 | /// 0x0001 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0001))] | |||||
[JT808MsgIdDescription("0x0001", "终端通用应答")] | |||||
终端通用应答 = 0x0001, | 终端通用应答 = 0x0001, | ||||
/// <summary> | /// <summary> | ||||
/// 平台通用应答 | /// 平台通用应答 | ||||
/// 0x8001 | /// 0x8001 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8001))] | |||||
[JT808MsgIdDescription("0x8001", "平台通用应答")] | |||||
平台通用应答 = 0x8001, | 平台通用应答 = 0x8001, | ||||
/// <summary> | /// <summary> | ||||
/// 终端心跳 | /// 终端心跳 | ||||
/// 0x0002 | /// 0x0002 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0002))] | |||||
[JT808MsgIdDescription("0x0002", "终端心跳")] | |||||
终端心跳 = 0x0002, | 终端心跳 = 0x0002, | ||||
/// <summary> | /// <summary> | ||||
/// 补传分包请求 | /// 补传分包请求 | ||||
/// 0x8003 | /// 0x8003 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8003))] | |||||
[JT808MsgIdDescription("0x8003", "补传分包请求")] | |||||
补传分包请求 = 0x8003, | 补传分包请求 = 0x8003, | ||||
/// <summary> | /// <summary> | ||||
/// 终端注册 | /// 终端注册 | ||||
/// 0x0100 | /// 0x0100 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0100))] | |||||
[JT808MsgIdDescription("0x0100", "终端注册")] | |||||
终端注册 = 0x0100, | 终端注册 = 0x0100, | ||||
/// <summary> | /// <summary> | ||||
/// 终端注册应答 | /// 终端注册应答 | ||||
/// 0x8100 | /// 0x8100 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8100))] | |||||
[JT808MsgIdDescription("0x8100", "终端注册应答")] | |||||
终端注册应答 = 0x8100, | 终端注册应答 = 0x8100, | ||||
/// <summary> | /// <summary> | ||||
/// 终端注销 | /// 终端注销 | ||||
/// 0x0003 | /// 0x0003 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0003))] | |||||
[JT808MsgIdDescription("0x0003", "终端注销")] | |||||
终端注销 = 0x0003, | 终端注销 = 0x0003, | ||||
/// <summary> | /// <summary> | ||||
/// 终端鉴权 | /// 终端鉴权 | ||||
/// 0x0102 | /// 0x0102 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0102))] | |||||
[JT808MsgIdDescription("0x0102", "终端鉴权")] | |||||
终端鉴权 = 0x0102, | 终端鉴权 = 0x0102, | ||||
/// <summary> | /// <summary> | ||||
/// 设置终端参数 | /// 设置终端参数 | ||||
/// 0x8103 | /// 0x8103 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8103))] | |||||
[JT808MsgIdDescription("0x8103", "设置终端参数")] | |||||
设置终端参数 = 0x8103, | 设置终端参数 = 0x8103, | ||||
/// <summary> | /// <summary> | ||||
/// 查询终端参数 | /// 查询终端参数 | ||||
/// 0x8104 | /// 0x8104 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8104))] | |||||
[JT808MsgIdDescription("0x8104", "查询终端参数")] | |||||
查询终端参数 = 0x8104, | 查询终端参数 = 0x8104, | ||||
/// <summary> | /// <summary> | ||||
/// 查询终端参数应答 | /// 查询终端参数应答 | ||||
/// 0x0104 | /// 0x0104 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0104))] | |||||
[JT808MsgIdDescription("0x0104", "查询终端参数应答")] | |||||
查询终端参数应答 = 0x0104, | 查询终端参数应答 = 0x0104, | ||||
/// <summary> | /// <summary> | ||||
/// 终端控制 | /// 终端控制 | ||||
/// 0x8105 | /// 0x8105 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8105))] | |||||
[JT808MsgIdDescription("0x8105", "终端控制")] | |||||
终端控制 = 0x8105, | 终端控制 = 0x8105, | ||||
/// <summary> | /// <summary> | ||||
/// 查询指定终端参数 | /// 查询指定终端参数 | ||||
/// 0x8106 | /// 0x8106 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8106))] | |||||
[JT808MsgIdDescription("0x8106", "查询指定终端参数")] | |||||
查询指定终端参数 = 0x8106, | 查询指定终端参数 = 0x8106, | ||||
/// <summary> | /// <summary> | ||||
/// 查询终端属性 | /// 查询终端属性 | ||||
/// 0x8107 | /// 0x8107 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8107))] | |||||
[JT808MsgIdDescription("0x8107", "查询终端属性")] | |||||
查询终端属性 = 0x8107, | 查询终端属性 = 0x8107, | ||||
/// <summary> | /// <summary> | ||||
/// 查询终端属性应答 | /// 查询终端属性应答 | ||||
/// 0x0107 | /// 0x0107 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0107))] | |||||
[JT808MsgIdDescription("0x0107", "查询终端属性应答")] | |||||
查询终端属性应答 = 0x0107, | 查询终端属性应答 = 0x0107, | ||||
/// <summary> | /// <summary> | ||||
/// 下发终端升级包 | /// 下发终端升级包 | ||||
/// 0x8108 | /// 0x8108 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8108))] | |||||
[JT808MsgIdDescription("0x8108", "下发终端升级包")] | |||||
下发终端升级包 = 0x8108, | 下发终端升级包 = 0x8108, | ||||
/// <summary> | /// <summary> | ||||
/// 终端升级结果通知 | /// 终端升级结果通知 | ||||
/// 0x0108 | /// 0x0108 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0108))] | |||||
[JT808MsgIdDescription("0x0108", "终端升级结果通知")] | |||||
终端升级结果通知 = 0x0108, | 终端升级结果通知 = 0x0108, | ||||
/// <summary> | /// <summary> | ||||
/// 位置信息汇报 | /// 位置信息汇报 | ||||
/// 0x0200 | /// 0x0200 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0200))] | |||||
[JT808MsgIdDescription("0x0200", "位置信息汇报")] | |||||
位置信息汇报 = 0x0200, | 位置信息汇报 = 0x0200, | ||||
/// <summary> | /// <summary> | ||||
/// 位置信息查询 | /// 位置信息查询 | ||||
/// 0x8201 | /// 0x8201 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8201))] | |||||
[JT808MsgIdDescription("0x8201", "位置信息查询")] | |||||
位置信息查询 = 0x8201, | 位置信息查询 = 0x8201, | ||||
/// <summary> | /// <summary> | ||||
/// 位置信息查询应答 | /// 位置信息查询应答 | ||||
/// 0x0201 | /// 0x0201 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0201))] | |||||
[JT808MsgIdDescription("0x0201", "位置信息查询应答")] | |||||
位置信息查询应答 = 0x0201, | 位置信息查询应答 = 0x0201, | ||||
/// <summary> | /// <summary> | ||||
/// 临时位置跟踪控制 | /// 临时位置跟踪控制 | ||||
/// 0x8202 | /// 0x8202 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8202))] | |||||
[JT808MsgIdDescription("0x8202", "临时位置跟踪控制")] | |||||
临时位置跟踪控制 = 0x8202, | 临时位置跟踪控制 = 0x8202, | ||||
/// <summary> | /// <summary> | ||||
/// 人工确认报警消息 | /// 人工确认报警消息 | ||||
/// 0x8203 | /// 0x8203 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8203))] | |||||
[JT808MsgIdDescription("0x8203", "人工确认报警消息")] | |||||
人工确认报警消息 = 0x8203, | 人工确认报警消息 = 0x8203, | ||||
/// <summary> | /// <summary> | ||||
/// 文本信息下发 | /// 文本信息下发 | ||||
/// 0x8300 | /// 0x8300 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8300))] | |||||
[JT808MsgIdDescription("0x8300", "文本信息下发")] | |||||
文本信息下发 = 0x8300, | 文本信息下发 = 0x8300, | ||||
/// <summary> | /// <summary> | ||||
/// 事件设置 | /// 事件设置 | ||||
/// 0x8301 | /// 0x8301 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8301))] | |||||
[JT808MsgIdDescription("0x8301", "事件设置")] | |||||
事件设置 = 0x8301, | 事件设置 = 0x8301, | ||||
/// <summary> | /// <summary> | ||||
/// 事件报告 | /// 事件报告 | ||||
/// 0x0301 | /// 0x0301 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0301))] | |||||
[JT808MsgIdDescription("0x0301", "事件报告")] | |||||
事件报告 = 0x0301, | 事件报告 = 0x0301, | ||||
/// <summary> | /// <summary> | ||||
/// 提问下发 | /// 提问下发 | ||||
/// 0x8302 | /// 0x8302 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8302))] | |||||
[JT808MsgIdDescription("0x8302", "提问下发")] | |||||
提问下发 = 0x8302, | 提问下发 = 0x8302, | ||||
/// <summary> | /// <summary> | ||||
/// 提问应答 | /// 提问应答 | ||||
/// 0x0302 | /// 0x0302 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0302))] | |||||
[JT808MsgIdDescription("0x8302", "提问应答")] | |||||
提问应答 = 0x0302, | 提问应答 = 0x0302, | ||||
/// <summary> | /// <summary> | ||||
/// 信息点播菜单设置 | /// 信息点播菜单设置 | ||||
/// 0x8303 | /// 0x8303 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8303))] | |||||
[JT808MsgIdDescription("0x8303", "信息点播菜单设置")] | |||||
信息点播菜单设置 = 0x8303, | 信息点播菜单设置 = 0x8303, | ||||
/// <summary> | /// <summary> | ||||
/// 信息点播/取消 | /// 信息点播/取消 | ||||
/// 0x0303 | /// 0x0303 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0303))] | |||||
[JT808MsgIdDescription("0x0303", "信息点播或取消")] | |||||
信息点播_取消 = 0x0303, | 信息点播_取消 = 0x0303, | ||||
/// <summary> | /// <summary> | ||||
/// 信息服务 | /// 信息服务 | ||||
/// 0x8304 | /// 0x8304 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8304))] | |||||
[JT808MsgIdDescription("0x8304", "信息服务")] | |||||
信息服务 = 0x8304, | 信息服务 = 0x8304, | ||||
/// <summary> | /// <summary> | ||||
/// 电话回拨 | /// 电话回拨 | ||||
/// 0x8400 | /// 0x8400 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8400))] | |||||
[JT808MsgIdDescription("0x8400", "电话回拨")] | |||||
电话回拨 = 0x8400, | 电话回拨 = 0x8400, | ||||
/// <summary> | /// <summary> | ||||
/// 设置电话本 | /// 设置电话本 | ||||
/// 0x8401 | /// 0x8401 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8401))] | |||||
[JT808MsgIdDescription("0x8401", "设置电话本")] | |||||
设置电话本 = 0x8401, | 设置电话本 = 0x8401, | ||||
/// <summary> | /// <summary> | ||||
/// 车辆控制 | /// 车辆控制 | ||||
/// 0x8500 | /// 0x8500 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8500))] | |||||
[JT808MsgIdDescription("0x8500", "车辆控制")] | |||||
车辆控制 = 0x8500, | 车辆控制 = 0x8500, | ||||
/// <summary> | /// <summary> | ||||
/// 车辆控制应答 | /// 车辆控制应答 | ||||
/// 0x0500 | /// 0x0500 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0500))] | |||||
[JT808MsgIdDescription("0x0500", "车辆控制应答")] | |||||
车辆控制应答 = 0x0500, | 车辆控制应答 = 0x0500, | ||||
/// <summary> | /// <summary> | ||||
/// 设置圆形区域 | /// 设置圆形区域 | ||||
/// 0x8600 | /// 0x8600 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8600))] | |||||
[JT808MsgIdDescription("0x8600", "设置圆形区域")] | |||||
设置圆形区域 = 0x8600, | 设置圆形区域 = 0x8600, | ||||
/// <summary> | /// <summary> | ||||
/// 删除圆形区域 | /// 删除圆形区域 | ||||
/// 0x8601 | /// 0x8601 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8601))] | |||||
[JT808MsgIdDescription("0x8601", "删除圆形区域")] | |||||
删除圆形区域 = 0x8601, | 删除圆形区域 = 0x8601, | ||||
/// <summary> | /// <summary> | ||||
/// 设置矩形区域 | /// 设置矩形区域 | ||||
/// 0x8602 | /// 0x8602 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8602))] | |||||
[JT808MsgIdDescription("0x8602", "设置矩形区域")] | |||||
设置矩形区域 = 0x8602, | 设置矩形区域 = 0x8602, | ||||
/// <summary> | /// <summary> | ||||
/// 删除矩形区域 | /// 删除矩形区域 | ||||
/// 0x8603 | /// 0x8603 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8603))] | |||||
[JT808MsgIdDescription("0x8603", "删除矩形区域")] | |||||
删除矩形区域 = 0x8603, | 删除矩形区域 = 0x8603, | ||||
/// <summary> | /// <summary> | ||||
/// 设置多边形区域 | /// 设置多边形区域 | ||||
/// 0x8604 | /// 0x8604 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8604))] | |||||
[JT808MsgIdDescription("0x8604", "设置多边形区域")] | |||||
设置多边形区域 = 0x8604, | 设置多边形区域 = 0x8604, | ||||
/// <summary> | /// <summary> | ||||
/// 删除多边形区域 | /// 删除多边形区域 | ||||
/// 0x8605 | /// 0x8605 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8605))] | |||||
[JT808MsgIdDescription("0x8605", "删除多边形区域")] | |||||
删除多边形区域 = 0x8605, | 删除多边形区域 = 0x8605, | ||||
/// <summary> | /// <summary> | ||||
/// 设置路线 | /// 设置路线 | ||||
/// 0x8606 | /// 0x8606 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8606))] | |||||
[JT808MsgIdDescription("0x8606", "设置路线")] | |||||
设置路线 = 0x8606, | 设置路线 = 0x8606, | ||||
/// <summary> | /// <summary> | ||||
/// 删除路线 | /// 删除路线 | ||||
/// 0x8607 | /// 0x8607 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8607))] | |||||
[JT808MsgIdDescription("0x8607", "删除路线")] | |||||
删除路线 = 0x8607, | 删除路线 = 0x8607, | ||||
///// <summary> | /// <summary> | ||||
///// 行驶记录仪数据采集命令 | /// 行驶记录仪数据采集命令 | ||||
///// 0x8700 | /// 0x8700 | ||||
///// </summary> | /// </summary> | ||||
//[JT808BodiesType(typeof(JT808_0x8700))] | 行驶记录仪数据采集命令 = 0x8700, | ||||
//[JT808MsgIdDescription("0x8700", "行驶记录仪数据采集命令")] | /// <summary> | ||||
//行驶记录仪数据采集命令 = 0x8700, | /// 行驶记录仪数据上传 | ||||
///// <summary> | /// 0x0700 | ||||
///// 行驶记录仪数据上传 | /// </summary> | ||||
///// 0x0700 | 行驶记录仪数据上传 = 0x0700, | ||||
///// </summary> | /// <summary> | ||||
//[JT808BodiesType(typeof(JT808_0x0700))] | /// 行驶记录仪参数下传命令 | ||||
//[JT808MsgIdDescription("0x0700", "行驶记录仪数据上传")] | /// 0x8701 | ||||
//行驶记录仪数据上传 = 0x0700, | /// </summary> | ||||
///// <summary> | 行驶记录仪参数下传命令 = 0x8701, | ||||
///// 行驶记录仪参数下传命令 | |||||
///// 0x8701 | |||||
///// </summary> | |||||
//[JT808BodiesType(typeof(JT808_0x8701))] | |||||
//[JT808MsgIdDescription("0x8701", "行驶记录仪参数下传命令")] | |||||
//行驶记录仪参数下传命令 = 0x8701, | |||||
/// <summary> | /// <summary> | ||||
/// 电子运单上报 | /// 电子运单上报 | ||||
/// 0x0701 | /// 0x0701 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0701))] | |||||
[JT808MsgIdDescription("0x0701", "电子运单上报")] | |||||
电子运单上报 = 0x0701, | 电子运单上报 = 0x0701, | ||||
/// <summary> | /// <summary> | ||||
/// 驾驶员身份信息采集上报 | /// 驾驶员身份信息采集上报 | ||||
/// 0x0702 | /// 0x0702 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0702))] | |||||
[JT808MsgIdDescription("0x0702", "驾驶员身份信息采集上报")] | |||||
驾驶员身份信息采集上报 = 0x0702, | 驾驶员身份信息采集上报 = 0x0702, | ||||
/// <summary> | /// <summary> | ||||
/// 上报驾驶员身份信息请求 | /// 上报驾驶员身份信息请求 | ||||
/// 0x8702 | /// 0x8702 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8702))] | |||||
[JT808MsgIdDescription("0x8702", "上报驾驶员身份信息请求")] | |||||
上报驾驶员身份信息请求 = 0x8702, | 上报驾驶员身份信息请求 = 0x8702, | ||||
/// <summary> | /// <summary> | ||||
/// 定位数据批量上传 | /// 定位数据批量上传 | ||||
/// 0x0704 | /// 0x0704 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0704))] | |||||
[JT808MsgIdDescription("0x0704", "定位数据批量上传")] | |||||
定位数据批量上传 = 0x0704, | 定位数据批量上传 = 0x0704, | ||||
/// <summary> | /// <summary> | ||||
/// CAN总线数据上传 | /// CAN总线数据上传 | ||||
/// 0x0705 | /// 0x0705 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0705))] | |||||
[JT808MsgIdDescription("0x0705", "CAN总线数据上传")] | |||||
CAN总线数据上传 = 0x0705, | CAN总线数据上传 = 0x0705, | ||||
/// <summary> | /// <summary> | ||||
/// 多媒体事件信息上传 | /// 多媒体事件信息上传 | ||||
/// 0x0800 | /// 0x0800 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0800))] | |||||
[JT808MsgIdDescription("0x0800", "多媒体事件信息上传")] | |||||
多媒体事件信息上传 = 0x0800, | 多媒体事件信息上传 = 0x0800, | ||||
/// <summary> | /// <summary> | ||||
/// 多媒体数据上传 | /// 多媒体数据上传 | ||||
/// 0x0801 | /// 0x0801 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0801))] | |||||
[JT808MsgIdDescription("0x0801", "多媒体数据上传")] | |||||
多媒体数据上传 = 0x0801, | 多媒体数据上传 = 0x0801, | ||||
/// <summary> | /// <summary> | ||||
/// 多媒体数据上传应答 | /// 多媒体数据上传应答 | ||||
/// 0x8800 | /// 0x8800 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8800))] | |||||
[JT808MsgIdDescription("0x8800", "多媒体数据上传应答")] | |||||
多媒体数据上传应答 = 0x8800, | 多媒体数据上传应答 = 0x8800, | ||||
/// <summary> | /// <summary> | ||||
/// 摄像头立即拍摄命令 | /// 摄像头立即拍摄命令 | ||||
/// 0x8801 | /// 0x8801 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8801))] | |||||
[JT808MsgIdDescription("0x8801", "摄像头立即拍摄命令")] | |||||
摄像头立即拍摄命令 = 0x8801, | 摄像头立即拍摄命令 = 0x8801, | ||||
/// <summary> | /// <summary> | ||||
/// 摄像头立即拍摄命令应答 | /// 摄像头立即拍摄命令应答 | ||||
/// 0x0805 | /// 0x0805 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0805))] | |||||
[JT808MsgIdDescription("0x0805", "摄像头立即拍摄命令应答")] | |||||
摄像头立即拍摄命令应答 = 0x0805, | 摄像头立即拍摄命令应答 = 0x0805, | ||||
/// <summary> | /// <summary> | ||||
/// 存储多媒体数据检索 | /// 存储多媒体数据检索 | ||||
/// 0x8802 | /// 0x8802 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8802))] | |||||
[JT808MsgIdDescription("0x8802", "存储多媒体数据检索")] | |||||
存储多媒体数据检索 = 0x8802, | 存储多媒体数据检索 = 0x8802, | ||||
/// <summary> | /// <summary> | ||||
/// 存储多媒体数据上传 | /// 存储多媒体数据上传 | ||||
/// 0x8803 | /// 0x8803 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8803))] | |||||
[JT808MsgIdDescription("0x8803", "存储多媒体数据上传")] | |||||
存储多媒体数据上传 = 0x8803, | 存储多媒体数据上传 = 0x8803, | ||||
/// <summary> | /// <summary> | ||||
/// 录音开始命令 | /// 录音开始命令 | ||||
/// 0x8804 | /// 0x8804 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8804))] | |||||
[JT808MsgIdDescription("0x8804", "录音开始命令")] | |||||
录音开始命令 = 0x8804, | 录音开始命令 = 0x8804, | ||||
/// <summary> | /// <summary> | ||||
/// 单条存储多媒体数据检索上传命令 | /// 单条存储多媒体数据检索上传命令 | ||||
/// 0x8805 | /// 0x8805 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8805))] | |||||
[JT808MsgIdDescription("0x8804", "单条存储多媒体数据检索上传命令")] | |||||
单条存储多媒体数据检索上传命令 = 0x8805, | 单条存储多媒体数据检索上传命令 = 0x8805, | ||||
/// <summary> | /// <summary> | ||||
/// 数据下行透传 | /// 数据下行透传 | ||||
/// 0x8900 | /// 0x8900 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8900))] | |||||
[JT808MsgIdDescription("0x8900", "数据下行透传")] | |||||
数据下行透传 = 0x8900, | 数据下行透传 = 0x8900, | ||||
/// <summary> | /// <summary> | ||||
/// 数据上行透传 | /// 数据上行透传 | ||||
/// 0x0900 | /// 0x0900 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0900))] | |||||
[JT808MsgIdDescription("0x0900", "数据上行透传")] | |||||
数据上行透传 = 0x0900, | 数据上行透传 = 0x0900, | ||||
/// <summary> | /// <summary> | ||||
/// 数据压缩上报 | /// 数据压缩上报 | ||||
/// 0x0901 | /// 0x0901 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0901))] | |||||
[JT808MsgIdDescription("0x0901", "数据压缩上报")] | |||||
数据压缩上报 = 0x0901, | 数据压缩上报 = 0x0901, | ||||
/// <summary> | /// <summary> | ||||
/// 平台RSA公钥 | /// 平台RSA公钥 | ||||
/// 0x8A00 | /// 0x8A00 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8A00))] | |||||
[JT808MsgIdDescription("0x8A00", "平台RSA公钥")] | |||||
平台RSA公钥 = 0x8A00, | 平台RSA公钥 = 0x8A00, | ||||
/// <summary> | /// <summary> | ||||
/// 终端RSA公钥 | /// 终端RSA公钥 | ||||
/// 0x0A00 | /// 0x0A00 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0A00))] | |||||
[JT808MsgIdDescription("0x0A00", "终端RSA公钥")] | |||||
终端RSA公钥 = 0x0A00, | 终端RSA公钥 = 0x0A00, | ||||
/// <summary> | /// <summary> | ||||
/// 查询服务器时间请求 | /// 查询服务器时间请求 | ||||
/// 0x0004 | /// 0x0004 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0004))] | |||||
[JT808MsgIdDescription("0x0004", "查询服务器时间请求")] | |||||
查询服务器时间请求 = 0x0004, | 查询服务器时间请求 = 0x0004, | ||||
/// <summary> | /// <summary> | ||||
/// 查询服务器时间应答 | /// 查询服务器时间应答 | ||||
/// 0x8004 | /// 0x8004 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8004))] | |||||
[JT808MsgIdDescription("0x8004", "查询服务器时间应答")] | |||||
查询服务器时间应答 = 0x8004, | 查询服务器时间应答 = 0x8004, | ||||
/// <summary> | /// <summary> | ||||
/// 终端补传分包请求 | /// 终端补传分包请求 | ||||
/// 0x0005 | /// 0x0005 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0005))] | |||||
[JT808MsgIdDescription("0x0005", "终端补传分包请求")] | |||||
终端补传分包请求 = 0x0005, | 终端补传分包请求 = 0x0005, | ||||
/// <summary> | /// <summary> | ||||
/// 链路检测 | /// 链路检测 | ||||
/// 0x8204 | /// 0x8204 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8204))] | |||||
[JT808MsgIdDescription("0x8204", "链路检测")] | |||||
链路检测 = 0x8204, | 链路检测 = 0x8204, | ||||
/// <summary> | /// <summary> | ||||
/// 查询区域或线路数据 | /// 查询区域或线路数据 | ||||
/// 0x8608 | /// 0x8608 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x8608))] | |||||
[JT808MsgIdDescription("0x8608", "查询区域或线路数据")] | |||||
查询区域或线路数据 = 0x8608, | 查询区域或线路数据 = 0x8608, | ||||
/// <summary> | /// <summary> | ||||
/// 查询区域或线路数据应答 | /// 查询区域或线路数据应答 | ||||
/// 0x0608 | /// 0x0608 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0608))] | |||||
[JT808MsgIdDescription("0x0608", "查询区域或线路数据应答")] | |||||
查询区域或线路数据应答 = 0x0608, | 查询区域或线路数据应答 = 0x0608, | ||||
/// <summary> | /// <summary> | ||||
/// 存储多媒体数据检索应答 | /// 存储多媒体数据检索应答 | ||||
/// 0x0802 | /// 0x0802 | ||||
/// </summary> | /// </summary> | ||||
[JT808BodiesType(typeof(JT808_0x0802))] | |||||
[JT808MsgIdDescription("0x0802", "存储多媒体数据检索应答")] | |||||
存储多媒体数据检索应答 = 0x0802, | 存储多媒体数据检索应答 = 0x0802, | ||||
} | } | ||||
} | } |
@@ -1,5 +1,8 @@ | |||||
namespace JT808.Protocol.Enums | namespace JT808.Protocol.Enums | ||||
{ | { | ||||
/// <summary> | |||||
/// 返回结果 | |||||
/// </summary> | |||||
public enum JT808PlatformResult : byte | public enum JT808PlatformResult : byte | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
@@ -5,10 +5,25 @@ | |||||
/// </summary> | /// </summary> | ||||
public enum JT808PositionType : byte | public enum JT808PositionType : byte | ||||
{ | { | ||||
/// <summary> | |||||
/// 无特定位置 | |||||
/// </summary> | |||||
无特定位置 = 0x00, | 无特定位置 = 0x00, | ||||
/// <summary> | |||||
/// 圆形区域 | |||||
/// </summary> | |||||
圆形区域 = 0x01, | 圆形区域 = 0x01, | ||||
/// <summary> | |||||
/// 矩形区域 | |||||
/// </summary> | |||||
矩形区域 = 0x02, | 矩形区域 = 0x02, | ||||
/// <summary> | |||||
/// 多边形区域 | |||||
/// </summary> | |||||
多边形区域 = 0x03, | 多边形区域 = 0x03, | ||||
/// <summary> | |||||
/// 路段 | |||||
/// </summary> | |||||
路段 = 0x04 | 路段 = 0x04 | ||||
} | } | ||||
} | } |
@@ -5,8 +5,17 @@ | |||||
/// </summary> | /// </summary> | ||||
public enum JT808UpgradeResult : byte | public enum JT808UpgradeResult : byte | ||||
{ | { | ||||
/// <summary> | |||||
/// 成功 | |||||
/// </summary> | |||||
成功 = 0, | 成功 = 0, | ||||
/// <summary> | |||||
/// 失败 | |||||
/// </summary> | |||||
失败 = 1, | 失败 = 1, | ||||
/// <summary> | |||||
/// 取消 | |||||
/// </summary> | |||||
取消 = 2, | 取消 = 2, | ||||
} | } | ||||
} | } |
@@ -5,8 +5,17 @@ | |||||
/// </summary> | /// </summary> | ||||
public enum JT808UpgradeType : byte | public enum JT808UpgradeType : byte | ||||
{ | { | ||||
/// <summary> | |||||
/// 终端 | |||||
/// </summary> | |||||
终端 = 0, | 终端 = 0, | ||||
/// <summary> | |||||
/// 道路运输证IC卡读卡器 | |||||
/// </summary> | |||||
道路运输证IC卡读卡器 = 12, | 道路运输证IC卡读卡器 = 12, | ||||
/// <summary> | |||||
/// 北斗卫星定位模块 | |||||
/// </summary> | |||||
北斗卫星定位模块 = 52, | 北斗卫星定位模块 = 52, | ||||
} | } | ||||
} | } |
@@ -4,9 +4,18 @@ using System.Text; | |||||
namespace JT808.Protocol.Enums | namespace JT808.Protocol.Enums | ||||
{ | { | ||||
/// <summary> | |||||
/// JT808版本号 | |||||
/// </summary> | |||||
public enum JT808Version:byte | public enum JT808Version:byte | ||||
{ | { | ||||
/// <summary> | |||||
/// 2013 | |||||
/// </summary> | |||||
JTT2013=1, | JTT2013=1, | ||||
/// <summary> | |||||
/// 2019 | |||||
/// </summary> | |||||
JTT2019=2, | JTT2019=2, | ||||
} | } | ||||
} | } |
@@ -3,29 +3,51 @@ using System; | |||||
namespace JT808.Protocol.Exceptions | namespace JT808.Protocol.Exceptions | ||||
{ | { | ||||
/// <summary> | |||||
/// JT808异常处理类 | |||||
/// </summary> | |||||
[Serializable] | [Serializable] | ||||
public class JT808Exception : Exception | public class JT808Exception : Exception | ||||
{ | { | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="errorCode"></param> | |||||
public JT808Exception(JT808ErrorCode errorCode) : base(errorCode.ToString()) | public JT808Exception(JT808ErrorCode errorCode) : base(errorCode.ToString()) | ||||
{ | { | ||||
ErrorCode = errorCode; | ErrorCode = errorCode; | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="errorCode"></param> | |||||
/// <param name="message"></param> | |||||
public JT808Exception(JT808ErrorCode errorCode, string message) : base(message) | public JT808Exception(JT808ErrorCode errorCode, string message) : base(message) | ||||
{ | { | ||||
ErrorCode = errorCode; | ErrorCode = errorCode; | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="errorCode"></param> | |||||
/// <param name="ex"></param> | |||||
public JT808Exception(JT808ErrorCode errorCode, Exception ex) : base(ex.Message, ex) | public JT808Exception(JT808ErrorCode errorCode, Exception ex) : base(ex.Message, ex) | ||||
{ | { | ||||
ErrorCode = errorCode; | ErrorCode = errorCode; | ||||
} | } | ||||
/// <summary> | |||||
public JT808Exception(JT808ErrorCode errorCode, string message, Exception ex) : base(ex.Message, ex) | /// | ||||
/// </summary> | |||||
/// <param name="errorCode"></param> | |||||
/// <param name="message"></param> | |||||
/// <param name="ex"></param> | |||||
public JT808Exception(JT808ErrorCode errorCode, string message, Exception ex) : base(message, ex) | |||||
{ | { | ||||
ErrorCode = errorCode; | ErrorCode = errorCode; | ||||
} | } | ||||
/// <summary> | |||||
/// JT808统一错误码 | |||||
/// </summary> | |||||
public JT808ErrorCode ErrorCode { get; } | public JT808ErrorCode ErrorCode { get; } | ||||
} | } | ||||
} | } |
@@ -7,8 +7,18 @@ using System.Text.Json; | |||||
namespace JT808.Protocol.Extensions | namespace JT808.Protocol.Extensions | ||||
{ | { | ||||
/// <summary> | |||||
/// JT808分析器扩展 | |||||
/// </summary> | |||||
public static class JT808AnalyzeExtensions | public static class JT808AnalyzeExtensions | ||||
{ | { | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="instance"></param> | |||||
/// <param name="reader"></param> | |||||
/// <param name="writer"></param> | |||||
/// <param name="config"></param> | |||||
public static void Analyze(this object instance, ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | public static void Analyze(this object instance, ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | ||||
{ | { | ||||
if(instance is IJT808Analyze analyze) | if(instance is IJT808Analyze analyze) | ||||
@@ -7,10 +7,19 @@ using System.Collections.Concurrent; | |||||
namespace JT808.Protocol | namespace JT808.Protocol | ||||
{ | { | ||||
/// <summary> | |||||
/// JT808配置扩展 | |||||
/// </summary> | |||||
public static class JT808ConfigExtensions | public static class JT808ConfigExtensions | ||||
{ | { | ||||
private readonly static ConcurrentDictionary<string, JT808Serializer> jT808SerializerDict = new ConcurrentDictionary<string, JT808Serializer>(StringComparer.OrdinalIgnoreCase); | private readonly static ConcurrentDictionary<string, JT808Serializer> jT808SerializerDict = new ConcurrentDictionary<string, JT808Serializer>(StringComparer.OrdinalIgnoreCase); | ||||
private readonly static ConcurrentDictionary<string, JT808CarDVRSerializer> jT808CarDVRSerializer = new ConcurrentDictionary<string, JT808CarDVRSerializer>(StringComparer.OrdinalIgnoreCase); | private readonly static ConcurrentDictionary<string, JT808CarDVRSerializer> jT808CarDVRSerializer = new ConcurrentDictionary<string, JT808CarDVRSerializer>(StringComparer.OrdinalIgnoreCase); | ||||
/// <summary> | |||||
/// 通过类型获取对应的消息序列化器 | |||||
/// </summary> | |||||
/// <param name="jT808Config"></param> | |||||
/// <param name="type"></param> | |||||
/// <returns></returns> | |||||
public static object GetMessagePackFormatterByType(this IJT808Config jT808Config,Type type) | public static object GetMessagePackFormatterByType(this IJT808Config jT808Config,Type type) | ||||
{ | { | ||||
if (!jT808Config.FormatterFactory.FormatterDict.TryGetValue(type.GUID, out var formatter)) | if (!jT808Config.FormatterFactory.FormatterDict.TryGetValue(type.GUID, out var formatter)) | ||||
@@ -19,6 +28,12 @@ namespace JT808.Protocol | |||||
} | } | ||||
return formatter; | return formatter; | ||||
} | } | ||||
/// <summary> | |||||
/// 通过类型获取对应的消息分析器 | |||||
/// </summary> | |||||
/// <param name="jT808Config"></param> | |||||
/// <param name="type"></param> | |||||
/// <returns></returns> | |||||
public static object GetAnalyzeByType(this IJT808Config jT808Config, Type type) | public static object GetAnalyzeByType(this IJT808Config jT808Config, Type type) | ||||
{ | { | ||||
if (!jT808Config.FormatterFactory.FormatterDict.TryGetValue(type.GUID, out var analyze)) | if (!jT808Config.FormatterFactory.FormatterDict.TryGetValue(type.GUID, out var analyze)) | ||||
@@ -27,14 +42,31 @@ namespace JT808.Protocol | |||||
} | } | ||||
return analyze; | return analyze; | ||||
} | } | ||||
/// <summary> | |||||
/// 获取对应的消息序列化器 | |||||
/// </summary> | |||||
/// <typeparam name="T"></typeparam> | |||||
/// <param name="jT808Config"></param> | |||||
/// <returns></returns> | |||||
public static IJT808MessagePackFormatter<T> GetMessagePackFormatter<T>(this IJT808Config jT808Config) | public static IJT808MessagePackFormatter<T> GetMessagePackFormatter<T>(this IJT808Config jT808Config) | ||||
{ | { | ||||
return (IJT808MessagePackFormatter<T>)GetMessagePackFormatterByType(jT808Config,typeof(T)); | return (IJT808MessagePackFormatter<T>)GetMessagePackFormatterByType(jT808Config,typeof(T)); | ||||
} | } | ||||
/// <summary> | |||||
/// 获取对应的消息分析器 | |||||
/// </summary> | |||||
/// <typeparam name="T"></typeparam> | |||||
/// <param name="jT808Config"></param> | |||||
/// <returns></returns> | |||||
public static IJT808Analyze GetAnalyze<T>(this IJT808Config jT808Config) | public static IJT808Analyze GetAnalyze<T>(this IJT808Config jT808Config) | ||||
{ | { | ||||
return (IJT808Analyze)GetAnalyzeByType(jT808Config, typeof(T)); | return (IJT808Analyze)GetAnalyzeByType(jT808Config, typeof(T)); | ||||
} | } | ||||
/// <summary> | |||||
/// 获取JT19056序列化器 | |||||
/// </summary> | |||||
/// <param name="jT808Config"></param> | |||||
/// <returns></returns> | |||||
public static JT808CarDVRSerializer GetCarDVRSerializer(this IJT808Config jT808Config) | public static JT808CarDVRSerializer GetCarDVRSerializer(this IJT808Config jT808Config) | ||||
{ | { | ||||
if(!jT808CarDVRSerializer.TryGetValue(jT808Config.ConfigId,out var serializer)) | if(!jT808CarDVRSerializer.TryGetValue(jT808Config.ConfigId,out var serializer)) | ||||
@@ -43,7 +75,12 @@ namespace JT808.Protocol | |||||
jT808CarDVRSerializer.TryAdd(jT808Config.ConfigId, serializer); | jT808CarDVRSerializer.TryAdd(jT808Config.ConfigId, serializer); | ||||
} | } | ||||
return serializer; | return serializer; | ||||
} | } | ||||
/// <summary> | |||||
/// 获取JT808序列化器 | |||||
/// </summary> | |||||
/// <param name="jT808Config"></param> | |||||
/// <returns></returns> | |||||
public static JT808Serializer GetSerializer(this IJT808Config jT808Config) | public static JT808Serializer GetSerializer(this IJT808Config jT808Config) | ||||
{ | { | ||||
if(!jT808SerializerDict.TryGetValue(jT808Config.ConfigId,out var serializer)) | if(!jT808SerializerDict.TryGetValue(jT808Config.ConfigId,out var serializer)) | ||||
@@ -116,7 +116,7 @@ namespace JT808.Protocol.Extensions | |||||
/// <summary> | /// <summary> | ||||
/// 获取DisplayNameAttribute特性枚举值的描述 | /// 获取DisplayNameAttribute特性枚举值的描述 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="obj">枚举值</param> | /// <param name="value">枚举值</param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public static string GetDisplayName(this Enum value) | public static string GetDisplayName(this Enum value) | ||||
{ | { | ||||
@@ -127,7 +127,7 @@ namespace JT808.Protocol.Extensions | |||||
/// <summary> | /// <summary> | ||||
/// 获取DisplayNameAttribute特性枚举及描述 | /// 获取DisplayNameAttribute特性枚举及描述 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="type"></param> | /// <param name="value"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public static Dictionary<string, string> GetDisplayNameAttributeDictionary(this Enum value) | public static Dictionary<string, string> GetDisplayNameAttributeDictionary(this Enum value) | ||||
{ | { | ||||
@@ -8,11 +8,59 @@ namespace JT808.Protocol.Extensions | |||||
/// </summary> | /// </summary> | ||||
public static partial class JT808BinaryExtensions | public static partial class JT808BinaryExtensions | ||||
{ | { | ||||
/// <summary> | |||||
/// 16进制数组转16进制字符串 | |||||
/// </summary> | |||||
/// <param name="source"></param> | |||||
/// <returns></returns> | |||||
public static string ToHexString(this byte[] source) | public static string ToHexString(this byte[] source) | ||||
{ | { | ||||
return HexUtil.DoHexDump(source, 0, source.Length).ToUpper(); | return HexUtil.DoHexDump(source, 0, source.Length).ToUpper(); | ||||
} | } | ||||
/// <summary> | |||||
/// 16进制字符串转16进制数组 | |||||
/// </summary> | |||||
/// <param name="hexString"></param> | |||||
/// <returns></returns> | |||||
public static byte[] ToHexBytes(this string hexString) | |||||
{ | |||||
hexString = hexString.Replace(" ", ""); | |||||
byte[] buf = new byte[hexString.Length / 2]; | |||||
ReadOnlySpan<char> readOnlySpan = hexString.AsSpan(); | |||||
for (int i = 0; i < hexString.Length; i++) | |||||
{ | |||||
if (i % 2 == 0) | |||||
{ | |||||
buf[i / 2] = Convert.ToByte(readOnlySpan.Slice(i, 2).ToString(), 16); | |||||
} | |||||
} | |||||
return buf; | |||||
} | |||||
/// <summary> | |||||
/// 从内存块中读取16进制字符串 | |||||
/// </summary> | |||||
/// <param name="read"></param> | |||||
/// <param name="offset"></param> | |||||
/// <param name="len"></param> | |||||
/// <returns></returns> | |||||
public static string ReadHexStringLittle(ReadOnlySpan<byte> read, ref int offset, int len) | |||||
{ | |||||
//ReadOnlySpan<byte> source = read.Slice(offset, len); | |||||
string hex = HexUtil.DoHexDump(read, offset, len); | |||||
offset += len; | |||||
return hex; | |||||
} | |||||
/// <summary> | |||||
/// 将16进制字符串写入对应数组中 | |||||
/// </summary> | |||||
/// <param name="bytes"></param> | |||||
/// <param name="offset"></param> | |||||
/// <param name="data"></param> | |||||
/// <param name="len"></param> | |||||
/// <returns></returns> | |||||
public static int WriteHexStringLittle(byte[] bytes, int offset, string data, int len) | public static int WriteHexStringLittle(byte[] bytes, int offset, string data, int len) | ||||
{ | { | ||||
if (data == null) data = ""; | if (data == null) data = ""; | ||||
@@ -41,86 +89,120 @@ namespace JT808.Protocol.Extensions | |||||
} | } | ||||
return length; | return length; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 16进制字符串转16进制数组 | /// | ||||
/// </summary> | /// </summary> | ||||
/// <param name="hexString"></param> | /// <param name="value"></param> | ||||
/// <param name="separator"></param> | /// <param name="format"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public static byte[] ToHexBytes(this string hexString) | |||||
{ | |||||
hexString = hexString.Replace(" ", ""); | |||||
byte[] buf = new byte[hexString.Length / 2]; | |||||
ReadOnlySpan<char> readOnlySpan = hexString.AsSpan(); | |||||
for (int i = 0; i < hexString.Length; i++) | |||||
{ | |||||
if (i % 2 == 0) | |||||
{ | |||||
buf[i / 2] = Convert.ToByte(readOnlySpan.Slice(i, 2).ToString(), 16); | |||||
} | |||||
} | |||||
return buf; | |||||
} | |||||
public static string ReadHexStringLittle(ReadOnlySpan<byte> read, ref int offset, int len) | |||||
{ | |||||
//ReadOnlySpan<byte> source = read.Slice(offset, len); | |||||
string hex = HexUtil.DoHexDump(read, offset, len); | |||||
offset += len; | |||||
return hex; | |||||
} | |||||
public static string ReadNumber(this byte value, string format = "X2") | public static string ReadNumber(this byte value, string format = "X2") | ||||
{ | { | ||||
return value.ToString(format); | return value.ToString(format); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="format"></param> | |||||
/// <returns></returns> | |||||
public static string ReadNumber(this int value, string format = "X8") | public static string ReadNumber(this int value, string format = "X8") | ||||
{ | { | ||||
return value.ToString(format); | return value.ToString(format); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="format"></param> | |||||
public static string ReadNumber(this uint value, string format = "X8") | public static string ReadNumber(this uint value, string format = "X8") | ||||
{ | { | ||||
return value.ToString(format); | return value.ToString(format); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="format"></param> | |||||
public static string ReadNumber(this long value, string format = "X16") | public static string ReadNumber(this long value, string format = "X16") | ||||
{ | { | ||||
return value.ToString(format); | return value.ToString(format); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="format"></param> | |||||
public static string ReadNumber(this ulong value, string format="X16") | public static string ReadNumber(this ulong value, string format="X16") | ||||
{ | { | ||||
return value.ToString(format); | return value.ToString(format); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="format"></param> | |||||
public static string ReadNumber(this short value, string format = "X4") | public static string ReadNumber(this short value, string format = "X4") | ||||
{ | { | ||||
return value.ToString(format); | return value.ToString(format); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="format"></param> | |||||
public static string ReadNumber(this ushort value, string format = "X4") | public static string ReadNumber(this ushort value, string format = "X4") | ||||
{ | { | ||||
return value.ToString(format); | return value.ToString(format); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <returns></returns> | |||||
public static ReadOnlySpan<char> ReadBinary(this ushort value) | public static ReadOnlySpan<char> ReadBinary(this ushort value) | ||||
{ | { | ||||
return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan(); | return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan(); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <returns></returns> | |||||
public static ReadOnlySpan<char> ReadBinary(this short value) | public static ReadOnlySpan<char> ReadBinary(this short value) | ||||
{ | { | ||||
return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan(); | return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan(); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <returns></returns> | |||||
public static ReadOnlySpan<char> ReadBinary(this uint value) | public static ReadOnlySpan<char> ReadBinary(this uint value) | ||||
{ | { | ||||
return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan(); | return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan(); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <returns></returns> | |||||
public static ReadOnlySpan<char> ReadBinary(this int value) | public static ReadOnlySpan<char> ReadBinary(this int value) | ||||
{ | { | ||||
return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan(); | return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan(); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <returns></returns> | |||||
public static ReadOnlySpan<char> ReadBinary(this byte value) | public static ReadOnlySpan<char> ReadBinary(this byte value) | ||||
{ | { | ||||
return System.Convert.ToString(value, 2).PadLeft(8, '0').AsSpan(); | return System.Convert.ToString(value, 2).PadLeft(8, '0').AsSpan(); | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public static class HexUtil | public static class HexUtil | ||||
{ | { | ||||
static readonly char[] HexdumpTable = new char[256 * 4]; | static readonly char[] HexdumpTable = new char[256 * 4]; | ||||
@@ -133,7 +215,13 @@ namespace JT808.Protocol.Extensions | |||||
HexdumpTable[(i << 1) + 1] = digits[i & 0x0F]; | HexdumpTable[(i << 1) + 1] = digits[i & 0x0F]; | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="buffer"></param> | |||||
/// <param name="fromIndex"></param> | |||||
/// <param name="length"></param> | |||||
/// <returns></returns> | |||||
public static string DoHexDump(ReadOnlySpan<byte> buffer, int fromIndex, int length) | public static string DoHexDump(ReadOnlySpan<byte> buffer, int fromIndex, int length) | ||||
{ | { | ||||
if (length == 0) | if (length == 0) | ||||
@@ -150,7 +238,13 @@ namespace JT808.Protocol.Extensions | |||||
} | } | ||||
return new string(buf); | return new string(buf); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="array"></param> | |||||
/// <param name="fromIndex"></param> | |||||
/// <param name="length"></param> | |||||
/// <returns></returns> | |||||
public static string DoHexDump(byte[] array, int fromIndex, int length) | public static string DoHexDump(byte[] array, int fromIndex, int length) | ||||
{ | { | ||||
if (length == 0) | if (length == 0) | ||||
@@ -6,65 +6,70 @@ | |||||
<#@ import namespace="JT808.Protocol" #> | <#@ import namespace="JT808.Protocol" #> | ||||
<#@ import namespace="JT808.Protocol.Enums" #> | <#@ import namespace="JT808.Protocol.Enums" #> | ||||
<#@ import namespace="JT808.Protocol.Extensions" #> | <#@ import namespace="JT808.Protocol.Extensions" #> | ||||
<#@ import namespace="JT808.Protocol.Attributes" #> | |||||
<#@ import namespace="System.Linq" #> | <#@ import namespace="System.Linq" #> | ||||
<#@ import namespace="System.Text" #> | <#@ import namespace="System.Text" #> | ||||
<#@ import namespace="System.Collections.Generic" #> | <#@ import namespace="System.Collections.Generic" #> | ||||
<#@ import namespace="System.Reflection" #> | <#@ import namespace="System.Reflection" #> | ||||
<#@ output extension=".cs" #> | <#@ output extension=".cs" #> | ||||
<# | <# | ||||
var types=Enum.GetNames(typeof(JT808MsgId)); | var types=Assembly.GetAssembly(typeof(JT808Package)).GetTypes().Where(w => w.BaseType == typeof(JT808Bodies)).ToList(); | ||||
#> | #> | ||||
using JT808.Protocol.Enums; | using JT808.Protocol.Enums; | ||||
namespace JT808.Protocol.Extensions | namespace JT808.Protocol.Extensions | ||||
{ | { | ||||
/// <summary> | |||||
/// todo:source-generators正式发布以后将T4模板换掉 | |||||
/// https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ | |||||
/// </summary> | |||||
public static partial class JT808PackageExtensions | public static partial class JT808PackageExtensions | ||||
{ | { | ||||
<# | <# | ||||
foreach (var item in types) | foreach (var type in types) | ||||
{ | { | ||||
JT808MsgId msgId = item.ToEnum<JT808MsgId>(); | var instance = Activator.CreateInstance(type); | ||||
JT808BodiesTypeAttribute jT808BodiesTypeAttribute = msgId.GetAttribute<JT808BodiesTypeAttribute>(); | if(instance is JT808Bodies jT808Bodies) | ||||
JT808MsgIdDescriptionAttribute jT808MsgIdDescriptionAttribute = msgId.GetAttribute<JT808MsgIdDescriptionAttribute>(); | { | ||||
string code = $"0x{jT808Bodies.MsgId.ToString("X2").PadLeft(4, '0')}"; | |||||
string name = jT808Bodies.Description; | |||||
#> | #> | ||||
/// <summary> | /// <summary> | ||||
/// <#= jT808MsgIdDescriptionAttribute.Code #> - <#= jT808MsgIdDescriptionAttribute.Name #> | /// <#= code #> - <#= name #> | ||||
/// auto-generated | /// auto-generated | ||||
/// </summary> | /// </summary> | ||||
public static JT808Package Create_<#= jT808MsgIdDescriptionAttribute.Name #>(this JT808MsgId msgId, string terminalPhoneNo,<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName #> bodies) | public static JT808Package Create_<#= name #>(this JT808MsgId msgId, string terminalPhoneNo,<#= type.FullName #> bodies) | ||||
{ | { | ||||
return Create<<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName#>>(msgId,terminalPhoneNo,bodies); | return Create<<#= type.FullName#>>(msgId,terminalPhoneNo,bodies); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// <#= jT808MsgIdDescriptionAttribute.Code #> - <#= jT808MsgIdDescriptionAttribute.Name #> | /// <#= code #> - <#= name #> | ||||
/// auto-generated | /// auto-generated | ||||
/// </summary> | /// </summary> | ||||
public static JT808Package Create(this JT808MsgId msgId, string terminalPhoneNo,<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName #> bodies) | public static JT808Package Create(this JT808MsgId msgId, string terminalPhoneNo,<#= type.FullName #> bodies) | ||||
{ | { | ||||
return Create<<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName#>>(msgId,terminalPhoneNo,bodies); | return Create<<#= type.FullName#>>(msgId,terminalPhoneNo,bodies); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// <#= jT808MsgIdDescriptionAttribute.Code #> - <#= jT808MsgIdDescriptionAttribute.Name #> | /// <#= code #> - <#= name #> | ||||
/// auto-generated 2019 version | /// auto-generated 2019 version | ||||
/// </summary> | /// </summary> | ||||
public static JT808Package Create_<#= jT808MsgIdDescriptionAttribute.Name #>_2019(this JT808MsgId msgId, string terminalPhoneNo,<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName #> bodies) | public static JT808Package Create_<#= name #>_2019(this JT808MsgId msgId, string terminalPhoneNo,<#= type.FullName #> bodies) | ||||
{ | { | ||||
return Create2019<<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName#>>(msgId,terminalPhoneNo,bodies); | return Create2019<<#= type.FullName#>>(msgId,terminalPhoneNo,bodies); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// <#= jT808MsgIdDescriptionAttribute.Code #> - <#= jT808MsgIdDescriptionAttribute.Name #> | /// <#= code #> - <#= name #> | ||||
/// auto-generated 2019 version | /// auto-generated 2019 version | ||||
/// </summary> | /// </summary> | ||||
public static JT808Package Create2019(this JT808MsgId msgId, string terminalPhoneNo,<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName #> bodies) | public static JT808Package Create2019(this JT808MsgId msgId, string terminalPhoneNo,<#= type.FullName #> bodies) | ||||
{ | { | ||||
return Create2019<<#= jT808BodiesTypeAttribute.JT808BodiesType.FullName#>>(msgId,terminalPhoneNo,bodies); | return Create2019<<#= type.FullName#>>(msgId,terminalPhoneNo,bodies); | ||||
} | } | ||||
<# | <# | ||||
} | |||||
} | } | ||||
#> | #> | ||||
} | } |
@@ -0,0 +1,67 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Exceptions; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Linq; | |||||
namespace JT808.Protocol.Extensions | |||||
{ | |||||
/// <summary> | |||||
/// 验证长度扩展方法 | |||||
/// </summary> | |||||
public static partial class JT808ValidationExtensions | |||||
{ | |||||
/// <summary> | |||||
/// 验证字符串长度 | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="fieldName"></param> | |||||
/// <param name="fixedLength"></param> | |||||
public static void ValiString(this string value,in string fieldName, in int fixedLength) | |||||
{ | |||||
vali(value.Length, fieldName, fixedLength); | |||||
} | |||||
/// <summary> | |||||
/// 验证数组长度 | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="fieldName"></param> | |||||
/// <param name="fixedLength"></param> | |||||
public static void ValiBytes(this byte[] value,in string fieldName, in int fixedLength) | |||||
{ | |||||
vali(value.Length, fieldName, fixedLength); | |||||
} | |||||
/// <summary> | |||||
/// 验证集合长度 | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="fieldName"></param> | |||||
/// <param name="fixedLength"></param> | |||||
public static void ValiList<T>(this IEnumerable<T> value, in string fieldName, in int fixedLength) | |||||
{ | |||||
vali(value.Count(), fieldName, fixedLength); | |||||
} | |||||
/// <summary> | |||||
/// 验证 | |||||
/// </summary> | |||||
/// <param name="length"></param> | |||||
/// <param name="fieldName"></param> | |||||
/// <param name="fixedLength"></param> | |||||
private static void vali(in int length,in string fieldName, in int fixedLength) | |||||
{ | |||||
if (length > fixedLength) | |||||
{ | |||||
throw new JT808Exception(JT808ErrorCode.VailLength, $"{fieldName}:{length}>fixed[{fixedLength}]"); | |||||
} | |||||
else if (length < fixedLength) | |||||
{ | |||||
throw new JT808Exception(JT808ErrorCode.NotEnoughLength, $"{fieldName}:{length}<fixed[{fixedLength}]"); | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -6,9 +6,20 @@ using System.Text; | |||||
namespace JT808.Protocol.Formatters | namespace JT808.Protocol.Formatters | ||||
{ | { | ||||
/// <summary> | |||||
/// 序列化工厂 | |||||
/// </summary> | |||||
public interface IJT808FormatterFactory: IJT808ExternalRegister | public interface IJT808FormatterFactory: IJT808ExternalRegister | ||||
{ | { | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
IDictionary<Guid,object> FormatterDict { get;} | IDictionary<Guid,object> FormatterDict { get;} | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <typeparam name="TIJT808Formatter"></typeparam> | |||||
/// <returns></returns> | |||||
IJT808FormatterFactory SetMap<TIJT808Formatter>() | IJT808FormatterFactory SetMap<TIJT808Formatter>() | ||||
where TIJT808Formatter : IJT808Formatter; | where TIJT808Formatter : IJT808Formatter; | ||||
} | } | ||||
@@ -1,15 +1,31 @@ | |||||
using System; | using JT808.Protocol.MessagePack; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
namespace JT808.Protocol.Formatters | namespace JT808.Protocol.Formatters | ||||
{ | { | ||||
/// <summary> | |||||
/// 序列化器接口 | |||||
/// </summary> | |||||
/// <typeparam name="T"></typeparam> | |||||
public interface IJT808MessagePackFormatter<T> : IJT808Formatter | public interface IJT808MessagePackFormatter<T> : IJT808Formatter | ||||
{ | { | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="writer"></param> | |||||
/// <param name="value"></param> | |||||
/// <param name="config"></param> | |||||
void Serialize(ref JT808MessagePackWriter writer, T value, IJT808Config config); | void Serialize(ref JT808MessagePackWriter writer, T value, IJT808Config config); | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="reader"></param> | |||||
/// <param name="config"></param> | |||||
/// <returns></returns> | |||||
T Deserialize(ref JT808MessagePackReader reader, IJT808Config config); | T Deserialize(ref JT808MessagePackReader reader, IJT808Config config); | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public interface IJT808Formatter | public interface IJT808Formatter | ||||
{ | { | ||||
@@ -10,6 +10,9 @@ namespace JT808.Protocol | |||||
{ | { | ||||
public interface IJT808Config | public interface IJT808Config | ||||
{ | { | ||||
/// <summary> | |||||
/// 配置ID | |||||
/// </summary> | |||||
string ConfigId { get; } | string ConfigId { get; } | ||||
/// <summary> | /// <summary> | ||||
/// 消息流水号 | /// 消息流水号 | ||||
@@ -5,8 +5,15 @@ using System.Text; | |||||
namespace JT808.Protocol.Interfaces | namespace JT808.Protocol.Interfaces | ||||
{ | { | ||||
/// <summary> | |||||
/// 外部注册 | |||||
/// </summary> | |||||
public interface IJT808ExternalRegister | public interface IJT808ExternalRegister | ||||
{ | { | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="externalAssembly"></param> | |||||
void Register(Assembly externalAssembly); | void Register(Assembly externalAssembly); | ||||
} | } | ||||
} | } |
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Enums; | using JT808.Protocol.Enums; | ||||
using JT808.Protocol.Exceptions; | using JT808.Protocol.Exceptions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Enums; | using JT808.Protocol.Enums; | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
@@ -15,7 +15,7 @@ | |||||
<license>https://github.com/SmallChi/JT808/blob/master/LICENSE</license> | <license>https://github.com/SmallChi/JT808/blob/master/LICENSE</license> | ||||
<DocumentationFile>JT808.Protocol.xml</DocumentationFile> | <DocumentationFile>JT808.Protocol.xml</DocumentationFile> | ||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | <GeneratePackageOnBuild>false</GeneratePackageOnBuild> | ||||
<Version>2.3.5</Version> | <Version>2.3.6</Version> | ||||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | <PackageLicenseFile>LICENSE</PackageLicenseFile> | ||||
<AnalysisLevel>latest</AnalysisLevel> | <AnalysisLevel>latest</AnalysisLevel> | ||||
<EnableNETAnalyzers>true</EnableNETAnalyzers> | <EnableNETAnalyzers>true</EnableNETAnalyzers> | ||||
@@ -67,7 +67,7 @@ | |||||
<PackageReference Include="System.Text.Json" Version="5.0.1" /> | <PackageReference Include="System.Text.Json" Version="5.0.1" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net5' "> | <ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' "> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -91,4 +91,7 @@ | |||||
</Compile> | </Compile> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | |||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> | |||||
</ItemGroup> | |||||
</Project> | </Project> |
@@ -153,11 +153,11 @@ namespace JT808.Protocol | |||||
/// </summary> | /// </summary> | ||||
public const uint JT808_0x8103_0x002E = 0x002E; | public const uint JT808_0x8103_0x002E = 0x002E; | ||||
/// <summary> | /// <summary> | ||||
/// 紧急报警时汇报距离间隔,单位为米(m),>0 | /// 紧急报警时汇报距离间隔,单位为米(m)>0 | ||||
/// </summary> | /// </summary> | ||||
public const uint JT808_0x8103_0x002F = 0x002F; | public const uint JT808_0x8103_0x002F = 0x002F; | ||||
/// <summary> | /// <summary> | ||||
/// 拐点补传角度,<180 | /// 拐点补传角度小于180 | ||||
/// </summary> | /// </summary> | ||||
public const uint JT808_0x8103_0x0030 = 0x0030; | public const uint JT808_0x8103_0x0030 = 0x0030; | ||||
/// <summary> | /// <summary> | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Enums; | using JT808.Protocol.Enums; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using System; | using System; | ||||
@@ -11,20 +11,32 @@ using System.Text.Json; | |||||
namespace JT808.Protocol | namespace JT808.Protocol | ||||
{ | { | ||||
/// <summary> | |||||
/// JT808序列化器 | |||||
/// </summary> | |||||
public class JT808Serializer | public class JT808Serializer | ||||
{ | { | ||||
private readonly static JT808Package jT808Package = new JT808Package(); | private readonly static JT808Package jT808Package = new JT808Package(); | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="jT808Config"></param> | |||||
public JT808Serializer(IJT808Config jT808Config) | public JT808Serializer(IJT808Config jT808Config) | ||||
{ | { | ||||
this.jT808Config = jT808Config; | this.jT808Config = jT808Config; | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public JT808Serializer():this(new DefaultGlobalConfig()) | public JT808Serializer():this(new DefaultGlobalConfig()) | ||||
{ | { | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public string SerializerId => jT808Config.ConfigId; | public string SerializerId => jT808Config.ConfigId; | ||||
private readonly IJT808Config jT808Config; | private readonly IJT808Config jT808Config; | ||||
@@ -30,14 +30,14 @@ namespace JT808.Protocol.MessageBody | |||||
/// 结果 | /// 结果 | ||||
/// 0:成功/确认;1:失败;2:消息有误;3:不支持 | /// 0:成功/确认;1:失败;2:消息有误;3:不支持 | ||||
/// </summary> | /// </summary> | ||||
public JT808TerminalResult JT808TerminalResult { get; set; } | public JT808TerminalResult TerminalResult { get; set; } | ||||
public JT808_0x0001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x0001 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x0001 jT808_0X0001 = new JT808_0x0001(); | JT808_0x0001 jT808_0X0001 = new JT808_0x0001(); | ||||
jT808_0X0001.ReplyMsgNum = reader.ReadUInt16(); | jT808_0X0001.ReplyMsgNum = reader.ReadUInt16(); | ||||
jT808_0X0001.ReplyMsgId = reader.ReadUInt16(); | jT808_0X0001.ReplyMsgId = reader.ReadUInt16(); | ||||
jT808_0X0001.JT808TerminalResult = (JT808TerminalResult)reader.ReadByte(); | jT808_0X0001.TerminalResult = (JT808TerminalResult)reader.ReadByte(); | ||||
return jT808_0X0001; | return jT808_0X0001; | ||||
} | } | ||||
@@ -45,7 +45,7 @@ namespace JT808.Protocol.MessageBody | |||||
{ | { | ||||
writer.WriteUInt16(value.ReplyMsgNum); | writer.WriteUInt16(value.ReplyMsgNum); | ||||
writer.WriteUInt16(value.ReplyMsgId); | writer.WriteUInt16(value.ReplyMsgId); | ||||
writer.WriteByte((byte)value.JT808TerminalResult); | writer.WriteByte((byte)value.TerminalResult); | ||||
} | } | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | ||||
@@ -12,6 +12,6 @@ | |||||
public override ushort MsgId { get; } = 0x0003; | public override ushort MsgId { get; } = 0x0003; | ||||
public override string Description => "终端注销请求"; | public override string Description => "终端注销"; | ||||
} | } | ||||
} | } |
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -9,13 +9,13 @@ using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody | namespace JT808.Protocol.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 行驶记录数据上传 | /// 行驶记录仪数据上传 | ||||
/// 0x0700 | /// 0x0700 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x0700 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0700>, IJT808Analyze | public class JT808_0x0700 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0700>, IJT808Analyze | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0700; | public override ushort MsgId { get; } = 0x0700; | ||||
public override string Description => "行驶记录数据上传"; | public override string Description => "行驶记录仪数据上传"; | ||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// </summary> | /// </summary> | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -22,7 +22,7 @@ namespace JT808.Protocol.MessageBody | |||||
/// <summary> | /// <summary> | ||||
/// 未压缩消息体 | /// 未压缩消息体 | ||||
/// 压缩消息体为需要压缩的消息经过 GZIP 压缩算法后的消息 | /// 压缩消息体为需要压缩的消息经过 GZIP 压缩算法后的消息 | ||||
/// 可实现 <see cref="JT808.Protocol.IJT808ICompress"/>自定义压缩算法 | /// 可实现 refJT808.Protocol.IJT808ICompress 自定义压缩算法 | ||||
/// </summary> | /// </summary> | ||||
public byte[] UnCompressMessage { get; set; } | public byte[] UnCompressMessage { get; set; } | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,4 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -8,7 +8,7 @@ using JT808.Protocol.MessagePack; | |||||
namespace JT808.Protocol.MessageBody | namespace JT808.Protocol.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 拐点补传角度,<180 | /// 拐点补传角度,小于180 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8103_0x0030 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0x0030>, IJT808Analyze | public class JT808_0x8103_0x0030 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0x0030>, IJT808Analyze | ||||
{ | { | ||||
@@ -18,7 +18,7 @@ namespace JT808.Protocol.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public override byte ParamLength { get; set; } = 4; | public override byte ParamLength { get; set; } = 4; | ||||
/// <summary> | /// <summary> | ||||
/// 拐点补传角度,<180 | /// 拐点补传角度,小于180 | ||||
/// </summary> | /// </summary> | ||||
public uint ParamValue { get; set; } | public uint ParamValue { get; set; } | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
@@ -1,5 +1,5 @@ | |||||
using System.Text.Json; | using System.Text.Json; | ||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||