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);
|
}
|
|
|
}
|