From daeb48f62a84ae4deab8b9df0e75e505010fef7c Mon Sep 17 00:00:00 2001 From: claire Date: Thu, 2 Jan 2025 14:16:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=BA=91=E5=8F=B0=E6=8E=A7=E5=88=B6=E5=85=B3=E4=BA=8E=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E7=9A=84=E9=94=99=E8=AF=AF=E6=8F=8F=E8=BF=B0=EF=BC=8C?= =?UTF-8?q?=E6=B0=B4=E5=B9=B3=E5=9E=82=E7=9B=B4=E6=8E=A7=E5=88=B6=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E4=B8=BA00H~FFH(0-255),=E5=8F=98=E5=80=8D=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E9=80=9F=E5=BA=A6=E4=B8=BA0H~FH(0-15)=EF=BC=8C?= =?UTF-8?q?=E8=81=9A=E7=84=A6=E9=80=9F=E5=BA=A6=E4=B8=BA00H~FFH(0-255),?= =?UTF-8?q?=E5=85=89=E5=9C=88=E9=80=9F=E5=BA=A6=E4=B8=BA00H~FFH(0-255)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/gb28181/controller/PtzController.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java index 3b87d1cf..1f9cfa27 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java @@ -53,7 +53,7 @@ public class PtzController { @Parameter(name = "cmdCode", description = "指令码(对应国标文档指令格式中的字节4)", required = true) @Parameter(name = "parameter1", description = "数据一(对应国标文档指令格式中的字节5, 范围0-255)", required = true) @Parameter(name = "parameter2", description = "数据二(对应国标文档指令格式中的字节6, 范围0-255)", required = true) - @Parameter(name = "combindCode2", description = "组合码二(对应国标文档指令格式中的字节7, 范围0-16)", required = true) + @Parameter(name = "combindCode2", description = "组合码二(对应国标文档指令格式中的字节7, 范围0-15)", required = true) @GetMapping("/common/{deviceId}/{channelId}") public void frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,Integer cmdCode, Integer parameter1, Integer parameter2, Integer combindCode2){ @@ -62,13 +62,13 @@ public class PtzController { } if (parameter1 == null || parameter1 < 0 || parameter1 > 255) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 1-255的数字"); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 0-255的数字"); } if (parameter2 == null || parameter2 < 0 || parameter2 > 255) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 1-255的数字"); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter2 为 0-255的数字"); } - if (combindCode2 == null || combindCode2 < 0 || combindCode2 > 16) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 1-255的数字"); + if (combindCode2 == null || combindCode2 < 0 || combindCode2 > 15) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "combindCode2 为 0-15的数字"); } Device device = deviceService.getDeviceByDeviceId(deviceId); @@ -84,7 +84,7 @@ public class PtzController { @Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true) @Parameter(name = "horizonSpeed", description = "水平速度(0-255)", required = true) @Parameter(name = "verticalSpeed", description = "垂直速度(0-255)", required = true) - @Parameter(name = "zoomSpeed", description = "缩放速度(0-16)", required = true) + @Parameter(name = "zoomSpeed", description = "缩放速度(0-15)", required = true) @GetMapping("/ptz/{deviceId}/{channelId}") public void ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, Integer horizonSpeed, Integer verticalSpeed, Integer zoomSpeed){ @@ -94,17 +94,17 @@ public class PtzController { if (horizonSpeed == null) { horizonSpeed = 100; }else if (horizonSpeed < 0 || horizonSpeed > 255) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "horizonSpeed 为 1-255的数字"); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "horizonSpeed 为 0-255的数字"); } if (verticalSpeed == null) { verticalSpeed = 100; }else if (verticalSpeed < 0 || verticalSpeed > 255) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "verticalSpeed 为 1-255的数字"); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "verticalSpeed 为 0-255的数字"); } if (zoomSpeed == null) { zoomSpeed = 16; - }else if (zoomSpeed < 0 || zoomSpeed > 16) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "zoomSpeed 为 1-255的数字"); + }else if (zoomSpeed < 0 || zoomSpeed > 15) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "zoomSpeed 为 0-15的数字"); } int cmdCode = 0; @@ -195,7 +195,7 @@ public class PtzController { if (speed == null) { speed = 100; }else if (speed < 0 || speed > 255) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "verticalSpeed 为 1-255的数字"); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "speed 为 0-255的数字"); } int cmdCode = 0x40; From d7ebe933378239e0848c75c6690e025af85faaf4 Mon Sep 17 00:00:00 2001 From: claire Date: Thu, 2 Jan 2025 14:20:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=89=E5=9C=88?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E8=8C=83=E5=9B=B4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genersoft/iot/vmp/gb28181/controller/PtzController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java index 1f9cfa27..233050b6 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java @@ -163,6 +163,12 @@ public class PtzController { log.debug("设备光圈控制 API调用,deviceId:{} ,channelId:{} ,command:{} ,speed:{} ",deviceId, channelId, command, speed); } + if (speed == null) { + speed = 100; + }else if (speed < 0 || speed > 255) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "speed 为 0-255的数字"); + } + int cmdCode = 0x40; switch (command){ case "in":