#
whycq
2024-08-15 e54492fb532366faac8aa5d46ad8905ea3ff38d5
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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();
    //}
}