| 1234567891011121314151617181920212223242526272829 |
- using Edge.Core.Parser.BinaryParser.Util;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LanTian_Pump_664_Or_886.MessageEntity.Outgoing
- {
- public class PresetVolumeRequest : MessageBase
- {
- public PresetVolumeRequest(int volumeWithoutDecimalPoint, byte volumeFieldLength)
- {
- if (volumeFieldLength != 3 && volumeFieldLength != 4)
- throw new ArgumentException("预置字段长度应为 3 or 4");
- if (volumeFieldLength == 3
- && (volumeWithoutDecimalPoint > 999999 || volumeWithoutDecimalPoint <= 0))
- throw new ArgumentException("664机型预置金额区为3字节, so should range from 0 to 999999");
- if (volumeFieldLength == 4
- && (volumeWithoutDecimalPoint > 99999999 || volumeWithoutDecimalPoint <= 0))
- throw new ArgumentException("886机型预置金额区为4字节, so should range from 0 to 99999999");
- this.BodyAndXRL = volumeWithoutDecimalPoint.GetBCDBytes(volumeFieldLength).ToList();
- // cmd byte
- this.BodyAndXRL.Add(0xB9);
- // add a place hold for XRL
- this.BodyAndXRL.Add(0);
- }
- }
- }
|