12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace VeederRoot_ATG_Console.MessageEntity.Outgoing
- {
- /// <summary>
- /// i|I602
- /// </summary>
- public class SetTankProductLabelRequest : OutgoingMessageBase
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="messageFormat"></param>
- /// <param name="tankNumber">0 indicates all tanks</param>
- /// <param name="productLabel">max 20 ASCII chars from 0x20 to 0x7E, like 'REGULAR UNLEADED', will pad right with space</param>
- 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<byte>();
- base.DataField.AddRange(Encoding.ASCII.GetBytes(productLabel.PadRight(20, ' ')));
- }
- }
- }
|