@@ -410,7 +410,7 @@ namespace JT808.Protocol.Test.MessagePack | |||||
byte[] array = new byte[4096]; | byte[] array = new byte[4096]; | ||||
byte[] array1 = new byte[] { 0x53,0x56,0x31,0x2E,0x31,0x2E,0x30 }; | byte[] array1 = new byte[] { 0x53,0x56,0x31,0x2E,0x31,0x2E,0x30 }; | ||||
var msgpackWriter = new JT808MessagePackWriter(array); | var msgpackWriter = new JT808MessagePackWriter(array); | ||||
msgpackWriter.WirteASCII("SV1.1.0"); | |||||
msgpackWriter.WriteASCII("SV1.1.0"); | |||||
var writeRealBytes = msgpackWriter.FlushAndGetRealArray(); | var writeRealBytes = msgpackWriter.FlushAndGetRealArray(); | ||||
Assert.Equal(array1, writeRealBytes); | Assert.Equal(array1, writeRealBytes); | ||||
} | } | ||||
@@ -0,0 +1,42 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Enums | |||||
{ | |||||
/// <summary> | |||||
/// 行车记录仪命令字 | |||||
/// </summary> | |||||
public enum JT808CarDVRCommandID:byte | |||||
{ | |||||
采集记录仪执行标准版本=0x00, | |||||
采集当前驾驶人信息 = 0x01, | |||||
采集记录仪实时时间 = 0x02, | |||||
采集累计行驶里程 = 0x03, | |||||
采集记录仪脉冲系数 = 0x04, | |||||
采集车辆信息 = 0x05, | |||||
采集记录仪状态信号配置信息 = 0x06, | |||||
采集记录仪唯一性编号 = 0x07, | |||||
采集指定的行驶速度记录 = 0x08, | |||||
采集指定的位置信息记录 = 0x09, | |||||
采集指定的事故疑点记录 = 0x10, | |||||
采集指定的超时驾驶记录 = 0x11, | |||||
采集指定的驾驶人身份记录 = 0x12, | |||||
采集指定的外部供电记录 = 0x13, | |||||
采集指定的参数修改记录 = 0x14, | |||||
采集指定的速度状态日志 = 0x15, | |||||
设置车辆信息= 0x82, | |||||
设置记录仪初次安装日期 = 0x83, | |||||
设置状态量配置信息 = 0x84, | |||||
设置记录仪时间 = 0xC2, | |||||
设置记录仪脉冲系数 = 0xC3, | |||||
设置初始里程 = 0xC4, | |||||
进入或保持检定状态 = 0xE0, | |||||
进入里程误差测量 = 0xE1, | |||||
进入脉冲系数误差测量 = 0xE2, | |||||
进入实时时间误差测量 = 0xE3, | |||||
返回正常工作状态 = 0xE4, | |||||
} | |||||
} |
@@ -7,6 +7,10 @@ | |||||
/// </summary> | /// </summary> | ||||
CheckCodeNotEqual = 1001, | CheckCodeNotEqual = 1001, | ||||
/// <summary> | /// <summary> | ||||
/// 校验和不相等 | |||||
/// </summary> | |||||
CarDVRCheckCodeNotEqual = 1002, | |||||
/// <summary> | |||||
/// 消息头解析错误 | /// 消息头解析错误 | ||||
/// </summary> | /// </summary> | ||||
HeaderParseError = 1003, | HeaderParseError = 1003, | ||||
@@ -46,7 +46,9 @@ namespace JT808.Protocol.Interfaces | |||||
public virtual IJT808_0x0900_Custom_Factory JT808_0x0900_Custom_Factory { get; set; } | public virtual IJT808_0x0900_Custom_Factory JT808_0x0900_Custom_Factory { get; set; } | ||||
public virtual IJT808_0x8900_Custom_Factory JT808_0x8900_Custom_Factory { get; set; } | public virtual IJT808_0x8900_Custom_Factory JT808_0x8900_Custom_Factory { get; set; } | ||||
public virtual IJT808_0x8500_2019_Factory JT808_0x8500_2019_Factory { get; set; } | public virtual IJT808_0x8500_2019_Factory JT808_0x8500_2019_Factory { get; set; } | ||||
public IJT808_Recorder_Factory JT808_Recorder_Factory { get; set; } | |||||
public IJT808_CarDVR_Up_Factory JT808_CarDVR_Up_Factory { get; set; } | |||||
public IJT808_CarDVR_Down_Factory JT808_CarDVR_Down_Factory { get; set; } | |||||
public bool SkipCarDVRCRCCode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } | |||||
public virtual IJT808Config Register(params Assembly[] externalAssemblies) | public virtual IJT808Config Register(params Assembly[] externalAssemblies) | ||||
{ | { | ||||
@@ -61,9 +61,13 @@ namespace JT808.Protocol | |||||
/// </summary> | /// </summary> | ||||
IJT808_0x8500_2019_Factory JT808_0x8500_2019_Factory { get; set; } | IJT808_0x8500_2019_Factory JT808_0x8500_2019_Factory { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 记录仪工厂 | |||||
/// 记录仪上行工厂 | |||||
/// </summary> | /// </summary> | ||||
IJT808_Recorder_Factory JT808_Recorder_Factory { get; set; } | |||||
IJT808_CarDVR_Up_Factory JT808_CarDVR_Up_Factory { get; set; } | |||||
/// <summary> | |||||
/// 记录仪下行工厂 | |||||
/// </summary> | |||||
IJT808_CarDVR_Down_Factory JT808_CarDVR_Down_Factory { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 统一编码 | /// 统一编码 | ||||
/// </summary> | /// </summary> | ||||
@@ -75,6 +79,12 @@ namespace JT808.Protocol | |||||
/// </summary> | /// </summary> | ||||
bool SkipCRCCode { get; set; } | bool SkipCRCCode { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 跳过行车记录仪校验码 | |||||
/// 测试的时候需要手动修改值,避免验证 | |||||
/// 默认:false | |||||
/// </summary> | |||||
bool SkipCarDVRCRCCode { get; set; } | |||||
/// <summary> | |||||
/// ReadBCD是否需要去0操作 | /// ReadBCD是否需要去0操作 | ||||
/// 默认是去0 | /// 默认是去0 | ||||
/// 注意:有时候对协议来说是有意义的0 | /// 注意:有时候对协议来说是有意义的0 | ||||
@@ -0,0 +1,15 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Interfaces | |||||
{ | |||||
/// <summary> | |||||
/// 记录仪工厂 | |||||
/// </summary> | |||||
public interface IJT808_CarDVR_Down_Factory : IJT808ExternalRegister | |||||
{ | |||||
IDictionary<byte, JT808CarDVRDownBodies> Map { get; } | |||||
IJT808_CarDVR_Down_Factory SetMap<JT808CarDVRDownBodies>() ; | |||||
} | |||||
} |
@@ -0,0 +1,15 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Interfaces | |||||
{ | |||||
/// <summary> | |||||
/// 记录仪工厂 | |||||
/// </summary> | |||||
public interface IJT808_CarDVR_Up_Factory : IJT808ExternalRegister | |||||
{ | |||||
IDictionary<byte, JT808CarDVRUpBodies> Map { get; } | |||||
IJT808_CarDVR_Up_Factory SetMap<JT808CarDVRUpBodies>() ; | |||||
} | |||||
} |
@@ -1,16 +0,0 @@ | |||||
using JT808.Protocol.MessageBody.Recorder; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.Interfaces | |||||
{ | |||||
/// <summary> | |||||
/// 记录仪工厂 | |||||
/// </summary> | |||||
public interface IJT808_Recorder_Factory : IJT808ExternalRegister | |||||
{ | |||||
IDictionary<byte, JT808_RecorderBody> Map { get; } | |||||
IJT808_Recorder_Factory SetMap<TJT808_RecorderBody>() ; | |||||
} | |||||
} |
@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
@@ -21,5 +22,7 @@ namespace JT808.Protocol | |||||
public virtual bool SkipSerialization { get; set; } = false; | public virtual bool SkipSerialization { get; set; } = false; | ||||
public abstract string Description { get; } | public abstract string Description { get; } | ||||
public abstract JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config); | |||||
public abstract void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config); | |||||
} | } | ||||
} | } |
@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | using System.Text; | ||||
@@ -21,5 +22,7 @@ namespace JT808.Protocol | |||||
public virtual bool SkipSerialization { get; set; } = false; | public virtual bool SkipSerialization { get; set; } = false; | ||||
public abstract string Description { get; } | public abstract string Description { get; } | ||||
public abstract JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config); | |||||
public abstract void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies value, IJT808Config config); | |||||
} | } | ||||
} | } |
@@ -1,4 +1,6 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Exceptions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System; | using System; | ||||
@@ -51,19 +53,42 @@ namespace JT808.Protocol | |||||
value.Begin = reader.ReadUInt16(); | value.Begin = reader.ReadUInt16(); | ||||
value.CommandId = reader.ReadByte(); | value.CommandId = reader.ReadByte(); | ||||
value.DataLength = reader.ReadUInt16(); | value.DataLength = reader.ReadUInt16(); | ||||
var carDVRCheckCode = reader.ReadCarDVRCheckCode(currentPosition, value.DataLength); | |||||
//todo:定义一个行车记录仪的异常和跳过校验的配置属性 | |||||
//比如:config.SkipCRCCode | |||||
//if (carDVRCheckCode.RealXorCheckCode != carDVRCheckCode.CalculateXorCheckCode) | |||||
value.KeepFields = reader.ReadByte(); | value.KeepFields = reader.ReadByte(); | ||||
//todo:数据体 | |||||
if (value.DataLength > 0) | |||||
{ | |||||
if (config.JT808_CarDVR_Up_Factory.Map.TryGetValue(value.CommandId, out var instance)) | |||||
{ | |||||
//4.2.处理消息体 | |||||
value.Bodies = instance.Deserialize(ref reader, config); | |||||
} | |||||
} | |||||
var carDVRCheckCode = reader.ReadCarDVRCheckCode(currentPosition); | |||||
if (!config.SkipCarDVRCRCCode) | |||||
{ | |||||
if (carDVRCheckCode.RealXorCheckCode != carDVRCheckCode.CalculateXorCheckCode) | |||||
throw new JT808Exception(JT808ErrorCode.CarDVRCheckCodeNotEqual, $"{reader.RealCheckXorCode}!={reader.CalculateCheckXorCode}"); | |||||
} | |||||
value.CheckCode = reader.ReadByte(); | value.CheckCode = reader.ReadByte(); | ||||
return value; | return value; | ||||
} | } | ||||
public void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpPackage value, IJT808Config config) | public void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpPackage value, IJT808Config config) | ||||
{ | { | ||||
throw new NotImplementedException(); | |||||
var currentPosition = writer.GetCurrentPosition(); | |||||
writer.WriteUInt16(value.Begin); | |||||
writer.WriteByte(value.CommandId); | |||||
writer.Skip(2, out var datalengthPosition); | |||||
writer.WriteByte(value.KeepFields); | |||||
if (config.JT808_CarDVR_Up_Factory.Map.TryGetValue(value.CommandId, out var instance)) | |||||
{ | |||||
if (!instance.SkipSerialization) | |||||
{ | |||||
//4.2.处理消息体 | |||||
instance.Serialize(ref writer, value.Bodies, config); | |||||
} | |||||
} | |||||
writer.WriteUInt16Return((ushort)(writer.GetCurrentPosition() - datalengthPosition + 1), datalengthPosition); | |||||
writer.WriteCarDVRCheckCode(currentPosition); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -1,4 +1,6 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System; | using System; | ||||
@@ -6,26 +8,26 @@ using System.Collections.Generic; | |||||
using System.Text; | using System.Text; | ||||
using System.Text.Json; | using System.Text.Json; | ||||
namespace JT808.Protocol.MessageBody.Recorder | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 采集记录仪执行标准版本 | /// 采集记录仪执行标准版本 | ||||
/// 返回:记录仪执行标准的年号及修改单号 | /// 返回:记录仪执行标准的年号及修改单号 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_Recorder_Down_0x00 : JT808_RecorderBody | |||||
public class JT808_CarDVR_Down_0x00 : JT808CarDVRDownBodies | |||||
{ | { | ||||
public override byte CommandId =>0x00; | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪执行标准版本.ToByteValue(); | |||||
public override string Description => "采集记录仪执行标准版本"; | public override string Description => "采集记录仪执行标准版本"; | ||||
public override bool SkipSerialization { get; set; } = true; | public override bool SkipSerialization { get; set; } = true; | ||||
public override JT808_RecorderBody Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | { | ||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
} | } | ||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808_RecorderBody value, IJT808Config config) | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | { | ||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
} | } |
@@ -0,0 +1,35 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 机动车驾驶证号码 | |||||
/// 返回:当前驾驶人的机动车驾驶证号码 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x01 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的驾驶人身份记录.ToByteValue(); | |||||
public override string Description => "采集机动车驾驶证号码"; | |||||
public override bool SkipSerialization { get; set; } = true; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪实时时间 | |||||
/// 返回:实时时间 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x02 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪实时时间.ToByteValue(); | |||||
public override string Description => "实时时间"; | |||||
public override bool SkipSerialization { get; set; } = true; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集累计行驶里程 | |||||
/// 返回:实时时间、安装时的初始里程及安装后的累计行驶里程 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x03 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集累计行驶里程.ToByteValue(); | |||||
public override string Description => "实时时间、安装时的初始里程及安装后的累计行驶里程"; | |||||
public override bool SkipSerialization { get; set; } = true; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪脉冲系数 | |||||
/// 返回:实时时间及设定的脉冲系数 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x04 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪脉冲系数.ToByteValue(); | |||||
public override string Description => "实时时间及设定的脉冲系数"; | |||||
public override bool SkipSerialization { get; set; } = true; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集车辆信息 | |||||
/// 返回:车辆识别代号、机动车号牌号码和机动车号牌分类 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x05 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集车辆信息.ToByteValue(); | |||||
public override string Description => "车辆识别代号、机动车号牌号码和机动车号牌分类"; | |||||
public override bool SkipSerialization { get; set; } = true; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪状态信号配置信息 | |||||
/// 返回:状态信号配置信息 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x06 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪状态信号配置信息.ToByteValue(); | |||||
public override string Description => "状态信号配置信息"; | |||||
public override bool SkipSerialization { get; set; } = true; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪唯一性编号 | |||||
/// 返回:唯一性编号及初次安装日期 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x07 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪唯一性编号.ToByteValue(); | |||||
public override string Description => "唯一性编号及初次安装日期"; | |||||
public override bool SkipSerialization { get; set; } = true; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,52 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的行驶速度记录 | |||||
/// 返回:符合条件的行驶速度记录 | |||||
/// 如在指定的时间范围内无数据记录,则本数据块数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x08 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的行驶速度记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override string Description => "符合条件的行驶速度记录"; | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x08 value = new JT808_CarDVR_Down_0x08(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x08 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x08; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,53 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的位置信息记录 | |||||
/// 返回:符合条件的位置信息记录 | |||||
/// 指定的时间范围内无数据记录,则本数据块数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x09 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的位置信息记录.ToByteValue(); | |||||
public override string Description => "符合条件的位置信息记录"; | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x09 value = new JT808_CarDVR_Down_0x09(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x09 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x09; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,53 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的事故疑点记录 | |||||
/// 返回:符合条件的事故疑点记录 | |||||
/// 指定的时间范围内无数据记录,则本数据块数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x10 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的事故疑点记录.ToByteValue(); | |||||
public override string Description => "符合条件的事故疑点记录"; | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x10 value = new JT808_CarDVR_Down_0x10(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x10 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x10; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,52 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的超时驾驶记录 | |||||
/// 返回:符合条件的超时驾驶记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x11 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的超时驾驶记录.ToByteValue(); | |||||
public override string Description => "符合条件的超时驾驶记录"; | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x11 value = new JT808_CarDVR_Down_0x11(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x11 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x11; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,51 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的驾驶人身份记录 | |||||
/// 返回:符合条件的驾驶人登录退出记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x12 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的驾驶人身份记录.ToByteValue(); | |||||
public override string Description => "符合条件的驾驶人登录退出记录"; | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x12 value = new JT808_CarDVR_Down_0x12(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x12 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x12; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,51 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的外部供电记录 | |||||
/// 返回:符合条件的供电记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x13 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的外部供电记录.ToByteValue(); | |||||
public override string Description => "符合条件的供电记录"; | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x13 value = new JT808_CarDVR_Down_0x13(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x13 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x13; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,51 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的参数修改记录 | |||||
/// 返回:符合条件的参数修改记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x14 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的参数修改记录.ToByteValue(); | |||||
public override string Description => "符合条件的参数修改记录"; | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x14 value = new JT808_CarDVR_Down_0x14(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x14 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x14; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,52 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的速度状态日志 | |||||
/// 返回:符合条件的速度状态日志 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x15 : JT808CarDVRDownBodies | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的速度状态日志.ToByteValue(); | |||||
public override string Description => "符合条件的速度状态日志"; | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 最大单位数据块个数 | |||||
/// </summary> | |||||
public ushort Count { get; set; } | |||||
public override JT808CarDVRDownBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x15 value = new JT808_CarDVR_Down_0x15(); | |||||
value.StartTime = reader.ReadDateTime6(); | |||||
value.EndTime = reader.ReadDateTime6(); | |||||
value.Count = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRDownBodies jT808CarDVRDownBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Down_0x15 value = jT808CarDVRDownBodies as JT808_CarDVR_Down_0x15; | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Count); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置车辆信息 | |||||
/// 返回:车辆信息 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x82 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置车辆信息.ToByteValue(); | |||||
public override string Description => "车辆信息"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x82 value = new JT808_CarDVR_Up_0x82(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x82 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x82; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置记录仪初次安装日期 | |||||
/// 返回:初次安装日期 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x83 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置记录仪初次安装日期.ToByteValue(); | |||||
public override string Description => "初次安装日期"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x83 value = new JT808_CarDVR_Up_0x83(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x83 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x83; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置状态量配置信息 | |||||
/// 返回:状态量配置信息 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0x84 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置状态量配置信息.ToByteValue(); | |||||
public override string Description => "状态量配置信息"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x84 value = new JT808_CarDVR_Up_0x84(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x84 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x84; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置记录仪时间 | |||||
/// 返回:北京时间的日期、时钟 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0xC2 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置记录仪时间.ToByteValue(); | |||||
public override string Description => "北京时间的日期、时钟"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC2 value = new JT808_CarDVR_Up_0xC2(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC2 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xC2; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置记录仪脉冲系数 | |||||
/// 返回:记录仪脉冲系数 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0xC3 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置记录仪脉冲系数.ToByteValue(); | |||||
public override string Description => "记录仪脉冲系数"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC3 value = new JT808_CarDVR_Up_0xC3(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC3 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xC3; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,39 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置初始里程 | |||||
/// 返回:记录仪初次安装时车辆已行驶的总里程 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Down_0xC4 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置初始里程.ToByteValue(); | |||||
public override string Description => "车辆识别代号、机动车号牌号码和机动车号牌分类"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC4 value = new JT808_CarDVR_Up_0xC4(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC4 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xC4; | |||||
} | |||||
} | |||||
} |
@@ -1,4 +1,6 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | using JT808.Protocol.Interfaces; | ||||
using JT808.Protocol.MessagePack; | using JT808.Protocol.MessagePack; | ||||
using System; | using System; | ||||
@@ -7,15 +9,15 @@ using System.Collections.Generic; | |||||
using System.Text; | using System.Text; | ||||
using System.Text.Json; | using System.Text.Json; | ||||
namespace JT808.Protocol.MessageBody.Recorder | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 采集记录仪执行标准版本 | /// 采集记录仪执行标准版本 | ||||
/// 返回:记录仪执行标准的年号及修改单号 | /// 返回:记录仪执行标准的年号及修改单号 | ||||
/// </summary> | /// </summary> | ||||
public class JT808_Recorder_Up_0x00 : JT808_RecorderBody, IJT808Analyze | |||||
public class JT808_CarDVR_Up_0x00 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | { | ||||
public override byte CommandId => 0x00; | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪执行标准版本.ToByteValue(); | |||||
/// <summary> | /// <summary> | ||||
/// 记录仪执行标准年号后 2 位 BCD 码 | /// 记录仪执行标准年号后 2 位 BCD 码 | ||||
/// 无应答则默认为 03 | /// 无应答则默认为 03 | ||||
@@ -26,24 +28,24 @@ namespace JT808.Protocol.MessageBody.Recorder | |||||
/// 无修改单或无应答则默认为 00H | /// 无修改单或无应答则默认为 00H | ||||
/// </summary> | /// </summary> | ||||
public byte ModifyNumber { get; set; } | public byte ModifyNumber { get; set; } | ||||
public override string Description => "采集记录仪执行标准版本应答"; | |||||
public override string Description => "记录仪执行标准的年号及修改单号"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | ||||
{ | { | ||||
} | } | ||||
public override JT808_RecorderBody Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | { | ||||
JT808_Recorder_Up_0x00 value = new JT808_Recorder_Up_0x00(); | |||||
JT808_CarDVR_Up_0x00 value = new JT808_CarDVR_Up_0x00(); | |||||
value.StandardYear = reader.ReadBCD(2); | value.StandardYear = reader.ReadBCD(2); | ||||
value.ModifyNumber = reader.ReadByte(); | value.ModifyNumber = reader.ReadByte(); | ||||
return value; | return value; | ||||
} | } | ||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808_RecorderBody jT808_RecorderBody, IJT808Config config) | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | { | ||||
JT808_Recorder_Up_0x00 value = jT808_RecorderBody as JT808_Recorder_Up_0x00; | |||||
JT808_CarDVR_Up_0x00 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x00; | |||||
writer.WriteBCD(value.StandardYear, 2); | writer.WriteBCD(value.StandardYear, 2); | ||||
writer.WriteByte(value.ModifyNumber); | writer.WriteByte(value.ModifyNumber); | ||||
} | } |
@@ -0,0 +1,46 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 机动车驾驶证号码 | |||||
/// 返回:当前驾驶人的机动车驾驶证号码 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x01 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集当前驾驶人信息.ToByteValue(); | |||||
/// <summary> | |||||
/// 机动车驾驶证号码 | |||||
/// 机动车驾驶证号码为 15 位时,后 3 位以 00H 补齐。驾驶人身份未知时以 00H 表示 | |||||
/// </summary> | |||||
public string DriverLicenseNo { get; set; } | |||||
public override string Description => "当前驾驶人的机动车驾驶证号码"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x01 value = new JT808_CarDVR_Up_0x01(); | |||||
value.DriverLicenseNo = reader.ReadASCII(18); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x01 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x01; | |||||
writer.WriteASCII(value.DriverLicenseNo.PadRight(18,'0')); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,45 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪实时时间 | |||||
/// 返回:实时时间 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x02 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪实时时间.ToByteValue(); | |||||
/// <summary> | |||||
/// 实时时间 | |||||
/// </summary> | |||||
public DateTime RealTime { get; set; } | |||||
public override string Description => "实时时间"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x02 value = new JT808_CarDVR_Up_0x02(); | |||||
value.RealTime = reader.ReadDateTime6(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x02 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x02; | |||||
writer.WriteDateTime6(value.RealTime); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,63 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集累计行驶里程 | |||||
/// 返回:实时时间、安装时的初始里程及安装后的累计行驶里程 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x03 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集累计行驶里程.ToByteValue(); | |||||
/// <summary> | |||||
/// 实时时间 | |||||
/// </summary> | |||||
public DateTime RealTime { get; set; } | |||||
/// <summary> | |||||
/// 初次安装时间 | |||||
/// </summary> | |||||
public DateTime FirstInstallTime { get; set; } | |||||
/// <summary> | |||||
/// 初始里程 | |||||
/// </summary> | |||||
public string FirstMileage { get; set; } | |||||
/// <summary> | |||||
/// 累计里程 | |||||
/// </summary> | |||||
public string TotalMilage { get; set; } | |||||
public override string Description => "实时时间、安装时的初始里程及安装后的累计行驶里程"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x03 value = new JT808_CarDVR_Up_0x03(); | |||||
value.RealTime = reader.ReadDateTime6(); | |||||
value.FirstInstallTime = reader.ReadDateTime6(); | |||||
value.FirstMileage = reader.ReadBCD(8); | |||||
value.TotalMilage = reader.ReadBCD(8); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x03 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x03; | |||||
writer.WriteDateTime6(value.RealTime); | |||||
writer.WriteDateTime6(value.FirstInstallTime); | |||||
writer.WriteBCD(value.FirstMileage, 8); | |||||
writer.WriteBCD(value.TotalMilage, 8); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,58 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪脉冲系数 | |||||
/// 返回:实时时间及设定的脉冲系数 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x04 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪脉冲系数.ToByteValue(); | |||||
/// <summary> | |||||
/// 当前时间 | |||||
/// </summary> | |||||
public DateTime RealTime { get; set; } | |||||
/// <summary> | |||||
/// 脉冲系数高字节 | |||||
/// </summary> | |||||
public byte PulseCoefficientHighByte { get; set; } | |||||
/// <summary> | |||||
/// 仪脉冲系数低字节 | |||||
/// </summary> | |||||
public byte PulseCoefficientLowByte { get; set; } | |||||
public override string Description => "实时时间及设定的脉冲系数"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x04 value = new JT808_CarDVR_Up_0x04(); | |||||
value.RealTime= reader.ReadDateTime6(); | |||||
value.PulseCoefficientHighByte = reader.ReadByte(); | |||||
value.PulseCoefficientLowByte = reader.ReadByte(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x04 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x04; | |||||
writer.WriteDateTime6(value.RealTime); | |||||
writer.WriteByte(value.PulseCoefficientHighByte); | |||||
writer.WriteByte(value.PulseCoefficientLowByte); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,63 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集车辆信息 | |||||
/// 返回:车辆识别代号、机动车号牌号码和机动车号牌分类 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x05 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集车辆信息.ToByteValue(); | |||||
/// <summary> | |||||
/// 车辆识别代号 | |||||
/// </summary> | |||||
public string Vin { get; set; } | |||||
/// <summary> | |||||
/// 机动车号牌号码 | |||||
/// 后 3 个字节为备用字 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 机动车号牌分类 | |||||
/// 后 4 个字节为备用字 | |||||
/// </summary> | |||||
public string VehicleType { get; set; } | |||||
public override string Description => "车辆识别代号、机动车号牌号码和机动车号牌分类"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x05 value = new JT808_CarDVR_Up_0x05(); | |||||
value.Vin= reader.ReadASCII(17); | |||||
value.VehicleNo = reader.ReadASCII(9); | |||||
reader.Skip(3); | |||||
value.VehicleType = reader.ReadString(6); | |||||
reader.Skip(4); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x05 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x05; | |||||
writer.WriteASCII(value.Vin.PadRight(17,'0')); | |||||
writer.WriteASCII(value.VehicleNo); | |||||
writer.Skip(12 - value.VehicleNo.Length, out var vehicleNo); | |||||
writer.WriteString(value.VehicleType); | |||||
writer.Skip(10 - value.VehicleType.Length, out var vehicleType); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,102 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪状态信号配置信息 | |||||
/// 返回:状态信号配置信息 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x06 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪状态信号配置信息.ToByteValue(); | |||||
/// <summary> | |||||
/// 实时时间 | |||||
/// </summary> | |||||
public DateTime RealTime { get; set; } | |||||
/// <summary> | |||||
/// 信号字节个数 | |||||
/// 单位字节的 D7~D0(由高到低)分别对应 8 个状态信号, 1 表示有操作,0表示无操作 | |||||
/// </summary> | |||||
public byte SignalOperate { get; set; } | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public string D0 { get; set; } | |||||
public string D1 { get; set; } | |||||
public string D2 { get; set; } | |||||
/// <summary> | |||||
/// 近光 D3 | |||||
/// 10个字节,未使用或不足时,补0 | |||||
/// </summary> | |||||
public string NearLight { get; set; } | |||||
/// <summary> | |||||
/// 远光 D4 | |||||
/// 10个字节,未使用或不足时,补0 | |||||
/// </summary> | |||||
public string FarLight { get; set; } | |||||
/// <summary> | |||||
/// 右转向 D5 | |||||
/// 10个字节,未使用或不足时,补0 | |||||
/// </summary> | |||||
public string RightTurn { get; set; } | |||||
/// <summary> | |||||
/// 左转向 D6 | |||||
/// 10个字节,未使用或不足时,补0 | |||||
/// </summary> | |||||
public string LeftTurn { get; set; } | |||||
/// <summary> | |||||
/// 制动 D7 | |||||
/// 10个字节,未使用或不足时,补0 | |||||
/// </summary> | |||||
public string Brake { get; set; } | |||||
public override string Description => "状态信号配置信息"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x06 value = new JT808_CarDVR_Up_0x06(); | |||||
value.RealTime = reader.ReadDateTime6(); | |||||
value.SignalOperate = reader.ReadByte(); | |||||
value.D0 = reader.ReadASCII(10); | |||||
value.D1 = reader.ReadASCII(10); | |||||
value.D2 = reader.ReadASCII(10); | |||||
value.NearLight = reader.ReadASCII(10); | |||||
value.FarLight = reader.ReadASCII(10); | |||||
value.RightTurn = reader.ReadASCII(10); | |||||
value.LeftTurn = reader.ReadASCII(10); | |||||
value.Brake = reader.ReadASCII(10); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x06 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x06; | |||||
writer.WriteDateTime6(value.RealTime); | |||||
writer.WriteByte(value.SignalOperate); | |||||
writer.WriteASCII(value.D0.PadRight(0)); | |||||
writer.WriteASCII(value.D1.PadRight(0)); | |||||
writer.WriteASCII(value.D2.PadRight(0)); | |||||
writer.WriteASCII(value.NearLight.PadRight(0)); | |||||
writer.WriteASCII(value.FarLight.PadRight(0)); | |||||
writer.WriteASCII(value.RightTurn.PadRight(0)); | |||||
writer.WriteASCII(value.LeftTurn.PadRight(0)); | |||||
writer.WriteASCII(value.Brake.PadRight(0)); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,69 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集记录仪唯一性编号 | |||||
/// 返回:唯一性编号及初次安装日期 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x07 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集记录仪唯一性编号.ToByteValue(); | |||||
/// <summary> | |||||
/// 生产厂 CCC 认证代码 7字节 | |||||
/// </summary> | |||||
public string ProductionPlantCCCCertificationCode { get; set; } | |||||
/// <summary> | |||||
/// 认证产品型号 16字节 | |||||
/// </summary> | |||||
public string CertifiedProductModels { get; set; } | |||||
/// <summary> | |||||
/// 生产日期 3字节 | |||||
/// </summary> | |||||
public DateTime ProductionDate { get; set; } | |||||
/// <summary> | |||||
/// 产品生产流水号 4字节 | |||||
/// </summary> | |||||
public string ProductProductionFlowNumber{get;set;} | |||||
/// <summary> | |||||
/// 备用 5字节 | |||||
/// </summary> | |||||
public string Reversed { get; set; } | |||||
public override string Description => "唯一性编号及初次安装日期"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x07 value = new JT808_CarDVR_Up_0x07(); | |||||
value.ProductionPlantCCCCertificationCode = reader.ReadASCII(7); | |||||
value.CertifiedProductModels = reader.ReadASCII(16); | |||||
value.ProductionDate = reader.ReadDateTime3(); | |||||
value.ProductProductionFlowNumber = reader.ReadASCII(4); | |||||
value.Reversed = reader.ReadASCII(5); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x07 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x07; | |||||
writer.WriteASCII(value.ProductionPlantCCCCertificationCode.PadRight(7,'0')); | |||||
writer.WriteASCII(value.CertifiedProductModels.PadRight(16, '0')); | |||||
writer.WriteDateTime3(value.ProductionDate); | |||||
writer.WriteASCII(value.ProductProductionFlowNumber.PadRight(4,'0')); | |||||
writer.WriteASCII(value.Reversed.PadRight(5, '0')); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,101 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的行驶速度记录 | |||||
/// 返回:符合条件的行驶速度记录 | |||||
/// 如在指定的时间范围内无数据记录,则本数据块数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x08 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的行驶速度记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x08_SpeedPerMinute> JT808_CarDVR_Up_0x08_SpeedPerMinutes { get; set; } | |||||
public override string Description => "符合条件的行驶速度记录"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x08 value = new JT808_CarDVR_Up_0x08(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1)/126;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x08_SpeedPerMinute jT808_CarDVR_Up_0X08_SpeedPerMinute = new JT808_CarDVR_Up_0x08_SpeedPerMinute() | |||||
{ | |||||
StartTime = reader.ReadDateTime6(), | |||||
JT808_CarDVR_Up_0x08_SpeedPerSeconds = new List<JT808_CarDVR_Up_0x08_SpeedPerSecond>() | |||||
}; | |||||
for (int j = 0; j < 60; j++)//60秒 | |||||
{ | |||||
jT808_CarDVR_Up_0X08_SpeedPerMinute.JT808_CarDVR_Up_0x08_SpeedPerSeconds.Add(new JT808_CarDVR_Up_0x08_SpeedPerSecond | |||||
{ | |||||
AvgSpeedAfterStartTime = reader.ReadByte(), | |||||
StatusSignalAfterStartTime = reader.ReadByte() | |||||
}); | |||||
} | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x08 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x08; | |||||
foreach (var speedPerMinute in value.JT808_CarDVR_Up_0x08_SpeedPerMinutes) | |||||
{ | |||||
writer.WriteDateTime6(speedPerMinute.StartTime); | |||||
foreach (var speedPerSecond in speedPerMinute.JT808_CarDVR_Up_0x08_SpeedPerSeconds) | |||||
{ | |||||
writer.WriteByte(speedPerSecond.AvgSpeedAfterStartTime); | |||||
writer.WriteByte(speedPerSecond.StatusSignalAfterStartTime); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 单位分钟行驶速度记录数据块格式 | |||||
/// 1.本数据块总长度为 126 个字节,不足部分以 FFH补齐; | |||||
/// 2.如单位分钟内无数据记录,则本数据块无效,数据长度为0,数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x08_SpeedPerMinute | |||||
{ | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 60s钟,每秒的信息 | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x08_SpeedPerSecond> JT808_CarDVR_Up_0x08_SpeedPerSeconds { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 开始时间之后每秒钟的平均速度和状态信号 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x08_SpeedPerSecond | |||||
{ | |||||
/// <summary> | |||||
/// 开始时间之后每秒钟的平均速度 | |||||
/// </summary> | |||||
public byte AvgSpeedAfterStartTime { get; set; } | |||||
/// <summary> | |||||
/// 开始时间之后每秒钟的状态信号 | |||||
/// </summary> | |||||
public byte StatusSignalAfterStartTime { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,113 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的位置信息记录 | |||||
/// 返回:符合条件的位置信息记录 | |||||
/// 指定的时间范围内无数据记录,则本数据块数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x09 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的位置信息记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x09_PositionPerHour> JT808_CarDVR_Up_0x09_PositionPerHours { get; set; } | |||||
public override string Description => "符合条件的位置信息记录"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x09 value = new JT808_CarDVR_Up_0x09(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1) / 666;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x09_PositionPerHour jT808_CarDVR_Up_0x09_PositionPerHour = new JT808_CarDVR_Up_0x09_PositionPerHour() | |||||
{ | |||||
StartTime = reader.ReadDateTime6(), | |||||
JT808_CarDVR_Up_0x09_PositionPerMinutes = new List<JT808_CarDVR_Up_0x09_PositionPerMinute>() | |||||
}; | |||||
for (int j = 0; j < 60; j++)//60钟 | |||||
{ | |||||
jT808_CarDVR_Up_0x09_PositionPerHour.JT808_CarDVR_Up_0x09_PositionPerMinutes.Add(new JT808_CarDVR_Up_0x09_PositionPerMinute | |||||
{ | |||||
GpsLng = reader.ReadInt32(), | |||||
GpsLat = reader.ReadInt32(), | |||||
Height = reader.ReadInt16(), | |||||
AvgSpeedAfterStartTime = reader.ReadByte() | |||||
}); | |||||
} | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x09 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x09; | |||||
foreach (var positionPerHour in value.JT808_CarDVR_Up_0x09_PositionPerHours) | |||||
{ | |||||
writer.WriteDateTime6(positionPerHour.StartTime); | |||||
foreach (var positionPerMinute in positionPerHour.JT808_CarDVR_Up_0x09_PositionPerMinutes) | |||||
{ | |||||
writer.WriteInt32(positionPerMinute.GpsLng); | |||||
writer.WriteInt32(positionPerMinute.GpsLat); | |||||
writer.WriteInt16(positionPerMinute.Height); | |||||
writer.WriteByte(positionPerMinute.AvgSpeedAfterStartTime); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 指定的结束时间之前最近的每 小时的位置信息记录 | |||||
/// 1.本数据块总长度为 666 个字节,不足部分以 FFH补齐; | |||||
/// 2.如单位分钟内无数据记录,则本数据块无效,数据长度为0,数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x09_PositionPerHour | |||||
{ | |||||
/// <summary> | |||||
/// 开始时间 | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 60s钟,每秒的信息 | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x09_PositionPerMinute> JT808_CarDVR_Up_0x09_PositionPerMinutes { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 开始时间之后每分钟的平均速度和位置信息 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x09_PositionPerMinute | |||||
{ | |||||
/// <summary> | |||||
/// 经度 | |||||
/// </summary> | |||||
public int GpsLng { get; set; } | |||||
/// <summary> | |||||
/// 纬度 | |||||
/// </summary> | |||||
public int GpsLat { get; set; } | |||||
/// <summary> | |||||
/// 高度 | |||||
/// </summary> | |||||
public short Height { get; set; } | |||||
/// <summary> | |||||
/// 开始时间之后每分钟的平均速度 | |||||
/// </summary> | |||||
public byte AvgSpeedAfterStartTime { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,124 @@ | |||||
| |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的事故疑点记录 | |||||
/// 返回:符合条件的事故疑点记录 | |||||
/// 指定的时间范围内无数据记录,则本数据块数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x10 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的事故疑点记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x10_AccidentSuspectin> JT808_CarDVR_Up_0x10_AccidentSuspectins { get; set; } | |||||
public override string Description => "符合条件的事故疑点记录"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x10 value = new JT808_CarDVR_Up_0x10(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1) / 234;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x10_AccidentSuspectin jT808_CarDVR_Up_0x10_AccidentSuspectin = new JT808_CarDVR_Up_0x10_AccidentSuspectin(); | |||||
jT808_CarDVR_Up_0x10_AccidentSuspectin.EndTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x10_AccidentSuspectin.DriverLicenseNo = reader.ReadASCII(18); | |||||
jT808_CarDVR_Up_0x10_AccidentSuspectin.JT808_CarDVR_Up_0x09_DrivingStatuss = new List<JT808_CarDVR_Up_0x10_DrivingStatus>(); | |||||
for (int j = 0; j < 100; j++)//100组 | |||||
{ | |||||
jT808_CarDVR_Up_0x10_AccidentSuspectin.JT808_CarDVR_Up_0x09_DrivingStatuss.Add(new JT808_CarDVR_Up_0x10_DrivingStatus | |||||
{ | |||||
Speed = reader.ReadByte(), | |||||
StatusSignal = reader.ReadByte() | |||||
}); | |||||
} | |||||
jT808_CarDVR_Up_0x10_AccidentSuspectin.GpsLng = reader.ReadInt32(); | |||||
jT808_CarDVR_Up_0x10_AccidentSuspectin.GpsLat = reader.ReadInt32(); | |||||
jT808_CarDVR_Up_0x10_AccidentSuspectin.Height = reader.ReadInt16(); | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x10 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x10; | |||||
foreach (var accidentSuspectin in value.JT808_CarDVR_Up_0x10_AccidentSuspectins) | |||||
{ | |||||
writer.WriteDateTime6(accidentSuspectin.EndTime); | |||||
writer.WriteASCII(accidentSuspectin.DriverLicenseNo.PadRight(18, '0')); | |||||
foreach (var drivingStatus in accidentSuspectin.JT808_CarDVR_Up_0x09_DrivingStatuss) | |||||
{ | |||||
writer.WriteByte(drivingStatus.Speed); | |||||
writer.WriteByte(drivingStatus.StatusSignal); | |||||
} | |||||
writer.WriteInt32(accidentSuspectin.GpsLng); | |||||
writer.WriteInt32(accidentSuspectin.GpsLat); | |||||
writer.WriteInt16(accidentSuspectin.Height); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 指定的结束时间之前最近的每条事故疑点记录 | |||||
/// 1.本数据块总长度为 234 个字节; | |||||
/// 2.如单位分钟内无数据记录,则本数据块无效,数据长度为0,数据为空 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x10_AccidentSuspectin | |||||
{ | |||||
/// <summary> | |||||
/// 行驶结束时间 | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 机动车驾驶证号码 | |||||
/// </summary> | |||||
public string DriverLicenseNo { get; set; } | |||||
/// <summary> | |||||
/// 每 0.2s 间隔采集 1 次,共 100组 20s 的事故疑点记录,按时间倒序排列 | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x10_DrivingStatus> JT808_CarDVR_Up_0x09_DrivingStatuss { get; set; } | |||||
/// <summary> | |||||
/// 经度 | |||||
/// </summary> | |||||
public int GpsLng { get; set; } | |||||
/// <summary> | |||||
/// 纬度 | |||||
/// </summary> | |||||
public int GpsLat { get; set; } | |||||
/// <summary> | |||||
/// 高度 | |||||
/// </summary> | |||||
public short Height { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 行驶结束时间前的状态 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x10_DrivingStatus | |||||
{ | |||||
/// <summary> | |||||
/// 速度 | |||||
/// </summary> | |||||
public byte Speed { get; set; } | |||||
/// <summary> | |||||
/// 状态信号 | |||||
/// </summary> | |||||
public byte StatusSignal { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,113 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的超时驾驶记录 | |||||
/// 返回:符合条件的超时驾驶记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x11 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的超时驾驶记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x11_DriveOverTime> JT808_CarDVR_Up_0x11_DriveOverTimes{ get; set; } | |||||
public override string Description => "符合条件的超时驾驶记录"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x11 value = new JT808_CarDVR_Up_0x11(); | |||||
value.JT808_CarDVR_Up_0x11_DriveOverTimes = new List<JT808_CarDVR_Up_0x11_DriveOverTime>(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1) / 50;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x11_DriveOverTime jT808_CarDVR_Up_0x11_DriveOverTime = new JT808_CarDVR_Up_0x11_DriveOverTime(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.DriverLicenseNo = reader.ReadASCII(18); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.ContinueDrivingStartTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.ContinueDrivingEndTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.GpsStartLng = reader.ReadInt32(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.GpsStartLat = reader.ReadInt32(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.StartHeight = reader.ReadInt16(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.GpsEndLng = reader.ReadInt32(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.GpsEndLat = reader.ReadInt32(); | |||||
jT808_CarDVR_Up_0x11_DriveOverTime.EndHeight = reader.ReadInt16(); | |||||
value.JT808_CarDVR_Up_0x11_DriveOverTimes.Add(jT808_CarDVR_Up_0x11_DriveOverTime); | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x11 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x11; | |||||
foreach (var driveOverTime in value.JT808_CarDVR_Up_0x11_DriveOverTimes) | |||||
{ | |||||
writer.WriteASCII(driveOverTime.DriverLicenseNo.PadRight(18, '0')); | |||||
writer.WriteDateTime6(driveOverTime.ContinueDrivingStartTime); | |||||
writer.WriteDateTime6(driveOverTime.ContinueDrivingEndTime); | |||||
writer.WriteInt32(driveOverTime.GpsStartLng); | |||||
writer.WriteInt32(driveOverTime.GpsStartLat); | |||||
writer.WriteInt16(driveOverTime.StartHeight); | |||||
writer.WriteInt32(driveOverTime.GpsEndLng); | |||||
writer.WriteInt32(driveOverTime.GpsStartLat); | |||||
writer.WriteInt16(driveOverTime.EndHeight); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 单位超时驾驶记录数据块 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x11_DriveOverTime | |||||
{ | |||||
/// <summary> | |||||
/// 机动车驾驶证号码 18位 | |||||
/// </summary> | |||||
public string DriverLicenseNo { get; set; } | |||||
/// <summary> | |||||
/// 连续驾驶开始时间 | |||||
/// </summary> | |||||
public DateTime ContinueDrivingStartTime { get; set; } | |||||
/// <summary> | |||||
/// 连续驾驶结束时间 | |||||
/// </summary> | |||||
public DateTime ContinueDrivingEndTime { get; set; } | |||||
/// <summary> | |||||
/// 经度 | |||||
/// </summary> | |||||
public int GpsStartLng { get; set; } | |||||
/// <summary> | |||||
/// 纬度 | |||||
/// </summary> | |||||
public int GpsStartLat { get; set; } | |||||
/// <summary> | |||||
/// 高度 | |||||
/// </summary> | |||||
public short StartHeight { get; set; } | |||||
/// <summary> | |||||
/// 经度 | |||||
/// </summary> | |||||
public int GpsEndLng { get; set; } | |||||
/// <summary> | |||||
/// 纬度 | |||||
/// </summary> | |||||
public int GpsEndLat { get; set; } | |||||
/// <summary> | |||||
/// 高度 | |||||
/// </summary> | |||||
public short EndHeight { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,77 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的驾驶人身份记录 | |||||
/// 返回:符合条件的驾驶人登录退出记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x12 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的驾驶人身份记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x12_DriveLogin> JT808_CarDVR_Up_0x12_DriveLogins { get; set; } | |||||
public override string Description => "符合条件的驾驶人登录退出记录"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x12 value = new JT808_CarDVR_Up_0x12(); | |||||
value.JT808_CarDVR_Up_0x12_DriveLogins= new List<JT808_CarDVR_Up_0x12_DriveLogin>(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1) / 25;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x12_DriveLogin jT808_CarDVR_Up_0x12_DriveLogin = new JT808_CarDVR_Up_0x12_DriveLogin(); | |||||
jT808_CarDVR_Up_0x12_DriveLogin.LoginTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x12_DriveLogin.DriverLicenseNo = reader.ReadASCII(18); | |||||
jT808_CarDVR_Up_0x12_DriveLogin.LoginType = reader.ReadByte(); | |||||
value.JT808_CarDVR_Up_0x12_DriveLogins.Add(jT808_CarDVR_Up_0x12_DriveLogin); | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x12 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x12; | |||||
foreach (var driveLogin in value.JT808_CarDVR_Up_0x12_DriveLogins) | |||||
{ | |||||
writer.WriteDateTime6(driveLogin.LoginTime); | |||||
writer.WriteASCII(driveLogin.DriverLicenseNo.PadRight(18, '0')); | |||||
writer.WriteByte(driveLogin.LoginType); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 单位驾驶人身份记录数据块格式 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x12_DriveLogin | |||||
{ | |||||
/// <summary> | |||||
/// 登入登出时间发生时间 | |||||
/// </summary> | |||||
public DateTime LoginTime { get; set; } | |||||
/// <summary> | |||||
/// 机动车驾驶证号码 18位 | |||||
/// </summary> | |||||
public string DriverLicenseNo { get; set; } | |||||
/// <summary> | |||||
/// 事件类型 | |||||
/// </summary> | |||||
public byte LoginType { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,71 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的外部供电记录 | |||||
/// 返回:符合条件的供电记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x13 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的外部供电记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x13_ExternalPowerSupply> JT808_CarDVR_Up_0x13_ExternalPowerSupplys { get; set; } | |||||
public override string Description => "符合条件的供电记录"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x13 value = new JT808_CarDVR_Up_0x13(); | |||||
value.JT808_CarDVR_Up_0x13_ExternalPowerSupplys = new List<JT808_CarDVR_Up_0x13_ExternalPowerSupply>(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1) / 7;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x13_ExternalPowerSupply jT808_CarDVR_Up_0x13_ExternalPowerSupply = new JT808_CarDVR_Up_0x13_ExternalPowerSupply(); | |||||
jT808_CarDVR_Up_0x13_ExternalPowerSupply.EventTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x13_ExternalPowerSupply.EventType = reader.ReadByte(); | |||||
value.JT808_CarDVR_Up_0x13_ExternalPowerSupplys.Add(jT808_CarDVR_Up_0x13_ExternalPowerSupply); | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x13 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x13; | |||||
foreach (var externalPowerSupply in value.JT808_CarDVR_Up_0x13_ExternalPowerSupplys) | |||||
{ | |||||
writer.WriteDateTime6(externalPowerSupply.EventTime); | |||||
writer.WriteByte(externalPowerSupply.EventType); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 单位记录仪外部供电记录数据块格式 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x13_ExternalPowerSupply | |||||
{ | |||||
/// <summary> | |||||
/// 事件发生时间 | |||||
/// </summary> | |||||
public DateTime EventTime { get; set; } | |||||
/// <summary> | |||||
/// 事件类型 | |||||
/// </summary> | |||||
public byte EventType { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,71 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的参数修改记录 | |||||
/// 返回:符合条件的参数修改记录 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x14 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的参数修改记录.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x14_ParameterModify> JT808_CarDVR_Up_0x14_ParameterModifys { get; set; } | |||||
public override string Description => "符合条件的参数修改记录"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x14 value = new JT808_CarDVR_Up_0x14(); | |||||
value.JT808_CarDVR_Up_0x14_ParameterModifys = new List<JT808_CarDVR_Up_0x14_ParameterModify>(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1) / 7;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x14_ParameterModify jT808_CarDVR_Up_0x14_ParameterModify = new JT808_CarDVR_Up_0x14_ParameterModify(); | |||||
jT808_CarDVR_Up_0x14_ParameterModify.EventTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x14_ParameterModify.EventType = reader.ReadByte(); | |||||
value.JT808_CarDVR_Up_0x14_ParameterModifys.Add(jT808_CarDVR_Up_0x14_ParameterModify); | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x14 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x14; | |||||
foreach (var parameterModify in value.JT808_CarDVR_Up_0x14_ParameterModifys) | |||||
{ | |||||
writer.WriteDateTime6(parameterModify.EventTime); | |||||
writer.WriteByte(parameterModify.EventType); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 单位记录仪外部供电记录数据块格式 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x14_ParameterModify | |||||
{ | |||||
/// <summary> | |||||
/// 事件发生时间 | |||||
/// </summary> | |||||
public DateTime EventTime { get; set; } | |||||
/// <summary> | |||||
/// 事件类型 | |||||
/// </summary> | |||||
public byte EventType { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,108 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 采集指定的速度状态日志 | |||||
/// 返回:符合条件的速度状态日志 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x15 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.采集指定的速度状态日志.ToByteValue(); | |||||
/// <summary> | |||||
/// 请求发送指定的时间范围内 N 个单位数据块的数据(N≥1) | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x15_SpeedStatusLog> JT808_CarDVR_Up_0x15_SpeedStatusLogs { get; set; } | |||||
public override string Description => "符合条件的速度状态日志"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x15 value = new JT808_CarDVR_Up_0x15(); | |||||
value.JT808_CarDVR_Up_0x15_SpeedStatusLogs = new List<JT808_CarDVR_Up_0x15_SpeedStatusLog>(); | |||||
var count = (reader.ReadCurrentRemainContentLength() - 1 - 1) / 133;//记录块个数, -1 去掉808校验位,-1去掉808尾部标志 | |||||
for (int i = 0; i < count; i++) | |||||
{ | |||||
JT808_CarDVR_Up_0x15_SpeedStatusLog jT808_CarDVR_Up_0x15_SpeedStatusLog = new JT808_CarDVR_Up_0x15_SpeedStatusLog(); | |||||
jT808_CarDVR_Up_0x15_SpeedStatusLog.SpeedStatus = reader.ReadByte(); | |||||
jT808_CarDVR_Up_0x15_SpeedStatusLog.SpeedStatusStartTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x15_SpeedStatusLog.SpeedStatusEndTime = reader.ReadDateTime6(); | |||||
jT808_CarDVR_Up_0x15_SpeedStatusLog.JT808_CarDVR_Up_0x15_SpeedPerSeconds = new List<JT808_CarDVR_Up_0x15_SpeedPerSecond>(); | |||||
for (int j = 0; j < 60; j++)//60组 | |||||
{ | |||||
JT808_CarDVR_Up_0x15_SpeedPerSecond jT808_CarDVR_Up_0X15_SpeedPerSecond = new JT808_CarDVR_Up_0x15_SpeedPerSecond(); | |||||
jT808_CarDVR_Up_0X15_SpeedPerSecond.RecordSpeed = reader.ReadByte(); | |||||
jT808_CarDVR_Up_0X15_SpeedPerSecond.ReferenceSpeed = reader.ReadByte(); | |||||
jT808_CarDVR_Up_0x15_SpeedStatusLog.JT808_CarDVR_Up_0x15_SpeedPerSeconds.Add(jT808_CarDVR_Up_0X15_SpeedPerSecond); | |||||
} | |||||
value.JT808_CarDVR_Up_0x15_SpeedStatusLogs.Add(jT808_CarDVR_Up_0x15_SpeedStatusLog); | |||||
} | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x15 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x15; | |||||
foreach (var speedStatusLog in value.JT808_CarDVR_Up_0x15_SpeedStatusLogs) | |||||
{ | |||||
writer.WriteByte(speedStatusLog.SpeedStatus); | |||||
writer.WriteDateTime6(speedStatusLog.SpeedStatusStartTime); | |||||
writer.WriteDateTime6(speedStatusLog.SpeedStatusEndTime); | |||||
foreach (var speedPerSecond in speedStatusLog.JT808_CarDVR_Up_0x15_SpeedPerSeconds) | |||||
{ | |||||
writer.WriteByte(speedPerSecond.RecordSpeed); | |||||
writer.WriteByte(speedPerSecond.ReferenceSpeed); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 单位速度状态日志数据块格式 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x15_SpeedStatusLog | |||||
{ | |||||
/// <summary> | |||||
/// 记录仪的速度状态 | |||||
/// </summary> | |||||
public byte SpeedStatus { get; set; } | |||||
/// <summary> | |||||
/// 速度状态判定的开始时间 | |||||
/// </summary> | |||||
public DateTime SpeedStatusStartTime { get; set; } | |||||
/// <summary> | |||||
/// 速度状态判定的结束时间 | |||||
/// </summary> | |||||
public DateTime SpeedStatusEndTime { get; set; } | |||||
/// <summary> | |||||
/// 60组 | |||||
/// </summary> | |||||
public List<JT808_CarDVR_Up_0x15_SpeedPerSecond> JT808_CarDVR_Up_0x15_SpeedPerSeconds { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 每秒速度 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x15_SpeedPerSecond | |||||
{ | |||||
/// <summary> | |||||
/// 记录速度 | |||||
/// </summary> | |||||
public byte RecordSpeed { get; set; } | |||||
/// <summary> | |||||
/// 参考速度 | |||||
/// </summary> | |||||
public byte ReferenceSpeed { get; set; } | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置车辆信息 | |||||
/// 返回:车辆信息 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x82 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置车辆信息.ToByteValue(); | |||||
public override string Description => "车辆信息"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x82 value = new JT808_CarDVR_Up_0x82(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x82 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x82; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置记录仪初次安装日期 | |||||
/// 返回:初次安装日期 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x83 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置记录仪初次安装日期.ToByteValue(); | |||||
public override string Description => "初次安装日期"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x83 value = new JT808_CarDVR_Up_0x83(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x83 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x83; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置状态量配置信息 | |||||
/// 返回:状态量配置信息 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0x84 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置状态量配置信息.ToByteValue(); | |||||
public override string Description => "状态量配置信息"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x84 value = new JT808_CarDVR_Up_0x84(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0x84 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0x84; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置记录仪时间 | |||||
/// 返回:北京时间的日期、时钟 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xC2 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置记录仪时间.ToByteValue(); | |||||
public override string Description => "北京时间的日期、时钟"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC2 value = new JT808_CarDVR_Up_0xC2(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC2 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xC2; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置记录仪脉冲系数 | |||||
/// 返回:记录仪脉冲系数 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xC3 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置记录仪脉冲系数.ToByteValue(); | |||||
public override string Description => "记录仪脉冲系数"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC3 value = new JT808_CarDVR_Up_0xC3(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC3 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xC3; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,39 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 设置初始里程 | |||||
/// 返回:记录仪初次安装时车辆已行驶的总里程 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xC4 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.设置初始里程.ToByteValue(); | |||||
public override string Description => "车辆识别代号、机动车号牌号码和机动车号牌分类"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC4 value = new JT808_CarDVR_Up_0xC4(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xC4 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xC4; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 进入或保持检定状态 | |||||
/// 返回:进入或保持检定状态 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xE0 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.进入或保持检定状态.ToByteValue(); | |||||
public override string Description => "进入或保持检定状态"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE0 value = new JT808_CarDVR_Up_0xE0(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE0 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xE0; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 进入里程误差测量 | |||||
/// 返回:通过 DB9 的 7 脚接收标准速度脉冲测量信号(TTL 电平) | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xE1 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.进入里程误差测量.ToByteValue(); | |||||
public override string Description => "通过 DB9 的 7 脚接收标准速度脉冲测量信号(TTL 电平)"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE1 value = new JT808_CarDVR_Up_0xE1(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE1 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xE1; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 进入脉冲系数误差测量 | |||||
/// 返回:通过 DB9 的 7 脚输出车速传感器信号(TTL 电平) | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xE2 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.进入脉冲系数误差测量.ToByteValue(); | |||||
public override string Description => "通过 DB9 的 7 脚输出车速传感器信号(TTL 电平)"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE2 value = new JT808_CarDVR_Up_0xE2(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE2 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xE2; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 进入实时时间误差测量 | |||||
/// 返回:通过 DB9 的 7 脚输出实时时钟的秒脉冲信号(TTL 电平) | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xE3 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.进入实时时间误差测量.ToByteValue(); | |||||
public override string Description => "通过 DB9 的 7 脚输出实时时钟的秒脉冲信号(TTL 电平)"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE3 value = new JT808_CarDVR_Up_0xE3(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE3 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xE3; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,39 @@ | |||||
using JT808.Protocol.Enums; | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.CarDVR | |||||
{ | |||||
/// <summary> | |||||
/// 返回正常工作状态 | |||||
/// 返回:返回正常工作状态 | |||||
/// </summary> | |||||
public class JT808_CarDVR_Up_0xE4 : JT808CarDVRUpBodies, IJT808Analyze | |||||
{ | |||||
public override byte CommandId => JT808CarDVRCommandID.返回正常工作状态.ToByteValue(); | |||||
public override string Description => "返回正常工作状态"; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
} | |||||
public override JT808CarDVRUpBodies Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE4 value = new JT808_CarDVR_Up_0xE4(); | |||||
return value; | |||||
} | |||||
public override void Serialize(ref JT808MessagePackWriter writer, JT808CarDVRUpBodies jT808CarDVRUpBodies, IJT808Config config) | |||||
{ | |||||
JT808_CarDVR_Up_0xE4 value = jT808CarDVRUpBodies as JT808_CarDVR_Up_0xE4; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody | |||||
{ | |||||
public class JT808_0x8700 : JT808Bodies, IJT808MessagePackFormatter<JT808_0x8700>, IJT808_2019_Version, IJT808Analyze | |||||
{ | |||||
public override ushort MsgId => 0x8700; | |||||
public override string Description => "行驶记录数据采集命令"; | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public byte CommandId { get; set; } | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public JT808_0x8700 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8700 value, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -1,29 +0,0 @@ | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT808.Protocol.MessageBody.Recorder | |||||
{ | |||||
/// <summary> | |||||
/// 记录仪数据体 | |||||
/// </summary> | |||||
public abstract class JT808_RecorderBody : IJT808Description | |||||
{ | |||||
/// <summary> | |||||
/// 命令字 | |||||
/// </summary> | |||||
public abstract byte CommandId { get; } | |||||
public abstract JT808_RecorderBody Deserialize(ref JT808MessagePackReader reader, IJT808Config config); | |||||
public abstract void Serialize(ref JT808MessagePackWriter writer, JT808_RecorderBody value, IJT808Config config); | |||||
/// <summary> | |||||
/// 跳过数据体序列化 | |||||
/// 默认不跳过 | |||||
/// 当数据体为空的时候,使用null作为空包感觉不适合,所以就算使用空包也需要new一下来表达意思。 | |||||
/// </summary> | |||||
public virtual bool SkipSerialization { get; set; } = false; | |||||
public abstract string Description { get; } | |||||
} | |||||
} |
@@ -1,41 +0,0 @@ | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.Recorder | |||||
{ | |||||
public class JT808_RecorderHeader: IJT808MessagePackFormatter<JT808_RecorderHeader>, IJT808Analyze | |||||
{ | |||||
/// <summary> | |||||
/// 命令字 | |||||
/// </summary> | |||||
public byte CommandId { get; set; } | |||||
/// <summary> | |||||
/// 数据块长度 | |||||
/// </summary> | |||||
public ushort DataLength { get; set; } | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public JT808_RecorderHeader Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_RecorderHeader value = new JT808_RecorderHeader(); | |||||
value.CommandId = reader.ReadByte(); | |||||
value.DataLength = reader.ReadUInt16(); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_RecorderHeader value, IJT808Config config) | |||||
{ | |||||
writer.WriteByte(value.CommandId); | |||||
writer.WriteUInt16(value.DataLength); | |||||
} | |||||
} | |||||
} |
@@ -1,117 +0,0 @@ | |||||
using JT808.Protocol.Extensions; | |||||
using JT808.Protocol.Formatters; | |||||
using JT808.Protocol.Interfaces; | |||||
using JT808.Protocol.MessagePack; | |||||
using System; | |||||
using System.Buffers.Binary; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Text.Json; | |||||
namespace JT808.Protocol.MessageBody.Recorder | |||||
{ | |||||
/// <summary> | |||||
/// 记录仪 | |||||
/// </summary> | |||||
public class JT808_RecorderPackage : IJT808MessagePackFormatter<JT808_RecorderPackage>, IJT808Analyze | |||||
{ | |||||
public const ushort BeginFlag = 0x557A; | |||||
/// <summary> | |||||
/// 起始字头 | |||||
/// </summary> | |||||
public ushort Begin { get; set; } = BeginFlag; | |||||
/// <summary> | |||||
/// 记录仪头部 | |||||
/// </summary> | |||||
public JT808_RecorderHeader JT808_RecorderHeader { get; set; } | |||||
/// <summary> | |||||
/// 保留字段 | |||||
/// </summary> | |||||
public byte KeepFields { get; set; } = 0x00; | |||||
/// <summary> | |||||
/// 记录仪体 | |||||
/// </summary> | |||||
public JT808_RecorderBody JT808_RecorderBody { get; set; } | |||||
/// <summary> | |||||
/// 校验字 | |||||
/// </summary> | |||||
public byte CheckCode { get; set; } | |||||
/// <summary> | |||||
/// 计算的异或校验码 | |||||
/// </summary> | |||||
public byte CalculateCheckXorCode { get; set; } = 0; | |||||
/// <summary> | |||||
/// 跳过数据体序列化 | |||||
/// 默认不跳过 | |||||
/// 当数据体为空的时候,使用null作为空包感觉不适合,所以就算使用空包也需要new一下来表达意思。 | |||||
/// </summary> | |||||
public virtual bool SkipSerialization { get; set; } = false; | |||||
public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public JT808_RecorderPackage Deserialize(ref JT808MessagePackReader reader, IJT808Config config) | |||||
{ | |||||
JT808_RecorderPackage value = new JT808_RecorderPackage(); | |||||
value.CalculateCheckXorCode = CalculateXorCheckCode(reader); | |||||
value.Begin = reader.ReadUInt16(); | |||||
value.JT808_RecorderHeader = new JT808_RecorderHeader().Deserialize(ref reader, config); | |||||
value.KeepFields = reader.ReadByte(); | |||||
if (value.JT808_RecorderHeader.DataLength > 0) | |||||
{ | |||||
if (config.JT808_Recorder_Factory.Map.TryGetValue(value.JT808_RecorderHeader.CommandId, out var instance)) | |||||
{ | |||||
//4.2.处理消息体 | |||||
value.JT808_RecorderBody = instance.Deserialize(ref reader, config); | |||||
} | |||||
} | |||||
value.CheckCode = reader.ReadByte(); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT808MessagePackWriter writer, JT808_RecorderPackage value, IJT808Config config) | |||||
{ | |||||
var currentPosition = writer.GetCurrentPosition(); | |||||
writer.WriteUInt16(value.Begin); | |||||
value.JT808_RecorderHeader.Serialize(ref writer, value.JT808_RecorderHeader, config); | |||||
writer.WriteByte(value.KeepFields); | |||||
if (value.JT808_RecorderHeader.DataLength > 0) { | |||||
if (config.JT808_Recorder_Factory.Map.TryGetValue(value.JT808_RecorderHeader.CommandId, out var instance)) | |||||
{ | |||||
if (!instance.SkipSerialization) | |||||
{ | |||||
//4.2.处理消息体 | |||||
instance.Serialize(ref writer, value.JT808_RecorderBody, config); | |||||
} | |||||
} | |||||
} | |||||
writer.WriteByte(CalculateXorCheckCode(writer.FlushAndGetRealReadOnlySpan().Slice(currentPosition, writer.GetCurrentPosition() - currentPosition + 1))); | |||||
} | |||||
/// <summary> | |||||
/// 计算校验码 | |||||
/// </summary> | |||||
/// <param name="readOnlySpan"></param> | |||||
/// <returns></returns> | |||||
private byte CalculateXorCheckCode(JT808MessagePackReader reader) { | |||||
var header = reader.GetVirtualReadOnlySpan(5); | |||||
int xorByteLength = 5+1 + BinaryPrimitives.ReadInt16BigEndian(header.Slice(3)); | |||||
var xorReadOnlySpan = reader.GetVirtualReadOnlySpan(xorByteLength); | |||||
return CalculateXorCheckCode(xorReadOnlySpan); | |||||
} | |||||
/// <summary> | |||||
/// 计算校验码 | |||||
/// </summary> | |||||
/// <param name="xorReadOnlySpan"></param> | |||||
/// <returns></returns> | |||||
private byte CalculateXorCheckCode(ReadOnlySpan<byte> xorReadOnlySpan) { | |||||
byte calculateXorCheckCode = 0; | |||||
foreach (var item in xorReadOnlySpan) | |||||
{ | |||||
calculateXorCheckCode = (byte)(calculateXorCheckCode ^ item); | |||||
} | |||||
return calculateXorCheckCode; | |||||
} | |||||
} | |||||
} |
@@ -234,21 +234,6 @@ namespace JT808.Protocol.MessagePack | |||||
string hex = HexUtil.DoHexDump(readOnlySpan, 0, len); | string hex = HexUtil.DoHexDump(readOnlySpan, 0, len); | ||||
return hex; | return hex; | ||||
} | } | ||||
public (byte CalculateXorCheckCode, byte RealXorCheckCode) ReadCarDVRCheckCode(int currentPosition, int bodyLength) | |||||
{ | |||||
//头+ 命令字 + 数据块长度+保留字 | |||||
//2 + 1 + 2 + 1 | |||||
var reader =Reader.Slice(currentPosition, currentPosition+ (2 + 1 + 2 + 1) +bodyLength); | |||||
byte calculateXorCheckCode = 0; | |||||
foreach (var item in reader) | |||||
{ | |||||
calculateXorCheckCode = (byte)(calculateXorCheckCode ^ item); | |||||
} | |||||
var realXorCheckCode = Reader.Slice(currentPosition, currentPosition + (2 + 1 + 2 + 1) + bodyLength + 1)[0]; | |||||
return (calculateXorCheckCode, realXorCheckCode); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// yyMMddHHmmss | /// yyMMddHHmmss | ||||
/// </summary> | /// </summary> | ||||
@@ -326,6 +311,27 @@ namespace JT808.Protocol.MessagePack | |||||
} | } | ||||
return d; | return d; | ||||
} | } | ||||
/// <summary> | |||||
/// YYMMDD | |||||
/// </summary> | |||||
/// <param name="format">D2: 10 X2:16</param> | |||||
public DateTime ReadDateTime3(string format = "X2") | |||||
{ | |||||
DateTime d; | |||||
try | |||||
{ | |||||
var readOnlySpan = GetReadOnlySpan(3); | |||||
d = new DateTime( | |||||
Convert.ToInt32(readOnlySpan[0].ToString(format)) + JT808Constants.DateLimitYear, | |||||
Convert.ToInt32(readOnlySpan[1].ToString(format)), | |||||
Convert.ToInt32(readOnlySpan[2].ToString(format))); | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
d = JT808Constants.UTCBaseTime; | |||||
} | |||||
return d; | |||||
} | |||||
public DateTime ReadUTCDateTime() | public DateTime ReadUTCDateTime() | ||||
{ | { | ||||
DateTime d; | DateTime d; | ||||
@@ -406,5 +412,16 @@ namespace JT808.Protocol.MessagePack | |||||
{ | { | ||||
ReaderCount += count; | ReaderCount += count; | ||||
} | } | ||||
public (byte CalculateXorCheckCode, byte RealXorCheckCode) ReadCarDVRCheckCode(int currentPosition) | |||||
{ | |||||
var reader = Reader.Slice(currentPosition, ReaderCount - currentPosition); | |||||
byte calculateXorCheckCode = 0; | |||||
foreach (var item in reader) | |||||
{ | |||||
calculateXorCheckCode = (byte)(calculateXorCheckCode ^ item); | |||||
} | |||||
var realXorCheckCode = Reader.Slice(ReaderCount + 1)[0]; | |||||
return (calculateXorCheckCode, realXorCheckCode); | |||||
} | |||||
} | } | ||||
} | } |
@@ -211,6 +211,21 @@ namespace JT808.Protocol.MessagePack | |||||
span[3] = Convert.ToByte(value.ToString("dd"), fromBase); | span[3] = Convert.ToByte(value.ToString("dd"), fromBase); | ||||
writer.Advance(4); | writer.Advance(4); | ||||
} | } | ||||
/// <summary> | |||||
/// YYMMDD | |||||
/// BCD[4] | |||||
/// 数据形如:20200101 | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="fromBase"></param> | |||||
public void WriteDateTime3(DateTime value, int fromBase = 16) | |||||
{ | |||||
var span = writer.Free; | |||||
span[0] = Convert.ToByte(value.ToString("yy"), fromBase); | |||||
span[1] = Convert.ToByte(value.ToString("MM"), fromBase); | |||||
span[2] = Convert.ToByte(value.ToString("dd"), fromBase); | |||||
writer.Advance(3); | |||||
} | |||||
public void WriteXor(int start, int end) | public void WriteXor(int start, int end) | ||||
{ | { | ||||
if (start > end) | if (start > end) | ||||
@@ -309,7 +324,7 @@ namespace JT808.Protocol.MessagePack | |||||
} | } | ||||
writer.Advance(byteIndex); | writer.Advance(byteIndex); | ||||
} | } | ||||
public void WirteASCII(string value) | |||||
public void WriteASCII(string value) | |||||
{ | { | ||||
var spanFree = writer.Free; | var spanFree = writer.Free; | ||||
var bytes = Encoding.ASCII.GetBytes(value).AsSpan(); | var bytes = Encoding.ASCII.GetBytes(value).AsSpan(); | ||||
@@ -388,5 +403,15 @@ namespace JT808.Protocol.MessagePack | |||||
{ | { | ||||
return writer.WrittenCount; | return writer.WrittenCount; | ||||
} | } | ||||
public void WriteCarDVRCheckCode(int currentPosition) | |||||
{ | |||||
var carDVRPackage = writer.Written.Slice(currentPosition, writer.WrittenCount- currentPosition); | |||||
byte calculateXorCheckCode = 0; | |||||
foreach (var item in carDVRPackage) | |||||
{ | |||||
calculateXorCheckCode = (byte)(calculateXorCheckCode ^ item); | |||||
} | |||||
WriteByte(calculateXorCheckCode); | |||||
} | |||||
} | } | ||||
} | } |