DisplayInfoRequest.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Edge.Core.Parser.BinaryParser.Attributes;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace ZhongSheng_NonIC_Pump
  7. {
  8. /// <summary>
  9. /// PC 发送信息提示给油机
  10. /// </summary>
  11. public class DisplayInfoRequest : MessageTemplateBase
  12. {
  13. [Format(1, EncodingType.BCD, 1)]
  14. public byte 枪号 { get; set; }
  15. [Format(3, EncodingType.ASCII, 2)]
  16. public string 信息码 { get; set; }
  17. [Format(1, EncodingType.BIN, 3)]
  18. public byte 提示信息字节数 { get; set; }
  19. [EnumerableFormat("提示信息字节数", 4, EncodingType = EncodingType.ASCII)]
  20. public List<char> 提示信息符串 { get; set; }
  21. /// <summary>
  22. ///
  23. /// </summary>
  24. /// <param name="nozzleNumber"></param>
  25. /// <param name="信息码">长度必须为3,如果PC发送信息码为“000”,表示清除显示屏提示信息</param>
  26. /// <param name="提示信息"></param>
  27. public DisplayInfoRequest(byte nozzleNumber, string 信息码, string 提示信息)
  28. {
  29. base.CommandCode = 0x37;
  30. this.枪号 = nozzleNumber;
  31. if (信息码.Length != 3)
  32. throw new ArgumentException("信息码 的长度必须为3");
  33. this.信息码 = 信息码;
  34. if (提示信息.Length > 255)
  35. throw new ArgumentException("displayInfo 的长度不能>255");
  36. this.提示信息字节数 = (byte)提示信息.Length;
  37. this.提示信息符串 = 提示信息.ToList();
  38. }
  39. }
  40. }