Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

48 rader
1.4 KiB

  1. using GBNewEnergy.Protocol.Exceptions;
  2. using GBNewEnergy.Protocol.Extensions;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. using GBNewEnergy.Protocol.NEProperties;
  7. namespace GBNewEnergy.Protocol.UpStream
  8. {
  9. /// <summary>
  10. /// 车辆登出
  11. /// </summary>
  12. public class NELogoutUpStream : NEBodies
  13. {
  14. public NELogoutUpStream(byte[] buffer) : base(buffer)
  15. {}
  16. public NELogoutUpStream(INEProperties nEProperties) : base(nEProperties){}
  17. protected override void InitializeProperties(INEProperties nEProperties)
  18. {
  19. NELogoutProperty nELogoutProperty = (NELogoutProperty)nEProperties;
  20. (ushort LoginNum, DateTime ExpirationTime) temp;
  21. if (LoginNumDict.TryGetValue(nELogoutProperty.VIN, out temp))
  22. {
  23. LoginNum = temp.LoginNum;
  24. }
  25. else
  26. {
  27. throw new NEException(Enums.NEErrorCode.LoginSerialNoError, "Must Dependency NELoginUpStream Class.");
  28. }
  29. }
  30. protected override void InitializePropertiesFromBuffer()
  31. {
  32. CurrentDateTime = Buffer.ReadDateTimeLittle(0, 6);
  33. LoginNum = Buffer.ReadUShortH2LLittle(6, 2);
  34. }
  35. protected override void ToBuffer()
  36. {
  37. Buffer = new byte[8];
  38. Buffer.WriteLittle(CurrentDateTime, 0, 6);
  39. Buffer.WriteLittle(LoginNum, 6, 2);
  40. }
  41. }
  42. }