| | |
| | | |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.component.mqtt.service.IMessageSenderService; |
| | | import com.dji.sample.patches.utils.MultipartFileTOFileUtil; |
| | | import com.dji.sample.speak.model.dto.PsdkModelDto; |
| | | import com.dji.sample.speak.model.dto.SpeakVoiceStartDto; |
| | | import com.dji.sample.speak.model.dto.SpeakVolumeDto; |
| | | import com.dji.sample.speak.model.enums.FormatEnum; |
| | | import com.dji.sample.speak.model.param.SpeakVoiceStartParam; |
| | | import com.dji.sample.speak.service.SpeakVoiceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | |
| | |
| | | private SpeakVoiceService voiceServicel; |
| | | |
| | | @PostMapping("/startVoice") |
| | | public ResponseResult takeVoice(String sn , SpeakVoiceStartParam param) { |
| | | return ResponseResult.success(voiceServicel.takeVoice(sn,param)); |
| | | public ResponseResult takeVoice(@RequestParam String sn, |
| | | @RequestParam int psdk_index, |
| | | @RequestParam String name, |
| | | @RequestParam MultipartFile file) { |
| | | File file1=MultipartFileTOFileUtil.multipartFile2File(file,"src/main/resources/tmp/20240614"); |
| | | return ResponseResult.success(voiceServicel.takeVoice(sn, psdk_index,name,file1)); |
| | | } |
| | | |
| | | @PostMapping("/stopVoice") |
| | | public ResponseResult stopVoice() { |
| | | return ResponseResult.success(voiceServicel.stopVoice()); |
| | | public ResponseResult stopVoice(@RequestParam int psdk_index, @RequestParam String sn) { |
| | | return ResponseResult.success(voiceServicel.stopVoice(sn, psdk_index)); |
| | | } |
| | | |
| | | @PostMapping("/voiceVolumn") |
| | | public ResponseResult voiceVolumn(SpeakVolumeDto dto) { |
| | | return ResponseResult.success(voiceServicel.setVoiceVolume(dto)); |
| | | public ResponseResult voiceVolumn(@RequestBody SpeakVolumeDto dto, @RequestParam String sn) { |
| | | return ResponseResult.success(voiceServicel.setVoiceVolume(dto, sn)); |
| | | } |
| | | |
| | | @PostMapping("/voiceMode") |
| | | public ResponseResult restartVoice(PsdkModelDto dto) { |
| | | return ResponseResult.success(voiceServicel.setVoiceMode(dto)); |
| | | public ResponseResult restartVoice(@RequestBody PsdkModelDto dto, @RequestParam String sn) { |
| | | return ResponseResult.success(voiceServicel.setVoiceMode(sn, dto)); |
| | | } |
| | | |
| | | @PostMapping("/restartVoice") |
| | | public ResponseResult restartVoice() { |
| | | return ResponseResult.success(voiceServicel.restartVoice()); |
| | | public ResponseResult restartVoice(@RequestParam int psdkIndex, @RequestParam String sn) { |
| | | return ResponseResult.success(voiceServicel.restartVoice(sn, psdkIndex)); |
| | | } |
| | | } |