|  |  |  | 
|---|
|  |  |  | package com.genersoft.iot.vmp.gb28181.event; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.Device; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.offline.OfflineEvent; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.*; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.platformKeepaliveExpire.PlatformKeepaliveExpireEvent; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformCycleRegisterEvent; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 
|---|
|  |  |  | 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.scheduling.annotation.Async; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.sip.TimeoutEvent; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashSet; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApplicationEventPublisher applicationEventPublisher; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void onlineEventPublish(Device device, String from) { | 
|---|
|  |  |  | OnlineEvent onEvent = new OnlineEvent(this); | 
|---|
|  |  |  | onEvent.setDevice(device); | 
|---|
|  |  |  | onEvent.setFrom(from); | 
|---|
|  |  |  | applicationEventPublisher.publishEvent(onEvent); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void outlineEventPublish(String deviceId, String from){ | 
|---|
|  |  |  | OfflineEvent outEvent = new OfflineEvent(this); | 
|---|
|  |  |  | outEvent.setDeviceId(deviceId); | 
|---|
|  |  |  | outEvent.setFrom(from); | 
|---|
|  |  |  | applicationEventPublisher.publishEvent(outEvent); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 平台心跳到期事件 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void requestTimeOut(TimeoutEvent timeoutEvent) { | 
|---|
|  |  |  | RequestTimeoutEvent requestTimeoutEvent = new RequestTimeoutEvent(this); | 
|---|
|  |  |  | requestTimeoutEvent.setTimeoutEvent(timeoutEvent); | 
|---|
|  |  |  | applicationEventPublisher.publishEvent(requestTimeoutEvent); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param platformId | 
|---|
|  |  |  | * @param deviceChannels | 
|---|
|  |  |  | * @param type | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void catalogEventPublish(String platformId, List<DeviceChannel> deviceChannels, String type) { | 
|---|
|  |  |  | CatalogEvent outEvent = new CatalogEvent(this); | 
|---|
|  |  |  | List<DeviceChannel> channels = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | gbStreamList.add(gbStream); | 
|---|
|  |  |  | catalogEventPublishForStream(platformId, gbStreamList, type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void recordEndEventPush(RecordInfo recordInfo) { | 
|---|
|  |  |  | RecordEndEvent outEvent = new RecordEndEvent(this); | 
|---|
|  |  |  | outEvent.setRecordInfo(recordInfo); | 
|---|
|  |  |  | applicationEventPublisher.publishEvent(outEvent); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|