| | |
| | | import com.ard.tianyu.model.dto.speaker.*; |
| | | import com.ard.tianyu.model.dto.state.UavState; |
| | | import com.ard.tianyu.model.dto.telemetry.TelemetryData; |
| | | import com.ard.tianyu.model.dto.wayline.PlanLineData; |
| | | import com.ard.tianyu.model.dto.wayline.WayLineUploadDTO; |
| | | import com.ard.tianyu.model.dto.wayline.*; |
| | | import com.ard.tianyu.model.receiver.*; |
| | | import com.ard.tianyu.netty.command.*; |
| | | import com.ard.tianyu.netty.TyNettyTcpClient; |
| | |
| | | import com.ard.tianyu.netty.command.real.UavTelemetryDataCmd; |
| | | import com.ard.tianyu.netty.command.register.*; |
| | | import com.ard.tianyu.netty.command.speaker.*; |
| | | import com.ard.tianyu.netty.command.wayline.WayLineUploadCmd; |
| | | import com.ard.tianyu.netty.command.wayline.WayLineUploadReplyCmd; |
| | | import com.ard.tianyu.netty.command.wayline.*; |
| | | import com.ard.tianyu.netty.handler.ErrorCodeEnum; |
| | | import com.ard.tianyu.netty.protobuf.TelemetryDataPB; |
| | | import com.ard.tianyu.service.ITyService; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 航线开始 |
| | | */ |
| | | @Override |
| | | public void wayLineBegin(WayLineBeginDTO wayLineBeginDTO) { |
| | | WayLineBeginCmd wayLineBeginCmd = new WayLineBeginCmd(wayLineBeginDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), wayLineBeginCmd); |
| | | } |
| | | |
| | | /** |
| | | * 航线暂停 |
| | | */ |
| | | @Override |
| | | public void wayLinePause(WayLinePauseDTO wayLinePauseDTO) { |
| | | WayLinePauseCmd wayLinePauseCmd = new WayLinePauseCmd(wayLinePauseDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), wayLinePauseCmd); |
| | | } |
| | | |
| | | /** |
| | | * 航线恢复 |
| | | */ |
| | | @Override |
| | | public void wayLineResume(WayLineResumeDTO wayLineResumeDTO) { |
| | | WayLineResumeCmd wayLineResumeCmd = new WayLineResumeCmd(wayLineResumeDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), wayLineResumeCmd); |
| | | } |
| | | |
| | | /** |
| | | * 航线结束 |
| | | */ |
| | | @Override |
| | | public void wayLineEnd(WayLineEndDTO wayLineEndDTO) { |
| | | WayLineEndCmd wayLineEndCmd = new WayLineEndCmd(wayLineEndDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), wayLineEndCmd); |
| | | } |
| | | |
| | | /** |
| | | * 处理天宇服务器返回的消息 |
| | | */ |
| | | @Override |
| | |
| | | WayLineUploadReplyCmd wayLineUploadReplyCmd = (WayLineUploadReplyCmd) tyCommand; |
| | | logPrint("上传航线", wayLineUploadReplyCmd.getResult(), wayLineUploadReplyCmd.getErrorCode()); |
| | | } |
| | | //开始航线回复 |
| | | if (tyCommand instanceof WayLineBeginReplyCmd) { |
| | | WayLineBeginReplyCmd wayLineBeginReplyCmd = (WayLineBeginReplyCmd) tyCommand; |
| | | logPrint("上传航线", wayLineBeginReplyCmd.getResult(), wayLineBeginReplyCmd.getErrorCode()); |
| | | } |
| | | //暂停航线回复 |
| | | if (tyCommand instanceof WayLinePauseReplyCmd) { |
| | | WayLinePauseReplyCmd wayLinePauseReplyCmd = (WayLinePauseReplyCmd) tyCommand; |
| | | logPrint("上传航线", wayLinePauseReplyCmd.getResult(), wayLinePauseReplyCmd.getErrorCode()); |
| | | } |
| | | //恢复航线回复 |
| | | if (tyCommand instanceof WayLineResumeReplyCmd) { |
| | | WayLineResumeReplyCmd wayLineResumeReplyCmd = (WayLineResumeReplyCmd) tyCommand; |
| | | logPrint("上传航线", wayLineResumeReplyCmd.getResult(), wayLineResumeReplyCmd.getErrorCode()); |
| | | } |
| | | //结束航线回复 |
| | | if (tyCommand instanceof WayLineEndReplyCmd) { |
| | | WayLineEndReplyCmd wayLineEndReplyCmd = (WayLineEndReplyCmd) tyCommand; |
| | | logPrint("上传航线", wayLineEndReplyCmd.getResult(), wayLineEndReplyCmd.getErrorCode()); |
| | | } |
| | | break; |
| | | default: |
| | | // 处理其他消息 |
| | |
| | | */ |
| | | @Scheduled(fixedRate = 3000) |
| | | public void sendHeartBeat() { |
| | | if(!TyTcpServerCache.getTcpServerCache(tyConfiguration.getTcpserver() + ":" + tyConfiguration.getTcpport())) |
| | | { |
| | | if (!TyTcpServerCache.getTcpServerCache(tyConfiguration.getTcpserver() + ":" + tyConfiguration.getTcpport())) { |
| | | return; |
| | | } |
| | | long timestamp = System.currentTimeMillis(); |