wangmengmeng
2025-04-26 96250617dbbefce55b5966c94880e2b07b6c98df
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
package com.dji.sample.control.controller;
 
import com.dji.sample.control.model.enums.DroneAuthorityEnum;
import com.dji.sample.control.model.enums.RemoteDebugMethodEnum;
import com.dji.sample.control.model.param.*;
import com.dji.sample.control.service.IControlService;
import com.dji.sdk.common.HttpResultResponse;
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}")//jjjjjjjjjjjj
    public HttpResultResponse createControlJob(@PathVariable String sn,
                                               @PathVariable("service_identifier") String serviceIdentifier,
                                               @Valid @RequestBody(required = false) RemoteDebugParam param) {
        return controlService.controlDockDebug(sn, RemoteDebugMethodEnum.find(serviceIdentifier), param);
    }
 
    @PostMapping("/jobs/fly-to-point")
    public HttpResultResponse flyToPoint(@RequestParam(value = "device_sn")  String sn, @Valid @RequestBody FlyToPointParam param) {
        return controlService.flyToPoint(sn, param);
    }
 
    @DeleteMapping("/jobs/fly-to-point")
    public HttpResultResponse flyToPointStop(@RequestParam(value = "device_sn")  String sn) {
        return controlService.flyToPointStop(sn);
    }
 
    @PostMapping("/jobs/takeoff-to-point")
    public HttpResultResponse takeoffToPoint(@RequestParam(value = "device_sn")  String sn, @Valid @RequestBody TakeoffToPointParam param) {
        return controlService.takeoffToPoint(sn, param);
    }
 
    @PostMapping("/authority/flight")
    public HttpResultResponse seizeFlightAuthority(@RequestParam(value = "device_sn")  String sn) {
        return controlService.seizeAuthority(sn, DroneAuthorityEnum.FLIGHT, null);
    }
 
    @PostMapping("/authority/payload")
    public HttpResultResponse seizePayloadAuthority(@RequestParam(value = "device_sn")  String sn, @Valid @RequestBody DronePayloadParam param) {
        return controlService.seizeAuthority(sn, DroneAuthorityEnum.PAYLOAD, param);
    }
 
    @PostMapping("/{sn}/payload/commands")
    public HttpResultResponse payloadCommands(@PathVariable String sn, @Valid @RequestBody PayloadCommandsParam param) throws Exception {
        param.setSn(sn);
        return controlService.payloadCommands(param);
    }
    /**
     * cameraFrameZoom.
     * @param sn
     * @return
     */
//    @PostMapping("/camera-frame/zoom")
//    public HttpResultResponse cameraFrameZoom(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraFrameZoomParam param) {
//        return controlService.cameraFrameZoom(sn,param);
//    }
 
    /**
     * cameraModeSwitch.
     * @param sn
     * @return
     */
    @PostMapping("/camera-mode/switch")
    public HttpResultResponse cameraModeSwitch(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraModeSwitchParam param) {
        return controlService.cameraModeSwitch(sn,param);
    }
 
    /**
     * cameraPhotoTake.
     * @param sn
     * @return
     */
    @PostMapping("/camera-photo/take")
    public HttpResultResponse cameraPhotoTake(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraPhotoTakeParam param) {
        return controlService.cameraPhotoTake(sn,param);
    }
 
    /**
     * cameraPhotoStop.
     * @param sn
     * @return
     */
    @PostMapping("/camera-photo/stop")
    public HttpResultResponse cameraPhotoStop(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraPhotoStopParam param) {
        return controlService.cameraPhotoStop(sn,param);
    }
 
    /**
     * cameraRecordingStart.
     * @param sn
     * @return
     */
    @PostMapping("/camera-recording/start")
    public HttpResultResponse cameraRecordingStart(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraRecordingStartParam param) {
        return controlService.cameraRecordingStart(sn,param);
    }
 
    /**
     * cameraRecordingStop.
     * @param sn
     * @return
     */
    @PostMapping("/camera-recording/stop")
    public HttpResultResponse cameraRecordingStop(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraRecordingStopParam param) {
        return controlService.cameraRecordingStop(sn,param);
    }
 
    /**
     * cameraScreenDrag.
     * @param sn
     * @return
     */
