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.

51 line
1.5 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(INEProperties nEProperties, NEGlobalConfigs nEConfigs) : base(nEProperties, nEConfigs)
  15. {
  16. }
  17. public NELogoutUpStream(byte[] buffer, NEGlobalConfigs nEConfigs) : base(buffer, nEConfigs)
  18. {
  19. }
  20. protected override void InitializeProperties(INEProperties nEProperties)
  21. {
  22. NELogoutProperty nELogoutProperty = (NELogoutProperty)nEProperties;
  23. LoginInfo temp;
  24. if (LoginNumDict.TryGetValue(nELogoutProperty.VIN, out temp))
  25. {
  26. LoginNum = temp.LoginNum;
  27. }
  28. else
  29. {
  30. throw new NEException(Enums.NEErrorCode.LoginSerialNoError, "Must Dependency NELoginUpStream Class.");
  31. }
  32. }
  33. protected override void InitializePropertiesFromBuffer()
  34. {
  35. CurrentDateTime = Buffer.ReadDateTimeLittle(0, 6);
  36. LoginNum = Buffer.ReadUShortH2LLittle(6, 2);
  37. }
  38. protected override void ToBuffer()
  39. {
  40. Buffer = new byte[8];
  41. Buffer.WriteLittle(CurrentDateTime, 0, 6);
  42. Buffer.WriteLittle(LoginNum, 6, 2);
  43. }
  44. }
  45. }