using Edge.Core.Parser.BinaryParser.Attributes; using Edge.Core.Parser.BinaryParser.MessageEntity; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FR_Pump_HaoSheng.MessageEntity { public abstract class MessageBase : MessageTemplateBase { public enum NozzleStateEnum { Replaced = 0x00, Lifted = 0x01, } /// /// 包头第一字节,固定值。 /// [Format(1, EncodingType.BIN, -1000)] public byte PrefixFirstByte { get { return 0xFA; } set { ; } } /// /// 包头第二字节,固定值。 /// [Format(1, EncodingType.BIN, -950)] public byte PrefixSecondByte { get { return 0x00; } set { ; } } /// /// 包头第三字节。 /// [Format(1, EncodingType.BIN, -930)] public NozzleStateEnum NozzleState { get; set; } /// /// 当前油枪号码,通过协议文档,貌似只可能是1 or 2, 当raw值为 0x00时,指1号枪,当raw值为 0x01时,指2号枪。 /// [Format(1, EncodingType.BIN, -900)] public byte NozzleNumberRaw { get; set; } /// /// [Format(2, EncodingType.BCD, -800)] public virtual int MessageBodyLength { get; set; } [EnumerableFormat("MessageBodyLength", 1000)] public virtual List MessageBodyRaw { get; set; } /// /// .两字节校验码为 FA 之后字节开始 到 有效数据的 CRC16 值 /// [EnumerableFormat(2, 1100)] public virtual List Crc16 { get; set; } } }