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.

45 lines
1.4 KiB

  1. using JT808.Protocol.Enums;
  2. using JT808.Protocol.Extensions;
  3. using JT808.Protocol.Formatters;
  4. using JT808.Protocol.Interfaces;
  5. using JT808.Protocol.MessagePack;
  6. using System;
  7. using System.Buffers.Binary;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using System.Text.Json;
  11. namespace JT808.Protocol.MessageBody.CarDVR
  12. {
  13. /// <summary>
  14. /// 采集记录仪实时时间
  15. /// 返回:实时时间
  16. /// </summary>
  17. public class JT808_CarDVR_Up_0x02 : JT808CarDVRUpBodies, IJT808MessagePackFormatter<JT808_CarDVR_Up_0x02>, IJT808Analyze
  18. {
  19. public override byte CommandId => JT808CarDVRCommandID.采集记录仪实时时间.ToByteValue();
  20. /// <summary>
  21. /// 实时时间
  22. /// </summary>
  23. public DateTime RealTime { get; set; }
  24. public override string Description => "实时时间";
  25. public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
  26. {
  27. }
  28. public void Serialize(ref JT808MessagePackWriter writer, JT808_CarDVR_Up_0x02 value, IJT808Config config)
  29. {
  30. writer.WriteDateTime6(value.RealTime);
  31. }
  32. public JT808_CarDVR_Up_0x02 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
  33. {
  34. JT808_CarDVR_Up_0x02 value = new JT808_CarDVR_Up_0x02();
  35. value.RealTime = reader.ReadDateTime6();
  36. return value;
  37. }
  38. }
  39. }