Merge branch 'postgresql' into wvp-28181-2.0
This commit is contained in:
@@ -66,7 +66,7 @@ public interface ISIPCommanderForPlatform {
|
||||
* @param fromTag
|
||||
* @return
|
||||
*/
|
||||
void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException;
|
||||
void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException;
|
||||
|
||||
/**
|
||||
* 向上级回复移动位置订阅消息
|
||||
|
||||
@@ -221,7 +221,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||
if (!channel.getChannelId().equals(parentPlatform.getDeviceGBId())) {
|
||||
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
|
||||
if (channel.getParental() == 0) {
|
||||
catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
|
||||
catalogXml.append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n");
|
||||
}
|
||||
}
|
||||
if (channel.getParental() == 0) {
|
||||
@@ -250,7 +250,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||
catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
|
||||
catalogXml.append("<Password>" + channel.getPort() + "</Password>\r\n");
|
||||
catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
|
||||
catalogXml.append("<Status>" + (channel.getStatus() == 1?"ON":"OFF") + "</Status>\r\n");
|
||||
catalogXml.append("<Status>" + (channel.isStatus() ? "ON":"OFF") + "</Status>\r\n");
|
||||
catalogXml.append("<Longitude>" +
|
||||
(channel.getLongitudeWgs84() != 0? channel.getLongitudeWgs84():channel.getLongitude())
|
||||
+ "</Longitude>\r\n");
|
||||
@@ -377,11 +377,11 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException {
|
||||
public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException {
|
||||
if (parentPlatform == null) {
|
||||
return ;
|
||||
}
|
||||
String statusStr = (status==1)?"ONLINE":"OFFLINE";
|
||||
String statusStr = (status)?"ONLINE":"OFFLINE";
|
||||
String characterSet = parentPlatform.getCharacterSet();
|
||||
StringBuffer deviceStatusXml = new StringBuffer(600);
|
||||
deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n")
|
||||
@@ -542,7 +542,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||
catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n")
|
||||
.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n")
|
||||
.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n")
|
||||
.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
|
||||
.append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n");
|
||||
|
||||
if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性
|
||||
catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n")
|
||||
|
||||
@@ -65,7 +65,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
|
||||
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
if (device == null || device.getOnline() == 0) {
|
||||
if (device == null || !device.isOnLine()) {
|
||||
logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
|
||||
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
if (device == null || device.getOnline() == 0) {
|
||||
if (device == null || !device.isOnLine()) {
|
||||
logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||
device.setGeoCoordSys("WGS84");
|
||||
device.setTreeType("CivilCode");
|
||||
device.setDeviceId(deviceId);
|
||||
device.setOnline(0);
|
||||
device.setOnLine(false);
|
||||
}
|
||||
device.setIp(remoteAddressInfo.getIp());
|
||||
device.setPort(remoteAddressInfo.getPort());
|
||||
|
||||
@@ -83,12 +83,12 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||
|
||||
device.setKeepaliveTime(DateUtil.getNow());
|
||||
|
||||
if (device.getOnline() == 1) {
|
||||
if (device.isOnLine()) {
|
||||
deviceService.updateDevice(device);
|
||||
}else {
|
||||
// 对于已经离线的设备判断他的注册是否已经过期
|
||||
if (!deviceService.expire(device)){
|
||||
device.setOnline(0);
|
||||
device.setOnLine(false);
|
||||
deviceService.online(device, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
|
||||
return;
|
||||
}
|
||||
try {
|
||||
cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(),deviceChannel.getStatus());
|
||||
cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(),deviceChannel.isStatus());
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
logger.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
|
||||
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@@ -59,7 +54,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent
|
||||
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
||||
logger.debug("接收到DeviceInfo应答消息");
|
||||
// 检查设备是否存在, 不存在则不回复
|
||||
if (device == null || device.getOnline() == 0) {
|
||||
if (device == null || !device.isOnLine()) {
|
||||
logger.warn("[接收到DeviceInfo应答消息,但是设备已经离线]:" + (device != null ? device.getDeviceId():"" ));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user