| | |
| | | import org.springframework.context.annotation.DependsOn;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.util.ObjectUtils;
|
| | | import org.springframework.util.StringUtils;
|
| | |
|
| | | import javax.sip.InvalidArgumentException;
|
| | | import javax.sip.ResponseEvent;
|
| | |
| | | * @param presetIndex 调用预置位编号,开启看守位时使用,取值范围0~255
|
| | | */
|
| | | @Override
|
| | | public void homePositionCmd(Device device, String channelId,String frontCmd, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
| | | public void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
| | |
|
| | | StringBuffer cmdXml = new StringBuffer(200);
|
| | | String charset = device.getCharset();
|
| | |
| | | cmdXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n");
|
| | | }
|
| | | cmdXml.append("<HomePosition>\r\n");
|
| | | if (StringUtils.hasText(frontCmd)){
|
| | | cmdXml.append(frontCmd);
|
| | | }else{
|
| | | if (NumericUtil.isInteger(enabled) && (!enabled.equals("0"))) {
|
| | | cmdXml.append("<Enabled>1</Enabled>\r\n");
|
| | | if (NumericUtil.isInteger(resetTime)) {
|
| | | cmdXml.append("<ResetTime>" + resetTime + "</ResetTime>\r\n");
|
| | | } else {
|
| | | cmdXml.append("<ResetTime>0</ResetTime>\r\n");
|
| | | }
|
| | | if (NumericUtil.isInteger(presetIndex)) {
|
| | | cmdXml.append("<PresetIndex>" + presetIndex + "</PresetIndex>\r\n");
|
| | | } else {
|
| | | cmdXml.append("<PresetIndex>0</PresetIndex>\r\n");
|
| | | }
|
| | | if (NumericUtil.isInteger(enabled) && (!enabled.equals("0"))) {
|
| | | cmdXml.append("<Enabled>1</Enabled>\r\n");
|
| | | if (NumericUtil.isInteger(resetTime)) {
|
| | | cmdXml.append("<ResetTime>" + resetTime + "</ResetTime>\r\n");
|
| | | } else {
|
| | | cmdXml.append("<Enabled>0</Enabled>\r\n");
|
| | | cmdXml.append("<ResetTime>0</ResetTime>\r\n");
|
| | | }
|
| | | if (NumericUtil.isInteger(presetIndex)) {
|
| | | cmdXml.append("<PresetIndex>" + presetIndex + "</PresetIndex>\r\n");
|
| | | } else {
|
| | | cmdXml.append("<PresetIndex>0</PresetIndex>\r\n");
|
| | | }
|
| | | } else {
|
| | | cmdXml.append("<Enabled>0</Enabled>\r\n");
|
| | | }
|
| | |
|
| | | cmdXml.append("</HomePosition>\r\n");
|
| | | cmdXml.append("</Control>\r\n");
|
| | |
|
| | |
| | | if (device == null) {
|
| | | return;
|
| | | }
|
| | | logger.info("[发送 报警通知] {}/{}->{},{}", device.getDeviceId(), deviceAlarm.getChannelId(),
|
| | | logger.info("[发送报警通知]设备: {}/{}->{},{}", device.getDeviceId(), deviceAlarm.getChannelId(),
|
| | | deviceAlarm.getLongitude(), deviceAlarm.getLatitude());
|
| | |
|
| | | String characterSet = device.getCharset();
|
| | |
| | | deviceStatusXml.append("<DeviceID>" + deviceAlarm.getChannelId() + "</DeviceID>\r\n");
|
| | | deviceStatusXml.append("<AlarmPriority>" + deviceAlarm.getAlarmPriority() + "</AlarmPriority>\r\n");
|
| | | deviceStatusXml.append("<AlarmMethod>" + deviceAlarm.getAlarmMethod() + "</AlarmMethod>\r\n");
|
| | | deviceStatusXml.append("<AlarmTime>" + deviceAlarm.getAlarmTime() + "</AlarmTime>\r\n");
|
| | | deviceStatusXml.append("<AlarmTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(deviceAlarm.getAlarmTime()) + "</AlarmTime>\r\n");
|
| | | deviceStatusXml.append("<AlarmDescription>" + deviceAlarm.getAlarmDescription() + "</AlarmDescription>\r\n");
|
| | | deviceStatusXml.append("<Longitude>" + deviceAlarm.getLongitude() + "</Longitude>\r\n");
|
| | | deviceStatusXml.append("<Latitude>" + deviceAlarm.getLatitude() + "</Latitude>\r\n");
|