package com.example.agvcontroller.protocol; /** * 协议头 * Created by vincent on 2019-04-03 */ public class PacHeader { public byte getStartSymbol() { return startSymbol; } public int getContentLength() { return contentLength; } public String getUniqueNo() { return uniqueNo; } public ProtocolType getProtocolType() { return protocolType; } public int getTimestamp() { return timestamp; } public String getSerialNum() { return serialNum; } public EncryType getEncryptType() { return encryptType; } /** * 起始符 * 固定为"0xEE || 0xAA" */ private byte startSymbol; /** * 数据单元长度 */ private int contentLength; /** * 唯一标识码 */ private String uniqueNo; /** * 时间戳 */ private int timestamp; /** * 命令标识 */ private ProtocolType protocolType; /** * 流水号 */ private String serialNum; /** * 数据单元加密方式 */ private EncryType encryptType; public PacHeader setStartSymbol(Byte startSymbol) { this.startSymbol = startSymbol; return this; } public PacHeader setProtocolType(ProtocolType protocolType) { this.protocolType = protocolType; return this; } public PacHeader setTimestamp(Integer timestamp) { this.timestamp = timestamp; return this; } public PacHeader setSerialNum(String serialNum) { this.serialNum = serialNum; return this; } public PacHeader setUniqueNo(String uniqueNo) { this.uniqueNo = uniqueNo; return this; } public PacHeader setEncryptType(EncryType encryptType) { this.encryptType = encryptType; return this; } public PacHeader setContentLength(int contentLength) { this.contentLength = contentLength; return this; } //@Override //public String toString() { // return new ToStringBuilder(this) // .append("startSymbol", startSymbol) // .append("contentLength", contentLength) // .append("uniqueNo", uniqueNo) // .append("timestamp", timestamp) // .append("protocolType", protocolType.getDes()) // .append("serialNum", serialNum) // .toString(); //} }