From dcd78a1cfa0c929403d51a347e43414f6aa5f0d8 Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期一, 04 一月 2021 18:30:44 +0800 Subject: [PATCH] 存储部分使用sqlite代替redis-3 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java | 34 ++++++++++++++++++++++++---------- 1 files changed, 24 insertions(+), 10 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 e7bda4e..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,7 +187,7 @@ DeviceChannel deviceChannel = new DeviceChannel(); deviceChannel.setName(channelName); deviceChannel.setChannelId(channelDeviceId); - // ONLINE OFFLINE 閮ㄥ垎NVR鐨勫吋瀹规�у鐞� + // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR鐨勫吋瀹规�у鐞� if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) { deviceChannel.setStatus(1); } @@ -294,7 +297,7 @@ device.setStreamMode("UDP"); } storager.updateDevice(device); - cmder.catalogQuery(device); + cmder.catalogQuery(device, null); // 鍥炲200 OK responseAck(evt); if (offLineDetector.isOnline(deviceId)) { @@ -315,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(); } @@ -447,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) { @@ -503,4 +510,11 @@ this.offLineDetector = offLineDetector; } + public IRedisCatchStorage getRedisCatchStorage() { + return redisCatchStorage; + } + + public void setRedisCatchStorage(IRedisCatchStorage redisCatchStorage) { + this.redisCatchStorage = redisCatchStorage; + } } -- Gitblit v1.8.0