aix
2024-07-30 259b893309f8c06a22adc8455f44bcc486d796c7
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
package com.dji.sample.control.controller;
 
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.control.model.enums.DroneAuthorityEnum;
import com.dji.sample.control.model.param.*;
import com.dji.sample.control.service.IControlService;
import com.dji.sample.log.aspect.SysLogAnnotation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
 
/**
 * @author sean
 * @version 1.2
 * @date 2022/7/29
 */
@RestController
@Slf4j
@RequestMapping("${url.control.prefix}${url.control.version}/devices")
public class DockController {
 
    @Autowired
    private IControlService controlService;
 
    @PostMapping("/{sn}/jobs/{service_identifier}")
    @SysLogAnnotation(operModul = "机场控制", operType = "控制指令", operDesc = "控制指令")
    public ResponseResult createControlJob(@PathVariable String sn,
                                           @PathVariable("service_identifier") String serviceIdentifier,
                                           @RequestBody(required = false) RemoteDebugParam param) {
        return controlService.controlDockDebug(sn, serviceIdentifier, param);
    }
 
    @PostMapping("/{sn}/jobs/fly-to-point")
    @SysLogAnnotation(operModul = "机场控制", operType = "控制指令", operDesc = "起飞")
    public ResponseResult flyToPoint(@PathVariable String sn, @Valid @RequestBody FlyToPointParam param) {
        return controlService.flyToPoint(sn, param);
    }
 
    @DeleteMapping("/{sn}/jobs/fly-to-point")
    @SysLogAnnotation(operModul = "机场控制", operType = "控制指令", operDesc = "停止起飞")
    public ResponseResult flyToPointStop(@PathVariable String sn) {
        return controlService.flyToPointStop(sn);
    }
 
    @PostMapping("/{sn}/jobs/takeoff-to-point")
    @SysLogAnnotation(operModul = "机场控制", operType = "控制指令", operDesc = "一键起飞")
    public ResponseResult takeoffToPoint(@PathVariable String sn, @Valid @RequestBody TakeoffToPointParam param) {
        return controlService.takeoffToPoint(sn, param);
    }
 
    @PostMapping("/{sn}/authority/flight")
    public ResponseResult seizeFlightAuthority(@PathVariable String sn) {
        return controlService.seizeAuthority(sn, DroneAuthorityEnum.FLIGHT, null);
    }
 
    @PostMapping("/{sn}/authority/payload")
    @SysLogAnnotation(operModul = "机场控制", operType = "控制指令", operDesc = "负载控制")
    public ResponseResult seizePayloadAuthority(@PathVariable String sn, @Valid @RequestBody DronePayloadParam param) {
        return controlService.seizeAuthority(sn, DroneAuthorityEnum.PAYLOAD, param);
    }
 
    @PostMapping("/{sn}/payload/commands")
    @SysLogAnnotation(operModul = "机场控制", operType = "控制指令", operDesc = "相机模式开关")
    public ResponseResult payloadCommands(@PathVariable String sn, @Valid @RequestBody PayloadCommandsParam param) throws Exception {
        param.setSn(sn);
        return controlService.payloadCommands(param);
    }
 
 
}