Commit 7e755f405dd1112a201b9dbde7e2d6cff8abc8f4
1 parent
ee490f5b
支持国标移动位置订阅,收到新位置发送redis消息;支持通道redis消息拉起第三方推流;云台控制添加ControlPriority字段;处理sql的bug
Showing
75 changed files
with
1381 additions
and
1007 deletions
Too many changes to show.
To preserve performance only 75 of 92 files are displayed.
sql/update.sql
0 → 100644
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
| ... | ... | @@ -70,8 +70,24 @@ public class VideoManagerConstants { |
| 70 | 70 | public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_"; |
| 71 | 71 | |
| 72 | 72 | //************************** redis 消息********************************* |
| 73 | + | |
| 74 | + // 流变化的通知 | |
| 73 | 75 | public static final String WVP_MSG_STREAM_CHANGE_PREFIX = "WVP_MSG_STREAM_CHANGE_"; |
| 74 | - public static final String WVP_MSG_GPS_PREFIX = "VM_MSG_GPS"; | |
| 76 | + | |
| 77 | + // 接收推流设备的GPS变化通知 | |
| 78 | + public static final String VM_MSG_GPS = "VM_MSG_GPS"; | |
| 79 | + | |
| 80 | + // redis 消息通知设备推流到平台 | |
| 81 | + public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED"; | |
| 82 | + | |
| 83 | + // 移动位置订阅通知 | |
| 84 | + public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition"; | |
| 85 | + | |
| 86 | + // 报警订阅的通知 | |
| 87 | + public static final String VM_MSG_SUBSCRIBE_ALARM = "alarm"; | |
| 88 | + | |
| 89 | + // 设备状态订阅的通知 | |
| 90 | + public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device"; | |
| 75 | 91 | |
| 76 | 92 | //************************** 第三方 **************************************** |
| 77 | 93 | public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_"; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java
| ... | ... | @@ -29,7 +29,7 @@ public class ApiAccessFilter extends OncePerRequestFilter { |
| 29 | 29 | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 30 | 30 | |
| 31 | 31 | @Autowired |
| 32 | - private UserSetup userSetup; | |
| 32 | + private UserSetting userSetting; | |
| 33 | 33 | |
| 34 | 34 | @Autowired |
| 35 | 35 | private ILogService logService; |
| ... | ... | @@ -48,7 +48,7 @@ public class ApiAccessFilter extends OncePerRequestFilter { |
| 48 | 48 | |
| 49 | 49 | filterChain.doFilter(servletRequest, servletResponse); |
| 50 | 50 | |
| 51 | - if (uriName != null && userSetup.getLogInDatebase()) { | |
| 51 | + if (uriName != null && userSetting.getLogInDatebase()) { | |
| 52 | 52 | |
| 53 | 53 | LogDto logDto = new LogDto(); |
| 54 | 54 | logDto.setName(uriName); | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
| ... | ... | @@ -7,6 +7,7 @@ import org.springframework.stereotype.Component; |
| 7 | 7 | |
| 8 | 8 | import java.util.Date; |
| 9 | 9 | import java.util.Map; |
| 10 | +import java.util.Set; | |
| 10 | 11 | import java.util.concurrent.ConcurrentHashMap; |
| 11 | 12 | import java.util.concurrent.ScheduledFuture; |
| 12 | 13 | |
| ... | ... | @@ -45,12 +46,12 @@ public class DynamicTask { |
| 45 | 46 | * 延时任务 |
| 46 | 47 | * @param key 任务ID |
| 47 | 48 | * @param task 任务 |
| 48 | - * @param delay 延时 /秒 | |
| 49 | + * @param delay 延时 /毫秒 | |
| 49 | 50 | * @return |
| 50 | 51 | */ |
| 51 | 52 | public String startDelay(String key, Runnable task, int delay) { |
| 52 | 53 | stop(key); |
| 53 | - Date starTime = new Date(System.currentTimeMillis() + delay * 1000); | |
| 54 | + Date starTime = new Date(System.currentTimeMillis() + delay); | |
| 54 | 55 | // scheduleWithFixedDelay 必须等待上一个任务结束才开始计时period, cycleForCatalog表示执行的间隔 |
| 55 | 56 | ScheduledFuture future = threadPoolTaskScheduler.schedule(task, starTime); |
| 56 | 57 | futureMap.put(key, future); |
| ... | ... | @@ -67,4 +68,8 @@ public class DynamicTask { |
| 67 | 68 | return futureMap.get(key) != null; |
| 68 | 69 | } |
| 69 | 70 | |
| 71 | + public Set<String> getAllKeys() { | |
| 72 | + return futureMap.keySet(); | |
| 73 | + } | |
| 74 | + | |
| 70 | 75 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java
| ... | ... | @@ -92,7 +92,7 @@ public class RedisConfig extends CachingConfigurerSupport { |
| 92 | 92 | |
| 93 | 93 | RedisMessageListenerContainer container = new RedisMessageListenerContainer(); |
| 94 | 94 | container.setConnectionFactory(connectionFactory); |
| 95 | - container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_GPS_PREFIX)); | |
| 95 | + container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GPS)); | |
| 96 | 96 | return container; |
| 97 | 97 | } |
| 98 | 98 | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/RedisKeyExpirationEventMessageListener.java
| ... | ... | @@ -3,25 +3,24 @@ package com.genersoft.iot.vmp.conf; |
| 3 | 3 | import org.springframework.data.redis.connection.RedisConnection; |
| 4 | 4 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| 5 | 5 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 6 | -import org.springframework.util.StringUtils; | |
| 7 | 6 | |
| 8 | 7 | import java.util.Properties; |
| 9 | 8 | |
| 10 | 9 | public class RedisKeyExpirationEventMessageListener extends KeyExpirationEventMessageListener { |
| 11 | 10 | |
| 12 | - private UserSetup userSetup; | |
| 11 | + private UserSetting userSetting; | |
| 13 | 12 | private RedisMessageListenerContainer listenerContainer; |
| 14 | 13 | private String keyspaceNotificationsConfigParameter = "EA"; |
| 15 | 14 | |
| 16 | - public RedisKeyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | |
| 15 | + public RedisKeyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { | |
| 17 | 16 | super(listenerContainer); |
| 18 | 17 | this.listenerContainer = listenerContainer; |
| 19 | - this.userSetup = userSetup; | |
| 18 | + this.userSetting = userSetting; | |
| 20 | 19 | } |
| 21 | 20 | |
| 22 | 21 | @Override |
| 23 | 22 | public void init() { |
| 24 | - if (!userSetup.getRedisConfig()) { | |
| 23 | + if (!userSetting.getRedisConfig()) { | |
| 25 | 24 | // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 |
| 26 | 25 | setKeyspaceNotificationsConfigParameter(""); |
| 27 | 26 | }else { | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
| ... | ... | @@ -4,9 +4,8 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 7 | -import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | |
| 8 | 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 9 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 8 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 10 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 10 | import org.springframework.boot.CommandLineRunner; |
| 12 | 11 | import org.springframework.core.annotation.Order; |
| ... | ... | @@ -22,7 +21,7 @@ import java.util.List; |
| 22 | 21 | public class SipPlatformRunner implements CommandLineRunner { |
| 23 | 22 | |
| 24 | 23 | @Autowired |
| 25 | - private IVideoManagerStorager storager; | |
| 24 | + private IVideoManagerStorage storager; | |
| 26 | 25 | |
| 27 | 26 | @Autowired |
| 28 | 27 | private IRedisCatchStorage redisCatchStorage; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/UserSetup.java renamed to src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
| ... | ... | @@ -6,10 +6,12 @@ import org.springframework.stereotype.Component; |
| 6 | 6 | import java.util.ArrayList; |
| 7 | 7 | import java.util.List; |
| 8 | 8 | |
| 9 | - | |
| 9 | +/** | |
| 10 | + * 配置文件 user-settings 映射的配置信息 | |
| 11 | + */ | |
| 10 | 12 | @Component |
| 11 | 13 | @ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true) |
| 12 | -public class UserSetup { | |
| 14 | +public class UserSetting { | |
| 13 | 15 | |
| 14 | 16 | private Boolean savePositionHistory = Boolean.FALSE; |
| 15 | 17 | |
| ... | ... | @@ -19,6 +21,8 @@ public class UserSetup { |
| 19 | 21 | |
| 20 | 22 | private Long playTimeout = 18000L; |
| 21 | 23 | |
| 24 | + private int platformPlayTimeout = 60000; | |
| 25 | + | |
| 22 | 26 | private Boolean interfaceAuthentication = Boolean.TRUE; |
| 23 | 27 | |
| 24 | 28 | private Boolean recordPushLive = Boolean.TRUE; |
| ... | ... | @@ -134,4 +138,12 @@ public class UserSetup { |
| 134 | 138 | public void setRecordSip(Boolean recordSip) { |
| 135 | 139 | this.recordSip = recordSip; |
| 136 | 140 | } |
| 141 | + | |
| 142 | + public int getPlatformPlayTimeout() { | |
| 143 | + return platformPlayTimeout; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setPlatformPlayTimeout(int platformPlayTimeout) { | |
| 147 | + this.platformPlayTimeout = platformPlayTimeout; | |
| 148 | + } | |
| 137 | 149 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/runner/SipDeviceRunner.java
| 1 | 1 | package com.genersoft.iot.vmp.conf.runner; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 3 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | 5 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 6 | 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 7 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 7 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.boot.CommandLineRunner; |
| 10 | 10 | import org.springframework.core.annotation.Order; |
| ... | ... | @@ -21,13 +21,13 @@ import java.util.List; |
| 21 | 21 | public class SipDeviceRunner implements CommandLineRunner { |
| 22 | 22 | |
| 23 | 23 | @Autowired |
| 24 | - private IVideoManagerStorager storager; | |
| 24 | + private IVideoManagerStorage storager; | |
| 25 | 25 | |
| 26 | 26 | @Autowired |
| 27 | 27 | private IRedisCatchStorage redisCatchStorage; |
| 28 | 28 | |
| 29 | 29 | @Autowired |
| 30 | - private UserSetup userSetup; | |
| 30 | + private UserSetting userSetting; | |
| 31 | 31 | |
| 32 | 32 | @Autowired |
| 33 | 33 | private IDeviceService deviceService; |
| ... | ... | @@ -44,6 +44,7 @@ public class SipDeviceRunner implements CommandLineRunner { |
| 44 | 44 | if (device != null && device.getSubscribeCycleForCatalog() > 0) { |
| 45 | 45 | // 查询在线设备那些开启了订阅,为设备开启定时的目录订阅 |
| 46 | 46 | deviceService.addCatalogSubscribe(device); |
| 47 | + deviceService.addMobilePositionSubscribe(device); | |
| 47 | 48 | } |
| 48 | 49 | } |
| 49 | 50 | // 重置cseq计数 | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
| 1 | 1 | package com.genersoft.iot.vmp.conf.security; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 3 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 4 | 4 | import org.slf4j.Logger; |
| 5 | 5 | import org.slf4j.LoggerFactory; |
| 6 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -29,7 +29,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| 29 | 29 | private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); |
| 30 | 30 | |
| 31 | 31 | @Autowired |
| 32 | - private UserSetup userSetup; | |
| 32 | + private UserSetting userSetting; | |
| 33 | 33 | |
| 34 | 34 | @Autowired |
| 35 | 35 | private DefaultUserDetailsServiceImpl userDetailsService; |
| ... | ... | @@ -77,7 +77,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| 77 | 77 | @Override |
| 78 | 78 | public void configure(WebSecurity web) { |
| 79 | 79 | |
| 80 | - if (!userSetup.isInterfaceAuthentication()) { | |
| 80 | + if (!userSetting.isInterfaceAuthentication()) { | |
| 81 | 81 | web.ignoring().antMatchers("**"); |
| 82 | 82 | }else { |
| 83 | 83 | // 可以直接访问的静态数据 |
| ... | ... | @@ -91,7 +91,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| 91 | 91 | .antMatchers("/swagger-resources/**") |
| 92 | 92 | .antMatchers("/v3/api-docs/**") |
| 93 | 93 | .antMatchers("/js/**"); |
| 94 | - List<String> interfaceAuthenticationExcludes = userSetup.getInterfaceAuthenticationExcludes(); | |
| 94 | + List<String> interfaceAuthenticationExcludes = userSetting.getInterfaceAuthenticationExcludes(); | |
| 95 | 95 | for (String interfaceAuthenticationExclude : interfaceAuthenticationExcludes) { |
| 96 | 96 | if (interfaceAuthenticationExclude.split("/").length < 4 ) { |
| 97 | 97 | logger.warn("{}不满足两级目录,已忽略", interfaceAuthenticationExclude); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/auth/RegisterLogicHandler.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.auth; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.storager.impl.VideoManagerStoragerImpl; | |
| 3 | +import com.genersoft.iot.vmp.storager.impl.VideoManagerStorageImpl; | |
| 4 | 4 | import org.slf4j.Logger; |
| 5 | 5 | import org.slf4j.LoggerFactory; |
| 6 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -23,7 +23,7 @@ public class RegisterLogicHandler { |
| 23 | 23 | private SIPCommander cmder; |
| 24 | 24 | |
| 25 | 25 | @Autowired |
| 26 | - private VideoManagerStoragerImpl storager; | |
| 26 | + private VideoManagerStorageImpl storager; | |
| 27 | 27 | |
| 28 | 28 | public void onRegister(Device device) { |
| 29 | 29 | // 只有第一次注册时调用查询设备信息,如需更新调用更新API接口 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| ... | ... | @@ -112,8 +112,22 @@ public class Device { |
| 112 | 112 | /** |
| 113 | 113 | * 目录订阅周期,0为不订阅 |
| 114 | 114 | */ |
| 115 | - private int subscribeCycleForCatalog ; | |
| 115 | + private int subscribeCycleForCatalog; | |
| 116 | 116 | |
| 117 | + /** | |
| 118 | + * 移动设备位置订阅周期,0为不订阅 | |
| 119 | + */ | |
| 120 | + private int subscribeCycleForMobilePosition; | |
| 121 | + | |
| 122 | + /** | |
| 123 | + * 移动设备位置信息上报时间间隔,单位:秒,默认值5 | |
| 124 | + */ | |
| 125 | + private int mobilePositionSubmissionInterval = 5; | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * 报警订阅周期,0为不订阅 | |
| 129 | + */ | |
| 130 | + private int subscribeCycleForAlarm; | |
| 117 | 131 | |
| 118 | 132 | |
| 119 | 133 | public String getDeviceId() { |
| ... | ... | @@ -283,4 +297,28 @@ public class Device { |
| 283 | 297 | public void setSubscribeCycleForCatalog(int subscribeCycleForCatalog) { |
| 284 | 298 | this.subscribeCycleForCatalog = subscribeCycleForCatalog; |
| 285 | 299 | } |
| 300 | + | |
| 301 | + public int getSubscribeCycleForMobilePosition() { | |
| 302 | + return subscribeCycleForMobilePosition; | |
| 303 | + } | |
| 304 | + | |
| 305 | + public void setSubscribeCycleForMobilePosition(int subscribeCycleForMobilePosition) { | |
| 306 | + this.subscribeCycleForMobilePosition = subscribeCycleForMobilePosition; | |
| 307 | + } | |
| 308 | + | |
| 309 | + public int getMobilePositionSubmissionInterval() { | |
| 310 | + return mobilePositionSubmissionInterval; | |
| 311 | + } | |
| 312 | + | |
| 313 | + public void setMobilePositionSubmissionInterval(int mobilePositionSubmissionInterval) { | |
| 314 | + this.mobilePositionSubmissionInterval = mobilePositionSubmissionInterval; | |
| 315 | + } | |
| 316 | + | |
| 317 | + public int getSubscribeCycleForAlarm() { | |
| 318 | + return subscribeCycleForAlarm; | |
| 319 | + } | |
| 320 | + | |
| 321 | + public void setSubscribeCycleForAlarm(int subscribeCycleForAlarm) { | |
| 322 | + this.subscribeCycleForAlarm = subscribeCycleForAlarm; | |
| 323 | + } | |
| 286 | 324 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamType.java
0 → 100644
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
| ... | ... | @@ -125,9 +125,9 @@ public class ParentPlatform { |
| 125 | 125 | private boolean alarmSubscribe; |
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | - * 已被订阅GPS信息 | |
| 128 | + * 已被订阅移动位置信息 | |
| 129 | 129 | */ |
| 130 | - private boolean gpsSubscribe; | |
| 130 | + private boolean mobilePositionSubscribe; | |
| 131 | 131 | |
| 132 | 132 | public Integer getId() { |
| 133 | 133 | return id; |
| ... | ... | @@ -322,11 +322,11 @@ public class ParentPlatform { |
| 322 | 322 | this.alarmSubscribe = alarmSubscribe; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - public boolean isGpsSubscribe() { | |
| 326 | - return gpsSubscribe; | |
| 325 | + public boolean isMobilePositionSubscribe() { | |
| 326 | + return mobilePositionSubscribe; | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - public void setGpsSubscribe(boolean gpsSubscribe) { | |
| 330 | - this.gpsSubscribe = gpsSubscribe; | |
| 329 | + public void setMobilePositionSubscribe(boolean mobilePositionSubscribe) { | |
| 330 | + this.mobilePositionSubscribe = mobilePositionSubscribe; | |
| 331 | 331 | } |
| 332 | 332 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java
| ... | ... | @@ -77,9 +77,9 @@ public class SendRtpItem { |
| 77 | 77 | private String CallId; |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * 是否是play, false是playback | |
| 80 | + * 播放类型 | |
| 81 | 81 | */ |
| 82 | - private boolean isPlay; | |
| 82 | + private InviteStreamType playType; | |
| 83 | 83 | |
| 84 | 84 | private byte[] transaction; |
| 85 | 85 | |
| ... | ... | @@ -197,12 +197,12 @@ public class SendRtpItem { |
| 197 | 197 | CallId = callId; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - public boolean isPlay() { | |
| 201 | - return isPlay; | |
| 200 | + public InviteStreamType getPlayType() { | |
| 201 | + return playType; | |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - public void setPlay(boolean play) { | |
| 205 | - isPlay = play; | |
| 204 | + public void setPlayType(InviteStreamType playType) { | |
| 205 | + this.playType = playType; | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | public byte[] getTransaction() { | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/DeviceOffLineDetector.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 3 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 4 | 4 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | 5 | import org.springframework.stereotype.Component; |
| 6 | 6 | |
| ... | ... | @@ -19,10 +19,10 @@ public class DeviceOffLineDetector { |
| 19 | 19 | private RedisUtil redis; |
| 20 | 20 | |
| 21 | 21 | @Autowired |
| 22 | - private UserSetup userSetup; | |
| 22 | + private UserSetting userSetting; | |
| 23 | 23 | |
| 24 | 24 | public boolean isOnline(String deviceId) { |
| 25 | - String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + deviceId; | |
| 25 | + String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + deviceId; | |
| 26 | 26 | return redis.hasKey(key); |
| 27 | 27 | } |
| 28 | 28 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 4 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 8 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 8 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 9 | 9 | import org.slf4j.Logger; |
| 10 | 10 | import org.slf4j.LoggerFactory; |
| 11 | -import org.springframework.beans.factory.InitializingBean; | |
| 12 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | -import org.springframework.context.annotation.DependsOn; | |
| 14 | 12 | import org.springframework.data.redis.connection.Message; |
| 15 | -import org.springframework.data.redis.connection.RedisConnection; | |
| 16 | -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | |
| 17 | 13 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 18 | 14 | import org.springframework.stereotype.Component; |
| 19 | 15 | |
| 20 | 16 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 21 | 17 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 22 | -import org.springframework.util.StringUtils; | |
| 23 | - | |
| 24 | -import java.util.Properties; | |
| 25 | 18 | |
| 26 | 19 | /** |
| 27 | 20 | * @description:设备心跳超时监听,借助redis过期特性,进行监听,监听到说明设备心跳超时,发送离线事件 |
| ... | ... | @@ -37,16 +30,16 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent |
| 37 | 30 | private EventPublisher publisher; |
| 38 | 31 | |
| 39 | 32 | @Autowired |
| 40 | - private UserSetup userSetup; | |
| 33 | + private UserSetting userSetting; | |
| 41 | 34 | |
| 42 | 35 | @Autowired |
| 43 | 36 | private SipSubscribe sipSubscribe; |
| 44 | 37 | |
| 45 | 38 | @Autowired |
| 46 | - private IVideoManagerStorager storager; | |
| 39 | + private IVideoManagerStorage storager; | |
| 47 | 40 | |
| 48 | - public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | |
| 49 | - super(listenerContainer, userSetup); | |
| 41 | + public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { | |
| 42 | + super(listenerContainer, userSetting); | |
| 50 | 43 | } |
| 51 | 44 | |
| 52 | 45 | |
| ... | ... | @@ -61,10 +54,10 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent |
| 61 | 54 | String expiredKey = message.toString(); |
| 62 | 55 | logger.debug(expiredKey); |
| 63 | 56 | // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 |
| 64 | - String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_"; | |
| 65 | - String PLATFORM_REGISTER_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_"; | |
| 66 | - String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_"; | |
| 67 | - String REGISTER_INFO_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_"; | |
| 57 | + String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_"; | |
| 58 | + String PLATFORM_REGISTER_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_"; | |
| 59 | + String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_"; | |
| 60 | + String REGISTER_INFO_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_"; | |
| 68 | 61 | if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { |
| 69 | 62 | String platformGBId = expiredKey.substring(PLATFORM_KEEPLIVEKEY_PREFIX.length(),expiredKey.length()); |
| 70 | 63 | ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGBId); |
| ... | ... | @@ -84,12 +77,14 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent |
| 84 | 77 | publisher.outlineEventPublish(deviceId, KEEPLIVEKEY_PREFIX); |
| 85 | 78 | } |
| 86 | 79 | }else if (expiredKey.startsWith(REGISTER_INFO_PREFIX)) { |
| 87 | - String callid = expiredKey.substring(REGISTER_INFO_PREFIX.length()); | |
| 88 | - SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(); | |
| 89 | - eventResult.callId = callid; | |
| 90 | - eventResult.msg = "注册超时"; | |
| 91 | - eventResult.type = "register timeout"; | |
| 92 | - sipSubscribe.getErrorSubscribe(callid).response(eventResult); | |
| 80 | + String callId = expiredKey.substring(REGISTER_INFO_PREFIX.length()); | |
| 81 | + if (sipSubscribe.getErrorSubscribe(callId) != null) { | |
| 82 | + SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(); | |
| 83 | + eventResult.callId = callId; | |
| 84 | + eventResult.msg = "注册超时"; | |
| 85 | + eventResult.type = "register timeout"; | |
| 86 | + sipSubscribe.getErrorSubscribe(callId).response(eventResult); | |
| 87 | + } | |
| 93 | 88 | } |
| 94 | 89 | |
| 95 | 90 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 4 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 5 | 5 | import org.slf4j.Logger; |
| 6 | 6 | import org.slf4j.LoggerFactory; |
| 7 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | -import org.springframework.context.annotation.DependsOn; | |
| 9 | -import org.springframework.context.annotation.Lazy; | |
| 10 | 8 | import org.springframework.data.redis.connection.Message; |
| 11 | -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | |
| 12 | 9 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 13 | 10 | import org.springframework.stereotype.Component; |
| 14 | 11 | |
| ... | ... | @@ -29,15 +26,15 @@ public class KeepliveTimeoutListener extends RedisKeyExpirationEventMessageListe |
| 29 | 26 | private EventPublisher publisher; |
| 30 | 27 | |
| 31 | 28 | @Autowired |
| 32 | - private UserSetup userSetup; | |
| 29 | + private UserSetting userSetting; | |
| 33 | 30 | |
| 34 | - public KeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | |
| 35 | - super(listenerContainer, userSetup); | |
| 31 | + public KeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { | |
| 32 | + super(listenerContainer, userSetting); | |
| 36 | 33 | } |
| 37 | 34 | |
| 38 | 35 | @Override |
| 39 | 36 | public void init() { |
| 40 | - if (!userSetup.getRedisConfig()) { | |
| 37 | + if (!userSetting.getRedisConfig()) { | |
| 41 | 38 | // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 |
| 42 | 39 | setKeyspaceNotificationsConfigParameter(""); |
| 43 | 40 | } |
| ... | ... | @@ -54,7 +51,7 @@ public class KeepliveTimeoutListener extends RedisKeyExpirationEventMessageListe |
| 54 | 51 | public void onMessage(Message message, byte[] pattern) { |
| 55 | 52 | // 获取失效的key |
| 56 | 53 | String expiredKey = message.toString(); |
| 57 | - String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_"; | |
| 54 | + String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_"; | |
| 58 | 55 | if(!expiredKey.startsWith(KEEPLIVEKEY_PREFIX)){ |
| 59 | 56 | logger.debug("收到redis过期监听,但开头不是"+KEEPLIVEKEY_PREFIX+",忽略"); |
| 60 | 57 | return; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 3 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 9 | 9 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 10 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | |
| 11 | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 12 | 11 | import org.slf4j.Logger; |
| 13 | 12 | import org.slf4j.LoggerFactory; |
| 14 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 14 | import org.springframework.context.ApplicationListener; |
| 16 | -import org.springframework.context.annotation.DependsOn; | |
| 17 | -import org.springframework.context.annotation.Lazy; | |
| 18 | 15 | import org.springframework.stereotype.Component; |
| 19 | 16 | |
| 20 | 17 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 21 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 22 | 19 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 23 | 20 | |
| 24 | 21 | import java.util.List; |
| ... | ... | @@ -36,7 +33,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { |
| 36 | 33 | private final static Logger logger = LoggerFactory.getLogger(OfflineEventListener.class); |
| 37 | 34 | |
| 38 | 35 | @Autowired |
| 39 | - private IVideoManagerStorager storager; | |
| 36 | + private IVideoManagerStorage storager; | |
| 40 | 37 | |
| 41 | 38 | @Autowired |
| 42 | 39 | private VideoStreamSessionManager streamSession; |
| ... | ... | @@ -45,7 +42,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { |
| 45 | 42 | private RedisUtil redis; |
| 46 | 43 | |
| 47 | 44 | @Autowired |
| 48 | - private UserSetup userSetup; | |
| 45 | + private UserSetting userSetting; | |
| 49 | 46 | |
| 50 | 47 | @Autowired |
| 51 | 48 | private EventPublisher eventPublisher; |
| ... | ... | @@ -65,7 +62,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { |
| 65 | 62 | logger.debug("设备离线事件触发,deviceId:" + event.getDeviceId() + ",from:" + event.getFrom()); |
| 66 | 63 | } |
| 67 | 64 | |
| 68 | - String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + event.getDeviceId(); | |
| 65 | + String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + event.getDeviceId(); | |
| 69 | 66 | |
| 70 | 67 | switch (event.getFrom()) { |
| 71 | 68 | // 心跳超时触发的离线事件,说明redis中已删除,无需处理 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event.online; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 4 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 10 | 10 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 11 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 12 | 11 | import org.slf4j.Logger; |
| 13 | 12 | import org.slf4j.LoggerFactory; |
| 14 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -16,7 +15,7 @@ import org.springframework.context.ApplicationListener; |
| 16 | 15 | import org.springframework.stereotype.Component; |
| 17 | 16 | |
| 18 | 17 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 19 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 20 | 19 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 21 | 20 | |
| 22 | 21 | import java.text.SimpleDateFormat; |
| ... | ... | @@ -35,7 +34,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { |
| 35 | 34 | private final static Logger logger = LoggerFactory.getLogger(OnlineEventListener.class); |
| 36 | 35 | |
| 37 | 36 | @Autowired |
| 38 | - private IVideoManagerStorager storager; | |
| 37 | + private IVideoManagerStorage storager; | |
| 39 | 38 | |
| 40 | 39 | @Autowired |
| 41 | 40 | private IDeviceService deviceService; |
| ... | ... | @@ -47,7 +46,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { |
| 47 | 46 | private SipConfig sipConfig; |
| 48 | 47 | |
| 49 | 48 | @Autowired |
| 50 | - private UserSetup userSetup; | |
| 49 | + private UserSetting userSetting; | |
| 51 | 50 | |
| 52 | 51 | @Autowired |
| 53 | 52 | private EventPublisher eventPublisher; |
| ... | ... | @@ -65,7 +64,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { |
| 65 | 64 | } |
| 66 | 65 | Device device = event.getDevice(); |
| 67 | 66 | if (device == null) return; |
| 68 | - String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + event.getDevice().getDeviceId(); | |
| 67 | + String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + event.getDevice().getDeviceId(); | |
| 69 | 68 | Device deviceInStore = storager.queryVideoDevice(device.getDeviceId()); |
| 70 | 69 | device.setOnline(1); |
| 71 | 70 | switch (event.getFrom()) { |
| ... | ... | @@ -103,6 +102,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { |
| 103 | 102 | // 上线添加订阅 |
| 104 | 103 | if (device.getSubscribeCycleForCatalog() > 0) { |
| 105 | 104 | deviceService.addCatalogSubscribe(device); |
| 105 | + deviceService.addMobilePositionSubscribe(device); | |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
| ... | ... | @@ -6,7 +6,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 8 | 8 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 9 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 9 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 10 | 10 | import org.jetbrains.annotations.NotNull; |
| 11 | 11 | import org.slf4j.Logger; |
| 12 | 12 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 14 | import org.springframework.context.ApplicationListener; |
| 15 | 15 | import org.springframework.stereotype.Component; |
| 16 | 16 | |
| 17 | -import javax.sip.ResponseEvent; | |
| 18 | 17 | import javax.sip.message.Response; |
| 19 | 18 | |
| 20 | 19 | /** |
| ... | ... | @@ -29,7 +28,7 @@ public class PlatformKeepaliveExpireEventLister implements ApplicationListener<P |
| 29 | 28 | private final static Logger logger = LoggerFactory.getLogger(PlatformKeepaliveExpireEventLister.class); |
| 30 | 29 | |
| 31 | 30 | @Autowired |
| 32 | - private IVideoManagerStorager storager; | |
| 31 | + private IVideoManagerStorage storager; | |
| 33 | 32 | |
| 34 | 33 | @Autowired |
| 35 | 34 | private IRedisCatchStorage redisCatchStorage; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformCycleRegisterEventLister.java
| ... | ... | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.event.platformNotRegister; |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 6 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 6 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 7 | 7 | import org.slf4j.Logger; |
| 8 | 8 | import org.slf4j.LoggerFactory; |
| 9 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -19,7 +19,7 @@ public class PlatformCycleRegisterEventLister implements ApplicationListener<Pla |
| 19 | 19 | private final static Logger logger = LoggerFactory.getLogger(PlatformCycleRegisterEventLister.class); |
| 20 | 20 | |
| 21 | 21 | @Autowired |
| 22 | - private IVideoManagerStorager storager; | |
| 22 | + private IVideoManagerStorage storager; | |
| 23 | 23 | @Autowired |
| 24 | 24 | private ISIPCommanderForPlatform sipCommanderFroPlatform; |
| 25 | 25 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java
| ... | ... | @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 9 | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 10 | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 11 | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 13 | 13 | import org.slf4j.Logger; |
| 14 | 14 | import org.slf4j.LoggerFactory; |
| 15 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -31,7 +31,7 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf |
| 31 | 31 | private final static Logger logger = LoggerFactory.getLogger(PlatformNotRegisterEventLister.class); |
| 32 | 32 | |
| 33 | 33 | @Autowired |
| 34 | - private IVideoManagerStorager storager; | |
| 34 | + private IVideoManagerStorage storager; | |
| 35 | 35 | @Autowired |
| 36 | 36 | private IRedisCatchStorage redisCatchStorage; |
| 37 | 37 | @Autowired | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/SubscribeListenerForPlatform.java
| ... | ... | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.event.subscribe; |
| 3 | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 5 | 5 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 6 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 6 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 7 | 7 | import org.slf4j.Logger; |
| 8 | 8 | import org.slf4j.LoggerFactory; |
| 9 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -20,13 +20,13 @@ public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessage |
| 20 | 20 | private Logger logger = LoggerFactory.getLogger(SubscribeListenerForPlatform.class); |
| 21 | 21 | |
| 22 | 22 | @Autowired |
| 23 | - private UserSetup userSetup; | |
| 23 | + private UserSetting userSetting; | |
| 24 | 24 | |
| 25 | 25 | @Autowired |
| 26 | 26 | private DynamicTask dynamicTask; |
| 27 | 27 | |
| 28 | - public SubscribeListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | |
| 29 | - super(listenerContainer, userSetup); | |
| 28 | + public SubscribeListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { | |
| 29 | + super(listenerContainer, userSetting); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| ... | ... | @@ -41,7 +41,7 @@ public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessage |
| 41 | 41 | String expiredKey = message.toString(); |
| 42 | 42 | logger.debug(expiredKey); |
| 43 | 43 | // 订阅到期 |
| 44 | - String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_"; | |
| 44 | + String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_"; | |
| 45 | 45 | if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { |
| 46 | 46 | // 取消定时任务 |
| 47 | 47 | dynamicTask.stop(expiredKey); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
| ... | ... | @@ -2,17 +2,14 @@ package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 5 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | |
| 8 | -import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent; | |
| 9 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 10 | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 11 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | |
| 12 | 9 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 13 | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 14 | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 15 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 16 | 13 | import org.slf4j.Logger; |
| 17 | 14 | import org.slf4j.LoggerFactory; |
| 18 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -31,7 +28,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { |
| 31 | 28 | private final static Logger logger = LoggerFactory.getLogger(CatalogEventLister.class); |
| 32 | 29 | |
| 33 | 30 | @Autowired |
| 34 | - private IVideoManagerStorager storager; | |
| 31 | + private IVideoManagerStorage storager; | |
| 35 | 32 | @Autowired |
| 36 | 33 | private IRedisCatchStorage redisCatchStorage; |
| 37 | 34 | @Autowired |
| ... | ... | @@ -47,7 +44,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { |
| 47 | 44 | private SipConfig config; |
| 48 | 45 | |
| 49 | 46 | @Autowired |
| 50 | - private UserSetup userSetup; | |
| 47 | + private UserSetting userSetting; | |
| 51 | 48 | |
| 52 | 49 | @Autowired |
| 53 | 50 | private IGbStreamService gbStreamService; |
| ... | ... | @@ -64,7 +61,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { |
| 64 | 61 | if (event.getPlatformId() != null) { |
| 65 | 62 | parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId()); |
| 66 | 63 | if (parentPlatform != null && !parentPlatform.isStatus())return; |
| 67 | - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); | |
| 64 | + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_Catalog_" + event.getPlatformId(); | |
| 68 | 65 | // subscribe = redisCatchStorage.getSubscribe(key); |
| 69 | 66 | subscribe = subscribeHolder.getCatalogSubscribe(event.getPlatformId()); |
| 70 | 67 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java
| ... | ... | @@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 8 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 8 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 9 | 9 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 10 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 11 | import org.springframework.scheduling.annotation.Scheduled; |
| ... | ... | @@ -23,7 +23,7 @@ public class CatalogDataCatch { |
| 23 | 23 | private DeferredResultHolder deferredResultHolder; |
| 24 | 24 | |
| 25 | 25 | @Autowired |
| 26 | - private IVideoManagerStorager storager; | |
| 26 | + private IVideoManagerStorage storager; | |
| 27 | 27 | |
| 28 | 28 | public void put(String key, int total, Device device, List<DeviceChannel> deviceChannelList) { |
| 29 | 29 | CatalogData catalogData = data.get(key); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
| ... | ... | @@ -7,7 +7,7 @@ import javax.sip.ClientTransaction; |
| 7 | 7 | import javax.sip.Dialog; |
| 8 | 8 | |
| 9 | 9 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 10 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 10 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| 12 | 12 | import com.genersoft.iot.vmp.utils.SerializeUtils; |
| 13 | 13 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| ... | ... | @@ -28,7 +28,7 @@ public class VideoStreamSessionManager { |
| 28 | 28 | private RedisUtil redisUtil; |
| 29 | 29 | |
| 30 | 30 | @Autowired |
| 31 | - private UserSetup userSetup; | |
| 31 | + private UserSetting userSetting; | |
| 32 | 32 | |
| 33 | 33 | public enum SessionType { |
| 34 | 34 | play, |
| ... | ... | @@ -58,9 +58,9 @@ public class VideoStreamSessionManager { |
| 58 | 58 | ssrcTransaction.setMediaServerId(mediaServerId); |
| 59 | 59 | ssrcTransaction.setType(type); |
| 60 | 60 | |
| 61 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() | |
| 61 | + redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() | |
| 62 | 62 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); |
| 63 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() | |
| 63 | + redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() | |
| 64 | 64 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); |
| 65 | 65 | } |
| 66 | 66 | |
| ... | ... | @@ -70,7 +70,7 @@ public class VideoStreamSessionManager { |
| 70 | 70 | byte[] dialogByteArray = SerializeUtils.serialize(dialog); |
| 71 | 71 | ssrcTransaction.setDialog(dialogByteArray); |
| 72 | 72 | } |
| 73 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() | |
| 73 | + redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() | |
| 74 | 74 | + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" |
| 75 | 75 | + ssrcTransaction.getStream(), ssrcTransaction); |
| 76 | 76 | } |
| ... | ... | @@ -105,7 +105,7 @@ public class VideoStreamSessionManager { |
| 105 | 105 | public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ |
| 106 | 106 | if (StringUtils.isEmpty(callId)) callId ="*"; |
| 107 | 107 | if (StringUtils.isEmpty(stream)) stream ="*"; |
| 108 | - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | |
| 108 | + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | |
| 109 | 109 | List<Object> scanResult = redisUtil.scan(key); |
| 110 | 110 | if (scanResult.size() == 0) return null; |
| 111 | 111 | return (SsrcTransaction)redisUtil.get((String) scanResult.get(0)); |
| ... | ... | @@ -116,7 +116,7 @@ public class VideoStreamSessionManager { |
| 116 | 116 | if (StringUtils.isEmpty(channelId)) channelId ="*"; |
| 117 | 117 | if (StringUtils.isEmpty(callId)) callId ="*"; |
| 118 | 118 | if (StringUtils.isEmpty(stream)) stream ="*"; |
| 119 | - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | |
| 119 | + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | |
| 120 | 120 | List<Object> scanResult = redisUtil.scan(key); |
| 121 | 121 | if (scanResult.size() == 0) return null; |
| 122 | 122 | List<SsrcTransaction> result = new ArrayList<>(); |
| ... | ... | @@ -141,13 +141,13 @@ public class VideoStreamSessionManager { |
| 141 | 141 | public void remove(String deviceId, String channelId, String stream) { |
| 142 | 142 | SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); |
| 143 | 143 | if (ssrcTransaction == null) return; |
| 144 | - redisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() + "_" | |
| 144 | + redisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" | |
| 145 | 145 | + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | public List<SsrcTransaction> getAllSsrc() { |
| 150 | - List<Object> ssrcTransactionKeys = redisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetup.getServerId() + "_" )); | |
| 150 | + List<Object> ssrcTransactionKeys = redisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId() + "_" )); | |
| 151 | 151 | List<SsrcTransaction> result= new ArrayList<>(); |
| 152 | 152 | for (int i = 0; i < ssrcTransactionKeys.size(); i++) { |
| 153 | 153 | String key = (String)ssrcTransactionKeys.get(i); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/task/GPSSubscribeTask.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.task; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | 5 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 5 | 6 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| ... | ... | @@ -7,7 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; |
| 7 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 8 | 9 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 9 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 10 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 11 | 12 | |
| 12 | 13 | import java.text.SimpleDateFormat; |
| 13 | 14 | import java.util.List; |
| ... | ... | @@ -15,7 +16,7 @@ import java.util.List; |
| 15 | 16 | public class GPSSubscribeTask implements Runnable{ |
| 16 | 17 | |
| 17 | 18 | private IRedisCatchStorage redisCatchStorage; |
| 18 | - private IVideoManagerStorager storager; | |
| 19 | + private IVideoManagerStorage storager; | |
| 19 | 20 | private ISIPCommanderForPlatform sipCommanderForPlatform; |
| 20 | 21 | private SubscribeHolder subscribeHolder; |
| 21 | 22 | private String platformId; |
| ... | ... | @@ -24,7 +25,7 @@ public class GPSSubscribeTask implements Runnable{ |
| 24 | 25 | |
| 25 | 26 | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 26 | 27 | |
| 27 | - public GPSSubscribeTask(IRedisCatchStorage redisCatchStorage, ISIPCommanderForPlatform sipCommanderForPlatform, IVideoManagerStorager storager, String platformId, String sn, String key, SubscribeHolder subscribeInfo) { | |
| 28 | + public GPSSubscribeTask(IRedisCatchStorage redisCatchStorage, ISIPCommanderForPlatform sipCommanderForPlatform, IVideoManagerStorage storager, String platformId, String sn, String key, SubscribeHolder subscribeInfo) { | |
| 28 | 29 | this.redisCatchStorage = redisCatchStorage; |
| 29 | 30 | this.storager = storager; |
| 30 | 31 | this.platformId = platformId; |
| ... | ... | @@ -48,21 +49,18 @@ public class GPSSubscribeTask implements Runnable{ |
| 48 | 49 | for (GbStream gbStream : gbStreams) { |
| 49 | 50 | String gbId = gbStream.getGbId(); |
| 50 | 51 | GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId); |
| 51 | - if (gbStream.isStatus()) { | |
| 52 | - if (gpsMsgInfo != null) { | |
| 53 | - // 发送GPS消息 | |
| 54 | - sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | |
| 55 | - }else { | |
| 56 | - // 没有在redis找到新的消息就使用数据库的消息 | |
| 57 | - gpsMsgInfo = new GPSMsgInfo(); | |
| 58 | - gpsMsgInfo.setId(gbId); | |
| 59 | - gpsMsgInfo.setLat(gbStream.getLongitude()); | |
| 60 | - gpsMsgInfo.setLng(gbStream.getLongitude()); | |
| 61 | - // 发送GPS消息 | |
| 62 | - sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | |
| 63 | - } | |
| 52 | + if (gpsMsgInfo != null) { | |
| 53 | + // 发送GPS消息 | |
| 54 | + sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | |
| 55 | + }else { | |
| 56 | + // 没有在redis找到新的消息就使用数据库的消息 | |
| 57 | + gpsMsgInfo = new GPSMsgInfo(); | |
| 58 | + gpsMsgInfo.setId(gbId); | |
| 59 | + gpsMsgInfo.setLat(gbStream.getLongitude()); | |
| 60 | + gpsMsgInfo.setLng(gbStream.getLongitude()); | |
| 61 | + // 发送GPS消息 | |
| 62 | + sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | |
| 64 | 63 | } |
| 65 | - | |
| 66 | 64 | } |
| 67 | 65 | } |
| 68 | 66 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
| ... | ... | @@ -305,11 +305,9 @@ public interface ISIPCommander { |
| 305 | 305 | * 订阅、取消订阅移动位置 |
| 306 | 306 | * |
| 307 | 307 | * @param device 视频设备 |
| 308 | - * @param expires 订阅超时时间(值=0时为取消订阅) | |
| 309 | - * @param interval 上报时间间隔 | |
| 310 | 308 | * @return true = 命令发送成功 |
| 311 | 309 | */ |
| 312 | - boolean mobilePositionSubscribe(Device device, int expires, int interval); | |
| 310 | + boolean mobilePositionSubscribe(Device device, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent); | |
| 313 | 311 | |
| 314 | 312 | /** |
| 315 | 313 | * 订阅、取消订阅报警信息 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | 5 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 6 | 6 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 7 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 7 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamInfo; |
| ... | ... | @@ -20,7 +20,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 20 | 20 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 21 | 21 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 22 | 22 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 23 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 23 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 24 | 24 | import gov.nist.javax.sip.SipProviderImpl; |
| 25 | 25 | import gov.nist.javax.sip.SipStackImpl; |
| 26 | 26 | import gov.nist.javax.sip.message.SIPRequest; |
| ... | ... | @@ -71,13 +71,13 @@ public class SIPCommander implements ISIPCommander { |
| 71 | 71 | private VideoStreamSessionManager streamSession; |
| 72 | 72 | |
| 73 | 73 | @Autowired |
| 74 | - private IVideoManagerStorager storager; | |
| 74 | + private IVideoManagerStorage storager; | |
| 75 | 75 | |
| 76 | 76 | @Autowired |
| 77 | 77 | private IRedisCatchStorage redisCatchStorage; |
| 78 | 78 | |
| 79 | 79 | @Autowired |
| 80 | - private UserSetup userSetup; | |
| 80 | + private UserSetting userSetting; | |
| 81 | 81 | |
| 82 | 82 | @Autowired |
| 83 | 83 | private ZLMHttpHookSubscribe subscribe; |
| ... | ... | @@ -236,6 +236,7 @@ public class SIPCommander implements ISIPCommander { |
| 236 | 236 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| 237 | 237 | ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); |
| 238 | 238 | ptzXml.append("<Info>\r\n"); |
| 239 | + ptzXml.append("<ControlPriority>5</ControlPriority>\r\n"); | |
| 239 | 240 | ptzXml.append("</Info>\r\n"); |
| 240 | 241 | ptzXml.append("</Control>\r\n"); |
| 241 | 242 | |
| ... | ... | @@ -277,6 +278,7 @@ public class SIPCommander implements ISIPCommander { |
| 277 | 278 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| 278 | 279 | ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); |
| 279 | 280 | ptzXml.append("<Info>\r\n"); |
| 281 | + ptzXml.append("<ControlPriority>5</ControlPriority>\r\n"); | |
| 280 | 282 | ptzXml.append("</Info>\r\n"); |
| 281 | 283 | ptzXml.append("</Control>\r\n"); |
| 282 | 284 | |
| ... | ... | @@ -311,6 +313,7 @@ public class SIPCommander implements ISIPCommander { |
| 311 | 313 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| 312 | 314 | ptzXml.append("<PTZCmd>" + cmdString + "</PTZCmd>\r\n"); |
| 313 | 315 | ptzXml.append("<Info>\r\n"); |
| 316 | + ptzXml.append("<ControlPriority>5</ControlPriority>\r\n"); | |
| 314 | 317 | ptzXml.append("</Info>\r\n"); |
| 315 | 318 | ptzXml.append("</Control>\r\n"); |
| 316 | 319 | |
| ... | ... | @@ -365,7 +368,7 @@ public class SIPCommander implements ISIPCommander { |
| 365 | 368 | content.append("c=IN IP4 "+ mediaServerItem.getSdpIp() +"\r\n"); |
| 366 | 369 | content.append("t=0 0\r\n"); |
| 367 | 370 | |
| 368 | - if (userSetup.isSeniorSdp()) { | |
| 371 | + if (userSetting.isSeniorSdp()) { | |
| 369 | 372 | if("TCP-PASSIVE".equals(streamMode)) { |
| 370 | 373 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); |
| 371 | 374 | }else if ("TCP-ACTIVE".equals(streamMode)) { |
| ... | ... | @@ -465,7 +468,7 @@ public class SIPCommander implements ISIPCommander { |
| 465 | 468 | |
| 466 | 469 | String streamMode = device.getStreamMode().toUpperCase(); |
| 467 | 470 | |
| 468 | - if (userSetup.isSeniorSdp()) { | |
| 471 | + if (userSetting.isSeniorSdp()) { | |
| 469 | 472 | if("TCP-PASSIVE".equals(streamMode)) { |
| 470 | 473 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); |
| 471 | 474 | }else if ("TCP-ACTIVE".equals(streamMode)) { |
| ... | ... | @@ -575,7 +578,7 @@ public class SIPCommander implements ISIPCommander { |
| 575 | 578 | |
| 576 | 579 | String streamMode = device.getStreamMode().toUpperCase(); |
| 577 | 580 | |
| 578 | - if (userSetup.isSeniorSdp()) { | |
| 581 | + if (userSetting.isSeniorSdp()) { | |
| 579 | 582 | if("TCP-PASSIVE".equals(streamMode)) { |
| 580 | 583 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); |
| 581 | 584 | }else if ("TCP-ACTIVE".equals(streamMode)) { |
| ... | ... | @@ -1433,11 +1436,9 @@ public class SIPCommander implements ISIPCommander { |
| 1433 | 1436 | * 订阅、取消订阅移动位置 |
| 1434 | 1437 | * |
| 1435 | 1438 | * @param device 视频设备 |
| 1436 | - * @param expires 订阅超时时间 | |
| 1437 | - * @param interval 上报时间间隔 | |
| 1438 | 1439 | * @return true = 命令发送成功 |
| 1439 | 1440 | */ |
| 1440 | - public boolean mobilePositionSubscribe(Device device, int expires, int interval) { | |
| 1441 | + public boolean mobilePositionSubscribe(Device device, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent) { | |
| 1441 | 1442 | try { |
| 1442 | 1443 | StringBuffer subscribePostitionXml = new StringBuffer(200); |
| 1443 | 1444 | String charset = device.getCharset(); |
| ... | ... | @@ -1446,8 +1447,8 @@ public class SIPCommander implements ISIPCommander { |
| 1446 | 1447 | subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); |
| 1447 | 1448 | subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| 1448 | 1449 | subscribePostitionXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); |
| 1449 | - if (expires > 0) { | |
| 1450 | - subscribePostitionXml.append("<Interval>" + String.valueOf(interval) + "</Interval>\r\n"); | |
| 1450 | + if (device.getSubscribeCycleForMobilePosition() > 0) { | |
| 1451 | + subscribePostitionXml.append("<Interval>" + String.valueOf(device.getMobilePositionSubmissionInterval()) + "</Interval>\r\n"); | |
| 1451 | 1452 | } |
| 1452 | 1453 | subscribePostitionXml.append("</Query>\r\n"); |
| 1453 | 1454 | |
| ... | ... | @@ -1456,8 +1457,8 @@ public class SIPCommander implements ISIPCommander { |
| 1456 | 1457 | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| 1457 | 1458 | : udpSipProvider.getNewCallId(); |
| 1458 | 1459 | |
| 1459 | - Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" ,callIdHeader); //Position;id=" + tm.substring(tm.length() - 4)); | |
| 1460 | - transmitRequest(device, request); | |
| 1460 | + Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, device.getSubscribeCycleForMobilePosition(), "presence" ,callIdHeader); //Position;id=" + tm.substring(tm.length() - 4)); | |
| 1461 | + transmitRequest(device, request, errorEvent, okEvent); | |
| 1461 | 1462 | |
| 1462 | 1463 | return true; |
| 1463 | 1464 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| ... | ... | @@ -372,7 +372,6 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 372 | 372 | : udpSipProvider.getNewCallId(); |
| 373 | 373 | callIdHeader.setCallId(subscribeInfo.getCallId()); |
| 374 | 374 | |
| 375 | -// | |
| 376 | 375 | sendNotify(parentPlatform, deviceStatusXml.toString(), subscribeInfo, eventResult -> { |
| 377 | 376 | logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); |
| 378 | 377 | }, null); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
| ... | ... | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | |
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamType; | |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| ... | ... | @@ -13,8 +13,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP |
| 13 | 13 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 14 | 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 15 | 15 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 16 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | |
| 16 | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 17 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 18 | 19 | import com.genersoft.iot.vmp.utils.SerializeUtils; |
| 19 | 20 | import gov.nist.javax.sip.stack.SIPDialog; |
| 20 | 21 | import org.slf4j.Logger; |
| ... | ... | @@ -50,7 +51,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In |
| 50 | 51 | private IRedisCatchStorage redisCatchStorage; |
| 51 | 52 | |
| 52 | 53 | @Autowired |
| 53 | - private IVideoManagerStorager storager; | |
| 54 | + private IVideoManagerStorage storager; | |
| 54 | 55 | |
| 55 | 56 | @Autowired |
| 56 | 57 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| ... | ... | @@ -99,10 +100,20 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In |
| 99 | 100 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId, callIdHeader.getCallId(), null); |
| 100 | 101 | int totalReaderCount = zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); |
| 101 | 102 | if (totalReaderCount <= 0) { |
| 102 | - logger.info("收到bye: {}无其它观看者,通知设备停止推流", streamId); | |
| 103 | - if (sendRtpItem.isPlay()) { | |
| 103 | + logger.info("收到bye: {} 无其它观看者,通知设备停止推流", streamId); | |
| 104 | + if (sendRtpItem.getPlayType().equals(InviteStreamType.PLAY)) { | |
| 104 | 105 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId, streamId, null); |
| 105 | 106 | } |
| 107 | + if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) { | |
| 108 | + MessageForPushChannel messageForPushChannel = new MessageForPushChannel(); | |
| 109 | + messageForPushChannel.setType(0); | |
| 110 | + messageForPushChannel.setGbId(sendRtpItem.getChannelId()); | |
| 111 | + messageForPushChannel.setApp(sendRtpItem.getApp()); | |
| 112 | + messageForPushChannel.setStream(sendRtpItem.getStreamId()); | |
| 113 | + messageForPushChannel.setMediaServerId(sendRtpItem.getMediaServerId()); | |
| 114 | + messageForPushChannel.setPlatFormId(sendRtpItem.getPlatformId()); | |
| 115 | + redisCatchStorage.sendStreamPushRequestedMsg(messageForPushChannel); | |
| 116 | + } | |
| 106 | 117 | } |
| 107 | 118 | } |
| 108 | 119 | // 可能是设备主动停止 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.alibaba.fastjson.JSONObject; |
| 5 | -import com.genersoft.iot.vmp.common.StreamInfo; | |
| 6 | 4 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 5 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 7 | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 8 | 7 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 9 | 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 10 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 11 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | |
| 12 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 13 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 14 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| ... | ... | @@ -16,20 +14,19 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor |
| 16 | 14 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 17 | 15 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 18 | 16 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| 17 | +import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; | |
| 19 | 18 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 20 | 19 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 21 | 20 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 22 | 21 | import com.genersoft.iot.vmp.service.IPlayService; |
| 22 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | |
| 23 | 23 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 24 | 24 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 25 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 25 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 26 | 26 | import com.genersoft.iot.vmp.utils.SerializeUtils; |
| 27 | -import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | |
| 28 | 27 | import gov.nist.javax.sdp.TimeDescriptionImpl; |
| 29 | 28 | import gov.nist.javax.sdp.fields.TimeField; |
| 30 | -import gov.nist.javax.sip.address.AddressImpl; | |
| 31 | -import gov.nist.javax.sip.address.SipUri; | |
| 32 | -import gov.nist.javax.sip.header.Subject; | |
| 29 | +import javafx.application.Platform; | |
| 33 | 30 | import org.slf4j.Logger; |
| 34 | 31 | import org.slf4j.LoggerFactory; |
| 35 | 32 | import org.springframework.beans.factory.InitializingBean; |
| ... | ... | @@ -37,20 +34,14 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 37 | 34 | import org.springframework.stereotype.Component; |
| 38 | 35 | |
| 39 | 36 | import javax.sdp.*; |
| 40 | -import javax.sip.InvalidArgumentException; | |
| 41 | -import javax.sip.RequestEvent; | |
| 42 | -import javax.sip.ServerTransaction; | |
| 43 | -import javax.sip.SipException; | |
| 37 | +import javax.sip.*; | |
| 44 | 38 | import javax.sip.address.SipURI; |
| 45 | 39 | import javax.sip.header.CallIdHeader; |
| 46 | -import javax.sip.header.FromHeader; | |
| 47 | -import javax.sip.header.Header; | |
| 48 | 40 | import javax.sip.message.Request; |
| 49 | 41 | import javax.sip.message.Response; |
| 50 | 42 | import java.text.ParseException; |
| 51 | 43 | import java.text.SimpleDateFormat; |
| 52 | 44 | import java.util.Date; |
| 53 | -import java.util.List; | |
| 54 | 45 | import java.util.Vector; |
| 55 | 46 | |
| 56 | 47 | /** |
| ... | ... | @@ -68,7 +59,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 68 | 59 | private SIPCommanderFroPlatform cmderFroPlatform; |
| 69 | 60 | |
| 70 | 61 | @Autowired |
| 71 | - private IVideoManagerStorager storager; | |
| 62 | + private IVideoManagerStorage storager; | |
| 72 | 63 | |
| 73 | 64 | @Autowired |
| 74 | 65 | private IRedisCatchStorage redisCatchStorage; |
| ... | ... | @@ -97,6 +88,12 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 97 | 88 | @Autowired |
| 98 | 89 | private VideoStreamSessionManager sessionManager; |
| 99 | 90 | |
| 91 | + @Autowired | |
| 92 | + private UserSetting userSetting; | |
| 93 | + | |
| 94 | + @Autowired | |
| 95 | + private ZLMMediaListManager mediaListManager; | |
| 96 | + | |
| 100 | 97 | |
| 101 | 98 | @Override |
| 102 | 99 | public void afterPropertiesSet() throws Exception { |
| ... | ... | @@ -153,12 +150,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 153 | 150 | responseAck(evt, Response.GONE); |
| 154 | 151 | return; |
| 155 | 152 | } |
| 156 | - Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); | |
| 157 | - if (!streamReady ) { | |
| 158 | - logger.info("[ app={}, stream={} ]通道离线,返回400",gbStream.getApp(), gbStream.getStream()); | |
| 159 | - responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline"); | |
| 160 | - return; | |
| 161 | - } | |
| 162 | 153 | responseAck(evt, Response.CALL_IS_BEING_FORWARDED); // 通道存在,发181,呼叫转接中 |
| 163 | 154 | }else if (catalog != null) { |
| 164 | 155 | responseAck(evt, Response.BAD_REQUEST, "catalog channel can not play"); // 目录不支持点播 |
| ... | ... | @@ -273,13 +264,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 273 | 264 | return; |
| 274 | 265 | } |
| 275 | 266 | sendRtpItem.setCallId(callIdHeader.getCallId()); |
| 276 | - sendRtpItem.setPlay("Play".equals(sessionName)); | |
| 267 | + sendRtpItem.setPlayType("Play".equals(sessionName)?InviteStreamType.PLAY:InviteStreamType.PLAYBACK); | |
| 277 | 268 | byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); |
| 278 | 269 | sendRtpItem.setDialog(dialogByteArray); |
| 279 | 270 | byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); |
| 280 | 271 | sendRtpItem.setTransaction(transactionByteArray); |
| 281 | - | |
| 282 | - | |
| 283 | 272 | Long finalStartTime = startTime; |
| 284 | 273 | Long finalStopTime = stopTime; |
| 285 | 274 | ZLMHttpHookSubscribe.Event hookEvent = (mediaServerItemInUSe, responseJSON)->{ |
| ... | ... | @@ -315,7 +304,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 315 | 304 | mediaServerService.releaseSsrc(mediaServerItemInUSe.getId(), ssrc); |
| 316 | 305 | // 回复bye |
| 317 | 306 | cmderFroPlatform.streamByeCmd(platform, callIdHeader.getCallId()); |
| 318 | - }, 60); | |
| 307 | + }, 60*1000); | |
| 319 | 308 | responseSdpAck(evt, content.toString(), platform); |
| 320 | 309 | |
| 321 | 310 | } catch (SipException e) { |
| ... | ... | @@ -340,7 +329,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 340 | 329 | }); |
| 341 | 330 | sendRtpItem.setApp("rtp"); |
| 342 | 331 | if ("Playback".equals(sessionName)) { |
| 343 | - sendRtpItem.setPlay(false); | |
| 332 | + sendRtpItem.setPlayType(InviteStreamType.PLAYBACK); | |
| 344 | 333 | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, true); |
| 345 | 334 | sendRtpItem.setStreamId(ssrcInfo.getStream()); |
| 346 | 335 | // 写入redis, 超时时回复 |
| ... | ... | @@ -370,7 +359,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 370 | 359 | } |
| 371 | 360 | }); |
| 372 | 361 | }else { |
| 373 | - sendRtpItem.setPlay(true); | |
| 362 | + sendRtpItem.setPlayType(InviteStreamType.PLAY); | |
| 374 | 363 | SsrcTransaction playTransaction = sessionManager.getSsrcTransaction(device.getDeviceId(), channelId, "play", null); |
| 375 | 364 | if (playTransaction != null) { |
| 376 | 365 | Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, "rtp", playTransaction.getStream()); |
| ... | ... | @@ -401,56 +390,105 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 401 | 390 | } |
| 402 | 391 | } |
| 403 | 392 | }else if (gbStream != null) { |
| 404 | - SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | |
| 405 | - gbStream.getApp(), gbStream.getStream(), channelId, | |
| 406 | - mediaTransmissionTCP); | |
| 407 | 393 | |
| 408 | - if (tcpActive != null) { | |
| 409 | - sendRtpItem.setTcpActive(tcpActive); | |
| 410 | - } | |
| 411 | - if (sendRtpItem == null) { | |
| 412 | - logger.warn("服务器端口资源不足"); | |
| 413 | - responseAck(evt, Response.BUSY_HERE); | |
| 414 | - return; | |
| 415 | - } | |
| 394 | + Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); | |
| 395 | + if (!streamReady ) { | |
| 396 | + if ("proxy".equals(gbStream.getStreamType())) { | |
| 397 | + // TODO 控制启用以使设备上线 | |
| 398 | + logger.info("[ app={}, stream={} ]通道离线,启用流后开始推流",gbStream.getApp(), gbStream.getStream()); | |
| 399 | + responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline"); | |
| 400 | + }else if ("push".equals(gbStream.getStreamType())) { | |
| 401 | + // 发送redis消息以使设备上线 | |
| 402 | + logger.info("[ app={}, stream={} ]通道离线,发送redis信息控制设备开始推流",gbStream.getApp(), gbStream.getStream()); | |
| 403 | + MessageForPushChannel messageForPushChannel = new MessageForPushChannel(); | |
| 404 | + messageForPushChannel.setType(1); | |
| 405 | + messageForPushChannel.setGbId(gbStream.getGbId()); | |
| 406 | + messageForPushChannel.setApp(gbStream.getApp()); | |
| 407 | + messageForPushChannel.setStream(gbStream.getStream()); | |
| 408 | + // TODO 获取低负载的节点 | |
| 409 | + messageForPushChannel.setMediaServerId(gbStream.getMediaServerId()); | |
| 410 | + messageForPushChannel.setPlatFormId(platform.getServerGBId()); | |
| 411 | + messageForPushChannel.setPlatFormName(platform.getName()); | |
| 412 | + redisCatchStorage.sendStreamPushRequestedMsg(messageForPushChannel); | |
| 413 | + // 设置超时 | |
| 414 | + dynamicTask.startDelay(callIdHeader.getCallId(), ()->{ | |
| 415 | + logger.info("[ app={}, stream={} ] 等待设备开始推流超时", gbStream.getApp(), gbStream.getStream()); | |
| 416 | + try { | |
| 417 | + mediaListManager.removedChannelOnlineEventLister(gbStream.getGbId()); | |
| 418 | + responseAck(evt, Response.REQUEST_TIMEOUT); // 超时 | |
| 419 | + } catch (SipException e) { | |
| 420 | + e.printStackTrace(); | |
| 421 | + } catch (InvalidArgumentException e) { | |
| 422 | + e.printStackTrace(); | |
| 423 | + } catch (ParseException e) { | |
| 424 | + e.printStackTrace(); | |
| 425 | + } | |
| 426 | + }, userSetting.getPlatformPlayTimeout()); | |
| 427 | + // 添加监听 | |
| 428 | + MediaServerItem finalMediaServerItem = mediaServerItem; | |
| 429 | + int finalPort = port; | |
| 430 | + boolean finalMediaTransmissionTCP = mediaTransmissionTCP; | |
| 431 | + Boolean finalTcpActive = tcpActive; | |
| 432 | + mediaListManager.addChannelOnlineEventLister(gbStream.getGbId(), (app, stream)->{ | |
| 433 | + SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(finalMediaServerItem, addressStr, finalPort, ssrc, requesterId, | |
| 434 | + app, stream, channelId, finalMediaTransmissionTCP); | |
| 435 | + | |
| 436 | + if (sendRtpItem == null) { | |
| 437 | + logger.warn("服务器端口资源不足"); | |
| 438 | + try { | |
| 439 | + responseAck(evt, Response.BUSY_HERE); | |
| 440 | + } catch (SipException e) { | |
| 441 | + e.printStackTrace(); | |
| 442 | + } catch (InvalidArgumentException e) { | |
| 443 | + e.printStackTrace(); | |
| 444 | + } catch (ParseException e) { | |
| 445 | + e.printStackTrace(); | |
| 446 | + } | |
| 447 | + return; | |
| 448 | + } | |
| 449 | + if (finalTcpActive != null) { | |
| 450 | + sendRtpItem.setTcpActive(finalTcpActive); | |
| 451 | + } | |
| 452 | + sendRtpItem.setPlayType(InviteStreamType.PUSH); | |
| 453 | + // 写入redis, 超时时回复 | |
| 454 | + sendRtpItem.setStatus(1); | |
| 455 | + sendRtpItem.setCallId(callIdHeader.getCallId()); | |
| 456 | + byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); | |
| 457 | + sendRtpItem.setDialog(dialogByteArray); | |
| 458 | + byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); | |
| 459 | + sendRtpItem.setTransaction(transactionByteArray); | |
| 460 | + redisCatchStorage.updateSendRTPSever(sendRtpItem); | |
| 461 | + sendStreamAck(finalMediaServerItem, sendRtpItem, platform, evt); | |
| 416 | 462 | |
| 417 | - // 写入redis, 超时时回复 | |
| 418 | - sendRtpItem.setStatus(1); | |
| 419 | - sendRtpItem.setCallId(callIdHeader.getCallId()); | |
| 420 | - byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); | |
| 421 | - sendRtpItem.setDialog(dialogByteArray); | |
| 422 | - byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); | |
| 423 | - sendRtpItem.setTransaction(transactionByteArray); | |
| 424 | - redisCatchStorage.updateSendRTPSever(sendRtpItem); | |
| 425 | - StringBuffer content = new StringBuffer(200); | |
| 426 | - content.append("v=0\r\n"); | |
| 427 | - content.append("o="+ channelId +" 0 0 IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); | |
| 428 | - content.append("s=Play\r\n"); | |
| 429 | - content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); | |
| 430 | - content.append("t=0 0\r\n"); | |
| 431 | - content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); | |
| 432 | - content.append("a=sendonly\r\n"); | |
| 433 | - content.append("a=rtpmap:96 PS/90000\r\n"); | |
| 434 | - if (sendRtpItem.isTcp()) { | |
| 435 | - content.append("a=connection:new\r\n"); | |
| 436 | - if (!sendRtpItem.isTcpActive()) { | |
| 437 | - content.append("a=setup:active\r\n"); | |
| 438 | - }else { | |
| 439 | - content.append("a=setup:passive\r\n"); | |
| 463 | + }); | |
| 440 | 464 | } |
| 465 | + }else { | |
| 466 | + SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | |
| 467 | + gbStream.getApp(), gbStream.getStream(), channelId, | |
| 468 | + mediaTransmissionTCP); | |
| 469 | + | |
| 470 | + | |
| 471 | + if (sendRtpItem == null) { | |
| 472 | + logger.warn("服务器端口资源不足"); | |
| 473 | + responseAck(evt, Response.BUSY_HERE); | |
| 474 | + return; | |
| 475 | + } | |
| 476 | + if (tcpActive != null) { | |
| 477 | + sendRtpItem.setTcpActive(tcpActive); | |
| 478 | + } | |
| 479 | + sendRtpItem.setPlayType(InviteStreamType.PUSH); | |
| 480 | + // 写入redis, 超时时回复 | |
| 481 | + sendRtpItem.setStatus(1); | |
| 482 | + sendRtpItem.setCallId(callIdHeader.getCallId()); | |
| 483 | + byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); | |
| 484 | + sendRtpItem.setDialog(dialogByteArray); | |
| 485 | + byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); | |
| 486 | + sendRtpItem.setTransaction(transactionByteArray); | |
| 487 | + redisCatchStorage.updateSendRTPSever(sendRtpItem); | |
| 488 | + sendStreamAck(mediaServerItem, sendRtpItem, platform, evt); | |
| 441 | 489 | } |
| 442 | - content.append("y="+ ssrc + "\r\n"); | |
| 443 | - content.append("f=\r\n"); | |
| 444 | - | |
| 445 | - try { | |
| 446 | - responseSdpAck(evt, content.toString(), platform); | |
| 447 | - } catch (SipException e) { | |
| 448 | - e.printStackTrace(); | |
| 449 | - } catch (InvalidArgumentException e) { | |
| 450 | - e.printStackTrace(); | |
| 451 | - } catch (ParseException e) { | |
| 452 | - e.printStackTrace(); | |
| 453 | - } | |
| 490 | + | |
| 491 | + | |
| 454 | 492 | } |
| 455 | 493 | |
| 456 | 494 | } |
| ... | ... | @@ -466,6 +504,39 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 466 | 504 | } |
| 467 | 505 | } |
| 468 | 506 | |
| 507 | + public void sendStreamAck(MediaServerItem mediaServerItem, SendRtpItem sendRtpItem, ParentPlatform platform, RequestEvent evt){ | |
| 508 | + | |
| 509 | + StringBuffer content = new StringBuffer(200); | |
| 510 | + content.append("v=0\r\n"); | |
| 511 | + content.append("o="+ sendRtpItem.getChannelId() +" 0 0 IN IP4 "+ mediaServerItem.getSdpIp()+"\r\n"); | |
| 512 | + content.append("s=Play\r\n"); | |
| 513 | + content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); | |
| 514 | + content.append("t=0 0\r\n"); | |
| 515 | + content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); | |
| 516 | + content.append("a=sendonly\r\n"); | |
| 517 | + content.append("a=rtpmap:96 PS/90000\r\n"); | |
| 518 | + if (sendRtpItem.isTcp()) { | |
| 519 | + content.append("a=connection:new\r\n"); | |
| 520 | + if (!sendRtpItem.isTcpActive()) { | |
| 521 | + content.append("a=setup:active\r\n"); | |
| 522 | + }else { | |
| 523 | + content.append("a=setup:passive\r\n"); | |
| 524 | + } | |
| 525 | + } | |
| 526 | + content.append("y="+ sendRtpItem.getSsrc() + "\r\n"); | |
| 527 | + content.append("f=\r\n"); | |
| 528 | + | |
| 529 | + try { | |
| 530 | + responseSdpAck(evt, content.toString(), platform); | |
| 531 | + } catch (SipException e) { | |
| 532 | + e.printStackTrace(); | |
| 533 | + } catch (InvalidArgumentException e) { | |
| 534 | + e.printStackTrace(); | |
| 535 | + } catch (ParseException e) { | |
| 536 | + e.printStackTrace(); | |
| 537 | + } | |
| 538 | + } | |
| 539 | + | |
| 469 | 540 | public void inviteFromDeviceHandle(RequestEvent evt, String requesterId) throws InvalidArgumentException, ParseException, SipException, SdpException { |
| 470 | 541 | |
| 471 | 542 | // 非上级平台请求,查询是否设备请求(通常为接收语音广播的设备) | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 3 | 4 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | 5 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 6 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 6 | 7 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | 8 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; |
| 8 | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| ... | ... | @@ -16,7 +17,7 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 16 | 17 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 17 | 18 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 18 | 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 19 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 20 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 20 | 21 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 21 | 22 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 22 | 23 | import org.dom4j.DocumentException; |
| ... | ... | @@ -46,10 +47,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 46 | 47 | private final static Logger logger = LoggerFactory.getLogger(NotifyRequestProcessor.class); |
| 47 | 48 | |
| 48 | 49 | @Autowired |
| 49 | - private UserSetup userSetup; | |
| 50 | + private UserSetting userSetting; | |
| 50 | 51 | |
| 51 | 52 | @Autowired |
| 52 | - private IVideoManagerStorager storager; | |
| 53 | + private IVideoManagerStorage storager; | |
| 53 | 54 | |
| 54 | 55 | @Autowired |
| 55 | 56 | private EventPublisher eventPublisher; |
| ... | ... | @@ -109,11 +110,15 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 109 | 110 | */ |
| 110 | 111 | private void processNotifyMobilePosition(RequestEvent evt) { |
| 111 | 112 | try { |
| 113 | + FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); | |
| 114 | + String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); | |
| 115 | + | |
| 112 | 116 | // 回复 200 OK |
| 113 | 117 | Element rootElement = getRootElement(evt); |
| 118 | + | |
| 114 | 119 | MobilePosition mobilePosition = new MobilePosition(); |
| 115 | 120 | Element deviceIdElement = rootElement.element("DeviceID"); |
| 116 | - String deviceId = deviceIdElement.getTextTrim().toString(); | |
| 121 | + String channelId = deviceIdElement.getTextTrim().toString(); | |
| 117 | 122 | Device device = redisCatchStorage.getDevice(deviceId); |
| 118 | 123 | if (device != null) { |
| 119 | 124 | if (!StringUtils.isEmpty(device.getName())) { |
| ... | ... | @@ -121,7 +126,9 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 121 | 126 | } |
| 122 | 127 | } |
| 123 | 128 | mobilePosition.setDeviceId(XmlUtil.getText(rootElement, "DeviceID")); |
| 124 | - mobilePosition.setTime(XmlUtil.getText(rootElement, "Time")); | |
| 129 | + mobilePosition.setChannelId(channelId); | |
| 130 | + String time = XmlUtil.getText(rootElement, "Time"); | |
| 131 | + mobilePosition.setTime(time); | |
| 125 | 132 | mobilePosition.setLongitude(Double.parseDouble(XmlUtil.getText(rootElement, "Longitude"))); |
| 126 | 133 | mobilePosition.setLatitude(Double.parseDouble(XmlUtil.getText(rootElement, "Latitude"))); |
| 127 | 134 | if (NumericUtil.isDouble(XmlUtil.getText(rootElement, "Speed"))) { |
| ... | ... | @@ -140,16 +147,27 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 140 | 147 | mobilePosition.setAltitude(0.0); |
| 141 | 148 | } |
| 142 | 149 | mobilePosition.setReportSource("Mobile Position"); |
| 143 | - BaiduPoint bp = new BaiduPoint(); | |
| 144 | - bp = GpsUtil.Wgs84ToBd09(String.valueOf(mobilePosition.getLongitude()), String.valueOf(mobilePosition.getLatitude())); | |
| 150 | + BaiduPoint bp = GpsUtil.Wgs84ToBd09(String.valueOf(mobilePosition.getLongitude()), String.valueOf(mobilePosition.getLatitude())); | |
| 145 | 151 | logger.info("百度坐标:" + bp.getBdLng() + ", " + bp.getBdLat()); |
| 146 | 152 | mobilePosition.setGeodeticSystem("BD-09"); |
| 147 | 153 | mobilePosition.setCnLng(bp.getBdLng()); |
| 148 | 154 | mobilePosition.setCnLat(bp.getBdLat()); |
| 149 | - if (!userSetup.getSavePositionHistory()) { | |
| 155 | + if (!userSetting.getSavePositionHistory()) { | |
| 150 | 156 | storager.clearMobilePositionsByDeviceId(deviceId); |
| 151 | 157 | } |
| 152 | 158 | storager.insertMobilePosition(mobilePosition); |
| 159 | + storager.updateChannelPotion(deviceId, channelId, mobilePosition.getLongitude(), mobilePosition.getLatitude() ); | |
| 160 | + // 发送redis消息。 通知位置信息的变化 | |
| 161 | + JSONObject jsonObject = new JSONObject(); | |
| 162 | + jsonObject.put("time", time); | |
| 163 | + jsonObject.put("serial", deviceId); | |
| 164 | + jsonObject.put("code", channelId); | |
| 165 | + jsonObject.put("longitude", mobilePosition.getLongitude()); | |
| 166 | + jsonObject.put("latitude", mobilePosition.getLatitude()); | |
| 167 | + jsonObject.put("altitude", mobilePosition.getAltitude()); | |
| 168 | + jsonObject.put("direction", mobilePosition.getDirection()); | |
| 169 | + jsonObject.put("speed", mobilePosition.getSpeed()); | |
| 170 | + redisCatchStorage.sendMobilePositionMsg(jsonObject); | |
| 153 | 171 | responseAck(evt, Response.OK); |
| 154 | 172 | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| 155 | 173 | e.printStackTrace(); |
| ... | ... | @@ -209,7 +227,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 209 | 227 | mobilePosition.setGeodeticSystem("BD-09"); |
| 210 | 228 | mobilePosition.setCnLng(bp.getBdLng()); |
| 211 | 229 | mobilePosition.setCnLat(bp.getBdLat()); |
| 212 | - if (!userSetup.getSavePositionHistory()) { | |
| 230 | + if (!userSetting.getSavePositionHistory()) { | |
| 213 | 231 | storager.clearMobilePositionsByDeviceId(deviceId); |
| 214 | 232 | } |
| 215 | 233 | storager.insertMobilePosition(mobilePosition); |
| ... | ... | @@ -321,7 +339,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 321 | 339 | public void setCmder(SIPCommander cmder) { |
| 322 | 340 | } |
| 323 | 341 | |
| 324 | - public void setStorager(IVideoManagerStorager storager) { | |
| 342 | + public void setStorager(IVideoManagerStorage storager) { | |
| 325 | 343 | this.storager = storager; |
| 326 | 344 | } |
| 327 | 345 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
| ... | ... | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| 12 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 13 | 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 14 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 15 | 15 | import gov.nist.javax.sip.RequestEventExt; |
| 16 | 16 | import gov.nist.javax.sip.address.AddressImpl; |
| 17 | 17 | import gov.nist.javax.sip.address.SipUri; |
| ... | ... | @@ -56,7 +56,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen |
| 56 | 56 | private IRedisCatchStorage redisCatchStorage; |
| 57 | 57 | |
| 58 | 58 | @Autowired |
| 59 | - private IVideoManagerStorager storager; | |
| 59 | + private IVideoManagerStorage storager; | |
| 60 | 60 | |
| 61 | 61 | @Autowired |
| 62 | 62 | private EventPublisher publisher; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java
| ... | ... | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 5 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.CmdType; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| ... | ... | @@ -15,8 +15,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP |
| 15 | 15 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 16 | 16 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 17 | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 18 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 19 | -import com.genersoft.iot.vmp.utils.SerializeUtils; | |
| 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 20 | 19 | import gov.nist.javax.sip.SipProviderImpl; |
| 21 | 20 | import org.dom4j.DocumentException; |
| 22 | 21 | import org.dom4j.Element; |
| ... | ... | @@ -30,7 +29,6 @@ import org.springframework.stereotype.Component; |
| 30 | 29 | |
| 31 | 30 | import javax.sip.*; |
| 32 | 31 | import javax.sip.header.ExpiresHeader; |
| 33 | -import javax.sip.header.ToHeader; | |
| 34 | 32 | import javax.sip.message.Request; |
| 35 | 33 | import javax.sip.message.Response; |
| 36 | 34 | import java.text.ParseException; |
| ... | ... | @@ -54,7 +52,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme |
| 54 | 52 | private ISIPCommanderForPlatform sipCommanderForPlatform; |
| 55 | 53 | |
| 56 | 54 | @Autowired |
| 57 | - private IVideoManagerStorager storager; | |
| 55 | + private IVideoManagerStorage storager; | |
| 58 | 56 | |
| 59 | 57 | @Lazy |
| 60 | 58 | @Autowired |
| ... | ... | @@ -70,7 +68,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme |
| 70 | 68 | private DynamicTask dynamicTask; |
| 71 | 69 | |
| 72 | 70 | @Autowired |
| 73 | - private UserSetup userSetup; | |
| 71 | + private UserSetting userSetting; | |
| 74 | 72 | |
| 75 | 73 | |
| 76 | 74 | @Autowired |
| ... | ... | @@ -135,12 +133,21 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme |
| 135 | 133 | /** |
| 136 | 134 | * 处理移动位置订阅消息 |
| 137 | 135 | */ |
| 138 | - private void processNotifyMobilePosition(RequestEvent evt, Element rootElement) { | |
| 136 | + private void processNotifyMobilePosition(RequestEvent evt, Element rootElement) throws SipException { | |
| 139 | 137 | String platformId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
| 140 | 138 | String deviceID = XmlUtil.getText(rootElement, "DeviceID"); |
| 139 | + ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId); | |
| 141 | 140 | SubscribeInfo subscribeInfo = new SubscribeInfo(evt, platformId); |
| 141 | + if (evt.getServerTransaction() == null) { | |
| 142 | + ServerTransaction serverTransaction = platform.getTransport().equals("TCP") ? tcpSipProvider.getNewServerTransaction(evt.getRequest()) | |
| 143 | + : udpSipProvider.getNewServerTransaction(evt.getRequest()); | |
| 144 | + subscribeInfo.setTransaction(serverTransaction); | |
| 145 | + Dialog dialog = serverTransaction.getDialog(); | |
| 146 | + dialog.terminateOnBye(false); | |
| 147 | + subscribeInfo.setDialog(dialog); | |
| 148 | + } | |
| 142 | 149 | String sn = XmlUtil.getText(rootElement, "SN"); |
| 143 | - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_MobilePosition_" + platformId; | |
| 150 | + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + platformId; | |
| 144 | 151 | logger.info("接收到{}的MobilePosition订阅", platformId); |
| 145 | 152 | StringBuilder resultXml = new StringBuilder(200); |
| 146 | 153 | resultXml.append("<?xml version=\"1.0\" ?>\r\n") |
| ... | ... | @@ -193,7 +200,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme |
| 193 | 200 | subscribeInfo.setDialog(dialog); |
| 194 | 201 | } |
| 195 | 202 | String sn = XmlUtil.getText(rootElement, "SN"); |
| 196 | - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platformId; | |
| 203 | + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_Catalog_" + platformId; | |
| 197 | 204 | logger.info("接收到{}的Catalog订阅", platformId); |
| 198 | 205 | StringBuilder resultXml = new StringBuilder(200); |
| 199 | 206 | resultXml.append("<?xml version=\"1.0\" ?>\r\n") | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java
| ... | ... | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | 12 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 13 | 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 14 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 15 | 15 | import org.dom4j.DocumentException; |
| 16 | 16 | import org.dom4j.Element; |
| 17 | 17 | import org.slf4j.Logger; |
| ... | ... | @@ -43,7 +43,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement |
| 43 | 43 | private SIPProcessorObserver sipProcessorObserver; |
| 44 | 44 | |
| 45 | 45 | @Autowired |
| 46 | - private IVideoManagerStorager storage; | |
| 46 | + private IVideoManagerStorage storage; | |
| 47 | 47 | |
| 48 | 48 | @Autowired |
| 49 | 49 | private SipSubscribe sipSubscribe; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java
| ... | ... | @@ -8,8 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.control.ControlMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; | |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 13 | 12 | import com.genersoft.iot.vmp.utils.SpringBeanFactory; |
| 14 | 13 | import gov.nist.javax.sip.SipStackImpl; |
| 15 | 14 | import org.dom4j.Element; |
| ... | ... | @@ -41,7 +40,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent |
| 41 | 40 | private ControlMessageHandler controlMessageHandler; |
| 42 | 41 | |
| 43 | 42 | @Autowired |
| 44 | - private IVideoManagerStorager storager; | |
| 43 | + private IVideoManagerStorage storager; | |
| 45 | 44 | |
| 46 | 45 | @Autowired |
| 47 | 46 | private SIPCommander cmder; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 4 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| ... | ... | @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | 12 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 14 | 14 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 15 | 15 | import org.dom4j.Element; |
| 16 | 16 | import org.slf4j.Logger; |
| ... | ... | @@ -37,13 +37,13 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme |
| 37 | 37 | private EventPublisher publisher; |
| 38 | 38 | |
| 39 | 39 | @Autowired |
| 40 | - private UserSetup userSetup; | |
| 40 | + private UserSetting userSetting; | |
| 41 | 41 | |
| 42 | 42 | @Autowired |
| 43 | 43 | private SipConfig sipConfig; |
| 44 | 44 | |
| 45 | 45 | @Autowired |
| 46 | - private IVideoManagerStorager storager; | |
| 46 | + private IVideoManagerStorage storager; | |
| 47 | 47 | |
| 48 | 48 | @Autowired |
| 49 | 49 | private IDeviceAlarmService deviceAlarmService; |
| ... | ... | @@ -99,7 +99,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme |
| 99 | 99 | mobilePosition.setGeodeticSystem("BD-09"); |
| 100 | 100 | mobilePosition.setCnLng(bp.getBdLng()); |
| 101 | 101 | mobilePosition.setCnLat(bp.getBdLat()); |
| 102 | - if (!userSetup.getSavePositionHistory()) { | |
| 102 | + if (!userSetting.getSavePositionHistory()) { | |
| 103 | 103 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| 104 | 104 | } |
| 105 | 105 | storager.insertMobilePosition(mobilePosition); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.SipConfig; | |
| 4 | 3 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 5 | -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | |
| 6 | 4 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 7 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 8 | 6 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 12 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 9 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 13 | 10 | import org.dom4j.Element; |
| 14 | -import org.slf4j.Logger; | |
| 15 | -import org.slf4j.LoggerFactory; | |
| 16 | 11 | import org.springframework.beans.factory.InitializingBean; |
| 17 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 13 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -28,21 +23,17 @@ import java.util.List; |
| 28 | 23 | @Component |
| 29 | 24 | public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| 30 | 25 | |
| 31 | - private Logger logger = LoggerFactory.getLogger(CatalogNotifyMessageHandler.class); | |
| 32 | 26 | private final String cmdType = "Catalog"; |
| 33 | 27 | |
| 34 | 28 | @Autowired |
| 35 | 29 | private NotifyMessageHandler notifyMessageHandler; |
| 36 | 30 | |
| 37 | 31 | @Autowired |
| 38 | - private IVideoManagerStorager storager; | |
| 32 | + private IVideoManagerStorage storage; | |
| 39 | 33 | |
| 40 | 34 | @Autowired |
| 41 | 35 | private SIPCommanderFroPlatform cmderFroPlatform; |
| 42 | 36 | |
| 43 | - @Autowired | |
| 44 | - private SipConfig config; | |
| 45 | - | |
| 46 | 37 | @Override |
| 47 | 38 | public void afterPropertiesSet() throws Exception { |
| 48 | 39 | notifyMessageHandler.addHandler(cmdType, this); |
| ... | ... | @@ -64,12 +55,12 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple |
| 64 | 55 | Element snElement = rootElement.element("SN"); |
| 65 | 56 | String sn = snElement.getText(); |
| 66 | 57 | // 准备回复通道信息 |
| 67 | - List<DeviceChannelInPlatform> deviceChannels = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); | |
| 58 | + List<DeviceChannelInPlatform> deviceChannels = storage.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); | |
| 68 | 59 | // 查询关联的直播通道 |
| 69 | - List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); | |
| 60 | + List<GbStream> gbStreams = storage.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); | |
| 70 | 61 | int size = deviceChannels.size() + gbStreams.size(); |
| 71 | 62 | // 回复目录信息 |
| 72 | - List<PlatformCatalog> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId()); | |
| 63 | + List<PlatformCatalog> catalogs = storage.queryCatalogInPlatform(parentPlatform.getServerGBId()); | |
| 73 | 64 | if (catalogs.size() > 0) { |
| 74 | 65 | for (PlatformCatalog catalog : catalogs) { |
| 75 | 66 | if (catalog.getParentId().equals(catalog.getPlatformId())) { |
| ... | ... | @@ -101,7 +92,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple |
| 101 | 92 | if (channel.getCatalogId().equals(parentPlatform.getServerGBId())) { |
| 102 | 93 | channel.setCatalogId(parentPlatform.getDeviceGBId()); |
| 103 | 94 | } |
| 104 | - DeviceChannel deviceChannel = storager.queryChannel(channel.getDeviceId(), channel.getChannelId()); | |
| 95 | + DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId()); | |
| 105 | 96 | deviceChannel.setParental(0); |
| 106 | 97 | deviceChannel.setParentId(channel.getCatalogId()); |
| 107 | 98 | deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6)); |
| ... | ... | @@ -140,13 +131,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple |
| 140 | 131 | // 回复无通道 |
| 141 | 132 | cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), size); |
| 142 | 133 | } |
| 143 | - } catch (SipException e) { | |
| 144 | - e.printStackTrace(); | |
| 145 | - } catch (InvalidArgumentException e) { | |
| 146 | - e.printStackTrace(); | |
| 147 | - } catch (ParseException e) { | |
| 148 | - e.printStackTrace(); | |
| 149 | - } catch (InterruptedException e) { | |
| 134 | + } catch (SipException | InvalidArgumentException | ParseException | InterruptedException e) { | |
| 150 | 135 | e.printStackTrace(); |
| 151 | 136 | } |
| 152 | 137 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
| ... | ... | @@ -7,9 +7,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 10 | -import com.genersoft.iot.vmp.service.IDeviceService; | |
| 11 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 13 | 12 | import org.dom4j.Element; |
| 14 | 13 | import org.slf4j.Logger; |
| 15 | 14 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -17,7 +16,6 @@ import org.springframework.beans.factory.InitializingBean; |
| 17 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 17 | import org.springframework.stereotype.Component; |
| 19 | 18 | import org.springframework.util.StringUtils; |
| 20 | -import springfox.documentation.service.Header; | |
| 21 | 19 | |
| 22 | 20 | import javax.sip.InvalidArgumentException; |
| 23 | 21 | import javax.sip.RequestEvent; |
| ... | ... | @@ -39,7 +37,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp |
| 39 | 37 | private EventPublisher publisher; |
| 40 | 38 | |
| 41 | 39 | @Autowired |
| 42 | - private IVideoManagerStorager videoManagerStorager; | |
| 40 | + private IVideoManagerStorage videoManagerStorager; | |
| 43 | 41 | |
| 44 | 42 | @Autowired |
| 45 | 43 | private IRedisCatchStorage redisCatchStorage; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 3 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| ... | ... | @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 13 | 13 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 14 | 14 | import org.dom4j.DocumentException; |
| 15 | 15 | import org.dom4j.Element; |
| ... | ... | @@ -38,10 +38,10 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen |
| 38 | 38 | private NotifyMessageHandler notifyMessageHandler; |
| 39 | 39 | |
| 40 | 40 | @Autowired |
| 41 | - private UserSetup userSetup; | |
| 41 | + private UserSetting userSetting; | |
| 42 | 42 | |
| 43 | 43 | @Autowired |
| 44 | - private IVideoManagerStorager storager; | |
| 44 | + private IVideoManagerStorage storager; | |
| 45 | 45 | |
| 46 | 46 | @Override |
| 47 | 47 | public void afterPropertiesSet() throws Exception { |
| ... | ... | @@ -85,7 +85,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen |
| 85 | 85 | mobilePosition.setGeodeticSystem("BD-09"); |
| 86 | 86 | mobilePosition.setCnLng(bp.getBdLng()); |
| 87 | 87 | mobilePosition.setCnLat(bp.getBdLat()); |
| 88 | - if (!userSetup.getSavePositionHistory()) { | |
| 88 | + if (!userSetting.getSavePositionHistory()) { | |
| 89 | 89 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| 90 | 90 | } |
| 91 | 91 | storager.insertMobilePosition(mobilePosition); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java
| ... | ... | @@ -2,17 +2,13 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query. |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | |
| 6 | -import com.genersoft.iot.vmp.gb28181.bean.GbStream; | |
| 7 | 5 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 8 | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | |
| 10 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 11 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 15 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 16 | 12 | import org.dom4j.Element; |
| 17 | 13 | import org.slf4j.Logger; |
| 18 | 14 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -23,10 +19,8 @@ import org.springframework.stereotype.Component; |
| 23 | 19 | import javax.sip.InvalidArgumentException; |
| 24 | 20 | import javax.sip.RequestEvent; |
| 25 | 21 | import javax.sip.SipException; |
| 26 | -import javax.sip.header.FromHeader; | |
| 27 | 22 | import javax.sip.message.Response; |
| 28 | 23 | import java.text.ParseException; |
| 29 | -import java.util.List; | |
| 30 | 24 | |
| 31 | 25 | @Component |
| 32 | 26 | public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| ... | ... | @@ -38,7 +32,7 @@ public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implemen |
| 38 | 32 | private QueryMessageHandler queryMessageHandler; |
| 39 | 33 | |
| 40 | 34 | @Autowired |
| 41 | - private IVideoManagerStorager storager; | |
| 35 | + private IVideoManagerStorage storager; | |
| 42 | 36 | |
| 43 | 37 | @Autowired |
| 44 | 38 | private SIPCommanderFroPlatform cmderFroPlatform; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
| ... | ... | @@ -8,8 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 12 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 13 | 12 | import org.dom4j.Element; |
| 14 | 13 | import org.slf4j.Logger; |
| 15 | 14 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -35,7 +34,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 35 | 34 | private QueryMessageHandler queryMessageHandler; |
| 36 | 35 | |
| 37 | 36 | @Autowired |
| 38 | - private IVideoManagerStorager storager; | |
| 37 | + private IVideoManagerStorage storager; | |
| 39 | 38 | |
| 40 | 39 | @Autowired |
| 41 | 40 | private SIPCommanderFroPlatform cmderFroPlatform; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceStatusQueryMessageHandler.java
| ... | ... | @@ -8,7 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 12 | 12 | import org.dom4j.Element; |
| 13 | 13 | import org.slf4j.Logger; |
| 14 | 14 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -33,7 +33,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i |
| 33 | 33 | private QueryMessageHandler queryMessageHandler; |
| 34 | 34 | |
| 35 | 35 | @Autowired |
| 36 | - private IVideoManagerStorager storager; | |
| 36 | + private IVideoManagerStorage storager; | |
| 37 | 37 | |
| 38 | 38 | @Autowired |
| 39 | 39 | private SIPCommanderFroPlatform cmderFroPlatform; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java
| ... | ... | @@ -4,16 +4,14 @@ import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener; |
| 7 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | |
| 8 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 9 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 10 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 11 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 12 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 13 | 12 | import com.genersoft.iot.vmp.gb28181.utils.DateUtil; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 15 | 14 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; |
| 16 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 17 | 15 | import org.dom4j.Element; |
| 18 | 16 | import org.slf4j.Logger; |
| 19 | 17 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -39,7 +37,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp |
| 39 | 37 | private QueryMessageHandler queryMessageHandler; |
| 40 | 38 | |
| 41 | 39 | @Autowired |
| 42 | - private IVideoManagerStorager storager; | |
| 40 | + private IVideoManagerStorage storager; | |
| 43 | 41 | |
| 44 | 42 | @Autowired |
| 45 | 43 | private SIPCommanderFroPlatform cmderFroPlatform; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
| ... | ... | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 5 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| ... | ... | @@ -15,7 +15,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respons |
| 15 | 15 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 16 | 16 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 17 | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 18 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 19 | 19 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 20 | 20 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 21 | 21 | import org.dom4j.DocumentException; |
| ... | ... | @@ -34,12 +34,9 @@ import javax.sip.message.Response; |
| 34 | 34 | import java.text.ParseException; |
| 35 | 35 | import java.text.SimpleDateFormat; |
| 36 | 36 | import java.util.ArrayList; |
| 37 | -import java.util.Date; | |
| 38 | 37 | import java.util.Iterator; |
| 39 | 38 | import java.util.List; |
| 40 | 39 | |
| 41 | -import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; | |
| 42 | - | |
| 43 | 40 | @Component |
| 44 | 41 | public class CatalogResponseMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| 45 | 42 | |
| ... | ... | @@ -52,7 +49,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 52 | 49 | private ResponseMessageHandler responseMessageHandler; |
| 53 | 50 | |
| 54 | 51 | @Autowired |
| 55 | - private IVideoManagerStorager storager; | |
| 52 | + private IVideoManagerStorage storager; | |
| 56 | 53 | |
| 57 | 54 | @Autowired |
| 58 | 55 | private DeferredResultHolder deferredResultHolder; |
| ... | ... | @@ -71,7 +68,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 71 | 68 | |
| 72 | 69 | //by brewswang |
| 73 | 70 | @Autowired |
| 74 | - private UserSetup userSetup; | |
| 71 | + private UserSetting userSetting; | |
| 75 | 72 | |
| 76 | 73 | @Autowired |
| 77 | 74 | private IRedisCatchStorage redisCatchStorage; |
| ... | ... | @@ -224,7 +221,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 224 | 221 | mobilePosition.setGeodeticSystem("BD-09"); |
| 225 | 222 | mobilePosition.setCnLng(bp.getBdLng()); |
| 226 | 223 | mobilePosition.setCnLat(bp.getBdLat()); |
| 227 | - if (!userSetup.getSavePositionHistory()) { | |
| 224 | + if (!userSetting.getSavePositionHistory()) { | |
| 228 | 225 | storager.clearMobilePositionsByDeviceId(deviceId); |
| 229 | 226 | } |
| 230 | 227 | storager.insertMobilePosition(mobilePosition); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java
| ... | ... | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 14 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 15 | 15 | import org.dom4j.DocumentException; |
| 16 | 16 | import org.dom4j.Element; |
| 17 | 17 | import org.slf4j.Logger; |
| ... | ... | @@ -39,7 +39,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent |
| 39 | 39 | private ResponseMessageHandler responseMessageHandler; |
| 40 | 40 | |
| 41 | 41 | @Autowired |
| 42 | - private IVideoManagerStorager storager; | |
| 42 | + private IVideoManagerStorage storager; | |
| 43 | 43 | |
| 44 | 44 | @Autowired |
| 45 | 45 | private DeferredResultHolder deferredResultHolder; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 3 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| ... | ... | @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 13 | 13 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 14 | 14 | import org.dom4j.DocumentException; |
| 15 | 15 | import org.dom4j.Element; |
| ... | ... | @@ -38,10 +38,10 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar |
| 38 | 38 | private ResponseMessageHandler responseMessageHandler; |
| 39 | 39 | |
| 40 | 40 | @Autowired |
| 41 | - private UserSetup userSetup; | |
| 41 | + private UserSetting userSetting; | |
| 42 | 42 | |
| 43 | 43 | @Autowired |
| 44 | - private IVideoManagerStorager storager; | |
| 44 | + private IVideoManagerStorage storager; | |
| 45 | 45 | |
| 46 | 46 | @Override |
| 47 | 47 | public void afterPropertiesSet() throws Exception { |
| ... | ... | @@ -85,7 +85,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar |
| 85 | 85 | mobilePosition.setGeodeticSystem("BD-09"); |
| 86 | 86 | mobilePosition.setCnLng(bp.getBdLng()); |
| 87 | 87 | mobilePosition.setCnLat(bp.getBdLat()); |
| 88 | - if (!userSetup.getSavePositionHistory()) { | |
| 88 | + if (!userSetting.getSavePositionHistory()) { | |
| 89 | 89 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| 90 | 90 | } |
| 91 | 91 | storager.insertMobilePosition(mobilePosition); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
| ... | ... | @@ -7,7 +7,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract; |
| 9 | 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 10 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 10 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 11 | 11 | import org.slf4j.Logger; |
| 12 | 12 | import org.slf4j.LoggerFactory; |
| 13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -33,7 +33,7 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract { |
| 33 | 33 | private ISIPCommanderForPlatform sipCommanderForPlatform; |
| 34 | 34 | |
| 35 | 35 | @Autowired |
| 36 | - private IVideoManagerStorager storager; | |
| 36 | + private IVideoManagerStorage storager; | |
| 37 | 37 | |
| 38 | 38 | @Autowired |
| 39 | 39 | private IRedisCatchStorage redisCatchStorage; | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| ... | ... | @@ -2,12 +2,10 @@ package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.List; |
| 5 | -import java.util.UUID; | |
| 6 | 5 | |
| 7 | 6 | import com.alibaba.fastjson.JSON; |
| 8 | 7 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 9 | -import com.genersoft.iot.vmp.conf.MediaConfig; | |
| 10 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 8 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 11 | 9 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 12 | 10 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 13 | 11 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| ... | ... | @@ -17,9 +15,8 @@ import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 17 | 15 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 18 | 16 | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| 19 | 17 | import com.genersoft.iot.vmp.service.*; |
| 20 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | |
| 21 | 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 22 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 19 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 23 | 20 | import org.slf4j.Logger; |
| 24 | 21 | import org.slf4j.LoggerFactory; |
| 25 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -54,7 +51,7 @@ public class ZLMHttpHookListener { |
| 54 | 51 | private IPlayService playService; |
| 55 | 52 | |
| 56 | 53 | @Autowired |
| 57 | - private IVideoManagerStorager storager; | |
| 54 | + private IVideoManagerStorage storager; | |
| 58 | 55 | |
| 59 | 56 | @Autowired |
| 60 | 57 | private IRedisCatchStorage redisCatchStorage; |
| ... | ... | @@ -81,7 +78,7 @@ public class ZLMHttpHookListener { |
| 81 | 78 | private ZLMHttpHookSubscribe subscribe; |
| 82 | 79 | |
| 83 | 80 | @Autowired |
| 84 | - private UserSetup userSetup; | |
| 81 | + private UserSetting userSetting; | |
| 85 | 82 | |
| 86 | 83 | @Autowired |
| 87 | 84 | private VideoStreamSessionManager sessionManager; |
| ... | ... | @@ -189,6 +186,12 @@ public class ZLMHttpHookListener { |
| 189 | 186 | ret.put("code", 0); |
| 190 | 187 | ret.put("msg", "success"); |
| 191 | 188 | ret.put("enable_hls", true); |
| 189 | + if (json.getInteger("originType") == 1 | |
| 190 | + || json.getInteger("originType") == 2 | |
| 191 | + || json.getInteger("originType") == 3) { | |
| 192 | + ret.put("enable_audio", true); | |
| 193 | + } | |
| 194 | + | |
| 192 | 195 | String mediaServerId = json.getString("mediaServerId"); |
| 193 | 196 | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json); |
| 194 | 197 | if (subscribe != null) { |
| ... | ... | @@ -203,9 +206,9 @@ public class ZLMHttpHookListener { |
| 203 | 206 | String app = json.getString("app"); |
| 204 | 207 | String stream = json.getString("stream"); |
| 205 | 208 | if ("rtp".equals(app)) { |
| 206 | - ret.put("enable_mp4", userSetup.getRecordSip()); | |
| 209 | + ret.put("enable_mp4", userSetting.getRecordSip()); | |
| 207 | 210 | }else { |
| 208 | - ret.put("enable_mp4", userSetup.isRecordPushLive()); | |
| 211 | + ret.put("enable_mp4", userSetting.isRecordPushLive()); | |
| 209 | 212 | } |
| 210 | 213 | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, stream); |
| 211 | 214 | if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) { |
| ... | ... | @@ -412,7 +415,7 @@ public class ZLMHttpHookListener { |
| 412 | 415 | if (type != null) { |
| 413 | 416 | // 发送流变化redis消息 |
| 414 | 417 | JSONObject jsonObject = new JSONObject(); |
| 415 | - jsonObject.put("serverId", userSetup.getServerId()); | |
| 418 | + jsonObject.put("serverId", userSetting.getServerId()); | |
| 416 | 419 | jsonObject.put("app", app); |
| 417 | 420 | jsonObject.put("stream", streamId); |
| 418 | 421 | jsonObject.put("register", regist); |
| ... | ... | @@ -506,7 +509,7 @@ public class ZLMHttpHookListener { |
| 506 | 509 | } |
| 507 | 510 | String mediaServerId = json.getString("mediaServerId"); |
| 508 | 511 | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); |
| 509 | - if (userSetup.isAutoApplyPlay() && mediaInfo != null && mediaInfo.isRtpEnable()) { | |
| 512 | + if (userSetting.isAutoApplyPlay() && mediaInfo != null && mediaInfo.isRtpEnable()) { | |
| 510 | 513 | String app = json.getString("app"); |
| 511 | 514 | String streamId = json.getString("stream"); |
| 512 | 515 | if ("rtp".equals(app)) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
| 1 | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 4 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 6 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | |
| 7 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | |
| 8 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | |
| 9 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | |
| 6 | +import com.genersoft.iot.vmp.media.zlm.dto.*; | |
| 10 | 7 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 11 | 8 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 12 | 9 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| 13 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 15 | 12 | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| 16 | 13 | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| 17 | 14 | import com.genersoft.iot.vmp.storager.dao.StreamPushMapper; |
| 15 | +import org.checkerframework.checker.units.qual.C; | |
| 18 | 16 | import org.slf4j.Logger; |
| 19 | 17 | import org.slf4j.LoggerFactory; |
| 20 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -22,6 +20,7 @@ import org.springframework.stereotype.Component; |
| 22 | 20 | import org.springframework.util.StringUtils; |
| 23 | 21 | |
| 24 | 22 | import java.util.*; |
| 23 | +import java.util.concurrent.ConcurrentHashMap; | |
| 25 | 24 | import java.util.regex.Matcher; |
| 26 | 25 | import java.util.regex.Pattern; |
| 27 | 26 | |
| ... | ... | @@ -37,7 +36,7 @@ public class ZLMMediaListManager { |
| 37 | 36 | private IRedisCatchStorage redisCatchStorage; |
| 38 | 37 | |
| 39 | 38 | @Autowired |
| 40 | - private IVideoManagerStorager storager; | |
| 39 | + private IVideoManagerStorage storager; | |
| 41 | 40 | |
| 42 | 41 | @Autowired |
| 43 | 42 | private GbStreamMapper gbStreamMapper; |
| ... | ... | @@ -58,7 +57,9 @@ public class ZLMMediaListManager { |
| 58 | 57 | private ZLMHttpHookSubscribe subscribe; |
| 59 | 58 | |
| 60 | 59 | @Autowired |
| 61 | - private UserSetup userSetup; | |
| 60 | + private UserSetting userSetting; | |
| 61 | + | |
| 62 | + private Map<String, ChannelOnlineEvent> channelOnlineEvents = new ConcurrentHashMap<>(); | |
| 62 | 63 | |
| 63 | 64 | |
| 64 | 65 | public void updateMediaList(MediaServerItem mediaServerItem) { |
| ... | ... | @@ -109,7 +110,7 @@ public class ZLMMediaListManager { |
| 109 | 110 | // 查找此直播流是否存在redis预设gbId |
| 110 | 111 | StreamPushItem transform = streamPushService.transform(mediaItem); |
| 111 | 112 | // 从streamId取出查询关键值 |
| 112 | - Pattern pattern = Pattern.compile(userSetup.getThirdPartyGBIdReg()); | |
| 113 | + Pattern pattern = Pattern.compile(userSetting.getThirdPartyGBIdReg()); | |
| 113 | 114 | Matcher matcher = pattern.matcher(mediaItem.getStream());// 指定要匹配的字符串 |
| 114 | 115 | String queryKey = null; |
| 115 | 116 | if (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配 |
| ... | ... | @@ -157,7 +158,15 @@ public class ZLMMediaListManager { |
| 157 | 158 | transform.setCreateStamp(System.currentTimeMillis()); |
| 158 | 159 | gbStreamMapper.add(transform); |
| 159 | 160 | } |
| 161 | + if (transform != null) { | |
| 162 | + if (channelOnlineEvents.get(transform.getGbId()) != null) { | |
| 163 | + channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream()); | |
| 164 | + channelOnlineEvents.remove(transform.getGbId()); | |
| 165 | + } | |
| 166 | + } | |
| 160 | 167 | } |
| 168 | + | |
| 169 | + | |
| 161 | 170 | storager.updateMedia(transform); |
| 162 | 171 | return transform; |
| 163 | 172 | } |
| ... | ... | @@ -200,6 +209,14 @@ public class ZLMMediaListManager { |
| 200 | 209 | return result; |
| 201 | 210 | } |
| 202 | 211 | |
| 212 | + public void addChannelOnlineEventLister(String key, ChannelOnlineEvent callback) { | |
| 213 | + this.channelOnlineEvents.put(key,callback); | |
| 214 | + } | |
| 215 | + | |
| 216 | + public void removedChannelOnlineEventLister(String key) { | |
| 217 | + this.channelOnlineEvents.remove(key); | |
| 218 | + } | |
| 219 | + | |
| 203 | 220 | |
| 204 | 221 | |
| 205 | 222 | // public void clearAllSessions() { | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ChannelOnlineEvent.java
0 → 100644
src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java
| ... | ... | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.media.zlm.event; |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 5 | 5 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 6 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 6 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 8 | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 9 | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| ... | ... | @@ -12,7 +12,6 @@ import org.slf4j.Logger; |
| 12 | 12 | import org.slf4j.LoggerFactory; |
| 13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 14 | import org.springframework.data.redis.connection.Message; |
| 15 | -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | |
| 16 | 15 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 17 | 16 | import org.springframework.stereotype.Component; |
| 18 | 17 | |
| ... | ... | @@ -33,13 +32,13 @@ public class ZLMKeepliveTimeoutListener extends RedisKeyExpirationEventMessageLi |
| 33 | 32 | private ZLMRESTfulUtils zlmresTfulUtils; |
| 34 | 33 | |
| 35 | 34 | @Autowired |
| 36 | - private UserSetup userSetup; | |
| 35 | + private UserSetting userSetting; | |
| 37 | 36 | |
| 38 | 37 | @Autowired |
| 39 | 38 | private IMediaServerService mediaServerService; |
| 40 | 39 | |
| 41 | - public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | |
| 42 | - super(listenerContainer, userSetup); | |
| 40 | + public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { | |
| 41 | + super(listenerContainer, userSetting); | |
| 43 | 42 | } |
| 44 | 43 | |
| 45 | 44 | |
| ... | ... | @@ -52,7 +51,7 @@ public class ZLMKeepliveTimeoutListener extends RedisKeyExpirationEventMessageLi |
| 52 | 51 | public void onMessage(Message message, byte[] pattern) { |
| 53 | 52 | // 获取失效的key |
| 54 | 53 | String expiredKey = message.toString(); |
| 55 | - String KEEPLIVEKEY_PREFIX = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetup.getServerId() + "_"; | |
| 54 | + String KEEPLIVEKEY_PREFIX = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_"; | |
| 56 | 55 | if(!expiredKey.startsWith(KEEPLIVEKEY_PREFIX)){ |
| 57 | 56 | return; |
| 58 | 57 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
| ... | ... | @@ -21,4 +21,17 @@ public interface IDeviceService { |
| 21 | 21 | */ |
| 22 | 22 | boolean removeCatalogSubscribe(Device device); |
| 23 | 23 | |
| 24 | + /** | |
| 25 | + * 添加移动位置订阅 | |
| 26 | + * @param device 设备信息 | |
| 27 | + * @return | |
| 28 | + */ | |
| 29 | + boolean addMobilePositionSubscribe(Device device); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 移除移动位置订阅 | |
| 33 | + * @param device 设备信息 | |
| 34 | + * @return | |
| 35 | + */ | |
| 36 | + boolean removeMobilePositionSubscribe(Device device); | |
| 24 | 37 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/StreamGPSSubscribeTask.java
| ... | ... | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.service; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 4 | 4 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 5 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 5 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 6 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 7 | import org.springframework.scheduling.annotation.Scheduled; |
| 8 | 8 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -20,7 +20,7 @@ public class StreamGPSSubscribeTask { |
| 20 | 20 | private IRedisCatchStorage redisCatchStorage; |
| 21 | 21 | |
| 22 | 22 | @Autowired |
| 23 | - private IVideoManagerStorager storager; | |
| 23 | + private IVideoManagerStorage storager; | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/bean/CatalogSubscribeTask.java
| ... | ... | @@ -10,6 +10,9 @@ import org.slf4j.LoggerFactory; |
| 10 | 10 | |
| 11 | 11 | import javax.sip.ResponseEvent; |
| 12 | 12 | |
| 13 | +/** | |
| 14 | + * 目录订阅任务 | |
| 15 | + */ | |
| 13 | 16 | public class CatalogSubscribeTask implements Runnable{ |
| 14 | 17 | private final Logger logger = LoggerFactory.getLogger(CatalogSubscribeTask.class); |
| 15 | 18 | private Device device; |
| ... | ... | @@ -24,7 +27,6 @@ public class CatalogSubscribeTask implements Runnable{ |
| 24 | 27 | public void run() { |
| 25 | 28 | sipCommander.catalogSubscribe(device, eventResult -> { |
| 26 | 29 | ResponseEvent event = (ResponseEvent) eventResult.event; |
| 27 | - Element rootElement = null; | |
| 28 | 30 | if (event.getResponse().getRawContent() != null) { |
| 29 | 31 | // 成功 |
| 30 | 32 | logger.info("[目录订阅]成功: {}", device.getDeviceId()); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannel.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.service.bean; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 当上级平台 | |
| 5 | + */ | |
| 6 | +public class MessageForPushChannel { | |
| 7 | + /** | |
| 8 | + * 消息类型 | |
| 9 | + * 0 流注销 1 流注册 | |
| 10 | + */ | |
| 11 | + private int type; | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * 流应用名 | |
| 15 | + */ | |
| 16 | + private String app; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 流Id | |
| 20 | + */ | |
| 21 | + private String stream; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 国标ID | |
| 25 | + */ | |
| 26 | + private String gbId; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 请求的平台ID | |
| 30 | + */ | |
| 31 | + private String platFormId; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 请求平台名称 | |
| 35 | + */ | |
| 36 | + private String platFormName; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * WVP服务ID | |
| 40 | + */ | |
| 41 | + private String serverId; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 目标流媒体节点ID | |
| 45 | + */ | |
| 46 | + private String mediaServerId; | |
| 47 | + | |
| 48 | + | |
| 49 | + public int getType() { | |
| 50 | + return type; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setType(int type) { | |
| 54 | + this.type = type; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public String getApp() { | |
| 58 | + return app; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setApp(String app) { | |
| 62 | + this.app = app; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getStream() { | |
| 66 | + return stream; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setStream(String stream) { | |
| 70 | + this.stream = stream; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public String getGbId() { | |
| 74 | + return gbId; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setGbId(String gbId) { | |
| 78 | + this.gbId = gbId; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getPlatFormId() { | |
| 82 | + return platFormId; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setPlatFormId(String platFormId) { | |
| 86 | + this.platFormId = platFormId; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getPlatFormName() { | |
| 90 | + return platFormName; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setPlatFormName(String platFormName) { | |
| 94 | + this.platFormName = platFormName; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public String getServerId() { | |
| 98 | + return serverId; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setServerId(String serverId) { | |
| 102 | + this.serverId = serverId; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public String getMediaServerId() { | |
| 106 | + return mediaServerId; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setMediaServerId(String mediaServerId) { | |
| 110 | + this.mediaServerId = mediaServerId; | |
| 111 | + } | |
| 112 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/bean/MobilePositionSubscribeTask.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.service.bean; | |
| 2 | + | |
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.Device; | |
| 4 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | |
| 5 | +import org.dom4j.Element; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 8 | + | |
| 9 | +import javax.sip.ResponseEvent; | |
| 10 | + | |
| 11 | +public class MobilePositionSubscribeTask implements Runnable{ | |
| 12 | + private final Logger logger = LoggerFactory.getLogger(MobilePositionSubscribeTask.class); | |
| 13 | + private Device device; | |
| 14 | + private ISIPCommander sipCommander; | |
| 15 | + | |
| 16 | + public MobilePositionSubscribeTask(Device device, ISIPCommander sipCommander) { | |
| 17 | + this.device = device; | |
| 18 | + this.sipCommander = sipCommander; | |
| 19 | + } | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public void run() { | |
| 23 | + sipCommander.mobilePositionSubscribe(device, eventResult -> { | |
| 24 | + ResponseEvent event = (ResponseEvent) eventResult.event; | |
| 25 | + Element rootElement = null; | |
| 26 | + if (event.getResponse().getRawContent() != null) { | |
| 27 | + // 成功 | |
| 28 | + logger.info("[移动位置订阅]成功: {}", device.getDeviceId()); | |
| 29 | + }else { | |
| 30 | + // 成功 | |
| 31 | + logger.info("[移动位置订阅]成功: {}", device.getDeviceId()); | |
| 32 | + } | |
| 33 | + },eventResult -> { | |
| 34 | + // 失败 | |
| 35 | + logger.warn("[移动位置订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg); | |
| 36 | + }); | |
| 37 | + } | |
| 38 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| ... | ... | @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 6 | 6 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 7 | 7 | import com.genersoft.iot.vmp.service.bean.CatalogSubscribeTask; |
| 8 | +import com.genersoft.iot.vmp.service.bean.MobilePositionSubscribeTask; | |
| 8 | 9 | import org.slf4j.Logger; |
| 9 | 10 | import org.slf4j.LoggerFactory; |
| 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -20,7 +21,6 @@ public class DeviceServiceImpl implements IDeviceService { |
| 20 | 21 | |
| 21 | 22 | @Autowired |
| 22 | 23 | private DynamicTask dynamicTask; |
| 23 | -; | |
| 24 | 24 | |
| 25 | 25 | @Autowired |
| 26 | 26 | private ISIPCommander sipCommander; |
| ... | ... | @@ -30,9 +30,9 @@ public class DeviceServiceImpl implements IDeviceService { |
| 30 | 30 | if (device == null || device.getSubscribeCycleForCatalog() < 0) { |
| 31 | 31 | return false; |
| 32 | 32 | } |
| 33 | - if (dynamicTask.contains(device.getDeviceId())) { | |
| 33 | + if (dynamicTask.contains(device.getDeviceId() + "catalog")) { | |
| 34 | 34 | // 存在则停止现有的,开启新的 |
| 35 | - dynamicTask.stop(device.getDeviceId()); | |
| 35 | + dynamicTask.stop(device.getDeviceId() + "catalog"); | |
| 36 | 36 | } |
| 37 | 37 | logger.info("[添加目录订阅] 设备{}", device.getDeviceId()); |
| 38 | 38 | // 添加目录订阅 |
| ... | ... | @@ -42,7 +42,7 @@ public class DeviceServiceImpl implements IDeviceService { |
| 42 | 42 | int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog(); |
| 43 | 43 | // 设置最小值为30 |
| 44 | 44 | subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30); |
| 45 | - dynamicTask.startCron(device.getDeviceId(), catalogSubscribeTask, subscribeCycleForCatalog - 5); | |
| 45 | + dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, subscribeCycleForCatalog - 5); | |
| 46 | 46 | return true; |
| 47 | 47 | } |
| 48 | 48 | |
| ... | ... | @@ -52,9 +52,42 @@ public class DeviceServiceImpl implements IDeviceService { |
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | logger.info("移除目录订阅: {}", device.getDeviceId()); |
| 55 | - dynamicTask.stop(device.getDeviceId()); | |
| 55 | + dynamicTask.stop(device.getDeviceId() + "catalog"); | |
| 56 | 56 | device.setSubscribeCycleForCatalog(0); |
| 57 | 57 | sipCommander.catalogSubscribe(device, null, null); |
| 58 | 58 | return true; |
| 59 | 59 | } |
| 60 | + | |
| 61 | + @Override | |
| 62 | + public boolean addMobilePositionSubscribe(Device device) { | |
| 63 | + if (device == null || device.getSubscribeCycleForMobilePosition() < 0) { | |
| 64 | + return false; | |
| 65 | + } | |
| 66 | + if (dynamicTask.contains(device.getDeviceId() + "mobile_position")) { | |
| 67 | + // 存在则停止现有的,开启新的 | |
| 68 | + dynamicTask.stop(device.getDeviceId() + "mobile_position"); | |
| 69 | + } | |
| 70 | + logger.info("[添加移动位置订阅] 设备{}", device.getDeviceId()); | |
| 71 | + // 添加目录订阅 | |
| 72 | + MobilePositionSubscribeTask mobilePositionSubscribeTask = new MobilePositionSubscribeTask(device, sipCommander); | |
| 73 | + mobilePositionSubscribeTask.run(); | |
| 74 | + // 提前开始刷新订阅 | |
| 75 | + int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog(); | |
| 76 | + // 设置最小值为30 | |
| 77 | + subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30); | |
| 78 | + dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, subscribeCycleForCatalog - 5); | |
| 79 | + return true; | |
| 80 | + } | |
| 81 | + | |
| 82 | + @Override | |
| 83 | + public boolean removeMobilePositionSubscribe(Device device) { | |
| 84 | + if (device == null || device.getSubscribeCycleForCatalog() < 0) { | |
| 85 | + return false; | |
| 86 | + } | |
| 87 | + logger.info("移除移动位置订阅: {}", device.getDeviceId()); | |
| 88 | + dynamicTask.stop(device.getDeviceId() + "mobile_position"); | |
| 89 | + device.setSubscribeCycleForCatalog(0); | |
| 90 | + sipCommander.mobilePositionSubscribe(device, null, null); | |
| 91 | + return true; | |
| 92 | + } | |
| 60 | 93 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| ... | ... | @@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | -import com.genersoft.iot.vmp.conf.MediaConfig; | |
| 8 | 7 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 9 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 10 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | |
| 8 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 11 | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 12 | 10 | import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; |
| 13 | 11 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| ... | ... | @@ -15,11 +13,10 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 15 | 13 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 16 | 14 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; |
| 17 | 15 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 18 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | |
| 19 | 16 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 20 | 17 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 21 | 18 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 22 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 19 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 23 | 20 | import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; |
| 24 | 21 | import com.genersoft.iot.vmp.utils.redis.JedisUtil; |
| 25 | 22 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| ... | ... | @@ -29,10 +26,7 @@ import org.slf4j.Logger; |
| 29 | 26 | import org.slf4j.LoggerFactory; |
| 30 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| 31 | 28 | import org.springframework.beans.factory.annotation.Value; |
| 32 | -import org.springframework.boot.CommandLineRunner; | |
| 33 | -import org.springframework.core.annotation.Order; | |
| 34 | 29 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| 35 | -import org.springframework.security.core.parameters.P; | |
| 36 | 30 | import org.springframework.stereotype.Service; |
| 37 | 31 | import org.springframework.transaction.TransactionDefinition; |
| 38 | 32 | import org.springframework.transaction.TransactionStatus; |
| ... | ... | @@ -60,7 +54,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 60 | 54 | private Integer serverPort; |
| 61 | 55 | |
| 62 | 56 | @Autowired |
| 63 | - private UserSetup userSetup; | |
| 57 | + private UserSetting userSetting; | |
| 64 | 58 | |
| 65 | 59 | @Autowired |
| 66 | 60 | private ZLMRESTfulUtils zlmresTfulUtils; |
| ... | ... | @@ -84,7 +78,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 84 | 78 | private RedisUtil redisUtil; |
| 85 | 79 | |
| 86 | 80 | @Autowired |
| 87 | - private IVideoManagerStorager storager; | |
| 81 | + private IVideoManagerStorage storager; | |
| 88 | 82 | |
| 89 | 83 | @Autowired |
| 90 | 84 | private IStreamProxyService streamProxyService; |
| ... | ... | @@ -111,10 +105,10 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 111 | 105 | if (mediaServerItem.getSsrcConfig() == null) { |
| 112 | 106 | SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain()); |
| 113 | 107 | mediaServerItem.setSsrcConfig(ssrcConfig); |
| 114 | - redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); | |
| 108 | + redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); | |
| 115 | 109 | } |
| 116 | 110 | // 查询redis是否存在此mediaServer |
| 117 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(); | |
| 111 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); | |
| 118 | 112 | if (!redisUtil.hasKey(key)) { |
| 119 | 113 | redisUtil.set(key, mediaServerItem); |
| 120 | 114 | } |
| ... | ... | @@ -133,7 +127,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 133 | 127 | return null; |
| 134 | 128 | } |
| 135 | 129 | // 获取mediaServer可用的ssrc |
| 136 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(); | |
| 130 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); | |
| 137 | 131 | |
| 138 | 132 | SsrcConfig ssrcConfig = mediaServerItem.getSsrcConfig(); |
| 139 | 133 | if (ssrcConfig == null) { |
| ... | ... | @@ -181,7 +175,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 181 | 175 | SsrcConfig ssrcConfig = mediaServerItem.getSsrcConfig(); |
| 182 | 176 | ssrcConfig.releaseSsrc(ssrc); |
| 183 | 177 | mediaServerItem.setSsrcConfig(ssrcConfig); |
| 184 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(); | |
| 178 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); | |
| 185 | 179 | redisUtil.set(key, mediaServerItem); |
| 186 | 180 | } |
| 187 | 181 | |
| ... | ... | @@ -191,7 +185,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 191 | 185 | @Override |
| 192 | 186 | public void clearRTPServer(MediaServerItem mediaServerItem) { |
| 193 | 187 | mediaServerItem.setSsrcConfig(new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain())); |
| 194 | - redisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(), mediaServerItem.getId(), 0); | |
| 188 | + redisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0); | |
| 195 | 189 | } |
| 196 | 190 | |
| 197 | 191 | |
| ... | ... | @@ -211,15 +205,15 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 211 | 205 | ) |
| 212 | 206 | ); |
| 213 | 207 | } |
| 214 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItemInDataBase.getId(); | |
| 208 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItemInDataBase.getId(); | |
| 215 | 209 | redisUtil.set(key, mediaServerItemInDataBase); |
| 216 | 210 | } |
| 217 | 211 | |
| 218 | 212 | @Override |
| 219 | 213 | public List<MediaServerItem> getAll() { |
| 220 | 214 | List<MediaServerItem> result = new ArrayList<>(); |
| 221 | - List<Object> mediaServerKeys = redisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetup.getServerId() + "_" )); | |
| 222 | - String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | |
| 215 | + List<Object> mediaServerKeys = redisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" )); | |
| 216 | + String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | |
| 223 | 217 | for (Object mediaServerKey : mediaServerKeys) { |
| 224 | 218 | String key = (String) mediaServerKey; |
| 225 | 219 | MediaServerItem mediaServerItem = (MediaServerItem) redisUtil.get(key); |
| ... | ... | @@ -250,13 +244,13 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 250 | 244 | |
| 251 | 245 | @Override |
| 252 | 246 | public List<MediaServerItem> getAllOnline() { |
| 253 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | |
| 247 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | |
| 254 | 248 | Set<String> mediaServerIdSet = redisUtil.zRevRange(key, 0, -1); |
| 255 | 249 | |
| 256 | 250 | List<MediaServerItem> result = new ArrayList<>(); |
| 257 | 251 | if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) { |
| 258 | 252 | for (String mediaServerId : mediaServerIdSet) { |
| 259 | - String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerId; | |
| 253 | + String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; | |
| 260 | 254 | result.add((MediaServerItem) redisUtil.get(serverKey)); |
| 261 | 255 | } |
| 262 | 256 | } |
| ... | ... | @@ -274,7 +268,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 274 | 268 | if (mediaServerId == null) { |
| 275 | 269 | return null; |
| 276 | 270 | } |
| 277 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerId; | |
| 271 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; | |
| 278 | 272 | return (MediaServerItem)redisUtil.get(key); |
| 279 | 273 | } |
| 280 | 274 | |
| ... | ... | @@ -286,7 +280,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 286 | 280 | |
| 287 | 281 | @Override |
| 288 | 282 | public void clearMediaServerForOnline() { |
| 289 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | |
| 283 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | |
| 290 | 284 | redisUtil.del(key); |
| 291 | 285 | } |
| 292 | 286 | |
| ... | ... | @@ -393,7 +387,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 393 | 387 | return; |
| 394 | 388 | } |
| 395 | 389 | mediaServerMapper.update(serverItem); |
| 396 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); | |
| 390 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); | |
| 397 | 391 | if (redisUtil.get(key) == null) { |
| 398 | 392 | SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain()); |
| 399 | 393 | serverItem.setSsrcConfig(ssrcConfig); |
| ... | ... | @@ -404,8 +398,9 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 404 | 398 | redisUtil.set(key, serverItem); |
| 405 | 399 | resetOnlineServerItem(serverItem); |
| 406 | 400 | updateMediaServerKeepalive(serverItem.getId(), null); |
| 407 | - setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); | |
| 408 | - | |
| 401 | + if (serverItem.isAutoConfig()) { | |
| 402 | + setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); | |
| 403 | + } | |
| 409 | 404 | publisher.zlmOnlineEventPublish(serverItem.getId()); |
| 410 | 405 | logger.info("[ ZLM:{} ]-[ {}:{} ]连接成功", |
| 411 | 406 | zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); |
| ... | ... | @@ -420,7 +415,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 420 | 415 | @Override |
| 421 | 416 | public void resetOnlineServerItem(MediaServerItem serverItem) { |
| 422 | 417 | // 更新缓存 |
| 423 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | |
| 418 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | |
| 424 | 419 | // 使用zset的分数作为当前并发量, 默认值设置为0 |
| 425 | 420 | if (redisUtil.zScore(key, serverItem.getId()) == null) { // 不存在则设置默认值 已存在则重置 |
| 426 | 421 | redisUtil.zAdd(key, serverItem.getId(), 0L); |
| ... | ... | @@ -446,14 +441,14 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 446 | 441 | if (mediaServerId == null) { |
| 447 | 442 | return; |
| 448 | 443 | } |
| 449 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | |
| 444 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | |
| 450 | 445 | redisUtil.zIncrScore(key, mediaServerId, 1); |
| 451 | 446 | |
| 452 | 447 | } |
| 453 | 448 | |
| 454 | 449 | @Override |
| 455 | 450 | public void removeCount(String mediaServerId) { |
| 456 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | |
| 451 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | |
| 457 | 452 | redisUtil.zIncrScore(key, mediaServerId, - 1); |
| 458 | 453 | } |
| 459 | 454 | |
| ... | ... | @@ -463,7 +458,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 463 | 458 | */ |
| 464 | 459 | @Override |
| 465 | 460 | public MediaServerItem getMediaServerForMinimumLoad() { |
| 466 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | |
| 461 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | |
| 467 | 462 | |
| 468 | 463 | if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) { |
| 469 | 464 | logger.info("获取负载最低的节点时无在线节点"); |
| ... | ... | @@ -617,8 +612,8 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 617 | 612 | |
| 618 | 613 | @Override |
| 619 | 614 | public void delete(String id) { |
| 620 | - redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(), id); | |
| 621 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + id; | |
| 615 | + redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id); | |
| 616 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id; | |
| 622 | 617 | redisUtil.del(key); |
| 623 | 618 | } |
| 624 | 619 | @Override |
| ... | ... | @@ -636,7 +631,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 636 | 631 | logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息"); |
| 637 | 632 | return; |
| 638 | 633 | } |
| 639 | - String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + mediaServerId; | |
| 634 | + String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + mediaServerId; | |
| 640 | 635 | int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2; |
| 641 | 636 | redisUtil.set(key, data, hookAliveInterval); |
| 642 | 637 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
| ... | ... | @@ -6,11 +6,10 @@ import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | 7 | import com.genersoft.iot.vmp.conf.MediaConfig; |
| 8 | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 9 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | |
| 10 | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 11 | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 12 | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 14 | 13 | import com.genersoft.iot.vmp.service.IMediaService; |
| 15 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 15 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -22,7 +21,7 @@ public class MediaServiceImpl implements IMediaService { |
| 22 | 21 | private IRedisCatchStorage redisCatchStorage; |
| 23 | 22 | |
| 24 | 23 | @Autowired |
| 25 | - private IVideoManagerStorager storager; | |
| 24 | + private IVideoManagerStorage storager; | |
| 26 | 25 | |
| 27 | 26 | @Autowired |
| 28 | 27 | private IMediaServerService mediaServerService; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 7 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| ... | ... | @@ -23,7 +23,7 @@ import com.genersoft.iot.vmp.service.bean.PlayBackCallback; |
| 23 | 23 | import com.genersoft.iot.vmp.service.bean.PlayBackResult; |
| 24 | 24 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 25 | 25 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 26 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 26 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 27 | 27 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 28 | 28 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 29 | 29 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| ... | ... | @@ -50,7 +50,7 @@ public class PlayServiceImpl implements IPlayService { |
| 50 | 50 | private final static Logger logger = LoggerFactory.getLogger(PlayServiceImpl.class); |
| 51 | 51 | |
| 52 | 52 | @Autowired |
| 53 | - private IVideoManagerStorager storager; | |
| 53 | + private IVideoManagerStorage storager; | |
| 54 | 54 | |
| 55 | 55 | @Autowired |
| 56 | 56 | private SIPCommander cmder; |
| ... | ... | @@ -83,7 +83,7 @@ public class PlayServiceImpl implements IPlayService { |
| 83 | 83 | private VideoStreamSessionManager streamSession; |
| 84 | 84 | |
| 85 | 85 | @Autowired |
| 86 | - private UserSetup userSetup; | |
| 86 | + private UserSetting userSetting; | |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | |
| ... | ... | @@ -99,7 +99,7 @@ public class PlayServiceImpl implements IPlayService { |
| 99 | 99 | String uuid = UUID.randomUUID().toString(); |
| 100 | 100 | msg.setId(uuid); |
| 101 | 101 | playResult.setUuid(uuid); |
| 102 | - DeferredResult<ResponseEntity<String>> result = new DeferredResult<>(userSetup.getPlayTimeout()); | |
| 102 | + DeferredResult<ResponseEntity<String>> result = new DeferredResult<>(userSetting.getPlayTimeout()); | |
| 103 | 103 | playResult.setResult(result); |
| 104 | 104 | // 录像查询以channelId作为deviceId查询 |
| 105 | 105 | resultHolder.put(key, uuid, result); |
| ... | ... | @@ -255,7 +255,7 @@ public class PlayServiceImpl implements IPlayService { |
| 255 | 255 | streamSession.remove(device.getDeviceId(), channelId, finalSsrcInfo.getStream()); |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | - }, userSetup.getPlayTimeout()); | |
| 258 | + }, userSetting.getPlayTimeout()); | |
| 259 | 259 | |
| 260 | 260 | cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> { |
| 261 | 261 | logger.info("收到订阅消息: " + response.toJSONString()); |
| ... | ... | @@ -374,7 +374,7 @@ public class PlayServiceImpl implements IPlayService { |
| 374 | 374 | // 回复之前所有的点播请求 |
| 375 | 375 | playBackCallback.call(playBackResult); |
| 376 | 376 | } |
| 377 | - }, userSetup.getPlayTimeout()); | |
| 377 | + }, userSetting.getPlayTimeout()); | |
| 378 | 378 | cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack, |
| 379 | 379 | (InviteStreamInfo inviteStreamInfo) -> { |
| 380 | 380 | logger.info("收到订阅消息: " + inviteStreamInfo.getResponse().toJSONString()); |
| ... | ... | @@ -461,7 +461,7 @@ public class PlayServiceImpl implements IPlayService { |
| 461 | 461 | // 回复之前所有的点播请求 |
| 462 | 462 | hookCallBack.call(downloadResult); |
| 463 | 463 | } |
| 464 | - }, userSetup.getPlayTimeout()); | |
| 464 | + }, userSetting.getPlayTimeout()); | |
| 465 | 465 | cmder.downloadStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, downloadSpeed, infoCallBack, |
| 466 | 466 | inviteStreamInfo -> { |
| 467 | 467 | logger.info("收到订阅消息: " + inviteStreamInfo.getResponse().toJSONString()); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisGPSMsgListener.java
| ... | ... | @@ -20,7 +20,7 @@ public class RedisGPSMsgListener implements MessageListener { |
| 20 | 20 | |
| 21 | 21 | @Override |
| 22 | 22 | public void onMessage(Message message, byte[] bytes) { |
| 23 | - logger.debug("收到来自REDIS的GPS通知: {}", new String(message.getBody())); | |
| 23 | + logger.info("收到来自REDIS的GPS通知: {}", new String(message.getBody())); | |
| 24 | 24 | GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); |
| 25 | 25 | redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); |
| 26 | 26 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| ... | ... | @@ -3,23 +3,20 @@ package com.genersoft.iot.vmp.service.impl; |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | 5 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 6 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 7 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | |
| 6 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 8 | 7 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 9 | 8 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 10 | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 11 | 10 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 12 | 11 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 13 | -import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | |
| 14 | 12 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 15 | 13 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 16 | 14 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 17 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | |
| 18 | 15 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 19 | 16 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 20 | 17 | import com.genersoft.iot.vmp.service.IMediaService; |
| 21 | 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 22 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 19 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 23 | 20 | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| 24 | 21 | import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; |
| 25 | 22 | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| ... | ... | @@ -44,7 +41,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { |
| 44 | 41 | private final static Logger logger = LoggerFactory.getLogger(StreamProxyServiceImpl.class); |
| 45 | 42 | |
| 46 | 43 | @Autowired |
| 47 | - private IVideoManagerStorager videoManagerStorager; | |
| 44 | + private IVideoManagerStorage videoManagerStorager; | |
| 48 | 45 | |
| 49 | 46 | @Autowired |
| 50 | 47 | private IMediaService mediaService; |
| ... | ... | @@ -59,10 +56,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService { |
| 59 | 56 | private IRedisCatchStorage redisCatchStorage; |
| 60 | 57 | |
| 61 | 58 | @Autowired |
| 62 | - private IVideoManagerStorager storager; | |
| 59 | + private IVideoManagerStorage storager; | |
| 63 | 60 | |
| 64 | 61 | @Autowired |
| 65 | - private UserSetup userSetup; | |
| 62 | + private UserSetting userSetting; | |
| 66 | 63 | |
| 67 | 64 | @Autowired |
| 68 | 65 | private SipConfig sipConfig; |
| ... | ... | @@ -321,7 +318,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { |
| 321 | 318 | if (mediaItems.size() > 0) { |
| 322 | 319 | for (MediaItem mediaItem : mediaItems) { |
| 323 | 320 | JSONObject jsonObject = new JSONObject(); |
| 324 | - jsonObject.put("serverId", userSetup.getServerId()); | |
| 321 | + jsonObject.put("serverId", userSetting.getServerId()); | |
| 325 | 322 | jsonObject.put("app", mediaItem.getApp()); |
| 326 | 323 | jsonObject.put("stream", mediaItem.getStream()); |
| 327 | 324 | jsonObject.put("register", false); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| ... | ... | @@ -4,21 +4,17 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.alibaba.fastjson.TypeReference; |
| 7 | -import com.genersoft.iot.vmp.common.StreamInfo; | |
| 8 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 7 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 9 | 8 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 10 | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 11 | 10 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 12 | -import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | |
| 13 | 11 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 14 | -import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | |
| 15 | 12 | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| 16 | 13 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 17 | 14 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 18 | 15 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 19 | 16 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 20 | 17 | import com.genersoft.iot.vmp.storager.dao.*; |
| 21 | -import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; | |
| 22 | 18 | import com.github.pagehelper.PageHelper; |
| 23 | 19 | import com.github.pagehelper.PageInfo; |
| 24 | 20 | import org.slf4j.Logger; |
| ... | ... | @@ -63,7 +59,7 @@ public class StreamPushServiceImpl implements IStreamPushService { |
| 63 | 59 | private IRedisCatchStorage redisCatchStorage; |
| 64 | 60 | |
| 65 | 61 | @Autowired |
| 66 | - private UserSetup userSetup; | |
| 62 | + private UserSetting userSetting; | |
| 67 | 63 | |
| 68 | 64 | @Autowired |
| 69 | 65 | private IMediaServerService mediaServerService; |
| ... | ... | @@ -263,7 +259,7 @@ public class StreamPushServiceImpl implements IStreamPushService { |
| 263 | 259 | String type = "PUSH"; |
| 264 | 260 | for (MediaItem offlineMediaItem : offlineMediaItemList) { |
| 265 | 261 | JSONObject jsonObject = new JSONObject(); |
| 266 | - jsonObject.put("serverId", userSetup.getServerId()); | |
| 262 | + jsonObject.put("serverId", userSetting.getServerId()); | |
| 267 | 263 | jsonObject.put("app", offlineMediaItem.getApp()); |
| 268 | 264 | jsonObject.put("stream", offlineMediaItem.getStream()); |
| 269 | 265 | jsonObject.put("register", false); |
| ... | ... | @@ -293,7 +289,7 @@ public class StreamPushServiceImpl implements IStreamPushService { |
| 293 | 289 | // 移除redis内流的信息 |
| 294 | 290 | redisCatchStorage.removeStream(mediaServerId, type, mediaItem.getApp(), mediaItem.getStream()); |
| 295 | 291 | JSONObject jsonObject = new JSONObject(); |
| 296 | - jsonObject.put("serverId", userSetup.getServerId()); | |
| 292 | + jsonObject.put("serverId", userSetting.getServerId()); | |
| 297 | 293 | jsonObject.put("app", mediaItem.getApp()); |
| 298 | 294 | jsonObject.put("stream", mediaItem.getStream()); |
| 299 | 295 | jsonObject.put("register", false); | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
| ... | ... | @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 7 | 7 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 8 | 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 9 | 9 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 10 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | |
| 10 | 11 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 11 | 12 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| 12 | 13 | |
| ... | ... | @@ -212,4 +213,7 @@ public interface IRedisCatchStorage { |
| 212 | 213 | |
| 213 | 214 | void addNetInfo(Map<String, String> networkInterfaces); |
| 214 | 215 | |
| 216 | + void sendMobilePositionMsg(JSONObject jsonObject); | |
| 217 | + | |
| 218 | + void sendStreamPushRequestedMsg(MessageForPushChannel messageForPushChannel); | |
| 215 | 219 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java renamed to src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
| 1 | -package com.genersoft.iot.vmp.storager; | |
| 2 | - | |
| 3 | -import com.genersoft.iot.vmp.gb28181.bean.*; | |
| 4 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | |
| 5 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | |
| 6 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | |
| 7 | -import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | |
| 8 | -import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | |
| 9 | -import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; | |
| 10 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 11 | -import com.github.pagehelper.PageInfo; | |
| 12 | - | |
| 13 | -import java.util.List; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * @description:视频设备数据存储接口 | |
| 17 | - * @author: swwheihei | |
| 18 | - * @date: 2020年5月6日 下午2:14:31 | |
| 19 | - */ | |
| 20 | -@SuppressWarnings("rawtypes") | |
| 21 | -public interface IVideoManagerStorager { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 根据设备ID判断设备是否存在 | |
| 25 | - * | |
| 26 | - * @param deviceId 设备ID | |
| 27 | - * @return true:存在 false:不存在 | |
| 28 | - */ | |
| 29 | - public boolean exists(String deviceId); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 视频设备创建 | |
| 33 | - * | |
| 34 | - * @param device 设备对象 | |
| 35 | - * @return true:创建成功 false:创建失败 | |
| 36 | - */ | |
| 37 | - public boolean create(Device device); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 视频设备更新 | |
| 41 | - * | |
| 42 | - * @param device 设备对象 | |
| 43 | - * @return true:创建成功 false:创建失败 | |
| 44 | - */ | |
| 45 | - public boolean updateDevice(Device device); | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 添加设备通道 | |
| 49 | - * | |
| 50 | - * @param deviceId 设备id | |
| 51 | - * @param channel 通道 | |
| 52 | - */ | |
| 53 | - public void updateChannel(String deviceId, DeviceChannel channel); | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * 批量添加设备通道 | |
| 57 | - * | |
| 58 | - * @param deviceId 设备id | |
| 59 | - * @param channels 多个通道 | |
| 60 | - */ | |
| 61 | - public int updateChannels(String deviceId, List<DeviceChannel> channels); | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * 开始播放 | |
| 65 | - * @param deviceId 设备id | |
| 66 | - * @param channelId 通道ID | |
| 67 | - * @param streamId 流地址 | |
| 68 | - */ | |
| 69 | - public void startPlay(String deviceId, String channelId, String streamId); | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 停止播放 | |
| 73 | - * @param deviceId 设备id | |
| 74 | - * @param channelId 通道ID | |
| 75 | - */ | |
| 76 | - public void stopPlay(String deviceId, String channelId); | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 获取设备 | |
| 80 | - * | |
| 81 | - * @param deviceId 设备ID | |
| 82 | - * @return DShadow 设备对象 | |
| 83 | - */ | |
| 84 | - public Device queryVideoDevice(String deviceId); | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * 获取某个设备的通道列表 | |
| 88 | - * | |
| 89 | - * @param deviceId 设备ID | |
| 90 | - * @param page 分页 当前页 | |
| 91 | - * @param count 每页数量 | |
| 92 | - * @return | |
| 93 | - */ | |
| 94 | - public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count); | |
| 95 | - | |
| 96 | - public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); | |
| 97 | - | |
| 98 | - /** | |
| 99 | - * 获取某个设备的通道树 | |
| 100 | - * @param deviceId 设备ID | |
| 101 | - * @return | |
| 102 | - */ | |
| 103 | - List<DeviceChannelTree> tree(String deviceId); | |
| 104 | - | |
| 105 | - /** | |
| 106 | - * 获取某个设备的通道列表 | |
| 107 | - * | |
| 108 | - * @param deviceId 设备ID | |
| 109 | - * @return | |
| 110 | - */ | |
| 111 | - public List<DeviceChannel> queryChannelsByDeviceId(String deviceId); | |
| 112 | - public List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); | |
| 113 | - | |
| 114 | - /** | |
| 115 | - * 获取某个设备的通道 | |
| 116 | - * @param deviceId 设备ID | |
| 117 | - * @param channelId 通道ID | |
| 118 | - */ | |
| 119 | - public DeviceChannel queryChannel(String deviceId, String channelId); | |
| 120 | - | |
| 121 | - /** | |
| 122 | - * 删除通道 | |
| 123 | - * @param deviceId 设备ID | |
| 124 | - * @param channelId 通道ID | |
| 125 | - */ | |
| 126 | - public int delChannel(String deviceId, String channelId); | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * 获取多个设备 | |
| 130 | - * @param page 当前页数 | |
| 131 | - * @param count 每页数量 | |
| 132 | - * @return List<Device> 设备对象数组 | |
| 133 | - */ | |
| 134 | - public PageInfo<Device> queryVideoDeviceList(int page, int count); | |
| 135 | - | |
| 136 | - /** | |
| 137 | - * 获取多个设备 | |
| 138 | - * | |
| 139 | - * @return List<Device> 设备对象数组 | |
| 140 | - */ | |
| 141 | - public List<Device> queryVideoDeviceList(); | |
| 142 | - | |
| 143 | - /** | |
| 144 | - * 删除设备 | |
| 145 | - * | |
| 146 | - * @param deviceId 设备ID | |
| 147 | - * @return true:删除成功 false:删除失败 | |
| 148 | - */ | |
| 149 | - public boolean delete(String deviceId); | |
| 150 | - | |
| 151 | - /** | |
| 152 | - * 更新设备在线 | |
| 153 | - * | |
| 154 | - * @param deviceId 设备ID | |
| 155 | - * @return true:更新成功 false:更新失败 | |
| 156 | - */ | |
| 157 | - public boolean online(String deviceId); | |
| 158 | - | |
| 159 | - /** | |
| 160 | - * 更新设备离线 | |
| 161 | - * | |
| 162 | - * @param deviceId 设备ID | |
| 163 | - * @return true:更新成功 false:更新失败 | |
| 164 | - */ | |
| 165 | - public boolean outline(String deviceId); | |
| 166 | - | |
| 167 | - /** | |
| 168 | - * 更新所有设备离线 | |
| 169 | - * | |
| 170 | - * @return true:更新成功 false:更新失败 | |
| 171 | - */ | |
| 172 | - public boolean outlineForAll(); | |
| 173 | - | |
| 174 | - | |
| 175 | - /** | |
| 176 | - * 查询子设备 | |
| 177 | - * | |
| 178 | - * @param deviceId | |
| 179 | - * @param channelId | |
| 180 | - * @param page | |
| 181 | - * @param count | |
| 182 | - * @return | |
| 183 | - */ | |
| 184 | - PageInfo querySubChannels(String deviceId, String channelId, String query, Boolean hasSubChannel, String online, int page, int count); | |
| 185 | - | |
| 186 | - | |
| 187 | - /** | |
| 188 | - * 清空通道 | |
| 189 | - * @param deviceId | |
| 190 | - */ | |
| 191 | - void cleanChannelsForDevice(String deviceId); | |
| 192 | - | |
| 193 | - | |
| 194 | - /** | |
| 195 | - * 更新上级平台 | |
| 196 | - * @param parentPlatform | |
| 197 | - */ | |
| 198 | - boolean updateParentPlatform(ParentPlatform parentPlatform); | |
| 199 | - | |
| 200 | - | |
| 201 | - /** | |
| 202 | - * 添加上级平台 | |
| 203 | - * @param parentPlatform | |
| 204 | - */ | |
| 205 | - boolean addParentPlatform(ParentPlatform parentPlatform); | |
| 206 | - | |
| 207 | - /** | |
| 208 | - * 删除上级平台 | |
| 209 | - * @param parentPlatform | |
| 210 | - */ | |
| 211 | - boolean deleteParentPlatform(ParentPlatform parentPlatform); | |
| 212 | - | |
| 213 | - | |
| 214 | - /** | |
| 215 | - * 分页获取上级平台 | |
| 216 | - * @param page | |
| 217 | - * @param count | |
| 218 | - * @return | |
| 219 | - */ | |
| 220 | - PageInfo<ParentPlatform> queryParentPlatformList(int page, int count); | |
| 221 | - | |
| 222 | - /** | |
| 223 | - * 获取所有已启用的平台 | |
| 224 | - * @return | |
| 225 | - */ | |
| 226 | - List<ParentPlatform> queryEnableParentPlatformList(boolean enable); | |
| 227 | - | |
| 228 | - /** | |
| 229 | - * 获取上级平台 | |
| 230 | - * @param platformGbId | |
| 231 | - * @return | |
| 232 | - */ | |
| 233 | - ParentPlatform queryParentPlatByServerGBId(String platformGbId); | |
| 234 | - | |
| 235 | - /** | |
| 236 | - * 所有平台离线 | |
| 237 | - */ | |
| 238 | - void outlineForAllParentPlatform(); | |
| 239 | - | |
| 240 | - /** | |
| 241 | - * 查询通道信息,不区分设备(已关联平台或全部) | |
| 242 | - */ | |
| 243 | - PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId); | |
| 244 | - | |
| 245 | - /** | |
| 246 | - * 查询设备的通道信息 | |
| 247 | - */ | |
| 248 | - List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId); | |
| 249 | - | |
| 250 | - | |
| 251 | - /** | |
| 252 | - * 更新上级平台的通道信息 | |
| 253 | - * @param platformId | |
| 254 | - * @param channelReduces | |
| 255 | - * @return | |
| 256 | - */ | |
| 257 | - int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); | |
| 258 | - | |
| 259 | - /** | |
| 260 | - * 移除上级平台的通道信息 | |
| 261 | - * @param platformId | |
| 262 | - * @param channelReduces | |
| 263 | - * @return | |
| 264 | - */ | |
| 265 | - int delChannelForGB(String platformId, List<ChannelReduce> channelReduces); | |
| 266 | - | |
| 267 | - | |
| 268 | - DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); | |
| 269 | - | |
| 270 | - List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | |
| 271 | - List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId); | |
| 272 | - | |
| 273 | - Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); | |
| 274 | - | |
| 275 | - | |
| 276 | - /** | |
| 277 | - * 添加Mobile Position设备移动位置 | |
| 278 | - * @param mobilePosition | |
| 279 | - * @return | |
| 280 | - */ | |
| 281 | - public boolean insertMobilePosition(MobilePosition mobilePosition); | |
| 282 | - | |
| 283 | - /** | |
| 284 | - * 查询移动位置轨迹 | |
| 285 | - * @param deviceId | |
| 286 | - * @param startTime | |
| 287 | - * @param endTime | |
| 288 | - */ | |
| 289 | - public List<MobilePosition> queryMobilePositions(String deviceId, String startTime, String endTime); | |
| 290 | - | |
| 291 | - /** | |
| 292 | - * 查询最新移动位置 | |
| 293 | - * @param deviceId | |
| 294 | - */ | |
| 295 | - public MobilePosition queryLatestPosition(String deviceId); | |
| 296 | - | |
| 297 | - /** | |
| 298 | - * 删除指定设备的所有移动位置 | |
| 299 | - * @param deviceId | |
| 300 | - */ | |
| 301 | - public int clearMobilePositionsByDeviceId(String deviceId); | |
| 302 | - | |
| 303 | - /** | |
| 304 | - * 新增代理流 | |
| 305 | - * @param streamProxyDto | |
| 306 | - * @return | |
| 307 | - */ | |
| 308 | - public boolean addStreamProxy(StreamProxyItem streamProxyDto); | |
| 309 | - | |
| 310 | - /** | |
| 311 | - * 更新代理流 | |
| 312 | - * @param streamProxyDto | |
| 313 | - * @return | |
| 314 | - */ | |
| 315 | - public boolean updateStreamProxy(StreamProxyItem streamProxyDto); | |
| 316 | - | |
| 317 | - /** | |
| 318 | - * 移除代理流 | |
| 319 | - * @param app | |
| 320 | - * @param stream | |
| 321 | - * @return | |
| 322 | - */ | |
| 323 | - public int deleteStreamProxy(String app, String stream); | |
| 324 | - | |
| 325 | - /** | |
| 326 | - * 按照是否启用获取代理流 | |
| 327 | - * @param enable | |
| 328 | - * @return | |
| 329 | - */ | |
| 330 | - public List<StreamProxyItem> getStreamProxyListForEnable(boolean enable); | |
| 331 | - | |
| 332 | - /** | |
| 333 | - * 按照是app和stream获取代理流 | |
| 334 | - * @param app | |
| 335 | - * @param stream | |
| 336 | - * @return | |
| 337 | - */ | |
| 338 | - public StreamProxyItem queryStreamProxy(String app, String stream); | |
| 339 | - | |
| 340 | - /** | |
| 341 | - * 获取代理流 | |
| 342 | - * @param page | |
| 343 | - * @param count | |
| 344 | - * @return | |
| 345 | - */ | |
| 346 | - PageInfo<StreamProxyItem> queryStreamProxyList(Integer page, Integer count); | |
| 347 | - | |
| 348 | - /** | |
| 349 | - * 根据国标ID获取平台关联的直播流 | |
| 350 | - * @param platformId | |
| 351 | - * @param channelId | |
| 352 | - * @return | |
| 353 | - */ | |
| 354 | - GbStream queryStreamInParentPlatform(String platformId, String channelId); | |
| 355 | - | |
| 356 | - /** | |
| 357 | - * 获取平台关联的直播流 | |
| 358 | - * @param platformId | |
| 359 | - * @return | |
| 360 | - */ | |
| 361 | - List<GbStream> queryGbStreamListInPlatform(String platformId); | |
| 362 | - | |
| 363 | - /** | |
| 364 | - * 批量更新推流列表 | |
| 365 | - * @param streamPushItems | |
| 366 | - */ | |
| 367 | - void updateMediaList(List<StreamPushItem> streamPushItems); | |
| 368 | - | |
| 369 | - /** | |
| 370 | - * 更新单个推流 | |
| 371 | - * @param streamPushItem | |
| 372 | - */ | |
| 373 | - void updateMedia(StreamPushItem streamPushItem); | |
| 374 | - | |
| 375 | - /** | |
| 376 | - * 移除单个推流 | |
| 377 | - * @param app | |
| 378 | - * @param stream | |
| 379 | - */ | |
| 380 | - int removeMedia(String app, String stream); | |
| 381 | - | |
| 382 | - | |
| 383 | - /** | |
| 384 | - * 清空推流列表 | |
| 385 | - */ | |
| 386 | - void clearMediaList(); | |
| 387 | - | |
| 388 | - /** | |
| 389 | - * 设置流离线 | |
| 390 | - * @param app | |
| 391 | - * @param streamId | |
| 392 | - */ | |
| 393 | - int mediaOutline(String app, String streamId); | |
| 394 | - | |
| 395 | - /** | |
| 396 | - * 设置平台在线/离线 | |
| 397 | - * @param online | |
| 398 | - */ | |
| 399 | - void updateParentPlatformStatus(String platformGbID, boolean online); | |
| 400 | - | |
| 401 | - /** | |
| 402 | - * 根据媒体ID获取启用/不启用的代理列表 | |
| 403 | - * @param id 媒体ID | |
| 404 | - * @param enable 启用/不启用 | |
| 405 | - * @param status 状态 | |
| 406 | - * @return | |
| 407 | - */ | |
| 408 | - List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable, boolean status); | |
| 409 | - | |
| 410 | - /** | |
| 411 | - * 根据通道ID获取其所在设备 | |
| 412 | - * @param channelId 通道ID | |
| 413 | - * @return | |
| 414 | - */ | |
| 415 | - Device queryVideoDeviceByChannelId(String channelId); | |
| 416 | - | |
| 417 | - /** | |
| 418 | - * 通道上线 | |
| 419 | - * @param channelId 通道ID | |
| 420 | - */ | |
| 421 | - void deviceChannelOnline(String deviceId, String channelId); | |
| 422 | - | |
| 423 | - /** | |
| 424 | - * 通道离线 | |
| 425 | - * @param channelId 通道ID | |
| 426 | - */ | |
| 427 | - void deviceChannelOffline(String deviceId, String channelId); | |
| 428 | - | |
| 429 | - /** | |
| 430 | - * 通过app与stream获取StreamProxy | |
| 431 | - * @param app | |
| 432 | - * @param streamId | |
| 433 | - * @return | |
| 434 | - */ | |
| 435 | - StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId); | |
| 436 | - | |
| 437 | - /** | |
| 438 | - * catlog查询结束后完全重写通道信息 | |
| 439 | - * @param deviceId | |
| 440 | - * @param deviceChannelList | |
| 441 | - */ | |
| 442 | - boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList); | |
| 443 | - | |
| 444 | - /** | |
| 445 | - * 获取目录信息 | |
| 446 | - * @param platformId | |
| 447 | - * @param parentId | |
| 448 | - * @return | |
| 449 | - */ | |
| 450 | - List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId); | |
| 451 | - | |
| 452 | - int addCatalog(PlatformCatalog platformCatalog); | |
| 453 | - | |
| 454 | - PlatformCatalog getCatalog(String id); | |
| 455 | - | |
| 456 | - int delCatalog(String id); | |
| 457 | - | |
| 458 | - int updateCatalog(PlatformCatalog platformCatalog); | |
| 459 | - | |
| 460 | - int setDefaultCatalog(String platformId, String catalogId); | |
| 461 | - | |
| 462 | - List<PlatformCatalog> queryCatalogInPlatform(String serverGBId); | |
| 463 | - | |
| 464 | - int delRelation(PlatformCatalog platformCatalog); | |
| 465 | - | |
| 466 | - int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo); | |
| 467 | - | |
| 468 | - List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); | |
| 469 | - | |
| 470 | - List<ParentPlatform> queryPlatFormListForStreamWithGBId(String app, String stream, List<String> platforms); | |
| 471 | - | |
| 472 | - GbStream getGbStream(String app, String streamId); | |
| 473 | - | |
| 474 | - void delCatalogByPlatformId(String serverGBId); | |
| 475 | - | |
| 476 | - void delRelationByPlatformId(String serverGBId); | |
| 477 | - | |
| 478 | - PlatformCatalog queryDefaultCatalogInPlatform(String platformId); | |
| 479 | - | |
| 480 | - List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); | |
| 481 | -} | |
| 1 | +package com.genersoft.iot.vmp.storager; | |
| 2 | + | |
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.*; | |
| 4 | +import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | |
| 5 | +import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | |
| 6 | +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | |
| 7 | +import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | |
| 8 | +import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; | |
| 9 | +import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | |
| 10 | +import com.github.pagehelper.PageInfo; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * @description:视频设备数据存储接口 | |
| 16 | + * @author: swwheihei | |
| 17 | + * @date: 2020年5月6日 下午2:14:31 | |
| 18 | + */ | |
| 19 | +@SuppressWarnings("rawtypes") | |
| 20 | +public interface IVideoManagerStorage { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 根据设备ID判断设备是否存在 | |
| 24 | + * | |
| 25 | + * @param deviceId 设备ID | |
| 26 | + * @return true:存在 false:不存在 | |
| 27 | + */ | |
| 28 | + public boolean exists(String deviceId); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 视频设备创建 | |
| 32 | + * | |
| 33 | + * @param device 设备对象 | |
| 34 | + * @return true:创建成功 false:创建失败 | |
| 35 | + */ | |
| 36 | + public boolean create(Device device); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 视频设备更新 | |
| 40 | + * | |
| 41 | + * @param device 设备对象 | |
| 42 | + * @return true:创建成功 false:创建失败 | |
| 43 | + */ | |
| 44 | + public boolean updateDevice(Device device); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 添加设备通道 | |
| 48 | + * | |
| 49 | + * @param deviceId 设备id | |
| 50 | + * @param channel 通道 | |
| 51 | + */ | |
| 52 | + public void updateChannel(String deviceId, DeviceChannel channel); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 批量添加设备通道 | |
| 56 | + * | |
| 57 | + * @param deviceId 设备id | |
| 58 | + * @param channels 多个通道 | |
| 59 | + */ | |
| 60 | + public int updateChannels(String deviceId, List<DeviceChannel> channels); | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 开始播放 | |
| 64 | + * @param deviceId 设备id | |
| 65 | + * @param channelId 通道ID | |
| 66 | + * @param streamId 流地址 | |
| 67 | + */ | |
| 68 | + public void startPlay(String deviceId, String channelId, String streamId); | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 停止播放 | |
| 72 | + * @param deviceId 设备id | |
| 73 | + * @param channelId 通道ID | |
| 74 | + */ | |
| 75 | + public void stopPlay(String deviceId, String channelId); | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 获取设备 | |
| 79 | + * | |
| 80 | + * @param deviceId 设备ID | |
| 81 | + * @return DShadow 设备对象 | |
| 82 | + */ | |
| 83 | + public Device queryVideoDevice(String deviceId); | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 获取某个设备的通道列表 | |
| 87 | + * | |
| 88 | + * @param deviceId 设备ID | |
| 89 | + * @param page 分页 当前页 | |
| 90 | + * @param count 每页数量 | |
| 91 | + * @return | |
| 92 | + */ | |
| 93 | + public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count); | |
| 94 | + | |
| 95 | + public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * 获取某个设备的通道树 | |
| 99 | + * @param deviceId 设备ID | |
| 100 | + * @return | |
| 101 | + */ | |
| 102 | + List<DeviceChannelTree> tree(String deviceId); | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * 获取某个设备的通道列表 | |
| 106 | + * | |
| 107 | + * @param deviceId 设备ID | |
| 108 | + * @return | |
| 109 | + */ | |
| 110 | + public List<DeviceChannel> queryChannelsByDeviceId(String deviceId); | |
| 111 | + public List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * 获取某个设备的通道 | |
| 115 | + * @param deviceId 设备ID | |
| 116 | + * @param channelId 通道ID | |
| 117 | + */ | |
| 118 | + public DeviceChannel queryChannel(String deviceId, String channelId); | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * 删除通道 | |
| 122 | + * @param deviceId 设备ID | |
| 123 | + * @param channelId 通道ID | |
| 124 | + */ | |
| 125 | + public int delChannel(String deviceId, String channelId); | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * 获取多个设备 | |
| 129 | + * @param page 当前页数 | |
| 130 | + * @param count 每页数量 | |
| 131 | + * @return List<Device> 设备对象数组 | |
| 132 | + */ | |
| 133 | + public PageInfo<Device> queryVideoDeviceList(int page, int count); | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * 获取多个设备 | |
| 137 | + * | |
| 138 | + * @return List<Device> 设备对象数组 | |
| 139 | + */ | |
| 140 | + public List<Device> queryVideoDeviceList(); | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * 删除设备 | |
| 144 | + * | |
| 145 | + * @param deviceId 设备ID | |
| 146 | + * @return true:删除成功 false:删除失败 | |
| 147 | + */ | |
| 148 | + public boolean delete(String deviceId); | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * 更新设备在线 | |
| 152 | + * | |
| 153 | + * @param deviceId 设备ID | |
| 154 | + * @return true:更新成功 false:更新失败 | |
| 155 | + */ | |
| 156 | + public boolean online(String deviceId); | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * 更新设备离线 | |
| 160 | + * | |
| 161 | + * @param deviceId 设备ID | |
| 162 | + * @return true:更新成功 false:更新失败 | |
| 163 | + */ | |
| 164 | + public boolean outline(String deviceId); | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * 更新所有设备离线 | |
| 168 | + * | |
| 169 | + * @return true:更新成功 false:更新失败 | |
| 170 | + */ | |
| 171 | + public boolean outlineForAll(); | |
| 172 | + | |
| 173 | + | |
| 174 | + /** | |
| 175 | + * 查询子设备 | |
| 176 | + * | |
| 177 | + * @param deviceId | |
| 178 | + * @param channelId | |
| 179 | + * @param page | |
| 180 | + * @param count | |
| 181 | + * @return | |
| 182 | + */ | |
| 183 | + PageInfo querySubChannels(String deviceId, String channelId, String query, Boolean hasSubChannel, String online, int page, int count); | |
| 184 | + | |
| 185 | + | |
| 186 | + /** | |
| 187 | + * 清空通道 | |
| 188 | + * @param deviceId | |
| 189 | + */ | |
| 190 | + void cleanChannelsForDevice(String deviceId); | |
| 191 | + | |
| 192 | + | |
| 193 | + /** | |
| 194 | + * 更新上级平台 | |
| 195 | + * @param parentPlatform | |
| 196 | + */ | |
| 197 | + boolean updateParentPlatform(ParentPlatform parentPlatform); | |
| 198 | + | |
| 199 | + | |
| 200 | + /** | |
| 201 | + * 添加上级平台 | |
| 202 | + * @param parentPlatform | |
| 203 | + */ | |
| 204 | + boolean addParentPlatform(ParentPlatform parentPlatform); | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * 删除上级平台 | |
| 208 | + * @param parentPlatform | |
| 209 | + */ | |
| 210 | + boolean deleteParentPlatform(ParentPlatform parentPlatform); | |
| 211 | + | |
| 212 | + | |
| 213 | + /** | |
| 214 | + * 分页获取上级平台 | |
| 215 | + * @param page | |
| 216 | + * @param count | |
| 217 | + * @return | |
| 218 | + */ | |
| 219 | + PageInfo<ParentPlatform> queryParentPlatformList(int page, int count); | |
| 220 | + | |
| 221 | + /** | |
| 222 | + * 获取所有已启用的平台 | |
| 223 | + * @return | |
| 224 | + */ | |
| 225 | + List<ParentPlatform> queryEnableParentPlatformList(boolean enable); | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * 获取上级平台 | |
| 229 | + * @param platformGbId | |
| 230 | + * @return | |
| 231 | + */ | |
| 232 | + ParentPlatform queryParentPlatByServerGBId(String platformGbId); | |
| 233 | + | |
| 234 | + /** | |
| 235 | + * 所有平台离线 | |
| 236 | + */ | |
| 237 | + void outlineForAllParentPlatform(); | |
| 238 | + | |
| 239 | + /** | |
| 240 | + * 查询通道信息,不区分设备(已关联平台或全部) | |
| 241 | + */ | |
| 242 | + PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId); | |
| 243 | + | |
| 244 | + /** | |
| 245 | + * 查询设备的通道信息 | |
| 246 | + */ | |
| 247 | + List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId); | |
| 248 | + | |
| 249 | + | |
| 250 | + /** | |
| 251 | + * 更新上级平台的通道信息 | |
| 252 | + * @param platformId | |
| 253 | + * @param channelReduces | |
| 254 | + * @return | |
| 255 | + */ | |
| 256 | + int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); | |
| 257 | + | |
| 258 | + /** | |
| 259 | + * 移除上级平台的通道信息 | |
| 260 | + * @param platformId | |
| 261 | + * @param channelReduces | |
| 262 | + * @return | |
| 263 | + */ | |
| 264 | + int delChannelForGB(String platformId, List<ChannelReduce> channelReduces); | |
| 265 | + | |
| 266 | + | |
| 267 | + DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); | |
| 268 | + | |
| 269 | + List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | |
| 270 | + List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId); | |
| 271 | + | |
| 272 | + Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); | |
| 273 | + | |
| 274 | + | |
| 275 | + /** | |
| 276 | + * 添加Mobile Position设备移动位置 | |
| 277 | + * @param mobilePosition | |
| 278 | + * @return | |
| 279 | + */ | |
| 280 | + public boolean insertMobilePosition(MobilePosition mobilePosition); | |
| 281 | + | |
| 282 | + /** | |
| 283 | + * 查询移动位置轨迹 | |
| 284 | + * @param deviceId | |
| 285 | + * @param startTime | |
| 286 | + * @param endTime | |
| 287 | + */ | |
| 288 | + public List<MobilePosition> queryMobilePositions(String deviceId, String startTime, String endTime); | |
| 289 | + | |
| 290 | + /** | |
| 291 | + * 查询最新移动位置 | |
| 292 | + * @param deviceId | |
| 293 | + */ | |
| 294 | + public MobilePosition queryLatestPosition(String deviceId); | |
| 295 | + | |
| 296 | + /** | |
| 297 | + * 删除指定设备的所有移动位置 | |
| 298 | + * @param deviceId | |
| 299 | + */ | |
| 300 | + public int clearMobilePositionsByDeviceId(String deviceId); | |
| 301 | + | |
| 302 | + /** | |
| 303 | + * 新增代理流 | |
| 304 | + * @param streamProxyDto | |
| 305 | + * @return | |
| 306 | + */ | |
| 307 | + public boolean addStreamProxy(StreamProxyItem streamProxyDto); | |
| 308 | + | |
| 309 | + /** | |
| 310 | + * 更新代理流 | |
| 311 | + * @param streamProxyDto | |
| 312 | + * @return | |
| 313 | + */ | |
| 314 | + public boolean updateStreamProxy(StreamProxyItem streamProxyDto); | |
| 315 | + | |
| 316 | + /** | |
| 317 | + * 移除代理流 | |
| 318 | + * @param app | |
| 319 | + * @param stream | |
| 320 | + * @return | |
| 321 | + */ | |
| 322 | + public int deleteStreamProxy(String app, String stream); | |
| 323 | + | |
| 324 | + /** | |
| 325 | + * 按照是否启用获取代理流 | |
| 326 | + * @param enable | |
| 327 | + * @return | |
| 328 | + */ | |
| 329 | + public List<StreamProxyItem> getStreamProxyListForEnable(boolean enable); | |
| 330 | + | |
| 331 | + /** | |
| 332 | + * 按照是app和stream获取代理流 | |
| 333 | + * @param app | |
| 334 | + * @param stream | |
| 335 | + * @return | |
| 336 | + */ | |
| 337 | + public StreamProxyItem queryStreamProxy(String app, String stream); | |
| 338 | + | |
| 339 | + /** | |
| 340 | + * 获取代理流 | |
| 341 | + * @param page | |
| 342 | + * @param count | |
| 343 | + * @return | |
| 344 | + */ | |
| 345 | + PageInfo<StreamProxyItem> queryStreamProxyList(Integer page, Integer count); | |
| 346 | + | |
| 347 | + /** | |
| 348 | + * 根据国标ID获取平台关联的直播流 | |
| 349 | + * @param platformId | |
| 350 | + * @param channelId | |
| 351 | + * @return | |
| 352 | + */ | |
| 353 | + GbStream queryStreamInParentPlatform(String platformId, String channelId); | |
| 354 | + | |
| 355 | + /** | |
| 356 | + * 获取平台关联的直播流 | |
| 357 | + * @param platformId | |
| 358 | + * @return | |
| 359 | + */ | |
| 360 | + List<GbStream> queryGbStreamListInPlatform(String platformId); | |
| 361 | + | |
| 362 | + /** | |
| 363 | + * 批量更新推流列表 | |
| 364 | + * @param streamPushItems | |
| 365 | + */ | |
| 366 | + void updateMediaList(List<StreamPushItem> streamPushItems); | |
| 367 | + | |
| 368 | + /** | |
| 369 | + * 更新单个推流 | |
| 370 | + * @param streamPushItem | |
| 371 | + */ | |
| 372 | + void updateMedia(StreamPushItem streamPushItem); | |
| 373 | + | |
| 374 | + /** | |
| 375 | + * 移除单个推流 | |
| 376 | + * @param app | |
| 377 | + * @param stream | |
| 378 | + */ | |
| 379 | + int removeMedia(String app, String stream); | |
| 380 | + | |
| 381 | + | |
| 382 | + /** | |
| 383 | + * 清空推流列表 | |
| 384 | + */ | |
| 385 | + void clearMediaList(); | |
| 386 | + | |
| 387 | + /** | |
| 388 | + * 设置流离线 | |
| 389 | + * @param app | |
| 390 | + * @param streamId | |
| 391 | + */ | |
| 392 | + int mediaOutline(String app, String streamId); | |
| 393 | + | |
| 394 | + /** | |
| 395 | + * 设置平台在线/离线 | |
| 396 | + * @param online | |
| 397 | + */ | |
| 398 | + void updateParentPlatformStatus(String platformGbID, boolean online); | |
| 399 | + | |
| 400 | + /** | |
| 401 | + * 根据媒体ID获取启用/不启用的代理列表 | |
| 402 | + * @param id 媒体ID | |
| 403 | + * @param enable 启用/不启用 | |
| 404 | + * @param status 状态 | |
| 405 | + * @return | |
| 406 | + */ | |
| 407 | + List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable, boolean status); | |
| 408 | + | |
| 409 | + /** | |
| 410 | + * 根据通道ID获取其所在设备 | |
| 411 | + * @param channelId 通道ID | |
| 412 | + * @return | |
| 413 | + */ | |
| 414 | + Device queryVideoDeviceByChannelId(String channelId); | |
| 415 | + | |
| 416 | + /** | |
| 417 | + * 通道上线 | |
| 418 | + * @param channelId 通道ID | |
| 419 | + */ | |
| 420 | + void deviceChannelOnline(String deviceId, String channelId); | |
| 421 | + | |
| 422 | + /** | |
| 423 | + * 通道离线 | |
| 424 | + * @param channelId 通道ID | |
| 425 | + */ | |
| 426 | + void deviceChannelOffline(String deviceId, String channelId); | |
| 427 | + | |
| 428 | + /** | |
| 429 | + * 通过app与stream获取StreamProxy | |
| 430 | + * @param app | |
| 431 | + * @param streamId | |
| 432 | + * @return | |
| 433 | + */ | |
| 434 | + StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId); | |
| 435 | + | |
| 436 | + /** | |
| 437 | + * catlog查询结束后完全重写通道信息 | |
| 438 | + * @param deviceId | |
| 439 | + * @param deviceChannelList | |
| 440 | + */ | |
| 441 | + boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList); | |
| 442 | + | |
| 443 | + /** | |
| 444 | + * 获取目录信息 | |
| 445 | + * @param platformId | |
| 446 | + * @param parentId | |
| 447 | + * @return | |
| 448 | + */ | |
| 449 | + List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId); | |
| 450 | + | |
| 451 | + int addCatalog(PlatformCatalog platformCatalog); | |
| 452 | + | |
| 453 | + PlatformCatalog getCatalog(String id); | |
| 454 | + | |
| 455 | + int delCatalog(String id); | |
| 456 | + | |
| 457 | + int updateCatalog(PlatformCatalog platformCatalog); | |
| 458 | + | |
| 459 | + int setDefaultCatalog(String platformId, String catalogId); | |
| 460 | + | |
| 461 | + List<PlatformCatalog> queryCatalogInPlatform(String serverGBId); | |
| 462 | + | |
| 463 | + int delRelation(PlatformCatalog platformCatalog); | |
| 464 | + | |
| 465 | + int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo); | |
| 466 | + | |
| 467 | + List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); | |
| 468 | + | |
| 469 | + List<ParentPlatform> queryPlatFormListForStreamWithGBId(String app, String stream, List<String> platforms); | |
| 470 | + | |
| 471 | + GbStream getGbStream(String app, String streamId); | |
| 472 | + | |
| 473 | + void delCatalogByPlatformId(String serverGBId); | |
| 474 | + | |
| 475 | + void delRelationByPlatformId(String serverGBId); | |
| 476 | + | |
| 477 | + PlatformCatalog queryDefaultCatalogInPlatform(String platformId); | |
| 478 | + | |
| 479 | + List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); | |
| 480 | + | |
| 481 | + void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude); | |
| 482 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| ... | ... | @@ -106,7 +106,7 @@ public interface DeviceChannelMapper { |
| 106 | 106 | " <if test='online == true' > AND dc.status=1</if> " + |
| 107 | 107 | " <if test='online == false' > AND dc.status=0</if> " + |
| 108 | 108 | " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " + |
| 109 | - " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount == 0</if> " + | |
| 109 | + " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount = 0</if> " + | |
| 110 | 110 | " <if test='catalogId == null ' > AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " + |
| 111 | 111 | " <if test='catalogId != null ' > AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " + |
| 112 | 112 | " ORDER BY dc.deviceId, dc.channelId ASC" + |
| ... | ... | @@ -270,4 +270,7 @@ public interface DeviceChannelMapper { |
| 270 | 270 | " where deviceId = #{deviceId} " + |
| 271 | 271 | " and channelId = #{channelId}") |
| 272 | 272 | int updateChannelSubCount(String deviceId, String channelId); |
| 273 | + | |
| 274 | + @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) | |
| 275 | + void updatePotion(String deviceId, String channelId, double longitude, double latitude); | |
| 273 | 276 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| ... | ... | @@ -34,6 +34,9 @@ public interface DeviceMapper { |
| 34 | 34 | "updateTime," + |
| 35 | 35 | "charset," + |
| 36 | 36 | "subscribeCycleForCatalog," + |
| 37 | + "subscribeCycleForMobilePosition," + | |
| 38 | + "mobilePositionSubmissionInterval," + | |
| 39 | + "subscribeCycleForAlarm," + | |
| 37 | 40 | "online" + |
| 38 | 41 | ") VALUES (" + |
| 39 | 42 | "#{deviceId}," + |
| ... | ... | @@ -53,6 +56,9 @@ public interface DeviceMapper { |
| 53 | 56 | "#{updateTime}," + |
| 54 | 57 | "#{charset}," + |
| 55 | 58 | "#{subscribeCycleForCatalog}," + |
| 59 | + "#{subscribeCycleForMobilePosition}," + | |
| 60 | + "#{mobilePositionSubmissionInterval}," + | |
| 61 | + "#{subscribeCycleForAlarm}," + | |
| 56 | 62 | "#{online}" + |
| 57 | 63 | ")") |
| 58 | 64 | int add(Device device); |
| ... | ... | @@ -75,6 +81,9 @@ public interface DeviceMapper { |
| 75 | 81 | "<if test=\"expires != null\">, expires=${expires}</if>" + |
| 76 | 82 | "<if test=\"charset != null\">, charset='${charset}'</if>" + |
| 77 | 83 | "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" + |
| 84 | + "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" + | |
| 85 | + "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" + | |
| 86 | + "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" + | |
| 78 | 87 | "WHERE deviceId='${deviceId}'"+ |
| 79 | 88 | " </script>"}) |
| 80 | 89 | int update(Device device); | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.storager.impl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | 6 | import com.genersoft.iot.vmp.common.SystemInfoDto; |
| 6 | 7 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | -import com.genersoft.iot.vmp.conf.UserSetup; | |
| 8 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 8 | 9 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 9 | 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 10 | 11 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 11 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | |
| 12 | 12 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 13 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | |
| 13 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | |
| 14 | 14 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| 15 | 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 16 | 16 | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| ... | ... | @@ -18,9 +18,7 @@ import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 18 | 18 | import org.slf4j.Logger; |
| 19 | 19 | import org.slf4j.LoggerFactory; |
| 20 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | -import org.springframework.security.core.parameters.P; | |
| 22 | 21 | import org.springframework.stereotype.Component; |
| 23 | -import org.springframework.util.StringUtils; | |
| 24 | 22 | |
| 25 | 23 | import java.text.SimpleDateFormat; |
| 26 | 24 | import java.util.*; |
| ... | ... | @@ -29,7 +27,7 @@ import java.util.*; |
| 29 | 27 | @Component |
| 30 | 28 | public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 31 | 29 | |
| 32 | - private Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); | |
| 30 | + private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); | |
| 33 | 31 | |
| 34 | 32 | @Autowired |
| 35 | 33 | private RedisUtil redis; |
| ... | ... | @@ -38,13 +36,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 38 | 36 | private DeviceChannelMapper deviceChannelMapper; |
| 39 | 37 | |
| 40 | 38 | @Autowired |
| 41 | - private UserSetup userSetup; | |
| 39 | + private UserSetting userSetting; | |
| 42 | 40 | |
| 43 | - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 41 | + private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 44 | 42 | |
| 45 | 43 | @Override |
| 46 | 44 | public Long getCSEQ(String method) { |
| 47 | - String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetup.getServerId() + "_" + method; | |
| 45 | + String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_" + method; | |
| 48 | 46 | |
| 49 | 47 | long result = redis.incr(key, 1L); |
| 50 | 48 | if (result > Integer.MAX_VALUE) { |
| ... | ... | @@ -56,7 +54,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 56 | 54 | |
| 57 | 55 | @Override |
| 58 | 56 | public Long getSN(String method) { |
| 59 | - String key = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_" + method; | |
| 57 | + String key = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_" + method; | |
| 60 | 58 | |
| 61 | 59 | long result = redis.incr(key, 1L); |
| 62 | 60 | if (result > Integer.MAX_VALUE) { |
| ... | ... | @@ -68,20 +66,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 68 | 66 | |
| 69 | 67 | @Override |
| 70 | 68 | public void resetAllCSEQ() { |
| 71 | - String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetup.getServerId() + "_*"; | |
| 69 | + String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*"; | |
| 72 | 70 | List<Object> keys = redis.scan(scanKey); |
| 73 | - for (int i = 0; i < keys.size(); i++) { | |
| 74 | - String key = (String) keys.get(i); | |
| 71 | + for (Object o : keys) { | |
| 72 | + String key = (String) o; | |
| 75 | 73 | redis.set(key, 1); |
| 76 | 74 | } |
| 77 | 75 | } |
| 78 | 76 | |
| 79 | 77 | @Override |
| 80 | 78 | public void resetAllSN() { |
| 81 | - String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_*"; | |
| 79 | + String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*"; | |
| 82 | 80 | List<Object> keys = redis.scan(scanKey); |
| 83 | - for (int i = 0; i < keys.size(); i++) { | |
| 84 | - String key = (String) keys.get(i); | |
| 81 | + for (Object o : keys) { | |
| 82 | + String key = (String) o; | |
| 85 | 83 | redis.set(key, 1); |
| 86 | 84 | } |
| 87 | 85 | } |
| ... | ... | @@ -93,7 +91,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 93 | 91 | */ |
| 94 | 92 | @Override |
| 95 | 93 | public boolean startPlay(StreamInfo stream) { |
| 96 | - return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(), | |
| 94 | + return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), | |
| 97 | 95 | stream.getStream(), stream.getDeviceID(), stream.getChannelId()), |
| 98 | 96 | stream); |
| 99 | 97 | } |
| ... | ... | @@ -107,7 +105,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 107 | 105 | public boolean stopPlay(StreamInfo streamInfo) { |
| 108 | 106 | if (streamInfo == null) return false; |
| 109 | 107 | return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
| 110 | - userSetup.getServerId(), | |
| 108 | + userSetting.getServerId(), | |
| 111 | 109 | streamInfo.getStream(), |
| 112 | 110 | streamInfo.getDeviceID(), |
| 113 | 111 | streamInfo.getChannelId())); |
| ... | ... | @@ -121,14 +119,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 121 | 119 | public StreamInfo queryPlay(StreamInfo streamInfo) { |
| 122 | 120 | return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s", |
| 123 | 121 | VideoManagerConstants.PLAYER_PREFIX, |
| 124 | - userSetup.getServerId(), | |
| 122 | + userSetting.getServerId(), | |
| 125 | 123 | streamInfo.getStream(), |
| 126 | 124 | streamInfo.getDeviceID(), |
| 127 | 125 | streamInfo.getChannelId())); |
| 128 | 126 | } |
| 129 | 127 | @Override |
| 130 | 128 | public StreamInfo queryPlayByStreamId(String streamId) { |
| 131 | - List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(), streamId)); | |
| 129 | + List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); | |
| 132 | 130 | if (playLeys == null || playLeys.size() == 0) return null; |
| 133 | 131 | return (StreamInfo)redis.get(playLeys.get(0).toString()); |
| 134 | 132 | } |
| ... | ... | @@ -136,7 +134,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 136 | 134 | @Override |
| 137 | 135 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { |
| 138 | 136 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
| 139 | - userSetup.getServerId(), | |
| 137 | + userSetting.getServerId(), | |
| 140 | 138 | deviceId, |
| 141 | 139 | channelId)); |
| 142 | 140 | if (playLeys == null || playLeys.size() == 0) return null; |
| ... | ... | @@ -147,11 +145,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 147 | 145 | public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { |
| 148 | 146 | Map<String, StreamInfo> streamInfos = new HashMap<>(); |
| 149 | 147 | // List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); |
| 150 | - List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(),deviceId)); | |
| 148 | + List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); | |
| 151 | 149 | if (players.size() == 0) return streamInfos; |
| 152 | - for (int i = 0; i < players.size(); i++) { | |
| 153 | - String key = (String) players.get(i); | |
| 154 | - StreamInfo streamInfo = (StreamInfo)redis.get(key); | |
| 150 | + for (Object player : players) { | |
| 151 | + String key = (String) player; | |
| 152 | + StreamInfo streamInfo = (StreamInfo) redis.get(key); | |
| 155 | 153 | streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); |
| 156 | 154 | } |
| 157 | 155 | return streamInfos; |
| ... | ... | @@ -161,7 +159,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 161 | 159 | @Override |
| 162 | 160 | public boolean startPlayback(StreamInfo stream, String callId) { |
| 163 | 161 | return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 164 | - userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 162 | + userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 165 | 163 | } |
| 166 | 164 | |
| 167 | 165 | @Override |
| ... | ... | @@ -169,10 +167,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 169 | 167 | boolean result; |
| 170 | 168 | if (stream.getProgress() == 1) { |
| 171 | 169 | result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 172 | - userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 170 | + userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 173 | 171 | }else { |
| 174 | 172 | result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 175 | - userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); | |
| 173 | + userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); | |
| 176 | 174 | } |
| 177 | 175 | return result; |
| 178 | 176 | } |
| ... | ... | @@ -189,7 +187,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 189 | 187 | if (stream == null) stream = "*"; |
| 190 | 188 | if (callId == null) callId = "*"; |
| 191 | 189 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 192 | - userSetup.getServerId(), | |
| 190 | + userSetting.getServerId(), | |
| 193 | 191 | deviceId, |
| 194 | 192 | channelId, |
| 195 | 193 | stream, |
| ... | ... | @@ -217,7 +215,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 217 | 215 | if (stream == null) stream = "*"; |
| 218 | 216 | if (callId == null) callId = "*"; |
| 219 | 217 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 220 | - userSetup.getServerId(), | |
| 218 | + userSetting.getServerId(), | |
| 221 | 219 | deviceId, |
| 222 | 220 | channelId, |
| 223 | 221 | stream, |
| ... | ... | @@ -242,7 +240,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 242 | 240 | if (stream == null) stream = "*"; |
| 243 | 241 | if (callId == null) callId = "*"; |
| 244 | 242 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 245 | - userSetup.getServerId(), | |
| 243 | + userSetting.getServerId(), | |
| 246 | 244 | deviceId, |
| 247 | 245 | channelId, |
| 248 | 246 | stream, |
| ... | ... | @@ -258,63 +256,63 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 258 | 256 | |
| 259 | 257 | @Override |
| 260 | 258 | public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { |
| 261 | - String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + parentPlatformCatch.getId(); | |
| 259 | + String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId(); | |
| 262 | 260 | redis.set(key, parentPlatformCatch); |
| 263 | 261 | } |
| 264 | 262 | |
| 265 | 263 | @Override |
| 266 | 264 | public void updatePlatformKeepalive(ParentPlatform parentPlatform) { |
| 267 | - String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + parentPlatform.getServerGBId(); | |
| 265 | + String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); | |
| 268 | 266 | redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); |
| 269 | 267 | } |
| 270 | 268 | |
| 271 | 269 | @Override |
| 272 | 270 | public void updatePlatformRegister(ParentPlatform parentPlatform) { |
| 273 | - String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_" + parentPlatform.getServerGBId(); | |
| 271 | + String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); | |
| 274 | 272 | redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); |
| 275 | 273 | } |
| 276 | 274 | |
| 277 | 275 | @Override |
| 278 | 276 | public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { |
| 279 | - return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + platformGbId); | |
| 277 | + return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); | |
| 280 | 278 | } |
| 281 | 279 | |
| 282 | 280 | @Override |
| 283 | 281 | public void delPlatformCatchInfo(String platformGbId) { |
| 284 | - redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + platformGbId); | |
| 282 | + redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); | |
| 285 | 283 | } |
| 286 | 284 | |
| 287 | 285 | @Override |
| 288 | 286 | public void delPlatformKeepalive(String platformGbId) { |
| 289 | - redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + platformGbId); | |
| 287 | + redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId); | |
| 290 | 288 | } |
| 291 | 289 | |
| 292 | 290 | @Override |
| 293 | 291 | public void delPlatformRegister(String platformGbId) { |
| 294 | - redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_" + platformGbId); | |
| 292 | + redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId); | |
| 295 | 293 | } |
| 296 | 294 | |
| 297 | 295 | |
| 298 | 296 | @Override |
| 299 | 297 | public void updatePlatformRegisterInfo(String callId, String platformGbId) { |
| 300 | - String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId; | |
| 298 | + String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId; | |
| 301 | 299 | redis.set(key, platformGbId, 30); |
| 302 | 300 | } |
| 303 | 301 | |
| 304 | 302 | |
| 305 | 303 | @Override |
| 306 | 304 | public String queryPlatformRegisterInfo(String callId) { |
| 307 | - return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId); | |
| 305 | + return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); | |
| 308 | 306 | } |
| 309 | 307 | |
| 310 | 308 | @Override |
| 311 | 309 | public void delPlatformRegisterInfo(String callId) { |
| 312 | - redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId); | |
| 310 | + redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); | |
| 313 | 311 | } |
| 314 | 312 | |
| 315 | 313 | @Override |
| 316 | 314 | public void cleanPlatformRegisterInfos() { |
| 317 | - List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + "*"); | |
| 315 | + List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*"); | |
| 318 | 316 | for (Object key : regInfos) { |
| 319 | 317 | redis.del(key.toString()); |
| 320 | 318 | } |
| ... | ... | @@ -322,7 +320,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 322 | 320 | |
| 323 | 321 | @Override |
| 324 | 322 | public void updateSendRTPSever(SendRtpItem sendRtpItem) { |
| 325 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" | |
| 323 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" | |
| 326 | 324 | + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" |
| 327 | 325 | + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); |
| 328 | 326 | redis.set(key, sendRtpItem); |
| ... | ... | @@ -334,7 +332,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 334 | 332 | if (channelId == null) channelId = "*"; |
| 335 | 333 | if (streamId == null) streamId = "*"; |
| 336 | 334 | if (callId == null) callId = "*"; |
| 337 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId | |
| 335 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | |
| 338 | 336 | + "_" + channelId + "_" + streamId + "_" + callId; |
| 339 | 337 | List<Object> scan = redis.scan(key); |
| 340 | 338 | if (scan.size() > 0) { |
| ... | ... | @@ -347,13 +345,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 347 | 345 | @Override |
| 348 | 346 | public List<SendRtpItem> querySendRTPServer(String platformGbId) { |
| 349 | 347 | if (platformGbId == null) platformGbId = "*"; |
| 350 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; | |
| 348 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; | |
| 351 | 349 | List<Object> queryResult = redis.scan(key); |
| 352 | 350 | List<SendRtpItem> result= new ArrayList<>(); |
| 353 | 351 | |
| 354 | - for (int i = 0; i < queryResult.size(); i++) { | |
| 355 | - String keyItem = (String) queryResult.get(i); | |
| 356 | - result.add((SendRtpItem)redis.get(keyItem)); | |
| 352 | + for (Object o : queryResult) { | |
| 353 | + String keyItem = (String) o; | |
| 354 | + result.add((SendRtpItem) redis.get(keyItem)); | |
| 357 | 355 | } |
| 358 | 356 | |
| 359 | 357 | return result; |
| ... | ... | @@ -368,7 +366,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 368 | 366 | public void deleteSendRTPServer(String platformGbId, String channelId, String callId, String streamId) { |
| 369 | 367 | if (streamId == null) streamId = "*"; |
| 370 | 368 | if (callId == null) callId = "*"; |
| 371 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId | |
| 369 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | |
| 372 | 370 | + "_" + channelId + "_" + streamId + "_" + callId; |
| 373 | 371 | List<Object> scan = redis.scan(key); |
| 374 | 372 | if (scan.size() > 0) { |
| ... | ... | @@ -386,7 +384,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 386 | 384 | */ |
| 387 | 385 | @Override |
| 388 | 386 | public boolean isChannelSendingRTP(String channelId) { |
| 389 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; | |
| 387 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; | |
| 390 | 388 | List<Object> RtpStreams = redis.scan(key); |
| 391 | 389 | if (RtpStreams.size() > 0) { |
| 392 | 390 | return true; |
| ... | ... | @@ -398,7 +396,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 398 | 396 | @Override |
| 399 | 397 | public void clearCatchByDeviceId(String deviceId) { |
| 400 | 398 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, |
| 401 | - userSetup.getServerId(), | |
| 399 | + userSetting.getServerId(), | |
| 402 | 400 | deviceId)); |
| 403 | 401 | if (playLeys.size() > 0) { |
| 404 | 402 | for (Object key : playLeys) { |
| ... | ... | @@ -407,7 +405,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 407 | 405 | } |
| 408 | 406 | |
| 409 | 407 | List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 410 | - userSetup.getServerId(), | |
| 408 | + userSetting.getServerId(), | |
| 411 | 409 | deviceId)); |
| 412 | 410 | if (playBackers.size() > 0) { |
| 413 | 411 | for (Object key : playBackers) { |
| ... | ... | @@ -416,7 +414,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 416 | 414 | } |
| 417 | 415 | |
| 418 | 416 | List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, |
| 419 | - userSetup.getServerId(), | |
| 417 | + userSetting.getServerId(), | |
| 420 | 418 | deviceId)); |
| 421 | 419 | if (deviceCache.size() > 0) { |
| 422 | 420 | for (Object key : deviceCache) { |
| ... | ... | @@ -427,7 +425,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 427 | 425 | |
| 428 | 426 | @Override |
| 429 | 427 | public void outlineForAll() { |
| 430 | - List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + "*" ); | |
| 428 | + List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + "*" ); | |
| 431 | 429 | for (int i = 0; i < onlineDevices.size(); i++) { |
| 432 | 430 | String key = (String) onlineDevices.get(i); |
| 433 | 431 | redis.del(key); |
| ... | ... | @@ -437,7 +435,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 437 | 435 | @Override |
| 438 | 436 | public List<String> getOnlineForAll() { |
| 439 | 437 | List<String> result = new ArrayList<>(); |
| 440 | - List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + "*" ); | |
| 438 | + List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + "*" ); | |
| 441 | 439 | for (int i = 0; i < onlineDevices.size(); i++) { |
| 442 | 440 | String key = (String) onlineDevices.get(i); |
| 443 | 441 | result.add((String) redis.get(key)); |
| ... | ... | @@ -447,7 +445,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 447 | 445 | |
| 448 | 446 | @Override |
| 449 | 447 | public void updateWVPInfo(JSONObject jsonObject, int time) { |
| 450 | - String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetup.getServerId(); | |
| 448 | + String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId(); | |
| 451 | 449 | redis.set(key, jsonObject, time); |
| 452 | 450 | } |
| 453 | 451 | |
| ... | ... | @@ -460,13 +458,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 460 | 458 | |
| 461 | 459 | @Override |
| 462 | 460 | public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, MediaItem mediaItem) { |
| 463 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); | |
| 461 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); | |
| 464 | 462 | redis.set(key, mediaItem); |
| 465 | 463 | } |
| 466 | 464 | |
| 467 | 465 | @Override |
| 468 | 466 | public void removeStream(String mediaServerId, String type, String app, String streamId) { |
| 469 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; | |
| 467 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; | |
| 470 | 468 | redis.del(key); |
| 471 | 469 | } |
| 472 | 470 | |
| ... | ... | @@ -480,7 +478,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 480 | 478 | if (stream == null) stream = "*"; |
| 481 | 479 | if (callId == null) callId = "*"; |
| 482 | 480 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 483 | - userSetup.getServerId(), | |
| 481 | + userSetting.getServerId(), | |
| 484 | 482 | deviceId, |
| 485 | 483 | channelId, |
| 486 | 484 | stream, |
| ... | ... | @@ -503,7 +501,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 503 | 501 | |
| 504 | 502 | @Override |
| 505 | 503 | public void removeStream(String mediaServerId, String type) { |
| 506 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId; | |
| 504 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; | |
| 507 | 505 | List<Object> streams = redis.scan(key); |
| 508 | 506 | for (Object stream : streams) { |
| 509 | 507 | redis.del((String) stream); |
| ... | ... | @@ -513,7 +511,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 513 | 511 | @Override |
| 514 | 512 | public List<MediaItem> getStreams(String mediaServerId, String type) { |
| 515 | 513 | List<MediaItem> result = new ArrayList<>(); |
| 516 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId; | |
| 514 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; | |
| 517 | 515 | List<Object> streams = redis.scan(key); |
| 518 | 516 | for (Object stream : streams) { |
| 519 | 517 | MediaItem mediaItem = (MediaItem)redis.get((String) stream); |
| ... | ... | @@ -524,37 +522,37 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 524 | 522 | |
| 525 | 523 | @Override |
| 526 | 524 | public void updateDevice(Device device) { |
| 527 | - String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + device.getDeviceId(); | |
| 525 | + String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + device.getDeviceId(); | |
| 528 | 526 | redis.set(key, device); |
| 529 | 527 | } |
| 530 | 528 | |
| 531 | 529 | @Override |
| 532 | 530 | public void removeDevice(String deviceId) { |
| 533 | - String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; | |
| 531 | + String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; | |
| 534 | 532 | redis.del(key); |
| 535 | 533 | } |
| 536 | 534 | |
| 537 | 535 | @Override |
| 538 | 536 | public Device getDevice(String deviceId) { |
| 539 | - String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; | |
| 537 | + String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; | |
| 540 | 538 | return (Device)redis.get(key); |
| 541 | 539 | } |
| 542 | 540 | |
| 543 | 541 | @Override |
| 544 | 542 | public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { |
| 545 | - String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gpsMsgInfo.getId(); | |
| 543 | + String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); | |
| 546 | 544 | redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟 |
| 547 | 545 | } |
| 548 | 546 | |
| 549 | 547 | @Override |
| 550 | 548 | public GPSMsgInfo getGpsMsgInfo(String gbId) { |
| 551 | - String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gbId; | |
| 549 | + String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gbId; | |
| 552 | 550 | return (GPSMsgInfo)redis.get(key); |
| 553 | 551 | } |
| 554 | 552 | |
| 555 | 553 | @Override |
| 556 | 554 | public List<GPSMsgInfo> getAllGpsMsgInfo() { |
| 557 | - String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*"; | |
| 555 | + String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*"; | |
| 558 | 556 | List<GPSMsgInfo> result = new ArrayList<>(); |
| 559 | 557 | List<Object> keys = redis.scan(scanKey); |
| 560 | 558 | for (int i = 0; i < keys.size(); i++) { |
| ... | ... | @@ -570,7 +568,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 570 | 568 | |
| 571 | 569 | @Override |
| 572 | 570 | public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { |
| 573 | - String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; | |
| 571 | + String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; | |
| 574 | 572 | |
| 575 | 573 | MediaItem result = null; |
| 576 | 574 | List<Object> keys = redis.scan(scanKey); |
| ... | ... | @@ -584,7 +582,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 584 | 582 | |
| 585 | 583 | @Override |
| 586 | 584 | public void addCpuInfo(double cpuInfo) { |
| 587 | - String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetup.getServerId(); | |
| 585 | + String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetting.getServerId(); | |
| 588 | 586 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
| 589 | 587 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
| 590 | 588 | systemInfoDto.setData(cpuInfo); |
| ... | ... | @@ -599,7 +597,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 599 | 597 | |
| 600 | 598 | @Override |
| 601 | 599 | public void addMemInfo(double memInfo) { |
| 602 | - String key = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetup.getServerId(); | |
| 600 | + String key = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetting.getServerId(); | |
| 603 | 601 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
| 604 | 602 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
| 605 | 603 | systemInfoDto.setData(memInfo); |
| ... | ... | @@ -614,7 +612,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 614 | 612 | |
| 615 | 613 | @Override |
| 616 | 614 | public void addNetInfo(Map<String, String> networkInterfaces) { |
| 617 | - String key = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetup.getServerId(); | |
| 615 | + String key = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetting.getServerId(); | |
| 618 | 616 | SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); |
| 619 | 617 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
| 620 | 618 | systemInfoDto.setData(networkInterfaces); |
| ... | ... | @@ -626,4 +624,18 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 626 | 624 | } |
| 627 | 625 | } |
| 628 | 626 | } |
| 627 | + | |
| 628 | + @Override | |
| 629 | + public void sendMobilePositionMsg(JSONObject jsonObject) { | |
| 630 | + String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; | |
| 631 | + logger.debug("[redis 移动位置订阅通知] {}: {}", key, jsonObject.toString()); | |
| 632 | + redis.convertAndSend(key, jsonObject); | |
| 633 | + } | |
| 634 | + | |
| 635 | + @Override | |
| 636 | + public void sendStreamPushRequestedMsg(MessageForPushChannel msg) { | |
| 637 | + String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED; | |
| 638 | + logger.debug("[redis 推流被请求通知] {}: {}-{}", key, msg.getApp(), msg.getStream()); | |
| 639 | + redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); | |
| 640 | + } | |
| 629 | 641 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java renamed to src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| ... | ... | @@ -5,14 +5,12 @@ import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 8 | -import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | |
| 9 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | |
| 10 | 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 11 | 9 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 12 | 10 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 13 | 11 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 14 | 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 15 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 16 | 14 | import com.genersoft.iot.vmp.storager.dao.*; |
| 17 | 15 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; |
| 18 | 16 | import com.genersoft.iot.vmp.utils.node.ForestNodeMerger; |
| ... | ... | @@ -40,9 +38,9 @@ import java.util.*; |
| 40 | 38 | */ |
| 41 | 39 | @SuppressWarnings("rawtypes") |
| 42 | 40 | @Component |
| 43 | -public class VideoManagerStoragerImpl implements IVideoManagerStorager { | |
| 41 | +public class VideoManagerStorageImpl implements IVideoManagerStorage { | |
| 44 | 42 | |
| 45 | - private final Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class); | |
| 43 | + private final Logger logger = LoggerFactory.getLogger(VideoManagerStorageImpl.class); | |
| 46 | 44 | |
| 47 | 45 | @Autowired |
| 48 | 46 | EventPublisher eventPublisher; |
| ... | ... | @@ -85,7 +83,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 85 | 83 | |
| 86 | 84 | @Autowired |
| 87 | 85 | private PlatformCatalogMapper catalogMapper; |
| 88 | -; | |
| 89 | 86 | |
| 90 | 87 | @Autowired |
| 91 | 88 | private PlatformGbStreamMapper platformGbStreamMapper; |
| ... | ... | @@ -96,13 +93,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 96 | 93 | @Autowired |
| 97 | 94 | private ParentPlatformMapper parentPlatformMapper; |
| 98 | 95 | |
| 99 | - @Autowired | |
| 100 | - private VideoStreamSessionManager streamSession; | |
| 101 | - | |
| 102 | - @Autowired | |
| 103 | - private MediaServerMapper mediaServerMapper; | |
| 104 | - | |
| 105 | - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 96 | + private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 106 | 97 | |
| 107 | 98 | |
| 108 | 99 | /** |
| ... | ... | @@ -268,7 +259,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 268 | 259 | } |
| 269 | 260 | } |
| 270 | 261 | }else { |
| 271 | - stringBuilder.append(deviceChannel.getChannelId() + ","); | |
| 262 | + stringBuilder.append(deviceChannel.getChannelId()).append(","); | |
| 272 | 263 | } |
| 273 | 264 | } |
| 274 | 265 | if (channels.size() > 0) { |
| ... | ... | @@ -286,7 +277,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 286 | 277 | logger.debug("[目录查询]收到的数据存在重复: {}" , stringBuilder); |
| 287 | 278 | } |
| 288 | 279 | try { |
| 289 | -// int cleanChannelsResult = deviceChannelMapper.cleanChannelsByDeviceId(deviceId); | |
| 290 | 280 | int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels); |
| 291 | 281 | int limitCount = 300; |
| 292 | 282 | boolean result = cleanChannelsResult < 0; |
| ... | ... | @@ -1133,4 +1123,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 1133 | 1123 | public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) { |
| 1134 | 1124 | return platformMapper.getChannelSource(platformId, gbId); |
| 1135 | 1125 | } |
| 1126 | + | |
| 1127 | + @Override | |
| 1128 | + public void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude) { | |
| 1129 | + deviceChannelMapper.updatePotion(deviceId, channelId, longitude, latitude); | |
| 1130 | + } | |
| 1136 | 1131 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java
| ... | ... | @@ -3,14 +3,12 @@ package com.genersoft.iot.vmp.vmanager.gb28181.MobilePosition; |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.util.UUID; |
| 5 | 5 | |
| 6 | -import javax.sip.message.Response; | |
| 7 | - | |
| 8 | 6 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 9 | 7 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| 10 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 11 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 12 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 14 | 12 | import com.github.pagehelper.util.StringUtil; |
| 15 | 13 | |
| 16 | 14 | import io.swagger.annotations.Api; |
| ... | ... | @@ -42,7 +40,7 @@ public class MobilePositionController { |
| 42 | 40 | private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class); |
| 43 | 41 | |
| 44 | 42 | @Autowired |
| 45 | - private IVideoManagerStorager storager; | |
| 43 | + private IVideoManagerStorage storager; | |
| 46 | 44 | |
| 47 | 45 | @Autowired |
| 48 | 46 | private SIPCommander cmder; |
| ... | ... | @@ -161,9 +159,11 @@ public class MobilePositionController { |
| 161 | 159 | interval = "5"; |
| 162 | 160 | } |
| 163 | 161 | Device device = storager.queryVideoDevice(deviceId); |
| 164 | - | |
| 162 | + device.setSubscribeCycleForMobilePosition(Integer.parseInt(expires)); | |
| 163 | + device.setMobilePositionSubmissionInterval(Integer.parseInt(interval)); | |
| 164 | + storager.updateDevice(device); | |
| 165 | 165 | String result = msg; |
| 166 | - if (cmder.mobilePositionSubscribe(device, Integer.parseInt(expires), Integer.parseInt(interval))) { | |
| 166 | + if (cmder.mobilePositionSubscribe(device, null, null)) { | |
| 167 | 167 | result += ",成功"; |
| 168 | 168 | } else { |
| 169 | 169 | result += ",失败"; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java
| ... | ... | @@ -7,14 +7,12 @@ |
| 7 | 7 | |
| 8 | 8 | package com.genersoft.iot.vmp.vmanager.gb28181.device; |
| 9 | 9 | |
| 10 | -import javax.sip.message.Response; | |
| 11 | - | |
| 12 | 10 | import com.alibaba.fastjson.JSONObject; |
| 13 | 11 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 14 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 15 | 13 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 16 | 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 17 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 15 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 18 | 16 | |
| 19 | 17 | import io.swagger.annotations.Api; |
| 20 | 18 | import io.swagger.annotations.ApiImplicitParam; |
| ... | ... | @@ -39,7 +37,7 @@ public class DeviceConfig { |
| 39 | 37 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| 40 | 38 | |
| 41 | 39 | @Autowired |
| 42 | - private IVideoManagerStorager storager; | |
| 40 | + private IVideoManagerStorage storager; | |
| 43 | 41 | |
| 44 | 42 | @Autowired |
| 45 | 43 | private SIPCommander cmder; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java
| ... | ... | @@ -7,14 +7,12 @@ |
| 7 | 7 | |
| 8 | 8 | package com.genersoft.iot.vmp.vmanager.gb28181.device; |
| 9 | 9 | |
| 10 | -import javax.sip.message.Response; | |
| 11 | - | |
| 12 | 10 | import com.alibaba.fastjson.JSONObject; |
| 13 | 11 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 14 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 15 | 13 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 16 | 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 17 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 15 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 18 | 16 | |
| 19 | 17 | import io.swagger.annotations.Api; |
| 20 | 18 | import io.swagger.annotations.ApiImplicitParam; |
| ... | ... | @@ -40,7 +38,7 @@ public class DeviceControl { |
| 40 | 38 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| 41 | 39 | |
| 42 | 40 | @Autowired |
| 43 | - private IVideoManagerStorager storager; | |
| 41 | + private IVideoManagerStorage storager; | |
| 44 | 42 | |
| 45 | 43 | @Autowired |
| 46 | 44 | private SIPCommander cmder; | ... | ... |