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.

66 lignes
2.3 KiB

  1. using JT808.Protocol.Enums;
  2. using JT808.Protocol.Formatters;
  3. using JT808.Protocol.MessagePack;
  4. namespace JT808.Protocol.MessageBody
  5. {
  6. public class JT808_0x0200_0x11 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter<JT808_0x0200_0x11>
  7. {
  8. /// <summary>
  9. /// 超速报警附加信息
  10. /// 0:无特定位置;
  11. /// 1:圆形区域;
  12. /// 2:矩形区域;
  13. /// 3:多边形区域;
  14. /// 4:路段
  15. /// </summary>
  16. public JT808PositionType JT808PositionType { get; set; }
  17. /// <summary>
  18. /// 区域或路段 ID
  19. /// 若位置类型为 0,无该字段
  20. /// </summary>
  21. public uint AreaId { get; set; }
  22. public override byte AttachInfoId { get; set; } = 0x11;
  23. public override byte AttachInfoLength
  24. {
  25. get
  26. {
  27. if (JT808PositionType != JT808PositionType.无特定位置)
  28. {
  29. return 5;
  30. }
  31. else
  32. {
  33. return 1;
  34. }
  35. }
  36. set { }
  37. }
  38. public JT808_0x0200_0x11 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
  39. {
  40. JT808_0x0200_0x11 jT808LocationAttachImpl0x11 = new JT808_0x0200_0x11();
  41. jT808LocationAttachImpl0x11.AttachInfoId = reader.ReadByte();
  42. jT808LocationAttachImpl0x11.AttachInfoLength = reader.ReadByte();
  43. jT808LocationAttachImpl0x11.JT808PositionType = (JT808PositionType)reader.ReadByte();
  44. if (jT808LocationAttachImpl0x11.JT808PositionType != JT808PositionType.无特定位置)
  45. {
  46. jT808LocationAttachImpl0x11.AreaId = reader.ReadUInt32();
  47. }
  48. return jT808LocationAttachImpl0x11;
  49. }
  50. public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x11 value, IJT808Config config)
  51. {
  52. writer.WriteByte(value.AttachInfoId);
  53. writer.WriteByte(value.AttachInfoLength);
  54. writer.WriteByte((byte)value.JT808PositionType);
  55. if (value.JT808PositionType != JT808PositionType.无特定位置)
  56. {
  57. writer.WriteUInt32(value.AreaId);
  58. }
  59. }
  60. }
  61. }