Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

53 lignes
1.9 KiB

  1. using JT808.Protocol.Attributes;
  2. using JT808.Protocol.Enums;
  3. using JT808.Protocol.Formatters;
  4. using JT808.Protocol.Formatters.MessageBodyFormatters;
  5. using JT808.Protocol.MessagePack;
  6. namespace JT808.Protocol.MessageBody
  7. {
  8. [JT808Formatter(typeof(JT808_0x0200_0x13_Formatter))]
  9. public class JT808_0x0200_0x13 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x13>
  10. {
  11. public override byte AttachInfoId { get; set; } = 0x13;
  12. public override byte AttachInfoLength { get; set; } = 7;
  13. /// <summary>
  14. /// 路段 ID
  15. /// </summary>
  16. public int DrivenRouteId { get; set; }
  17. /// <summary>
  18. /// 路段行驶时间
  19. /// 单位为秒(s)
  20. /// </summary>
  21. public ushort Time { get; set; }
  22. /// <summary>
  23. /// 结果 0:不足;1:过长
  24. /// </summary>
  25. public JT808DrivenRouteType DrivenRoute { get; set; }
  26. public JT808_0x0200_0x13 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
  27. {
  28. JT808_0x0200_0x13 jT808LocationAttachImpl0x13 = new JT808_0x0200_0x13();
  29. jT808LocationAttachImpl0x13.AttachInfoId = reader.ReadByte();
  30. jT808LocationAttachImpl0x13.AttachInfoLength = reader.ReadByte();
  31. jT808LocationAttachImpl0x13.DrivenRouteId = reader.ReadInt32();
  32. jT808LocationAttachImpl0x13.Time = reader.ReadUInt16();
  33. jT808LocationAttachImpl0x13.DrivenRoute = (JT808DrivenRouteType)reader.ReadByte();
  34. return jT808LocationAttachImpl0x13;
  35. }
  36. public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x13 value, IJT808Config config)
  37. {
  38. writer.WriteByte(value.AttachInfoId);
  39. writer.WriteByte(value.AttachInfoLength);
  40. writer.WriteInt32(value.DrivenRouteId);
  41. writer.WriteUInt16(value.Time);
  42. writer.WriteByte((byte)value.DrivenRoute);
  43. }
  44. }
  45. }