using System; using System.Collections.Generic; using System.Text; namespace VeederRoot_ATG_Console.MessageEntity.Outgoing { /// /// i|I602 /// public class SetTankProductLabelRequest : OutgoingMessageBase { /// /// /// /// /// 0 indicates all tanks /// max 20 ASCII chars from 0x20 to 0x7E, like 'REGULAR UNLEADED', will pad right with space public SetTankProductLabelRequest(MessageFormat messageFormat , int tankNumber, string productLabel) : base(messageFormat, FuncCode.SetTankProductLabel, tankNumber.ToString()) { if (tankNumber < 0 || tankNumber > 99) throw new ArgumentOutOfRangeException("Valid tank number is range from 0 to 99"); if (productLabel.Length > 20) throw new ArgumentOutOfRangeException("Valid productLabel must have its length from 0 to 20"); //base.FunctionCodeRaw = base.FunctionCodeRaw.Substring(0, 4) + tankNumber.ToString().PadLeft(2, '0'); base.DataField = new List(); base.DataField.AddRange(Encoding.ASCII.GetBytes(productLabel.PadRight(20, ' '))); } } }