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.

29 line
949 B

  1. using JT809.Protocol.JT809Enums;
  2. using JT809.Protocol.JT809Extensions;
  3. using JT809.Protocol.JT809MessageBody;
  4. using System;
  5. using System.Buffers;
  6. using System.Collections.Generic;
  7. using System.Text;
  8. namespace JT809.Protocol.JT809Formatters.JT809MessageBodyFormatters
  9. {
  10. public class JT809_0x9002Formatter : IJT809Formatter<JT809_0x9002>
  11. {
  12. public JT809_0x9002 Deserialize(ReadOnlySpan<byte> bytes, out int readSize)
  13. {
  14. int offset = 0;
  15. JT809_0x9002 jT809_0X9002 = new JT809_0x9002();
  16. jT809_0X9002.Result = (JT809_0x9002_Result)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset);
  17. readSize = offset;
  18. return jT809_0X9002;
  19. }
  20. public int Serialize(ref byte[] bytes, int offset, JT809_0x9002 value)
  21. {
  22. offset += JT809BinaryExtensions.WriteByteLittle(bytes, offset, (byte)value.Result);
  23. return offset;
  24. }
  25. }
  26. }