zhaowenyu
2025-11-26 f2c909e42b81bb7b589c956bfcf90dba3e16d0a8
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
@@ -29,6 +29,7 @@
import com.ard.work.domain.cache.UavSignalInfoCache;
import com.ard.work.domain.cache.UavStateCache;
import com.ard.work.domain.cache.UavTelemetryDataCache;
import com.ard.work.domain.cache.UavWaylineCache;
import com.ard.work.domain.dto.BoxHistoryDTO;
import com.ard.work.domain.dto.BoxPhotosDTO;
import com.ard.work.domain.dto.BoxSettingsDTO;
@@ -123,8 +124,8 @@
        if (ardDroneInfo == null) {
            throw new ControlException("未找到对应的飞行器信息,boxSn:{}" + boxSn);
        }
        TyHttpCommonReceiver<BoxStreamUrlReceiver> boxLiveUrl = tyClient.getBoxLiveUrl(ardDroneInfo.getServerId(),
                boxSn);
        return boxLiveUrl == null ? null : boxLiveUrl.getContent();
@@ -596,10 +597,41 @@
        if (ardDroneInfo == null) {
            throw new ControlException("未找到对应的飞行器信息,boxSn:{}" + boxSn);
        }
        FlyPointControlCancelCmd flyPointControlCancelCmd = new FlyPointControlCancelCmd(flyPointControlCancelDTO);
        this.sendMessage(ardDroneInfo.getServerId(), flyPointControlCancelCmd);
        return true;
    }
    /**
     * 环绕飞行控制
     */
    @Override
    public Boolean FlyRoundControl(FlyRoundControlDTO flyRoundControlDTO) {
        String boxSn = flyRoundControlDTO.getBoxSn();
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxSn);
        if (ardDroneInfo == null) {
            throw new ControlException("未找到对应的飞行器信息,boxSn:{}" + boxSn);
        }
        FlyRoundControlCmd flyRoundControlCmd = new FlyRoundControlCmd(flyRoundControlDTO);
        this.sendMessage(ardDroneInfo.getServerId(), flyRoundControlCmd);
        return true;
    }
    /**
     * 停止环绕飞行控制
     */
    @Override
    public Boolean FlyRoundControlCancel(FlyRoundControlCancelDTO flyRoundControlCancelDTO) {
        String boxSn = flyRoundControlCancelDTO.getBoxSn();
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxSn);
        if (ardDroneInfo == null) {
            throw new ControlException("未找到对应的飞行器信息,boxSn:{}" + boxSn);
        }
        FlyRoundControlCancelCmd flyRoundControlCancelCmd = new FlyRoundControlCancelCmd(flyRoundControlCancelDTO);
        this.sendMessage(ardDroneInfo.getServerId(), flyRoundControlCancelCmd);
        return true;
    }
@@ -614,8 +646,8 @@
        if (ardDroneInfo == null) {
            throw new ControlException("未找到对应的飞行器信息,boxSn:{}" + boxSn);
        }
        EmergencyBrakeCmd emergencyBrakeCmd = new EmergencyBrakeCmd(emeragencyBrakeDTO);
        this.sendMessage(ardDroneInfo.getServerId(), emergencyBrakeCmd);
        return true;
@@ -763,6 +795,7 @@
        }
        //wayLineUploadDTO.setWayLineData(this.CreatePlanLineData());//设置航线数据
        System.out.println("wayLineUploadDTO:-----------------" + wayLineUploadDTO);
        log.info("打印数据 ++++ wayLineUploadDTO:-----------------" + wayLineUploadDTO);
        WayLineUploadCmd wayLineUploadCmd = new WayLineUploadCmd(wayLineUploadDTO);
        System.out.println("wayLineUploadCmd:-----------------" + wayLineUploadCmd);
        this.sendMessage(ardDroneInfo.getServerId(), wayLineUploadCmd);
@@ -909,6 +942,11 @@
                // 处理无人机状态消息
                UavStateCmd uavStateCmd = (UavStateCmd) tyCommand;
                UavStateCache.put(uavStateCmd.getUavState());
                int flightMode = uavStateCmd.getUavState().getFlightControllerState().getFlightMode();
                if (flightMode != 14) {
                    //不在航线中 移除航线信息
                    UavWaylineCache.remove(uavStateCmd.getUavState().getBoxSn());
                }
                //logPrint("无人机状态", uavStateCmd.getUavState().getBoxSn());
                // WebSocketUtil.sendMessageAll(uavStateCmd.getUavState());
                break;
@@ -1041,6 +1079,12 @@
                    logPrint("设置返航点", returnPointSettingReplyCmd.getResult(),
                            returnPointSettingReplyCmd.getErrorCode());
                }
                //到达环绕位置回复
                if (tyCommand instanceof FlyRoundReplyCmd) {
                    FlyRoundReplyCmd flyRoundReplyCmd = (FlyRoundReplyCmd) tyCommand;
                    logPrint("到达环绕位置", flyRoundReplyCmd.getResult(),
                            flyRoundReplyCmd.getErrorCode());
                }
                break;
            case (byte) 0xD2:
                //设置视频码流回复