|
|
@ -50,18 +50,12 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
|
|
|
|
private final static Logger logger = LoggerFactory.getLogger(MessageRequestProcessor.class); |
|
|
|
|
|
|
|
private SIPCommander cmder; |
|
|
|
|
|
|
|
private IVideoManagerStorager storager; |
|
|
|
|
|
|
|
private IRedisCatchStorage redisCatchStorage; |
|
|
|
|
|
|
|
private EventPublisher publisher; |
|
|
|
|
|
|
|
private RedisUtil redis; |
|
|
|
|
|
|
|
private DeferredResultHolder deferredResultHolder; |
|
|
|
|
|
|
|
private DeviceOffLineDetector offLineDetector; |
|
|
|
|
|
|
|
private static final String NOTIFY_CATALOG = "Catalog"; |
|
|
@ -87,18 +81,19 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
logger.info("接收到消息:" + cmd); |
|
|
|
response200Ok(evt); |
|
|
|
} |
|
|
|
} catch (DocumentException | SipException |InvalidArgumentException | ParseException e) { |
|
|
|
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 处理MobilePosition移动位置Notify |
|
|
|
* |
|
|
|
* @param evt |
|
|
|
*/ |
|
|
|
private void processNotifyMobilePosition(RequestEvent evt) { |
|
|
|
try { |
|
|
|
//回复 200 OK
|
|
|
|
// 回复 200 OK
|
|
|
|
Element rootElement = getRootElement(evt); |
|
|
|
MobilePosition mobilePosition = new MobilePosition(); |
|
|
|
Element deviceIdElement = rootElement.element("DeviceID"); |
|
|
@ -147,6 +142,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
|
|
|
|
/*** |
|
|
|
* 处理alarm设备报警Notify |
|
|
|
* |
|
|
|
* @param evt |
|
|
|
*/ |
|
|
|
private void processNotifyAlarm(RequestEvent evt) { |
|
|
@ -180,7 +176,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
deviceAlarm.setLatitude(0.00); |
|
|
|
} |
|
|
|
|
|
|
|
if ( deviceAlarm.getAlarmMethod().equals("4")) { |
|
|
|
if (deviceAlarm.getAlarmMethod().equals("4")) { |
|
|
|
MobilePosition mobilePosition = new MobilePosition(); |
|
|
|
mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); |
|
|
|
mobilePosition.setTime(deviceAlarm.getAlarmTime()); |
|
|
@ -259,29 +255,34 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode")); |
|
|
|
deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block")); |
|
|
|
deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address")); |
|
|
|
if (XmlUtil.getText(itemDevice, "Parental") == null || XmlUtil.getText(itemDevice, "Parental") == "") { |
|
|
|
if (XmlUtil.getText(itemDevice, "Parental") == null |
|
|
|
|| XmlUtil.getText(itemDevice, "Parental") == "") { |
|
|
|
deviceChannel.setParental(0); |
|
|
|
} else { |
|
|
|
deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental"))); |
|
|
|
} |
|
|
|
deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID")); |
|
|
|
if (XmlUtil.getText(itemDevice, "SafetyWay") == null || XmlUtil.getText(itemDevice, "SafetyWay")== "") { |
|
|
|
if (XmlUtil.getText(itemDevice, "SafetyWay") == null |
|
|
|
|| XmlUtil.getText(itemDevice, "SafetyWay") == "") { |
|
|
|
deviceChannel.setSafetyWay(0); |
|
|
|
} else { |
|
|
|
deviceChannel.setSafetyWay(Integer.parseInt(XmlUtil.getText(itemDevice, "SafetyWay"))); |
|
|
|
} |
|
|
|
if (XmlUtil.getText(itemDevice, "RegisterWay") == null || XmlUtil.getText(itemDevice, "RegisterWay") =="") { |
|
|
|
if (XmlUtil.getText(itemDevice, "RegisterWay") == null |
|
|
|
|| XmlUtil.getText(itemDevice, "RegisterWay") == "") { |
|
|
|
deviceChannel.setRegisterWay(1); |
|
|
|
} else { |
|
|
|
deviceChannel.setRegisterWay(Integer.parseInt(XmlUtil.getText(itemDevice, "RegisterWay"))); |
|
|
|
} |
|
|
|
deviceChannel.setCertNum(XmlUtil.getText(itemDevice, "CertNum")); |
|
|
|
if (XmlUtil.getText(itemDevice, "Certifiable") == null || XmlUtil.getText(itemDevice, "Certifiable") == "") { |
|
|
|
if (XmlUtil.getText(itemDevice, "Certifiable") == null |
|
|
|
|| XmlUtil.getText(itemDevice, "Certifiable") == "") { |
|
|
|
deviceChannel.setCertifiable(0); |
|
|
|
} else { |
|
|
|
deviceChannel.setCertifiable(Integer.parseInt(XmlUtil.getText(itemDevice, "Certifiable"))); |
|
|
|
} |
|
|
|
if (XmlUtil.getText(itemDevice, "ErrCode") == null || XmlUtil.getText(itemDevice, "ErrCode") == "") { |
|
|
|
if (XmlUtil.getText(itemDevice, "ErrCode") == null |
|
|
|
|| XmlUtil.getText(itemDevice, "ErrCode") == "") { |
|
|
|
deviceChannel.setErrCode(0); |
|
|
|
} else { |
|
|
|
deviceChannel.setErrCode(Integer.parseInt(XmlUtil.getText(itemDevice, "ErrCode"))); |
|
|
@ -289,7 +290,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
deviceChannel.setEndTime(XmlUtil.getText(itemDevice, "EndTime")); |
|
|
|
deviceChannel.setSecrecy(XmlUtil.getText(itemDevice, "Secrecy")); |
|
|
|
deviceChannel.setIpAddress(XmlUtil.getText(itemDevice, "IPAddress")); |
|
|
|
if (XmlUtil.getText(itemDevice, "Port") == null || XmlUtil.getText(itemDevice, "Port") =="") { |
|
|
|
if (XmlUtil.getText(itemDevice, "Port") == null || XmlUtil.getText(itemDevice, "Port") == "") { |
|
|
|
deviceChannel.setPort(0); |
|
|
|
} else { |
|
|
|
deviceChannel.setPort(Integer.parseInt(XmlUtil.getText(itemDevice, "Port"))); |
|
|
@ -305,7 +306,8 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
} else { |
|
|
|
deviceChannel.setLatitude(0.00); |
|
|
|
} |
|
|
|
if (XmlUtil.getText(itemDevice, "PTZType") == null || XmlUtil.getText(itemDevice, "PTZType") == "") { |
|
|
|
if (XmlUtil.getText(itemDevice, "PTZType") == null |
|
|
|
|| XmlUtil.getText(itemDevice, "PTZType") == "") { |
|
|
|
deviceChannel.setPTZType(0); |
|
|
|
} else { |
|
|
|
deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); |
|
|
@ -330,9 +332,9 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
* 回复200 OK |
|
|
|
* |
|
|
|
* @param evt |
|
|
|
* @throws SipException |
|
|
|
* @throws InvalidArgumentException |
|
|
@ -352,7 +354,6 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
} |
|
|
|
|
|
|
|
public void setCmder(SIPCommander cmder) { |
|
|
|
this.cmder = cmder; |
|
|
|
} |
|
|
|
|
|
|
|
public void setStorager(IVideoManagerStorager storager) { |
|
|
@ -364,11 +365,9 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
} |
|
|
|
|
|
|
|
public void setRedis(RedisUtil redis) { |
|
|
|
this.redis = redis; |
|
|
|
} |
|
|
|
|
|
|
|
public void setDeferredResultHolder(DeferredResultHolder deferredResultHolder) { |
|
|
|
this.deferredResultHolder = deferredResultHolder; |
|
|
|
} |
|
|
|
|
|
|
|
public void setOffLineDetector(DeviceOffLineDetector offLineDetector) { |
|
|
|