调整看守位控制接口

This commit is contained in:
648540858
2024-03-29 19:18:34 +08:00
parent 1de344674a
commit 486daf4dfe
4 changed files with 14 additions and 29 deletions

View File

@@ -220,13 +220,8 @@ public interface ISIPCommander {
/**
* 看守位控制命令
*
* @param device 视频设备
* @param channelId 通道id非通道则是设备本身
* @param enabled 看守位使能1 = 开启0 = 关闭
* @param resetTime 自动归位时间间隔,开启看守位时使用,单位:秒(s)
* @param presetIndex 调用预置位编号开启看守位时使用取值范围0~255
*/
void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
void homePositionCmd(Device device, String channelId, Boolean enabled, Integer resetTime, Integer presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
/**
* 设备配置命令

View File

@@ -880,7 +880,7 @@ public class SIPCommander implements ISIPCommander {
* @param presetIndex 调用预置位编号开启看守位时使用取值范围0~255
*/
@Override
public void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
public void homePositionCmd(Device device, String channelId, Boolean enabled, Integer resetTime, Integer presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
StringBuffer cmdXml = new StringBuffer(200);
String charset = device.getCharset();
@@ -894,18 +894,10 @@ public class SIPCommander implements ISIPCommander {
cmdXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n");
}
cmdXml.append("<HomePosition>\r\n");
if (NumericUtil.isInteger(enabled) && (!enabled.equals("0"))) {
if (enabled) {
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");
}
cmdXml.append("<ResetTime>" + resetTime + "</ResetTime>\r\n");
cmdXml.append("<PresetIndex>" + presetIndex + "</PresetIndex>\r\n");
} else {
cmdXml.append("<Enabled>0</Enabled>\r\n");
}

View File

@@ -248,7 +248,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
HomePositionRequest homePosition = loadElement(rootElement, HomePositionRequest.class);
//获取整个消息主体,我们只需要修改请求头即可
HomePositionRequest.HomePosition info = homePosition.getHomePosition();
cmder.homePositionCmd(device, channelId, info.getEnabled(), info.getResetTime(), info.getPresetIndex(),
cmder.homePositionCmd(device, channelId, !"0".equals(info.getEnabled()), Integer.parseInt(info.getResetTime()), Integer.parseInt(info.getPresetIndex()),
errorResult -> onError(request, errorResult),
okResult -> onOk(request, okResult));
} catch (Exception e) {