using Edge.Core.Parser.BinaryParser.Util; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Wayne_Pump_Dart.MessageEntity.Outgoing { /// /// NOZ1-n specifies the logical nozzle numbers that is allowed for filling. /// The transaction is used when a pump is authorized. /// E.g. if nozzle 1-3 is allowed, the transaction contains 1, 2, 3. /// public class PriceUpdateRequest : MessageBase { /// /// /// /// /// /// PRI is the price in packet BCD with MSB in first byte. PRI1 is the price for logical nozzle number 1. PRI2 is the price for logical nozzle number 2 and so on. public PriceUpdateRequest(byte address, byte blockSeqNumber, IEnumerable newPrices) { if (newPrices.Any(p => p.ToString().Length > 6)) throw new ArgumentException("Price must <= 6 digits"); base.Adrs = address; base.BlockSeqNumber = blockSeqNumber; base.ControlCharacter = ControlCharacter.DATA; base.TransactionDatas = new List() { new TransactionData() { TransactionNumber = 0x05, RawData = newPrices.Select(p=>p.GetBCDBytes(3)).SelectMany(s=>s).ToList() } }; } } }