From 59e369e37d52f8822b1abfe8994bf8ff7346c6d4 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 25 Nov 2021 11:04:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=BC=E5=AE=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/gb28181/ApiCompatibleController.java | 33 ----------------- .../vmp/web/gb28181/ApiControlController.java | 37 +++++++++---------- .../vmp/web/gb28181/ApiDeviceController.java | 2 +- 3 files changed, 18 insertions(+), 54 deletions(-) delete mode 100644 src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiCompatibleController.java diff --git a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiCompatibleController.java b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiCompatibleController.java deleted file mode 100644 index 5080bb03..00000000 --- a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiCompatibleController.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.genersoft.iot.vmp.web.gb28181; - -import com.genersoft.iot.vmp.common.StreamInfo; -import com.genersoft.iot.vmp.service.IMediaService; -import com.genersoft.iot.vmp.vmanager.bean.WVPResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; - -@CrossOrigin -@RestController -public class ApiCompatibleController { - - private final static Logger logger = LoggerFactory.getLogger(ApiCompatibleController.class); - - @Autowired - private IMediaService mediaService; - - @GetMapping(value = "/api/v1/stream_info_by_app_and_stream") - @ResponseBody - public WVPResult getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, @RequestParam String stream){ - String localAddr = request.getLocalAddr(); - StreamInfo streamINfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, localAddr); - WVPResult wvpResult = new WVPResult<>(); - wvpResult.setCode(0); - wvpResult.setMsg("success"); - wvpResult.setData(streamINfo); - return wvpResult; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java index f784d3e6..4c124cf3 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java +++ b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java @@ -45,49 +45,46 @@ public class ApiControlController { serial, code, command, speed)); } Device device = storager.queryVideoDevice(serial); - int leftRight = 0; - int upDown = 0; - int inOut = 0; - switch (command) { + int cmdCode = 0; + switch (command){ case "left": - leftRight = 1; + cmdCode = 2; break; case "right": - leftRight = 2; + cmdCode = 1; break; case "up": - upDown = 1; + cmdCode = 8; break; case "down": - upDown = 2; + cmdCode = 4; break; case "upleft": - upDown = 1; - leftRight = 1; + cmdCode = 10; + break; case "upright": - upDown = 1; - leftRight = 2; + cmdCode = 9; break; case "downleft": - upDown = 2; - leftRight = 1; + cmdCode = 6; break; case "downright": - upDown = 2; - leftRight = 2; + cmdCode = 5; break; case "zoomin": - inOut = 2; + cmdCode = 16; break; case "zoomout": - inOut = 1; + cmdCode = 32; break; case "stop": + cmdCode = 0; + break; + default: break; - } // 默认值 50 - cmder.ptzCmd(device, code, leftRight, upDown, inOut, speed==0 ? 129 : speed, 50); + cmder.frontEndCmd(device, code, cmdCode, speed, speed, speed); return null; } } diff --git a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java index 30942839..2a021a2f 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java +++ b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java @@ -73,7 +73,7 @@ public class ApiDeviceController { deviceJsonObject.put("ChannelCount", device.getChannelCount()); deviceJsonObject.put("RecvStreamIP", ""); deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期 - deviceJsonObject.put("SubscribeInterval", 0); // 订阅周期(秒), 0 表示后台不周期订阅 + deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(秒), 0 表示后台不周期订阅 deviceJsonObject.put("Online", device.getOnline() == 1); deviceJsonObject.put("Password", ""); deviceJsonObject.put("MediaTransport", device.getTransport());