| package com.zy.acs.gateway.domain; | 
|   | 
| import com.zy.acs.gateway.constant.EncryType; | 
| import com.zy.acs.gateway.constant.ProtocolType; | 
| import lombok.Data; | 
| import org.apache.commons.lang.builder.ToStringBuilder; | 
|   | 
| /** | 
|  * 协议头 | 
|  * Created by vincent on 2019-04-03 | 
|  */ | 
| @Data | 
| public class PacHeader { | 
|   | 
|     /** | 
|      * 起始符 | 
|      * 固定为"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(); | 
|     } | 
| } |