@@ -120,12 +120,20 @@ | |||
| 1 | 0x1500 | √ | 主链路车辆监管消息 | | |||
| 2 | 0x1501 | √ | 车辆单向监听应答 | | |||
| 3 | 0x1502 | √ | 车辆拍照应答 | | |||
| 4 | 0x1503 | √ | 下发车辆报文应答 | | |||
| 5 | 0x1504 | √ | 上报车辆行驶记录应答 | | |||
| 6 | 0x1505 | √ | 车辆应急接入监管平台应答消息 | | |||
#### 从链路车辆监管消息 | |||
|序号|消息ID|完成情况|消息体名称| | |||
|:------:|:------:|:------:|:------:| | |||
| 1 | 0x9500 | √ | 从链路车辆监管消息 | | |||
| 2 | 0x9501 | √ | 车辆单向监听请求 | | |||
| 3 | 0x9502 | √ | 车辆拍照请求 | | |||
| 4 | 0x9503 | √ | 下发车辆报文请求 | | |||
| 5 | 0x9504 | √ | 上报车辆行驶记录请求 | | |||
| 6 | 0x9505 | √ | 车辆应急接入监管平台请求消息 | | |||
### 车辆静态信息交换类 | |||
@@ -34,12 +34,15 @@ | |||
<ItemGroup> | |||
<Compile Include="JT809Configs\JT809EncryptOptions.cs" /> | |||
<Compile Include="JT809Enums\JT809CommandType.cs" /> | |||
<Compile Include="JT809Enums\JT809ErrorCode.cs" /> | |||
<Compile Include="JT809Enums\JT809BusinessType.cs" /> | |||
<Compile Include="JT809Enums\JT809SubBusinessType.cs" /> | |||
<Compile Include="JT809Enums\JT809VehicleColorType.cs" /> | |||
<Compile Include="JT809Enums\JT809_0x1502_PhotoRspFlag.cs" /> | |||
<Compile Include="JT809Enums\JT809_0x1501_Result.cs" /> | |||
<Compile Include="JT809Enums\JT809_0x1505_Result.cs" /> | |||
<Compile Include="JT809Enums\JT809_0x1503_Result.cs" /> | |||
<Compile Include="JT809Enums\JT809_0x9403_WarnSrc.cs" /> | |||
<Compile Include="JT809Enums\JT809_0x9402_WarnSrc.cs" /> | |||
<Compile Include="JT809Enums\JT809_0x9401_WarnSrc.cs" /> | |||
@@ -0,0 +1,29 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Enums | |||
{ | |||
/// <summary> | |||
/// 命令字ID | |||
/// </summary> | |||
public enum JT809CommandType:byte | |||
{ | |||
记录仪标准版本=0x00, | |||
当前驾驶人信息=0x01, | |||
记录仪时间=0x02, | |||
记录仪累计行驶里程=0x03, | |||
记录仪脉冲系数=0x04, | |||
车辆信息 = 0x05, | |||
记录仪状态信号配置信息 = 0x06, | |||
记录仪唯一性编号 = 0x07, | |||
采集记录仪行驶记录 = 0x08, | |||
采集记录仪位置信息记录 = 0x09, | |||
采集记录仪事故疑点记录 = 0x10, | |||
采集记录仪超时驾驶记录 = 0x11, | |||
采集记录仪驾驶人身份记录=0x12, | |||
采集记录仪外部供电记录=0x13, | |||
采集记录仪参数修改记录 = 0x14, | |||
采集记录仪速度状态日志 = 0x15, | |||
} | |||
} |
@@ -236,19 +236,19 @@ namespace JT809.Protocol.JT809Enums | |||
///下发车辆报文应答 | |||
///</summary> | |||
[Description("下发车辆报文应答")] | |||
//[JT809BodiesType(typeof(JT809_0x1500_0x1503))] | |||
[JT809BodiesType(typeof(JT809_0x1500_0x1503))] | |||
UP_CTRL_MSG_TEXT_INFO_ACK = 0x1503, | |||
///<summary> | |||
///上报车辆行驶记录应答 | |||
///</summary> | |||
[Description("上报车辆行驶记录应答")] | |||
//[JT809BodiesType(typeof(JT809_0x1500_0x1504))] | |||
[JT809BodiesType(typeof(JT809_0x1500_0x1504))] | |||
UP_CTRL_MSG_TAKE_TRAVEL_ACK = 0x1504, | |||
///<summary> | |||
///车辆应急接入监管平台应答消息 | |||
///</summary> | |||
[Description("车辆应急接入监管平台应答消息")] | |||
//[JT809BodiesType(typeof(JT809_0x1500_0x1505))] | |||
[JT809BodiesType(typeof(JT809_0x1500_0x1505))] | |||
UP_CTRL_MSG_EMERGENCY_MONITORING_ACK = 0x1505, | |||
#endregion | |||
@@ -257,26 +257,31 @@ namespace JT809.Protocol.JT809Enums | |||
///车辆单向监听请求 | |||
///</summary> | |||
[Description("车辆单向监听请求")] | |||
[JT809BodiesType(typeof(JT809_0x9500_0x9501))] | |||
DOWN_CTRL_MSG_MONITOR_VEHICLE_REQ = 0x9501, | |||
///<summary> | |||
///车辆拍照请求 | |||
///</summary> | |||
[Description("车辆拍照请求")] | |||
[JT809BodiesType(typeof(JT809_0x9500_0x9502))] | |||
DOWN_CTRL_MSG_TAKE_PHOTO_REQ = 0x9502, | |||
///<summary> | |||
///下发车辆报文请求 | |||
///</summary> | |||
[Description("下发车辆报文请求")] | |||
[JT809BodiesType(typeof(JT809_0x9500_0x9503))] | |||
DOWN_CTRL_MSG_TEXT_INFO = 0x9503, | |||
///<summary> | |||
///上报车辆行驶记录请求 | |||
///</summary> | |||
[Description("上报车辆行驶记录请求")] | |||
[JT809BodiesType(typeof(JT809_0x9500_0x9504))] | |||
DOWN_CTRL_MSG_TAKE_TRAVEL_REQ = 0x9504, | |||
///<summary> | |||
///车辆应急接入监管平台请求消息 | |||
///</summary> | |||
[Description("车辆应急接入监管平台请求消息")] | |||
[JT809BodiesType(typeof(JT809_0x9500_0x9505))] | |||
DOWN_CTRL_MSG_EMERGENCY_MONITORING_REQ = 0x9505, | |||
#endregion | |||
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Enums | |||
{ | |||
/// <summary> | |||
/// 应答结果 | |||
/// </summary> | |||
public enum JT809_0x1503_Result : byte | |||
{ | |||
下发成功 = 0x00, | |||
下发失败 = 0x01, | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Enums | |||
{ | |||
/// <summary> | |||
/// 应答结果 | |||
/// </summary> | |||
public enum JT809_0x1505_Result : byte | |||
{ | |||
车载终端成功收到该命令 = 0x00, | |||
无该车辆 = 0x01, | |||
其它原因失败=0x02 | |||
} | |||
} |
@@ -181,6 +181,13 @@ namespace JT809.Protocol.JT809Extensions | |||
return temp.ToArray(); | |||
} | |||
public static byte[] ReadBytesLittle(ReadOnlySpan<byte> read, ref int offset) | |||
{ | |||
ReadOnlySpan<byte> temp = read.Slice(offset); | |||
offset = offset + temp.Length; | |||
return temp.ToArray(); | |||
} | |||
/// <summary> | |||
/// 数字编码 大端模式、高位在前 | |||
/// </summary> | |||
@@ -1,4 +1,6 @@ | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using JT809.Protocol.JT809Enums; | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
@@ -10,12 +12,59 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public JT809_0x1500_0x1502 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
throw new NotImplementedException(); | |||
int offset = 0; | |||
JT809_0x1500_0x1502 jT809_0X1500_0X1502 = new JT809_0x1500_0x1502(); | |||
jT809_0X1500_0X1502.PhotoRspFlag= (JT809_0x1502_PhotoRspFlag)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Encrypt = (JT809_VehiclePositionEncrypt)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Day = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Month = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Year = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Hour = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Minute = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Second = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Lon = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Lat = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Vec1 = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Vec2 = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Vec3 = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Direction = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Altitude = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.State = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.VehiclePosition.Alarm = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.LensID = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.PhotoLen = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1502.SizeType = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.Type = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1502.Photo = JT809BinaryExtensions.ReadBytesLittle(bytes, ref offset); | |||
readSize = offset; | |||
return jT809_0X1500_0X1502; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1500_0x1502 value) | |||
{ | |||
throw new NotImplementedException(); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.PhotoRspFlag); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.VehiclePosition.Encrypt); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.VehiclePosition.Day); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.VehiclePosition.Month); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.VehiclePosition.Year); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.VehiclePosition.Hour); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.VehiclePosition.Minute); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.VehiclePosition.Second); | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.VehiclePosition.Lon); | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.VehiclePosition.Lat); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.VehiclePosition.Vec1); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.VehiclePosition.Vec2); | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.VehiclePosition.Vec3); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.VehiclePosition.Direction); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.VehiclePosition.Altitude); | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.VehiclePosition.State); | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.VehiclePosition.Alarm); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.LensID); | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.PhotoLen); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.SizeType); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.Type); | |||
offset += JT809BinaryExtensions.WriteBytesLittle(memoryOwner, offset, value.Photo); | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x1500_0x1503Formatter : IJT809Formatter<JT809_0x1500_0x1503> | |||
{ | |||
public JT809_0x1500_0x1503 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x1500_0x1503 jT809_0X1500_0X1503 = new JT809_0x1500_0x1503(); | |||
jT809_0X1500_0X1503.MsgID= JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1503.Result = (JT809Enums.JT809_0x1503_Result)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
readSize = offset; | |||
return jT809_0X1500_0X1503; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1500_0x1503 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.MsgID); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.Result); | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x1500_0x1504Formatter : IJT809Formatter<JT809_0x1500_0x1504> | |||
{ | |||
public JT809_0x1500_0x1504 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x1500_0x1504 jT809_0X1500_0X1504 = new JT809_0x1500_0x1504(); | |||
jT809_0X1500_0X1504.CommandType = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X1500_0X1504.TraveldataLength= JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X1500_0X1504.TraveldataInfo = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, (int)jT809_0X1500_0X1504.TraveldataLength); | |||
readSize = offset; | |||
return jT809_0X1500_0X1504; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1500_0x1504 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.CommandType); | |||
// 先计算内容长度(汉字为两个字节) | |||
offset += 4; | |||
int byteLength = JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.TraveldataInfo); | |||
JT809BinaryExtensions.WriteInt32Little(memoryOwner, offset - 4, byteLength); | |||
offset += byteLength; | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x1500_0x1505Formatter : IJT809Formatter<JT809_0x1500_0x1505> | |||
{ | |||
public JT809_0x1500_0x1505 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x1500_0x1505 jT809_0X1500_0X1505 = new JT809_0x1500_0x1505(); | |||
jT809_0X1500_0X1505.Result = (JT809Enums.JT809_0x1505_Result) JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
readSize = offset; | |||
return jT809_0X1500_0X1505; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x1500_0x1505 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset,(byte)value.Result); | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x9500_0x9501Formatter : IJT809Formatter<JT809_0x9500_0x9501> | |||
{ | |||
public JT809_0x9500_0x9501 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x9500_0x9501 jT809_0X9500_0X9501 = new JT809_0x9500_0x9501(); | |||
jT809_0X9500_0X9501.MonitorTel = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset,20); | |||
readSize = offset; | |||
return jT809_0X9500_0X9501; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9500_0x9501 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.MonitorTel,20); | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x9500_0x9502Formatter : IJT809Formatter<JT809_0x9500_0x9502> | |||
{ | |||
public JT809_0x9500_0x9502 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x9500_0x9502 jT809_0X9500_0X9502 = new JT809_0x9500_0x9502(); | |||
jT809_0X9500_0X9502.LensID = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X9500_0X9502.SizeType = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
readSize = offset; | |||
return jT809_0X9500_0X9502; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9500_0x9502 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.LensID); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.SizeType); | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x9500_0x9503Formatter : IJT809Formatter<JT809_0x9500_0x9503> | |||
{ | |||
public JT809_0x9500_0x9503 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x9500_0x9503 jT809_0X9500_0X9503 = new JT809_0x9500_0x9503(); | |||
jT809_0X9500_0X9503.MsgSequence = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X9500_0X9503.MsgPriority = JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
jT809_0X9500_0X9503.MsgLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); | |||
jT809_0X9500_0X9503.MsgContent = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset,(int)jT809_0X9500_0X9503.MsgLength); | |||
readSize = offset; | |||
return jT809_0X9500_0X9503; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9500_0x9503 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteUInt32Little(memoryOwner, offset, value.MsgSequence); | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, value.MsgPriority); | |||
// 先计算内容长度(汉字为两个字节) | |||
offset += 4; | |||
int byteLength = JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.MsgContent); | |||
JT809BinaryExtensions.WriteInt32Little(memoryOwner, offset - 4, byteLength); | |||
offset += byteLength; | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x9500_0x9504Formatter : IJT809Formatter<JT809_0x9500_0x9504> | |||
{ | |||
public JT809_0x9500_0x9504 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x9500_0x9504 jT809_0X9500_0X9504 = new JT809_0x9500_0x9504(); | |||
jT809_0X9500_0X9504.Command = (JT809Enums.JT809CommandType) JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); | |||
switch (jT809_0X9500_0X9504.Command) | |||
{ | |||
case JT809Enums.JT809CommandType.记录仪标准版本: | |||
case JT809Enums.JT809CommandType.当前驾驶人信息: | |||
case JT809Enums.JT809CommandType.记录仪时间: | |||
case JT809Enums.JT809CommandType.记录仪累计行驶里程: | |||
case JT809Enums.JT809CommandType.记录仪脉冲系数: | |||
case JT809Enums.JT809CommandType.车辆信息: | |||
case JT809Enums.JT809CommandType.记录仪状态信号配置信息: | |||
case JT809Enums.JT809CommandType.记录仪唯一性编号: | |||
break; | |||
case JT809Enums.JT809CommandType.采集记录仪行驶记录: | |||
case JT809Enums.JT809CommandType.采集记录仪位置信息记录: | |||
case JT809Enums.JT809CommandType.采集记录仪事故疑点记录: | |||
case JT809Enums.JT809CommandType.采集记录仪超时驾驶记录: | |||
case JT809Enums.JT809CommandType.采集记录仪驾驶人身份记录: | |||
case JT809Enums.JT809CommandType.采集记录仪外部供电记录: | |||
case JT809Enums.JT809CommandType.采集记录仪参数修改记录: | |||
case JT809Enums.JT809CommandType.采集记录仪速度状态日志: | |||
jT809_0X9500_0X9504.StartTime = JT809BinaryExtensions.ReadDateTimeLittle(bytes, ref offset); | |||
jT809_0X9500_0X9504.EndTime = JT809BinaryExtensions.ReadDateTimeLittle(bytes, ref offset); | |||
jT809_0X9500_0X9504.Max = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
break; | |||
} | |||
readSize = offset; | |||
return jT809_0X9500_0X9504; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9500_0x9504 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteByteLittle(memoryOwner, offset, (byte)value.Command); | |||
switch (value.Command) | |||
{ | |||
case JT809Enums.JT809CommandType.记录仪标准版本: | |||
case JT809Enums.JT809CommandType.当前驾驶人信息: | |||
case JT809Enums.JT809CommandType.记录仪时间: | |||
case JT809Enums.JT809CommandType.记录仪累计行驶里程: | |||
case JT809Enums.JT809CommandType.记录仪脉冲系数: | |||
case JT809Enums.JT809CommandType.车辆信息: | |||
case JT809Enums.JT809CommandType.记录仪状态信号配置信息: | |||
case JT809Enums.JT809CommandType.记录仪唯一性编号: | |||
break; | |||
case JT809Enums.JT809CommandType.采集记录仪行驶记录: | |||
case JT809Enums.JT809CommandType.采集记录仪位置信息记录: | |||
case JT809Enums.JT809CommandType.采集记录仪事故疑点记录: | |||
case JT809Enums.JT809CommandType.采集记录仪超时驾驶记录: | |||
case JT809Enums.JT809CommandType.采集记录仪驾驶人身份记录: | |||
case JT809Enums.JT809CommandType.采集记录仪外部供电记录: | |||
case JT809Enums.JT809CommandType.采集记录仪参数修改记录: | |||
case JT809Enums.JT809CommandType.采集记录仪速度状态日志: | |||
offset += JT809BinaryExtensions.WriteDateTime6Little(memoryOwner, offset, value.StartTime); | |||
offset += JT809BinaryExtensions.WriteDateTime6Little(memoryOwner, offset, value.EndTime); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.Max); | |||
break; | |||
} | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
using JT809.Protocol.JT809Extensions; | |||
using JT809.Protocol.JT809SubMessageBody; | |||
using System; | |||
using System.Buffers; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters | |||
{ | |||
public class JT809_0x9500_0x9505Formatter : IJT809Formatter<JT809_0x9500_0x9505> | |||
{ | |||
public JT809_0x9500_0x9505 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
int offset = 0; | |||
JT809_0x9500_0x9505 jT809_0X9500_0X9505 = new JT809_0x9500_0x9505(); | |||
jT809_0X9500_0X9505.AuthenticationCode= JT809BinaryExtensions.ReadBCD32(bytes, ref offset,10).ToString(); | |||
jT809_0X9500_0X9505.AccessPointName = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 20); | |||
jT809_0X9500_0X9505.UserName = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset,49); | |||
jT809_0X9500_0X9505.Password = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset,22); | |||
jT809_0X9500_0X9505.ServerIP = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, 32); | |||
jT809_0X9500_0X9505.TcpPort = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
jT809_0X9500_0X9505.UdpPort = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||
jT809_0X9500_0X9505.EndTime = JT809BinaryExtensions.ReadDateTimeLittle(bytes, ref offset); | |||
readSize = offset; | |||
return jT809_0X9500_0X9505; | |||
} | |||
public int Serialize(IMemoryOwner<byte> memoryOwner, int offset, JT809_0x9500_0x9505 value) | |||
{ | |||
offset += JT809BinaryExtensions.WriteBCDLittle(memoryOwner, offset, value.AuthenticationCode,4,10); | |||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.AccessPointName,20); | |||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.UserName, 49); | |||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.Password, 22); | |||
offset += JT809BinaryExtensions.WriteStringLittle(memoryOwner, offset, value.ServerIP, 32); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.TcpPort); | |||
offset += JT809BinaryExtensions.WriteUInt16Little(memoryOwner, offset, value.UdpPort); | |||
offset += JT809BinaryExtensions.WriteUTCDateTimeLittle(memoryOwner, offset, value.EndTime); | |||
return offset; | |||
} | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Enums; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 下发车辆报文应答消息 | |||
/// <para>子业务类型标识:UP_CTRL_MSG_TEXT_INFO_ACK</para> | |||
/// <para>描述:下级平台应答上级平台下发的报文是否成功到达指定车辆</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x1500_0x1503Formatter))] | |||
public class JT809_0x1500_0x1503:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 消息ID | |||
/// 对应“下发车辆报文请求消息”中的MSG_ID | |||
/// </summary> | |||
public uint MsgID { get; set; } | |||
/// <summary> | |||
/// 应答结果 | |||
/// </summary> | |||
public JT809_0x1503_Result Result { get; set; } | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 上报车辆行驶记录应答消息 | |||
/// <para>子业务类型标识:UP_CTRL_MSG_TAKE_T'RAVEL_ACK</para> | |||
/// <para>描述:下级平台应答上级平台下发的上报车辆行驶记录请求消息,将车辆行驶记录数据上传至上级平台</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x1500_0x1504Formatter))] | |||
public class JT809_0x1500_0x1504:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 命令字 | |||
/// </summary> | |||
public byte CommandType { get; set; } | |||
/// <summary> | |||
/// 车辆行驶记录数据体长度 | |||
/// </summary> | |||
public uint TraveldataLength { get; set; } | |||
/// <summary> | |||
/// 车辆行驶记录信息 | |||
/// </summary> | |||
public string TraveldataInfo { get; set; } | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Enums; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 车辆应急接入监管平台应答消息 | |||
/// <para>子业务类型标识: UP_CTRL_MSG_EMERGENCY_MONITORING_ACK</para> | |||
/// <para>描述:下级平台应答上级平台下发的车辆应急接入监管平台请求消息应答</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x1500_0x1505Formatter))] | |||
public class JT809_0x1500_0x1505:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 应答结果 | |||
/// </summary> | |||
public JT809_0x1505_Result Result { get; set; } | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 车辆单向监听请求消息 | |||
/// <para>子业务类型标识:DOWN_CTRL_MSG_MONITOR_VEHICLE_REQ</para> | |||
/// <para>描述:上级平台向下级平台下发车辆单向监听清求消息</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x9500_0x9501Formatter))] | |||
public class JT809_0x9500_0x9501:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 回拨电话号码 | |||
/// </summary> | |||
public string MonitorTel { get; set; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 车辆拍照请求消息 | |||
/// <para>子业务类型标识:DOWN_CTRL_MSG_TAKE_PHOTO_REQ</para> | |||
/// <para>描述:上级平台向下级平台下发对某指定车辆的拍照请求消息</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x9500_0x9502Formatter))] | |||
public class JT809_0x9500_0x9502:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 镜头ID | |||
/// </summary> | |||
public byte LensID { get; set; } | |||
/// <summary> | |||
/// 图片大小 | |||
/// </summary> | |||
public byte SizeType { get; set; } | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 下发车辆报文请求 | |||
/// <para>子业务类型标识:DOWN_CTRL_MSG_TEXT_INFO</para> | |||
/// <para>描述:用于上级平台向下级平台下发报文到某指定车辆</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x9500_0x9503Formatter))] | |||
public class JT809_0x9500_0x9503:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 消息ID序号 | |||
/// </summary> | |||
public uint MsgSequence { get; set; } | |||
/// <summary> | |||
/// 报文优先级 | |||
/// </summary> | |||
public byte MsgPriority { get; set; } | |||
/// <summary> | |||
/// 报文信息长度 | |||
/// </summary> | |||
public uint MsgLength { get; set; } | |||
/// <summary> | |||
/// 报文信息内容 | |||
/// </summary> | |||
public string MsgContent { get; set; } | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Enums; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 上报车辆行驶记录请求消息 | |||
/// <para>子业务类型标识:DOVJN_CTRL_MSG_TAKE_TRAVEL_REQ</para> | |||
/// <para>描述:上级平台向下级平台下发上报车辆行驶记录请求消息</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x9500_0x9504Formatter))] | |||
public class JT809_0x9500_0x9504:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 命令字ID | |||
/// </summary> | |||
public JT809CommandType Command { get; set; } | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime StartTime { get; set; } | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime EndTime { get; set; } | |||
/// <summary> | |||
/// 最大数据数 | |||
/// </summary> | |||
public ushort Max { get; set; } | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
using JT809.Protocol.JT809Attributes; | |||
using JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT809.Protocol.JT809SubMessageBody | |||
{ | |||
/// <summary> | |||
/// 车辆应急接入监管平台请求消息 | |||
/// <para>子业务类型标识:UP_CTRL_MSG_EMERGENCY_MONITORING_REQ</para> | |||
/// <para>描述:发生应急情况时,政府监管平台需要及时监控该车辆时,就向该车辆归属的下级平台发送该命令</para> | |||
/// </summary> | |||
[JT809Formatter(typeof(JT809_0x9500_0x9505Formatter))] | |||
public class JT809_0x9500_0x9505:JT809SubBodies | |||
{ | |||
/// <summary> | |||
/// 监管平台下发的鉴权码 | |||
/// </summary> | |||
public string AuthenticationCode { get; set; } | |||
/// <summary> | |||
/// 拨号点名称 | |||
/// </summary> | |||
public string AccessPointName { get; set; } | |||
/// <summary> | |||
/// 拨号用户名 | |||
/// </summary> | |||
public string UserName { get; set; } | |||
/// <summary> | |||
/// 拨号密码 | |||
/// </summary> | |||
public string Password { get; set; } | |||
/// <summary> | |||
/// 地址 | |||
/// </summary> | |||
public string ServerIP { get; set; } | |||
/// <summary> | |||
/// 服务器TCP端口 | |||
/// </summary> | |||
public ushort TcpPort { get; set; } | |||
/// <summary> | |||
/// 服务器UDP端口 | |||
/// </summary> | |||
public ushort UdpPort { get; set; } | |||
/// <summary> | |||
/// 结束时间 | |||
/// </summary> | |||
public DateTime EndTime { get; set; } | |||
} | |||
} |