@@ -6,6 +6,7 @@ | |||
<Description>基于JT809协议、GB809协议扩展的视频消息协议</Description> | |||
<PackageReleaseNotes>基于JT809协议、GB809协议扩展的视频消息协议</PackageReleaseNotes> | |||
<DocumentationFile>JT809.Protocol.Extensions.JT1078.xml</DocumentationFile> | |||
<NoWarn>1701;1702;1591</NoWarn> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
@@ -2,8 +2,8 @@ | |||
<PropertyGroup> | |||
<TargetFramework>net5.0</TargetFramework> | |||
<IsPackable>false</IsPackable> | |||
<NoWarn>1701;1702;1591</NoWarn> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
@@ -100,7 +100,7 @@ namespace JT809.Protocol.Extensions | |||
/// <summary> | |||
/// 获取DescriptionAttribute特性枚举及描述 | |||
/// </summary> | |||
/// <param name="type"></param> | |||
/// <param name="value"></param> | |||
/// <returns></returns> | |||
public static Dictionary<string, string> GetDescriptionAttributeDictionary(this Enum value) | |||
{ | |||
@@ -117,7 +117,7 @@ namespace JT809.Protocol.Extensions | |||
/// <summary> | |||
/// 获取DisplayNameAttribute特性枚举值的描述 | |||
/// </summary> | |||
/// <param name="obj">枚举值</param> | |||
/// <param name="value">枚举值</param> | |||
/// <returns></returns> | |||
public static string GetDisplayName(this Enum value) | |||
{ | |||
@@ -128,7 +128,7 @@ namespace JT809.Protocol.Extensions | |||
/// <summary> | |||
/// 获取DisplayNameAttribute特性枚举及描述 | |||
/// </summary> | |||
/// <param name="type"></param> | |||
/// <param name="value"></param> | |||
/// <returns></returns> | |||
public static Dictionary<string, string> GetDisplayNameAttributeDictionary(this Enum value) | |||
{ | |||
@@ -49,7 +49,6 @@ namespace JT809.Protocol.Extensions | |||
/// 16进制字符串转16进制数组 | |||
/// </summary> | |||
/// <param name="hexString"></param> | |||
/// <param name="separator"></param> | |||
/// <returns></returns> | |||
public static byte[] ToHexBytes(this string hexString) | |||
{ | |||
@@ -40,7 +40,7 @@ namespace JT808.Protocol.Internal | |||
version = (JT809Version)type.GetProperty(nameof(JT809Bodies.Version)).GetValue(instance); | |||
replaceInternalMsgId = (bool)type.GetProperty(nameof(JT809Bodies.ReplaceInternalMsgId)).GetValue(instance); | |||
} | |||
catch (Exception ex) | |||
catch | |||
{ | |||
continue; | |||
} | |||
@@ -78,7 +78,7 @@ namespace JT808.Protocol.Internal | |||
{ | |||
throw new ArgumentException($"{type.FullName} {msgId} An element with the same key already exists."); | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
@@ -144,7 +144,7 @@ namespace JT808.Protocol.Internal | |||
public bool TryGetValue(ushort msgId, JT809Version version, out object instance) | |||
{ | |||
if(version== JT809Version.JTT2019) | |||
if (version == JT809Version.JTT2019) | |||
{ | |||
return Map_2019.TryGetValue(msgId, out instance); | |||
} | |||
@@ -33,7 +33,7 @@ namespace JT808.Protocol.Internal | |||
msgId = (ushort)type.GetProperty(nameof(JT809SubBodies.SubMsgId)).GetValue(instance); | |||
replaceInternalSubMsgId = (bool)type.GetProperty(nameof(JT809SubBodies.ReplaceInternalSubMsgId)).GetValue(instance); | |||
} | |||
catch (Exception ex) | |||
catch | |||
{ | |||
continue; | |||
} | |||
@@ -0,0 +1,130 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<Import Project="..\Info.props" /> | |||
<PropertyGroup> | |||
<PackageId>JT809</PackageId> | |||
<Product>JT809</Product> | |||
<Description>JT809协议、GB809协议、道路运输车辆卫星定位系统-平台数据交换协议(支持2011、2019版本) </Description> | |||
<PackageReleaseNotes>JT809协议、GB809协议、道路运输车辆卫星定位系统-平台数据交换协议(支持2011、2019版本) </PackageReleaseNotes> | |||
<DocumentationFile>JT809.Protocol.xml</DocumentationFile> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'"> | |||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | |||
<NoWarn>1701;1702;1591</NoWarn> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'"> | |||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Compile Remove="Configs\**" /> | |||
<Compile Remove="Enums\**" /> | |||
<Compile Remove="Escape\**" /> | |||
<Compile Remove="ProtocolPacket\**" /> | |||
<EmbeddedResource Remove="Configs\**" /> | |||
<EmbeddedResource Remove="Enums\**" /> | |||
<EmbeddedResource Remove="Escape\**" /> | |||
<EmbeddedResource Remove="ProtocolPacket\**" /> | |||
<None Remove="Configs\**" /> | |||
<None Remove="Enums\**" /> | |||
<None Remove="Escape\**" /> | |||
<None Remove="ProtocolPacket\**" /> | |||
<None Include="..\..\LICENSE"> | |||
<Pack>True</Pack> | |||
<PackagePath></PackagePath> | |||
</None> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Remove="Constants.cs" /> | |||
<Compile Remove="IEscape.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Configs\JT809EncryptOptions.cs" /> | |||
<Compile Include="Configs\JT809HeaderOptions.cs" /> | |||
<Compile Include="Enums\JT809Version.cs" /> | |||
<Compile Include="Enums\JT808_Alarm.cs" /> | |||
<Compile Include="Enums\JT808_Status.cs" /> | |||
<Compile Include="Enums\JT809CommandType.cs" /> | |||
<Compile Include="Enums\JT809ErrorCode.cs" /> | |||
<Compile Include="Enums\JT809BusinessType.cs" /> | |||
<Compile Include="Enums\JT809SubBusinessType.cs" /> | |||
<Compile Include="Enums\JT809VehicleColorType.cs" /> | |||
<Compile Include="Enums\JT809WarnSrc.cs" /> | |||
<Compile Include="Enums\JT809WarnType.cs" /> | |||
<Compile Include="Enums\JT809_0x1413_SupervisionLevel.cs" /> | |||
<Compile Include="Enums\JT809_0x1412_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1411_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1502_PhotoRspFlag.cs" /> | |||
<Compile Include="Enums\JT809_0x1501_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1505_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1503_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1403_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1401_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1002_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x1007_ErrorCode.cs" /> | |||
<Compile Include="Enums\JT809_0x920A_UploadFlag.cs" /> | |||
<Compile Include="Enums\JT809_0x9201_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x920D_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x9302_ObjectType.cs" /> | |||
<Compile Include="Enums\JT809_0x9301_ObjectType.cs" /> | |||
<Compile Include="Enums\JT809_0x1301_ObjectType.cs" /> | |||
<Compile Include="Enums\JT809_0x9209_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x9208_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x9207_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x9206_ReasonCode.cs" /> | |||
<Compile Include="Enums\JT809_0x9205_ReasonCode.cs" /> | |||
<Compile Include="Enums\JT809_0x9007_ReasonCode.cs" /> | |||
<Compile Include="Enums\JT809_0x1008_ReasonCode.cs" /> | |||
<Compile Include="Enums\JT809_0x9002_Result.cs" /> | |||
<Compile Include="Enums\JT809_0x9008_ReasonCode.cs" /> | |||
<Compile Include="Enums\JT809_0x9503_MsgPriority.cs" /> | |||
<Compile Include="Enums\JT809_9401_SupervisionLevel.cs" /> | |||
<Compile Include="Enums\JT809_LinkType.cs" /> | |||
<Compile Include="Enums\JT809_VehiclePositionEncrypt.cs" /> | |||
<Compile Include="Enums\JT809__0x9502_ImageType.cs" /> | |||
<Compile Include="Enums\JT809__0x9502_SizeType.cs" /> | |||
</ItemGroup> | |||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> | |||
<PackageReference Include="Microsoft.CSharp" Version="4.6.0" /> | |||
<PackageReference Include="System.Buffers" Version="4.5.1" /> | |||
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" /> | |||
<PackageReference Include="System.Memory" Version="4.5.4" /> | |||
<PackageReference Include="System.Reflection.Extensions" Version="4.3.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> | |||
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" /> | |||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" /> | |||
<PackageReference Include="System.Text.Json" Version="5.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Update="Extensions\JT809PackageExtensionsTemplate.cs"> | |||
<DesignTime>True</DesignTime> | |||
<AutoGen>True</AutoGen> | |||
<DependentUpon>JT809PackageExtensionsTemplate.tt</DependentUpon> | |||
</Compile> | |||
<Compile Update="Extensions\JT809SubPackageExtensionsTemplate.cs"> | |||
<DesignTime>True</DesignTime> | |||
<AutoGen>True</AutoGen> | |||
<DependentUpon>JT809SubPackageExtensionsTemplate.tt</DependentUpon> | |||
</Compile> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Update="Extensions\JT809PackageExtensionsTemplate.tt"> | |||
<Generator>TextTemplatingFileGenerator</Generator> | |||
<LastGenOutput>JT809PackageExtensionsTemplate.cs</LastGenOutput> | |||
</None> | |||
<None Update="Extensions\JT809SubPackageExtensionsTemplate.tt"> | |||
<Generator>TextTemplatingFileGenerator</Generator> | |||
<LastGenOutput>JT809SubPackageExtensionsTemplate.cs</LastGenOutput> | |||
</None> | |||
</ItemGroup> | |||
</Project> |
@@ -6,6 +6,7 @@ | |||
<Description>JT809协议、GB809协议、道路运输车辆卫星定位系统-平台数据交换协议(支持2011、2019版本) </Description> | |||
<PackageReleaseNotes>JT809协议、GB809协议、道路运输车辆卫星定位系统-平台数据交换协议(支持2011、2019版本) </PackageReleaseNotes> | |||
<DocumentationFile>JT809.Protocol.xml</DocumentationFile> | |||
<NoWarn>1701;1702;1591</NoWarn> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'"> | |||
@@ -33,6 +34,7 @@ | |||
<Pack>True</Pack> | |||
<PackagePath></PackagePath> | |||
</None> | |||
<None Include="..\.editorconfig" Link=".editorconfig" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -89,21 +89,21 @@ | |||
<summary> | |||
获取DescriptionAttribute特性枚举及描述 | |||
</summary> | |||
<param name="type"></param> | |||
<param name="value"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:JT809.Protocol.Extensions.JT809EnumExtensions.GetDisplayName(System.Enum)"> | |||
<summary> | |||
获取DisplayNameAttribute特性枚举值的描述 | |||
</summary> | |||
<param name="obj">枚举值</param> | |||
<param name="value">枚举值</param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:JT809.Protocol.Extensions.JT809EnumExtensions.GetDisplayNameAttributeDictionary(System.Enum)"> | |||
<summary> | |||
获取DisplayNameAttribute特性枚举及描述 | |||
</summary> | |||
<param name="type"></param> | |||
<param name="value"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:JT809.Protocol.Extensions.JT809EnumExtensions.GetAttribute``1(System.Enum)"> | |||
@@ -134,7 +134,6 @@ | |||
16进制字符串转16进制数组 | |||
</summary> | |||
<param name="hexString"></param> | |||
<param name="separator"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="T:JT809.Protocol.Extensions.JT809MessagePackFormatterResolverExtensions"> | |||
@@ -17,7 +17,7 @@ namespace JT809.Protocol.MessageBody | |||
/// <para>业务数据类型标识:UP_EXG_MSG</para> | |||
/// <para>描述:下级平台向上级平台发送车辆动态信息交换业务数据包</para> | |||
/// </summary> | |||
public class JT809_0x1200: JT809ExchangeMessageBodies, IJT809MessagePackFormatter<JT809_0x1200>, IJT809Analyze | |||
public class JT809_0x1200 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter<JT809_0x1200>, IJT809Analyze | |||
{ | |||
public override ushort MsgId => JT809BusinessType.主链路车辆动态信息交换业务.ToUInt16Value(); | |||
public override string Description => "主链路车辆动态信息交换业务"; | |||
@@ -128,7 +128,7 @@ namespace JT809.Protocol.MessageBody | |||
writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); | |||
} | |||
} | |||
catch(Exception ex) | |||
catch | |||
{ | |||
throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); | |||
} | |||
@@ -34,15 +34,15 @@ namespace JT809.Protocol.MessagePack | |||
/// 解码(转义还原),计算校验和 | |||
/// </summary> | |||
/// <param name="buffer"></param> | |||
public JT809MessagePackReader(ReadOnlySpan<byte> srcBuffer) | |||
public JT809MessagePackReader(ReadOnlySpan<byte> buffer) | |||
{ | |||
SrcBuffer = srcBuffer; | |||
SrcBuffer = buffer; | |||
ReaderCount = 0; | |||
_realCheckCRCCode = 0x00; | |||
_calculateCheckCRCCode = 0xFFFF; | |||
_checkCRCCodeVali = false; | |||
_decoded = false; | |||
Reader = srcBuffer; | |||
Reader = buffer; | |||
} | |||
/// <summary> | |||
/// 在解码的时候把校验和也计算出来,避免在循环一次进行校验 | |||
@@ -319,18 +319,18 @@ namespace JT809.Protocol.MessagePack | |||
/// yyMMddHHmmss | |||
/// </summary> | |||
/// <param name="fromBase">>D2: 10 X2:16</param> | |||
public DateTime ReadDateTime6(string format = "X2") | |||
public DateTime ReadDateTime6(string fromBase = "X2") | |||
{ | |||
DateTime d; | |||
try | |||
{ | |||
var readOnlySpan = GetReadOnlySpan(6); | |||
int year = Convert.ToInt32(readOnlySpan[0].ToString(format)) + JT809Constants.DateLimitYear; | |||
int month = Convert.ToInt32(readOnlySpan[1].ToString(format)); | |||
int day = Convert.ToInt32(readOnlySpan[2].ToString(format)); | |||
int hour = Convert.ToInt32(readOnlySpan[3].ToString(format)); | |||
int minute = Convert.ToInt32(readOnlySpan[4].ToString(format)); | |||
int second = Convert.ToInt32(readOnlySpan[5].ToString(format)); | |||
int year = Convert.ToInt32(readOnlySpan[0].ToString(fromBase)) + JT809Constants.DateLimitYear; | |||
int month = Convert.ToInt32(readOnlySpan[1].ToString(fromBase)); | |||
int day = Convert.ToInt32(readOnlySpan[2].ToString(fromBase)); | |||
int hour = Convert.ToInt32(readOnlySpan[3].ToString(fromBase)); | |||
int minute = Convert.ToInt32(readOnlySpan[4].ToString(fromBase)); | |||
int second = Convert.ToInt32(readOnlySpan[5].ToString(fromBase)); | |||
d = new DateTime(year, month, day, hour, minute, second); | |||
} | |||
catch (Exception) | |||
@@ -48,7 +48,7 @@ namespace JT809.Protocol.SubMessageBody | |||
try | |||
{ | |||
writer.WriteStartObject(); | |||
config.GetMessagePackFormatter<JT809_0x1200_0x1202>().Analyze(ref reader,writer, config); | |||
config.GetMessagePackFormatter<JT809_0x1200_0x1202>().Analyze(ref reader, writer, config); | |||
writer.WriteEndObject(); | |||
} | |||
catch (Exception) | |||
@@ -92,7 +92,7 @@ namespace JT809.Protocol.SubMessageBody | |||
{ | |||
item.Serialize(ref writer, item, config); | |||
} | |||
catch (Exception ex) | |||
catch | |||
{ | |||
} | |||
@@ -86,7 +86,7 @@ namespace JT809.Protocol.SubMessageBody | |||
{ | |||
item.Serialize(ref writer, item, config); | |||
} | |||
catch (Exception ex) | |||
catch | |||
{ | |||
} | |||