| | |
| | | import com.ard.tianyu.model.dto.converter.UavTelemetryDataConverter; |
| | | import com.ard.tianyu.model.dto.manual.*; |
| | | import com.ard.tianyu.model.dto.signal.SignalInfo; |
| | | 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.receiver.*; |
| | |
| | | import com.ard.tianyu.netty.command.real.UavStateCmd; |
| | | 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.handler.ErrorCodeEnum; |
| | | import com.ard.tianyu.service.ITyService; |
| | | import com.ard.tianyu.websocket.utils.WebSocketUtil; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 喊话模式切换 |
| | | */ |
| | | @Override |
| | | public void speakModeSwitch(SpeakModeSwitchDTO speakModeSwitchDTO) { |
| | | SpeakModeSwitchCmd speakModeSwitchCmd = new SpeakModeSwitchCmd(speakModeSwitchDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), speakModeSwitchCmd); |
| | | } |
| | | |
| | | /** |
| | | * 文字喊话 |
| | | */ |
| | | @Override |
| | | public void textSpeak(TextSpeakDTO textSpeakDTO) { |
| | | TextSpeakCmd textSpeakCmd = new TextSpeakCmd(textSpeakDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), textSpeakCmd); |
| | | } |
| | | |
| | | /** |
| | | * 实时喊话 |
| | | */ |
| | | @Override |
| | | public void realSpeak(RealSpeakDTO realSpeakDTO) { |
| | | RealSpeakCmd realSpeakCmd = new RealSpeakCmd(realSpeakDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), realSpeakCmd); |
| | | } |
| | | |
| | | /** |
| | | * 录音喊话 |
| | | */ |
| | | @Override |
| | | public void recordSpeak(RecordSpeakDTO recordSpeakDTO) { |
| | | RecordSpeakCmd recordSpeakCmd = new RecordSpeakCmd(recordSpeakDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), recordSpeakCmd); |
| | | } |
| | | /** |
| | | * 设置音量 |
| | | */ |
| | | @Override |
| | | public void volumeSetting(VolumeSettingDTO volumeSettingDTO) { |
| | | VolumeSettingCmd volumeSettingCmd = new VolumeSettingCmd(volumeSettingDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), volumeSettingCmd); |
| | | } |
| | | |
| | | /** |
| | | * 设置循环播放 |
| | | */ |
| | | @Override |
| | | public void loopSetting(LoopSettingDTO loopSettingDTO) { |
| | | LoopSettingCmd loopSettingCmd = new LoopSettingCmd(loopSettingDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), loopSettingCmd); |
| | | } |
| | | /** |
| | | * 停止喊话 |
| | | */ |
| | | @Override |
| | | public void stopSpeak(StopSpeakDTO stopSpeakDTO) { |
| | | StopSpeakCmd stopSpeakCmd=new StopSpeakCmd(stopSpeakDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), stopSpeakCmd); |
| | | } |
| | | |
| | | /** |
| | | * 处理天宇服务器返回的消息 |
| | | */ |
| | | @Override |
| | |
| | | case (byte) 0xA9: |
| | | // 处理无人机遥测消息 |
| | | UavTelemetryDataCmd uavTelemetryDataCmd = (UavTelemetryDataCmd) tyCommand; |
| | | if (uavTelemetryDataCmd.getBoxSn() == null) { |
| | | return; |
| | | } |
| | | String boxSn = ByteUtils.bytesToString(uavTelemetryDataCmd.getBoxSn()); // 假设有获取无人机ID的方法 |
| | | long currentTime = System.currentTimeMillis(); |
| | | |