临时提交
parent
66f32d799d
commit
456ef2c5e4
|
@ -222,9 +222,9 @@ public interface ISIPCommander {
|
|||
* @param channelId 通道id,非通道则是设备本身
|
||||
* @param enabled 看守位使能:1 = 开启,0 = 关闭
|
||||
* @param resetTime 自动归位时间间隔,开启看守位时使用,单位:秒(s)
|
||||
* @param presetIndex 调用预置位编号,开启看守位时使用,取值范围0~255
|
||||
* @param presetId 调用预置位编号,开启看守位时使用,取值范围0~255
|
||||
*/
|
||||
void homePositionCmd(Device device, String channelId, boolean enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
|
||||
void homePositionCmd(Device device, String channelId, boolean enabled, String resetTime, Integer presetId, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
|
||||
|
||||
/**
|
||||
* 设备配置命令
|
||||
|
|
|
@ -691,7 +691,7 @@ public class SIPCommander implements ISIPCommander {
|
|||
*
|
||||
* @param device 视频设备
|
||||
* @param channelId 预览通道
|
||||
* @param recordCmdStr 录像命令:Record / StopRecord
|
||||
* @param record 录像命令:Record / StopRecord
|
||||
*/
|
||||
@Override
|
||||
public void recordCmd(Device device, String channelId, boolean record, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
||||
|
@ -748,7 +748,7 @@ public class SIPCommander implements ISIPCommander {
|
|||
* 报警布防/撤防命令
|
||||
*
|
||||
* @param device 视频设备
|
||||
* @param guardCmdStr "SetGuard"/"ResetGuard"
|
||||
* @param setGuard "SetGuard"/"ResetGuard"
|
||||
*/
|
||||
@Override
|
||||
public void guardCmd(Device device, boolean setGuard, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
||||
|
@ -843,10 +843,10 @@ public class SIPCommander implements ISIPCommander {
|
|||
* @param channelId 通道id,非通道则是设备本身
|
||||
* @param enabled 看守位使能:1 = 开启,0 = 关闭
|
||||
* @param resetTime 自动归位时间间隔,开启看守位时使用,单位:秒(s)
|
||||
* @param presetIndex 调用预置位编号,开启看守位时使用,取值范围0~255
|
||||
* @param presetId 调用预置位编号,开启看守位时使用,取值范围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, String resetTime, Integer presetId, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
||||
|
||||
StringBuffer cmdXml = new StringBuffer(200);
|
||||
String charset = device.getCharset();
|
||||
|
@ -860,26 +860,24 @@ 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");
|
||||
if (presetId != null) {
|
||||
cmdXml.append("<PresetIndex>" + presetId + "</PresetIndex>\r\n");
|
||||
} else {
|
||||
cmdXml.append("<PresetIndex>0</PresetIndex>\r\n");
|
||||
}
|
||||
} else {
|
||||
}else {
|
||||
cmdXml.append("<Enabled>0</Enabled>\r\n");
|
||||
}
|
||||
cmdXml.append("</HomePosition>\r\n");
|
||||
cmdXml.append("</Control>\r\n");
|
||||
|
||||
|
||||
|
||||
Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
|
||||
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent,okEvent);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
|
|||
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.cmd.ISIPCommander;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -71,9 +70,10 @@ public class DeviceControl {
|
|||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制命令,可选值:start(手动录像),stop(停止手动录像)", required = true)
|
||||
@GetMapping("/record/{deviceId}/{channelId}/{command}")
|
||||
public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId, @PathVariable String channelId,
|
||||
@PathVariable String command) {
|
||||
@GetMapping("/record/{deviceId}/{channelId}")
|
||||
public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId,
|
||||
@PathVariable String channelId,
|
||||
String command) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("开始/停止录像API调用");
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ public class DeviceControl {
|
|||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制命令,可选值:start(布防),stop(撤防)", required = true)
|
||||
@GetMapping("/guard/{deviceId}/{command}")
|
||||
public DeferredResult<String> guardApi(@PathVariable String deviceId, @PathVariable String command) {
|
||||
@GetMapping("/guard/{deviceId}")
|
||||
public DeferredResult<String> guardApi(@PathVariable String deviceId, String command) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("布防/撤防API调用");
|
||||
}
|
||||
|
@ -250,14 +250,14 @@ public class DeviceControl {
|
|||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制命令: start-开启看守位 stop-关闭看守位", required = true)
|
||||
@Parameter(name = "presetIndex", description = "调用预置位编号, 取值范围为-255")
|
||||
@Parameter(name = "presetId", description = "调用预置位编号, 取值范围为-255")
|
||||
@Parameter(name = "resetTime", description = "自动归位时间间隔,单位:秒(s)")
|
||||
@GetMapping("/home_position/{deviceId}/{command}")
|
||||
@GetMapping("/home_position/{deviceId}")
|
||||
public DeferredResult<String> homePositionApi(@PathVariable String deviceId,
|
||||
@PathVariable String command,
|
||||
@RequestParam(required = false) String resetTime,
|
||||
@RequestParam(required = false) String presetIndex,
|
||||
String channelId) {
|
||||
String command,
|
||||
@RequestParam(required = false) String resetTime,
|
||||
@RequestParam(required = false) Integer presetId,
|
||||
String channelId) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("报警复位API调用");
|
||||
}
|
||||
|
@ -267,8 +267,16 @@ public class DeviceControl {
|
|||
if (device == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), deviceId + "不存在");
|
||||
}
|
||||
boolean enabled;
|
||||
if (command.equalsIgnoreCase("start")) {
|
||||
enabled = true;
|
||||
}else if (command.equalsIgnoreCase("stop")) {
|
||||
enabled = false;
|
||||
}else {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "command参数不是规定值");
|
||||
}
|
||||
try {
|
||||
cmder.homePositionCmd(device, channelId, enabled, resetTime, presetIndex, event -> {
|
||||
cmder.homePositionCmd(device, channelId, enabled, resetTime, presetId, event -> {
|
||||
RequestMessage msg = new RequestMessage();
|
||||
msg.setId(uuid);
|
||||
msg.setKey(key);
|
||||
|
|
Loading…
Reference in New Issue