HeartBeatMessage.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Edge.Core.IndustryStandardInterface.Pump.Fdc;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace HengshanPaymentTerminal.MessageEntity.Incoming
  8. {
  9. /// <summary>
  10. /// 心跳包数据对象
  11. /// </summary>
  12. public class HeartBeatMessage : CommonMessage
  13. {
  14. /// <summary>
  15. /// 油枪数
  16. /// </summary>
  17. public int GunCount { get; set; }
  18. /// <summary>
  19. /// 各油枪状态
  20. /// </summary>
  21. public List<HeartBeatNozzleState> NozzleStatus { get; set; }
  22. public override CommonMessage ToObject(byte[] datas)
  23. {
  24. this.getBaseData(datas);
  25. this.GunCount = datas[7];
  26. List<HeartBeatNozzleState> nozzleStates = new List<HeartBeatNozzleState>();
  27. for (int index = 8;index < datas.Length - 2;index += 2)
  28. {
  29. HeartBeatNozzleState nozzle = new HeartBeatNozzleState()
  30. {
  31. NozzleNum = datas[index],
  32. STATU = datas[index + 1]
  33. };
  34. nozzleStates.Add(nozzle);
  35. }
  36. this.NozzleStatus = nozzleStates;
  37. return this;
  38. }
  39. public override byte[] ToCommonByteArray()
  40. {
  41. byte[] content = new byte[] { 0x55, this.Handle, 0x00, ((byte)RESULT.OVER) };
  42. return content2data(content);
  43. }
  44. }
  45. public class HeartBeatNozzleState
  46. {
  47. /// <summary>
  48. /// 油枪号
  49. /// </summary>
  50. public int NozzleNum { get; set; }
  51. /// <summary>
  52. /// 油枪状态 01:不可用 02:关闭 03:空闲 04:呼叫 05:授权 06:开始加油 07:挂起开始加油 08:加油中 09:挂起加油
  53. /// </summary>
  54. public int STATU { get; set; }
  55. }
  56. }