|
@@ -115,16 +115,17 @@ public class PtzController {
|
|
@Operation(summary = "云台控制新接口")
|
|
@Operation(summary = "云台控制新接口")
|
|
@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 = "控制指令,允许值: left, right, up, down, stop", required = true)
|
|
|
|
- @Parameter(name = "speed", description = "移动速度", required = false)
|
|
|
|
|
|
+ @Parameter(name = "c", description = "控制指令,允许值: left, right, up, down, stop", required = true)
|
|
|
|
+ @Parameter(name = "step", description = "移动速度", required = false)
|
|
@PostMapping("/c/{deviceId}/{channelId}")
|
|
@PostMapping("/c/{deviceId}/{channelId}")
|
|
- public void newPTZ(@PathVariable String deviceId,@PathVariable String channelId, String command,int speed){
|
|
|
|
|
|
+ public void newPTZ(@PathVariable String deviceId,@PathVariable String channelId, String c,String step){
|
|
if (logger.isDebugEnabled()) {
|
|
if (logger.isDebugEnabled()) {
|
|
- logger.debug(String.format("设备云台控制 API调用,deviceId:%s ,channelId:%s ,command:%s ,speed:%d ",deviceId, channelId, command, speed));
|
|
|
|
|
|
+ logger.debug(String.format("设备云台控制 API调用,deviceId:%s ,channelId:%s ,c:%s ,speed:%d ",deviceId, channelId, c, step));
|
|
}
|
|
}
|
|
|
|
+ logger.info("设备云台控制 API调用,deviceId:{} ,channelId:{} ,command:{} ,speed:{} ",deviceId, channelId, c, step);
|
|
Device device = storager.queryVideoDevice(deviceId);
|
|
Device device = storager.queryVideoDevice(deviceId);
|
|
int cmdCode = 0;
|
|
int cmdCode = 0;
|
|
- switch (command){
|
|
|
|
|
|
+ switch (c){
|
|
case "left":
|
|
case "left":
|
|
cmdCode = 3;
|
|
cmdCode = 3;
|
|
break;
|
|
break;
|
|
@@ -142,6 +143,13 @@ public class PtzController {
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ int defaultValue = 0; // 默认值
|
|
|
|
+ int speed;
|
|
|
|
+ try {
|
|
|
|
+ speed = Integer.parseInt(step);
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ speed = defaultValue;
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
cmder.ptzCmdNew(device, channelId, cmdCode,speed);
|
|
cmder.ptzCmdNew(device, channelId, cmdCode,speed);
|
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|