#
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
package com.example.agvcontroller.protocol;
 
 
public enum PacErrorType implements ICodedStatus {
 
    /**
     * 解析异常
     */
    PAC_ANALYZE_ERROR(0x01, "报文解析异常"),
 
    /**
     * 报文长度验证异常
     */
    PAC_LENGTH_ERROR(0x02, "报文长度验证异常"),
 
    /**
     * 报文校验异常
     */
    PAC_VALID_ERROR(0x023, "报文长度验证异常"),
 
    ;
 
    private int code;   // 编码
    private String des; // 描述
 
    PacErrorType(int code, String des) {
        this.code = code;
        this.des = des;
    }
 
    public int getCode() {
        return code;
    }
 
    public String getDes() {
        return des;
    }
 
    public static PacErrorType getByCode(int code) {
        for (PacErrorType c :
                PacErrorType.values()) {
            if (c.getCode() == code) {
                return c;
            }
        }
        return null;
    }
}