liusuyi
2024-10-24 e9ad2e18fcff1e6adcf4dd624a8ec02f9cb6c13e
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package com.ard.tianyu.controller;
 
import com.ard.common.core.domain.AjaxResult;
import com.ard.tianyu.model.dto.BoxHistoryDTO;
import com.ard.tianyu.model.dto.BoxPhotosDTO;
import com.ard.tianyu.model.dto.BoxSettingsDTO;
import com.ard.tianyu.model.dto.signal.SignalInfo;
import com.ard.tianyu.model.dto.state.UavState;
import com.ard.tianyu.model.dto.telemetry.TelemetryData;
import com.ard.tianyu.model.receiver.BoxHistoryReceiver;
import com.ard.tianyu.model.receiver.BoxPhotosReceiver;
import com.ard.tianyu.model.receiver.BoxInfoReceiver;
import com.ard.tianyu.model.receiver.BoxStreamUrlReceiver;
import com.ard.tianyu.service.ITyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * UavTest
 *
 * @author liusuyi
 * @date 2024年10月21日13:52
 **/
@Api(tags = "无人机接口")
@RequestMapping("/uav")
@RestController
public class UavController {
 
    @Resource
    private ITyService tyService;
 
    @ApiOperation("获取天宇token信息")
    @GetMapping("/getToken")
    public AjaxResult getToken() {
        return AjaxResult.success(tyService.getAccessToken());
    }
 
    @ApiOperation("获取天宇盒子列表")
    @GetMapping("/getBoxList")
    public AjaxResult getBoxList() {
        List<BoxInfoReceiver> BoxList = tyService.getBoxList();
        return AjaxResult.success(BoxList);
    }
 
    @ApiOperation("获取直播地址")
    @GetMapping("/getBoxList/{boxSn}")
    public AjaxResult getBoxLiveUrl(@PathVariable("boxSn") String boxSn) {
        BoxStreamUrlReceiver boxLiveUrl = tyService.getBoxLiveUrl(boxSn);
        return AjaxResult.success(boxLiveUrl);
    }
 
    @ApiOperation("获取飞行历史")
    @PostMapping("/getBoxHistory")
    public AjaxResult getBoxHistory(@RequestBody BoxHistoryDTO boxHistoryDTO) {
        List<BoxHistoryReceiver> boxHistory = tyService.getBoxHistory(boxHistoryDTO);
        return AjaxResult.success(boxHistory);
    }
 
    @ApiOperation("获取任务照片")
    @PostMapping("/getBoxPhotos")
    public AjaxResult getBoxPhotos(@RequestBody BoxPhotosDTO boxPhotosDTO) {
        List<BoxPhotosReceiver> boxPhotos = tyService.getBoxPhotos(boxPhotosDTO);
        return AjaxResult.success(boxPhotos);
    }
 
    @ApiOperation("修改云盒设置")
    @PostMapping("/updateBoxSettings")
    public AjaxResult updateBoxSettings(@RequestBody BoxSettingsDTO boxSettingsDTO) {
        Boolean state = tyService.updateBoxSettings(boxSettingsDTO);
        return AjaxResult.success(state);
    }
 
    @ApiOperation("无人机控制订阅")
    @GetMapping("/uavControlSubscribe")
    public AjaxResult uavControlSubscribe(String boxSn) {
        tyService.uavControlSubscribe(boxSn);
        return AjaxResult.success();
    }
 
    @ApiOperation("云台转动(基于角度)")
    @GetMapping("/controlAngle")
    public AjaxResult controlAngle(String boxSn,Integer actionId,Integer rotationAngle) {
        tyService.controlAngle(boxSn,actionId,rotationAngle);
        return AjaxResult.success();
    }
 
    @ApiOperation("获取无人机状态")
    @GetMapping("/getUavState")
    public AjaxResult getUavState(String boxSn) {
        UavState uavState = tyService.getUavState(boxSn);
        return AjaxResult.success(uavState);
    }
 
    @ApiOperation("获取无人机遥测数据")
    @GetMapping("/getUavTelemetryData")
    public AjaxResult getUavTelemetryData(String boxSn) {
        TelemetryData telemetryData = tyService.getUavTelemetryData(boxSn);
        return AjaxResult.success(telemetryData);
    }
 
    @ApiOperation("获取无人机信道质量数据")
    @GetMapping("/getSignalInfo")
    public AjaxResult getSignalInfo(String boxSn) {
        SignalInfo signalInfo = tyService.getSignalInfo(boxSn);
        return AjaxResult.success(signalInfo);
    }
}