using System;
using Edge.Core.Parser.BinaryParser.Attributes;
using Edge.Core.Parser.BinaryParser.MessageEntity;
namespace Dfs.WayneChina.HengshanTerminalWrapper.MessageEntity.Base
{
///
/// 前导码(0FFH)+长度(0-20H)+{命令(0A0H--0AFH)+参数}+校验({...}XRL结果,0FFH=0EEH)
/// 长度=命令+参数+校验
/// 校验 = 命令 + 参数
/// 超时判定:30秒
///
[Serializable]
public abstract class NonCardDispenserMessageTemplateBase : MessageTemplateBase
{
public enum Result
{
成功,
失败
}
///
/// 数据包头,同步头
///
[Format(1, EncodingType.BIN, -100)]
public virtual byte Prefix
{
get { return 0xFF; }
set
{
;
}
}
///
/// 前导码(0FFH)+长度(0-20H)+{命令(0A0H--0AFH)+参数}+校验
///
///
/// 消息长度
///
[Format(1, "%OnSerializingBytesCount", EncodingType.BIN, -99)]
public virtual int MessageLength { get; set; }
/////
///// fixed legth
/// cmd
/////
[FormatAttribute(1, EncodingType.BIN, -98)]
public virtual byte CMD { get; set; }
[Format(1, EncodingType.BIN, 1000)]
public virtual byte XRL { get; set; }
///
/// Gets the code for the message, the code is variant length, most of them are 1 or 2 byte.
///
//public virtual List 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);
}
}
}