Browse Source

优化页面云台逻辑,重新设计预置点/巡航组/自动扫描/雨刷/辅助开关的页面,支持光圈放大缩小,支持焦距放大缩小

648540858 11 months ago
parent
commit
d720275ada

+ 80 - 47
src/main/java/com/genersoft/iot/vmp/gb28181/controller/PtzController.java

@@ -43,17 +43,26 @@ public class PtzController {
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
 	@Parameter(name = "cmdCode", description = "指令码(对应国标文档指令格式中的字节4)", required = true)
-	@Parameter(name = "parameter1", description = "数据一(对应国标文档指令格式中的字节5)", required = true)
-	@Parameter(name = "parameter2", description = "数据二(对应国标文档指令格式中的字节6)", required = true)
-	@Parameter(name = "combindCode2", description = "组合码二(对应国标文档指令格式中的字节7:组合码2,高4位是数据3,低4位是地址的高4位)", required = true)
-	@PostMapping("/common/{deviceId}/{channelId}")
-	public void frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int parameter1, int parameter2, int combindCode2){
+	@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)
+	@GetMapping("/common/{deviceId}/{channelId}")
+	public void frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,Integer cmdCode, Integer parameter1, Integer parameter2, Integer combindCode2){
 
 		if (log.isDebugEnabled()) {
 			log.debug(String.format("设备云台控制 API调用,deviceId:%s ,channelId:%s ,cmdCode:%d parameter1:%d parameter2:%d",deviceId, channelId, cmdCode, parameter1, parameter2));
 		}
 		Device device = deviceService.getDeviceByDeviceId(deviceId);
 
+		if (parameter1 == null || parameter1 < 0 || parameter1 > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 1-255的数字");
+		}
+		if (parameter2 == null || parameter2 < 0 || parameter2 > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 1-255的数字");
+		}
+		if (combindCode2 == null || combindCode2 < 0 || combindCode2 > 16) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 1-255的数字");
+		}
 		try {
 			cmder.frontEndCmd(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
 		} catch (SipException | InvalidArgumentException | ParseException e) {
@@ -69,12 +78,27 @@ public class PtzController {
 	@Parameter(name = "horizonSpeed", description = "水平速度(0-255)", required = true)
 	@Parameter(name = "verticalSpeed", description = "垂直速度(0-255)", required = true)
 	@Parameter(name = "zoomSpeed", description = "缩放速度(0-16)", required = true)
-	@PostMapping("/ptz/{deviceId}/{channelId}")
-	public void ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, int horizonSpeed, int verticalSpeed, int zoomSpeed){
+	@GetMapping("/ptz/{deviceId}/{channelId}")
+	public void ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, Integer horizonSpeed, Integer verticalSpeed, Integer zoomSpeed){
 
 		if (log.isDebugEnabled()) {
 			log.debug(String.format("设备云台控制 API调用,deviceId:%s ,channelId:%s ,command:%s ,horizonSpeed:%d ,verticalSpeed:%d ,zoomSpeed:%d",deviceId, channelId, command, horizonSpeed, verticalSpeed, zoomSpeed));
 		}
+		if (horizonSpeed == null) {
+			horizonSpeed = 100;
+		}else if (horizonSpeed < 0 || horizonSpeed > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "horizonSpeed 为 1-255的数字");
+		}
+		if (verticalSpeed == null) {
+			verticalSpeed = 100;
+		}else if (verticalSpeed < 0 || verticalSpeed > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "verticalSpeed 为 1-255的数字");
+		}
+		if (zoomSpeed == null) {
+			zoomSpeed = 16;
+		}else if (zoomSpeed < 0 || zoomSpeed > 16) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "zoomSpeed 为 1-255的数字");
+		}
 
 		int cmdCode = 0;
 		switch (command){
@@ -125,8 +149,8 @@ public class PtzController {
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
 	@Parameter(name = "command", description = "控制指令,允许值: in, out, stop", required = true)
 	@Parameter(name = "speed", description = "光圈速度(0-255)", required = true)
-	@PostMapping("/fi/iris/{deviceId}/{channelId}")
-	public void iris(@PathVariable String deviceId,@PathVariable String channelId, String command, int speed){
+	@GetMapping("/fi/iris/{deviceId}/{channelId}")
+	public void iris(@PathVariable String deviceId,@PathVariable String channelId, String command, Integer speed){
 
 		if (log.isDebugEnabled()) {
 			log.debug("设备光圈控制 API调用,deviceId:{} ,channelId:{} ,command:{} ,speed:{} ",deviceId, channelId, command, speed);
@@ -135,10 +159,10 @@ public class PtzController {
 		int cmdCode = 0x40;
 		switch (command){
 			case "in":
-				cmdCode = 0x48;
+				cmdCode = 0x44;
 				break;
 			case "out":
-				cmdCode = 0x44;
+				cmdCode = 0x48;
 				break;
 			case "stop":
 				speed = 0;
@@ -154,13 +178,19 @@ public class PtzController {
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
 	@Parameter(name = "command", description = "控制指令,允许值: near, far, stop", required = true)
 	@Parameter(name = "speed", description = "聚焦速度(0-255)", required = true)
-	@PostMapping("/fi/focus/{deviceId}/{channelId}")
-	public void focus(@PathVariable String deviceId,@PathVariable String channelId, String command, int speed){
+	@GetMapping("/fi/focus/{deviceId}/{channelId}")
+	public void focus(@PathVariable String deviceId,@PathVariable String channelId, String command, Integer speed){
 
 		if (log.isDebugEnabled()) {
 			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(), "verticalSpeed 为 1-255的数字");
+		}
+
 		int cmdCode = 0x40;
 		switch (command){
 			case "near":
@@ -221,7 +251,7 @@ public class PtzController {
 	@Operation(summary = "预置位指令-设置预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
-	@Parameter(name = "presetId", description = "预置位编号(0-255)", required = true)
+	@Parameter(name = "presetId", description = "预置位编号(1-255)", required = true)
 	@GetMapping("/preset/add/{deviceId}/{channelId}")
 	public void addPreset(@PathVariable String deviceId, @PathVariable String channelId, Integer presetId) {
 		if (presetId == null || presetId < 1 || presetId > 255) {
@@ -233,7 +263,7 @@ public class PtzController {
 	@Operation(summary = "预置位指令-调用预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
-	@Parameter(name = "presetId", description = "预置位编号(0-255)", required = true)
+	@Parameter(name = "presetId", description = "预置位编号(1-255)", required = true)
 	@GetMapping("/preset/call/{deviceId}/{channelId}")
 	public void callPreset(@PathVariable String deviceId, @PathVariable String channelId, Integer presetId) {
 		if (presetId == null || presetId < 1 || presetId > 255) {
@@ -245,7 +275,7 @@ public class PtzController {
 	@Operation(summary = "预置位指令-删除预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
-	@Parameter(name = "presetId", description = "预置位编号(0-255)", required = true)
+	@Parameter(name = "presetId", description = "预置位编号(1-255)", required = true)
 	@GetMapping("/preset/delete/{deviceId}/{channelId}")
 	public void deletePreset(@PathVariable String deviceId, @PathVariable String channelId, Integer presetId) {
 		if (presetId == null || presetId < 1 || presetId > 255) {
@@ -258,10 +288,10 @@ public class PtzController {
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
 	@Parameter(name = "cruiseId", description = "巡航组号(0-255)", required = true)
-	@Parameter(name = "presetId", description = "预置位编号(0-255)", required = true)
+	@Parameter(name = "presetId", description = "预置位编号(1-255)", required = true)
 	@GetMapping("/cruise/point/add/{deviceId}/{channelId}")
 	public void addCruisePoint(@PathVariable String deviceId, @PathVariable String channelId, Integer cruiseId, Integer presetId) {
-		if (presetId == null || cruiseId == null || presetId < 1 || presetId > 255 || cruiseId < 1 || cruiseId > 255) {
+		if (presetId == null || cruiseId == null || presetId < 1 || presetId > 255 || cruiseId < 0 || cruiseId > 255) {
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "编号必须为1-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0x84, cruiseId, presetId, 0);
@@ -274,8 +304,11 @@ public class PtzController {
 	@Parameter(name = "presetId", description = "预置位编号(0-255, 为0时删除整个巡航)", required = true)
 	@GetMapping("/cruise/point/delete/{deviceId}/{channelId}")
 	public void deleteCruisePoint(@PathVariable String deviceId, @PathVariable String channelId, Integer cruiseId, Integer presetId) {
-		if (presetId == null || cruiseId == null || presetId < 0 || presetId > 255 || cruiseId < 1 || cruiseId > 255) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "编号必须为1-255之间的数字");
+		if (presetId == null || presetId < 0 || presetId > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "预置位编号必须为0-255之间的数字, 为0时删除整个巡航");
+		}
+		if (cruiseId == null || cruiseId < 0 || cruiseId > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "巡航组号必须为0-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0x85, cruiseId, presetId, 0);
 	}
@@ -287,14 +320,14 @@ public class PtzController {
 	@Parameter(name = "speed", description = "巡航速度(1-4095)", required = true)
 	@GetMapping("/cruise/speed/{deviceId}/{channelId}")
 	public void setCruiseSpeed(@PathVariable String deviceId, @PathVariable String channelId, Integer cruiseId, Integer speed) {
-		if (cruiseId == null || cruiseId < 1 || cruiseId > 255) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "编号必须为1-255之间的数字");
+		if (cruiseId == null || cruiseId < 0 || cruiseId > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "巡航组号必须为0-255之间的数字");
 		}
 		if (speed == null || speed < 1 || speed > 4095) {
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "巡航速度必须为1-4095之间的数字");
 		}
-		int parameter2 = speed >> 4;
-		int combindCode2 =  speed - parameter2 << 4 ;
+		int parameter2 = speed & 0xFF;
+		int combindCode2 =  speed >> 8;
 		frontEndCommand(deviceId, channelId, 0x86, cruiseId, parameter2, combindCode2);
 	}
 
@@ -305,14 +338,14 @@ public class PtzController {
 	@Parameter(name = "time", description = "巡航停留时间(1-4095)", required = true)
 	@GetMapping("/cruise/time/{deviceId}/{channelId}")
 	public void setCruiseTime(@PathVariable String deviceId, @PathVariable String channelId, Integer cruiseId, Integer time) {
-		if (cruiseId == null || cruiseId < 1 || cruiseId > 255) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "编号必须为1-255之间的数字");
+		if (cruiseId == null || cruiseId < 0 || cruiseId > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "巡航组号必须为0-255之间的数字");
 		}
 		if (time == null || time < 1 || time > 4095) {
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "巡航停留时间必须为1-4095之间的数字");
 		}
-		int parameter2 = time >> 4;
-		int combindCode2 =  time - parameter2 << 4 ;
+		int parameter2 = time & 0xFF;
+		int combindCode2 =  time >> 8;
 		frontEndCommand(deviceId, channelId, 0x87, cruiseId, parameter2, combindCode2);
 	}
 
@@ -322,8 +355,8 @@ public class PtzController {
 	@Parameter(name = "cruiseId", description = "巡航组号)", required = true)
 	@GetMapping("/cruise/start/{deviceId}/{channelId}")
 	public void startCruise(@PathVariable String deviceId, @PathVariable String channelId, Integer cruiseId) {
-		if (cruiseId == null || cruiseId < 1 || cruiseId > 255) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "编号必须为1-255之间的数字");
+		if (cruiseId == null || cruiseId < 0 || cruiseId > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "巡航组号必须为0-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0x88, cruiseId, 0, 0);
 	}
@@ -334,8 +367,8 @@ public class PtzController {
 	@Parameter(name = "cruiseId", description = "巡航组号", required = true)
 	@GetMapping("/cruise/stop/{deviceId}/{channelId}")
 	public void stopCruise(@PathVariable String deviceId, @PathVariable String channelId, Integer cruiseId) {
-		if (cruiseId == null || cruiseId < 1 || cruiseId > 255) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "编号必须为1-255之间的数字");
+		if (cruiseId == null || cruiseId < 0 || cruiseId > 255) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "巡航组号必须为0-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0, 0, 0, 0);
 	}
@@ -346,8 +379,8 @@ public class PtzController {
 	@Parameter(name = "scanId", description = "扫描组号(0-255)", required = true)
 	@GetMapping("/scan/start/{deviceId}/{channelId}")
 	public void startScan(@PathVariable String deviceId, @PathVariable String channelId, Integer scanId) {
-		if (scanId == null || scanId < 1 || scanId > 255 ) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为1-255之间的数字");
+		if (scanId == null || scanId < 0 || scanId > 255 ) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为0-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0x89, scanId, 0, 0);
 	}
@@ -358,8 +391,8 @@ public class PtzController {
 	@Parameter(name = "scanId", description = "扫描组号(0-255)", required = true)
 	@GetMapping("/scan/stop/{deviceId}/{channelId}")
 	public void stopScan(@PathVariable String deviceId, @PathVariable String channelId, Integer scanId) {
-		if (scanId == null || scanId < 1 || scanId > 255 ) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为1-255之间的数字");
+		if (scanId == null || scanId < 0 || scanId > 255 ) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为0-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0, 0, 0, 0);
 	}
@@ -370,8 +403,8 @@ public class PtzController {
 	@Parameter(name = "scanId", description = "扫描组号(0-255)", required = true)
 	@GetMapping("/scan/set/left/{deviceId}/{channelId}")
 	public void setScanLeft(@PathVariable String deviceId, @PathVariable String channelId, Integer scanId) {
-		if (scanId == null || scanId < 1 || scanId > 255 ) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为1-255之间的数字");
+		if (scanId == null || scanId < 0 || scanId > 255 ) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为0-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0x89, scanId, 1, 0);
 	}
@@ -382,8 +415,8 @@ public class PtzController {
 	@Parameter(name = "scanId", description = "扫描组号(0-255)", required = true)
 	@GetMapping("/scan/set/right/{deviceId}/{channelId}")
 	public void setScanRight(@PathVariable String deviceId, @PathVariable String channelId, Integer scanId) {
-		if (scanId == null || scanId < 1 || scanId > 255 ) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为1-255之间的数字");
+		if (scanId == null || scanId < 0 || scanId > 255 ) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为0-255之间的数字");
 		}
 		frontEndCommand(deviceId, channelId, 0x89, scanId, 2, 0);
 	}
@@ -393,17 +426,17 @@ public class PtzController {
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
 	@Parameter(name = "scanId", description = "扫描组号(0-255)", required = true)
-	@Parameter(name = "speed", description = "自动扫描速度(1-16)", required = true)
+	@Parameter(name = "speed", description = "自动扫描速度(1-4095)", required = true)
 	@GetMapping("/scan/set/speed/{deviceId}/{channelId}")
 	public void setScanSpeed(@PathVariable String deviceId, @PathVariable String channelId, Integer scanId, Integer speed) {
-		if (scanId == null || scanId < 1 || scanId > 255 ) {
-			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为1-255之间的数字");
+		if (scanId == null || scanId < 0 || scanId > 255 ) {
+			throw new ControllerException(ErrorCode.ERROR100.getCode(), "扫描组号必须为0-255之间的数字");
 		}
 		if (speed == null || speed < 1 || speed > 4095) {
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "自动扫描速度必须为1-4095之间的数字");
 		}
-		int parameter2 = speed >> 4;
-		int combindCode2 =  speed - parameter2 << 4 ;
+		int parameter2 = speed & 0xFF;
+		int combindCode2 =  speed >> 8;
 		frontEndCommand(deviceId, channelId, 0x8A, scanId, parameter2, combindCode2);
 	}
 
@@ -412,7 +445,7 @@ public class PtzController {
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
 	@Parameter(name = "command", description = "控制指令,允许值: on, off", required = true)
-	@PostMapping("/wiper/{deviceId}/{channelId}")
+	@GetMapping("/wiper/{deviceId}/{channelId}")
 	public void wiper(@PathVariable String deviceId,@PathVariable String channelId, String command){
 
 		if (log.isDebugEnabled()) {
@@ -438,7 +471,7 @@ public class PtzController {
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
 	@Parameter(name = "command", description = "控制指令,允许值: on, off", required = true)
 	@Parameter(name = "switchId", description = "开关编号", required = true)
-	@PostMapping("/auxiliary/{deviceId}/{channelId}")
+	@GetMapping("/auxiliary/{deviceId}/{channelId}")
 	public void auxiliarySwitch(@PathVariable String deviceId,@PathVariable String channelId, String command, Integer switchId){
 
 		if (log.isDebugEnabled()) {

+ 1 - 5
src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java

@@ -8,7 +8,6 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -91,17 +90,14 @@ public class SSRCFactory {
      * 获取后四位数SN,随机数
      */
     private String getSN(String mediaServerId) {
-        String sn = null;
         String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
         Long size = redisTemplate.opsForSet().size(redisKey);
         if (size == null || size == 0) {
             throw new RuntimeException("ssrc已经用完");
         } else {
             // 在集合中移除并返回一个随机成员。
-            sn = (String) redisTemplate.opsForSet().pop(redisKey);
-            redisTemplate.opsForSet().remove(redisKey, sn);
+            return redisTemplate.opsForSet().pop(redisKey);
         }
-        return sn;
     }
 
     /**

+ 3 - 8
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@@ -142,15 +142,10 @@ public class SIPCommander implements ISIPCommander {
         builder.append(strTmp, 0, 2);
         strTmp = String.format("%02X", parameter2);
         builder.append(strTmp, 0, 2);
-        //优化zoom变倍速率
-        if ((combineCode2 > 0) && (combineCode2 <16))
-        {
-            combineCode2 = 16;
-        }
-        strTmp = String.format("%X", combineCode2);
-        builder.append(strTmp, 0, 1).append("0");
+        strTmp = String.format("%02X", combineCode2 << 4);
+        builder.append(strTmp, 0, 2);
         //计算校验码
-        int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + parameter1 + parameter2 + (combineCode2 & 0XF0)) % 0X100;
+        int checkCode = (0XA5 + 0X0F + 0X01 + cmdCode + parameter1 + parameter2 + (combineCode2 << 4)) % 0X100;
         strTmp = String.format("%02X", checkCode);
         builder.append(strTmp, 0, 2);
         return builder.toString();

+ 1 - 1
web_src/src/components/common/ptzCruising.vue

@@ -227,7 +227,7 @@ export default {
           }
         }).then((res)=> {
           if (res.data.code === 0) {
-            this.presetList.splice(index, 1)
+            this.presetList = []
           }else {
             this.$message({
               showClose: true,

+ 90 - 0
web_src/src/components/common/ptzSwitch.vue

@@ -0,0 +1,90 @@
+<template>
+  <div id="ptzScan">
+    <el-form size="mini" :inline="true" >
+      <el-form-item >
+        <el-input
+          min="1"
+          max="4095"
+          placeholder="开关编号"
+          addonBefore="开关编号"
+          addonAfter="(2-255)"
+          v-model="switchId"
+          size="mini"
+        >
+        </el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button size="mini" @click="open('on')">开启</el-button>
+        <el-button size="mini" @click="open('off')">关闭</el-button>
+      </el-form-item>
+    </el-form>
+
+  </div>
+</template>
+
+<script>
+
+export default {
+  name: "ptzScan",
+  props: [ 'channelDeviceId', 'deviceId'],
+  components: {},
+  created() {
+  },
+  data() {
+    return {
+      switchId: 1,
+    };
+  },
+  methods: {
+    open: function (command){
+      const loading = this.$loading({
+        lock: true,
+        fullscreen: true,
+        text: '正在发送指令',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
+      this.$axios({
+        method: 'get',
+        url: `/api/front-end/auxiliary/${this.deviceId}/${this.channelDeviceId}`,
+        params: {
+          command: command,
+          switchId: this.switchId,
+        }
+      }).then((res)=> {
+        if (res.data.code === 0) {
+          this.$message({
+            showClose: true,
+            message: "保存成功",
+            type: 'success'
+          });
+        }else {
+          this.$message({
+            showClose: true,
+            message: res.data.msg,
+            type: 'error'
+          });
+        }
+      }).catch((error)=> {
+        this.$message({
+          showClose: true,
+          message: error,
+          type: 'error'
+        });
+      }).finally(()=>{
+        loading.close()
+      })
+    },
+  },
+};
+</script>
+<style>
+.channel-form {
+  display: grid;
+  background-color: #FFFFFF;
+  padding: 1rem 2rem 0 2rem;
+  grid-template-columns: 1fr 1fr 1fr;
+  gap: 1rem;
+}
+
+</style>

+ 70 - 0
web_src/src/components/common/ptzWiper.vue

@@ -0,0 +1,70 @@
+<template>
+  <div id="ptzWiper">
+    <el-button size="mini" @click="open('on')">开启</el-button>
+    <el-button size="mini" @click="open('off')">关闭</el-button>
+  </div>
+</template>
+
+<script>
+
+export default {
+  name: "ptzWiper",
+  props: [ 'channelDeviceId', 'deviceId'],
+  components: {},
+  created() {
+  },
+  data() {
+    return {};
+  },
+  methods: {
+    open: function (command){
+      const loading = this.$loading({
+        lock: true,
+        fullscreen: true,
+        text: '正在发送指令',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
+      this.$axios({
+        method: 'get',
+        url: `/api/front-end/wiper/${this.deviceId}/${this.channelDeviceId}`,
+        params: {
+          command: command,
+        }
+      }).then((res)=> {
+        if (res.data.code === 0) {
+          this.$message({
+            showClose: true,
+            message: "保存成功",
+            type: 'success'
+          });
+        }else {
+          this.$message({
+            showClose: true,
+            message: res.data.msg,
+            type: 'error'
+          });
+        }
+      }).catch((error)=> {
+        this.$message({
+          showClose: true,
+          message: error,
+          type: 'error'
+        });
+      }).finally(()=>{
+        loading.close()
+      })
+    },
+  },
+};
+</script>
+<style>
+.channel-form {
+  display: grid;
+  background-color: #FFFFFF;
+  padding: 1rem 2rem 0 2rem;
+  grid-template-columns: 1fr 1fr 1fr;
+  gap: 1rem;
+}
+
+</style>

+ 81 - 33
web_src/src/components/dialog/devicePlayer.vue

@@ -155,35 +155,58 @@
           <!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}-->
           <!--遥控界面-->
           <el-tab-pane label="云台控制" name="control" v-if="showPtz">
-            <div style="display: grid; grid-template-columns: 200px auto; height: 180px; overflow: auto">
-              <div class="control-wrapper">
-                <div class="control-btn control-top" @mousedown="ptzCamera('up')" @mouseup="ptzCamera('stop')">
-                  <i class="el-icon-caret-top"></i>
-                  <div class="control-inner-btn control-inner"></div>
+            <div style="display: grid; grid-template-columns: 240px auto; height: 180px; overflow: auto">
+              <div style="display: grid; grid-template-columns: 6.25rem auto;">
+
+                <div class="control-wrapper">
+                  <div class="control-btn control-top" @mousedown="ptzCamera('up')" @mouseup="ptzCamera('stop')">
+                    <i class="el-icon-caret-top"></i>
+                    <div class="control-inner-btn control-inner"></div>
+                  </div>
+                  <div class="control-btn control-left" @mousedown="ptzCamera('left')" @mouseup="ptzCamera('stop')">
+                    <i class="el-icon-caret-left"></i>
+                    <div class="control-inner-btn control-inner"></div>
+                  </div>
+                  <div class="control-btn control-bottom" @mousedown="ptzCamera('down')" @mouseup="ptzCamera('stop')">
+                    <i class="el-icon-caret-bottom"></i>
+                    <div class="control-inner-btn control-inner"></div>
+                  </div>
+                  <div class="control-btn control-right" @mousedown="ptzCamera('right')" @mouseup="ptzCamera('stop')">
+                    <i class="el-icon-caret-right"></i>
+                    <div class="control-inner-btn control-inner"></div>
+                  </div>
+                  <div class="control-round">
+                    <div class="control-round-inner"><i class="fa fa-pause-circle"></i></div>
+                  </div>
+                  <div class="contro-speed" style="position: absolute; left: 4px; top: 7rem; width: 6.25rem;">
+                    <el-slider v-model="controSpeed" :max="100"></el-slider>
+                  </div>
                 </div>
-                <div class="control-btn control-left" @mousedown="ptzCamera('left')" @mouseup="ptzCamera('stop')">
-                  <i class="el-icon-caret-left"></i>
-                  <div class="control-inner-btn control-inner"></div>
-                </div>
-                <div class="control-btn control-bottom" @mousedown="ptzCamera('down')" @mouseup="ptzCamera('stop')">
-                  <i class="el-icon-caret-bottom"></i>
-                  <div class="control-inner-btn control-inner"></div>
-                </div>
-                <div class="control-btn control-right" @mousedown="ptzCamera('right')" @mouseup="ptzCamera('stop')">
-                  <i class="el-icon-caret-right"></i>
-                  <div class="control-inner-btn control-inner"></div>
-                </div>
-                <div class="control-round">
-                  <div class="control-round-inner"><i class="fa fa-pause-circle"></i></div>
-                </div>
-                <div style="position: absolute; left: 7.25rem; top: 1.25rem" @mousedown="ptzCamera('zoomin')"
-                     @mouseup="ptzCamera('stop')"><i class="el-icon-zoom-in control-zoom-btn"
-                                                     style="font-size: 1.875rem;"></i></div>
-                <div style="position: absolute; left: 7.25rem; top: 3.25rem; font-size: 1.875rem;"
-                     @mousedown="ptzCamera('zoomout')" @mouseup="ptzCamera('stop')"><i
-                  class="el-icon-zoom-out control-zoom-btn"></i></div>
-                <div class="contro-speed" style="position: absolute; left: 4px; top: 7rem; width: 9rem;">
-                  <el-slider v-model="controSpeed" :max="255"></el-slider>
+                <div>
+                  <div class="ptz-btn-box">
+                    <div style="" @mousedown="ptzCamera('zoomin')" @mouseup="ptzCamera('stop')" title="变倍+">
+                      <i class="el-icon-zoom-in control-zoom-btn" style="font-size: 1.5rem;"></i>
+                    </div>
+                    <div style="" @mousedown="ptzCamera('zoomout')" @mouseup="ptzCamera('stop')" title="变倍-">
+                      <i class="el-icon-zoom-out control-zoom-btn" style="font-size: 1.5rem;"></i>
+                    </div>
+                  </div>
+                  <div class="ptz-btn-box">
+                    <div @mousedown="focusCamera('near')"  @mouseup="focusCamera('stop')" title="聚焦+">
+                      <i class="iconfont icon-bianjiao-fangda control-zoom-btn" style="font-size: 1.5rem;"></i>
+                    </div>
+                    <div @mousedown="focusCamera('far')" @mouseup="focusCamera('stop')" title="聚焦-">
+                      <i class="iconfont icon-bianjiao-suoxiao control-zoom-btn" style="font-size: 1.5rem;"></i>
+                    </div>
+                  </div>
+                  <div class="ptz-btn-box">
+                    <div @mousedown="irisCamera('in')"  @mouseup="irisCamera('stop')" title="光圈+">
+                      <i class="iconfont icon-guangquan control-zoom-btn" style="font-size: 1.5rem;"></i>
+                    </div>
+                    <div @mousedown="pirisCamera('out')" @mouseup="irisCamera('stop')" title="光圈-">
+                      <i class="iconfont icon-guangquan- control-zoom-btn" style="font-size: 1.5rem;"></i>
+                    </div>
+                  </div>
                 </div>
               </div>
               <div style="text-align: left" >
@@ -194,15 +217,17 @@
                   placeholder="请选择云台功能"
                 >
                   <el-option label="预置点" value="preset"></el-option>
-                  <el-option label="巡航组" value="cruising"></el-option>
+                  <el-option label="巡航组" value="cruise"></el-option>
                   <el-option label="自动扫描" value="scan"></el-option>
                   <el-option label="雨刷" value="wiper"></el-option>
+                  <el-option label="辅助开关" value="switch"></el-option>
                 </el-select>
 
                 <ptzPreset :channelDeviceId="channelId" :deviceId="deviceId" v-if="ptzMethod === 'preset'" style="margin-top: 1rem"></ptzPreset>
                 <ptzCruising :channelDeviceId="channelId" :deviceId="deviceId" v-if="ptzMethod === 'cruise'" style="margin-top: 1rem"></ptzCruising>
                 <ptzScan :channelDeviceId="channelId" :deviceId="deviceId" v-if="ptzMethod === 'scan'" style="margin-top: 1rem"></ptzScan>
-<!--                <ptzWiper :channelDeviceId="channelId" :deviceId="deviceId" v-if="ptzMethod === 'wiper'" style="margin-top: 1rem"></ptzWiper>-->
+                <ptzWiper :channelDeviceId="channelId" :deviceId="deviceId" v-if="ptzMethod === 'wiper'" style="margin-top: 1rem"></ptzWiper>
+                <ptzSwitch :channelDeviceId="channelId" :deviceId="deviceId" v-if="ptzMethod === 'switch'" style="margin-top: 1rem"></ptzSwitch>
               </div>
             </div>
           </el-tab-pane>
@@ -266,12 +291,14 @@ import jessibucaPlayer from '../common/jessibuca.vue'
 import PtzPreset from "../common/ptzPreset.vue";
 import PtzCruising from "../common/ptzCruising.vue";
 import ptzScan from "../common/ptzScan.vue";
+import ptzWiper from "../common/ptzWiper.vue";
+import ptzSwitch from "../common/ptzSwitch.vue";
 
 export default {
   name: 'devicePlayer',
   props: {},
   components: {
-    PtzPreset,PtzCruising,ptzScan,
+    PtzPreset,PtzCruising,ptzScan,ptzWiper,ptzSwitch,
     LivePlayer, jessibucaPlayer, rtcPlayer,
   },
   computed: {
@@ -537,8 +564,22 @@ export default {
       console.log('云台控制:' + command);
       let that = this;
       this.$axios({
-        method: 'post',
-        url: '/api/front-end/ptz/' + this.deviceId + '/' + this.channelId + '?command=' + command + '&horizonSpeed=' + this.controSpeed + '&verticalSpeed=' + this.controSpeed + '&zoomSpeed=' + this.controSpeed
+        method: 'get',
+        url: '/api/front-end/ptz/' + this.deviceId + '/' + this.channelId + '?command=' + command + '&horizonSpeed=' + parseInt(this.controSpeed * 255/100) + '&verticalSpeed=' + parseInt(this.controSpeed * 255/100) + '&zoomSpeed=' + parseInt(this.controSpeed * 16/100)
+      }).then(function (res) {
+      });
+    },
+    irisCamera: function (command) {
+      this.$axios({
+        method: 'get',
+        url: '/api/front-end/fi/iris/' + this.deviceId + '/' + this.channelId + '?command=' + command + '&speed=' + parseInt(this.controSpeed * 255/100)
+      }).then(function (res) {
+      });
+    },
+    focusCamera: function (command) {
+      this.$axios({
+        method: 'get',
+        url: '/api/front-end/fi/focus/' + this.deviceId + '/' + this.channelId + '?command=' + command + '&speed=' + parseInt(this.controSpeed * 255/100)
       }).then(function (res) {
       });
     },
@@ -946,4 +987,11 @@ export default {
 .el-dialog__body{
   padding: 10px 20px;
 }
+.ptz-btn-box {
+  display: grid;
+  grid-template-columns: 1fr 1fr;
+  padding: 0 2rem;
+  height: 3rem;
+  line-height: 4rem;
+}
 </style>

+ 19 - 3
web_src/static/css/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 1291092 */
-  src: url('iconfont.woff2?t=1726109971995') format('woff2'),
-       url('iconfont.woff?t=1726109971995') format('woff'),
-       url('iconfont.ttf?t=1726109971995') format('truetype');
+  src: url('iconfont.woff2?t=1731484250872') format('woff2'),
+       url('iconfont.woff?t=1731484250872') format('woff'),
+       url('iconfont.ttf?t=1731484250872') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,22 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-bianjiao-suoxiao:before {
+  content: "\e8c8";
+}
+
+.icon-bianjiao-fangda:before {
+  content: "\e8c9";
+}
+
+.icon-guangquan-:before {
+  content: "\e7e9";
+}
+
+.icon-guangquan:before {
+  content: "\e7ea";
+}
+
 .icon-a-mti-1fenpingshi:before {
   content: "\e7e5";
 }

BIN
web_src/static/css/iconfont.woff2