using System; using Edge.Core.Parser.BinaryParser.Attributes; using Edge.Core.Parser.BinaryParser.MessageEntity; namespace Dfs.WayneChina.HengshanTerminalWrapper.MessageEntity.Base { /// <summary> /// 前导码(0FFH)+长度(0-20H)+{命令(0A0H--0AFH)+参数}+校验({...}XRL结果,0FFH=0EEH) /// 长度=命令+参数+校验 /// 校验 = 命令 + 参数 /// 超时判定:30秒 /// </summary> [Serializable] public abstract class NonCardDispenserMessageTemplateBase : MessageTemplateBase { public enum Result { 成功, 失败 } /// <summary> /// 数据包头,同步头 /// </summary> [Format(1, EncodingType.BIN, -100)] public virtual byte Prefix { get { return 0xFF; } set { ; } } /// /// 前导码(0FFH)+长度(0-20H)+{命令(0A0H--0AFH)+参数}+校验 /// /// <summary> /// 消息长度 /// </summary> [Format(1, "%OnSerializingBytesCount", EncodingType.BIN, -99)] public virtual int MessageLength { get; set; } ///// <summary> ///// fixed legth /// cmd ///// </summary> [FormatAttribute(1, EncodingType.BIN, -98)] public virtual byte CMD { get; set; } [Format(1, EncodingType.BIN, 1000)] public virtual byte XRL { get; set; } /// <summary> /// Gets the code for the message, the code is variant length, most of them are 1 or 2 byte. /// </summary> //public virtual List<byte> Code { get; protected set; } //protected KaJiLianDongV11MessageTemplateBase() //{ // // fusion always the host, the pump side msg sender is from a system embeded in pump. // this.SetMessageCallerSide(MessageCallerSide.Host); //} public override string ToLogString() { return this.GetType().Name + " " + base.ToLogString().Replace("FrameSequenceAndControlRaw:", "(message length: 0x" + MessageLength + ", cmd: 0x" + CMD); } } }