You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.2 KiB

  1. using JT809.Protocol.Enums;
  2. using JT809.Protocol.Formatters;
  3. using JT809.Protocol.MessagePack;
  4. using JT809.Protocol.Extensions;
  5. using JT809.Protocol.Interfaces;
  6. namespace JT809.Protocol.SubMessageBody
  7. {
  8. /// <summary>
  9. /// 下发平台间报文应答消息
  10. /// <para>子业务类型标识:UP_PLATFORM_MSG_INFO_ACK</para>
  11. /// <para>描述:下级平台收到上级平台发送的"下发平台间报文请求"消息后,根据相应的下发报文对象类型,进行转发,并向上级平台发送应答消息</para>
  12. /// </summary>
  13. public class JT809_0x1300_0x1302:JT809SubBodies, IJT809MessagePackFormatter<JT809_0x1300_0x1302>, IJT809_2019_Version
  14. {
  15. public override ushort SubMsgId => JT809SubBusinessType.下发平台间报文应答消息.ToUInt16Value();
  16. public override string Description => "下发平台间报文应答消息";
  17. /// <summary>
  18. /// 对应下发平台间报文请求消息源子业务类型标识
  19. /// </summary>
  20. public ushort SourceDataType { get; set; }
  21. /// <summary>
  22. /// 对应下发平台间报文请求消息源报文序列号
  23. /// </summary>
  24. public uint SourceMsgSn { get; set; }
  25. /// <summary>
  26. /// 信息ID
  27. /// </summary>
  28. public uint InfoID { get; set; }
  29. public JT809_0x1300_0x1302 Deserialize(ref JT809MessagePackReader reader, IJT809Config config)
  30. {
  31. JT809_0x1300_0x1302 value = new JT809_0x1300_0x1302();
  32. if (config.Version == JT809Version.JTT2019) {
  33. value.SourceDataType = reader.ReadUInt16();
  34. value.SourceMsgSn = reader.ReadUInt32();
  35. }
  36. else
  37. {
  38. value.InfoID = reader.ReadUInt32();
  39. }
  40. return value;
  41. }
  42. public void Serialize(ref JT809MessagePackWriter writer, JT809_0x1300_0x1302 value, IJT809Config config)
  43. {
  44. if (config.Version == JT809Version.JTT2019)
  45. {
  46. writer.WriteUInt16(value.SourceDataType);
  47. writer.WriteUInt32(value.SourceMsgSn);
  48. }
  49. else {
  50. writer.WriteUInt32(value.InfoID);
  51. }
  52. }
  53. }
  54. }