@@ -5,7 +5,7 @@ JTActiveSafety协议、道路运输车辆主动安全智能防控系统-主动 | |||||
1. 设备终端到平台的通信也就是JT808 | 1. 设备终端到平台的通信也就是JT808 | ||||
2. 设备终端上传的附件数据也就是附件服务器 | 2. 设备终端上传的附件数据也就是附件服务器 | ||||
[](https://github.com/SmallChi/JTActiveSafety/blob/master/LICENSE)[]() | |||||
[](https://github.com/SmallChi/JTActiveSafety/blob/master/LICENSE) | |||||
## 基于JT808扩展的JTActiveSafety消息协议 | ## 基于JT808扩展的JTActiveSafety消息协议 | ||||
@@ -8,7 +8,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.1" /> | <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.1" /> | ||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> | |||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> | |||||
<PackageReference Include="xunit" Version="2.4.1" /> | <PackageReference Include="xunit" Version="2.4.1" /> | ||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> | ||||
<PrivateAssets>all</PrivateAssets> | <PrivateAssets>all</PrivateAssets> | ||||
@@ -1,4 +1,5 @@ | |||||
using JT808.Protocol.Extensions.JTActiveSafety.MessageBody; | using JT808.Protocol.Extensions.JTActiveSafety.MessageBody; | ||||
using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | |||||
using JT808.Protocol.MessageBody; | using JT808.Protocol.MessageBody; | ||||
using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||
using System; | using System; | ||||
@@ -19,61 +20,89 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
IJT808Config jT808Config = serviceDescriptors.BuildServiceProvider().GetRequiredService<IJT808Config>(); | IJT808Config jT808Config = serviceDescriptors.BuildServiceProvider().GetRequiredService<IJT808Config>(); | ||||
JT808Serializer = new JT808Serializer(jT808Config); | JT808Serializer = new JT808Serializer(jT808Config); | ||||
} | } | ||||
[Fact] | [Fact] | ||||
public void Serializer() | |||||
public void Test_0xF7_1() | |||||
{ | { | ||||
JT808_JTActiveSafety_0x0900 jT808UploadLocationRequest = new JT808_JTActiveSafety_0x0900 | |||||
JT808_0x0900_0xF7 jT808_0x0900_0xF7 = new JT808_0x0900_0xF7 | |||||
{ | { | ||||
USBMessageCount=2, | |||||
USBMessages=new List<JT808_JTActiveSafety_0x0900_USBMessage> { | |||||
new JT808_JTActiveSafety_0x0900_USBMessage{ | |||||
USBID=1, | |||||
MessageContentObejct=new JT808_JTActiveSafety_0x0900_USB_0xF7{ | |||||
AlarmStatus=1, | |||||
WorkingCondition=2 | |||||
} | |||||
}, | |||||
new JT808_JTActiveSafety_0x0900_USBMessage{ | |||||
USBID=2, | |||||
MessageContentObejct=new JT808_JTActiveSafety_0x0900_USB_0xF8{ | |||||
CompantName="CompantName", | |||||
CustomerCode="CustomerCode", | |||||
DevicesID="DevicesID", | |||||
HardwareVersionNumber="HardwareVersionNumber", | |||||
ProductModel="ProductModel", | |||||
SoftwareVersionNumber="SoftwareVersionNumber" | |||||
} | |||||
} | |||||
USBMessageCount = 2, | |||||
USBMessages = new List<JT808_0x0900_0xF7_USB> { | |||||
new JT808_0x0900_0xF7_USB { | |||||
USBID = 1, | |||||
AlarmStatus = 1, | |||||
WorkingCondition = 2 | |||||
}, | |||||
new JT808_0x0900_0xF7_USB { | |||||
USBID = 2, | |||||
AlarmStatus = 1, | |||||
WorkingCondition = 2 | |||||
} | |||||
} | } | ||||
}; | }; | ||||
var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); | |||||
Assert.Equal("0201050200000001025C0B436F6D70616E744E616D650C50726F647563744D6F64656C15486172647761726556657273696F6E4E756D62657215536F66747761726556657273696F6E4E756D626572094465766963657349440C437573746F6D6572436F6465", hex); | |||||
var hex = JT808Serializer.Serialize(jT808_0x0900_0xF7).ToHexString(); | |||||
Assert.Equal("020105020000000102050200000001", hex); | |||||
} | } | ||||
[Fact] | [Fact] | ||||
public void Deserialize() | |||||
public void Test_0xF7_2() | |||||
{ | { | ||||
var jT808UploadLocationRequest = JT808Serializer.Deserialize<JT808_JTActiveSafety_0x0900>("0201050200000001025C0B436F6D70616E744E616D650C50726F647563744D6F64656C15486172647761726556657273696F6E4E756D62657215536F66747761726556657273696F6E4E756D626572094465766963657349440C437573746F6D6572436F6465".ToHexBytes()); | |||||
Assert.Equal(2, jT808UploadLocationRequest.USBMessageCount); | |||||
var jT808_0x0900_0xF7 = JT808Serializer.Deserialize<JT808_0x0900_0xF7>("020105020000000102050200000001".ToHexBytes()); | |||||
Assert.Equal(1, jT808UploadLocationRequest.USBMessages[0].USBID); | |||||
JT808_JTActiveSafety_0x0900_USB_0xF7 jT808_JTActiveSafety_0X0900_USB_0XF7 = JT808Serializer.Deserialize< JT808_JTActiveSafety_0x0900_USB_0xF7 >(jT808UploadLocationRequest.USBMessages[0].MessageContent) ; | |||||
Assert.Equal(1u, jT808_JTActiveSafety_0X0900_USB_0XF7.AlarmStatus); | |||||
Assert.Equal(2, jT808_JTActiveSafety_0X0900_USB_0XF7.WorkingCondition); | |||||
Assert.Equal(JT808_JTActiveSafety_Constants.JT808_0X0900_0xF7, jT808_0x0900_0xF7.PassthroughType); | |||||
Assert.Equal(2, jT808_0x0900_0xF7.USBMessageCount); | |||||
Assert.Equal(1, jT808_0x0900_0xF7.USBMessages[0].USBID); | |||||
Assert.Equal(5, jT808_0x0900_0xF7.USBMessages[0].MessageLength); | |||||
Assert.Equal(2, jT808_0x0900_0xF7.USBMessages[0].WorkingCondition); | |||||
Assert.Equal(1u, jT808_0x0900_0xF7.USBMessages[0].AlarmStatus); | |||||
Assert.Equal(2, jT808_0x0900_0xF7.USBMessages[1].USBID); | |||||
Assert.Equal(5, jT808_0x0900_0xF7.USBMessages[1].MessageLength); | |||||
Assert.Equal(2, jT808_0x0900_0xF7.USBMessages[1].WorkingCondition); | |||||
Assert.Equal(1u, jT808_0x0900_0xF7.USBMessages[1].AlarmStatus); | |||||
} | |||||
Assert.Equal(2, jT808UploadLocationRequest.USBMessages[1].USBID); | |||||
JT808_JTActiveSafety_0x0900_USB_0xF8 jT808_JTActiveSafety_0X0900_USB_0XF8 = JT808Serializer.Deserialize<JT808_JTActiveSafety_0x0900_USB_0xF8>(jT808UploadLocationRequest.USBMessages[1].MessageContent); ; | |||||
Assert.Equal("CompantName", jT808_JTActiveSafety_0X0900_USB_0XF8.CompantName); | |||||
Assert.Equal("CompantName".Length, jT808_JTActiveSafety_0X0900_USB_0XF8.CompantNameLength); | |||||
Assert.Equal("CustomerCode", jT808_JTActiveSafety_0X0900_USB_0XF8.CustomerCode); | |||||
Assert.Equal("CustomerCode".Length, jT808_JTActiveSafety_0X0900_USB_0XF8.CustomerCodeLength); | |||||
Assert.Equal("DevicesID", jT808_JTActiveSafety_0X0900_USB_0XF8.DevicesID); | |||||
Assert.Equal("DevicesID".Length, jT808_JTActiveSafety_0X0900_USB_0XF8.DevicesIDLength); | |||||
Assert.Equal("HardwareVersionNumber", jT808_JTActiveSafety_0X0900_USB_0XF8.HardwareVersionNumber); | |||||
Assert.Equal("HardwareVersionNumber".Length, jT808_JTActiveSafety_0X0900_USB_0XF8.HardwareVersionNumberLength); | |||||
Assert.Equal("ProductModel", jT808_JTActiveSafety_0X0900_USB_0XF8.ProductModel); | |||||
Assert.Equal("ProductModel".Length, jT808_JTActiveSafety_0X0900_USB_0XF8.ProductModelLength); | |||||
Assert.Equal("SoftwareVersionNumber", jT808_JTActiveSafety_0X0900_USB_0XF8.SoftwareVersionNumber); | |||||
Assert.Equal("SoftwareVersionNumber".Length, jT808_JTActiveSafety_0X0900_USB_0XF8.SoftwareVersionNumberLength); | |||||
[Fact] | |||||
public void Test_0xF8_1() | |||||
{ | |||||
JT808_0x0900_0xF8 jT808_0x0900_0xF8 = new JT808_0x0900_0xF8 | |||||
{ | |||||
USBMessageCount = 1, | |||||
USBMessages = new List<JT808_0x0900_0xF8_USB> { | |||||
new JT808_0x0900_0xF8_USB { | |||||
USBID = 1, | |||||
CompantName = "CompantName", | |||||
CustomerCode = "CustomerCode", | |||||
DevicesID = "DevicesID", | |||||
HardwareVersionNumber = "HardwareVersionNumber", | |||||
ProductModel = "ProductModel", | |||||
SoftwareVersionNumber = "SoftwareVersionNumber" | |||||
} | |||||
} | |||||
}; | |||||
var hex = JT808Serializer.Serialize(jT808_0x0900_0xF8).ToHexString(); | |||||
Assert.Equal("01015C0B436F6D70616E744E616D650C50726F647563744D6F64656C15486172647761726556657273696F6E4E756D62657215536F66747761726556657273696F6E4E756D626572094465766963657349440C437573746F6D6572436F6465", hex); | |||||
} | |||||
[Fact] | |||||
public void Test_0xF8_2() | |||||
{ | |||||
var jT808_0x0900_0xF8 = JT808Serializer.Deserialize<JT808_0x0900_0xF8>("01015C0B436F6D70616E744E616D650C50726F647563744D6F64656C15486172647761726556657273696F6E4E756D62657215536F66747761726556657273696F6E4E756D626572094465766963657349440C437573746F6D6572436F6465".ToHexBytes()); | |||||
Assert.Equal(JT808_JTActiveSafety_Constants.JT808_0X0900_0xF8, jT808_0x0900_0xF8.PassthroughType); | |||||
Assert.Equal(1, jT808_0x0900_0xF8.USBMessageCount); | |||||
Assert.Equal(1, jT808_0x0900_0xF8.USBMessages[0].USBID); | |||||
Assert.Equal("CompantName", jT808_0x0900_0xF8.USBMessages[0].CompantName); | |||||
Assert.Equal("CompantName".Length, jT808_0x0900_0xF8.USBMessages[0].CompantNameLength); | |||||
Assert.Equal("CustomerCode", jT808_0x0900_0xF8.USBMessages[0].CustomerCode); | |||||
Assert.Equal("CustomerCode".Length, jT808_0x0900_0xF8.USBMessages[0].CustomerCodeLength); | |||||
Assert.Equal("DevicesID", jT808_0x0900_0xF8.USBMessages[0].DevicesID); | |||||
Assert.Equal("DevicesID".Length, jT808_0x0900_0xF8.USBMessages[0].DevicesIDLength); | |||||
Assert.Equal("HardwareVersionNumber", jT808_0x0900_0xF8.USBMessages[0].HardwareVersionNumber); | |||||
Assert.Equal("HardwareVersionNumber".Length, jT808_0x0900_0xF8.USBMessages[0].HardwareVersionNumberLength); | |||||
Assert.Equal("ProductModel", jT808_0x0900_0xF8.USBMessages[0].ProductModel); | |||||
Assert.Equal("ProductModel".Length, jT808_0x0900_0xF8.USBMessages[0].ProductModelLength); | |||||
Assert.Equal("SoftwareVersionNumber", jT808_0x0900_0xF8.USBMessages[0].SoftwareVersionNumber); | |||||
Assert.Equal("SoftwareVersionNumber".Length, jT808_0x0900_0xF8.USBMessages[0].SoftwareVersionNumberLength); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -22,7 +22,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
[Fact] | [Fact] | ||||
public void Serializer() | public void Serializer() | ||||
{ | { | ||||
JT808_JTActiveSafety_0x8900 jT808UploadLocationRequest = new JT808_JTActiveSafety_0x8900 | |||||
JT808_0x8900_0xF7 jT808UploadLocationRequest = new JT808_0x8900_0xF7 | |||||
{ | { | ||||
USBCount=2, | USBCount=2, | ||||
MultipleUSB=new List<byte> {1,2 } | MultipleUSB=new List<byte> {1,2 } | ||||
@@ -33,7 +33,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Test | |||||
[Fact] | [Fact] | ||||
public void Deserialize() | public void Deserialize() | ||||
{ | { | ||||
var jT808UploadLocationRequest = JT808Serializer.Deserialize<JT808_JTActiveSafety_0x8900>("020102".ToHexBytes()); | |||||
var jT808UploadLocationRequest = JT808Serializer.Deserialize<JT808_0x8900_0xF7>("020102".ToHexBytes()); | |||||
Assert.Equal(2, jT808UploadLocationRequest.USBCount); | Assert.Equal(2, jT808UploadLocationRequest.USBCount); | ||||
Assert.Equal(new List<byte> { 1, 2 }.ToArray().ToHexString(), jT808UploadLocationRequest.MultipleUSB.ToArray().ToHexString()); | Assert.Equal(new List<byte> { 1, 2 }.ToArray().ToHexString(), jT808UploadLocationRequest.MultipleUSB.ToArray().ToHexString()); | ||||
} | } | ||||
@@ -6,9 +6,21 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.Enums | |||||
{ | { | ||||
public enum USBIDType:byte | public enum USBIDType:byte | ||||
{ | { | ||||
ADAS=0x64, | |||||
DSM=0x65, | |||||
TPMS=0x66, | |||||
BSD=0x67 | |||||
/// <summary> | |||||
/// 高级驾驶辅助系统 | |||||
/// </summary> | |||||
ADAS = 0x64, | |||||
/// <summary> | |||||
/// 驾驶员状态监控系统 | |||||
/// </summary> | |||||
DSM = 0x65, | |||||
/// <summary> | |||||
/// 轮胎气压监测系统 | |||||
/// </summary> | |||||
TPMS = 0x66, | |||||
/// <summary> | |||||
/// 盲点监测系统 | |||||
/// </summary> | |||||
BSD = 0x67 | |||||
} | } | ||||
} | } |
@@ -1,30 +0,0 @@ | |||||
using JT808.Protocol.Extensions.JTActiveSafety.Enums; | |||||
using JT808.Protocol.Extensions.JTActiveSafety.MessageBody; | |||||
using JT808.Protocol.MessagePack; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.Extensions | |||||
{ | |||||
#warning 由于透传消息类型没有向下传递导致下面获取不到,先用这种方式临时处理 | |||||
public static class JT808_JTActiveSafety_0x0900_USBMessageExtensions | |||||
{ | |||||
/// <summary> | |||||
/// 解析透传对象扩展 | |||||
/// </summary> | |||||
/// <param name="jT808_JTActiveSafety_0X0900_USBMessage"></param> | |||||
/// <param name="jT808_JTActiveSafety_0X0900_Type"></param> | |||||
public static void ParseObject(this JT808_JTActiveSafety_0x0900_USBMessage jT808_JTActiveSafety_0X0900_USBMessage, JT808_JTActiveSafety_0x0900_Type jT808_JTActiveSafety_0X0900_Type) | |||||
{ | |||||
switch(jT808_JTActiveSafety_0X0900_Type) | |||||
{ | |||||
case JT808_JTActiveSafety_0x0900_Type.QueryState: | |||||
JT808MessagePackReader QueryStateMessagePackReader = new JT808MessagePackReader(jT808_JTActiveSafety_0X0900_USBMessage.MessageContent); | |||||
jT808_JTActiveSafety_0X0900_USBMessage.MessageContentObejct= JT808_JTActiveSafety_0x0900_USB_0xF7.Instance.Deserialize(ref QueryStateMessagePackReader, null); | |||||
break; | |||||
case JT808_JTActiveSafety_0x0900_Type.QueryInfomation: | |||||
JT808MessagePackReader QueryInfomationMessagePackReader = new JT808MessagePackReader(jT808_JTActiveSafety_0X0900_USBMessage.MessageContent); | |||||
jT808_JTActiveSafety_0X0900_USBMessage.MessageContentObejct = JT808_JTActiveSafety_0x0900_USB_0xF7.Instance.Deserialize(ref QueryInfomationMessagePackReader, null); | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -19,6 +19,14 @@ | |||||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | <PackageLicenseFile>LICENSE</PackageLicenseFile> | ||||
</PropertyGroup> | </PropertyGroup> | ||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'"> | |||||
<DocumentationFile>JT808.Protocol.Extensions.JTActiveSafety.xml</DocumentationFile> | |||||
</PropertyGroup> | |||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'"> | |||||
<DocumentationFile>JT808.Protocol.Extensions.JTActiveSafety.xml</DocumentationFile> | |||||
</PropertyGroup> | |||||
<ItemGroup> | <ItemGroup> | ||||
<None Include="..\..\LICENSE"> | <None Include="..\..\LICENSE"> | ||||
<Pack>True</Pack> | <Pack>True</Pack> | ||||
@@ -27,7 +35,7 @@ | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="JT808" Version="2.2.6" /> | |||||
<PackageReference Include="JT808" Version="2.2.7" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
@@ -38,5 +38,13 @@ namespace JT808.Protocol.Extensions.JTActiveSafety | |||||
/// 盲区监测系统参数设置 | /// 盲区监测系统参数设置 | ||||
/// </summary> | /// </summary> | ||||
public const uint JT808_0X8103_0xF367 = 0xF367; | public const uint JT808_0X8103_0xF367 = 0xF367; | ||||
/// <summary> | |||||
/// 状态查询 | |||||
/// </summary> | |||||
public const byte JT808_0X0900_0xF7 = 0xF7; | |||||
/// <summary> | |||||
/// 信息查询 | |||||
/// </summary> | |||||
public const byte JT808_0X0900_0xF8 = 0xF8; | |||||
} | } | ||||
} | } |
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x0200_0x64 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x64> | public class JT808_0x0200_0x64 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x64> | ||||
{ | { | ||||
public override byte AttachInfoId { get; set; } = 0x64; | |||||
public override byte AttachInfoId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0200_0x64; | |||||
public override byte AttachInfoLength { get; set; } = 32; | public override byte AttachInfoLength { get; set; } = 32; | ||||
/// <summary> | /// <summary> | ||||
/// 报警ID | /// 报警ID | ||||
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x0200_0x65 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x65> | public class JT808_0x0200_0x65 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x65> | ||||
{ | { | ||||
public override byte AttachInfoId { get; set; } = 0x65; | |||||
public override byte AttachInfoId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0200_0x65; | |||||
public override byte AttachInfoLength { get; set; } = 32; | public override byte AttachInfoLength { get; set; } = 32; | ||||
/// <summary> | /// <summary> | ||||
/// 报警ID | /// 报警ID | ||||
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x0200_0x66 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x66> | public class JT808_0x0200_0x66 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x66> | ||||
{ | { | ||||
public override byte AttachInfoId { get; set; } = 0x66; | |||||
public override byte AttachInfoId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0200_0x66; | |||||
public override byte AttachInfoLength { get; set; } | public override byte AttachInfoLength { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 报警ID | /// 报警ID | ||||
@@ -13,7 +13,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x0200_0x67 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x67> | public class JT808_0x0200_0x67 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x67> | ||||
{ | { | ||||
public override byte AttachInfoId { get; set; } = 0x67; | |||||
public override byte AttachInfoId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0200_0x67; | |||||
public override byte AttachInfoLength { get; set; } = 26; | public override byte AttachInfoLength { get; set; } = 26; | ||||
/// <summary> | /// <summary> | ||||
/// 报警ID | /// 报警ID | ||||
@@ -0,0 +1,56 @@ | |||||
using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.MessageBody; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
{ | |||||
public class JT808_0x0900_0xF7 : JT808_0x0900_BodyBase, IJT808MessagePackFormatter<JT808_0x0900_0xF7> | |||||
{ | |||||
public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF7; | |||||
/// <summary> | |||||
/// 消息列表总数 | |||||
/// </summary> | |||||
public byte USBMessageCount { get; set; } | |||||
public List<JT808_0x0900_0xF7_USB> USBMessages { get; set; } | |||||
public JT808_0x0900_0xF7 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_0x0900_0xF7 value = new JT808_0x0900_0xF7(); | |||||
value.USBMessageCount = reader.ReadByte(); | |||||
if (value.USBMessageCount > 0) | |||||
{ | |||||
value.USBMessages = new List<JT808_0x0900_0xF7_USB>(); | |||||
for (int i = 0; i < value.USBMessageCount; i++) | |||||
{ | |||||
JT808_0x0900_0xF7_USB item = new JT808_0x0900_0xF7_USB(); | |||||
item.USBID = reader.ReadByte(); | |||||
item.MessageLength = reader.ReadByte(); | |||||
item.WorkingCondition = reader.ReadByte(); | |||||
item.AlarmStatus = reader.ReadUInt32(); | |||||
value.USBMessages.Add(item); | |||||
} | |||||
} | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0900_0xF7 value, IJT808Config config) | |||||
{ | |||||
if (value.USBMessages != null && value.USBMessages.Count > 0) | |||||
{ | |||||
writer.WriteByte((byte)value.USBMessages.Count); | |||||
foreach (var item in value.USBMessages) | |||||
{ | |||||
writer.WriteByte(item.USBID); | |||||
writer.WriteByte(5); | |||||
writer.WriteByte(item.WorkingCondition); | |||||
writer.WriteUInt32(item.AlarmStatus); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,88 @@ | |||||
using JT808.Protocol.Extensions.JTActiveSafety.Metadata; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.MessageBody; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
{ | |||||
public class JT808_0x0900_0xF8 : JT808_0x0900_BodyBase, IJT808MessagePackFormatter<JT808_0x0900_0xF8> | |||||
{ | |||||
public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF8; | |||||
/// <summary> | |||||
/// 消息列表总数 | |||||
/// </summary> | |||||
public byte USBMessageCount { get; set; } | |||||
public List<JT808_0x0900_0xF8_USB> USBMessages { get; set; } | |||||
public JT808_0x0900_0xF8 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_0x0900_0xF8 value = new JT808_0x0900_0xF8(); | |||||
value.USBMessageCount = reader.ReadByte(); | |||||
if (value.USBMessageCount > 0) | |||||
{ | |||||
value.USBMessages = new List<JT808_0x0900_0xF8_USB>(); | |||||
for (int i = 0; i < value.USBMessageCount; i++) | |||||
{ | |||||
JT808_0x0900_0xF8_USB item = new JT808_0x0900_0xF8_USB(); | |||||
item.USBID = reader.ReadByte(); | |||||
item.MessageLength = reader.ReadByte(); | |||||
item.CompantNameLength = reader.ReadByte(); | |||||
item.CompantName = reader.ReadString(item.CompantNameLength); | |||||
item.ProductModelLength = reader.ReadByte(); | |||||
item.ProductModel = reader.ReadString(item.ProductModelLength); | |||||
item.HardwareVersionNumberLength = reader.ReadByte(); | |||||
item.HardwareVersionNumber = reader.ReadString(item.HardwareVersionNumberLength); | |||||
item.SoftwareVersionNumberLength = reader.ReadByte(); | |||||
item.SoftwareVersionNumber = reader.ReadString(item.SoftwareVersionNumberLength); | |||||
item.DevicesIDLength = reader.ReadByte(); | |||||
item.DevicesID = reader.ReadString(item.DevicesIDLength); | |||||
item.CustomerCodeLength = reader.ReadByte(); | |||||
item.CustomerCode = reader.ReadString(item.CustomerCodeLength); | |||||
value.USBMessages.Add(item); | |||||
} | |||||
} | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0900_0xF8 value, IJT808Config config) | |||||
{ | |||||
if (value.USBMessages != null && value.USBMessages.Count > 0) | |||||
{ | |||||
writer.WriteByte((byte)value.USBMessages.Count); | |||||
foreach (var item in value.USBMessages) | |||||
{ | |||||
writer.WriteByte(item.USBID); | |||||
writer.Skip(1,out int messageLengthPosition); | |||||
writer.Skip(1, out int CompantNameLengthPosition); | |||||
writer.WriteString(item.CompantName); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - CompantNameLengthPosition - 1), CompantNameLengthPosition); | |||||
writer.Skip(1, out int ProductModelLengthPosition); | |||||
writer.WriteString(item.ProductModel); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - ProductModelLengthPosition - 1), ProductModelLengthPosition); | |||||
writer.Skip(1, out int HardwareVersionNumberLengthPosition); | |||||
writer.WriteString(item.HardwareVersionNumber); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - HardwareVersionNumberLengthPosition - 1), HardwareVersionNumberLengthPosition); | |||||
writer.Skip(1, out int SoftwareVersionNumberLengthPosition); | |||||
writer.WriteString(item.SoftwareVersionNumber); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - SoftwareVersionNumberLengthPosition - 1), SoftwareVersionNumberLengthPosition); | |||||
writer.Skip(1, out int DevicesIDLengthPosition); | |||||
writer.WriteString(item.DevicesID); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - DevicesIDLengthPosition - 1), DevicesIDLengthPosition); | |||||
writer.Skip(1, out int CustomerCodeLengthPosition); | |||||
writer.WriteString(item.CustomerCode); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - CustomerCodeLengthPosition - 1), CustomerCodeLengthPosition); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - messageLengthPosition - 1), messageLengthPosition); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -9,7 +9,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8103_0xF364 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF364> | public class JT808_0x8103_0xF364 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF364> | ||||
{ | { | ||||
public override uint ParamId { get; set; } = 0xF364; | |||||
public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF364; | |||||
public override byte ParamLength { get; set; } | public override byte ParamLength { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 报警判断速度阈值 | /// 报警判断速度阈值 | ||||
@@ -9,7 +9,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8103_0xF365 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF365> | public class JT808_0x8103_0xF365 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF365> | ||||
{ | { | ||||
public override uint ParamId { get; set; } = 0xF365; | |||||
public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF365; | |||||
public override byte ParamLength { get; set; } | public override byte ParamLength { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 报警判断速度阈值 | /// 报警判断速度阈值 | ||||
@@ -9,7 +9,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8103_0xF366 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF366> | public class JT808_0x8103_0xF366 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF366> | ||||
{ | { | ||||
public override uint ParamId { get; set; } = 0xF366; | |||||
public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF366; | |||||
public override byte ParamLength { get; set; } = 46; | public override byte ParamLength { get; set; } = 46; | ||||
/// <summary> | /// <summary> | ||||
/// 轮胎规格型号 12位 | /// 轮胎规格型号 12位 | ||||
@@ -9,7 +9,7 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public class JT808_0x8103_0xF367 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF367> | public class JT808_0x8103_0xF367 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter<JT808_0x8103_0xF367> | ||||
{ | { | ||||
public override uint ParamId { get; set; } = 0xF367; | |||||
public override uint ParamId { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X8103_0xF367; | |||||
public override byte ParamLength { get; set; } = 2; | public override byte ParamLength { get; set; } = 2; | ||||
/// <summary> | /// <summary> | ||||
/// 后方接近报警时间阈值 | /// 后方接近报警时间阈值 | ||||
@@ -8,8 +8,9 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// <summary> | /// <summary> | ||||
/// 查询基本信息 | /// 查询基本信息 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_JTActiveSafety_0x8900: JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_JTActiveSafety_0x8900> | |||||
public class JT808_0x8900_0xF7 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF7> | |||||
{ | { | ||||
public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF7; | |||||
/// <summary> | /// <summary> | ||||
/// 外设ID列表总数 | /// 外设ID列表总数 | ||||
/// </summary> | /// </summary> | ||||
@@ -19,22 +20,22 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public List<byte> MultipleUSB { get; set; } | public List<byte> MultipleUSB { get; set; } | ||||
public JT808_JTActiveSafety_0x8900 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
public JT808_0x8900_0xF7 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | { | ||||
JT808_JTActiveSafety_0x8900 jT808_JTActiveSafety_0X8900 = new JT808_JTActiveSafety_0x8900(); | |||||
jT808_JTActiveSafety_0X8900.USBCount = reader.ReadByte(); | |||||
if (jT808_JTActiveSafety_0X8900.USBCount > 0) | |||||
JT808_0x8900_0xF7 value = new JT808_0x8900_0xF7(); | |||||
value.USBCount = reader.ReadByte(); | |||||
if (value.USBCount > 0) | |||||
{ | { | ||||
jT808_JTActiveSafety_0X8900.MultipleUSB = new List<byte>(); | |||||
for (int i = 0; i < jT808_JTActiveSafety_0X8900.USBCount; i++) | |||||
value.MultipleUSB = new List<byte>(); | |||||
for (int i = 0; i < value.USBCount; i++) | |||||
{ | { | ||||
jT808_JTActiveSafety_0X8900.MultipleUSB.Add(reader.ReadByte()); | |||||
value.MultipleUSB.Add(reader.ReadByte()); | |||||
} | } | ||||
} | } | ||||
return jT808_JTActiveSafety_0X8900; | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_JTActiveSafety_0x8900 value, IJT808Config config) | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8900_0xF7 value, IJT808Config config) | |||||
{ | { | ||||
if (value.MultipleUSB != null && value.MultipleUSB.Count > 0) | if (value.MultipleUSB != null && value.MultipleUSB.Count > 0) | ||||
{ | { |
@@ -0,0 +1,50 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.MessageBody; | |||||
using JT808.Protocol.MessagePack; | |||||
using System.Collections.Generic; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 查询基本信息 | |||||
/// </summary> | |||||
public class JT808_0x8900_0xF8 : JT808_0x8900_BodyBase, IJT808MessagePackFormatter<JT808_0x8900_0xF8> | |||||
{ | |||||
public override byte PassthroughType { get; set; } = JT808_JTActiveSafety_Constants.JT808_0X0900_0xF8; | |||||
/// <summary> | |||||
/// 外设ID列表总数 | |||||
/// </summary> | |||||
public byte USBCount { get; set; } | |||||
/// <summary> | |||||
/// 外设ID | |||||
/// </summary> | |||||
public List<byte> MultipleUSB { get; set; } | |||||
public JT808_0x8900_0xF8 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_0x8900_0xF8 value = new JT808_0x8900_0xF8(); | |||||
value.USBCount = reader.ReadByte(); | |||||
if (value.USBCount > 0) | |||||
{ | |||||
value.MultipleUSB = new List<byte>(); | |||||
for (int i = 0; i < value.USBCount; i++) | |||||
{ | |||||
value.MultipleUSB.Add(reader.ReadByte()); | |||||
} | |||||
} | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8900_0xF8 value, IJT808Config config) | |||||
{ | |||||
if (value.MultipleUSB != null && value.MultipleUSB.Count > 0) | |||||
{ | |||||
writer.WriteByte((byte)value.MultipleUSB.Count); | |||||
foreach (var item in value.MultipleUSB) | |||||
{ | |||||
writer.WriteByte(item); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -1,63 +0,0 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.MessageBody; | |||||
using JT808.Protocol.MessagePack; | |||||
using System.Collections.Generic; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 上传基本信息 | |||||
/// </summary> | |||||
public class JT808_JTActiveSafety_0x0900 : JT808_0x0900_BodyBase, IJT808MessagePackFormatter<JT808_JTActiveSafety_0x0900> | |||||
{ | |||||
/// <summary> | |||||
/// 消息列表总数 | |||||
/// </summary> | |||||
public byte USBMessageCount { get; set; } | |||||
public List<JT808_JTActiveSafety_0x0900_USBMessage> USBMessages { get; set; } | |||||
public JT808_JTActiveSafety_0x0900 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_JTActiveSafety_0x0900 jT808_JTActiveSafety_0X0900 = new JT808_JTActiveSafety_0x0900(); | |||||
jT808_JTActiveSafety_0X0900.USBMessageCount = reader.ReadByte(); | |||||
if (jT808_JTActiveSafety_0X0900.USBMessageCount > 0) | |||||
{ | |||||
jT808_JTActiveSafety_0X0900.USBMessages = new List<JT808_JTActiveSafety_0x0900_USBMessage>(); | |||||
for (int i = 0; i < jT808_JTActiveSafety_0X0900.USBMessageCount; i++) | |||||
{ | |||||
JT808_JTActiveSafety_0x0900_USBMessage jT808_JTActiveSafety_0X0900_USBMessage = new JT808_JTActiveSafety_0x0900_USBMessage(); | |||||
jT808_JTActiveSafety_0X0900_USBMessage.USBID = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USBMessage.MessageLength = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USBMessage.MessageContent = reader.ReadArray(jT808_JTActiveSafety_0X0900_USBMessage.MessageLength).ToArray(); | |||||
jT808_JTActiveSafety_0X0900.USBMessages.Add(jT808_JTActiveSafety_0X0900_USBMessage); | |||||
} | |||||
} | |||||
return jT808_JTActiveSafety_0X0900; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_JTActiveSafety_0x0900 value, IJT808Config config) | |||||
{ | |||||
if (value.USBMessages != null && value.USBMessages.Count > 0) | |||||
{ | |||||
writer.WriteByte((byte)value.USBMessages.Count); | |||||
foreach (var item in value.USBMessages) | |||||
{ | |||||
writer.WriteByte(item.USBID); | |||||
if (item.MessageContent != null && item.MessageContent.Length > 0) | |||||
{ | |||||
writer.WriteByte((byte)item.MessageContent.Length); | |||||
writer.WriteArray(item.MessageContent); | |||||
} | |||||
else if (item.MessageContentObejct != null) | |||||
{ | |||||
writer.Skip(1, out int MessageContentLengthPosition); | |||||
object obj = config.GetMessagePackFormatterByType(item.MessageContentObejct.GetType()); | |||||
JT808MessagePackFormatterResolverExtensions.JT808DynamicSerialize(obj, ref writer, item.MessageContentObejct, config); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - MessageContentLengthPosition - 1), MessageContentLengthPosition); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -1,35 +0,0 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.MessagePack; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 外设工作状态 | |||||
/// </summary> | |||||
public class JT808_JTActiveSafety_0x0900_USB_0xF7 : JT808_JTActiveSafety_0x0900_USB_Base, IJT808MessagePackFormatter<JT808_JTActiveSafety_0x0900_USB_0xF7> | |||||
{ | |||||
public static JT808_JTActiveSafety_0x0900_USB_0xF7 Instance = new JT808_JTActiveSafety_0x0900_USB_0xF7(); | |||||
/// <summary> | |||||
/// 工作状态 | |||||
/// </summary> | |||||
public byte WorkingCondition { get; set; } | |||||
/// <summary> | |||||
/// 报警状态 | |||||
/// </summary> | |||||
public uint AlarmStatus { get; set; } | |||||
public JT808_JTActiveSafety_0x0900_USB_0xF7 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_JTActiveSafety_0x0900_USB_0xF7 jT808_JTActiveSafety_0X0900_USB_0XF7 = new JT808_JTActiveSafety_0x0900_USB_0xF7(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF7.WorkingCondition = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF7.AlarmStatus = reader.ReadUInt32(); | |||||
return jT808_JTActiveSafety_0X0900_USB_0XF7; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_JTActiveSafety_0x0900_USB_0xF7 value, IJT808Config config) | |||||
{ | |||||
writer.WriteByte(value.WorkingCondition); | |||||
writer.WriteUInt32(value.AlarmStatus); | |||||
} | |||||
} | |||||
} |
@@ -1,107 +0,0 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.MessagePack; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 外设系统信息 | |||||
/// </summary> | |||||
public class JT808_JTActiveSafety_0x0900_USB_0xF8 : JT808_JTActiveSafety_0x0900_USB_Base, IJT808MessagePackFormatter<JT808_JTActiveSafety_0x0900_USB_0xF8> | |||||
{ | |||||
/// <summary> | |||||
/// 公司名称长度 | |||||
/// </summary> | |||||
public byte CompantNameLength { get; set; } | |||||
/// <summary> | |||||
/// 公司名称 | |||||
/// </summary> | |||||
public string CompantName { get; set; } | |||||
/// <summary> | |||||
/// 产品型号长度 | |||||
/// </summary> | |||||
public byte ProductModelLength { get; set; } | |||||
/// <summary> | |||||
/// 产品型号 | |||||
/// </summary> | |||||
public string ProductModel { get; set; } | |||||
/// <summary> | |||||
/// 硬件版本号长度 | |||||
/// </summary> | |||||
public byte HardwareVersionNumberLength { get; set; } | |||||
/// <summary> | |||||
/// 硬件版本号 | |||||
/// ASCII | |||||
/// </summary> | |||||
public string HardwareVersionNumber { get; set; } | |||||
/// <summary> | |||||
/// 软件版本号长度 | |||||
/// </summary> | |||||
public byte SoftwareVersionNumberLength { get; set; } | |||||
/// <summary> | |||||
/// 软件版本号 | |||||
/// ASCII | |||||
/// </summary> | |||||
public string SoftwareVersionNumber { get; set; } | |||||
/// <summary> | |||||
/// 设备ID长度 | |||||
/// </summary> | |||||
public byte DevicesIDLength { get; set; } | |||||
/// <summary> | |||||
/// 设备ID | |||||
/// </summary> | |||||
public string DevicesID { get; set; } | |||||
/// <summary> | |||||
/// 客户代码长度 | |||||
/// </summary> | |||||
public byte CustomerCodeLength { get; set; } | |||||
/// <summary> | |||||
/// 客户代码 | |||||
/// </summary> | |||||
public string CustomerCode { get; set; } | |||||
public JT808_JTActiveSafety_0x0900_USB_0xF8 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_JTActiveSafety_0x0900_USB_0xF8 jT808_JTActiveSafety_0X0900_USB_0XF8 = new JT808_JTActiveSafety_0x0900_USB_0xF8(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.CompantNameLength = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.CompantName = reader.ReadString(jT808_JTActiveSafety_0X0900_USB_0XF8.CompantNameLength); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.ProductModelLength = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.ProductModel = reader.ReadString(jT808_JTActiveSafety_0X0900_USB_0XF8.ProductModelLength); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.HardwareVersionNumberLength = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.HardwareVersionNumber = reader.ReadString(jT808_JTActiveSafety_0X0900_USB_0XF8.HardwareVersionNumberLength); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.SoftwareVersionNumberLength = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.SoftwareVersionNumber = reader.ReadString(jT808_JTActiveSafety_0X0900_USB_0XF8.SoftwareVersionNumberLength); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.DevicesIDLength = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.DevicesID = reader.ReadString(jT808_JTActiveSafety_0X0900_USB_0XF8.DevicesIDLength); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.CustomerCodeLength = reader.ReadByte(); | |||||
jT808_JTActiveSafety_0X0900_USB_0XF8.CustomerCode = reader.ReadString(jT808_JTActiveSafety_0X0900_USB_0XF8.CustomerCodeLength); | |||||
return jT808_JTActiveSafety_0X0900_USB_0XF8; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_JTActiveSafety_0x0900_USB_0xF8 value, IJT808Config config) | |||||
{ | |||||
writer.Skip(1, out int CompantNameLengthPosition); | |||||
writer.WriteString(value.CompantName); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - CompantNameLengthPosition - 1), CompantNameLengthPosition); | |||||
writer.Skip(1, out int ProductModelLengthPosition); | |||||
writer.WriteString(value.ProductModel); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - ProductModelLengthPosition - 1), ProductModelLengthPosition); | |||||
writer.Skip(1, out int HardwareVersionNumberLengthPosition); | |||||
writer.WriteString(value.HardwareVersionNumber); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - HardwareVersionNumberLengthPosition - 1), HardwareVersionNumberLengthPosition); | |||||
writer.Skip(1, out int SoftwareVersionNumberLengthPosition); | |||||
writer.WriteString(value.SoftwareVersionNumber); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - SoftwareVersionNumberLengthPosition - 1), SoftwareVersionNumberLengthPosition); | |||||
writer.Skip(1, out int DevicesIDLengthPosition); | |||||
writer.WriteString(value.DevicesID); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - DevicesIDLengthPosition - 1), DevicesIDLengthPosition); | |||||
writer.Skip(1, out int CustomerCodeLengthPosition); | |||||
writer.WriteString(value.CustomerCode); | |||||
writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - CustomerCodeLengthPosition - 1), CustomerCodeLengthPosition); | |||||
} | |||||
} | |||||
} |
@@ -1,10 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
{ | |||||
public abstract class JT808_JTActiveSafety_0x0900_USB_Base | |||||
{ | |||||
} | |||||
} |
@@ -2,15 +2,13 @@ | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.Metadata | |||||
{ | { | ||||
/// <summary> | |||||
/// 外设消息结构 | |||||
/// </summary> | |||||
public class JT808_JTActiveSafety_0x0900_USBMessage | |||||
public class JT808_0x0900_0xF7_USB | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 外设ID | /// 外设ID | ||||
/// <see cref="JT808.Protocol.Extensions.JTActiveSafety.Enums.USBIDType"/> | |||||
/// </summary> | /// </summary> | ||||
public byte USBID { get; set; } | public byte USBID { get; set; } | ||||
/// <summary> | /// <summary> | ||||
@@ -18,12 +16,12 @@ namespace JT808.Protocol.Extensions.JTActiveSafety.MessageBody | |||||
/// </summary> | /// </summary> | ||||
public byte MessageLength { get; set; } | public byte MessageLength { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 消息内容 | |||||
/// 工作状态 | |||||
/// </summary> | /// </summary> | ||||
public byte[] MessageContent { get; set; } | |||||
public byte WorkingCondition { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 消息内容对象 | |||||
/// 报警状态 | |||||
/// </summary> | /// </summary> | ||||
public JT808_JTActiveSafety_0x0900_USB_Base MessageContentObejct { get; set; } | |||||
public uint AlarmStatus { get; set; } | |||||
} | } | ||||
} | } |
@@ -0,0 +1,69 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Extensions.JTActiveSafety.Metadata | |||||
{ | |||||
public class JT808_0x0900_0xF8_USB | |||||
{ | |||||
/// <summary> | |||||
/// 外设ID | |||||
/// <see cref="JT808.Protocol.Extensions.JTActiveSafety.Enums.USBIDType"/> | |||||
/// </summary> | |||||
public byte USBID { get; set; } | |||||
/// <summary> | |||||
/// 消息长度 | |||||
/// </summary> | |||||
public byte MessageLength { get; set; } | |||||
/// <summary> | |||||
/// 公司名称长度 | |||||
/// </summary> | |||||
public byte CompantNameLength { get; set; } | |||||
/// <summary> | |||||
/// 公司名称 | |||||
/// </summary> | |||||
public string CompantName { get; set; } | |||||
/// <summary> | |||||
/// 产品型号长度 | |||||
/// </summary> | |||||
public byte ProductModelLength { get; set; } | |||||
/// <summary> | |||||
/// 产品型号 | |||||
/// </summary> | |||||
public string ProductModel { get; set; } | |||||
/// <summary> | |||||
/// 硬件版本号长度 | |||||
/// </summary> | |||||
public byte HardwareVersionNumberLength { get; set; } | |||||
/// <summary> | |||||
/// 硬件版本号 | |||||
/// ASCII | |||||
/// </summary> | |||||
public string HardwareVersionNumber { get; set; } | |||||
/// <summary> | |||||
/// 软件版本号长度 | |||||
/// </summary> | |||||
public byte SoftwareVersionNumberLength { get; set; } | |||||
/// <summary> | |||||
/// 软件版本号 | |||||
/// ASCII | |||||
/// </summary> | |||||
public string SoftwareVersionNumber { get; set; } | |||||
/// <summary> | |||||
/// 设备ID长度 | |||||
/// </summary> | |||||
public byte DevicesIDLength { get; set; } | |||||
/// <summary> | |||||
/// 设备ID | |||||
/// </summary> | |||||
public string DevicesID { get; set; } | |||||
/// <summary> | |||||
/// 客户代码长度 | |||||
/// </summary> | |||||
public byte CustomerCodeLength { get; set; } | |||||
/// <summary> | |||||
/// 客户代码 | |||||
/// </summary> | |||||
public string CustomerCode { get; set; } | |||||
} | |||||
} |