wangmengmeng
2024-12-24 24432a361d5c6bd6f3d8c008693e9f1155d62517
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
package com.dji.sdk.cloudapi.control;
 
import com.dji.sdk.common.IErrorInfo;
import com.dji.sdk.exception.CloudSDKException;
import com.fasterxml.jackson.annotation.JsonCreator;
 
import java.util.Arrays;
 
/**
 * @author sean
 * @version 1.4
 * @date 2023/3/17
 */
public enum DrcStatusErrorEnum implements IErrorInfo {
 
    SUCCESS(0, "success"),
 
    MQTT_ERR(514300, "The mqtt connection error."),
 
    HEARTBEAT_TIMEOUT(514301, "The heartbeat times out and the dock disconnects."),
 
    MQTT_CERTIFICATE_ERR(514302, "The mqtt certificate is abnormal and the connection fails."),
 
    MQTT_LOST(514303, "The dock network is abnormal and the mqtt connection is lost."),
 
    MQTT_REFUSE(514304, "The dock connection to mqtt server was refused.");
 
    private final String msg;
 
    private final int code;
 
    DrcStatusErrorEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
 
    @Override
    public String getMessage() {
        return msg;
    }
 
    @Override
    public Integer getCode() {
        return code;
    }
 
    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static DrcStatusErrorEnum find(int code) {
        return Arrays.stream(values()).filter(error -> error.code == code).findAny()
                .orElseThrow(() -> new CloudSDKException(DrcStatusErrorEnum.class, code));
    }
}