From 22efd0f56c20e1aedb18fa7b9bcdc48007fcc954 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 20 十二月 2021 09:51:51 +0800 Subject: [PATCH] 添加心跳到期时验证zlm是否真的离线。 --- src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java | 37 ++++++++++++++++++++++++++++++++----- 1 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java index 29f859d..9495e9d 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java @@ -1,16 +1,21 @@ package com.genersoft.iot.vmp.gb28181.event; +import com.genersoft.iot.vmp.gb28181.bean.Device; +import com.genersoft.iot.vmp.gb28181.event.offline.OfflineEvent; import com.genersoft.iot.vmp.gb28181.event.platformKeepaliveExpire.PlatformKeepaliveExpireEvent; import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent; +import com.genersoft.iot.vmp.media.zlm.event.ZLMOfflineEvent; +import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Component; -import com.genersoft.iot.vmp.gb28181.event.offline.OfflineEvent; +import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; +import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEvent; import com.genersoft.iot.vmp.gb28181.event.online.OnlineEvent; /** - * @Description:Event浜嬩欢閫氱煡鎺ㄩ�佸櫒锛屾敮鎸佹帹閫佸湪绾夸簨浠躲�佺绾夸簨浠� + * @description:Event浜嬩欢閫氱煡鎺ㄩ�佸櫒锛屾敮鎸佹帹閫佸湪绾夸簨浠躲�佺绾夸簨浠� * @author: swwheihei * @date: 2020骞�5鏈�6鏃� 涓婂崍11:30:50 */ @@ -20,9 +25,9 @@ @Autowired private ApplicationEventPublisher applicationEventPublisher; - public void onlineEventPublish(String deviceId, String from) { + public void onlineEventPublish(Device device, String from) { OnlineEvent onEvent = new OnlineEvent(this); - onEvent.setDeviceId(deviceId); + onEvent.setDevice(device); onEvent.setFrom(from); applicationEventPublisher.publishEvent(onEvent); } @@ -52,5 +57,27 @@ PlatformNotRegisterEvent platformNotRegisterEvent = new PlatformNotRegisterEvent(this); platformNotRegisterEvent.setPlatformGbID(platformGbId); applicationEventPublisher.publishEvent(platformNotRegisterEvent); - } + } + + /** + * 璁惧鎶ヨ浜嬩欢 + * @param deviceAlarm + */ + public void deviceAlarmEventPublish(DeviceAlarm deviceAlarm) { + AlarmEvent alarmEvent = new AlarmEvent(this); + alarmEvent.setAlarmInfo(deviceAlarm); + applicationEventPublisher.publishEvent(alarmEvent); + } + + public void zlmOfflineEventPublish(String mediaServerId){ + ZLMOfflineEvent outEvent = new ZLMOfflineEvent(this); + outEvent.setMediaServerId(mediaServerId); + applicationEventPublisher.publishEvent(outEvent); + } + + public void zlmOnlineEventPublish(String mediaServerId) { + ZLMOnlineEvent outEvent = new ZLMOnlineEvent(this); + outEvent.setMediaServerId(mediaServerId); + applicationEventPublisher.publishEvent(outEvent); + } } -- Gitblit v1.8.0