临时提交
parent
70f3f3b431
commit
0688bb91d2
|
@ -31,7 +31,7 @@ public enum DeviceControlType {
|
|||
/**
|
||||
* 告警控制
|
||||
*/
|
||||
ALARM("AlarmCmd","告警控制"),
|
||||
ALARM("AlarmCmd","报警复位"),
|
||||
/**
|
||||
* 强制关键帧
|
||||
*/
|
||||
|
|
|
@ -123,6 +123,27 @@ public class GB28181ResourceServiceImpl implements IResourceService {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetAlarm(CommonGbChannel commonGbChannel, Integer alarmMethod, Integer alarmType) {
|
||||
CheckCommonGbChannelResult checkResult = checkCommonGbChannel(commonGbChannel);
|
||||
|
||||
if (checkResult.errorMsg != null) {
|
||||
logger.warn("[资源类-国标28181] 报警处理失败: {}", checkResult.errorMsg);
|
||||
return;
|
||||
}
|
||||
if (checkResult.device == null || checkResult.channel == null) {
|
||||
logger.warn("[资源类-国标28181] 报警处理失败: 设备获取失败");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
commander.alarmCmd(checkResult.device, alarmMethod, alarmType,
|
||||
errorResult -> onError(request, errorResult),
|
||||
okResult -> onOk(request, okResult));
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败]: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void streamOffline(String app, String streamId) {
|
||||
// TODO
|
||||
|
|
|
@ -258,7 +258,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
|||
}
|
||||
|
||||
/**
|
||||
* 处理告警消息***
|
||||
* 处理告警消息
|
||||
*/
|
||||
private void handleAlarmCmd(CommonGbChannel commonGbChannel, Element rootElement, SIPRequest request) {
|
||||
IResourceService resourceService = resourceServiceMap.get(commonGbChannel.getType());
|
||||
|
@ -289,36 +289,9 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
|||
}
|
||||
}
|
||||
|
||||
logger.info("\r\n[报警]: alarmMethod: {} alarmType: {}", alarmMethod, alarmType);
|
||||
logger.info("\r\n[报警复位]: alarmMethod: {} alarmType: {}", alarmMethod, alarmType);
|
||||
|
||||
resourceService.ptzControl(commonGbChannel, ptzCommand);
|
||||
|
||||
|
||||
|
||||
//告警方法
|
||||
Integer alarmMethod = null;
|
||||
//告警类型
|
||||
Integer alarmType = null;
|
||||
List<Element> info = rootElement.elements("Info");
|
||||
if (info != null) {
|
||||
for (Element element : info) {
|
||||
String alarmMethodStr = getText(element, "AlarmMethod");
|
||||
if (alarmMethodStr != null) {
|
||||
alarmMethod = Integer.parseInt(alarmMethodStr);
|
||||
}
|
||||
String alarmTypeStr = getText(element, "AlarmType");
|
||||
if (alarmTypeStr != null) {
|
||||
alarmType = Integer.parseInt(alarmTypeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
cmder.alarmCmd(device, alarmMethod, alarmType,
|
||||
errorResult -> onError(request, errorResult),
|
||||
okResult -> onOk(request, okResult));
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 告警消息: {}", e.getMessage());
|
||||
}
|
||||
resourceService.resetAlarm(commonGbChannel, alarmMethod, alarmType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,4 +46,9 @@ public interface IResourceService {
|
|||
* 录像下载
|
||||
*/
|
||||
void startDownload(CommonGbChannel channel, Long startTime, Long stopTime, Integer downloadSpeed, IResourcePlayCallback playCallback);
|
||||
|
||||
/**
|
||||
* 报警复位
|
||||
*/
|
||||
void resetAlarm(CommonGbChannel commonGbChannel, Integer alarmMethod, Integer alarmType);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue