using Edge.Core.Parser.BinaryParser.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ZhongSheng_NonIC_Pump { /// /// PC 发送信息提示给油机 /// public class DisplayInfoRequest : MessageTemplateBase { [Format(1, EncodingType.BCD, 1)] public byte 枪号 { get; set; } [Format(3, EncodingType.ASCII, 2)] public string 信息码 { get; set; } [Format(1, EncodingType.BIN, 3)] public byte 提示信息字节数 { get; set; } [EnumerableFormat("提示信息字节数", 4, EncodingType = EncodingType.ASCII)] public List 提示信息符串 { get; set; } /// /// /// /// /// 长度必须为3,如果PC发送信息码为“000”,表示清除显示屏提示信息 /// public DisplayInfoRequest(byte nozzleNumber, string 信息码, string 提示信息) { base.CommandCode = 0x37; this.枪号 = nozzleNumber; if (信息码.Length != 3) throw new ArgumentException("信息码 的长度必须为3"); this.信息码 = 信息码; if (提示信息.Length > 255) throw new ArgumentException("displayInfo 的长度不能>255"); this.提示信息字节数 = (byte)提示信息.Length; this.提示信息符串 = 提示信息.ToList(); } } }