From 730a64be077b51add311b9d880bb23f5162253ec Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期二, 05 一月 2021 14:35:43 +0800 Subject: [PATCH] 优化录像查询,优化注释 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java | 37 ++++++++++++++++++++++++++----------- 1 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java index 4c95cf1..cab4a9b 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java @@ -10,6 +10,7 @@ import javax.sip.message.Request; import javax.sip.message.Response; +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; @@ -47,6 +48,8 @@ private SIPCommander cmder; private IVideoManagerStorager storager; + + private IRedisCatchStorage redisCatchStorage; private EventPublisher publisher; @@ -184,10 +187,11 @@ DeviceChannel deviceChannel = new DeviceChannel(); deviceChannel.setName(channelName); deviceChannel.setChannelId(channelDeviceId); - if (status.equals("ON") || status.equals("On")) { + // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR鐨勫吋瀹规�у鐞� + if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) { deviceChannel.setStatus(1); } - if (status.equals("OFF") || status.equals("Off")) { + if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) { deviceChannel.setStatus(0); } @@ -293,7 +297,7 @@ device.setStreamMode("UDP"); } storager.updateDevice(device); - cmder.catalogQuery(device); + cmder.catalogQuery(device, null); // 鍥炲200 OK responseAck(evt); if (offLineDetector.isOnline(deviceId)) { @@ -314,12 +318,16 @@ try { Element rootElement = getRootElement(evt); String deviceId = XmlUtil.getText(rootElement, "DeviceID"); - // 鍥炲200 OK - responseAck(evt); - if (offLineDetector.isOnline(deviceId)) { - publisher.onlineEventPublish(deviceId, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE); - } else { + // 妫�鏌ヨ澶囨槸鍚﹀瓨鍦紝 涓嶅瓨鍦ㄥ垯涓嶅洖澶� + if (storager.exists(deviceId)) { + // 鍥炲200 OK + responseAck(evt); + if (offLineDetector.isOnline(deviceId)) { + publisher.onlineEventPublish(deviceId, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE); + } else { + } } + } catch (ParseException | SipException | InvalidArgumentException | DocumentException e) { e.printStackTrace(); } @@ -446,10 +454,10 @@ String NotifyType =XmlUtil.getText(rootElement, "NotifyType"); if (NotifyType.equals("121")){ logger.info("濯掍綋鎾斁瀹屾瘯锛岄�氱煡鍏虫祦"); - StreamInfo streamInfo = storager.queryPlaybackByDevice(deviceId, "*"); + StreamInfo streamInfo = redisCatchStorage.queryPlaybackByDevice(deviceId, "*"); if (streamInfo != null) { - storager.stopPlayback(streamInfo); - cmder.streamByeCmd(streamInfo.getSsrc()); + redisCatchStorage.stopPlayback(streamInfo); + cmder.streamByeCmd(streamInfo.getStreamId()); } } } catch (ParseException | SipException | InvalidArgumentException | DocumentException e) { @@ -502,4 +510,11 @@ this.offLineDetector = offLineDetector; } + public IRedisCatchStorage getRedisCatchStorage() { + return redisCatchStorage; + } + + public void setRedisCatchStorage(IRedisCatchStorage redisCatchStorage) { + this.redisCatchStorage = redisCatchStorage; + } } -- Gitblit v1.8.0