| | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | |
| | | /** |
| | | * @author sean |
| | |
| | | @SysLogAnnotation(operModul = "云台拍照录像控制", operType = "控制指令", operDesc = "云台拍照录像控制") |
| | | public ResponseResult photoAndVideoCmd(@PathVariable String sn, @PathVariable String type) throws Exception { |
| | | |
| | | String bid = UUID.randomUUID().toString(); |
| | | |
| | | List<DeviceDTO> list = deviceService.getDevicesByParams(DeviceQueryParam.builder().deviceSn(sn).build()); |
| | | |
| | | if (list.isEmpty()) { |
| | |
| | | param.setSn(sn); |
| | | DronePayloadParam data = new DronePayloadParam(); |
| | | data.setPayloadIndex(cameraDTO.getPayloadIndex()); |
| | | |
| | | //拍照 |
| | | switch (type) { |
| | | case "photo": |
| | |
| | | //切换模式 |
| | | ResponseResult swResult = switchingMode(sn, CameraModeEnum.PHOTO, cameraDTO); |
| | | log.info("摄像头切换状态:{}", swResult); |
| | | |
| | | } |
| | | param.setCmd(PayloadCommandsEnum.CAMERA_PHOTO_TAKE); |
| | | param.setData(data); |
| | | break; |
| | | case "video_start": {//开始录像 |
| | | if (Objects.equals(cameraDTO.getCameraMode().getMode(), CameraModeEnum.PHOTO.getMode())) { |
| | | if (!Objects.equals(cameraDTO.getCameraMode().getMode(), CameraModeEnum.VIDEO.getMode())) { |
| | | //切换模式 |
| | | ResponseResult swResult = switchingMode(sn, CameraModeEnum.VIDEO, cameraDTO); |
| | | log.info("摄像头切换状态:{}", swResult); |
| | |
| | | break; |
| | | } |
| | | case "video_stop": {//结束录像 |
| | | if (Objects.equals(cameraDTO.getCameraMode().getMode(), CameraModeEnum.PHOTO.getMode())) { |
| | | if (!Objects.equals(cameraDTO.getCameraMode().getMode(), CameraModeEnum.VIDEO.getMode())) { |
| | | //切换模式 |
| | | ResponseResult swResult = switchingMode(sn, CameraModeEnum.VIDEO, cameraDTO); |
| | | log.info("摄像头切换状态:{}", swResult); |
| | |
| | | return ResponseResult.error(-1, "未知类型!"); |
| | | } |
| | | |
| | | return controlService.payloadCommands(param); |
| | | |
| | | Thread.sleep(2000); // 延迟2000毫秒(2秒) |
| | | |
| | | return controlService.payloadCommands(param,bid); |
| | | } |
| | | |
| | | /** |