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