WriteCloseAheadValveThresholdRequest.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. using Edge.Core.Parser.BinaryParser.Attributes;
  2. using Edge.Core.Parser.BinaryParser.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace LanTian_Pump_664_Or_886.MessageEntity.Outgoing
  9. {
  10. /// <summary>
  11. /// 3、写提前关阀量
  12. /// </summary>
  13. public class WriteCloseAheadValveThresholdRequest : MessageBase
  14. {
  15. /// <summary>
  16. ///
  17. /// </summary>
  18. /// <param name="thresholdValueWithoutDecimalPoint">max 2 digits, 35 表示设置提前关阀量为0.35L</param>
  19. public WriteCloseAheadValveThresholdRequest(int thresholdValueWithoutDecimalPoint)
  20. {
  21. if (thresholdValueWithoutDecimalPoint > 99 || thresholdValueWithoutDecimalPoint <= 0)
  22. throw new ArgumentException("写提前关阀量 should range from 0 to 9999");
  23. base.BodyAndXRL = thresholdValueWithoutDecimalPoint.GetBCDBytes(1).ToList();
  24. // cmd byte
  25. this.BodyAndXRL.Add(0xD2);
  26. // add a place hold for XRL
  27. this.BodyAndXRL.Add(0);
  28. }
  29. }
  30. }