//    @PostMapping("/camera-screen/drag")
//    public HttpResultResponse cameraScreenDrag(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraScreenDragParam param) {
//        return controlService.cameraScreenDrag(sn,param);
//    }
 
    /**
     * cameraFocalLengthSet.
     * @param sn
     * @return
     */
    @PostMapping("/camera-focal-length/set")
    public HttpResultResponse cameraFocalLengthSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraFocalLengthSetParam param) {
        return controlService.cameraFocalLengthSet(sn,param);
    }
 
    /**
     * gimbalReset.
     * @param sn
     * @return
     */
    @PostMapping("/gimbal/reset")
    public HttpResultResponse gimbalReset(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody GimbalResetParam param) {
        return controlService.gimbalReset(sn,param);
    }
 
    /**
     * cameraScreenSplit.
     * @param sn
     * @return
     */
    @PostMapping("/camera-screen/split")
    public HttpResultResponse cameraScreenSplit(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraScreenSplitParam param) {
        return controlService.cameraScreenSplit(sn,param);
    }
 
    /**
     * photoStorageSet.
     * @param sn
     * @return
     */
    @PostMapping("/photo-storage/set")
    public HttpResultResponse photoStorageSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody PhotoStorageSetParam param) {
        return controlService.photoStorageSet(sn,param);
    }
 
    /**
     * videoStorageSet.
     * @param sn
     * @return
     */
    @PostMapping("/video-storage/set")
    public HttpResultResponse videoStorageSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody VideoStorageSetParam param) {
        return controlService.videoStorageSet(sn,param);
    }
 
    /**
     * cameraExposureModeSet.
     * @param sn
     * @return
     */
    @PostMapping("/camera-exposure-mode/set")
    public HttpResultResponse cameraExposureModeSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraExposureModeSetParam param) {
        return controlService.cameraExposureModeSet(sn,param);
    }
 
    /**
     * cameraExposureSet.
     * @param sn
     * @return
     */
    @PostMapping("/camera-exposure/set")
    public HttpResultResponse cameraExposureSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraExposureSetParam param) {
        return controlService.cameraExposureSet(sn,param);
    }
 
    /**
     * cameraFocusModeSet.
     * @param sn
     * @return
     */
    @PostMapping("/camera-focus-mode/set")
    public HttpResultResponse cameraFocusModeSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraFocusModeSetParam param) {
        return controlService.cameraFocusModeSet(sn,param);
    }
 
    /**
     * cameraFocusValueSet.
     * @param sn
     * @return
     */
    @PostMapping("/camera-focus-value/set")
    public HttpResultResponse cameraFocusValueSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraFocusValueSetParam param) {
        return controlService.cameraFocusValueSet(sn,param);
    }
 
    /**
     * cameraPointFocusAction.
     * @param sn
     * @return
     */
    @PostMapping("/camera-point-focus-action")
    public HttpResultResponse cameraPointFocusAction(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraPointFocusActionParam param) {
        return controlService.cameraPointFocusAction(sn,param);
    }
 
    /**
     * irMeteringModeSet.
     * @param sn
     * @return
     */
    @PostMapping("/ir-metering-mode/set")
    public HttpResultResponse irMeteringModeSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody IrMeteringModeSetParam param) {
        return controlService.irMeteringModeSet(sn,param);
    }
 
    /**
     * irMeteringPointSet.
     * @param sn
     * @return
     */
    @PostMapping("/ir-metering-point/set")
    public HttpResultResponse irMeteringPointSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody IrMeteringPointSetParam param) {
        return controlService.irMeteringPointSet(sn,param);
    }
 
    /**
     * irMeteringAreaSet.
     * @param sn
     * @return
     */
    @PostMapping("/ir-metering-area/set")
    public HttpResultResponse irMeteringAreaSet(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody IrMeteringAreaSetParam param) {
        return controlService.irMeteringAreaSet(sn,param);
    }
 
    /**
     * flyToPointUpdate.
     * @param sn
     * @return
     */
    @PostMapping("/fly-to-point/update")
    public HttpResultResponse flyToPointUpdate(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody FlyToPointUpdateParam param) {
        return controlService.flyToPointUpdate(sn,param);
    }
 
    /**
     * cameraAim.
     * @param sn
     * @return
     */
    @PostMapping("/camera/aim")
    public HttpResultResponse cameraAim(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraAimParam param) {
        return controlService.cameraAim(sn,param);
    }
 
    /**
     * cameraLookAt.
     * @param sn
     * @return
     */
    @PostMapping("/camera/look-at")
    public HttpResultResponse cameraLookAt(@RequestParam(value = "device_sn")  String sn,@Valid @RequestBody CameraLookAtParam param) {
        return controlService.cameraLookAt(sn,param);
    }
 
}