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.

28 line
940 B

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