guoshilong
2023-10-08 1ad4e77cc910abdb7e95ebea160473526c8ac9ce
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
package com.dji.sample.manage.model.enums;
 
import com.dji.sample.manage.model.receiver.*;
import lombok.Getter;
 
import java.util.Arrays;
import java.util.Optional;
 
/**
 * @author sean
 * @version 1.3
 * @date 2022/10/27
 */
@Getter
public enum DeviceSetPropertyEnum {
 
    NIGHT_LIGHTS_STATE("night_lights_state", NightLightsStateReceiver.class),
 
    HEIGHT_LIMIT("height_limit", HeightLimitReceiver.class),
 
    DISTANCE_LIMIT_STATUS("distance_limit_status", DistanceLimitStatusReceiver.class),
 
    OBSTACLE_AVOIDANCE("obstacle_avoidance", ObstacleAvoidanceReceiver.class),
 
    RTH_ALTITUDE("rth_altitude", RthAltitudeReceiver.class),
 
    OUT_OF_CONTROL_ACTION("out_of_control_action", OutOfControlActionReceiver.class);
 
    String property;
 
    Class<? extends BasicDeviceProperty> clazz;
 
    DeviceSetPropertyEnum(String property, Class<? extends BasicDeviceProperty> clazz) {
        this.property = property;
        this.clazz = clazz;
    }
 
    public static Optional<DeviceSetPropertyEnum> find(String property) {
        return Arrays.stream(DeviceSetPropertyEnum.values()).filter(propertyEnum -> propertyEnum.property.equals(property)).findAny();
    }
}