rain
2024-08-14 ea73b6fb3ad0b34e4d856321afecae5ada1091fe
src/main/java/com/dji/sample/control/service/impl/PayloadCommandsHandler.java
@@ -33,19 +33,19 @@
        Optional<OsdSubDeviceReceiver> deviceOpt = SpringBeanUtils.getBean(IDeviceRedisService.class)
                .getDeviceOsd(deviceSn, OsdSubDeviceReceiver.class);
        if (deviceOpt.isEmpty()) {
            throw new RuntimeException("The device is offline.");
            throw new RuntimeException("设备离线");
        }
        osdCamera = deviceOpt.get().getCameras().stream()
                .filter(osdCamera -> param.getPayloadIndex().equals(osdCamera.getPayloadIndex()))
                .findAny()
                .orElseThrow(() -> new RuntimeException("Did not receive osd information about the camera, please check the cache data."));
                .orElseThrow(() -> new RuntimeException("没有收到相机osd信息,请检查缓存数据"));
        return true;
    }
    private String checkDockOnline(String dockSn) {
        Optional<DeviceDTO> deviceOpt = SpringBeanUtils.getBean(IDeviceRedisService.class).getDeviceOnline(dockSn);
        if (deviceOpt.isEmpty()) {
            throw new RuntimeException("The dock is offline.");
            throw new RuntimeException("设备离线");
        }
        return deviceOpt.get().getChildDeviceSn();
    }
@@ -53,7 +53,7 @@
    private void checkDeviceOnline(String deviceSn) {
        boolean isOnline = SpringBeanUtils.getBean(IDeviceRedisService.class).checkDeviceOnline(deviceSn);
        if (!isOnline) {
            throw new RuntimeException("The device is offline.");
            throw new RuntimeException("设备离线");
        }
    }
@@ -61,13 +61,13 @@
        boolean hasAuthority = SpringBeanUtils.getBean(IDevicePayloadService.class)
                .checkAuthorityPayload(deviceSn, param.getPayloadIndex());
        if (!hasAuthority) {
            throw new RuntimeException("The device does not have payload control authority.");
            throw new RuntimeException("设备没有有效载荷控制权限");
        }
    }
    public final void checkCondition(String dockSn) {
        if (!valid()) {
            throw new RuntimeException("illegal argument");
            throw new RuntimeException("非法参数");
        }
        String deviceSn = checkDockOnline(dockSn);
@@ -75,7 +75,7 @@
        checkAuthority(deviceSn);
        if (!canPublish(deviceSn)) {
            throw new RuntimeException("The current state of the drone does not support this function, please try again later.");
            throw new RuntimeException("无人机当前状态不支持此功能,请稍后再试");
        }
    }