1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using Edge.Core.Parser.BinaryParser.Attributes;
- using Edge.Core.Parser.BinaryParser.MessageEntity;
- using Edge.Core.Parser.BinaryParser.Util;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Dfs.WayneChina.GilbarcoDispenserPayTerminal.MessageEntities
- {
- public enum CallingParty
- {
- /// <summary>
- /// System/后台
- /// </summary>
- System,
- /// <summary>
- /// Pump/加油机,实际上是终端
- /// </summary>
- Pump
- }
- public class CardMessageBase : MessageTemplateBase
- {
- #region Constructor
- public CardMessageBase(HandleType handleType)
- {
- Stx = 0xFA;
- Handle = Convert.ToByte(handleType);
- }
- #endregion
- [Format(1, EncodingType.BIN, -100)]
- public virtual byte Stx { get; set; }
- [Format(1, EncodingType.BIN, -99)]
- public virtual byte DestinationAddress { get; set; }
- [Format(1, EncodingType.BIN, -98)]
- public virtual byte SourceAddress { get; set; }
- [Format(1, EncodingType.BIN, -97)]
- public virtual byte FrameSqNoByte { get; set; }
- [Format(2, "%OnSerializingBytesCount", EncodingType.BCD, -96)]
- public virtual int BodyLength { get; set; }
- [Format(1, EncodingType.BIN, -95)]
- public byte Handle { get; set; }
- [EnumerableFormat(2, 1000, EncodingType = EncodingType.BIN)]
- public virtual List<byte> CRC { get; set; }
- public CallingParty Caller
- {
- get
- {
- if (FrameSqNoByte.GetBit(6) == 1)
- return CallingParty.Pump;
- return CallingParty.System;
- }
- }
- public virtual int FrameNo
- {
- get { return FrameSqNoByte & 0x3F; }
- }
- public override string ToLogString()
- {
- return GetType().Name + " " + base.ToLogString().Replace(
- "FrameSqNoByte:", "(Caller: " + Caller + ", FrameNo: " + FrameNo + ")FrameSqNoByte:");
- }
- }
- }
|