#
luxiaotao1123
2024-08-12 1560f3063ca90d41c0717f8ed6e1fb00fde64776
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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();
    }
}