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
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
package com.dji.sample.wayline.model.enums;
 
import com.dji.sdk.common.IErrorInfo;
import com.fasterxml.jackson.annotation.JsonCreator;
 
import java.util.Arrays;
 
/**
 * @author sean
 * @version 1.3
 * @date 2023/2/17
 */
public enum WaylineErrorCodeEnum implements IErrorInfo {
 
    SUCCESS(0, "success", false),
 
    EMERGENCY_BUTTON(316026, "The emergency button at the dock was pressed.", true),
    
    NOT_IDLE(319001, "Task Center is not currently idle.", true),
    
    PERFORMING_TASK(319016, "The dock is performing other tasks.", true),
    
    EXPORTING_LOGS(319018, "The dock is exporting logs.", true),
    
    PULLING_LOGS(319019, "The dock is pulling logs.", true),
    
    HEIGHT_LIMIT(321513, "The wayline altitude has exceeded the height limit of the drone.", true),
    
    DISTANCE_LIMIT(321514, "The wayline distance has exceeded the limit of the drone.", true),
 
    RESTRICTED_FLIGHT_AREA(321515, "The wayline passes through a restricted flight area.", true),
    
    SDR_DISCONNECT(514120, "The sdr link between the dock and the drone is disconnected.", true),
 
    HEAVY_RAIN(514134, "Heavy rain prevented the flight.", true),
    
    STRONG_WIND(514135, "Strong wind prevented the flight.", true),
    
    POWER_DISCONNECT(514136, "The dock's power supply is disconnected.", true),
 
    LOW_TEMPERATURE(514137, "The low temperature of the environment prevented flight.", true),
 
    DEBUGGING(514145, "The dock is being debugged.", true),
 
    REMOTE_DEBUGGING(514146, "The dock is being debugged remotely.", true),
 
    DOCK_UPGRADING(514147, "The dock is being upgraded.", true),
 
    DOCK_WORKING(514148, "The dock is working and cannot perform new tasks.", true),
 
    UNKNOWN(-1, "Unknown wayline error.", false);
    
    private String msg;
 
    private int code;
 
    boolean block; 
    
    WaylineErrorCodeEnum(int code, String msg, boolean block) {
        this.code = code;
        this.msg = msg;
        this.block = block;
    }
 
    @Override
    public String getMessage() {
        return msg;
    }
 
    @Override
    public Integer getCode() {
        return code;
    }
 
    public boolean isBlock() {
        return block;
    }
 
    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static WaylineErrorCodeEnum find(int code) {
        return Arrays.stream(WaylineErrorCodeEnum.values()).filter(error -> error.code == code).findAny().orElse(UNKNOWN);
    }
}