@@ -314,6 +314,9 @@ | |||
高级驾驶辅助系统报警信息Id | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x64.PassthroughType"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x64.AttachInfoLength"> | |||
<summary> | |||
高级驾驶辅助系统报警信息附加长度 | |||
@@ -435,6 +438,9 @@ | |||
驾驶员状态监测系统报警信息Id | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x65.PassthroughType"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x65.AttachInfoLength"> | |||
<summary> | |||
驾驶员状态监测系统报警信息长度 | |||
@@ -541,6 +547,9 @@ | |||
胎压监测系统报警信息Id | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x66.PassthroughType"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x66.AttachInfoLength"> | |||
<summary> | |||
胎压监测系统报警信息长度 | |||
@@ -637,6 +646,9 @@ | |||
盲区监测系统报警信息Id | |||
</summary> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x67.PassthroughType"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="P:JT808.Protocol.Extensions.SuBiao.MessageBody.JT808_0x0200_0x67.AttachInfoLength"> | |||
<summary> | |||
盲区监测系统报警信息长度 | |||
@@ -1,24 +1,26 @@ | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
{ | |||
/// <summary> | |||
/// 高级驾驶辅助系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x64 : JT808MessagePackFormatter<JT808_0x0200_0x64>, JT808_0x0200_CustomBodyBase, IJT808Analyze | |||
public class JT808_0x0200_0x64 : JT808MessagePackFormatter<JT808_0x0200_0x64>, JT808_0x0200_CustomBodyBase, JT808_0x8900_BodyBase, IJT808Analyze | |||
{ | |||
/// <summary> | |||
/// 高级驾驶辅助系统报警信息Id | |||
/// </summary> | |||
public byte AttachInfoId { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x64; | |||
/// <inheritdoc/> | |||
public byte PassthroughType { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x64; | |||
/// <summary> | |||
/// 高级驾驶辅助系统报警信息附加长度 | |||
/// </summary> | |||
@@ -34,7 +36,7 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
/// <summary> | |||
/// 报警/事件类型 | |||
/// </summary> | |||
public byte AlarmOrEventType{ get; set; } | |||
public byte AlarmOrEventType { get; set; } | |||
/// <summary> | |||
/// 报警/事件类型 | |||
/// </summary> | |||
@@ -89,6 +91,7 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
/// 报警标识号 | |||
/// </summary> | |||
public AlarmIdentificationProperty AlarmIdentification { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
@@ -277,7 +280,7 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
/// <param name="config"></param> | |||
/// <returns></returns> | |||
public override JT808_0x0200_0x64 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
{ | |||
JT808_0x0200_0x64 value = new JT808_0x0200_0x64(); | |||
value.AttachInfoId = reader.ReadByte(); | |||
value.AttachInfoLength = reader.ReadByte(); | |||
@@ -331,7 +334,8 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
writer.WriteUInt32((uint)value.Longitude); | |||
writer.WriteDateTime_yyMMddHHmmss(value.AlarmTime); | |||
writer.WriteUInt16(value.VehicleState); | |||
if (value.AlarmIdentification == null) { | |||
if (value.AlarmIdentification == null) | |||
{ | |||
throw new NullReferenceException($"{nameof(AlarmIdentificationProperty)}不为空"); | |||
} | |||
writer.WriteString(value.AlarmIdentification.TerminalID); | |||
@@ -1,24 +1,26 @@ | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
{ | |||
/// <summary> | |||
/// 驾驶员状态监测系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x65 : JT808MessagePackFormatter<JT808_0x0200_0x65>, JT808_0x0200_CustomBodyBase, IJT808Analyze | |||
public class JT808_0x0200_0x65 : JT808MessagePackFormatter<JT808_0x0200_0x65>, JT808_0x0200_CustomBodyBase, JT808_0x8900_BodyBase, IJT808Analyze | |||
{ | |||
/// <summary> | |||
/// 驾驶员状态监测系统报警信息Id | |||
/// </summary> | |||
public byte AttachInfoId { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x65; | |||
/// <inheritdoc/> | |||
public byte PassthroughType { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x65; | |||
/// <summary> | |||
/// 驾驶员状态监测系统报警信息长度 | |||
/// </summary> | |||
@@ -34,7 +36,7 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
/// <summary> | |||
/// 报警/事件类型 | |||
/// </summary> | |||
public byte AlarmOrEventType{ get; set; } | |||
public byte AlarmOrEventType { get; set; } | |||
/// <summary> | |||
/// 报警级别 | |||
/// </summary> | |||
@@ -86,7 +88,7 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||
{ | |||
JT808_0x0200_0x65 value = new JT808_0x0200_0x65(); | |||
value.AttachInfoId = reader.ReadByte(); | |||
value.AttachInfoId = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId); | |||
value.AttachInfoLength = reader.ReadByte(); | |||
writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength); | |||
@@ -1,24 +1,26 @@ | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
{ | |||
/// <summary> | |||
/// 胎压监测系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x66 : JT808MessagePackFormatter<JT808_0x0200_0x66>, JT808_0x0200_CustomBodyBase, IJT808Analyze | |||
public class JT808_0x0200_0x66 : JT808MessagePackFormatter<JT808_0x0200_0x66>, JT808_0x0200_CustomBodyBase, JT808_0x8900_BodyBase, IJT808Analyze | |||
{ | |||
/// <summary> | |||
/// 胎压监测系统报警信息Id | |||
/// </summary> | |||
public byte AttachInfoId { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x66; | |||
/// <inheritdoc/> | |||
public byte PassthroughType { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x66; | |||
/// <summary> | |||
/// 胎压监测系统报警信息长度 | |||
/// </summary> | |||
@@ -1,24 +1,26 @@ | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
using JT808.Protocol.Extensions.SuBiao.Metadata; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using JT808.Protocol.MessagePack; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Text.Json; | |||
namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
{ | |||
/// <summary> | |||
/// 盲区监测系统报警信息 | |||
/// </summary> | |||
public class JT808_0x0200_0x67 : JT808MessagePackFormatter<JT808_0x0200_0x67>, JT808_0x0200_CustomBodyBase, IJT808Analyze | |||
public class JT808_0x0200_0x67 : JT808MessagePackFormatter<JT808_0x0200_0x67>, JT808_0x0200_CustomBodyBase, JT808_0x8900_BodyBase, IJT808Analyze | |||
{ | |||
/// <summary> | |||
/// 盲区监测系统报警信息Id | |||
/// </summary> | |||
public byte AttachInfoId { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x67; | |||
/// <inheritdoc/> | |||
public byte PassthroughType { get; set; } = JT808_SuBiao_Constants.JT808_0X0200_0x67; | |||
/// <summary> | |||
/// 盲区监测系统报警信息长度 | |||
/// </summary> | |||
@@ -34,7 +36,7 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
/// <summary> | |||
/// 报警/事件类型 | |||
/// </summary> | |||
public byte AlarmOrEventType{ get; set; } | |||
public byte AlarmOrEventType { get; set; } | |||
/// <summary> | |||
/// 报警/事件类型 | |||
/// </summary> | |||
@@ -182,12 +184,12 @@ namespace JT808.Protocol.Extensions.SuBiao.MessageBody | |||
writer.WriteString($"[{value.AlarmTime.ToString("yyMMddHHmmss")}]日期时间", value.AlarmTime.ToString("yyyy-MM-dd HH:mm:ss")); | |||
value.VehicleState = reader.ReadUInt16(); | |||
writer.WriteNumber($"[{value.VehicleState.ReadNumber()}]车辆状态", value.VehicleState); | |||
var vehicleStateBits=Convert.ToString(value.VehicleState, 2).PadLeft(16, '0'); | |||
var vehicleStateBits = Convert.ToString(value.VehicleState, 2).PadLeft(16, '0'); | |||
writer.WriteStartObject($"车辆状态对象[{vehicleStateBits}]"); | |||
writer.WriteString($"[{vehicleStateBits[15]}]Bit0ACC状态", vehicleStateBits[15]=='0'?"关闭":"打开"); | |||
writer.WriteString($"[{vehicleStateBits[14]}]Bit1左转向状态", vehicleStateBits[14]=='0'?"关闭":"打开"); | |||
writer.WriteString($"[{vehicleStateBits[13]}]Bit2右转向状态", vehicleStateBits[13]=='0'?"关闭":"打开"); | |||
writer.WriteString($"[{vehicleStateBits[12]}]Bit3雨刮器状态", vehicleStateBits[12]=='0'?"关闭":"打开"); | |||
writer.WriteString($"[{vehicleStateBits[15]}]Bit0ACC状态", vehicleStateBits[15] == '0' ? "关闭" : "打开"); | |||
writer.WriteString($"[{vehicleStateBits[14]}]Bit1左转向状态", vehicleStateBits[14] == '0' ? "关闭" : "打开"); | |||
writer.WriteString($"[{vehicleStateBits[13]}]Bit2右转向状态", vehicleStateBits[13] == '0' ? "关闭" : "打开"); | |||
writer.WriteString($"[{vehicleStateBits[12]}]Bit3雨刮器状态", vehicleStateBits[12] == '0' ? "关闭" : "打开"); | |||
writer.WriteString($"[{vehicleStateBits[11]}]Bit4制动状态", vehicleStateBits[11] == '0' ? "未制动" : "制动"); | |||
writer.WriteString($"[{vehicleStateBits[10]}]Bit5插卡状态", vehicleStateBits[10] == '0' ? "未插卡" : "已插卡"); | |||
writer.WriteString($"[{vehicleStateBits[9]}]Bit6自定义", vehicleStateBits[9].ToString()); | |||
@@ -1,7 +1,7 @@ | |||
using System; | |||
using JT808.Protocol.MessageBody; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using JT808.Protocol.MessageBody; | |||
namespace JT808.Protocol.Interfaces | |||
{ | |||
@@ -19,6 +19,6 @@ namespace JT808.Protocol.Interfaces | |||
/// </summary> | |||
/// <typeparam name="TJT808_0x8900_BodyBase"></typeparam> | |||
/// <returns></returns> | |||
IJT808_0x8900_Custom_Factory SetMap<TJT808_0x8900_BodyBase>(); | |||
IJT808_0x8900_Custom_Factory SetMap<TJT808_0x8900_BodyBase>() where TJT808_0x8900_BodyBase : JT808_0x8900_BodyBase; | |||
} | |||
} |
@@ -15,15 +15,15 @@ namespace JT808.Protocol.Internal | |||
public void Register(Assembly externalAssembly) | |||
{ | |||
foreach (var item in externalAssembly.GetTypes().Where(x => x.GetConstructor(Type.EmptyTypes) != default)) | |||
foreach (var item in externalAssembly.GetTypes().Where(x => x is JT808_0x8900_BodyBase && x.GetConstructor(Type.EmptyTypes) != default)) | |||
{ | |||
Register(item); | |||
} | |||
} | |||
public IJT808_0x8900_Custom_Factory SetMap<T>() | |||
public IJT808_0x8900_Custom_Factory SetMap<TJT808_0x8900_BodyBase>() where TJT808_0x8900_BodyBase : JT808_0x8900_BodyBase | |||
{ | |||
var type = typeof(T); | |||
var type = typeof(TJT808_0x8900_BodyBase); | |||
if (type.GetConstructor(Type.EmptyTypes) != default) | |||
{ | |||
Register(type); | |||
@@ -38,9 +38,9 @@ namespace JT808.Protocol.Internal | |||
void Register(Type type) | |||
{ | |||
var instance = Activator.CreateInstance(type); | |||
if (instance is JT808_0x0200_CustomBodyBase jT808_0X0200_Custom) | |||
if (instance is JT808_0x8900_BodyBase jT808_0X8900_Custom) | |||
{ | |||
var key = jT808_0X0200_Custom.AttachInfoId; | |||
var key = jT808_0X8900_Custom.PassthroughType; | |||
if (Map.ContainsKey(key)) | |||
{ | |||
throw new ArgumentException($"{type.FullName} {key} An element with the same key already exists."); | |||
@@ -50,17 +50,9 @@ namespace JT808.Protocol.Internal | |||
Map.Add(key, instance); | |||
} | |||
} | |||
else if (instance is JT808_0x8900_BodyBase jT808_0X8900_Custom) | |||
else | |||
{ | |||
var key = jT808_0X8900_Custom.PassthroughType; | |||
if (Map.ContainsKey(key)) | |||
{ | |||
throw new ArgumentException($"{type.FullName} {key} An element with the same key already exists."); | |||
} | |||
else | |||
{ | |||
Map.Add(key, instance); | |||
} | |||
throw new ArgumentException($"{type.FullName} must be implement of {typeof(JT808_0x8900_BodyBase).FullName}."); | |||
} | |||
} | |||
} | |||