@@ -0,0 +1,52 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JT808.Protocol.Extensions; | |||||
namespace JT808.Protocol.Test.Extensions | |||||
{ | |||||
public class JT808HexExtensionsTest | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
ushort a1 = 512; | |||||
string hex1 = a1.ReadNumber(); | |||||
Assert.Equal("0200", hex1); | |||||
byte a2 = 126; | |||||
string hex2 = a2.ReadNumber(); | |||||
Assert.Equal("7E", hex2); | |||||
ushort a3 = 126; | |||||
string hex3 = a3.ReadNumber(); | |||||
Assert.Equal("007E", hex3); | |||||
short a4 = 126; | |||||
string hex4 = a4.ReadNumber(); | |||||
Assert.Equal("007E", hex4); | |||||
int a5 = 126; | |||||
string hex5 = a5.ReadNumber(); | |||||
Assert.Equal("0000007E", hex5); | |||||
uint a6 = 126; | |||||
string hex6 = a6.ReadNumber(); | |||||
Assert.Equal("0000007E", hex6); | |||||
long a7 = 126; | |||||
string hex7 = a7.ReadNumber(); | |||||
Assert.Equal("000000000000007E", hex7); | |||||
ulong a8 = 126; | |||||
string hex8 = a8.ReadNumber(); | |||||
Assert.Equal("000000000000007E", hex8); | |||||
ulong a9 = 191204091818; | |||||
string hex9 = a9.ReadNumber("D12"); | |||||
Assert.Equal("191204091818", hex9); | |||||
} | |||||
} | |||||
} |
@@ -26,6 +26,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<Compile Include="Extensions\JT808EnumExtensionsTest.cs" /> | <Compile Include="Extensions\JT808EnumExtensionsTest.cs" /> | ||||
<Compile Include="Extensions\JT808HexExtensionsTest.cs" /> | |||||
<Compile Include="Extensions\JT808PackageExtensionsTest.cs" /> | <Compile Include="Extensions\JT808PackageExtensionsTest.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" /> | ||||
@@ -44,5 +44,13 @@ namespace JT808.Protocol.Test.MessageBody | |||||
Assert.Equal(1000, JT808Bodies.ReplyMsgNum); | Assert.Equal(1000, JT808Bodies.ReplyMsgNum); | ||||
Assert.Equal(Enums.JT808TerminalResult.Success, JT808Bodies.JT808TerminalResult); | Assert.Equal(Enums.JT808TerminalResult.Success, JT808Bodies.JT808TerminalResult); | ||||
} | } | ||||
[Fact] | |||||
public void Test3() | |||||
{ | |||||
var bytes = "7E 00 01 00 05 01 23 45 67 89 00 04 B3 03 E8 00 02 00 D3 7E".ToHexBytes(); | |||||
string json = JT808Serializer.Analyze(bytes); | |||||
//{"[7E]\u5F00\u59CB":126,"[0001]\u6D88\u606FId":1,"\u6D88\u606F\u4F53\u5C5E\u6027\u5BF9\u8C61":{"[0000000000000101]\u6D88\u606F\u4F53\u5C5E\u6027":5,"[0]\u4FDD\u7559":0,"[0]\u4FDD\u7559":0,"[0]\u662F\u5426\u5206\u5305":false,"[000]\u6570\u636E\u52A0\u5BC6":"None","[000000101]\u6D88\u606F\u4F53\u957F\u5EA6":5},"[12345678900]\u7EC8\u7AEF\u624B\u673A\u53F7":"12345678900","[04B3]\u6D88\u606F\u6D41\u6C34\u53F7":1203,"\u6570\u636E\u4F53\u5BF9\u8C61":{"\u7EC8\u7AEF\u901A\u7528\u5E94\u7B54":"03E8000200","[03E8]\u5E94\u7B54\u6D41\u6C34\u53F7":1000,"[0002]\u5E94\u7B54\u6D88\u606FId":2,"[0]\u7ED3\u679C":"Success"},"[D3]\u6821\u9A8C\u7801":211,"[D3]\u7ED3\u675F":211} | |||||
} | |||||
} | } | ||||
} | } |
@@ -12,6 +12,8 @@ namespace JT808.Protocol.Test.MessageBody | |||||
public override ushort MsgId => 0x9999; | public override ushort MsgId => 0x9999; | ||||
public override string Description => "自定义消息"; | |||||
public JT808_0x9999 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808_0x9999 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808_0x9999 jT808_0X9999 = new JT808_0x9999(); | JT808_0x9999 jT808_0X9999 = new JT808_0x9999(); | ||||
@@ -148,6 +148,8 @@ namespace JT808.Protocol.Test.Simples | |||||
public override ushort MsgId => 0x91; | public override ushort MsgId => 0x91; | ||||
public override string Description =>"DT1Demo6"; | |||||
public DT1Demo6 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public DT1Demo6 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
DT1Demo6 dT1Demo6 = new DT1Demo6(); | DT1Demo6 dT1Demo6 = new DT1Demo6(); | ||||
@@ -169,6 +171,9 @@ namespace JT808.Protocol.Test.Simples | |||||
public byte Sex2 { get; set; } | public byte Sex2 { get; set; } | ||||
public ushort Age2 { get; set; } | public ushort Age2 { get; set; } | ||||
public override string Description => "DT2Demo6"; | |||||
public DT2Demo6 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public DT2Demo6 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
DT2Demo6 dT2Demo6 = new DT2Demo6(); | DT2Demo6 dT2Demo6 = new DT2Demo6(); | ||||
@@ -18,10 +18,22 @@ namespace JT808.Protocol | |||||
} | } | ||||
return formatter; | return formatter; | ||||
} | } | ||||
public static object GetAnalyzeByType(this IJT808Config jT808Config, Type type) | |||||
{ | |||||
if (!jT808Config.FormatterFactory.FormatterDict.TryGetValue(type.GUID, out var analyze)) | |||||
{ | |||||
throw new JT808Exception(JT808ErrorCode.NotGlobalRegisterFormatterAssembly, type.FullName); | |||||
} | |||||
return analyze; | |||||
} | |||||
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)); | ||||
} | } | ||||
public static IJT808Analyze GetAnalyze<T>(this IJT808Config jT808Config) | |||||
{ | |||||
return (IJT808Analyze)GetAnalyzeByType(jT808Config, typeof(T)); | |||||
} | |||||
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)) | ||||
@@ -71,12 +71,54 @@ namespace JT808.Protocol.Extensions | |||||
return hex; | return hex; | ||||
} | } | ||||
/// <summary> | |||||
/// Copyright (c) Microsoft. All rights reserved. | |||||
/// Licensed under the MIT license. See LICENSE file in the project root for full license information. | |||||
/// <see cref="DotNetty.Buffers.ByteBufferUtil"/> | |||||
/// </summary> | |||||
public static string ReadNumber(this byte value, string format = "X1") | |||||
{ | |||||
return value.ToString(format); | |||||
} | |||||
public static string ReadNumber(this int value, string format = "X8") | |||||
{ | |||||
return value.ToString(format); | |||||
} | |||||
public static string ReadNumber(this uint value, string format = "X8") | |||||
{ | |||||
return value.ToString(format); | |||||
} | |||||
public static string ReadNumber(this long value, string format = "X16") | |||||
{ | |||||
return value.ToString(format); | |||||
} | |||||
public static string ReadNumber(this ulong value, string format="X16") | |||||
{ | |||||
return value.ToString(format); | |||||
} | |||||
public static string ReadNumber(this short value, string format = "X4") | |||||
{ | |||||
return value.ToString(format); | |||||
} | |||||
public static string ReadNumber(this ushort value, string format = "X4") | |||||
{ | |||||
return value.ToString(format); | |||||
} | |||||
public static ReadOnlySpan<char> ReadBinary(this ushort value) | |||||
{ | |||||
return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan(); | |||||
} | |||||
public static ReadOnlySpan<char> ReadBinary(this short value) | |||||
{ | |||||
return System.Convert.ToString(value, 2).PadLeft(16, '0').AsSpan(); | |||||
} | |||||
public static ReadOnlySpan<char> ReadBinary(this uint value) | |||||
{ | |||||
return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan(); | |||||
} | |||||
public static ReadOnlySpan<char> ReadBinary(this int value) | |||||
{ | |||||
return System.Convert.ToString(value, 2).PadLeft(32, '0').AsSpan(); | |||||
} | |||||
public static ReadOnlySpan<char> ReadBinary(this byte value) | |||||
{ | |||||
return System.Convert.ToString(value, 2).PadLeft(8, '0').AsSpan(); | |||||
} | |||||
} | } | ||||
public static class HexUtil | public static class HexUtil | ||||
@@ -0,0 +1,11 @@ | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.Interfaces | |||||
{ | |||||
public interface IJT808Analyze | |||||
{ | |||||
void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config); | |||||
} | |||||
} |
@@ -0,0 +1,11 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Interfaces | |||||
{ | |||||
public interface IJT808Description | |||||
{ | |||||
string Description { get;} | |||||
} | |||||
} |
@@ -14,7 +14,7 @@ | |||||
<licenseUrl>https://github.com/SmallChi/JT808/blob/master/LICENSE</licenseUrl> | <licenseUrl>https://github.com/SmallChi/JT808/blob/master/LICENSE</licenseUrl> | ||||
<license>https://github.com/SmallChi/JT808/blob/master/LICENSE</license> | <license>https://github.com/SmallChi/JT808/blob/master/LICENSE</license> | ||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | <GeneratePackageOnBuild>false</GeneratePackageOnBuild> | ||||
<Version>2.2.3</Version> | |||||
<Version>2.3.0-preview1</Version> | |||||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | <PackageLicenseFile>LICENSE</PackageLicenseFile> | ||||
</PropertyGroup> | </PropertyGroup> | ||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||||
@@ -57,7 +57,7 @@ | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> | <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> | ||||
<PackageReference Include="Microsoft.CSharp" Version="4.6.0" /> | |||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> | |||||
<PackageReference Include="System.Buffers" Version="4.5.0" /> | <PackageReference Include="System.Buffers" Version="4.5.0" /> | ||||
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" /> | <PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" /> | ||||
<PackageReference Include="System.Memory" Version="4.5.3" /> | <PackageReference Include="System.Memory" Version="4.5.3" /> | ||||
@@ -72,6 +72,7 @@ | |||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> | <PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> | ||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" /> | <PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" /> | ||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0" /> | <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0" /> | ||||
<PackageReference Include="System.Text.Json" Version="4.7.0" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -1,6 +1,8 @@ | |||||
namespace JT808.Protocol | |||||
using JT808.Protocol.Interfaces; | |||||
namespace JT808.Protocol | |||||
{ | { | ||||
public abstract class JT808Bodies | |||||
public abstract class JT808Bodies: IJT808Description | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 跳过数据体序列化 | /// 跳过数据体序列化 | ||||
@@ -10,5 +12,7 @@ | |||||
public virtual bool SkipSerialization { get; set; } = false; | public virtual bool SkipSerialization { get; set; } = false; | ||||
public abstract ushort MsgId { get;} | public abstract ushort MsgId { get;} | ||||
public abstract string Description { get; } | |||||
} | } | ||||
} | } |
@@ -1,17 +1,18 @@ | |||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Exceptions; | using JT808.Protocol.Exceptions; | ||||
using JT808.Protocol.Extensions; | using JT808.Protocol.Extensions; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System; | using System; | ||||
using System.Text.Json; | |||||
namespace JT808.Protocol | namespace JT808.Protocol | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// JT808数据包 | /// JT808数据包 | ||||
/// </summary> | /// </summary> | ||||
public class JT808Package:IJT808MessagePackFormatter<JT808Package> | |||||
public class JT808Package:IJT808MessagePackFormatter<JT808Package>, IJT808Analyze | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 起始符 | /// 起始符 | ||||
@@ -170,7 +171,6 @@ namespace JT808.Protocol | |||||
} | } | ||||
} | } | ||||
} | } | ||||
// 5.读取校验码 | // 5.读取校验码 | ||||
jT808Package.CheckCode = reader.ReadByte(); | jT808Package.CheckCode = reader.ReadByte(); | ||||
// 6.读取终止位置 | // 6.读取终止位置 | ||||
@@ -246,5 +246,164 @@ namespace JT808.Protocol | |||||
writer.WriteEncode(); | writer.WriteEncode(); | ||||
// ---------------组包结束-------------- | // ---------------组包结束-------------- | ||||
} | } | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
// ---------------开始解析对象-------------- | |||||
writer.WriteStartObject(); | |||||
// 1. 验证校验和 | |||||
if (!reader.CheckXorCodeVali) | |||||
{ | |||||
writer.WriteString("检验和错误", $"{reader.RealCheckXorCode}!={reader.CalculateCheckXorCode}"); | |||||
} | |||||
// 2.读取起始位置 | |||||
byte start = reader.ReadEnd(); | |||||
writer.WriteNumber($"[{start.ReadNumber()}]开始", start); | |||||
var msgid = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{msgid.ReadNumber()}]消息Id", msgid); | |||||
ushort messageBodyPropertyValue = reader.ReadUInt16(); | |||||
var headerMessageBodyProperty=new JT808HeaderMessageBodyProperty(messageBodyPropertyValue); | |||||
//消息体属性对象 开始 | |||||
writer.WriteStartObject("消息体属性对象"); | |||||
ReadOnlySpan<char> messageBodyPropertyReadOnlySpan = messageBodyPropertyValue.ReadBinary(); | |||||
writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan.ToString()}]消息体属性", messageBodyPropertyValue); | |||||
if (headerMessageBodyProperty.VersionFlag) | |||||
{ | |||||
writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan[0]}]保留", 0); | |||||
writer.WriteBoolean($"[{messageBodyPropertyReadOnlySpan[1]}]协议版本标识", headerMessageBodyProperty.VersionFlag); | |||||
writer.WriteBoolean($"[{messageBodyPropertyReadOnlySpan.Slice(2,1).ToString()}]是否分包", headerMessageBodyProperty.IsPackage); | |||||
writer.WriteString($"[{messageBodyPropertyReadOnlySpan.Slice(3,3).ToString()}]数据加密", headerMessageBodyProperty.Encrypt.ToString()); | |||||
writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan.Slice(7).ToString()}]消息体长度", headerMessageBodyProperty.DataLength); | |||||
//消息体属性对象 结束 | |||||
writer.WriteEndObject(); | |||||
//2019版本 | |||||
var protocolVersion = reader.ReadByte(); | |||||
writer.WriteNumber($"[{protocolVersion.ReadNumber()}]协议版本号(2019)", protocolVersion); | |||||
// 3.4.读取终端手机号 | |||||
var terminalPhoneNo = reader.ReadBCD(20, config.Trim); | |||||
writer.WriteString($"[{terminalPhoneNo}]终端手机号", terminalPhoneNo); | |||||
} | |||||
else | |||||
{ | |||||
writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan[0]}]保留", 0); | |||||
writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan[1]}]保留", 0); | |||||
writer.WriteBoolean($"[{messageBodyPropertyReadOnlySpan.Slice(2, 1).ToString()}]是否分包", headerMessageBodyProperty.IsPackage); | |||||
writer.WriteString($"[{messageBodyPropertyReadOnlySpan.Slice(3, 3).ToString()}]数据加密", headerMessageBodyProperty.Encrypt.ToString()); | |||||
writer.WriteNumber($"[{messageBodyPropertyReadOnlySpan.Slice(7).ToString()}]消息体长度", headerMessageBodyProperty.DataLength); | |||||
writer.WriteEndObject(); | |||||
//2013版本 | |||||
// 3.3.读取终端手机号 | |||||
var terminalPhoneNo = reader.ReadBCD(config.TerminalPhoneNoLength, config.Trim); | |||||
//消息体属性对象 结束 | |||||
writer.WriteString($"[{terminalPhoneNo}]终端手机号", terminalPhoneNo); | |||||
} | |||||
// 3.4.读取消息流水号 | |||||
var msgNum = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{msgNum.ReadNumber()}]消息流水号", msgNum); | |||||
// 3.5.判断有无分包 | |||||
uint packgeCount=0, packageIndex=0; | |||||
if (headerMessageBodyProperty.IsPackage) | |||||
{ | |||||
//3.5.1.读取消息包总数 | |||||
packgeCount = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{packgeCount.ReadNumber()}]消息包总数", packgeCount); | |||||
//3.5.2.读取消息包序号 | |||||
packageIndex = reader.ReadUInt16(); | |||||
writer.WriteNumber($"[{packageIndex.ReadNumber()}]消息包序号", packageIndex); | |||||
} | |||||
// 4.处理数据体 | |||||
// 4.1.判断有无数据体 | |||||
if (headerMessageBodyProperty.DataLength > 0) | |||||
{ | |||||
if (config.MsgIdFactory.TryGetValue(msgid, out object instance)) | |||||
{ | |||||
//数据体属性对象 开始 | |||||
writer.WriteStartObject("数据体对象"); | |||||
string description = "数据体"; | |||||
if (instance is IJT808Description jT808Description) | |||||
{ | |||||
//4.2.处理消息体 | |||||
description = jT808Description.Description; | |||||
} | |||||
if (headerMessageBodyProperty.IsPackage) | |||||
{ | |||||
if (packageIndex > 1) | |||||
{ | |||||
try | |||||
{ | |||||
//4.2处理第二包之后的分包数据消息体 | |||||
writer.WriteString($"[分包]数据体", reader.ReadContent().ToArray().ToHexString()); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
writer.WriteString($"[分包]数据体异常", ex.StackTrace); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
try | |||||
{ | |||||
writer.WriteString($"[分包]{description}", reader.ReadVirtualArray(headerMessageBodyProperty.DataLength).ToArray().ToHexString()); | |||||
if (instance is IJT808Analyze analyze) | |||||
{ | |||||
//4.2.处理消息体 | |||||
analyze.Analyze(ref reader, writer, config); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
writer.WriteString($"[分包]数据体异常", ex.StackTrace); | |||||
} | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
try | |||||
{ | |||||
writer.WriteString($"{description}", reader.ReadVirtualArray(headerMessageBodyProperty.DataLength).ToArray().ToHexString()); | |||||
if (instance is IJT808Analyze analyze) | |||||
{ | |||||
//4.2.处理消息体 | |||||
analyze.Analyze(ref reader, writer, config); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
writer.WriteString($"数据体异常", ex.StackTrace); | |||||
} | |||||
} | |||||
//数据体属性对象 结束 | |||||
writer.WriteEndObject(); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
if (config.MsgIdFactory.TryGetValue(msgid, out object instance)) | |||||
{ | |||||
//数据体属性对象 开始 | |||||
writer.WriteStartObject("数据体对象"); | |||||
string description = "[Null]数据体"; | |||||
if (instance is IJT808Description jT808Description) | |||||
{ | |||||
//4.2.处理消息体 | |||||
description = jT808Description.Description; | |||||
} | |||||
writer.WriteNull(description); | |||||
//数据体属性对象 结束 | |||||
writer.WriteEndObject(); | |||||
} | |||||
else | |||||
{ | |||||
writer.WriteNull($"[Null]数据体"); | |||||
} | |||||
} | |||||
// 5.读取校验码 | |||||
reader.ReadByte(); | |||||
writer.WriteNumber($"[{reader.RealCheckXorCode.ReadNumber()}]校验码", reader.RealCheckXorCode); | |||||
// 6.读取终止位置 | |||||
byte end = reader.ReadEnd(); | |||||
writer.WriteNumber($"[{end.ReadNumber()}]结束", end); | |||||
writer.WriteEndObject(); | |||||
} | |||||
} | } | ||||
} | } |
@@ -5,6 +5,9 @@ using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.Internal; | using JT808.Protocol.Internal; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System; | using System; | ||||
using System.IO; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol | namespace JT808.Protocol | ||||
{ | { | ||||
@@ -161,5 +164,97 @@ namespace JT808.Protocol | |||||
JT808ArrayPool.Return(buffer); | JT808ArrayPool.Return(buffer); | ||||
} | } | ||||
} | } | ||||
public string Analyze(ReadOnlySpan<byte> bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096) | |||||
{ | |||||
byte[] buffer = JT808ArrayPool.Rent(minBufferSize); | |||||
try | |||||
{ | |||||
JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version); | |||||
jT808MessagePackReader.Decode(buffer); | |||||
using(MemoryStream memoryStream = new MemoryStream()) | |||||
using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options)) | |||||
{ | |||||
jT808Package.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config); | |||||
utf8JsonWriter.Flush(); | |||||
string value = Encoding.UTF8.GetString(memoryStream.ToArray()); | |||||
return value; | |||||
} | |||||
} | |||||
finally | |||||
{ | |||||
JT808ArrayPool.Return(buffer); | |||||
} | |||||
} | |||||
public string Analyze<T>(ReadOnlySpan<byte> bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096) | |||||
{ | |||||
byte[] buffer = JT808ArrayPool.Rent(minBufferSize); | |||||
byte[] buffer1 = JT808ArrayPool.Rent(minBufferSize); | |||||
try | |||||
{ | |||||
JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version); | |||||
if (CheckPackageType(typeof(T))) | |||||
jT808MessagePackReader.Decode(buffer); | |||||
var analyze = jT808Config.GetAnalyze<T>(); | |||||
using (MemoryStream memoryStream = new MemoryStream(buffer1)) | |||||
using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options)) | |||||
{ | |||||
analyze.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config); | |||||
utf8JsonWriter.Flush(); | |||||
return utf8JsonWriter.ToString(); | |||||
} | |||||
} | |||||
finally | |||||
{ | |||||
JT808ArrayPool.Return(buffer); | |||||
JT808ArrayPool.Return(buffer1); | |||||
} | |||||
} | |||||
public byte[] AnalyzeJsonBuffer(ReadOnlySpan<byte> bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096) | |||||
{ | |||||
byte[] buffer = JT808ArrayPool.Rent(minBufferSize); | |||||
try | |||||
{ | |||||
JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version); | |||||
jT808MessagePackReader.Decode(buffer); | |||||
using (MemoryStream memoryStream = new MemoryStream()) | |||||
using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options)) | |||||
{ | |||||
jT808Package.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config); | |||||
utf8JsonWriter.Flush(); | |||||
return memoryStream.ToArray(); | |||||
} | |||||
} | |||||
finally | |||||
{ | |||||
JT808ArrayPool.Return(buffer); | |||||
} | |||||
} | |||||
public byte[] AnalyzeJsonBuffer<T>(ReadOnlySpan<byte> bytes, JT808Version version = JT808Version.JTT2013, JsonWriterOptions options = default, int minBufferSize = 8096) | |||||
{ | |||||
byte[] buffer = JT808ArrayPool.Rent(minBufferSize); | |||||
try | |||||
{ | |||||
JT808MessagePackReader jT808MessagePackReader = new JT808MessagePackReader(bytes, version); | |||||
if (CheckPackageType(typeof(T))) | |||||
jT808MessagePackReader.Decode(buffer); | |||||
var analyze = jT808Config.GetAnalyze<T>(); | |||||
using (MemoryStream memoryStream = new MemoryStream()) | |||||
using (Utf8JsonWriter utf8JsonWriter = new Utf8JsonWriter(memoryStream, options)) | |||||
{ | |||||
analyze.Analyze(ref jT808MessagePackReader, utf8JsonWriter, jT808Config); | |||||
utf8JsonWriter.Flush(); | |||||
return memoryStream.ToArray(); | |||||
} | |||||
} | |||||
finally | |||||
{ | |||||
JT808ArrayPool.Return(buffer); | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -14,6 +14,8 @@ namespace JT808.Protocol | |||||
public override ushort MsgId => 0xFFFF; | public override ushort MsgId => 0xFFFF; | ||||
public override string Description => "统一分包数据体"; | |||||
public JT808SplitPackageBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | public JT808SplitPackageBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | ||||
{ | { | ||||
JT808SplitPackageBodies jT808SplitPackageBodies = new JT808SplitPackageBodies | JT808SplitPackageBodies jT808SplitPackageBodies = new JT808SplitPackageBodies | ||||
@@ -1,15 +1,19 @@ | |||||
using JT808.Protocol.Enums; | using JT808.Protocol.Enums; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.Interfaces; | |||||
using System.Text.Json; | |||||
using JT808.Protocol.Extensions; | |||||
namespace JT808.Protocol.MessageBody | namespace JT808.Protocol.MessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 终端通用应答 | /// 终端通用应答 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_0x0001 : JT808Bodies,IJT808MessagePackFormatter<JT808_0x0001> | |||||
public class JT808_0x0001 : JT808Bodies,IJT808MessagePackFormatter<JT808_0x0001>, IJT808Analyze | |||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0001; | |||||
public override ushort MsgId => 0x0001; | |||||
public override string Description => "终端通用应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 对应的平台消息的流水号 | /// 对应的平台消息的流水号 | ||||
@@ -43,5 +47,15 @@ namespace JT808.Protocol.MessageBody | |||||
writer.WriteUInt16(value.ReplyMsgId); | writer.WriteUInt16(value.ReplyMsgId); | ||||
writer.WriteByte((byte)value.JT808TerminalResult); | writer.WriteByte((byte)value.JT808TerminalResult); | ||||
} | } | ||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
var replyMsgNum = reader.ReadUInt16(); | |||||
var replyMsgId = reader.ReadUInt16(); | |||||
var terminalResult = reader.ReadByte(); | |||||
writer.WriteNumber($"[{replyMsgNum.ReadNumber()}]应答流水号", replyMsgNum); | |||||
writer.WriteNumber($"[{replyMsgId.ReadNumber()}]应答消息Id", replyMsgId); | |||||
writer.WriteString($"[{terminalResult.ReadNumber()}]结果", ((JT808TerminalResult)terminalResult).ToString()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -7,5 +7,7 @@ | |||||
{ | { | ||||
public override bool SkipSerialization { get; set; } = true; | public override bool SkipSerialization { get; set; } = true; | ||||
public override ushort MsgId { get; } = 0x0002; | public override ushort MsgId { get; } = 0x0002; | ||||
public override string Description => "终端心跳"; | |||||
} | } | ||||
} | } |
@@ -11,5 +11,7 @@ | |||||
public override bool SkipSerialization { get; set; } = true; | public override bool SkipSerialization { get; set; } = true; | ||||
public override ushort MsgId { get; } = 0x0003; | public override ushort MsgId { get; } = 0x0003; | ||||
public override string Description => "终端注销请求"; | |||||
} | } | ||||
} | } |
@@ -14,5 +14,7 @@ namespace JT808.Protocol.MessageBody | |||||
public override bool SkipSerialization { get; set; } = true; | public override bool SkipSerialization { get; set; } = true; | ||||
public override ushort MsgId { get; } = 0x0004; | public override ushort MsgId { get; } = 0x0004; | ||||
public override string Description => "查询服务器时间请求"; | |||||
} | } | ||||
} | } |
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0005 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0005>, IJT808_2019_Version | public class JT808_0x0005 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0005>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0005; | public override ushort MsgId { get; } = 0x0005; | ||||
public override string Description => "终端补传分包请求"; | |||||
/// <summary> | /// <summary> | ||||
/// 原始消息流水号 | /// 原始消息流水号 | ||||
/// 对应要求补传的原始消息第一包的消息流水号 | /// 对应要求补传的原始消息第一包的消息流水号 | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0100 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0100>, IJT808_2019_Version | public class JT808_0x0100 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0100>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0100; | public override ushort MsgId { get; } = 0x0100; | ||||
public override string Description => "终端注册"; | |||||
/// <summary> | /// <summary> | ||||
/// 省域 ID | /// 省域 ID | ||||
/// 标示终端安装车辆所在的省域,0 保留,由平台取默 | /// 标示终端安装车辆所在的省域,0 保留,由平台取默 | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0102 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0102>, IJT808_2019_Version | public class JT808_0x0102 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0102>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0102; | public override ushort MsgId { get; } = 0x0102; | ||||
public override string Description => "终端鉴权"; | |||||
/// <summary> | /// <summary> | ||||
/// 鉴权码 | /// 鉴权码 | ||||
/// 鉴权码内容 2019版本 | /// 鉴权码内容 2019版本 | ||||
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0104 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0104> | public class JT808_0x0104 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0104> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0104; | public override ushort MsgId { get; } = 0x0104; | ||||
public override string Description => "查询终端参数应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 查询指定终端参数的流水号 | /// 查询指定终端参数的流水号 | ||||
@@ -11,6 +11,8 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0107 : JT808Bodies,IJT808MessagePackFormatter<JT808_0x0107>, IJT808_2019_Version | public class JT808_0x0107 : JT808Bodies,IJT808MessagePackFormatter<JT808_0x0107>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0107; | public override ushort MsgId { get; } = 0x0107; | ||||
public override string Description => "查询终端属性应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 终端类型 | /// 终端类型 | ||||
/// bit0,0:不适用客运车辆,1:适用客运车辆; | /// bit0,0:不适用客运车辆,1:适用客运车辆; | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0108 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0108> | public class JT808_0x0108 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0108> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0108; | public override ushort MsgId { get; } = 0x0108; | ||||
public override string Description => "终端升级结果通知"; | |||||
/// <summary> | /// <summary> | ||||
/// 升级类型 | /// 升级类型 | ||||
/// 0:终端,12:道路运输证 IC 卡读卡器,52:北斗卫星定位模块 | /// 0:终端,12:道路运输证 IC 卡读卡器,52:北斗卫星定位模块 | ||||
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0200 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0200> | public class JT808_0x0200 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0200> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0200; | public override ushort MsgId { get; } = 0x0200; | ||||
public override string Description => "位置信息汇报"; | |||||
/// <summary> | /// <summary> | ||||
/// 报警标志 | /// 报警标志 | ||||
/// </summary> | /// </summary> | ||||
@@ -9,6 +9,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0201 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0201> | public class JT808_0x0201 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0201> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0201; | public override ushort MsgId { get; } = 0x0201; | ||||
public override string Description => "位置信息查询应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 对应的终端注册消息的流水号 | /// 对应的终端注册消息的流水号 | ||||
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0301 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0301>, IJT808_2019_Version | public class JT808_0x0301 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0301>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0301; | public override ushort MsgId { get; } = 0x0301; | ||||
public override string Description => "事件报告"; | |||||
/// <summary> | /// <summary> | ||||
/// 事件 ID | /// 事件 ID | ||||
/// </summary> | /// </summary> | ||||
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0302 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0302>,IJT808_2019_Version | public class JT808_0x0302 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0302>,IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0302; | public override ushort MsgId { get; } = 0x0302; | ||||
public override string Description => "提问应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 对应的提问下发消息的流水号 | /// 对应的提问下发消息的流水号 | ||||
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0303 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0303>, IJT808_2019_Version | public class JT808_0x0303 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0303>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0303; | public override ushort MsgId { get; } = 0x0303; | ||||
public override string Description => "信息点播_取消"; | |||||
/// <summary> | /// <summary> | ||||
/// 信息类型 | /// 信息类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -9,6 +9,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0500 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0500> | public class JT808_0x0500 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0500> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0500; | public override ushort MsgId { get; } = 0x0500; | ||||
public override string Description => "车辆控制应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 对应的终端注册消息的流水号 | /// 对应的终端注册消息的流水号 | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0608 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0608>, IJT808_2019_Version | public class JT808_0x0608 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0608>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0608; | public override ushort MsgId { get; } = 0x0608; | ||||
public override string Description => "查询区域或线路数据应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 查询类型 | /// 查询类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0701 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0701> | public class JT808_0x0701 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0701> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0701; | public override ushort MsgId { get; } = 0x0701; | ||||
public override string Description => "电子运单上报"; | |||||
/// <summary> | /// <summary> | ||||
/// 电子运单长度 | /// 电子运单长度 | ||||
/// </summary> | /// </summary> | ||||
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0702 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0702>, IJT808_2019_Version | public class JT808_0x0702 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0702>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0702; | public override ushort MsgId { get; } = 0x0702; | ||||
public override string Description => "驾驶员身份信息采集上报"; | |||||
/// <summary> | /// <summary> | ||||
/// 状态 | /// 状态 | ||||
/// 0x01:从业资格证 IC 卡插入(驾驶员上班); | /// 0x01:从业资格证 IC 卡插入(驾驶员上班); | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0704 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0704> | public class JT808_0x0704 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0704> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0704; | public override ushort MsgId { get; } = 0x0704; | ||||
public override string Description => "定位数据批量上传"; | |||||
/// <summary> | /// <summary> | ||||
/// 数据项个数 | /// 数据项个数 | ||||
/// </summary> | /// </summary> | ||||
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0705 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0705>,IJT808_2019_Version | public class JT808_0x0705 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0705>,IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0705; | public override ushort MsgId { get; } = 0x0705; | ||||
public override string Description => "CAN总线数据上传"; | |||||
/// <summary> | /// <summary> | ||||
/// 数据项个数 | /// 数据项个数 | ||||
/// 包含的 CAN 总线数据项个数,>0 | /// 包含的 CAN 总线数据项个数,>0 | ||||
@@ -1,5 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
namespace JT808.Protocol.MessageBody | namespace JT808.Protocol.MessageBody | ||||
@@ -11,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0800 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0800> | public class JT808_0x0800 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0800> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0800; | public override ushort MsgId { get; } = 0x0800; | ||||
public override string Description => "多媒体事件信息上传"; | |||||
/// <summary> | /// <summary> | ||||
/// 多媒体数据 ID | /// 多媒体数据 ID | ||||
/// </summary> | /// </summary> | ||||
@@ -1,5 +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.MessagePack; | using JT808.Protocol.MessagePack; | ||||
@@ -12,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0801>, IJT808_2019_Version | public class JT808_0x0801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0801>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0801; | public override ushort MsgId { get; } = 0x0801; | ||||
public override string Description => "多媒体数据上传"; | |||||
/// <summary> | /// <summary> | ||||
/// 多媒体 ID | /// 多媒体 ID | ||||
/// </summary> | /// </summary> | ||||
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0802 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0802>, IJT808_2019_Version | public class JT808_0x0802 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0802>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0802; | public override ushort MsgId { get; } = 0x0802; | ||||
public override string Description => "存储多媒体数据检索应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 对应的多媒体数据检索消息的流水号 | /// 对应的多媒体数据检索消息的流水号 | ||||
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0805 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0805>, IJT808_2019_Version | public class JT808_0x0805 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0805>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0805; | public override ushort MsgId { get; } = 0x0805; | ||||
public override string Description => "摄像头立即拍摄命令应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 对应平台摄像头立即拍摄命令的消息流水号 | /// 对应平台摄像头立即拍摄命令的消息流水号 | ||||
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0900 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0900>, IJT808_2019_Version | public class JT808_0x0900 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0900>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0900; | public override ushort MsgId { get; } = 0x0900; | ||||
public override string Description => "数据上行透传"; | |||||
/// <summary> | /// <summary> | ||||
/// 透传消息类型 | /// 透传消息类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0901 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0901> | public class JT808_0x0901 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0901> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0901; | public override ushort MsgId { get; } = 0x0901; | ||||
public override string Description => "数据压缩上报"; | |||||
/// <summary> | /// <summary> | ||||
/// 未压缩消息长度 | /// 未压缩消息长度 | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x0A00 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0A00> | public class JT808_0x0A00 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x0A00> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x0A00; | public override ushort MsgId { get; } = 0x0A00; | ||||
public override string Description => "终端RSA公钥"; | |||||
/// <summary> | /// <summary> | ||||
/// e | /// e | ||||
/// 终端 RSA 公钥{e,n}中的 e | /// 终端 RSA 公钥{e,n}中的 e | ||||
@@ -1,5 +1,4 @@ | |||||
using JT808.Protocol.Attributes; | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Formatters; | using JT808.Protocol.Formatters; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
@@ -11,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8001 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8001> | public class JT808_0x8001 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8001> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8001; | public override ushort MsgId { get; } = 0x8001; | ||||
public override string Description => "平台通用应答"; | |||||
public ushort MsgNum { get; set; } | public ushort MsgNum { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// <see cref="JT808.Protocol.Enums.JT808MsgId"/> | /// <see cref="JT808.Protocol.Enums.JT808MsgId"/> | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8003 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8003> | public class JT808_0x8003 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8003> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8003; | public override ushort MsgId { get; } = 0x8003; | ||||
public override string Description => "补传分包请求"; | |||||
/// <summary> | /// <summary> | ||||
/// 原始消息流水号 | /// 原始消息流水号 | ||||
/// 对应要求补传的原始消息第一包的消息流水号 | /// 对应要求补传的原始消息第一包的消息流水号 | ||||
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8004 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8004>, IJT808_2019_Version | public class JT808_0x8004 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8004>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8004; | public override ushort MsgId { get; } = 0x8004; | ||||
public override string Description => "查询服务器时间应答"; | |||||
public DateTime Time { get; set; } = DateTime.Now; | public DateTime Time { get; set; } = DateTime.Now; | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8100 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8100> | public class JT808_0x8100 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8100> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8100; | public override ushort MsgId { get; } = 0x8100; | ||||
public override string Description => "终端注册应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 应答流水号 | /// 应答流水号 | ||||
/// 对应的终端注册消息的流水号 | /// 对应的终端注册消息的流水号 | ||||
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8103 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8103> | public class JT808_0x8103 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8103> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8103; | public override ushort MsgId { get; } = 0x8103; | ||||
public override string Description => "设置终端参数"; | |||||
/// <summary> | /// <summary> | ||||
/// 参数总数 | /// 参数总数 | ||||
/// </summary> | /// </summary> | ||||
@@ -6,6 +6,7 @@ | |||||
public class JT808_0x8104 : JT808Bodies | public class JT808_0x8104 : JT808Bodies | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8104; | public override ushort MsgId { get; } = 0x8104; | ||||
public override string Description => "查询终端参数"; | |||||
/// <summary> | /// <summary> | ||||
/// 跳过数据体序列化 | /// 跳过数据体序列化 | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8105>, IJT808_2019_Version | public class JT808_0x8105 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8105>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8105; | public override ushort MsgId { get; } = 0x8105; | ||||
public override string Description => "终端控制"; | |||||
/// <summary> | /// <summary> | ||||
/// 命令字 | /// 命令字 | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8106 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8106> | public class JT808_0x8106 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8106> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8106; | public override ushort MsgId { get; } = 0x8106; | ||||
public override string Description => "查询指定终端参数"; | |||||
/// <summary> | /// <summary> | ||||
/// 参数总数 | /// 参数总数 | ||||
/// 参数总数为 n | /// 参数总数为 n | ||||
@@ -10,5 +10,7 @@ | |||||
/// 跳过数据体序列化 | /// 跳过数据体序列化 | ||||
/// </summary> | /// </summary> | ||||
public override bool SkipSerialization { get; set; } = true; | public override bool SkipSerialization { get; set; } = true; | ||||
public override string Description => "查询终端属性"; | |||||
} | } | ||||
} | } |
@@ -11,6 +11,8 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8108 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8108>, IJT808_2019_Version | public class JT808_0x8108 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8108>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8108; | public override ushort MsgId { get; } = 0x8108; | ||||
public override string Description => "下发终端升级包"; | |||||
/// <summary> | /// <summary> | ||||
/// 升级类型 | /// 升级类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -10,5 +10,7 @@ | |||||
/// 跳过数据体序列化 | /// 跳过数据体序列化 | ||||
/// </summary> | /// </summary> | ||||
public override bool SkipSerialization { get; set; } = true; | public override bool SkipSerialization { get; set; } = true; | ||||
public override string Description => "位置信息查询"; | |||||
} | } | ||||
} | } |
@@ -9,6 +9,8 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8202 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8202> | public class JT808_0x8202 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8202> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8202; | public override ushort MsgId { get; } = 0x8202; | ||||
public override string Description => "临时位置跟踪控制"; | |||||
/// <summary> | /// <summary> | ||||
/// 时间间隔 | /// 时间间隔 | ||||
/// 单位为秒(s),0 则停止跟踪。停止跟踪无需带后继字段 | /// 单位为秒(s),0 则停止跟踪。停止跟踪无需带后继字段 | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8203 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8203> | public class JT808_0x8203 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8203> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8203; | public override ushort MsgId { get; } = 0x8203; | ||||
public override string Description => "人工确认报警消息"; | |||||
/// <summary> | /// <summary> | ||||
/// 报警消息流水号 | /// 报警消息流水号 | ||||
/// 需人工确认的报警消息流水号,0 表示该报警类型所有消息 | /// 需人工确认的报警消息流水号,0 表示该报警类型所有消息 | ||||
@@ -13,5 +13,7 @@ namespace JT808.Protocol.MessageBody | |||||
public override ushort MsgId { get; } = 0x8204; | public override ushort MsgId { get; } = 0x8204; | ||||
public override bool SkipSerialization { get; set; } = true; | public override bool SkipSerialization { get; set; } = true; | ||||
public override string Description => "链路检测"; | |||||
} | } | ||||
} | } |
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8300 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8300>, IJT808_2019_Version | public class JT808_0x8300 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8300>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8300; | public override ushort MsgId { get; } = 0x8300; | ||||
public override string Description => "文本信息下发"; | |||||
/// <summary> | /// <summary> | ||||
/// 文本信息标志位含义见 表 38 | /// 文本信息标志位含义见 表 38 | ||||
/// </summary> | /// </summary> | ||||
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8301 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8301>,IJT808_2019_Version | public class JT808_0x8301 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8301>,IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8301; | public override ushort MsgId { get; } = 0x8301; | ||||
public override string Description => "事件设置"; | |||||
/// <summary> | /// <summary> | ||||
/// 设置类型 | /// 设置类型 | ||||
/// <see cref="JT808.Protocol.Enums.JT808EventSettingType"/> | /// <see cref="JT808.Protocol.Enums.JT808EventSettingType"/> | ||||
@@ -14,6 +14,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8302 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8302>, IJT808_2019_Version | public class JT808_0x8302 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8302>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8302; | public override ushort MsgId { get; } = 0x8302; | ||||
public override string Description => "提问下发"; | |||||
/// <summary> | /// <summary> | ||||
/// 标志 | /// 标志 | ||||
/// 提问下发标志位定义 | /// 提问下发标志位定义 | ||||
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8303 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8303>, IJT808_2019_Version | public class JT808_0x8303 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8303>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8303; | public override ushort MsgId { get; } = 0x8303; | ||||
public override string Description => "信息点播菜单设置"; | |||||
/// <summary> | /// <summary> | ||||
/// 设置类型 | /// 设置类型 | ||||
/// <see cref="JT808.Protocol.Enums.JT808InformationSettingType"/> | /// <see cref="JT808.Protocol.Enums.JT808InformationSettingType"/> | ||||
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8304 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8304>, IJT808_2019_Version | public class JT808_0x8304 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8304>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8304; | public override ushort MsgId { get; } = 0x8304; | ||||
public override string Description => "信息服务"; | |||||
/// <summary> | /// <summary> | ||||
/// 信息类型 | /// 信息类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8400 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8400> | public class JT808_0x8400 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8400> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8400; | public override ushort MsgId { get; } = 0x8400; | ||||
public override string Description => "电话回拨"; | |||||
/// <summary> | /// <summary> | ||||
/// 0:普通通话;1:监听 | /// 0:普通通话;1:监听 | ||||
/// </summary> | /// </summary> | ||||
@@ -12,6 +12,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8401 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8401> | public class JT808_0x8401 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8401> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8401; | public override ushort MsgId { get; } = 0x8401; | ||||
public override string Description => "设置电话本"; | |||||
/// <summary> | /// <summary> | ||||
/// 设置类型 | /// 设置类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8500 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8500>, IJT808_2019_Version | public class JT808_0x8500 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8500>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8500; | public override ushort MsgId { get; } = 0x8500; | ||||
public override string Description => "车辆控制"; | |||||
/// <summary> | /// <summary> | ||||
/// 控制标志 | /// 控制标志 | ||||
/// 控制指令标志位数据格式 | /// 控制指令标志位数据格式 | ||||
@@ -16,6 +16,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8600 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8600>, IJT808_2019_Version | public class JT808_0x8600 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8600>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8600; | public override ushort MsgId { get; } = 0x8600; | ||||
public override string Description => "设置圆形区域"; | |||||
/// <summary> | /// <summary> | ||||
/// 设置属性 | /// 设置属性 | ||||
/// <see cref="JT808.Protocol.Enums.JT808SettingProperty"/> | /// <see cref="JT808.Protocol.Enums.JT808SettingProperty"/> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8601 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8601> | public class JT808_0x8601 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8601> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8601; | public override ushort MsgId { get; } = 0x8601; | ||||
public override string Description => "删除圆形区域"; | |||||
/// <summary> | /// <summary> | ||||
/// 区域数 | /// 区域数 | ||||
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | /// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | ||||
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8602 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8602>, IJT808_2019_Version | public class JT808_0x8602 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8602>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8602; | public override ushort MsgId { get; } = 0x8602; | ||||
public override string Description => "设置矩形区域"; | |||||
/// <summary> | /// <summary> | ||||
/// 设置属性 | /// 设置属性 | ||||
/// <see cref="JT808.Protocol.Enums.JT808SettingProperty"/> | /// <see cref="JT808.Protocol.Enums.JT808SettingProperty"/> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8603 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8603> | public class JT808_0x8603 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8603> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8603; | public override ushort MsgId { get; } = 0x8603; | ||||
public override string Description => "删除矩形区域"; | |||||
/// <summary> | /// <summary> | ||||
/// 区域数 | /// 区域数 | ||||
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | /// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | ||||
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8604 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8604>, IJT808_2019_Version | public class JT808_0x8604 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8604>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8604; | public override ushort MsgId { get; } = 0x8604; | ||||
public override string Description => "设置多边形区域"; | |||||
/// <summary> | /// <summary> | ||||
/// 区域 ID | /// 区域 ID | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8605 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8605> | public class JT808_0x8605 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8605> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8605; | public override ushort MsgId { get; } = 0x8605; | ||||
public override string Description => "删除多边形区域"; | |||||
/// <summary> | /// <summary> | ||||
/// 区域数 | /// 区域数 | ||||
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | /// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | ||||
@@ -15,6 +15,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8606 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8606>, IJT808_2019_Version | public class JT808_0x8606 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8606>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8606; | public override ushort MsgId { get; } = 0x8606; | ||||
public override string Description => "设置路线"; | |||||
/// <summary> | /// <summary> | ||||
/// 路线 ID | /// 路线 ID | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8607 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8607> | public class JT808_0x8607 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8607> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8607; | public override ushort MsgId { get; } = 0x8607; | ||||
public override string Description => "删除路线"; | |||||
/// <summary> | /// <summary> | ||||
/// 区域数 | /// 区域数 | ||||
/// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | /// 本条消息中包含的区域数,不超过 125 个,多于 125个建议用多条消息,0 为删除所有圆形区域 | ||||
@@ -13,6 +13,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8608 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8608>, IJT808_2019_Version | public class JT808_0x8608 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8608>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8608; | public override ushort MsgId { get; } = 0x8608; | ||||
public override string Description => "查询区域或线路数据"; | |||||
/// <summary> | /// <summary> | ||||
/// 查询类型 | /// 查询类型 | ||||
/// </summary> | /// </summary> | ||||
@@ -6,6 +6,7 @@ | |||||
public class JT808_0x8702 : JT808Bodies | public class JT808_0x8702 : JT808Bodies | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8702; | public override ushort MsgId { get; } = 0x8702; | ||||
public override string Description => "上报驾驶员身份信息请求"; | |||||
/// <summary> | /// <summary> | ||||
/// 跳过数据体序列化 | /// 跳过数据体序列化 | ||||
/// </summary> | /// </summary> | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8800 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8800> | public class JT808_0x8800 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8800> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8800; | public override ushort MsgId { get; } = 0x8800; | ||||
public override string Description => "多媒体数据上传应答"; | |||||
/// <summary> | /// <summary> | ||||
/// 多媒体ID | /// 多媒体ID | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8801>, IJT808_2019_Version | public class JT808_0x8801 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8801>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8801; | public override ushort MsgId { get; } = 0x8801; | ||||
public override string Description => "摄像头立即拍摄命令"; | |||||
/// <summary> | /// <summary> | ||||
/// 通道 ID | /// 通道 ID | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8802 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8802> | public class JT808_0x8802 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8802> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8802; | public override ushort MsgId { get; } = 0x8802; | ||||
public override string Description => "存储多媒体数据检索"; | |||||
/// <summary> | /// <summary> | ||||
/// 多媒体类型 | /// 多媒体类型 | ||||
/// <see cref="JT808.Protocol.Enums.JT808MultimediaType"/> | /// <see cref="JT808.Protocol.Enums.JT808MultimediaType"/> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8803 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8803> | public class JT808_0x8803 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8803> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8803; | public override ushort MsgId { get; } = 0x8803; | ||||
public override string Description => "存储多媒体数据上传命令"; | |||||
/// <summary> | /// <summary> | ||||
/// 多媒体类型 | /// 多媒体类型 | ||||
/// <see cref="JT808.Protocol.Enums.JT808MultimediaType"/> | /// <see cref="JT808.Protocol.Enums.JT808MultimediaType"/> | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8804 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8804> | public class JT808_0x8804 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8804> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8804; | public override ushort MsgId { get; } = 0x8804; | ||||
public override string Description => "录音开始命令"; | |||||
/// <summary> | /// <summary> | ||||
/// 录音命令 | /// 录音命令 | ||||
/// 0:停止录音;0x01:开始录音; | /// 0:停止录音;0x01:开始录音; | ||||
@@ -10,6 +10,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8805 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8805>,IJT808_2019_Version | public class JT808_0x8805 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8805>,IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8805; | public override ushort MsgId { get; } = 0x8805; | ||||
public override string Description => "单条存储多媒体数据检索上传命令"; | |||||
/// <summary> | /// <summary> | ||||
/// 多媒体ID | /// 多媒体ID | ||||
/// </summary> | /// </summary> | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8900 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8900>, IJT808_2019_Version | public class JT808_0x8900 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8900>, IJT808_2019_Version | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8900; | public override ushort MsgId { get; } = 0x8900; | ||||
public override string Description => "数据下行透传"; | |||||
/// <summary> | /// <summary> | ||||
/// 透传消息类型 | /// 透传消息类型 | ||||
/// 透传消息类型定义见 表 93 | /// 透传消息类型定义见 表 93 | ||||
@@ -11,6 +11,7 @@ namespace JT808.Protocol.MessageBody | |||||
public class JT808_0x8A00 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8A00> | public class JT808_0x8A00 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8A00> | ||||
{ | { | ||||
public override ushort MsgId { get; } = 0x8A00; | public override ushort MsgId { get; } = 0x8A00; | ||||
public override string Description => "平台RSA公钥"; | |||||
/// <summary> | /// <summary> | ||||
/// e | /// e | ||||
/// 平台 RSA 公钥{e,n}中的 e | /// 平台 RSA 公钥{e,n}中的 e | ||||
@@ -160,6 +160,10 @@ namespace JT808.Protocol.MessagePack | |||||
{ | { | ||||
return GetVirtualReadOnlySpan(1)[0]; | return GetVirtualReadOnlySpan(1)[0]; | ||||
} | } | ||||
public ReadOnlySpan<byte> ReadVirtualArray(int count) | |||||
{ | |||||
return GetVirtualReadOnlySpan(count); | |||||
} | |||||
public ushort ReadVirtualUInt16() | public ushort ReadVirtualUInt16() | ||||
{ | { | ||||
return BinaryPrimitives.ReadUInt16BigEndian(GetVirtualReadOnlySpan(2)); | return BinaryPrimitives.ReadUInt16BigEndian(GetVirtualReadOnlySpan(2)); | ||||
@@ -229,6 +233,7 @@ namespace JT808.Protocol.MessagePack | |||||
string hex = HexUtil.DoHexDump(readOnlySpan, 0, len); | string hex = HexUtil.DoHexDump(readOnlySpan, 0, len); | ||||
return hex; | return hex; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// yyMMddHHmmss | /// yyMMddHHmmss | ||||
/// </summary> | /// </summary> | ||||