Commit ff3c30f32e77aba0035583e4912723e6389d9e9f
1 parent
db865cc9
优化收到心跳设置设备上线的逻辑
Showing
12 changed files
with
30 additions
and
72 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/event/DeviceOffLineDetector.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.gb28181.event; | ||
| 2 | - | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetting; | ||
| 4 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | -import org.springframework.stereotype.Component; | ||
| 6 | - | ||
| 7 | -import com.genersoft.iot.vmp.common.VideoManagerConstants; | ||
| 8 | -import com.genersoft.iot.vmp.utils.redis.RedisUtil; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * @description:设备离在线状态检测器,用于检测设备状态 | ||
| 12 | - * @author: swwheihei | ||
| 13 | - * @date: 2020年5月13日 下午2:40:29 | ||
| 14 | - */ | ||
| 15 | -@Component | ||
| 16 | -public class DeviceOffLineDetector { | ||
| 17 | - | ||
| 18 | - @Autowired | ||
| 19 | - private RedisUtil redis; | ||
| 20 | - | ||
| 21 | - @Autowired | ||
| 22 | - private UserSetting userSetting; | ||
| 23 | - | ||
| 24 | - public boolean isOnline(String deviceId) { | ||
| 25 | - String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + deviceId; | ||
| 26 | - return redis.hasKey(key); | ||
| 27 | - } | ||
| 28 | -} |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -340,7 +340,7 @@ public class SIPCommander implements ISIPCommander { | @@ -340,7 +340,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 340 | * @param channelId 预览通道 | 340 | * @param channelId 预览通道 |
| 341 | * @param event hook订阅 | 341 | * @param event hook订阅 |
| 342 | * @param errorEvent sip错误订阅 | 342 | * @param errorEvent sip错误订阅 |
| 343 | - */ | 343 | + */ |
| 344 | @Override | 344 | @Override |
| 345 | public void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, | 345 | public void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, |
| 346 | ZLMHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) { | 346 | ZLMHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) { |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
| @@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; | @@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; | ||
| 5 | import com.genersoft.iot.vmp.conf.SipConfig; | 5 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 6 | import com.genersoft.iot.vmp.conf.UserSetting; | 6 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 7 | import com.genersoft.iot.vmp.gb28181.bean.*; | 7 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 8 | -import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | ||
| 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 10 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 9 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| @@ -19,7 +18,6 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | @@ -19,7 +18,6 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | ||
| 19 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | 18 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 20 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 21 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 20 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 22 | -import com.genersoft.iot.vmp.utils.GpsUtil; | ||
| 23 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 21 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 24 | import org.dom4j.DocumentException; | 22 | import org.dom4j.DocumentException; |
| 25 | import org.dom4j.Element; | 23 | import org.dom4j.Element; |
| @@ -65,10 +63,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -65,10 +63,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 65 | @Autowired | 63 | @Autowired |
| 66 | private EventPublisher publisher; | 64 | private EventPublisher publisher; |
| 67 | 65 | ||
| 68 | - @Autowired | ||
| 69 | - private DeviceOffLineDetector offLineDetector; | ||
| 70 | - | ||
| 71 | - | ||
| 72 | private String method = "NOTIFY"; | 66 | private String method = "NOTIFY"; |
| 73 | 67 | ||
| 74 | @Autowired | 68 | @Autowired |
| @@ -240,7 +234,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -240,7 +234,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 240 | 234 | ||
| 241 | // 回复200 OK | 235 | // 回复200 OK |
| 242 | responseAck(evt, Response.OK); | 236 | responseAck(evt, Response.OK); |
| 243 | - if (offLineDetector.isOnline(deviceId)) { | 237 | + if (redisCatchStorage.deviceIsOnline(deviceId)) { |
| 244 | publisher.deviceAlarmEventPublish(deviceAlarm); | 238 | publisher.deviceAlarmEventPublish(deviceAlarm); |
| 245 | } | 239 | } |
| 246 | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { | 240 | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| @@ -331,7 +325,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -331,7 +325,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 331 | 325 | ||
| 332 | } | 326 | } |
| 333 | 327 | ||
| 334 | - if (!offLineDetector.isOnline(deviceId)) { | 328 | + if (!redisCatchStorage.deviceIsOnline(deviceId)) { |
| 335 | publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE); | 329 | publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE); |
| 336 | } | 330 | } |
| 337 | } | 331 | } |
| @@ -357,10 +351,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -357,10 +351,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 357 | public void setDeferredResultHolder(DeferredResultHolder deferredResultHolder) { | 351 | public void setDeferredResultHolder(DeferredResultHolder deferredResultHolder) { |
| 358 | } | 352 | } |
| 359 | 353 | ||
| 360 | - public void setOffLineDetector(DeviceOffLineDetector offLineDetector) { | ||
| 361 | - this.offLineDetector = offLineDetector; | ||
| 362 | - } | ||
| 363 | - | ||
| 364 | public IRedisCatchStorage getRedisCatchStorage() { | 354 | public IRedisCatchStorage getRedisCatchStorage() { |
| 365 | return redisCatchStorage; | 355 | return redisCatchStorage; |
| 366 | } | 356 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | import com.genersoft.iot.vmp.conf.UserSetting; | 4 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.*; | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| @@ -14,7 +12,6 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | @@ -14,7 +12,6 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | ||
| 14 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; | 12 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 16 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 17 | -import com.genersoft.iot.vmp.utils.GpsUtil; | ||
| 18 | import org.dom4j.Element; | 15 | import org.dom4j.Element; |
| 19 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 20 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| @@ -59,9 +56,6 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -59,9 +56,6 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 59 | @Autowired | 56 | @Autowired |
| 60 | private IDeviceAlarmService deviceAlarmService; | 57 | private IDeviceAlarmService deviceAlarmService; |
| 61 | 58 | ||
| 62 | - @Autowired | ||
| 63 | - private DeviceOffLineDetector offLineDetector; | ||
| 64 | - | ||
| 65 | @Override | 59 | @Override |
| 66 | public void afterPropertiesSet() throws Exception { | 60 | public void afterPropertiesSet() throws Exception { |
| 67 | notifyMessageHandler.addHandler(cmdType, this); | 61 | notifyMessageHandler.addHandler(cmdType, this); |
| @@ -151,7 +145,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -151,7 +145,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 151 | } | 145 | } |
| 152 | 146 | ||
| 153 | 147 | ||
| 154 | - if (offLineDetector.isOnline(device.getDeviceId())) { | 148 | + if (redisCatchStorage.deviceIsOnline(device.getDeviceId())) { |
| 155 | publisher.deviceAlarmEventPublish(deviceAlarm); | 149 | publisher.deviceAlarmEventPublish(deviceAlarm); |
| 156 | } | 150 | } |
| 157 | } | 151 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
| @@ -70,7 +70,9 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp | @@ -70,7 +70,9 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp | ||
| 70 | videoManagerStorager.updateDevice(device); | 70 | videoManagerStorager.updateDevice(device); |
| 71 | redisCatchStorage.updateDevice(device); | 71 | redisCatchStorage.updateDevice(device); |
| 72 | } | 72 | } |
| 73 | - publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE); | 73 | + if (!redisCatchStorage.deviceIsOnline(device.getDeviceId())) { |
| 74 | + publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE); | ||
| 75 | + } | ||
| 74 | } | 76 | } |
| 75 | } catch (SipException e) { | 77 | } catch (SipException e) { |
| 76 | e.printStackTrace(); | 78 | e.printStackTrace(); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.common.VideoManagerConstants; | ||
| 4 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | import com.genersoft.iot.vmp.conf.UserSetting; | 4 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.*; | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch; | 7 | import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 11 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 14 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| @@ -17,8 +14,6 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | @@ -17,8 +14,6 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | ||
| 17 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | 14 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 19 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 16 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 20 | -import com.genersoft.iot.vmp.utils.GpsUtil; | ||
| 21 | -import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 22 | import org.dom4j.DocumentException; | 17 | import org.dom4j.DocumentException; |
| 23 | import org.dom4j.Element; | 18 | import org.dom4j.Element; |
| 24 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
| @@ -59,9 +54,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | @@ -59,9 +54,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | ||
| 59 | private CatalogDataCatch catalogDataCatch; | 54 | private CatalogDataCatch catalogDataCatch; |
| 60 | 55 | ||
| 61 | @Autowired | 56 | @Autowired |
| 62 | - private DeviceOffLineDetector offLineDetector; | ||
| 63 | - | ||
| 64 | - @Autowired | ||
| 65 | private SipConfig config; | 57 | private SipConfig config; |
| 66 | 58 | ||
| 67 | @Autowired | 59 | @Autowired |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java
| @@ -4,13 +4,13 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; | @@ -4,13 +4,13 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; | ||
| 4 | import com.genersoft.iot.vmp.conf.SipConfig; | 4 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 6 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 13 | +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | import org.dom4j.DocumentException; | 15 | import org.dom4j.DocumentException; |
| 16 | import org.dom4j.Element; | 16 | import org.dom4j.Element; |
| @@ -42,10 +42,10 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent | @@ -42,10 +42,10 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent | ||
| 42 | private IVideoManagerStorage storager; | 42 | private IVideoManagerStorage storager; |
| 43 | 43 | ||
| 44 | @Autowired | 44 | @Autowired |
| 45 | - private DeferredResultHolder deferredResultHolder; | 45 | + private IRedisCatchStorage redisCatchStorage; |
| 46 | 46 | ||
| 47 | @Autowired | 47 | @Autowired |
| 48 | - private DeviceOffLineDetector offLineDetector; | 48 | + private DeferredResultHolder deferredResultHolder; |
| 49 | 49 | ||
| 50 | @Autowired | 50 | @Autowired |
| 51 | private SipConfig config; | 51 | private SipConfig config; |
| @@ -82,7 +82,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent | @@ -82,7 +82,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent | ||
| 82 | deferredResultHolder.invokeAllResult(msg); | 82 | deferredResultHolder.invokeAllResult(msg); |
| 83 | // 回复200 OK | 83 | // 回复200 OK |
| 84 | responseAck(evt, Response.OK); | 84 | responseAck(evt, Response.OK); |
| 85 | - if (offLineDetector.isOnline(device.getDeviceId())) { | 85 | + if (redisCatchStorage.deviceIsOnline(device.getDeviceId())) { |
| 86 | publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE); | 86 | publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE); |
| 87 | } | 87 | } |
| 88 | } catch (DocumentException e) { | 88 | } catch (DocumentException e) { |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java
| @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; | @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; | ||
| 4 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 4 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 6 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| @@ -12,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | @@ -12,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | ||
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 14 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | 13 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 14 | +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 15 | import org.dom4j.Element; | 15 | import org.dom4j.Element; |
| 16 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 17 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| @@ -34,8 +34,6 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen | @@ -34,8 +34,6 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen | ||
| 34 | @Autowired | 34 | @Autowired |
| 35 | private ResponseMessageHandler responseMessageHandler; | 35 | private ResponseMessageHandler responseMessageHandler; |
| 36 | 36 | ||
| 37 | - @Autowired | ||
| 38 | - private DeviceOffLineDetector offLineDetector; | ||
| 39 | 37 | ||
| 40 | @Autowired | 38 | @Autowired |
| 41 | private DeferredResultHolder deferredResultHolder; | 39 | private DeferredResultHolder deferredResultHolder; |
| @@ -43,6 +41,9 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen | @@ -43,6 +41,9 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen | ||
| 43 | @Autowired | 41 | @Autowired |
| 44 | private EventPublisher publisher; | 42 | private EventPublisher publisher; |
| 45 | 43 | ||
| 44 | + @Autowired | ||
| 45 | + private IRedisCatchStorage redisCatchStorage; | ||
| 46 | + | ||
| 46 | @Override | 47 | @Override |
| 47 | public void afterPropertiesSet() throws Exception { | 48 | public void afterPropertiesSet() throws Exception { |
| 48 | responseMessageHandler.addHandler(cmdType, this); | 49 | responseMessageHandler.addHandler(cmdType, this); |
| @@ -74,10 +75,8 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen | @@ -74,10 +75,8 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen | ||
| 74 | msg.setData(json); | 75 | msg.setData(json); |
| 75 | deferredResultHolder.invokeAllResult(msg); | 76 | deferredResultHolder.invokeAllResult(msg); |
| 76 | 77 | ||
| 77 | - if (offLineDetector.isOnline(device.getDeviceId())) { | 78 | + if (redisCatchStorage.deviceIsOnline(device.getDeviceId())) { |
| 78 | publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE); | 79 | publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE); |
| 79 | - } else { | ||
| 80 | - | ||
| 81 | } | 80 | } |
| 82 | } | 81 | } |
| 83 | 82 |
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
| @@ -223,4 +223,11 @@ public interface IRedisCatchStorage { | @@ -223,4 +223,11 @@ public interface IRedisCatchStorage { | ||
| 223 | 223 | ||
| 224 | void sendStreamPushRequestedMsg(MessageForPushChannel messageForPushChannel); | 224 | void sendStreamPushRequestedMsg(MessageForPushChannel messageForPushChannel); |
| 225 | 225 | ||
| 226 | + /** | ||
| 227 | + * 判断设备状态 | ||
| 228 | + * @param deviceId 设备ID | ||
| 229 | + * @return | ||
| 230 | + */ | ||
| 231 | + public boolean deviceIsOnline(String deviceId); | ||
| 232 | + | ||
| 226 | } | 233 | } |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| @@ -645,4 +645,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -645,4 +645,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 645 | logger.info("[redis 报警通知] {}: {}", key, JSON.toJSON(msg)); | 645 | logger.info("[redis 报警通知] {}: {}", key, JSON.toJSON(msg)); |
| 646 | redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); | 646 | redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); |
| 647 | } | 647 | } |
| 648 | + | ||
| 649 | + @Override | ||
| 650 | + public boolean deviceIsOnline(String deviceId) { | ||
| 651 | + String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + deviceId; | ||
| 652 | + return redis.hasKey(key); | ||
| 653 | + } | ||
| 648 | } | 654 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| @@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | @@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 7 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; | 7 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.SyncStatus; | 8 | import com.genersoft.iot.vmp.gb28181.bean.SyncStatus; |
| 9 | -import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | ||
| 10 | import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; | 9 | import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; |
| 11 | import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask; | 10 | import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask; |
| 12 | import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask; | 11 | import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask; |
| @@ -54,9 +53,6 @@ public class DeviceQuery { | @@ -54,9 +53,6 @@ public class DeviceQuery { | ||
| 54 | 53 | ||
| 55 | @Autowired | 54 | @Autowired |
| 56 | private DeferredResultHolder resultHolder; | 55 | private DeferredResultHolder resultHolder; |
| 57 | - | ||
| 58 | - @Autowired | ||
| 59 | - private DeviceOffLineDetector offLineDetector; | ||
| 60 | 56 | ||
| 61 | @Autowired | 57 | @Autowired |
| 62 | private IDeviceService deviceService; | 58 | private IDeviceService deviceService; |
web_src/src/components/common/jessibuca.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div ref="container" @dblclick="fullscreenSwich" style="width:100%;height:100%;background-color: #eee;margin:0 auto;"> | 2 | + <div ref="container" @dblclick="fullscreenSwich" style="width:100%;height:100%;background-color: #000000;margin:0 auto;"> |
| 3 | <div class="buttons-box" id="buttonsBox"> | 3 | <div class="buttons-box" id="buttonsBox"> |
| 4 | <div class="buttons-box-left"> | 4 | <div class="buttons-box-left"> |
| 5 | <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> | 5 | <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> |