| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using Edge.Core.Parser.BinaryParser.Attributes;
- using Edge.Core.Parser.BinaryParser.MessageEntity;
- using Edge.Core.Parser.BinaryParser.Util;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- namespace Gilbarco_Pump
- {
- public abstract class MessageTemplateBase : Edge.Core.Parser.BinaryParser.MessageEntity.MessageTemplateBase
- {
- /// <summary>
- /// 数据包头,同步头
- /// </summary>
- [Format(1, EncodingType.BIN, -100)]
- public virtual byte Prefix
- {
- get { return 0xFA; }
- set
- {
- ;
- }
- }
- /// <summary>
- /// 数据接收端的地址编号 ,中控地址就放0xff
- /// </summary>
- [Format(1, EncodingType.BIN, -99)]
- public virtual byte TargetAddress { get; set; }
- /// <summary>
- /// 数据发送端的地址编号,中控地址就放0xff
- /// </summary>
- [Format(1, EncodingType.BIN, -98)]
- public virtual byte SourceAddress { get; set; }
- /// <summary>
- /// 帧号/控制
- /// 发送端与接收端的同步帧号,发送方发出某帧号,应答方回送此帧号,
- /// 该数从0x01递增到0x3F,然后再回到0x00,继续递增循环。
- ///
- /// 注意注意,实际加油机会发送0x40进来,可能是油机的BUG,所以这里放开到0x40
- /// </summary>
- [Format(1, EncodingType.BIN, -97)]
- [Range(1, 0x40, "帧号/控制 must between 0x01 to 0x3F, but now is: {0}")]
- public virtual byte FrameSeqNo { get; set; }
- /// <summary>
- /// 有效数据长度, 压缩 BCD,转 义字符 不计入 其中
- /// </summary>
- [Format(1, "%OnSerializingBytesCount", EncodingType.BIN, -90)]
- //[Range(1, 240, "有效数据长度must between 1 and 240, but now is {0}")]
- public virtual int DataLength { get; set; }
- [Format(1, EncodingType.BIN, -80)]
- public virtual byte CommandCode { get; set; }
- //[Format(1, EncodingType.BIN, 9999)]
- public virtual byte CheckSum { get; set; }
- public override string ToLogString()
- {
- return this.GetType().Name + " " + base.ToLogString();
- }
- }
- }
|