@@ -22,7 +22,7 @@ namespace JT809.Protocol.Test.JT809SubMessageBody | |||||
Command= JT809CommandType.采集记录仪事故疑点记录, | Command= JT809CommandType.采集记录仪事故疑点记录, | ||||
StartTime=DateTime.Parse("2018-09-27 20:00:20"), | StartTime=DateTime.Parse("2018-09-27 20:00:20"), | ||||
EndTime=DateTime.Parse("2018-09-27 23:00:20"), | EndTime=DateTime.Parse("2018-09-27 23:00:20"), | ||||
Max=5556 | |||||
//Max=5556 | |||||
}; | }; | ||||
var hex = JT809Serializer.Serialize(jT809_0X9500_0X9504).ToHexString(); | var hex = JT809Serializer.Serialize(jT809_0X9500_0X9504).ToHexString(); | ||||
//"10 18 09 27 20 00 20 18 09 27 23 00 20 15 B4" | //"10 18 09 27 20 00 20 18 09 27 23 00 20 15 B4" | ||||
@@ -39,7 +39,7 @@ namespace JT809.Protocol.Test.JT809SubMessageBody | |||||
Assert.Equal(JT809CommandType.采集记录仪事故疑点记录, jT809_0X9500_0X9504.Command); | Assert.Equal(JT809CommandType.采集记录仪事故疑点记录, jT809_0X9500_0X9504.Command); | ||||
Assert.Equal(DateTime.Parse("2018-09-27 20:00:20"), jT809_0X9500_0X9504.StartTime); | Assert.Equal(DateTime.Parse("2018-09-27 20:00:20"), jT809_0X9500_0X9504.StartTime); | ||||
Assert.Equal(DateTime.Parse("2018-09-27 23:00:20"), jT809_0X9500_0X9504.EndTime); | Assert.Equal(DateTime.Parse("2018-09-27 23:00:20"), jT809_0X9500_0X9504.EndTime); | ||||
Assert.Equal(5556, jT809_0X9500_0X9504.Max); | |||||
//Assert.Equal(5556, jT809_0X9500_0X9504.Max); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -228,7 +228,7 @@ namespace JT809.Protocol.Enums | |||||
[JT809BusinessTypeDescription("DOWN_PLATFORM_MSG", "从链路平台间信息交互业务")] | [JT809BusinessTypeDescription("DOWN_PLATFORM_MSG", "从链路平台间信息交互业务")] | ||||
从链路平台间信息交互业务 = 0x9300, | 从链路平台间信息交互业务 = 0x9300, | ||||
#endregion | #endregion | ||||
#region 车辆报警信息交互类 | |||||
#region 车辆报警信息交互类(2013) 报警信息交互业务类(2019) | |||||
///<summary> | ///<summary> | ||||
///主链路报警信息交互消息 | ///主链路报警信息交互消息 | ||||
///UP_WARN_MSG | ///UP_WARN_MSG | ||||
@@ -107,6 +107,16 @@ namespace JT809.Protocol.Enums | |||||
[JT809BodiesType(typeof(JT809_0x1200_0x120D))] | [JT809BodiesType(typeof(JT809_0x1200_0x120D))] | ||||
[JT809SubBusinessTypeDescription("UP_EXG_MSG_REPORT_EWAYBILL_INFO", "主动上报车辆电子运单信息", JT809BusinessType.主链路车辆动态信息交换业务)] | [JT809SubBusinessTypeDescription("UP_EXG_MSG_REPORT_EWAYBILL_INFO", "主动上报车辆电子运单信息", JT809BusinessType.主链路车辆动态信息交换业务)] | ||||
主动上报车辆电子运单信息 = 0x120D, | 主动上报车辆电子运单信息 = 0x120D, | ||||
///<summary> | |||||
///主动上报车辆行驶路线信息 | |||||
///UP_EXG_MSG_DRVLINE_INFO | |||||
///</summary> | |||||
[Description("主动上报车辆行驶路线信息")] | |||||
[JT809BodiesType(typeof(JT809_0x1200_0x120E))] | |||||
[JT809SubBusinessTypeDescription("UP_EXG_MSG_DRVLINE_INFO", "主动上报车辆行驶路线信息", JT809BusinessType.主链路车辆动态信息交换业务)] | |||||
主动上报车辆行驶路线信息 = 0x120E, | |||||
#endregion | #endregion | ||||
#region 从链路动态信息交换消息 DOWN_EXG_MSG | #region 从链路动态信息交换消息 DOWN_EXG_MSG | ||||
@@ -189,6 +199,22 @@ namespace JT809.Protocol.Enums | |||||
[JT809BodiesType(typeof(JT809_0x9200_0x920B))] | [JT809BodiesType(typeof(JT809_0x9200_0x920B))] | ||||
[JT809SubBusinessTypeDescription("DOWN_EXG_MSG_TAKE_EWAYBILL_REQ", "上报车辆电子运单请求消息", JT809BusinessType.从链路车辆动态信息交换业务)] | [JT809SubBusinessTypeDescription("DOWN_EXG_MSG_TAKE_EWAYBILL_REQ", "上报车辆电子运单请求消息", JT809BusinessType.从链路车辆动态信息交换业务)] | ||||
上报车辆电子运单请求消息 = 0x920B, | 上报车辆电子运单请求消息 = 0x920B, | ||||
///<summary> | |||||
///上报车辆车辆行驶路线请求 | |||||
///DOWN_BASE_MSG_DRVLINE_REQ | |||||
///</summary> | |||||
[Description("上报车辆车辆行驶路线请求")] | |||||
[JT809BodiesType(typeof(JT809_0x9200_0x920C))] | |||||
[JT809SubBusinessTypeDescription("DOWN_BASE_MSG_DRVLINE_REQ", "上报车辆车辆行驶路线请求", JT809BusinessType.从链路车辆动态信息交换业务)] | |||||
上报车辆车辆行驶路线请求 = 0x920C, | |||||
///<summary> | |||||
///车辆行驶线路请求应答 | |||||
///DOWN_BASE_MSG_DRVLINE_ACK | |||||
///</summary> | |||||
[Description("车辆行驶线路请求应答")] | |||||
[JT809BodiesType(typeof(JT809_0x9200_0x920D))] | |||||
[JT809SubBusinessTypeDescription("DOWN_BASE_MSG_DRVLINE_ACK", "车辆行驶线路请求应答", JT809BusinessType.从链路车辆动态信息交换业务)] | |||||
车辆行驶线路请求应答 = 0x920B, | |||||
#endregion | #endregion | ||||
#region 主链路平台信息交互消息 UP_PLATFORM_MSG | #region 主链路平台信息交互消息 UP_PLATFORM_MSG | ||||
@@ -208,6 +234,15 @@ namespace JT809.Protocol.Enums | |||||
[JT809BodiesType(typeof(JT809_0x1300_0x1302))] | [JT809BodiesType(typeof(JT809_0x1300_0x1302))] | ||||
[JT809SubBusinessTypeDescription("UP_PLATFORM_MSG_INFO_ACK", "下发平台间报文应答消息", JT809BusinessType.主链路平台间信息交互消息)] | [JT809SubBusinessTypeDescription("UP_PLATFORM_MSG_INFO_ACK", "下发平台间报文应答消息", JT809BusinessType.主链路平台间信息交互消息)] | ||||
下发平台间报文应答消息 = 0x1302, | 下发平台间报文应答消息 = 0x1302, | ||||
///<summary> | |||||
///上传平台间消息补传请求消息 | |||||
///UP_PLATFORM_MSG_RETRAN_REQ | |||||
///</summary> | |||||
[Description("上传平台间消息补传请求消息")] | |||||
[JT809BodiesType(typeof(JT809_0x1300_0x1303))] | |||||
[JT809SubBusinessTypeDescription("UP_PLATFORM_MSG_RETRAN_REQ", "上传平台间消息补传请求消息", JT809BusinessType.主链路平台间信息交互消息)] | |||||
上传平台间消息补传请求消息 = 0x1303, | |||||
#endregion | #endregion | ||||
#region 从链路平台信息交互消息 DOWN_PLATFORM_MSG | #region 从链路平台信息交互消息 DOWN_PLATFORM_MSG | ||||
@@ -227,6 +262,15 @@ namespace JT809.Protocol.Enums | |||||
[JT809BodiesType(typeof(JT809_0x9300_0x9302))] | [JT809BodiesType(typeof(JT809_0x9300_0x9302))] | ||||
[JT809SubBusinessTypeDescription("DOWN_PLATFORM_MSG_INFO_REQ", "下发平台间报文请求", JT809BusinessType.从链路平台间信息交互业务)] | [JT809SubBusinessTypeDescription("DOWN_PLATFORM_MSG_INFO_REQ", "下发平台间报文请求", JT809BusinessType.从链路平台间信息交互业务)] | ||||
下发平台间报文请求 = 0x9302, | 下发平台间报文请求 = 0x9302, | ||||
///<summary> | |||||
///下发平台间消息补传请求消息 | |||||
///DOWN_PLATFORM_MSG_RETRAN_REQ | |||||
///</summary> | |||||
[Description("下发平台间消息补传请求消息")] | |||||
[JT809BodiesType(typeof(JT809_0x9300_0x9303))] | |||||
[JT809SubBusinessTypeDescription("DOWN_PLATFORM_MSG_RETRAN_REQ", "下发平台间消息补传请求消息", JT809BusinessType.从链路平台间信息交互业务)] | |||||
下发平台间消息补传请求消息 = 0x9303, | |||||
#endregion | #endregion | ||||
#region 主链路报警信息交互消息 UP_WARN_MSG | #region 主链路报警信息交互消息 UP_WARN_MSG | ||||
@@ -247,13 +291,38 @@ namespace JT809.Protocol.Enums | |||||
[JT809SubBusinessTypeDescription("UP_WARN_MSG_ADPT_INFO", "上报报警信息消息", JT809BusinessType.主链路报警信息交互消息)] | [JT809SubBusinessTypeDescription("UP_WARN_MSG_ADPT_INFO", "上报报警信息消息", JT809BusinessType.主链路报警信息交互消息)] | ||||
上报报警信息消息 = 0x1402, | 上报报警信息消息 = 0x1402, | ||||
///<summary> | ///<summary> | ||||
///主动上报报警处理结果信息 | |||||
///上报报警督办应答消息 | |||||
///UP_WARN_MSG_URGE_TODO_ACK_INFO | |||||
///</summary> | |||||
[Description("上报报警督办应答消息")] | |||||
[JT809BodiesType(typeof(JT809_0x1400_0x1411))] | |||||
[JT809SubBusinessTypeDescription("UP_WARN_MSG_URGE_TODO_ACK_INFO", "上报报警督办应答消息", JT809BusinessType.主链路报警信息交互消息)] | |||||
上报报警督办应答消息 = 0x1411, | |||||
///<summary> | |||||
///主动上报报警处理结果消息 | |||||
///UP_WARN_MSG_ADPT_TODO_INFO | ///UP_WARN_MSG_ADPT_TODO_INFO | ||||
///</summary> | ///</summary> | ||||
[Description("主动上报报警处理结果信息")] | |||||
[Description("主动上报报警处理结果消息")] | |||||
[JT809BodiesType(typeof(JT809_0x1400_0x1412))] | |||||
[JT809SubBusinessTypeDescription("UP_WARN_MSG_URGE_TODO_ACK_INFO", "主动上报报警处理结果消息", JT809BusinessType.主链路报警信息交互消息)] | |||||
主动上报报警处理结果消息 = 0x1412, | |||||
///<summary> | |||||
///上报报警督办请求消息 | |||||
///UP_WARN_MSG_URGE_TODO_REQ_INFO | |||||
///</summary> | |||||
[Description("上报报警督办请求消息")] | |||||
[JT809BodiesType(typeof(JT809_0x1400_0x1413))] | |||||
[JT809SubBusinessTypeDescription("UP_WARN_MSG_URGE_TODO_REQ_INFO", "上报报警督办请求消息", JT809BusinessType.主链路报警信息交互消息)] | |||||
上报报警督办请求消息 = 0x1413, | |||||
///<summary> | |||||
///主动上报报警处理结果信息2013_上报报警预警信息2019 | |||||
///UP_WARN_MSG_ADPT_TODO_INFO_2013_UP_WARN_MSG_INFORM_TIPS_2019 | |||||
///</summary> | |||||
[Description("主动上报报警处理结果信息2013_上报报警预警信息2019")] | |||||
[JT809BodiesType(typeof(JT809_0x1400_0x1403))] | [JT809BodiesType(typeof(JT809_0x1400_0x1403))] | ||||
[JT809SubBusinessTypeDescription("UP_WARN_MSG_ADPT_TODO_INFO", "主动上报报警处理结果信息", JT809BusinessType.主链路报警信息交互消息)] | |||||
主动上报报警处理结果信息 = 0x1403, | |||||
[JT809SubBusinessTypeDescription("UP_WARN_MSG_ADPT_TODO_INFO_2013_UP_WARN_MSG_INFORM_TIPS_2019", "主动上报报警处理结果信息2013_上报报警预警信息2019", JT809BusinessType.主链路报警信息交互消息)] | |||||
主动上报报警处理结果信息2013_上报报警预警信息2019 = 0x1403, | |||||
#endregion | #endregion | ||||
#region 从链路报警信息交互消息 DOWN_WARN_MSG | #region 从链路报警信息交互消息 DOWN_WARN_MSG | ||||
@@ -266,13 +335,13 @@ namespace JT809.Protocol.Enums | |||||
[JT809SubBusinessTypeDescription("DOWN_WARN_MSG_URGE_TODO_REQ", "报警督办请求消息", JT809BusinessType.从链路报警信息交互消息)] | [JT809SubBusinessTypeDescription("DOWN_WARN_MSG_URGE_TODO_REQ", "报警督办请求消息", JT809BusinessType.从链路报警信息交互消息)] | ||||
报警督办请求消息 = 0x9401, | 报警督办请求消息 = 0x9401, | ||||
///<summary> | ///<summary> | ||||
///报警预警 | |||||
///报警预警2013_下发报警预警消息2019 | |||||
///DOWN_WARN_MSG_INFORM_TIPS | ///DOWN_WARN_MSG_INFORM_TIPS | ||||
///</summary> | ///</summary> | ||||
[Description("报警预警")] | |||||
[Description("报警预警2013_下发报警预警消息2019")] | |||||
[JT809BodiesType(typeof(JT809_0x9400_0x9402))] | [JT809BodiesType(typeof(JT809_0x9400_0x9402))] | ||||
[JT809SubBusinessTypeDescription("DOWN_WARN_MSG_INFORM_TIPS", "报警预警", JT809BusinessType.从链路报警信息交互消息)] | |||||
报警预警 = 0x9402, | |||||
[JT809SubBusinessTypeDescription("DOWN_WARN_MSG_INFORM_TIPS", "报警预警2013_下发报警预警消息2019", JT809BusinessType.从链路报警信息交互消息)] | |||||
报警预警2013_下发报警预警消息2019 = 0x9402, | |||||
///<summary> | ///<summary> | ||||
///实时交换报警信息 | ///实时交换报警信息 | ||||
///DOWN_WARN_MSG_EXG_INFORM | ///DOWN_WARN_MSG_EXG_INFORM | ||||
@@ -0,0 +1,17 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.Enums | |||||
{ | |||||
/// <summary> | |||||
/// 报警处理结果 | |||||
/// </summary> | |||||
public enum JT809_0x1411_Result : byte | |||||
{ | |||||
处理中 = 0x00, | |||||
已处理完毕 = 0x01, | |||||
不做处理 = 0x02, | |||||
将来处理 = 0x03 | |||||
} | |||||
} |
@@ -0,0 +1,17 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.Enums | |||||
{ | |||||
/// <summary> | |||||
/// 报警处理结果 | |||||
/// </summary> | |||||
public enum JT809_0x1412_Result : byte | |||||
{ | |||||
处理中 = 0x00, | |||||
已处理完毕 = 0x01, | |||||
不做处理 = 0x02, | |||||
将来处理 = 0x03 | |||||
} | |||||
} |
@@ -0,0 +1,15 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.Enums | |||||
{ | |||||
/// <summary> | |||||
/// 报警处理结果 | |||||
/// </summary> | |||||
public enum JT809_0x1413_SupervisionLevel : byte | |||||
{ | |||||
紧急 = 0x00, | |||||
一般 = 0x01, | |||||
} | |||||
} |
@@ -67,6 +67,9 @@ | |||||
<Compile Include="Enums\JT809VehicleColorType.cs" /> | <Compile Include="Enums\JT809VehicleColorType.cs" /> | ||||
<Compile Include="Enums\JT809WarnSrc.cs" /> | <Compile Include="Enums\JT809WarnSrc.cs" /> | ||||
<Compile Include="Enums\JT809WarnType.cs" /> | <Compile Include="Enums\JT809WarnType.cs" /> | ||||
<Compile Include="Enums\JT809_0x1413_SupervisionLevel.cs" /> | |||||
<Compile Include="Enums\JT809_0x1412_Result.cs" /> | |||||
<Compile Include="Enums\JT809_0x1411_Result.cs" /> | |||||
<Compile Include="Enums\JT809_0x1502_PhotoRspFlag.cs" /> | <Compile Include="Enums\JT809_0x1502_PhotoRspFlag.cs" /> | ||||
<Compile Include="Enums\JT809_0x1501_Result.cs" /> | <Compile Include="Enums\JT809_0x1501_Result.cs" /> | ||||
<Compile Include="Enums\JT809_0x1505_Result.cs" /> | <Compile Include="Enums\JT809_0x1505_Result.cs" /> | ||||
@@ -2,6 +2,7 @@ | |||||
using JT809.Protocol.Exceptions; | using JT809.Protocol.Exceptions; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using JT809.Protocol.Formatters; | using JT809.Protocol.Formatters; | ||||
using JT809.Protocol.Interfaces; | |||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
namespace JT809.Protocol.MessageBody | namespace JT809.Protocol.MessageBody | ||||
@@ -14,7 +15,7 @@ namespace JT809.Protocol.MessageBody | |||||
/// <para>业务数据类型标识:UP_WARN_MSG</para> | /// <para>业务数据类型标识:UP_WARN_MSG</para> | ||||
/// <para>描述:下级平台向上级平台发送车辆报警信息业务</para> | /// <para>描述:下级平台向上级平台发送车辆报警信息业务</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x1400: JT809ExchangeMessageBodies, IJT809MessagePackFormatter<JT809_0x1400> | |||||
public class JT809_0x1400: JT809ExchangeMessageBodies, IJT809MessagePackFormatter<JT809_0x1400>, IJT809_2019_Version | |||||
{ | { | ||||
public override ushort MsgId => JT809BusinessType.主链路报警信息交互消息.ToUInt16Value(); | public override ushort MsgId => JT809BusinessType.主链路报警信息交互消息.ToUInt16Value(); | ||||
public override string Description => "主链路报警信息交互消息"; | public override string Description => "主链路报警信息交互消息"; | ||||
@@ -23,9 +24,12 @@ namespace JT809.Protocol.MessageBody | |||||
public JT809_0x1400 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x1400 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x1400 value = new JT809_0x1400(); | JT809_0x1400 value = new JT809_0x1400(); | ||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
value.SubBusinessType = reader.ReadUInt16(); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
value.SubBusinessType = reader.ReadUInt16(); | |||||
} | |||||
value.DataLength = reader.ReadUInt32(); | value.DataLength = reader.ReadUInt32(); | ||||
try | try | ||||
{ | { | ||||
@@ -51,8 +55,11 @@ namespace JT809.Protocol.MessageBody | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteStringPadRight(value.VehicleNo, 21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteStringPadRight(value.VehicleNo, 21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
} | |||||
writer.WriteUInt16(value.SubBusinessType); | writer.WriteUInt16(value.SubBusinessType); | ||||
try | try | ||||
{ | { | ||||
@@ -3,6 +3,7 @@ using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Exceptions; | using JT809.Protocol.Exceptions; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using JT809.Protocol.Formatters; | using JT809.Protocol.Formatters; | ||||
using JT809.Protocol.Interfaces; | |||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
namespace JT809.Protocol.MessageBody | namespace JT809.Protocol.MessageBody | ||||
@@ -14,7 +15,7 @@ namespace JT809.Protocol.MessageBody | |||||
/// <para>业务数据类型标识:DOWN_WARN_MSG</para> | /// <para>业务数据类型标识:DOWN_WARN_MSG</para> | ||||
/// <para>描述:上级平台向下级平台发送报瞥信息业务</para> | /// <para>描述:上级平台向下级平台发送报瞥信息业务</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x9400: JT809ExchangeMessageBodies, IJT809MessagePackFormatter<JT809_0x9400> | |||||
public class JT809_0x9400: JT809ExchangeMessageBodies, IJT809MessagePackFormatter<JT809_0x9400>, IJT809_2019_Version | |||||
{ | { | ||||
public override ushort MsgId => JT809BusinessType.从链路报警信息交互消息.ToUInt16Value(); | public override ushort MsgId => JT809BusinessType.从链路报警信息交互消息.ToUInt16Value(); | ||||
public override string Description => "从链路报警信息交互消息"; | public override string Description => "从链路报警信息交互消息"; | ||||
@@ -22,8 +23,11 @@ namespace JT809.Protocol.MessageBody | |||||
public JT809_0x9400 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x9400 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x9400 value = new JT809_0x9400(); | JT809_0x9400 value = new JT809_0x9400(); | ||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
} | |||||
value.SubBusinessType = reader.ReadUInt16(); | value.SubBusinessType = reader.ReadUInt16(); | ||||
value.DataLength = reader.ReadUInt32(); | value.DataLength = reader.ReadUInt32(); | ||||
try | try | ||||
@@ -50,8 +54,11 @@ namespace JT809.Protocol.MessageBody | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteStringPadRight(value.VehicleNo, 21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteStringPadRight(value.VehicleNo, 21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
} | |||||
writer.WriteUInt16(value.SubBusinessType); | writer.WriteUInt16(value.SubBusinessType); | ||||
try | try | ||||
{ | { | ||||
@@ -0,0 +1,34 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | |||||
using JT809.Protocol.Extensions; | |||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 主动上报车辆行驶路线信息 | |||||
/// <para>子业务类型标识:UP_EXG_MSG_DRVLINE_INFO</para> | |||||
/// </summary> | |||||
public class JT809_0x1200_0x120E:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1200_0x120E>, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.主动上报车辆行驶路线信息.ToUInt16Value(); | |||||
public override string Description => "主动上报车辆行驶路线信息"; | |||||
/// <summary> | |||||
/// 路线信息 按照808-2019中8606规定的报文格式 | |||||
/// </summary> | |||||
public byte[] DRVLine { get; set; } | |||||
public JT809_0x1200_0x120E Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | |||||
{ | |||||
var value = new JT809_0x1200_0x120E(); | |||||
value.DRVLine = reader.ReadArray(reader.ReadCurrentRemainContentLength()).ToArray(); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1200_0x120E value, IJT809Config config) | |||||
{ | |||||
writer.WriteArray(value.DRVLine); | |||||
} | |||||
} | |||||
} |
@@ -2,6 +2,7 @@ | |||||
using JT809.Protocol.Formatters; | using JT809.Protocol.Formatters; | ||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | namespace JT809.Protocol.SubMessageBody | ||||
{ | { | ||||
@@ -10,7 +11,7 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// <para>子业务类型标识:UP_PLATFORM_MSG_POST_QUERY_ACK</para> | /// <para>子业务类型标识:UP_PLATFORM_MSG_POST_QUERY_ACK</para> | ||||
/// <para>描述:下级平台应答上级平台发送的不定期平台查岗消息</para> | /// <para>描述:下级平台应答上级平台发送的不定期平台查岗消息</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x1300_0x1301:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1300_0x1301> | |||||
public class JT809_0x1300_0x1301:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1300_0x1301>, IJT809_2019_Version | |||||
{ | { | ||||
public override ushort SubMsgId => JT809SubBusinessType.平台查岗应答消息.ToUInt16Value(); | public override ushort SubMsgId => JT809SubBusinessType.平台查岗应答消息.ToUInt16Value(); | ||||
@@ -20,10 +21,31 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// </summary> | /// </summary> | ||||
public JT809_0x1301_ObjectType ObjectType { get; set; } | public JT809_0x1301_ObjectType ObjectType { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 查岗应答人姓名 | |||||
/// </summary> | |||||
public string Responder { get; set; } | |||||
/// <summary> | |||||
/// 查岗应答人联系电话 | |||||
/// </summary> | |||||
public string ResponderTel { get; set; } | |||||
/// <summary> | |||||
/// 查岗对象的ID | /// 查岗对象的ID | ||||
/// </summary> | /// </summary> | ||||
public string ObjectID { get; set; } | public string ObjectID { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 查岗对象的ID | |||||
/// 20位 | |||||
/// </summary> | |||||
public string ObjectID_2019 { get; set; } | |||||
/// <summary> | |||||
/// 对应平台查岗请求消息源子业务类型标识 | |||||
/// </summary> | |||||
public ushort SourceDataType { get; set; } | |||||
/// <summary> | |||||
/// 对应平台查岗请求消息源报文序列号 | |||||
/// </summary> | |||||
public uint SourceMsgSn { get; set; } | |||||
/// <summary> | |||||
/// 信息ID | /// 信息ID | ||||
/// </summary> | /// </summary> | ||||
public uint InfoID { get; set; } | public uint InfoID { get; set; } | ||||
@@ -37,20 +59,40 @@ namespace JT809.Protocol.SubMessageBody | |||||
public string InfoContent { get; set; } | public string InfoContent { get; set; } | ||||
public JT809_0x1300_0x1301 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x1300_0x1301 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x1300_0x1301 jT809_0X1200_0X1301 = new JT809_0x1300_0x1301(); | |||||
jT809_0X1200_0X1301.ObjectType = (JT809_0x1301_ObjectType)reader.ReadByte(); | |||||
jT809_0X1200_0X1301.ObjectID = reader.ReadString(12); | |||||
jT809_0X1200_0X1301.InfoID = reader.ReadUInt32(); | |||||
jT809_0X1200_0X1301.InfoLength = reader.ReadUInt32(); | |||||
jT809_0X1200_0X1301.InfoContent = reader.ReadString((int)jT809_0X1200_0X1301.InfoLength); | |||||
return jT809_0X1200_0X1301; | |||||
var value = new JT809_0x1300_0x1301(); | |||||
value.ObjectType = (JT809_0x1301_ObjectType)reader.ReadByte(); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
value.ObjectID = reader.ReadString(12); | |||||
value.InfoID = reader.ReadUInt32(); | |||||
} | |||||
else { | |||||
value.Responder = reader.ReadString(16); | |||||
value.ResponderTel = reader.ReadString(20); | |||||
value.ObjectID_2019 = reader.ReadString(20); | |||||
value.SourceDataType = reader.ReadUInt16(); | |||||
value.SourceMsgSn = reader.ReadUInt32(); | |||||
} | |||||
value.InfoLength = reader.ReadUInt32(); | |||||
value.InfoContent = reader.ReadString((int)value.InfoLength); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1300_0x1301 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1300_0x1301 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteByte((byte)value.ObjectType); | writer.WriteByte((byte)value.ObjectType); | ||||
writer.WriteStringPadRight(value.ObjectID, 12); | |||||
writer.WriteUInt32(value.InfoID); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteStringPadRight(value.ObjectID, 12); | |||||
writer.WriteUInt32(value.InfoID); | |||||
} | |||||
else { | |||||
writer.WriteStringPadRight(value.Responder, 16); | |||||
writer.WriteStringPadRight(value.ResponderTel, 20); | |||||
writer.WriteStringPadRight(value.ObjectID_2019, 20); | |||||
writer.WriteUInt16(value.SourceDataType); | |||||
writer.WriteUInt32(value.SourceMsgSn); | |||||
} | |||||
// 先计算内容长度(汉字为两个字节) | // 先计算内容长度(汉字为两个字节) | ||||
writer.Skip(4, out int lengthPosition); | writer.Skip(4, out int lengthPosition); | ||||
writer.WriteString(value.InfoContent); | writer.WriteString(value.InfoContent); | ||||
@@ -0,0 +1,44 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | |||||
using JT809.Protocol.Extensions; | |||||
using System; | |||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 上传平台间消息补传请求消息 | |||||
/// <para>子业务类型标识:UP_PLATFORM_MSG_RETRAN_REQ</para> | |||||
/// <para>描述:下级平台在接收消息时,如发现消息报文序列号不连续,则立即发送消息补传请求。上级平台收到消息补传请求后,根据请求的消息报文序列号或起始时间(当仅填写一项时。另一项全为0),重传相应的消息</para> | |||||
/// </summary> | |||||
public class JT809_0x1300_0x1303:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1300_0x1303>, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.上传平台间消息补传请求消息.ToUInt16Value(); | |||||
public override string Description => "上传平台间消息补传请求消息"; | |||||
/// <summary> | |||||
/// 需要重传消息的起始报文序列号和结束的报文序列号。如只请求重传一个消息,则起始消息报文序列号和结束消息报文序列号相同 | |||||
/// 8位 | |||||
/// </summary> | |||||
public byte[] SerialList { get; set; } | |||||
/// <summary> | |||||
/// 重传起始系统utc时间 | |||||
/// 8位 | |||||
/// </summary> | |||||
public DateTime Time { get; set; } | |||||
public JT809_0x1300_0x1303 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | |||||
{ | |||||
var value= new JT809_0x1300_0x1303(); | |||||
value.SerialList = reader.ReadArray(8).ToArray(); | |||||
value.Time = reader.ReadUTCDateTime(); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1300_0x1303 value, IJT809Config config) | |||||
{ | |||||
writer.WriteArray(value.SerialList); | |||||
writer.WriteUTCDateTime(value.Time); | |||||
} | |||||
} | |||||
} |
@@ -3,6 +3,7 @@ using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using System; | using System; | ||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | namespace JT809.Protocol.SubMessageBody | ||||
{ | { | ||||
@@ -12,7 +13,7 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// <para>描述:下级平台向上级平台上报某车辆的报警信息</para> | /// <para>描述:下级平台向上级平台上报某车辆的报警信息</para> | ||||
/// <para>本条消息上级平台无需应答</para> | /// <para>本条消息上级平台无需应答</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x1400_0x1402:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1400_0x1402> | |||||
public class JT809_0x1400_0x1402:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1400_0x1402>, IJT809_2019_Version | |||||
{ | { | ||||
public override ushort SubMsgId => JT809SubBusinessType.上报报警信息消息.ToUInt16Value(); | public override ushort SubMsgId => JT809SubBusinessType.上报报警信息消息.ToUInt16Value(); | ||||
@@ -22,6 +23,10 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// </summary> | /// </summary> | ||||
public JT809WarnSrc WarnSrc { get; set; } | public JT809WarnSrc WarnSrc { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 发起报警平台唯一编码,由平台所在地行政区域代码和平台编号组成 | |||||
/// </summary> | |||||
public byte[] SourcePlatformId { get; set; } | |||||
/// <summary> | |||||
/// 报警类型 | /// 报警类型 | ||||
/// </summary> | /// </summary> | ||||
public JT809WarnType WarnType { get; set; } | public JT809WarnType WarnType { get; set; } | ||||
@@ -30,6 +35,30 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// </summary> | /// </summary> | ||||
public DateTime WarnTime { get; set; } | public DateTime WarnTime { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 事件开始时间 utc | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 事件结束时间 utc | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 车牌号码 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车牌颜色 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 被报警平台唯一编码,由平台所在地行政区划代码和平台编号组成。非平台相关报警全填0 | |||||
/// </summary> | |||||
public byte[] DestinationPlatformId { get; set; } | |||||
/// <summary> | |||||
/// 线路ID 808-2019中0x8606规定的报文中的线路ID | |||||
/// </summary> | |||||
public uint DRVLineId { get; set; } | |||||
/// <summary> | |||||
/// 信息ID | /// 信息ID | ||||
/// </summary> | /// </summary> | ||||
public uint InfoID { get; set; } | public uint InfoID { get; set; } | ||||
@@ -43,22 +72,58 @@ namespace JT809.Protocol.SubMessageBody | |||||
public string InfoContent { get; set; } | public string InfoContent { get; set; } | ||||
public JT809_0x1400_0x1402 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x1400_0x1402 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x1400_0x1402 jT809_0X1400_0X1402 = new JT809_0x1400_0x1402(); | |||||
jT809_0X1400_0X1402.WarnSrc = (JT809WarnSrc)reader.ReadByte(); | |||||
jT809_0X1400_0X1402.WarnType = (JT809WarnType)reader.ReadUInt16(); | |||||
jT809_0X1400_0X1402.WarnTime = reader.ReadUTCDateTime(); | |||||
jT809_0X1400_0X1402.InfoID = reader.ReadUInt32(); | |||||
jT809_0X1400_0X1402.InfoLength = reader.ReadUInt32(); | |||||
jT809_0X1400_0X1402.InfoContent = reader.ReadString((int)jT809_0X1400_0X1402.InfoLength); | |||||
return jT809_0X1400_0X1402; | |||||
var value = new JT809_0x1400_0x1402(); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
value.WarnSrc = (JT809WarnSrc)reader.ReadByte(); | |||||
} | |||||
else { | |||||
value.SourcePlatformId = reader.ReadArray(11).ToArray(); | |||||
} | |||||
value.WarnType = (JT809WarnType)reader.ReadUInt16(); | |||||
value.WarnTime = reader.ReadUTCDateTime(); | |||||
if (config.Version != JT809Version.JTT2013) | |||||
{ | |||||
value.InfoID = reader.ReadUInt32(); | |||||
} | |||||
else | |||||
{ | |||||
value.StartTime = reader.ReadUTCDateTime(); | |||||
value.EndTime = reader.ReadUTCDateTime(); | |||||
#warning 此处车牌号文档长度有误,使用旧版长度21 | |||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
value.DestinationPlatformId = reader.ReadArray(11).ToArray(); | |||||
value.DRVLineId = reader.ReadUInt32(); | |||||
} | |||||
value.InfoLength = reader.ReadUInt32(); | |||||
value.InfoContent = reader.ReadString((int)value.InfoLength); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1402 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1402 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteByte((byte)value.WarnSrc); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteByte((byte)value.WarnSrc); | |||||
} | |||||
else { | |||||
writer.WriteArray(value.SourcePlatformId); | |||||
} | |||||
writer.WriteUInt16((ushort)value.WarnType); | writer.WriteUInt16((ushort)value.WarnType); | ||||
writer.WriteUTCDateTime(value.WarnTime); | writer.WriteUTCDateTime(value.WarnTime); | ||||
writer.WriteUInt32(value.InfoID); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteUInt32(value.InfoID); | |||||
} | |||||
else { | |||||
writer.WriteUTCDateTime(value.StartTime); | |||||
writer.WriteUTCDateTime(value.EndTime); | |||||
writer.WriteStringPadRight(value.VehicleNo,21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
writer.WriteArray(value.DestinationPlatformId); | |||||
writer.WriteUInt32(value.DRVLineId); | |||||
} | |||||
// 先计算内容长度(汉字为两个字节) | // 先计算内容长度(汉字为两个字节) | ||||
writer.Skip(4, out int lengthPosition); | writer.Skip(4, out int lengthPosition); | ||||
writer.WriteString(value.InfoContent); | writer.WriteString(value.InfoContent); | ||||
@@ -2,20 +2,69 @@ | |||||
using JT809.Protocol.Formatters; | using JT809.Protocol.Formatters; | ||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using JT809.Protocol.Interfaces; | |||||
using System; | |||||
namespace JT809.Protocol.SubMessageBody | namespace JT809.Protocol.SubMessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 主动上报报警处理结果信息 | |||||
/// <para>子业务类型标识:UP_WARN_MSG_ADPT_TODO_INFO</para> | |||||
/// <para>描述:下级平台向上级平台上报报警处理结果</para> | |||||
/// 主动上报报警处理结果信息(2013) | |||||
/// 上报报警预警信息(2019) | |||||
/// <para>子业务类型标识:UP_WARN_MSG_ADPT_TODO_INFO_2013</para> | |||||
/// <para>子业务类型标识:UP_WARN_MSG_INFORM_TIPS_2019</para> | |||||
/// <para>描述:下级平台向上级平台上报报警处理结果2013</para> | |||||
/// <para>描述:用于下级平台向上级平台上报相关报警预警或运行提示信息2019</para> | |||||
/// <para>本条消息上级平台无需应答</para> | /// <para>本条消息上级平台无需应答</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x1400_0x1403:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1400_0x1403> | |||||
public class JT809_0x1400_0x1403:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1400_0x1403>, IJT809_2019_Version | |||||
{ | { | ||||
public override ushort SubMsgId => JT809SubBusinessType.主动上报报警处理结果信息.ToUInt16Value(); | |||||
public override ushort SubMsgId => JT809SubBusinessType.主动上报报警处理结果信息2013_上报报警预警信息2019.ToUInt16Value(); | |||||
public override string Description => "主动上报报警处理结果信息"; | |||||
public override string Description => "主动上报报警处理结果信息2013_上报报警预警信息2019"; | |||||
/// <summary> | |||||
/// 发起报警平台唯一编码,由平台所在地行政区域代码和平台编号组成 | |||||
/// </summary> | |||||
public byte[] SourcePlatformId { get; set; } | |||||
/// <summary> | |||||
/// 报警类型 | |||||
/// </summary> | |||||
public JT809WarnType WarnType { get; set; } | |||||
/// <summary> | |||||
/// 报警时间 | |||||
/// </summary> | |||||
public DateTime WarnTime { get; set; } | |||||
/// <summary> | |||||
/// 事件开始时间 utc | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 事件结束时间 utc | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 车牌号码 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车牌颜色 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 被报警平台唯一编码,由平台所在地行政区划代码和平台编号组成。非平台相关报警全填0 | |||||
/// </summary> | |||||
public byte[] DestinationPlatformId { get; set; } | |||||
/// <summary> | |||||
/// 线路ID 808-2019中0x8606规定的报文中的线路ID | |||||
/// </summary> | |||||
public uint DRVLineId { get; set; } | |||||
/// <summary> | |||||
/// 数据长度 | |||||
/// </summary> | |||||
public uint InfoLength { get; set; } | |||||
/// <summary> | |||||
/// 数据长度 | |||||
/// </summary> | |||||
public string InfoContent { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 报警信息ID | /// 报警信息ID | ||||
/// </summary> | /// </summary> | ||||
@@ -26,16 +75,52 @@ namespace JT809.Protocol.SubMessageBody | |||||
public JT809_0x1403_Result Result { get; set; } | public JT809_0x1403_Result Result { get; set; } | ||||
public JT809_0x1400_0x1403 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x1400_0x1403 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x1400_0x1403 jT809_0X1400_0X1403 = new JT809_0x1400_0x1403(); | |||||
jT809_0X1400_0X1403.InfoID = reader.ReadUInt32(); | |||||
jT809_0X1400_0X1403.Result = (JT809_0x1403_Result)reader.ReadByte(); | |||||
return jT809_0X1400_0X1403; | |||||
var value = new JT809_0x1400_0x1403(); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
value.InfoID = reader.ReadUInt32(); | |||||
value.Result = (JT809_0x1403_Result)reader.ReadByte(); | |||||
} | |||||
else { | |||||
value.SourcePlatformId = reader.ReadArray(11).ToArray(); | |||||
value.WarnType = (JT809WarnType)reader.ReadUInt16(); | |||||
value.WarnTime = reader.ReadUTCDateTime(); | |||||
value.StartTime = reader.ReadUTCDateTime(); | |||||
value.EndTime = reader.ReadUTCDateTime(); | |||||
#warning 此处车牌号文档长度有误,使用旧版长度21 | |||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
value.DestinationPlatformId = reader.ReadArray(11).ToArray(); | |||||
value.DRVLineId = reader.ReadUInt32(); | |||||
value.InfoLength = reader.ReadUInt32(); | |||||
value.InfoContent = reader.ReadString((int)value.InfoLength); | |||||
} | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1403 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1403 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteUInt32(value.InfoID); | |||||
writer.WriteByte((byte)value.Result); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteUInt32(value.InfoID); | |||||
writer.WriteByte((byte)value.Result); | |||||
} | |||||
else { | |||||
writer.WriteArray(value.SourcePlatformId); | |||||
writer.WriteUInt16((ushort)value.WarnType); | |||||
writer.WriteUTCDateTime(value.WarnTime); | |||||
writer.WriteUTCDateTime(value.StartTime); | |||||
writer.WriteUTCDateTime(value.EndTime); | |||||
writer.WriteStringPadRight(value.VehicleNo, 21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
writer.WriteArray(value.DestinationPlatformId); | |||||
writer.WriteUInt32(value.DRVLineId); | |||||
// 先计算内容长度(汉字为两个字节) | |||||
writer.Skip(4, out int lengthPosition); | |||||
writer.WriteString(value.InfoContent); | |||||
writer.WriteInt32Return(writer.GetCurrentPosition() - lengthPosition - 4, lengthPosition); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -0,0 +1,49 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | |||||
using JT809.Protocol.Extensions; | |||||
using System; | |||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 上报报警督办应答消息 | |||||
/// <para>子业务类型标识:UP_WARN_MSG_ADPT_INFO</para> | |||||
/// <para>描述:下级平台向上级平台上报某车辆的报警信息</para> | |||||
/// <para>本条消息上级平台无需应答</para> | |||||
/// </summary> | |||||
public class JT809_0x1400_0x1411 : JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1400_0x1411>, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.上报报警督办应答消息.ToUInt16Value(); | |||||
public override string Description => "上报报警督办应答消息"; | |||||
/// <summary> | |||||
/// 对应报警督办请求消息源子业务类型标识 | |||||
/// </summary> | |||||
public ushort SourceDateType { get; set; } | |||||
/// <summary> | |||||
/// 对应报警督办请求消息源报文序列号 | |||||
/// </summary> | |||||
public uint SourceMsgSn { get; set; } | |||||
/// <summary> | |||||
/// 报警处理结果 | |||||
/// </summary> | |||||
public JT809_0x1411_Result Result { get; set; } | |||||
public JT809_0x1400_0x1411 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | |||||
{ | |||||
var value = new JT809_0x1400_0x1411(); | |||||
value.SourceDateType = reader.ReadUInt16(); | |||||
value.SourceMsgSn = reader.ReadUInt32(); | |||||
value.Result = (JT809_0x1411_Result)reader.ReadByte(); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1411 value, IJT809Config config) | |||||
{ | |||||
writer.WriteUInt16(value.SourceDateType); | |||||
writer.WriteUInt32(value.SourceMsgSn); | |||||
writer.WriteByte((byte)value.Result); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,49 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | |||||
using JT809.Protocol.Extensions; | |||||
using System; | |||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 主动上报报警处理结果消息 | |||||
/// <para>子业务类型标识:UP_WARN_MSG_ADPT_TODO_INFO</para> | |||||
/// <para>描述:下级平台主动向上级平台上报报警处理结果</para> | |||||
/// <para>本条消息上级平台无需应答</para> | |||||
/// </summary> | |||||
public class JT809_0x1400_0x1412 : JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1400_0x1412>, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.主动上报报警处理结果消息.ToUInt16Value(); | |||||
public override string Description => "主动上报报警处理结果消息"; | |||||
/// <summary> | |||||
/// 对应报警督办请求消息源子业务类型标识 | |||||
/// </summary> | |||||
public ushort SourceDateType { get; set; } | |||||
/// <summary> | |||||
/// 对应报警督办请求消息源报文序列号 | |||||
/// </summary> | |||||
public uint SourceMsgSn { get; set; } | |||||
/// <summary> | |||||
/// 报警处理结果 | |||||
/// </summary> | |||||
public JT809_0x1412_Result Result { get; set; } | |||||
public JT809_0x1400_0x1412 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | |||||
{ | |||||
var value = new JT809_0x1400_0x1412(); | |||||
value.SourceDateType = reader.ReadUInt16(); | |||||
value.SourceMsgSn = reader.ReadUInt32(); | |||||
value.Result = (JT809_0x1412_Result)reader.ReadByte(); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1412 value, IJT809Config config) | |||||
{ | |||||
writer.WriteUInt16(value.SourceDateType); | |||||
writer.WriteUInt32(value.SourceMsgSn); | |||||
writer.WriteByte((byte)value.Result); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,85 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | |||||
using JT809.Protocol.Extensions; | |||||
using System; | |||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 上报报警督办请求消息 | |||||
/// <para>子业务类型标识:UP_WARN_MSG_URGE_TODO_REQ_INFO</para> | |||||
/// <para>描述:下级平台告知上级平台已对报警情况进行催办</para> | |||||
/// <para>本条消息上级平台无需应答</para> | |||||
/// </summary> | |||||
public class JT809_0x1400_0x1413 : JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1400_0x1413>, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.主动上报报警处理结果消息.ToUInt16Value(); | |||||
public override string Description => "上报报警督办请求消息"; | |||||
/// <summary> | |||||
/// 发起报警平台唯一编码,由平台所在地行政区划大码和平台编号组成 | |||||
/// </summary> | |||||
public byte[] SourcePlatformId { get; set; } | |||||
/// <summary> | |||||
/// 报警时间 utc | |||||
/// </summary> | |||||
public DateTime WarnTime { get; set; } | |||||
/// <summary> | |||||
/// 对应报警督办请求消息源子业务类型标识 | |||||
/// </summary> | |||||
public ushort SourceDateType { get; set; } | |||||
/// <summary> | |||||
/// 对应报警督办请求消息源报文序列号 | |||||
/// </summary> | |||||
public uint SourceMsgSn { get; set; } | |||||
/// <summary> | |||||
/// 督办截止时间 utc | |||||
/// </summary> | |||||
public DateTime SupervisionEndTime { get; set; } | |||||
/// <summary> | |||||
/// 督办级别 | |||||
/// </summary> | |||||
public JT809_0x1413_SupervisionLevel SupervisionLevel { get; set; } | |||||
/// <summary> | |||||
/// 督办人 | |||||
/// </summary> | |||||
public string Supervisor { get; set; } | |||||
/// <summary> | |||||
/// 督办人联系电话 | |||||
/// </summary> | |||||
public string SupervisorTel { get; set; } | |||||
/// <summary> | |||||
/// 督办人联系电子邮件 | |||||
/// </summary> | |||||
public string SupervisorEmail { get; set; } | |||||
public JT809_0x1400_0x1413 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | |||||
{ | |||||
var value = new JT809_0x1400_0x1413(); | |||||
value.SourcePlatformId = reader.ReadArray(11).ToArray(); | |||||
value.WarnTime = reader.ReadUTCDateTime(); | |||||
value.SourceDateType = reader.ReadUInt16(); | |||||
value.SourceMsgSn = reader.ReadUInt32(); | |||||
value.SupervisionEndTime = reader.ReadUTCDateTime(); | |||||
value.SupervisionLevel=(JT809_0x1413_SupervisionLevel)reader.ReadByte(); | |||||
value.Supervisor = reader.ReadString(16); | |||||
value.SupervisorTel = reader.ReadString(20); | |||||
value.SupervisorEmail = reader.ReadString(32); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1400_0x1413 value, IJT809Config config) | |||||
{ | |||||
writer.WriteArray(value.SourcePlatformId); | |||||
writer.WriteUTCDateTime(value.WarnTime); | |||||
writer.WriteUInt16(value.SourceDateType); | |||||
writer.WriteUInt32(value.SourceMsgSn); | |||||
writer.WriteUTCDateTime(value.SupervisionEndTime); | |||||
writer.WriteByte((byte)value.SupervisionLevel); | |||||
writer.WriteStringPadRight(value.Supervisor, 16); | |||||
writer.WriteStringPadRight(value.SupervisorTel, 20); | |||||
writer.WriteStringPadRight(value.SupervisorEmail, 32); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Extensions; | |||||
using JT809.Protocol.Interfaces; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 上报车辆车辆行驶路线请求 | |||||
/// <para>子业务类型标识:DOWN_BASE_MSG_DRVLINE_REQ</para> | |||||
/// </summary> | |||||
public class JT809_0x9200_0x920C:JT809SubBodies, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.上报车辆车辆行驶路线请求.ToUInt16Value(); | |||||
public override string Description => "上报车辆车辆行驶路线请求"; | |||||
public override bool SkipSerialization => true; | |||||
} | |||||
} |
@@ -0,0 +1,57 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Extensions; | |||||
using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.Interfaces; | |||||
using JT809.Protocol.MessagePack; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 车辆行驶线路请求应答 | |||||
/// <para>子业务类型标识:DOWN_BASE_MSG_DRVLINE_ACK</para> | |||||
/// </summary> | |||||
public class JT809_0x9200_0x920D : JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9200_0x920D>, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.车辆行驶线路请求应答.ToUInt16Value(); | |||||
public override string Description => "车辆行驶线路请求应答"; | |||||
/// <summary> | |||||
/// 线路ID,按照808-2019中0x8606规定的报文中的线路ID | |||||
/// </summary> | |||||
public uint DRVLineID { get; set; } | |||||
/// <summary> | |||||
/// 处理结果 0x00 完成记录,0x01 审核通过,完成记录 0x02信息错误,未完成记录0x03 审核未通过,未完成记录 | |||||
/// </summary> | |||||
public byte Result { get; set; } | |||||
/// <summary> | |||||
/// 未通过原因内容长度 | |||||
/// </summary> | |||||
public ushort ReasonLength { get; set; } | |||||
/// <summary> | |||||
/// 经过GBK编码后的未通过原因 | |||||
/// </summary> | |||||
public string Reason { get; set; } | |||||
public JT809_0x9200_0x920D Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | |||||
{ | |||||
var value = new JT809_0x9200_0x920D(); | |||||
value.DRVLineID = reader.ReadUInt32(); | |||||
value.Result = reader.ReadByte(); | |||||
value.ReasonLength = reader.ReadUInt16(); | |||||
value.Reason = reader.ReadString(value.ReasonLength); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9200_0x920D value, IJT809Config config) | |||||
{ | |||||
writer.WriteUInt32(value.DRVLineID); | |||||
writer.WriteByte(value.Result); | |||||
writer.Skip(2, out int position); | |||||
writer.WriteString(value.Reason); | |||||
writer.WriteUInt16Return((ushort)(writer.GetCurrentPosition() - position-2), position); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,44 @@ | |||||
using JT809.Protocol.Enums; | |||||
using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | |||||
using JT809.Protocol.Extensions; | |||||
using System; | |||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 下发平台间消息补传请求消息 | |||||
/// <para>子业务类型标识:DOWN_PLATFORM_MSG_RETRAN_REQ</para> | |||||
/// <para>描述:上级平台接收方在接受消息时,如发现消息报文序列号不连接,则立即发送消息补传请求。下级平台收到消息补传请求后,根据请求的消息报文序列号。重传相应的消息</para> | |||||
/// </summary> | |||||
public class JT809_0x9300_0x9303:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9300_0x9303>, IJT809_2019_Version | |||||
{ | |||||
public override ushort SubMsgId => JT809SubBusinessType.下发平台间消息补传请求消息.ToUInt16Value(); | |||||
public override string Description => "下发平台间消息补传请求消息"; | |||||
/// <summary> | |||||
/// 需要重传消息的起始报文序列号和结束的报文序列号。如只请求重传一个消息,则起始消息报文序列号和结束消息报文序列号相同 | |||||
/// 8位 | |||||
/// </summary> | |||||
public byte[] SerialList { get; set; } | |||||
/// <summary> | |||||
/// 重传起始系统utc时间 | |||||
/// 8位 | |||||
/// </summary> | |||||
public DateTime Time { get; set; } | |||||
public JT809_0x9300_0x9303 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | |||||
{ | |||||
var value = new JT809_0x9300_0x9303(); | |||||
value.SerialList = reader.ReadArray(8).ToArray(); | |||||
value.Time = reader.ReadUTCDateTime(); | |||||
return value; | |||||
} | |||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9300_0x9303 value, IJT809Config config) | |||||
{ | |||||
writer.WriteArray(value.SerialList); | |||||
writer.WriteUTCDateTime(value.Time); | |||||
} | |||||
} | |||||
} |
@@ -3,33 +3,63 @@ using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using System; | using System; | ||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | namespace JT809.Protocol.SubMessageBody | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 报警预警 | |||||
/// 报警预警2013 | |||||
/// 下发报警预警消息2019 | |||||
/// <para>子业务类型标识:DOWN_WARN_MSG_INFORM_TIPS</para> | /// <para>子业务类型标识:DOWN_WARN_MSG_INFORM_TIPS</para> | ||||
/// <para>描述:用于上级平台向车辆归属或车辆跨域下级平台下发相关车辆的报警顶警或运行提示信息</para> | /// <para>描述:用于上级平台向车辆归属或车辆跨域下级平台下发相关车辆的报警顶警或运行提示信息</para> | ||||
/// <para>本条消息下级平台无需应答</para> | /// <para>本条消息下级平台无需应答</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x9400_0x9402:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9400_0x9402> | |||||
public class JT809_0x9400_0x9402:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9400_0x9402>,IJT809_2019_Version | |||||
{ | { | ||||
public override ushort SubMsgId => JT809SubBusinessType.报警预警.ToUInt16Value(); | |||||
public override ushort SubMsgId => JT809SubBusinessType.报警预警2013_下发报警预警消息2019.ToUInt16Value(); | |||||
public override string Description => "报警预警"; | |||||
public override string Description => "报警预警2013_下发报警预警消息2019"; | |||||
/// <summary> | /// <summary> | ||||
/// 报警信息来源 | /// 报警信息来源 | ||||
/// </summary> | /// </summary> | ||||
public JT809WarnSrc WarnSrc { get; set; } | public JT809WarnSrc WarnSrc { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 发起报警平台唯一编码,由平台所在地行政区域代码和平台编号组成 | |||||
/// </summary> | |||||
public byte[] SourcePlatformId { get; set; } | |||||
/// <summary> | |||||
/// 报警类型 | /// 报警类型 | ||||
/// </summary> | /// </summary> | ||||
public JT809WarnType WarnType { get; set; } | public JT809WarnType WarnType { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 报警时间 UTCDateTime | |||||
/// 报警时间 | |||||
/// </summary> | /// </summary> | ||||
public DateTime WarnTime { get; set; } | public DateTime WarnTime { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 事件开始时间 utc | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 事件结束时间 utc | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 车牌号码 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车牌颜色 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 被报警平台唯一编码,由平台所在地行政区划代码和平台编号组成。非平台相关报警全填0 | |||||
/// </summary> | |||||
public byte[] DestinationPlatformId { get; set; } | |||||
/// <summary> | |||||
/// 线路ID 808-2019中0x8606规定的报文中的线路ID | |||||
/// </summary> | |||||
public uint DRVLineId { get; set; } | |||||
/// <summary> | |||||
/// 数据长度 | /// 数据长度 | ||||
/// </summary> | /// </summary> | ||||
public uint WarnLength { get; set; } | public uint WarnLength { get; set; } | ||||
@@ -40,20 +70,49 @@ namespace JT809.Protocol.SubMessageBody | |||||
public JT809_0x9400_0x9402 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x9400_0x9402 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x9400_0x9402 jT809_0X9400_0X9402 = new JT809_0x9400_0x9402(); | |||||
jT809_0X9400_0X9402.WarnSrc = (JT809WarnSrc)reader.ReadByte(); | |||||
jT809_0X9400_0X9402.WarnType = (JT809WarnType)reader.ReadUInt16(); | |||||
jT809_0X9400_0X9402.WarnTime = reader.ReadUTCDateTime(); | |||||
jT809_0X9400_0X9402.WarnLength = reader.ReadUInt32(); | |||||
jT809_0X9400_0X9402.WarnContent = reader.ReadString((int)jT809_0X9400_0X9402.WarnLength); | |||||
return jT809_0X9400_0X9402; | |||||
var value = new JT809_0x9400_0x9402(); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
value.WarnSrc = (JT809WarnSrc)reader.ReadByte(); | |||||
} | |||||
else { | |||||
value.SourcePlatformId = reader.ReadArray(11).ToArray(); | |||||
} | |||||
value.WarnType = (JT809WarnType)reader.ReadUInt16(); | |||||
value.WarnTime = reader.ReadUTCDateTime(); | |||||
if (config.Version == JT809Version.JTT2019) { | |||||
value.StartTime = reader.ReadUTCDateTime(); | |||||
value.EndTime = reader.ReadUTCDateTime(); | |||||
#warning 此处车牌号文档长度有误,使用旧版长度21 | |||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
value.DestinationPlatformId = reader.ReadArray(11).ToArray(); | |||||
value.DRVLineId = reader.ReadUInt32(); | |||||
} | |||||
value.WarnLength = reader.ReadUInt32(); | |||||
value.WarnContent = reader.ReadString((int)value.WarnLength); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400_0x9402 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400_0x9402 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteByte((byte)value.WarnSrc); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteByte((byte)value.WarnSrc); | |||||
} | |||||
else { | |||||
writer.WriteArray(value.SourcePlatformId); | |||||
} | |||||
writer.WriteUInt16((ushort)value.WarnType); | writer.WriteUInt16((ushort)value.WarnType); | ||||
writer.WriteUTCDateTime(value.WarnTime); | writer.WriteUTCDateTime(value.WarnTime); | ||||
if (config.Version == JT809Version.JTT2019) { | |||||
writer.WriteUTCDateTime(value.StartTime); | |||||
writer.WriteUTCDateTime(value.EndTime); | |||||
writer.WriteStringPadRight(value.VehicleNo, 21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
writer.WriteArray(value.DestinationPlatformId); | |||||
writer.WriteUInt32(value.DRVLineId); | |||||
} | |||||
// 先计算内容长度(汉字为两个字节) | // 先计算内容长度(汉字为两个字节) | ||||
writer.Skip(4, out int lengthPosition); | writer.Skip(4, out int lengthPosition); | ||||
writer.WriteString(value.WarnContent); | writer.WriteString(value.WarnContent); | ||||
@@ -3,6 +3,7 @@ using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using System; | using System; | ||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | namespace JT809.Protocol.SubMessageBody | ||||
{ | { | ||||
@@ -12,7 +13,7 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// <para>描述:用于上级平台向车辆跨域目的地下级平台下发相关车辆的当前报警情况</para> | /// <para>描述:用于上级平台向车辆跨域目的地下级平台下发相关车辆的当前报警情况</para> | ||||
/// <para>本条消息下级平台无需应答</para> | /// <para>本条消息下级平台无需应答</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x9400_0x9403:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9400_0x9403> | |||||
public class JT809_0x9400_0x9403:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9400_0x9403>,IJT809_2019_Version | |||||
{ | { | ||||
public override ushort SubMsgId => JT809SubBusinessType.实时交换报警信息.ToUInt16Value(); | public override ushort SubMsgId => JT809SubBusinessType.实时交换报警信息.ToUInt16Value(); | ||||
@@ -22,6 +23,10 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// </summary> | /// </summary> | ||||
public JT809WarnSrc WarnSrc { get; set; } | public JT809WarnSrc WarnSrc { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 发起报警平台唯一编码,由平台所在地行政区域代码和平台编号组成 | |||||
/// </summary> | |||||
public byte[] SourcePlatformId { get; set; } | |||||
/// <summary> | |||||
/// 报警类型 | /// 报警类型 | ||||
/// </summary> | /// </summary> | ||||
public JT809WarnType WarnType { get; set; } | public JT809WarnType WarnType { get; set; } | ||||
@@ -30,6 +35,30 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// </summary> | /// </summary> | ||||
public DateTime WarnTime { get; set; } | public DateTime WarnTime { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 事件开始时间 utc | |||||
/// </summary> | |||||
public DateTime StartTime { get; set; } | |||||
/// <summary> | |||||
/// 事件结束时间 utc | |||||
/// </summary> | |||||
public DateTime EndTime { get; set; } | |||||
/// <summary> | |||||
/// 车牌号码 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public string VehicleNo { get; set; } | |||||
/// <summary> | |||||
/// 车牌颜色 非车辆相关报警全填0 | |||||
/// </summary> | |||||
public JT809VehicleColorType VehicleColor { get; set; } | |||||
/// <summary> | |||||
/// 被报警平台唯一编码,由平台所在地行政区划代码和平台编号组成。非平台相关报警全填0 | |||||
/// </summary> | |||||
public byte[] DestinationPlatformId { get; set; } | |||||
/// <summary> | |||||
/// 线路ID 808-2019中0x8606规定的报文中的线路ID | |||||
/// </summary> | |||||
public uint DRVLineId { get; set; } | |||||
/// <summary> | |||||
/// 数据长度 | /// 数据长度 | ||||
/// </summary> | /// </summary> | ||||
public uint WarnLength { get; set; } | public uint WarnLength { get; set; } | ||||
@@ -39,20 +68,53 @@ namespace JT809.Protocol.SubMessageBody | |||||
public string WarnContent { get; set; } | public string WarnContent { get; set; } | ||||
public JT809_0x9400_0x9403 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x9400_0x9403 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x9400_0x9403 jT809_0X9400_0X9403 = new JT809_0x9400_0x9403(); | |||||
jT809_0X9400_0X9403.WarnSrc = (JT809WarnSrc)reader.ReadByte(); | |||||
jT809_0X9400_0X9403.WarnType = (JT809WarnType)reader.ReadUInt16(); | |||||
jT809_0X9400_0X9403.WarnTime = reader.ReadUTCDateTime(); | |||||
jT809_0X9400_0X9403.WarnLength = reader.ReadUInt32(); | |||||
jT809_0X9400_0X9403.WarnContent = reader.ReadString((int)jT809_0X9400_0X9403.WarnLength); | |||||
return jT809_0X9400_0X9403; | |||||
var value = new JT809_0x9400_0x9403(); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
value.WarnSrc = (JT809WarnSrc)reader.ReadByte(); | |||||
} | |||||
else | |||||
{ | |||||
value.SourcePlatformId = reader.ReadArray(11).ToArray(); | |||||
} | |||||
value.WarnType = (JT809WarnType)reader.ReadUInt16(); | |||||
value.WarnTime = reader.ReadUTCDateTime(); | |||||
if (config.Version == JT809Version.JTT2019) | |||||
{ | |||||
value.StartTime = reader.ReadUTCDateTime(); | |||||
value.EndTime = reader.ReadUTCDateTime(); | |||||
#warning 此处车牌号文档长度有误,使用旧版长度21 | |||||
value.VehicleNo = reader.ReadString(21); | |||||
value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); | |||||
value.DestinationPlatformId = reader.ReadArray(11).ToArray(); | |||||
value.DRVLineId = reader.ReadUInt32(); | |||||
} | |||||
value.WarnLength = reader.ReadUInt32(); | |||||
value.WarnContent = reader.ReadString((int)value.WarnLength); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400_0x9403 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9400_0x9403 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteByte((byte)value.WarnSrc); | |||||
if (config.Version == JT809Version.JTT2013) | |||||
{ | |||||
writer.WriteByte((byte)value.WarnSrc); | |||||
} | |||||
else | |||||
{ | |||||
writer.WriteArray(value.SourcePlatformId); | |||||
} | |||||
writer.WriteUInt16((ushort)value.WarnType); | writer.WriteUInt16((ushort)value.WarnType); | ||||
writer.WriteUTCDateTime(value.WarnTime); | writer.WriteUTCDateTime(value.WarnTime); | ||||
if (config.Version == JT809Version.JTT2019) | |||||
{ | |||||
writer.WriteUTCDateTime(value.StartTime); | |||||
writer.WriteUTCDateTime(value.EndTime); | |||||
writer.WriteStringPadRight(value.VehicleNo, 21); | |||||
writer.WriteByte((byte)value.VehicleColor); | |||||
writer.WriteArray(value.DestinationPlatformId); | |||||
writer.WriteUInt32(value.DRVLineId); | |||||
} | |||||
// 先计算内容长度(汉字为两个字节) | // 先计算内容长度(汉字为两个字节) | ||||
writer.Skip(4, out int lengthPosition); | writer.Skip(4, out int lengthPosition); | ||||
writer.WriteString(value.WarnContent); | writer.WriteString(value.WarnContent); | ||||
@@ -3,6 +3,7 @@ using JT809.Protocol.Formatters; | |||||
using JT809.Protocol.MessagePack; | using JT809.Protocol.MessagePack; | ||||
using JT809.Protocol.Extensions; | using JT809.Protocol.Extensions; | ||||
using System; | using System; | ||||
using JT809.Protocol.Interfaces; | |||||
namespace JT809.Protocol.SubMessageBody | namespace JT809.Protocol.SubMessageBody | ||||
{ | { | ||||
@@ -11,16 +12,12 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// <para>子业务类型标识:DOVJN_CTRL_MSG_TAKE_TRAVEL_REQ</para> | /// <para>子业务类型标识:DOVJN_CTRL_MSG_TAKE_TRAVEL_REQ</para> | ||||
/// <para>描述:上级平台向下级平台下发上报车辆行驶记录请求消息</para> | /// <para>描述:上级平台向下级平台下发上报车辆行驶记录请求消息</para> | ||||
/// </summary> | /// </summary> | ||||
public class JT809_0x9500_0x9504:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9500_0x9504> | |||||
public class JT809_0x9500_0x9504:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x9500_0x9504>, IJT809_2019_Version | |||||
{ | { | ||||
public override ushort SubMsgId => JT809SubBusinessType.上报车辆行驶记录请求消息.ToUInt16Value(); | public override ushort SubMsgId => JT809SubBusinessType.上报车辆行驶记录请求消息.ToUInt16Value(); | ||||
public override string Description => "上报车辆行驶记录请求消息"; | public override string Description => "上报车辆行驶记录请求消息"; | ||||
/// <summary> | /// <summary> | ||||
/// 命令字ID | |||||
/// </summary> | |||||
public JT809CommandType Command { get; set; } | |||||
/// <summary> | |||||
/// 开始时间 | /// 开始时间 | ||||
/// </summary> | /// </summary> | ||||
public DateTime StartTime { get; set; } | public DateTime StartTime { get; set; } | ||||
@@ -29,68 +26,24 @@ namespace JT809.Protocol.SubMessageBody | |||||
/// </summary> | /// </summary> | ||||
public DateTime EndTime { get; set; } | public DateTime EndTime { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 最大数据数 | |||||
/// 命令字ID | |||||
/// </summary> | /// </summary> | ||||
public ushort Max { get; set; } | |||||
public JT809CommandType Command { get; set; } | |||||
public JT809_0x9500_0x9504 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | public JT809_0x9500_0x9504 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) | ||||
{ | { | ||||
JT809_0x9500_0x9504 jT809_0X9500_0X9504 = new JT809_0x9500_0x9504(); | |||||
jT809_0X9500_0X9504.Command = (JT809CommandType)reader.ReadByte(); | |||||
switch (jT809_0X9500_0X9504.Command) | |||||
{ | |||||
case JT809CommandType.记录仪标准版本: | |||||
case JT809CommandType.当前驾驶人信息: | |||||
case JT809CommandType.记录仪时间: | |||||
case JT809CommandType.记录仪累计行驶里程: | |||||
case JT809CommandType.记录仪脉冲系数: | |||||
case JT809CommandType.车辆信息: | |||||
case JT809CommandType.记录仪状态信号配置信息: | |||||
case JT809CommandType.记录仪唯一性编号: | |||||
break; | |||||
case JT809CommandType.采集记录仪行驶记录: | |||||
case JT809CommandType.采集记录仪位置信息记录: | |||||
case JT809CommandType.采集记录仪事故疑点记录: | |||||
case JT809CommandType.采集记录仪超时驾驶记录: | |||||
case JT809CommandType.采集记录仪驾驶人身份记录: | |||||
case JT809CommandType.采集记录仪外部供电记录: | |||||
case JT809CommandType.采集记录仪参数修改记录: | |||||
case JT809CommandType.采集记录仪速度状态日志: | |||||
jT809_0X9500_0X9504.StartTime = reader.ReadDateTime6(); | |||||
jT809_0X9500_0X9504.EndTime = reader.ReadDateTime6(); | |||||
jT809_0X9500_0X9504.Max = reader.ReadUInt16(); | |||||
break; | |||||
} | |||||
return jT809_0X9500_0X9504; | |||||
var value = new JT809_0x9500_0x9504(); | |||||
value.StartTime = reader.ReadUTCDateTime(); | |||||
value.EndTime = reader.ReadUTCDateTime(); | |||||
value.Command = (JT809CommandType)reader.ReadByte(); | |||||
return value; | |||||
} | } | ||||
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9500_0x9504 value, IJT809Config config) | public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9500_0x9504 value, IJT809Config config) | ||||
{ | { | ||||
writer.WriteUTCDateTime(value.StartTime); | |||||
writer.WriteUTCDateTime(value.EndTime); | |||||
writer.WriteByte((byte)value.Command); | writer.WriteByte((byte)value.Command); | ||||
switch (value.Command) | |||||
{ | |||||
case JT809CommandType.记录仪标准版本: | |||||
case JT809CommandType.当前驾驶人信息: | |||||
case JT809CommandType.记录仪时间: | |||||
case JT809CommandType.记录仪累计行驶里程: | |||||
case JT809CommandType.记录仪脉冲系数: | |||||
case JT809CommandType.车辆信息: | |||||
case JT809CommandType.记录仪状态信号配置信息: | |||||
case JT809CommandType.记录仪唯一性编号: | |||||
break; | |||||
case JT809CommandType.采集记录仪行驶记录: | |||||
case JT809CommandType.采集记录仪位置信息记录: | |||||
case JT809CommandType.采集记录仪事故疑点记录: | |||||
case JT809CommandType.采集记录仪超时驾驶记录: | |||||
case JT809CommandType.采集记录仪驾驶人身份记录: | |||||
case JT809CommandType.采集记录仪外部供电记录: | |||||
case JT809CommandType.采集记录仪参数修改记录: | |||||
case JT809CommandType.采集记录仪速度状态日志: | |||||
writer.WriteDateTime6(value.StartTime); | |||||
writer.WriteDateTime6(value.EndTime); | |||||
writer.WriteUInt16(value.Max); | |||||
break; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |