| | |
| | | import com.ard.common.core.redis.RedisOpsUtils; |
| | | import com.ard.sample.component.websocket.enums.MessageType; |
| | | import com.ard.sample.component.websocket.handler.DockWebSocketHandler; |
| | | import com.ard.sample.component.websocket.handler.LiveStreamHandler; |
| | | import com.ard.sample.component.websocket.service.ISendMessageService; |
| | | import com.ard.sample.manage.model.dto.BasicDeviceProperty; |
| | | import com.ard.sample.manage.model.dto.DeviceDTO; |
| | |
| | | |
| | | @Autowired |
| | | private IDeviceService _deviceService; |
| | | |
| | | @Autowired |
| | | private LiveStreamHandler _liveStreamHandler; |
| | | |
| | | // @Autowired |
| | | // private IWebSocketManageService webSocketManageService; |
| | |
| | | if (!isExist) { |
| | | return ResponseResult.error(CommonErrorEnum.DEVICE_OFFLINE.getErrorCode(), CommonErrorEnum.DEVICE_OFFLINE.getErrorMsg()); |
| | | } |
| | | DeviceDTO device = (DeviceDTO) RedisOpsUtils.get(RedisConst.DEVICE_ONLINE_PREFIX + sn); |
| | | // 重启机场时清redis视频直播地址,机场重启不掉线。但是流停了。 |
| | | if(RemoteControlMethodEnum.DEVICE_REBOOT == controlMethodEnum) { |
| | | DeviceDTO device = (DeviceDTO) RedisOpsUtils.get(RedisConst.DEVICE_ONLINE_PREFIX + sn); |
| | | // 重启机场时,读取舱盖状态,开舱盖不让重启,关舱盖重启 |
| | | Integer cover_state = (Integer)RedisOpsUtils.get(RedisConst.COVER_STATE_OSD_PREFIX + device.getDeviceSn()); |
| | | if(cover_state != null && cover_state != 0) { |
| | |
| | | RedisOpsUtils.del(RedisConst.COVER_STATE_PREFIX + sn); |
| | | RedisOpsUtils.del(RedisConst.WEBSOCKET_VIDEO_ADDRESS_PREFIX + device.getChildDeviceSn()); |
| | | } |
| | | if(RemoteControlMethodEnum.DRONE_CLOSE == controlMethodEnum) { |
| | | // 飞行器关机时drone_close,关闭飞行器视频流 |
| | | _liveStreamHandler.StopLiveStreaming(device.getChildDeviceSn()); |
| | | RedisOpsUtils.del(RedisConst.WEBSOCKET_VIDEO_ADDRESS_PREFIX + device.getChildDeviceSn()); |
| | | log.info("SN: {}-飞行器关机,停止直播并删除redis直播信息!", device.getChildDeviceSn()); |
| | | } |
| | | String topic = TopicConst.THING_MODEL_PRE + TopicConst.PRODUCT + sn + TopicConst.SERVICES_SUF; |
| | | String bid = UUID.randomUUID().toString(); |
| | | ServiceReply serviceReplyOpt = messageSenderService.publishWithReply( |