From aaa07634fa899b7346dfd61c6f70962adbc1dca5 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期五, 20 十月 2023 08:55:02 +0800
Subject: [PATCH] 1. 增加聚焦值和获取接口。 2. 增加视频编码获取接口。 3. 流媒体通过编码自动切换是否转码。
---
ard-work/src/main/java/com/ruoyi/device/dhsdk/service/IDhClientService.java | 16
ard-work/src/main/resources/templates/test.html | 102 ++--
ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java | 4
ard-work/src/main/java/com/ruoyi/utils/tools/ArdTool.java | 16
ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/HCNetSDK.java | 2
ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java | 2
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java | 26
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java | 226 ++++++--
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/ConfigModule.java | 67 ++
ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/HikSdkController.java | 25
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/RealPlayModule.java | 17
ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java | 4
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java | 14
ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/structure/CFG_VIDEO_IN_FOCUS_UNIT.java | 54 +-
ard-work/src/main/java/com/ruoyi/device/dhsdk/controller/DhSdkController.java | 5
ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java | 31
ard-work/src/main/java/com/ruoyi/device/dhsdk/service/impl/DhClientServiceImpl.java | 316 +++++++++++-
ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java | 16
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java | 14
ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/enumeration/EM_FOCUS_LIMIT_SELECT_MODE.java | 2
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java | 12
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java | 53 +
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java | 323 +++++++------
ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java | 26 +
ard-work/src/main/java/com/ruoyi/device/camera/service/ICameraSdkService.java | 28
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 1
ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java | 25
27 files changed, 927 insertions(+), 500 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java
index b4b12e0..d67db60 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java
@@ -15,7 +15,7 @@
import com.ruoyi.alarm.tube.service.IArdAlarmTubeService;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.device.camera.domain.CameraCmd;
-import com.ruoyi.device.hiksdk.service.IHikClientService;
+import com.ruoyi.device.camera.service.ICameraSdkService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -39,7 +39,7 @@
@Resource
IArdAlarmRadarPumpService ardAlarmRadarPumpService;
@Resource
- IHikClientService hikClientService;
+ ICameraSdkService cameraSdkService;
@Resource
IArdAlarmTubeService ardAlarmTubeService;
@@ -58,17 +58,17 @@
cmd.setRecordBucketName("record");
cmd.setRecordObjectName("alarm_" + guideTask.getAlarmId());
log.debug("寮�濮嬪紩瀵�");
- boolean guideRes = hikClientService.guideTargetPosition(cmd);
+ boolean guideRes = cameraSdkService.guideTargetPosition(cmd);
if (guideRes) {
log.debug("寮曞鎴愬姛");
- hikClientService.controlLock(cmd);//涓婇攣
- hikClientService.recordStart(cmd);//寮�濮嬪綍鍍�
+ cameraSdkService.controlLock(cmd);//涓婇攣
+ cameraSdkService.recordStart(cmd);//寮�濮嬪綍鍍�
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
log.info("褰撳墠浠诲姟ID" + guideTask.getAlarmId() + "绾跨▼琚粓姝�");
}
- String url = hikClientService.recordStopToMinio(cmd);//鍋滄褰曞儚杩斿洖url
+ String url = cameraSdkService.recordStopToMinio(cmd);//鍋滄褰曞儚杩斿洖url
if (StringUtils.isNotEmpty(url)) {
switch (guideTask.getAlarmType()) {
case "sys_tube_leak":
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
index 2ffda2a..4a4976e 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
@@ -7,6 +7,8 @@
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.service.IArdCamerasService;
+import com.ruoyi.device.camera.service.ICameraSdkService;
+import com.ruoyi.device.camera.service.impl.CameraSdkServiceImpl;
import com.ruoyi.device.dhsdk.service.IDhClientService;
import com.ruoyi.device.hiksdk.service.IHikClientService;
import com.ruoyi.device.hiksdk.service.impl.HikClientServiceImpl;
@@ -49,6 +51,8 @@
private IHikClientService hikSdk;
@Resource
private IDhClientService dhSdk;
+ @Resource
+ private ICameraSdkService cameraSdkService;
@Resource
private IArdCamerasService ardCamerasService;
@Resource
@@ -99,17 +103,8 @@
public AjaxResult add(@RequestBody ArdCameras camera) {
int i = ardCamerasService.insertArdCameras(camera);
if (i > 0) {
- if (camera.getFactory().equals("1")) {
- //娉ㄩ攢
- hikSdk.logout(camera.getId());
- //寮傛鐧诲綍
- hikSdk.asyncLogin(camera);
- }
- else if(camera.getFactory().equals("2"))
- {
- dhSdk.logout(camera.getId());
- dhSdk.login(camera);
- }
+ cameraSdkService.logout(camera.getId());
+ cameraSdkService.login(camera);
}
return toAjax(i);
}
@@ -124,15 +119,8 @@
public AjaxResult edit(@RequestBody ArdCameras camera) {
int i = ardCamerasService.updateArdCameras(camera);
if (i > 0) {
- camera= ardCamerasService.selectArdCamerasById(camera.getId());
- if(camera.getFactory().equals("1")) {
- hikSdk.logout(camera.getId());
- hikSdk.asyncLogin(camera);
- }
- else if(camera.getFactory().equals("2")) {
- dhSdk.logout(camera.getId());
- dhSdk.login(camera);
- }
+ cameraSdkService.logout(camera.getId());
+ cameraSdkService.login(camera);
}
return toAjax(i);
}
@@ -146,8 +134,7 @@
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
for (String id : ids) {
- hikSdk.logout(id);
- dhSdk.logout(id);
+ cameraSdkService.logout(id);
}
return toAjax(ardCamerasService.deleteArdCamerasByIds(ids));
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java b/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java
index 81adfa8..186424c 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java
@@ -150,8 +150,8 @@
public @ResponseBody
AjaxResult getFocusPos(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
- Map<String, Object> Map = cameraSdkService.getFocusPos(cmd);
- return AjaxResult.success("鑾峰彇鑱氱劍鍊�", Map);
+ int focus = cameraSdkService.getFocusPos(cmd);
+ return AjaxResult.success("鑾峰彇鑱氱劍鍊�", focus);
}
@ApiOperation("璁剧疆鑱氱劍鍊�")
@@ -335,6 +335,17 @@
return AjaxResult.success(cameraSdkService.getGisInfo(cmd));
}
+ @ApiOperation("褰曞儚")
+ @PostMapping("/record")
+ @Log(title = "鎵嬪姩褰曞儚寮�濮�", businessType = BusinessType.CONTROL)
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
+ public @ResponseBody
+ AjaxResult record(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
+ String url = cameraSdkService.record(cmd);
+ return AjaxResult.success(url);
+ }
+
@ApiOperation("鎵嬪姩褰曞儚寮�濮�")
@PostMapping("/recordStart")
@Log(title = "鎵嬪姩褰曞儚寮�濮�", businessType = BusinessType.CONTROL)
@@ -345,6 +356,7 @@
boolean b = cameraSdkService.recordStart(cmd);
return toAjax(b);
}
+
@ApiOperation("鎵嬪姩褰曞儚鍋滄")
@PostMapping("/recordStop")
@Log(title = "鎵嬪姩褰曞儚鍋滄", businessType = BusinessType.CONTROL)
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/ICameraSdkService.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/ICameraSdkService.java
index dc7f5cf..e210aad 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/ICameraSdkService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/ICameraSdkService.java
@@ -2,20 +2,15 @@
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
-import com.ruoyi.device.channel.domain.ArdChannel;
-import java.util.List;
import java.util.Map;
public interface ICameraSdkService {
//sdk鍒濆鍖�
void initSDK();
- //鍚屾鐧诲綍
- void syncLogin(ArdCameras cameras);
-
- //寮傛鐧诲綍
- void asyncLogin(ArdCameras cameras);
+ //鐧诲綍
+ Boolean login(ArdCameras ardCamera);
//娉ㄩ攢
boolean logout(String cameraId);
@@ -30,7 +25,7 @@
boolean setFocusPos(CameraCmd cmd);
//鑾峰彇鑱氱劍鍊�
- Map<String, Object> getFocusPos(CameraCmd cmd);
+ int getFocusPos(CameraCmd cmd);
//璁剧疆棰勭疆浣�
boolean setPreset(CameraCmd cmd);
@@ -39,12 +34,12 @@
boolean gotoPreset(CameraCmd cmd);
//鑾峰彇鐮佹祦鍘嬬缉鍙傛暟
- Map<String, String> getVideoCompressionCfg(CameraCmd cmd);
+ Map<String, Object> getVideoCompressionCfg(CameraCmd cmd);
//閫忛浘
boolean controlDefogcfg(CameraCmd cmd);
- //绾㈠?
+ //绾㈠
boolean controlInfrarecfg(CameraCmd cmd);
//鑱氱劍妯″紡
@@ -56,7 +51,7 @@
//浜戝彴鍔犵儹
boolean controlPTHeateRpwron(CameraCmd cmd);
- //闀滃ご闄ゅ啺
+ //闀滃ご鍔犵儹闄ゅ啺
boolean controlCameraDeicing(CameraCmd cmd);
//閰嶇疆閿佸畾
@@ -85,9 +80,11 @@
//璁剧疆闆舵柟浣嶈
boolean setZeroPtz(CameraCmd cmd);
-
//寮曞鐩爣浣嶇疆
boolean guideTargetPosition(CameraCmd cmd);
+
+ //褰曞儚
+ String record(CameraCmd cmd);
//鎵嬪姩寮�濮嬪綍鍍�
boolean recordStart(CameraCmd cmd);
@@ -96,11 +93,8 @@
String recordStopToMinio(CameraCmd cmd);
//鍋滄褰曞儚-涓嶄笂浼爉inio
- void recordStopNotToMinio(CameraCmd cmd);
-
- //鑾峰彇鐩告満閫氶亾淇℃伅
- public List<ArdChannel> getCameraChannelList(ArdCameras camera);
+ boolean recordStopNotToMinio(CameraCmd cmd);
//鑾峰彇GIS淇℃伅鏁版嵁
- public Map<String, Object> getGisInfo(CameraCmd cmd);
+ Map<String, Object> getGisInfo(CameraCmd cmd);
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
index e44f979..8fb5c0d 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.device.channel.domain.ArdChannel;
import com.ruoyi.device.channel.mapper.ArdChannelMapper;
import com.ruoyi.device.hiksdk.service.IHikClientService;
+import com.ruoyi.media.domain.Vtdu;
import com.ruoyi.media.service.IVtduService;
import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.utils.gis.GisUtil;
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java
index 97591be..00fb04a 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java
@@ -1,11 +1,16 @@
package com.ruoyi.device.camera.service.impl;
+import com.ruoyi.common.annotation.SdkOperate;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
+import com.ruoyi.device.camera.service.IArdCamerasService;
import com.ruoyi.device.camera.service.ICameraSdkService;
import com.ruoyi.device.channel.domain.ArdChannel;
+import com.ruoyi.device.dhsdk.lib.NetSDKLib;
+import com.ruoyi.device.dhsdk.module.RealPlayModule;
import com.ruoyi.device.dhsdk.service.IDhClientService;
import com.ruoyi.device.hiksdk.common.GlobalVariable;
import com.ruoyi.device.hiksdk.service.IHikClientService;
@@ -13,10 +18,13 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint;
+import static com.ruoyi.device.dhsdk.module.LoginModule.netsdk;
import static com.ruoyi.device.hiksdk.sdk.HCNetSDK.NET_DVR_CHECK_USER_STATUS;
@@ -30,12 +38,14 @@
@Slf4j(topic = "SDK")
public class CameraSdkServiceImpl implements ICameraSdkService {
@Resource
+ private IArdCamerasService ardCamerasService;
+ @Resource
IHikClientService hikClientService;
@Resource
IDhClientService dhClientService;
@Resource
RedisCache redisCache;
-
+ //鍒濆鍖朣DK
@Override
public void initSDK() {
//鍒濆鍖栧姞杞絪dk搴撴枃浠�
@@ -48,20 +58,47 @@
dhClientService.loginAll();//鐧诲綍鍏ㄩ儴澶у崕鐩告満
}
}
+ //鐧诲綍
@Override
- public void syncLogin(ArdCameras cameras) {
-
+ public Boolean login(ArdCameras ardCamera) {
+ boolean result = false;
+ try {
+ if (ardCamera != null) {
+ String factory = ardCamera.getFactory();
+ if (factory.equals("1")) {
+ hikClientService.syncLogin(ardCamera);
+ result=true;
+ } else if (factory.equals("2")) {
+ result = dhClientService.login(ardCamera);
+ }
+ }
+ } catch (Exception ex) {
+ log.error("鐧诲綍寮傚父锛�" + ex.getMessage());
+ return false;
+ }
+ return result;
}
-
- @Override
- public void asyncLogin(ArdCameras cameras) {
-
- }
-
+ //娉ㄩ攢
@Override
public boolean logout(String cameraId) {
- return false;
+ boolean result = false;
+ try {
+ ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
+ if (ardCamera != null) {
+ String factory = ardCamera.getFactory();
+ if (factory.equals("1")) {
+ result = hikClientService.logout(cameraId);
+ } else if (factory.equals("2")) {
+ result = dhClientService.logout(cameraId);
+ }
+ }
+ } catch (Exception ex) {
+ log.error("娉ㄩ攢寮傚父锛�" + ex.getMessage());
+ return false;
+ }
+ return result;
}
+
//鍦ㄧ嚎妫�娴�
@Override
public boolean isOnLine(CameraCmd cmd) {
@@ -84,6 +121,7 @@
}
}
//浜戝彴鎺у埗
+ @SdkOperate
@Override
public boolean pTZControl(CameraCmd cmd) {
try {
@@ -116,7 +154,7 @@
if (factory.equals("1")) {
result = hikClientService.setFocusPos(cmd);
} else if (factory.equals("2")) {
-
+ result = dhClientService.setFocusPos(cmd);
}
}
} catch (Exception ex) {
@@ -127,23 +165,23 @@
}
//鑾峰彇鑱氱劍鍊�
@Override
- public Map<String, Object> getFocusPos(CameraCmd cmd) {
- Map<String, Object> map = new HashMap<>();
+ public int getFocusPos(CameraCmd cmd) {
+ int result=0;
try {
String cameraId = cmd.getCameraId();
ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
if (ardCamera != null) {
String factory = ardCamera.getFactory();
if (factory.equals("1")) {
- map = hikClientService.getFocusPos(cmd);
+ result = hikClientService.getFocusPos(cmd);
} else if (factory.equals("2")) {
-
+ result = dhClientService.getFocusPos(cmd);
}
}
} catch (Exception ex) {
log.error("鑾峰彇鑱氱劍鍊煎紓甯革細" + ex.getMessage());
}
- return map;
+ return result;
}
//璁剧疆棰勭疆浣�
@Override
@@ -187,8 +225,8 @@
}
//鑾峰彇鐮佹祦鍘嬬缉鍙傛暟
@Override
- public Map<String, String> getVideoCompressionCfg(CameraCmd cmd) {
- Map<String, String> map = new HashMap<>();
+ public Map<String, Object> getVideoCompressionCfg(CameraCmd cmd) {
+ Map<String, Object> map = new HashMap<>();
try {
String cameraId = cmd.getCameraId();
ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
@@ -197,7 +235,7 @@
if (factory.equals("1")) {
map = hikClientService.getVideoCompressionCfg(cmd);
} else if (factory.equals("2")) {
-
+ map = dhClientService.getVideoCompressionCfg(cmd);
}
}
} catch (Exception ex) {
@@ -217,7 +255,7 @@
if (factory.equals("1")) {
result = hikClientService.controlDefogcfg(cmd);
} else if (factory.equals("2")) {
-
+ //涓嶆敮鎸�
}
}
} catch (Exception ex) {
@@ -237,7 +275,7 @@
if (factory.equals("1")) {
result = hikClientService.controlInfrarecfg(cmd);
} else if (factory.equals("2")) {
-
+ result = dhClientService.controlInfrarecfg(cmd);
}
}
} catch (Exception ex) {
@@ -297,7 +335,7 @@
if (factory.equals("1")) {
result = hikClientService.controlPTHeateRpwron(cmd);
} else if (factory.equals("2")) {
-
+ //涓嶆敮鎸�
}
}
} catch (Exception ex) {
@@ -317,7 +355,7 @@
if (factory.equals("1")) {
result = hikClientService.controlCameraDeicing(cmd);
} else if (factory.equals("2")) {
-
+ //涓嶆敮鎸�
}
}
} catch (Exception ex) {
@@ -325,46 +363,7 @@
}
return result;
}
- //鎿嶆帶閿佸畾
- @Override
- public boolean controlLock(CameraCmd cmd) {
- boolean result = false;
- try {
- String cameraId = cmd.getCameraId();
- ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
- if (ardCamera != null) {
- String factory = ardCamera.getFactory();
- if (factory.equals("1")) {
- result = hikClientService.controlLock(cmd);
- } else if (factory.equals("2")) {
- }
- }
- } catch (Exception ex) {
- log.error("鎿嶆帶閿佸畾寮傚父锛�" + ex.getMessage());
- }
- return result;
- }
- //璁剧疆瑙i攣
- @Override
- public boolean controlUnLock(CameraCmd cmd) {
- boolean result = false;
- try {
- String cameraId = cmd.getCameraId();
- ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
- if (ardCamera != null) {
- String factory = ardCamera.getFactory();
- if (factory.equals("1")) {
- result = hikClientService.controlUnLock(cmd);
- } else if (factory.equals("2")) {
-
- }
- }
- } catch (Exception ex) {
- log.error("璁剧疆瑙i攣寮傚父锛�" + ex.getMessage());
- }
- return result;
- }
//鑾峰彇浜戝彴閿佸畾淇℃伅
@Override
public int getPTZLockInfo(CameraCmd cmd) {
@@ -391,17 +390,23 @@
return null;
}
//鎶撳浘
+ @SdkOperate
@Override
public String picCutCate(CameraCmd cmd) {
- String url = "";
+ String url = "";
try {
+ //鑾峰彇鎽勫儚澶碔D
String cameraId = cmd.getCameraId();
+ //浠巖edis涓幏鍙栨憚鍍忓ご淇℃伅
ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
if (ardCamera != null) {
+ //鑾峰彇鎽勫儚澶村伐鍘�
String factory = ardCamera.getFactory();
if (factory.equals("1")) {
+ //璋冪敤hikClientService鐨刾icCutCate鏂规硶
url = hikClientService.picCutCate(cmd);
} else if (factory.equals("2")) {
+ //璋冪敤dhClientService鐨刾icCutCate鏂规硶
url = dhClientService.picCutCate(cmd);
}
}
@@ -451,6 +456,7 @@
return map;
}
//璁剧疆ptz
+ @SdkOperate
@Override
public boolean setPtz(CameraCmd cmd) {
boolean result = false;
@@ -471,6 +477,7 @@
return result;
}
//璁剧疆闆舵柟浣嶈
+ @SdkOperate
@Override
public boolean setZeroPtz(CameraCmd cmd) {
boolean result = false;
@@ -491,6 +498,7 @@
return result;
}
//寮曞鎸囧悜鐩爣
+ @SdkOperate
@Override
public boolean guideTargetPosition(CameraCmd cmd) {
boolean result = false;
@@ -510,6 +518,74 @@
}
return result;
}
+
+ /**
+ * @鎻忚堪 鎿嶆帶閿佸畾
+ * @鍙傛暟 [userId, channelNum]
+ * @杩斿洖鍊� boolean
+ * @鍒涘缓浜� 鍒樿嫃涔�
+ * @鍒涘缓鏃堕棿 2023/1/17 16:36
+ * @淇敼浜哄拰鍏跺畠淇℃伅 0-瑙i攣 1-閿佸畾
+ */
+ @Override
+ @SdkOperate
+ public boolean controlLock(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();//鐢宠閿佺殑鐩告満
+ ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId);
+ Date now = new Date();
+ now.setTime(now.getTime() + cmd.getExpired() * 1000);
+ ardCameras.setOperatorExpired(now);//璁剧疆褰撳墠杩囨湡鏃堕棿
+ ardCamerasService.updateArdCameras(ardCameras);
+ return true;
+ }
+
+ /**
+ * @鎻忚堪 鎿嶆帶瑙i攣
+ * @鍙傛暟 [userId, channelNum]
+ * @杩斿洖鍊� boolean
+ * @鍒涘缓浜� 鍒樿嫃涔�
+ * @鍒涘缓鏃堕棿 2023/6/30 15:36
+ * @淇敼浜哄拰鍏跺畠淇℃伅
+ */
+ @Override
+ public boolean controlUnLock(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();//鐢宠瑙i攣鐨勭浉鏈�
+ String operator = cmd.getOperator();//鐢宠鑰�
+ ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId);
+ if (ardCameras.getOperatorId().equals(operator)) {
+ //濡傛灉瑙i攣鐩告満鐨勫綋鍓嶇敤鎴锋槸鐢宠鑰咃紝鍒欐竻绌鸿鐩告満鐨勮繃鏈熸椂闂�
+ ardCameras.setOperatorExpired(null);
+ int i = ardCamerasService.updateArdCameras(ardCameras);
+ if (i > 0) {
+ log.debug(cameraId + "--瑙i攣鎴愬姛");
+ }
+ }
+ return true;
+ }
+
+
+ //褰曞儚
+ @SdkOperate
+ @Override
+ public String record(CameraCmd cmd) {
+ String url = "";
+ try {
+ String cameraId = cmd.getCameraId();
+ ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
+ if (ardCamera != null) {
+ String factory = ardCamera.getFactory();
+ if (factory.equals("1")) {
+ url = hikClientService.record(cmd);
+ } else if (factory.equals("2")) {
+ url = dhClientService.record(cmd);
+ }
+ }
+ } catch (Exception ex) {
+ log.error("褰曞儚寮傚父锛�" + ex.getMessage());
+ }
+ return url;
+ }
+
//寮�濮嬪綍鍍�
@Override
public boolean recordStart(CameraCmd cmd) {
@@ -552,13 +628,23 @@
}
//鍋滄褰曞儚骞朵笉瀛樺叆minio
@Override
- public void recordStopNotToMinio(CameraCmd cmd) {
-
- }
-
- @Override
- public List<ArdChannel> getCameraChannelList(ArdCameras camera) {
- return null;
+ public boolean recordStopNotToMinio(CameraCmd cmd) {
+ boolean result = false;
+ try {
+ String cameraId = cmd.getCameraId();
+ ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
+ if (ardCamera != null) {
+ String factory = ardCamera.getFactory();
+ if (factory.equals("1")) {
+ result = hikClientService.recordStopNotToMinio(cmd);
+ } else if (factory.equals("2")) {
+ result = dhClientService.recordStopNotToMinio(cmd);
+ }
+ }
+ } catch (Exception ex) {
+ log.error("鍋滄褰曞儚寮傚父锛�" + ex.getMessage());
+ }
+ return result;
}
//鑾峰彇鐩告満鏋惰鍙傛暟
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/controller/DhSdkController.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/controller/DhSdkController.java
index c0039e5..94d0385 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/controller/DhSdkController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/controller/DhSdkController.java
@@ -9,7 +9,6 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.dhsdk.service.IDhClientService;
-import com.ruoyi.device.hiksdk.service.IHikClientService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
@@ -17,8 +16,6 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;
@@ -28,7 +25,7 @@
* @Author: 鍒樿嫃涔�
* @Date: 2023骞�10鏈�14鏃�10:34:58
**/
-@Api(tags = "澶у崕SDK鎺ュ彛")
+
@Controller
@RequestMapping("/dh")
@Anonymous
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/enumeration/EM_FOCUS_LIMIT_SELECT_MODE.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/enumeration/EM_FOCUS_LIMIT_SELECT_MODE.java
index 40520ef..6e99ee6 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/enumeration/EM_FOCUS_LIMIT_SELECT_MODE.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/enumeration/EM_FOCUS_LIMIT_SELECT_MODE.java
@@ -10,7 +10,7 @@
/**
Manual 鑷姩
*/
-EM_FOCUS_LIMIT_MODE_MANUAL(0," Manual 鑷姩"),
+EM_FOCUS_LIMIT_MODE_MANUAL(0," Manual 鑷姩"),
/**
Auto 鎵嬪姩
*/
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/structure/CFG_VIDEO_IN_FOCUS_UNIT.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/structure/CFG_VIDEO_IN_FOCUS_UNIT.java
index e8667be..3e1b252 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/structure/CFG_VIDEO_IN_FOCUS_UNIT.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/lib/structure/CFG_VIDEO_IN_FOCUS_UNIT.java
@@ -2,33 +2,33 @@
import com.ruoyi.device.dhsdk.lib.NetSDKLib;
-/**
-* @author 291189
-* @description 鑱氱劍璁剧疆鍩烘湰淇℃伅鍗曞厓
-* @date 2022/11/01 11:16:54
-*/
+/**
+ * @author 291189
+ * @description 鑱氱劍璁剧疆鍩烘湰淇℃伅鍗曞厓
+ * @date 2022/11/01 11:16:54
+ */
public class CFG_VIDEO_IN_FOCUS_UNIT extends NetSDKLib.SdkStructure {
-/**
-鑱氱劍妯″紡, 0-鍏抽棴, 1-杈呭姪鑱氱劍, 2-鑷姩鑱氱劍, 3-鍗婅嚜鍔ㄨ仛鐒�, 4-鎵嬪姩鑱氱劍
-*/
-public int nMode;
-/**
-鑱氱劍鐏垫晱搴�, 0-楂�, 1-榛樿, 2-浣�
-*/
-public int nSensitivity;
-/**
-绾㈠鍏夎仛鐒︿慨姝�, 0-涓嶄慨姝�, 1-淇, 2-鑷姩淇
-*/
-public int nIRCorrection;
-/**
-鑱氱劍鏋侀檺 {@link com.ruoyi.device.dhsdk.lib.enumeration.EM_FOCUS_LIMIT_SELECT_MODE}
-*/
-public int emFocusMode;
-/**
-鑱氱劍鏋侀檺鍊�, 鍗曚綅姣背
-*/
-public int nFocusLimit;
+ /**
+ * 鑱氱劍妯″紡, 0-鍏抽棴, 1-杈呭姪鑱氱劍, 2-鑷姩鑱氱劍, 3-鍗婅嚜鍔ㄨ仛鐒�, 4-鎵嬪姩鑱氱劍
+ */
+ public int nMode;
+ /**
+ * 鑱氱劍鐏垫晱搴�, 0-楂�, 1-榛樿, 2-浣�
+ */
+ public int nSensitivity;
+ /**
+ * 绾㈠鍏夎仛鐒︿慨姝�, 0-涓嶄慨姝�, 1-淇, 2-鑷姩淇
+ */
+ public int nIRCorrection;
+ /**
+ * 鑱氱劍鏋侀檺 {@link com.ruoyi.device.dhsdk.lib.enumeration.EM_FOCUS_LIMIT_SELECT_MODE}
+ */
+ public int emFocusMode;
+ /**
+ * 鑱氱劍鏋侀檺鍊�, 鍗曚綅姣背
+ */
+ public int nFocusLimit;
-public CFG_VIDEO_IN_FOCUS_UNIT(){
-}
+ public CFG_VIDEO_IN_FOCUS_UNIT() {
+ }
}
\ No newline at end of file
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/ConfigModule.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/ConfigModule.java
index bb99075..cf30284 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/ConfigModule.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/ConfigModule.java
@@ -1,8 +1,10 @@
package com.ruoyi.device.dhsdk.module;
import com.ruoyi.device.dhsdk.lib.NetSDKLib;
+import com.ruoyi.device.dhsdk.lib.ToolKits;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
+
import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint;
/**
@@ -14,6 +16,7 @@
public class ConfigModule {
public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
public static NetSDKLib configsdk = NetSDKLib.CONFIG_INSTANCE;
+
/**
* 鏌ヨ璁惧鐘舵��
*/
@@ -27,28 +30,78 @@
stuInfo.read();
return true;
}
+
+ /**
+ * 鑾峰彇鍗曚釜閰嶇疆
+ *
+ * @param hLoginHandle 鐧婚檰鍙ユ焺
+ * @param nChn 閫氶亾鍙凤紝-1 琛ㄧず鍏ㄩ�氶亾
+ * @param strCmd 閰嶇疆鍚嶇О
+ * @param cmdObject 閰嶇疆瀵瑰簲鐨勭粨鏋勪綋瀵硅薄
+ * @return 鎴愬姛杩斿洖 true
+ */
+ public static boolean GetNewDevConfig(NetSDKLib.LLong hLoginHandle, int nChn, String strCmd, Structure cmdObject) {
+ boolean result = false;
+ IntByReference error = new IntByReference(0);
+ int nBufferLen = 2 * 1024 * 1024;
+ byte[] strBuffer = new byte[nBufferLen];
+
+ if (netsdk.CLIENT_GetNewDevConfig(hLoginHandle, strCmd, nChn, strBuffer, nBufferLen, error, 3000)) {
+ cmdObject.write();
+ if (configsdk.CLIENT_ParseData(strCmd, strBuffer, cmdObject.getPointer(), cmdObject.size(), null)) {
+ cmdObject.read();
+ result = true;
+ } else {
+ System.err.println("Parse " + strCmd + " Config Failed!" + ToolKits.getErrorCodePrint());
+ result = false;
+ }
+ } else {
+ System.err.printf("Get %s Config Failed!Last Error = %s\n", strCmd, getErrorCodePrint());
+ result = false;
+ }
+
+ return result;
+ }
+
+ public static boolean GetDevConfig(NetSDKLib.LLong hLoginHandle, int nChn, String strCmd, Structure cmdObject) {
+ boolean result = true;
+ IntByReference error = new IntByReference(0);
+ int nBufferLen = 2 * 1024 * 1024;
+ byte[] strBuffer = new byte[nBufferLen];
+ cmdObject.write();
+ boolean bRet = netsdk.CLIENT_QueryNewSystemInfo(hLoginHandle, strCmd, nChn, strBuffer, cmdObject.size(), error,3000);
+ if (bRet) {
+ cmdObject.read();
+ } else {
+ System.err.printf("Get %s Config Failed!Last Error = %s\n", strCmd, getErrorCodePrint());
+ result = false;
+ }
+ return result;
+ }
+
/**
* 璁剧疆鍗曚釜閰嶇疆
+ *
* @param hLoginHandle 鐧婚檰鍙ユ焺
- * @param nChn 閫氶亾鍙凤紝-1 琛ㄧず鍏ㄩ�氶亾
- * @param strCmd 閰嶇疆鍚嶇О
- * @param cmdObject 閰嶇疆瀵瑰簲鐨勭粨鏋勪綋瀵硅薄
+ * @param nChn 閫氶亾鍙凤紝-1 琛ㄧず鍏ㄩ�氶亾
+ * @param strCmd 閰嶇疆鍚嶇О
+ * @param cmdObject 閰嶇疆瀵瑰簲鐨勭粨鏋勪綋瀵硅薄
* @return 鎴愬姛杩斿洖 true
*/
public static boolean SetDevConfig(NetSDKLib.LLong hLoginHandle, int nChn, String strCmd, Structure cmdObject) {
boolean result = false;
- int nBufferLen = 2*1024*1024;
+ int nBufferLen = 2 * 1024 * 1024;
byte szBuffer[] = new byte[nBufferLen];
- for(int i=0; i<nBufferLen; i++)szBuffer[i]=0;
+ for (int i = 0; i < nBufferLen; i++) szBuffer[i] = 0;
IntByReference error = new IntByReference(0);
IntByReference restart = new IntByReference(0);
cmdObject.write();
if (configsdk.CLIENT_PacketData(strCmd, cmdObject.getPointer(), cmdObject.size(), szBuffer, nBufferLen)) {
cmdObject.read();
- if( configsdk.CLIENT_SetNewDevConfig(hLoginHandle, strCmd , nChn , szBuffer, nBufferLen, error, restart, 3000)) {
+ if (netsdk.CLIENT_SetNewDevConfig(hLoginHandle, strCmd, nChn, szBuffer, nBufferLen, error, restart, 3000)) {
result = true;
} else {
- System.err.printf("Set %s Config Failed! Last Error = %s\n" , strCmd , getErrorCodePrint());
+ System.err.printf("Set %s Config Failed! Last Error = %s\n", strCmd, getErrorCodePrint());
result = false;
}
} else {
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java
index 31ecfe6..32fa9a0 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java
@@ -2,18 +2,27 @@
import com.ruoyi.device.dhsdk.lib.NetSDKLib;
+import static com.ruoyi.device.dhsdk.module.LoginModule.netsdk;
+
/**
* 浜戝彴鎺у埗鎺ュ彛瀹炵幇
* 涓昏鏈� 锛氬叓涓柟鍚戞帶鍒躲�佸彉鍊嶃�佸彉鐒︺�佸厜鍦堝姛鑳�
*/
public class PtzControlModule {
public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
+ /**
+ * 鎸塪wPTZCommand绫诲瀷鎺у埗
+ */
+ public static boolean ptzControl(NetSDKLib.LLong m_hLoginHandle,int nChannelID, int dwPTZCommand,int lParam1, int lParam2,int lParam3, int dwStop) {
+ return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID, dwPTZCommand, lParam1, lParam2, lParam3, dwStop);
+ }
+
/**
* 鍚戜笂
*/
- public static boolean ptzControlUpStart(NetSDKLib.LLong lLoginID, int nChannelID, int lParam1, int lParam2) {
- return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ public static boolean ptzControlUpStart(NetSDKLib.LLong m_hLoginHandle, int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(m_hLoginHandle, nChannelID,
NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
lParam1, lParam2, 0, 0);
}
@@ -72,6 +81,7 @@
/**
* 鍚戝乏涓�
*/
+
public static boolean ptzControlLeftUpStart(int nChannelID, int lParam1, int lParam2) {
return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/RealPlayModule.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/RealPlayModule.java
index a397132..a97ce4c 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/RealPlayModule.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/RealPlayModule.java
@@ -18,25 +18,14 @@
* 寮�濮嬮瑙�
* \endif
*/
- public static NetSDKLib.LLong startRealPlay(NetSDKLib.LLong m_hLoginHandle, int channel, int stream) {
- NetSDKLib.LLong m_hPlayHandle = netsdk.CLIENT_RealPlayEx(m_hLoginHandle, channel, null, stream);
- if (m_hPlayHandle.longValue() == 0) {
- System.err.println("寮�濮嬪疄鏃堕瑙堝け璐ワ紝閿欒鐮�" + ToolKits.getErrorCodePrint());
- } else {
- System.out.println("Success to start realplay");
- // netsdk.CLIENT_SetRealDataCallBackEx(m_hPlayHandle, CbfRealDataCallBackEx.getInstance(),null, 0x0000001f);
- }
- return m_hPlayHandle;
- }
- public static NetSDKLib.LLong startRealPlay1(NetSDKLib.LLong m_hLoginHandle, int channel, String path) {
+ public static NetSDKLib.LLong startRealPlay(NetSDKLib.LLong m_hLoginHandle, int channel, String path) {
NetSDKLib.NET_IN_REALPLAY_BY_DATA_TYPE net_in_realplay_by_data_type = new NetSDKLib.NET_IN_REALPLAY_BY_DATA_TYPE();
net_in_realplay_by_data_type.nChannelID = channel;
net_in_realplay_by_data_type.hWnd = null;
net_in_realplay_by_data_type.rType = 0;
net_in_realplay_by_data_type.emDataType = NetSDKLib.EM_REAL_DATA_TYPE.EM_REAL_DATA_TYPE_MP4;
net_in_realplay_by_data_type.szSaveFileName = path;
- //net_in_realplay_by_data_type.cbRealData = CbfRealDataCallBackEx.getInstance();
NetSDKLib.NET_OUT_REALPLAY_BY_DATA_TYPE net_out_realplay_by_data_type = new NetSDKLib.NET_OUT_REALPLAY_BY_DATA_TYPE();
NetSDKLib.LLong m_hPlayHandle = netsdk.CLIENT_RealPlayByDataType(m_hLoginHandle, net_in_realplay_by_data_type, net_out_realplay_by_data_type, 5000);
if (m_hPlayHandle.longValue() == 0) {
@@ -49,7 +38,7 @@
/**
* \if ENGLISH_LANG
- * Start RealPlay
+ * Stop RealPlay
* \else
* 鍋滄棰勮
* \endif
@@ -110,4 +99,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/IDhClientService.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/IDhClientService.java
index 32ad998..7c9fd83 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/IDhClientService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/IDhClientService.java
@@ -1,11 +1,7 @@
package com.ruoyi.device.dhsdk.service;
-import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
-import com.ruoyi.device.channel.domain.ArdChannel;
-
-import java.util.List;
import java.util.Map;
/**
@@ -51,7 +47,7 @@
String record(CameraCmd cmd);
boolean recordStart(CameraCmd cmd);
String recordStopToMinio(CameraCmd cmd);
-
+ boolean recordStopNotToMinio(CameraCmd cmd);
//寮曞鐩爣浣嶇疆
boolean guideTargetPosition(CameraCmd cmd);
@@ -61,4 +57,14 @@
boolean setPreset(CameraCmd cmd);
//鑱氱劍妯″紡
boolean controlFocusMode(CameraCmd cmd);
+ //閫忛浘
+ boolean controlDefogcfg(CameraCmd cmd);
+ //绾㈠
+ boolean controlInfrarecfg(CameraCmd cmd);
+ //鑾峰彇鑱氱劍鍊�
+ int getFocusPos(CameraCmd cmd);
+ //璁剧疆鑱氱劍鍊�
+ boolean setFocusPos(CameraCmd cmd);
+ //鑾峰彇鐮佹祦鍘嬬缉鍙傛暟
+ Map<String, Object> getVideoCompressionCfg(CameraCmd cmd);
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/impl/DhClientServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/impl/DhClientServiceImpl.java
index b7aadfb..ed12a00 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/impl/DhClientServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/service/impl/DhClientServiceImpl.java
@@ -13,17 +13,21 @@
import com.ruoyi.device.dhsdk.common.Res;
import com.ruoyi.device.dhsdk.lib.NetSDKLib;
import com.ruoyi.device.dhsdk.lib.NetSDKLib.LLong;
+import com.ruoyi.device.dhsdk.lib.enumeration.EM_FOCUS_LIMIT_SELECT_MODE;
+import com.ruoyi.device.dhsdk.lib.enumeration.EM_NEW_CONFIG;
import com.ruoyi.device.dhsdk.lib.structure.CFG_VIDEO_IN_FOCUS;
import com.ruoyi.device.dhsdk.lib.structure.CFG_VIDEO_IN_FOCUS_UNIT;
-import com.ruoyi.device.dhsdk.module.CapturePictureModule;
-import com.ruoyi.device.dhsdk.module.ConfigModule;
-import com.ruoyi.device.dhsdk.module.LoginModule;
-import com.ruoyi.device.dhsdk.module.RealPlayModule;
+import com.ruoyi.device.dhsdk.lib.structure.NET_ENCODE_VIDEO_INFO;
+import com.ruoyi.device.dhsdk.module.*;
import com.ruoyi.device.dhsdk.service.IDhClientService;
import com.ruoyi.device.hiksdk.common.GlobalVariable;
import com.ruoyi.device.hiksdk.sdk.HCNetSDK;
+import com.ruoyi.media.domain.Vtdu;
+import com.ruoyi.media.service.IVtduService;
+import com.ruoyi.media.service.impl.VtduServiceImpl;
import com.ruoyi.utils.gis.GisUtil;
import com.ruoyi.utils.minio.MinioUtil;
+import com.ruoyi.utils.tools.ArdTool;
import com.sun.jna.Pointer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@@ -31,20 +35,15 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
-import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_DEVSTATE_ONLINE;
-import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_DEVSTATE_PTZ_LOCATION;
+import static com.ruoyi.device.dhsdk.lib.NetSDKLib.*;
import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_MOVE_CONTROL;
import static com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_SET_CONTROL;
import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint;
import static com.ruoyi.device.dhsdk.module.LoginModule.netsdk;
-import static com.ruoyi.device.hiksdk.sdk.HCNetSDK.NET_DVR_SET_PTZPOS;
/**
@@ -61,10 +60,11 @@
private IArdCamerasService ardCamerasService;
@Resource
private IArdChannelService ardChannelService;
+ @Resource
+ private IVtduService vtduService;
@Value("${minio.endpoint}")
private String minioEndPoint;
- private Vector<String> chnlist = new Vector<String>();
// 璁惧鏂嚎閫氱煡鍥炶皟
private static DisConnect disConnect = new DisConnect();
// 缃戠粶杩炴帴鎭㈠
@@ -125,13 +125,39 @@
GlobalVariable.loginMap.put(camera.getId(), loginId);
//鑾峰彇鏈�鏂伴�氶亾
for (int i = 1; i < LoginModule.m_stDeviceInfo.byChanNum + 1; i++) {
- chnlist.add(Res.string().getChannel() + " " + String.valueOf(i));
ArdChannel channel = new ArdChannel();
+ AV_CFG_ChannelName av_cfg_channelName = new AV_CFG_ChannelName();
+ boolean b = ConfigModule.GetNewDevConfig(loginId, i - 1, CFG_CMD_CHANNELTITLE, av_cfg_channelName);
+ if (b) {
+ String chanName = null;
+ try {
+ chanName = new String(av_cfg_channelName.szName, "GBK").trim();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ channel.setName(chanName);
+ } else {
+ channel.setName("閫氶亾" + i);
+ }
channel.setDeviceId(camera.getId());
- channel.setName("閫氶亾" + i);
- channel.setId(IdUtils.simpleUUID());
channel.setChanNo(i);
ardChannelService.insertArdChannel(channel);
+
+ //閰嶇疆鍒版祦濯掍綋
+ String name = camera.getId() + "_" + channel.getChanNo();
+ String rtspSource = "rtsp://" + camera.getUsername() + ":" + camera.getPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/cam/realmonitor?channel=" + channel.getChanNo() + "&subtype=0";
+ Vtdu vtdu = vtduService.selectVtduByName(name);
+ if (vtdu != null) {
+ vtduService.deleteVtduByName(name);
+ }
+ //娣诲姞鍒版祦濯掍綋
+ vtdu = new Vtdu();
+ vtdu.setRtspSource(rtspSource);
+ vtdu.setName(camera.getId() + "_" + channel.getChanNo());
+ vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
+ vtdu.setMode("1");//榛樿CPU杞В鐮�
+ vtdu.setCameraId(camera.getId());
+ vtduService.insertVtdu(vtdu);
}
} else {
//log.debug(camera.getIp() + ":" + camera.getPort() + "鐧诲綍澶辫触");
@@ -210,58 +236,58 @@
switch (code) {
/*鏂瑰悜*/
case 1:
- dwPTZCommand = NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP;
+ dwPTZCommand = NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP;
break;
case 2:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_UP_CONTROL;
break;
case 3:
- dwPTZCommand = NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP;
+ dwPTZCommand = NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP;
break;
case 4:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL;
break;
case 5:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_LOOP_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_POINT_LOOP_CONTROL;
break;
case 6:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL;
break;
case 7:
- dwPTZCommand = NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN;
+ dwPTZCommand = NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN;
break;
case 8:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL;
break;
case 9:
- dwPTZCommand = NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN;
+ dwPTZCommand = NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN;
break;
/*鐒﹁窛*/
case 10:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL;
break;
case 11:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL;
break;
/*鐒︾偣*/
case 12:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL;
break;
case 13:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL;
break;
/*鍏夊湀*/
case 14:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL;
break;
case 15:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL;
break;
case 16:
- dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LAMP_CONTROL;
+ dwPTZCommand = NET_PTZ_ControlType.NET_PTZ_LAMP_CONTROL;
break;
}
- boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, dwPTZCommand, speed, speed, 0, dwStop);
+ boolean bool = PtzControlModule.ptzControl(loginId, chanNo - 1, dwPTZCommand, speed, speed, 0, dwStop);
if (!bool) {
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
}
@@ -409,7 +435,7 @@
if (enable) {
LLong lRealHandle = new LLong(0);
if (!GlobalVariable.previewMap.containsKey(cameraId)) {
- lRealHandle = RealPlayModule.startRealPlay(loginId, chanNo, 0);
+ lRealHandle = RealPlayModule.startRealPlay(loginId, chanNo - 1, path);
if (lRealHandle.longValue() <= 0) {
log.error("鍙栨祦澶辫触" + getErrorCodePrint());
return "";
@@ -417,15 +443,11 @@
log.debug("鍙栨祦鎴愬姛");
GlobalVariable.previewMap.put(cameraId, lRealHandle.intValue());
}
- if (!netsdk.CLIENT_SaveRealData(lRealHandle, path)) {
- log.error("淇濆瓨瑙嗛鏂囦欢鍒颁复鏃舵枃浠跺す澶辫触 閿欒鐮佷负: " + getErrorCodePrint());
- return "";
- }
log.debug("褰曞儚寮�濮�");
} else {
if (GlobalVariable.previewMap.containsKey(cameraId)) {
LLong lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
- boolean b = netsdk.CLIENT_StopSaveRealData(lRealHandle);
+ RealPlayModule.stopRealPlay(lRealHandle);
GlobalVariable.previewMap.remove(cameraId);
}
log.debug("褰曞儚鍋滄");
@@ -450,11 +472,11 @@
LLong lRealHandle;
if (GlobalVariable.previewMap.containsKey(cameraId)) {
lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
- netsdk.CLIENT_StopRealPlayEx(lRealHandle);
+ RealPlayModule.stopRealPlay(lRealHandle);
GlobalVariable.previewMap.remove(cameraId);
log.debug("鍋滄褰撳墠褰曞儚");
}
- lRealHandle = RealPlayModule.startRealPlay1(loginId, chanNo - 1, path);
+ lRealHandle = RealPlayModule.startRealPlay(loginId, chanNo - 1, path);
if (lRealHandle.longValue() <= 0) {
log.error("鍙栨祦澶辫触" + getErrorCodePrint());
}
@@ -485,7 +507,7 @@
LLong lRealHandle;
if (GlobalVariable.previewMap.containsKey(cameraId)) {
lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
- netsdk.CLIENT_StopRealPlayEx(lRealHandle);
+ RealPlayModule.stopRealPlay(lRealHandle);
GlobalVariable.previewMap.remove(cameraId);
log.debug("鍋滄褰撳墠褰曞儚");
}
@@ -503,6 +525,29 @@
log.error("褰曞儚寮傚父" + ex.getMessage());
return "";
}
+ }
+
+ @Override
+ public boolean recordStopNotToMinio(CameraCmd cmd) {
+ boolean result = false;
+ try {
+ String cameraId = cmd.getCameraId();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return false;
+ }
+ LLong lRealHandle;
+ if (GlobalVariable.previewMap.containsKey(cameraId)) {
+ lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
+ RealPlayModule.stopRealPlay(lRealHandle);
+ GlobalVariable.previewMap.remove(cameraId);
+ log.debug("鍋滄褰撳墠褰曞儚");
+ }
+
+ result = true;
+ } catch (Exception ex) {
+ log.error("褰曞儚寮傚父" + ex.getMessage());
+ }
+ return result;
}
/**
@@ -595,14 +640,21 @@
LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
try {
CFG_VIDEO_IN_FOCUS cfg_video_in_focus = new CFG_VIDEO_IN_FOCUS();
- CFG_VIDEO_IN_FOCUS_UNIT[] stVideoInFocusUnit = new CFG_VIDEO_IN_FOCUS_UNIT[32];
- if (enable) {
- stVideoInFocusUnit[0].nMode = 4;//鎵嬪姩鑱氱劍
- } else {
- stVideoInFocusUnit[0].nMode = 2;//鎵嬪姩鑱氱劍
+ cfg_video_in_focus.nVideoInFocusRealNum = 3;//閰嶇疆浣跨敤涓暟
+ for (int i = 0; i < 3; i++) {
+ cfg_video_in_focus.stVideoInFocusUnit[i].nSensitivity = 1;//鑱氱劍鐏垫晱搴�, 0-楂�, 1-榛樿, 2-浣�
+
+ cfg_video_in_focus.stVideoInFocusUnit[i].nIRCorrection = 2;//绾㈠鍏夎仛鐒︿慨姝�, 0-涓嶄慨姝�, 1-淇, 2-鑷姩淇
+ cfg_video_in_focus.stVideoInFocusUnit[i].nFocusLimit = 10000;//鑱氱劍鏋侀檺鍊�, 鍗曚綅姣背
+ if (enable) {//鑱氱劍妯″紡, 0-鍏抽棴, 1-杈呭姪鑱氱劍, 2-鑷姩鑱氱劍, 3-鍗婅嚜鍔ㄨ仛鐒�, 4-鎵嬪姩鑱氱劍
+ cfg_video_in_focus.stVideoInFocusUnit[i].nMode = 4;//鎵嬪姩鑱氱劍
+ cfg_video_in_focus.stVideoInFocusUnit[i].emFocusMode = 1;//鑱氱劍鏋侀檺Manual
+ } else {
+ cfg_video_in_focus.stVideoInFocusUnit[i].nMode = 2;//鑷姩鑱氱劍
+ cfg_video_in_focus.stVideoInFocusUnit[i].emFocusMode = 0;//鑱氱劍鏋侀檺Auto
+ }
}
cfg_video_in_focus.nChannelIndex = chanNo - 1;
- cfg_video_in_focus.stVideoInFocusUnit = stVideoInFocusUnit;
boolean bool = ConfigModule.SetDevConfig(loginId, chanNo - 1, NetSDKLib.CFG_CMD_VIDEOIN_FOCUS, cfg_video_in_focus);
if (!bool) {
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
@@ -614,6 +666,176 @@
}
}
+ //閫忛浘
+ @Override
+ public boolean controlDefogcfg(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ boolean enable = cmd.isEnable();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return false;
+ }
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
+ try {
+ EM_NEW_CONFIG config = EM_NEW_CONFIG.CFG_CMD_VIDEOINDEFOG;
+ //CFG_VIDEOINDEFOG_LIST cfg_videoindefog_list=new CFG_VIDEOINDEFOG_LIST();
+ boolean bool = ConfigModule.SetDevConfig(loginId, chanNo - 1, config.getValue(), null);
+ if (!bool) {
+ log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
+ }
+ return bool;
+ } catch (Exception ex) {
+ log.error("鍒囨崲閫忛浘寮傚父:" + ex.getMessage());
+ return false;
+ }
+ }
+
+ //绾㈠
+ @Override
+ public boolean controlInfrarecfg(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ boolean enable = cmd.isEnable();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return false;
+ }
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
+ try {
+ CFG_LIGHTING_INFO cfg_lighting_info = new CFG_LIGHTING_INFO();
+ cfg_lighting_info.nLightingDetailNum = 1;
+ if (enable) {
+ cfg_lighting_info.stuLightingDetail[0].emMode = EM_CFG_LIGHTING_MODE.EM_CFG_LIGHTING_MODE_MANUAL;
+ } else {
+ cfg_lighting_info.stuLightingDetail[0].emMode = EM_CFG_LIGHTING_MODE.EM_CFG_LIGHTING_MODE_OFF;
+ }
+ boolean bool = ConfigModule.SetDevConfig(loginId, chanNo - 1, CFG_CMD_LIGHTING, cfg_lighting_info);
+ if (!bool) {
+ log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
+ }
+ return bool;
+ } catch (Exception ex) {
+ log.error("鍒囨崲绾㈠寮傚父:" + ex.getMessage());
+ return false;
+ }
+ }
+
+ //鑾峰彇鑱氱劍鍊�
+ @Override
+ public int getFocusPos(CameraCmd cmd) {
+ int result = 0;
+ try {
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return result;
+ }
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
+ NET_PTZ_LOCATION_INFO net_ptz_location_info = new NET_PTZ_LOCATION_INFO();
+ net_ptz_location_info.nChannelID = chanNo - 1;
+ boolean bool = ConfigModule.queryDevState(loginId, NET_DEVSTATE_PTZ_LOCATION, net_ptz_location_info);
+ if (!bool) {
+ log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
+ }
+ result = net_ptz_location_info.nFocusMapValue;
+ } catch (Exception ex) {
+ log.error("鑾峰彇鑱氱劍鍊煎紓甯�:" + ex.getMessage());
+ }
+ return result;
+ }
+
+ //璁剧疆鑱氱劍鍊�
+ @Override
+ public boolean setFocusPos(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ boolean enable = cmd.isEnable();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return false;
+ }
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
+ try {
+ CFG_LIGHTING_INFO cfg_lighting_info = new CFG_LIGHTING_INFO();
+ cfg_lighting_info.nLightingDetailNum = 1;
+ if (enable) {
+ cfg_lighting_info.stuLightingDetail[0].emMode = EM_CFG_LIGHTING_MODE.EM_CFG_LIGHTING_MODE_MANUAL;
+ } else {
+ cfg_lighting_info.stuLightingDetail[0].emMode = EM_CFG_LIGHTING_MODE.EM_CFG_LIGHTING_MODE_OFF;
+ }
+ boolean bool = ConfigModule.SetDevConfig(loginId, chanNo - 1, CFG_CMD_LIGHTING, cfg_lighting_info);
+ if (!bool) {
+ log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
+ }
+ return bool;
+ } catch (Exception ex) {
+ log.error("璁剧疆鑱氱劍鍊煎紓甯�:" + ex.getMessage());
+ return false;
+ }
+ }
+
+ //鑾峰彇鐮佹祦鍘嬬缉鍙傛暟
+ @Override
+ public Map<String, Object> getVideoCompressionCfg(CameraCmd cmd) {
+ Map<String, Object> map = new HashMap<>();
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return null;
+ }
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
+ CFG_ENCODE_INFO cfg_encode_info = new CFG_ENCODE_INFO();
+ cfg_encode_info.nChannelID = chanNo - 1;
+ boolean b = ConfigModule.GetNewDevConfig(loginId, chanNo - 1, CFG_CMD_ENCODE, cfg_encode_info);
+ if (b) {
+ int emCompression = cfg_encode_info.stuMainStream[0].stuVideoFormat.emCompression;//瑙嗛鏍煎紡
+ String videoEncType = "";
+ switch (emCompression) {
+ case 0:
+ videoEncType = "MPEG4";
+ break;
+ case 1:
+ videoEncType = "MS-MPEG4";
+ break;
+ case 2:
+ videoEncType = "MPEG2";
+ break;
+ case 3:
+ videoEncType = "MPEG1";
+ break;
+ case 4:
+ videoEncType = "H.263";
+ break;
+ case 5:
+ videoEncType = "MJPG";
+ break;
+ case 6:
+ videoEncType = "FCC-MPEG4";
+ break;
+ case 7:
+ videoEncType = "鏍囧噯h264";
+ break;
+ case 8:
+ videoEncType = "鏍囧噯h265";
+ break;
+ case 9:
+ videoEncType = "SVAC";
+ break;
+ default:
+ videoEncType = "鏈煡";
+ break;
+ }
+ int nBitRate = cfg_encode_info.stuMainStream[0].stuVideoFormat.nBitRate;
+ int nWidth = cfg_encode_info.stuMainStream[0].stuVideoFormat.nWidth;
+ int nHeight = cfg_encode_info.stuMainStream[0].stuVideoFormat.nHeight;
+ String resolution = nWidth + "*" + nHeight;
+ float nFrameRate = cfg_encode_info.stuMainStream[0].stuVideoFormat.nFrameRate;
+ map.put("resolution", resolution);//鍒嗚鲸鐜�
+ map.put("videoBitrate", String.valueOf(nBitRate));//姣旂壒鐜�
+ map.put("videoEncType", videoEncType);//缂栫爜
+ map.put("nFrameRate", String.valueOf(nFrameRate));//甯х巼
+ }
+ return map;
+ }
+
// 璁惧鏂嚎鍥炶皟: 褰撹澶囧嚭鐜版柇绾挎椂锛孲DK浼氳皟鐢ㄨ鍑芥暟
private static class DisConnect implements NetSDKLib.fDisConnect {
public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) {
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/HikSdkController.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/HikSdkController.java
index 6f9fbcb..7ccc486 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/HikSdkController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/HikSdkController.java
@@ -29,7 +29,6 @@
* @Date: 2023骞�01鏈�17鏃� 12:04
* @Version: 1.0
**/
-@Api(tags = "娴峰悍SDK鎺ュ彛")
@Controller
@RequestMapping("/hik")
@Anonymous
@@ -45,6 +44,7 @@
private String preview() {
return "preview";
}
+
@RequestMapping("/index")
private String index() {
return "test";
@@ -115,8 +115,8 @@
public @ResponseBody
AjaxResult getFocusPos(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
- Map<String, Object> Map = sdk.getFocusPos(cmd);
- return AjaxResult.success("鑾峰彇鑱氱劍鍊�", Map);
+ int focus = sdk.getFocusPos(cmd);
+ return AjaxResult.success("鑾峰彇鑱氱劍鍊�", focus);
}
@ApiOperation("璁剧疆鑱氱劍鍊�")
@@ -182,25 +182,6 @@
return toAjax(sdk.setZeroPtz(cmd));
}
- @ApiOperation("璁剧疆閿佸畾")
- @PostMapping("/setPTZLock")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.expired"})
- @Log(title = "璁剧疆閿佸畾", businessType = BusinessType.CONTROL)
- public @ResponseBody
- AjaxResult setPTZLock(@RequestBody CameraCmd cmd) {
- cmd.setOperator(SecurityUtils.getUserId());
- return AjaxResult.success(sdk.controlLock(cmd));
- }
-
- @ApiOperation("璁剧疆瑙i攣")
- @PostMapping("/setPTZUnLock")
- @ApiOperationSupport(includeParameters = {"cmd.cameraId"})
- @Log(title = "璁剧疆瑙i攣", businessType = BusinessType.CONTROL)
- public @ResponseBody
- AjaxResult setPTZUnLock(@RequestBody CameraCmd cmd) {
- cmd.setOperator(SecurityUtils.getUserId());
- return AjaxResult.success(sdk.controlUnLock(cmd));
- }
@ApiOperation("鑾峰彇浜戝彴閿佸畾淇℃伅")
@PostMapping("/getPTZLockInfo")
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/HCNetSDK.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/HCNetSDK.java
index d3dbd9f..7754aea 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/HCNetSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/HCNetSDK.java
@@ -1802,7 +1802,7 @@
public static class NET_DVR_COMPRESSIONCFG_V30 extends HIKSDKStructure {
public int dwSize;
public NET_DVR_COMPRESSION_INFO_V30 struNormHighRecordPara; //褰曞儚 瀵瑰簲8000鐨勬櫘閫�
- public NET_DVR_COMPRESSION_INFO_V30 struRes; //淇濈暀 String[28];
+ public NET_DVR_COMPRESSION_INFO_V30 struRes; //淇濈暀 String[28];
public NET_DVR_COMPRESSION_INFO_V30 struEventRecordPara; //浜嬩欢瑙﹀彂鍘嬬缉鍙傛暟
public NET_DVR_COMPRESSION_INFO_V30 struNetPara; //缃戜紶(瀛愮爜娴�)
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java
index a385d70..5c7bcf1 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/sdk/LoginResultCallBack.java
@@ -68,22 +68,17 @@
String name = camera.getId() + "_" + channel.getChanNo();
String rtspSource = "rtsp://" + camera.getUsername() + ":" + camera.getPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/h264/ch" + channel.getChanNo() + "/main/av_stream";
Vtdu vtdu = vtduService.selectVtduByName(name);
- if (vtdu == null) {
- //娣诲姞鍒版祦濯掍綋
- vtdu = new Vtdu();
- vtdu.setRtspSource(rtspSource);
- vtdu.setName(camera.getId() + "_" + channel.getChanNo());
- vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
- vtdu.setMode("1");//榛樿CPU杞В鐮�
- vtdu.setCameraId(camera.getId());
- vtduService.insertVtdu(vtdu);
- } else {
- if (!rtspSource.equals(vtdu.getRtspSource())) {
- //鏇存柊rtsp鍦板潃
- vtdu.setRtspSource(rtspSource);
- vtduService.updateVtdu(vtdu);
- }
+ if (vtdu != null) {
+ vtduService.deleteVtduByName(name);
}
+ //娣诲姞鍒版祦濯掍綋
+ vtdu = new Vtdu();
+ vtdu.setRtspSource(rtspSource);
+ vtdu.setName(camera.getId() + "_" + channel.getChanNo());
+ vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
+ vtdu.setMode("1");//榛樿CPU杞В鐮�
+ vtdu.setCameraId(camera.getId());
+ vtduService.insertVtdu(vtdu);
}
}
//鍒涘缓寮曞闃熷垪
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java
index b740fc8..a5606ed 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/IHikClientService.java
@@ -40,7 +40,7 @@
boolean setFocusPos(CameraCmd cmd);
//鑾峰彇鑱氱劍鍊�
- Map<String, Object> getFocusPos(CameraCmd cmd);
+ int getFocusPos(CameraCmd cmd);
//璁剧疆棰勭疆浣�
boolean setPreset(CameraCmd cmd);
@@ -49,12 +49,12 @@
boolean gotoPreset(CameraCmd cmd);
//鑾峰彇鐮佹祦鍘嬬缉鍙傛暟
- Map<String, String> getVideoCompressionCfg(CameraCmd cmd);
+ Map<String, Object> getVideoCompressionCfg(CameraCmd cmd);
//閫忛浘
boolean controlDefogcfg(CameraCmd cmd);
- //绾㈠?
+ //绾㈠
boolean controlInfrarecfg(CameraCmd cmd);
//鑱氱劍妯″紡
@@ -68,12 +68,6 @@
//闀滃ご闄ゅ啺
boolean controlCameraDeicing(CameraCmd cmd);
-
- //閰嶇疆閿佸畾
- boolean controlLock(CameraCmd cmd);
-
- //閰嶇疆瑙i攣
- boolean controlUnLock(CameraCmd cmd);
//鑾峰彇浜戝彴閿佸畾淇℃伅
int getPTZLockInfo(CameraCmd cmd);
@@ -109,7 +103,7 @@
String recordStopToMinio(CameraCmd cmd);
//鍋滄褰曞儚-涓嶄笂浼爉inio
- void recordStopNotToMinio(CameraCmd cmd);
+ boolean recordStopNotToMinio(CameraCmd cmd);
//鑾峰彇鐩告満閫氶亾淇℃伅
public List<ArdChannel> getCameraChannelList(ArdCameras camera);
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
index 126acde..b937b71 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
@@ -5,7 +5,6 @@
import com.ruoyi.common.annotation.SdkOperate;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
-import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.service.IArdCamerasService;
@@ -26,9 +25,7 @@
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
-
import java.util.Base64;
import javax.annotation.Resource;
import java.io.*;
@@ -184,22 +181,17 @@
String name = camera.getId() + "_" + channel.getChanNo();
String rtspSource = "rtsp://" + camera.getUsername() + ":" + camera.getPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/h264/ch" + channel.getChanNo() + "/main/av_stream";
Vtdu vtdu = vtduService.selectVtduByName(name);
- if (vtdu == null) {
- //娣诲姞鍒版祦濯掍綋
- vtdu = new Vtdu();
- vtdu.setRtspSource(rtspSource);
- vtdu.setName(camera.getId() + "_" + channel.getChanNo());
- vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
- vtdu.setMode("1");//榛樿CPU杞В鐮�
- vtdu.setCameraId(camera.getId());
- vtduService.insertVtdu(vtdu);
- } else {
- if (!rtspSource.equals(vtdu.getRtspSource())) {
- //鏇存柊rtsp鍦板潃
- vtdu.setRtspSource(rtspSource);
- vtduService.updateVtdu(vtdu);
- }
+ if (vtdu != null) {
+ vtduService.deleteVtduByName(name);
}
+ //娣诲姞鍒版祦濯掍綋
+ vtdu = new Vtdu();
+ vtdu.setRtspSource(rtspSource);
+ vtdu.setName(camera.getId() + "_" + channel.getChanNo());
+ vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
+ vtdu.setMode("1");//榛樿CPU杞В鐮�
+ vtdu.setCameraId(camera.getId());
+ vtduService.insertVtdu(vtdu);
}
}
//鍒涘缓寮曞闃熷垪
@@ -285,7 +277,7 @@
for (ArdCameras camera : ardCameras) {
Thread.sleep(500);
//寮傛鐧诲綍
- asyncLogin(camera);
+ syncLogin(camera);
}
} catch (Exception ex) {
log.error("鍒濆鍖栫櫥褰曠浉鏈哄紓甯革細" + ex.getMessage());
@@ -305,7 +297,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
boolean b = hCNetSDK.NET_DVR_Logout(userId);
if (b) {
GlobalVariable.loginMap.remove(cameraId);
@@ -325,7 +317,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
return hCNetSDK.NET_DVR_RemoteControl(userId, NET_DVR_CHECK_USER_STATUS, null, 0);
} catch (Exception ex) {
log.error("妫�娴嬪湪绾垮紓甯革細" + ex.getMessage());
@@ -344,7 +336,6 @@
* @淇敼浜哄拰鍏跺畠淇℃伅
*/
@Override
- @SdkOperate
public boolean pTZControlWithSpeed(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
@@ -354,7 +345,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
int dwStop;
if (enable) {
dwStop = 0;//寮�鍚�
@@ -431,7 +422,6 @@
* @param cmd 鐩告満鍛戒护
*/
@Override
- @SdkOperate
public boolean setFocusPos(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
@@ -440,7 +430,7 @@
return false;
}
// 鑾峰彇鍙傛暟
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
HCNetSDK.NET_DVR_STD_CONFIG struStdCfg = new HCNetSDK.NET_DVR_STD_CONFIG();
HCNetSDK.NET_DVR_GIS_INFO struGisInfo = new HCNetSDK.NET_DVR_GIS_INFO();
struGisInfo.struPtzPosEx.dwFocus = dwFocusPos;
@@ -467,14 +457,15 @@
* @param cmd 鐩告満鍛戒护
*/
@Override
- public Map<String, Object> getFocusPos(CameraCmd cmd) {
+ public int getFocusPos(CameraCmd cmd) {
+ int result = 0;
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
- return new HashMap<>();
+ return result;
}
// 鑾峰彇鍙傛暟
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
HCNetSDK.NET_DVR_STD_CONFIG struStdCfg = new HCNetSDK.NET_DVR_STD_CONFIG();
HCNetSDK.NET_DVR_GIS_INFO struGisInfo = new HCNetSDK.NET_DVR_GIS_INFO();
struStdCfg.read();
@@ -488,13 +479,12 @@
if (!bool) {
int code = hCNetSDK.NET_DVR_GetLastError();
log.error("鑾峰彇GIS淇℃伅鏁版嵁澶辫触,璇风◢鍚庨噸璇�" + code);
- return new HashMap<>();
+ return result;
} else {
struGisInfo.read();
- Map<String, Object> map = new HashMap<>();
- map.put("dwFocus", struGisInfo.struPtzPosEx.dwFocus);
- return map;
+ result = struGisInfo.struPtzPosEx.dwFocus;
}
+ return result;
}
/**
@@ -503,7 +493,6 @@
* @param cmd 鐩告満鍛戒护
*/
@Override
- @SdkOperate
public boolean setPreset(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
@@ -511,7 +500,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
boolean bool = hCNetSDK.NET_DVR_PTZPreset_Other(userId, channelNum, SET_PRESET, PresetIndex);
if (!bool) {
int code = hCNetSDK.NET_DVR_GetLastError();
@@ -526,7 +515,6 @@
* @param cmd 鐩告満鍛戒护
*/
@Override
- @SdkOperate
public boolean gotoPreset(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
@@ -534,7 +522,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
boolean bool = hCNetSDK.NET_DVR_PTZPreset_Other(userId, channelNum, GOTO_PRESET, PresetIndex);
if (!bool) {
int code = hCNetSDK.NET_DVR_GetLastError();
@@ -552,15 +540,15 @@
* @淇敼浜哄拰鍏跺畠淇℃伅
*/
@Override
- public Map<String, String> getVideoCompressionCfg(CameraCmd cmd) {
+ public Map<String, Object> getVideoCompressionCfg(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer chanNo = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return null;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
- Map<String, String> map = new HashMap<>();
+ Map<String, Object> map = new HashMap<>();
NET_DVR_COMPRESSIONCFG_V30 compressioncfg = new NET_DVR_COMPRESSIONCFG_V30();
compressioncfg.write();
Pointer pioint = compressioncfg.getPointer();
@@ -617,85 +605,85 @@
videoBitrate = "淇濈暀";
break;
case 1:
- videoBitrate = "16K(淇濈暀)";
+ videoBitrate = "16(淇濈暀)";
break;
case 2:
- videoBitrate = "32K";
+ videoBitrate = "32";
break;
case 3:
- videoBitrate = "48k";
+ videoBitrate = "48";
break;
case 4:
- videoBitrate = "64k";
+ videoBitrate = "64";
break;
case 5:
- videoBitrate = "80k";
+ videoBitrate = "80";
break;
case 6:
- videoBitrate = "96k";
+ videoBitrate = "96";
break;
case 7:
- videoBitrate = "128k";
+ videoBitrate = "128";
break;
case 8:
- videoBitrate = "160k";
+ videoBitrate = "160";
break;
case 9:
- videoBitrate = "192k";
+ videoBitrate = "192";
break;
case 10:
- videoBitrate = "224k";
+ videoBitrate = "224";
break;
case 11:
- videoBitrate = "256K";
+ videoBitrate = "256";
break;
case 12:
- videoBitrate = "320K";
+ videoBitrate = "320";
break;
case 13:
- videoBitrate = "384K";
+ videoBitrate = "384";
break;
case 14:
- videoBitrate = "448K";
+ videoBitrate = "448";
break;
case 15:
- videoBitrate = "512K";
+ videoBitrate = "512";
break;
case 16:
- videoBitrate = "640K";
+ videoBitrate = "640";
break;
case 17:
- videoBitrate = "768K";
+ videoBitrate = "768";
break;
case 18:
- videoBitrate = "896K";
+ videoBitrate = "896";
break;
case 19:
- videoBitrate = "1024K";
+ videoBitrate = "1024";
break;
case 20:
- videoBitrate = "1280K";
+ videoBitrate = "1280";
break;
case 21:
- videoBitrate = "1536K";
+ videoBitrate = "1536";
break;
case 22:
- videoBitrate = "1792K";
+ videoBitrate = "1792";
break;
case 23:
videoBitrate = "2048K";
break;
case 24:
- videoBitrate = "3072K";
+ videoBitrate = "3072";
break;
case 25:
- videoBitrate = "4096K";
+ videoBitrate = "4096";
break;
case 26:
- videoBitrate = "8192K";
+ videoBitrate = "8192";
break;
case 27:
- videoBitrate = "16384K";
+ videoBitrate = "16384";
break;
default:
videoBitrate = "鍏朵粬";
@@ -705,43 +693,43 @@
String resolution = "";
switch (compressioncfg.struNormHighRecordPara.byResolution) {
case 0:
- resolution = "DCIF(528*384/528*320)";
+ resolution = "528*384/528*320";
break;
case 1:
- resolution = "CIF(352*288/352*240)";
+ resolution = "352*288/352*240";
break;
case 2:
- resolution = "QCIF(176*144/176*120)";
+ resolution = "176*144/176*120";
break;
case 3:
- resolution = "4CIF(704*576/704*480)";
+ resolution = "704*576/704*480";
break;
case 4:
- resolution = "2CIF(704*288/704*240)";
+ resolution = "704*288/704*240";
break;
case 6:
- resolution = "QVGA(320*240)";
+ resolution = "320*240";
break;
case 7:
- resolution = "QQVGA(160*120)";
+ resolution = "160*120";
break;
case 16:
- resolution = "VGA(640*480)";
+ resolution = "640*480";
break;
case 17:
- resolution = "UXGA(1600*1200)";
+ resolution = "1600*1200";
break;
case 18:
- resolution = "SVGA(800*600)";
+ resolution = "800*600";
break;
case 19:
- resolution = "HD720P(1280*720)";
+ resolution = "1280*720";
break;
case 20:
- resolution = "XVGA(1280*960)";
+ resolution = "1280*960";
break;
case 21:
- resolution = "HD900P(1600*900)";
+ resolution = "1600*900";
break;
case 22:
resolution = "1360*1024";
@@ -753,7 +741,7 @@
resolution = "1920*1920";
break;
case 27:
- resolution = "1920*1080p";
+ resolution = "1920*1080";
break;
case 28:
resolution = "2560*1920";
@@ -768,10 +756,80 @@
resolution = "涓嶅湪褰撳墠鍒嗚鲸鐜囩储寮曪紝璇疯仈绯荤鐞嗗憳娣诲姞";
break;
}
- map.put("resolution", resolution);
- map.put("videoBitrate", videoBitrate);
- map.put("videoEncType", videoEncType);
- map.put("streamType", streamType);
+ //甯х巼
+ String nFrameRate = "";
+ switch (compressioncfg.struNormHighRecordPara.dwVideoFrameRate) {
+ case 0:
+ nFrameRate = "0";
+ break;
+ case 1:
+ nFrameRate = "1/16";
+ break;
+ case 2:
+ nFrameRate = "1/8";
+ break;
+ case 3:
+ nFrameRate = "1/4";
+ break;
+ case 4:
+ nFrameRate = "1/2";
+ break;
+ case 5:
+ nFrameRate = "1";
+ break;
+ case 6:
+ nFrameRate = "2";
+ break;
+ case 7:
+ nFrameRate = "4";
+ break;
+ case 8:
+ nFrameRate = "6";
+ break;
+ case 9:
+ nFrameRate = "8";
+ break;
+ case 10:
+ nFrameRate = "10";
+ break;
+ case 11:
+ nFrameRate = "12";
+ break;
+ case 12:
+ nFrameRate = "16";
+ break;
+ case 13:
+ nFrameRate = "20";
+ break;
+ case 14:
+ nFrameRate = "15";
+ break;
+ case 15:
+ nFrameRate = "18";
+ break;
+ case 16:
+ nFrameRate = "22";
+ break;
+ case 17:
+ nFrameRate = "25";
+ break;
+ case 18:
+ nFrameRate = "30";
+ break;
+ case 19:
+ nFrameRate = "35";
+ break;
+ case 20:
+ nFrameRate = "40";
+ break;
+ default:
+ nFrameRate = "鏈煡";
+ break;
+ }
+ map.put("resolution", resolution);//鍒嗚鲸鐜�
+ map.put("videoBitrate", videoBitrate);//姣旂壒鐜�
+ map.put("videoEncType", videoEncType);//缂栫爜
+ map.put("nFrameRate", nFrameRate);//甯х巼
} else {
int code = hCNetSDK.NET_DVR_GetLastError();
@@ -798,7 +856,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return new HashMap<>();
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_PTZPOS m_ptzPosCurrent = new NET_DVR_PTZPOS();
Pointer pioint = m_ptzPosCurrent.getPointer();
@@ -842,7 +900,6 @@
* @淇敼浜哄拰鍏跺畠淇℃伅 娉ㄦ剰淇话瑙掑害璐熷�奸渶瑕佸姞涓�360寰楀埌鐨勬鍊艰繘琛岃缃�
*/
@Override
- @SdkOperate
public boolean setPtz(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
@@ -850,13 +907,13 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_PTZPOS m_ptzPosCurrent = new NET_DVR_PTZPOS();
m_ptzPosCurrent.wAction = 1;
try {
- String p = String.valueOf((int)(ptz.get("p") * 10));
- String t = String.valueOf((int)(ptz.get("t") * 10));
- String z = String.valueOf((int)(ptz.get("z") * 10));
+ String p = String.valueOf((int) (ptz.get("p") * 10));
+ String t = String.valueOf((int) (ptz.get("t") * 10));
+ String z = String.valueOf((int) (ptz.get("z") * 10));
m_ptzPosCurrent.wPanPos = (short) (Integer.parseInt(p, 16));
m_ptzPosCurrent.wTiltPos = (short) (Integer.parseInt(t, 16));
m_ptzPosCurrent.wZoomPos = (short) (Integer.parseInt(z, 16));
@@ -875,14 +932,13 @@
}
@Override
- @SdkOperate
public boolean guideTargetPosition(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_PTZPOS m_ptzPosCurrent = new NET_DVR_PTZPOS();
m_ptzPosCurrent.wAction = 1;
try {
@@ -910,49 +966,6 @@
}
}
- /**
- * @鎻忚堪 鎿嶆帶閿佸畾
- * @鍙傛暟 [userId, channelNum]
- * @杩斿洖鍊� boolean
- * @鍒涘缓浜� 鍒樿嫃涔�
- * @鍒涘缓鏃堕棿 2023/1/17 16:36
- * @淇敼浜哄拰鍏跺畠淇℃伅 0-瑙i攣 1-閿佸畾
- */
- @Override
- @SdkOperate
- public boolean controlLock(CameraCmd cmd) {
- String cameraId = cmd.getCameraId();//鐢宠閿佺殑鐩告満
- ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId);
- Date now = new Date();
- now.setTime(now.getTime() + cmd.getExpired() * 1000);
- ardCameras.setOperatorExpired(now);//璁剧疆褰撳墠杩囨湡鏃堕棿
- ardCamerasService.updateArdCameras(ardCameras);
- return true;
- }
-
- /**
- * @鎻忚堪 鎿嶆帶瑙i攣
- * @鍙傛暟 [userId, channelNum]
- * @杩斿洖鍊� boolean
- * @鍒涘缓浜� 鍒樿嫃涔�
- * @鍒涘缓鏃堕棿 2023/6/30 15:36
- * @淇敼浜哄拰鍏跺畠淇℃伅
- */
- @Override
- public boolean controlUnLock(CameraCmd cmd) {
- String cameraId = cmd.getCameraId();//鐢宠瑙i攣鐨勭浉鏈�
- String operator = cmd.getOperator();//鐢宠鑰�
- ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId);
- if (ardCameras.getOperatorId().equals(operator)) {
- //濡傛灉瑙i攣鐩告満鐨勫綋鍓嶇敤鎴锋槸鐢宠鑰咃紝鍒欐竻绌鸿鐩告満鐨勮繃鏈熸椂闂�
- ardCameras.setOperatorExpired(null);
- int i = ardCamerasService.updateArdCameras(ardCameras);
- if (i > 0) {
- log.debug(cameraId + "--瑙i攣鎴愬姛");
- }
- }
- return true;
- }
/**
* @鎻忚堪 鑾峰彇ptz閿佸畾淇℃伅
@@ -969,7 +982,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return -1;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_PTZ_LOCKCFG netDvrPtzLockcfg = new NET_DVR_PTZ_LOCKCFG();
Pointer point = netDvrPtzLockcfg.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -1001,7 +1014,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_INITIALPOSITIONCTRL initialpositionctrl = new NET_DVR_INITIALPOSITIONCTRL();
initialpositionctrl.dwSize = initialpositionctrl.size();
@@ -1033,7 +1046,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return new HashMap<>();
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_PTZSCOPE m_ptzPosCurrent = new NET_DVR_PTZSCOPE();
Pointer point = m_ptzPosCurrent.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -1082,7 +1095,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_CAMERAPARAMCFG_EX struCameraParam = new NET_DVR_CAMERAPARAMCFG_EX();
Pointer point = struCameraParam.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -1128,7 +1141,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_CAMERAPARAMCFG_EX struDayNigh = new NET_DVR_CAMERAPARAMCFG_EX();
Pointer point = struDayNigh.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -1176,7 +1189,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_FOCUSMODE_CFG struFocusMode = new NET_DVR_FOCUSMODE_CFG();
Pointer point = struFocusMode.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -1219,7 +1232,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_FOCUSMODE_CFG struFocusMode = new NET_DVR_FOCUSMODE_CFG();
Pointer point = struFocusMode.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -1249,7 +1262,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
int dwStop;
if (enable) {
dwStop = 0;//寮�鍚�
@@ -1282,7 +1295,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_DEVSERVER_CFG struDeicing = new NET_DVR_DEVSERVER_CFG();
Pointer point = struDeicing.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -1319,7 +1332,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
NET_DVR_WORKSTATE_V30 devwork = new NET_DVR_WORKSTATE_V30();
if (!hCNetSDK.NET_DVR_GetDVRWorkState_V30(userId, devwork)) {
// 杩斿洖Boolean鍊硷紝鍒ゆ柇鏄惁鑾峰彇璁惧鑳藉姏
@@ -1362,7 +1375,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
//鍥剧墖淇℃伅
NET_DVR_JPEGPARA jpeg = new NET_DVR_JPEGPARA();
//璁剧疆鍥剧墖鍒嗚鲸鐜�
@@ -1426,7 +1439,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
//寮哄埗I甯х粨鏋勪綋瀵硅薄
HCNetSDK.NET_DVR_I_FRAME netDvrIFrame = new HCNetSDK.NET_DVR_I_FRAME(); //鏂板缓缁撴瀯浣撳璞�
netDvrIFrame.read();
@@ -1472,7 +1485,7 @@
log.debug("褰曞儚鍋滄");
//瀛樺叆minio
String BucketName = "record";
- String ObjectName =IdUtils.simpleUUID() + ".mp4";
+ String ObjectName = IdUtils.simpleUUID() + ".mp4";
FileInputStream stream = new FileInputStream(path);
boolean b = MinioUtil.uploadObject(BucketName, ObjectName, stream, stream.available(), "video/MP4");
if (b) {
@@ -1496,7 +1509,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
//寮哄埗I甯х粨鏋勪綋瀵硅薄
HCNetSDK.NET_DVR_I_FRAME netDvrIFrame = new HCNetSDK.NET_DVR_I_FRAME(); //鏂板缓缁撴瀯浣撳璞�
netDvrIFrame.read();
@@ -1553,7 +1566,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
//region 寮哄埗I甯�
HCNetSDK.NET_DVR_I_FRAME netDvrIFrame = new HCNetSDK.NET_DVR_I_FRAME(); //鏂板缓缁撴瀯浣撳璞�
netDvrIFrame.read();
@@ -1599,14 +1612,15 @@
}
@Override
- public void recordStopNotToMinio(CameraCmd cmd) {
+ public boolean recordStopNotToMinio(CameraCmd cmd) {
+ boolean result = false;
try {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
- return;
+ return false;
}
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
//寮哄埗I甯х粨鏋勪綋瀵硅薄
HCNetSDK.NET_DVR_I_FRAME netDvrIFrame = new HCNetSDK.NET_DVR_I_FRAME(); //鏂板缓缁撴瀯浣撳璞�
netDvrIFrame.read();
@@ -1633,9 +1647,12 @@
GlobalVariable.previewMap.remove(cameraId);
}
log.debug("褰曞儚鍋滄");
+ result = true;
} catch (Exception ex) {
log.error("褰曞儚鍋滄寮傚父" + ex.getMessage());
+ result = false;
}
+ return result;
}
//鑾峰彇IP閫氶亾
@@ -1691,7 +1708,7 @@
return new HashMap<>();
}
// 鑾峰彇鍙傛暟
- Integer userId = (Integer)GlobalVariable.loginMap.get(cameraId);
+ Integer userId = (Integer) GlobalVariable.loginMap.get(cameraId);
HCNetSDK.NET_DVR_STD_CONFIG struStdCfg = new HCNetSDK.NET_DVR_STD_CONFIG();
HCNetSDK.NET_DVR_GIS_INFO struGisInfo = new HCNetSDK.NET_DVR_GIS_INFO();
struStdCfg.read();
diff --git a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
index e24e4e6..4dd8d3b 100644
--- a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
+++ b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
@@ -85,7 +85,9 @@
vtdu.setRtspUrl(map.get("rtspUrl"));
vtdu.setRtmpUrl(map.get("rtmpUrl"));
vtdu.setWebrtcUrl(map.get("webrtcUrl"));
- vtduService.updateVtdu(vtdu);
+ //vtduService.updateVtdu(vtdu);
+ vtduService.deleteVtduByName(vtdu.getName());
+ vtduService.insertVtdu(vtdu);
return AjaxResult.success(map);
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java b/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java
index 5ea0a2d..afbbf20 100644
--- a/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java
+++ b/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java
@@ -6,6 +6,8 @@
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.device.camera.domain.CameraCmd;
+import com.ruoyi.device.camera.service.ICameraSdkService;
import com.ruoyi.media.service.IMediaService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,7 +40,8 @@
{
@Autowired
private IVtduService vtduService;
-
+ @Resource
+ private ICameraSdkService cameraSdkService;
/**
* 鏌ヨ娴佸獟浣撶鐞嗗垪琛�
*/
@@ -71,6 +74,27 @@
@GetMapping(value = "/{name}")
public AjaxResult getInfo(@PathVariable("name") String name)
{
+ //region 鑷姩杞爜
+ String[] nameArray = name.split("_");
+ String cameraId=nameArray[0];
+ Integer chanNo=Integer.valueOf(nameArray[1]);
+ CameraCmd cmd=new CameraCmd();
+ cmd.setCameraId(cameraId);
+ cmd.setChanNo(chanNo);
+ Map<String, Object> videoCompressionCfg = cameraSdkService.getVideoCompressionCfg(cmd);
+ String videoEncType = (String)videoCompressionCfg.get("videoEncType");
+ Vtdu vtdu = vtduService.selectVtduByName(name);
+ if(!videoEncType.equals("鏍囧噯h264"))
+ {
+ vtdu.setIsCode("1");
+ }
+ else
+ {
+ vtdu.setIsCode("0");
+ }
+ vtduService.deleteVtduByName(name);
+ vtduService.insertVtdu(vtdu);
+ //endregion
return success(vtduService.selectVtduByName(name));
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java b/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
index 5d04ef0..9f35a32 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
@@ -40,6 +40,8 @@
List<String> getNameList();
+ boolean checkNameExist(String name);
+
RtspSession getRtspSessionById(String sessionId);
WebrtcSession getWebrtcSessionById(String sessionId);
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
index 5d84867..bbd910c 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
@@ -84,14 +84,14 @@
mediaInfo.setMaxReaders(100);
mediaInfo.setSourceprotocol("tcp");
- List<String> nameList=new ArrayList<>();
+ List<String> nameList = new ArrayList<>();
String paths = mediaClient.paths();
JsonsRoot jsonsRoot = JSONObject.parseObject(paths, JsonsRoot.class);
List<Items> items = jsonsRoot.getItems();
for (Items item : items) {
nameList.add(item.getName());
}
- if(!nameList.contains(name)) {
+ if (!nameList.contains(name)) {
mediaClient.addPath(name, mediaInfo);
}
Map<String, String> map = new HashMap<>();
@@ -127,9 +127,10 @@
mediaInfo.setMaxReaders(100);
mediaInfo.setSourceprotocol("tcp");
- mediaClient.editPath(name, mediaInfo);
+ if (checkNameExist(name)) {
+ mediaClient.editPath(name, mediaInfo);
+ }
- // Map<String,String> map=new HashMap<>();
map.put("rtspUrl", rtspUrl);
map.put("rtmpUrl", rtmpUrl);
map.put("webrtcUrl", webrtcUrl);
@@ -169,13 +170,16 @@
@Override
public void removePath(String[] names) {
for (String name : names) {
- mediaClient.removePath(name);
+ if(checkNameExist(name)) {
+ mediaClient.removePath(name);}
}
}
@Override
public void removePath(String name) {
- mediaClient.removePath(name);
+ if(checkNameExist(name)) {
+ mediaClient.removePath(name);
+ }
}
@Override
@@ -448,22 +452,45 @@
return false;
}
}
+
/**
- * 鑾峰彇娴佸獟浣搉ame鍒楄〃
+ * 鑾峰彇娴佸獟浣搉ame鍒楄〃
* 鍒樿嫃涔�
* 2023/10/13 14:19:07
*/
@Override
public List<String> getNameList() {
- List<String> nameList=new ArrayList<>();
- String paths = mediaClient.paths();
- JsonsRoot jsonsRoot = JSONObject.parseObject(paths, JsonsRoot.class);
- List<Items> items = jsonsRoot.getItems();
- for (Items item : items) {
- nameList.add(item.getName());
+ List<String> nameList = new ArrayList<>();
+ try {
+ String paths = mediaClient.paths();
+ JsonsRoot jsonsRoot = JSONObject.parseObject(paths, JsonsRoot.class);
+ List<Items> items = jsonsRoot.getItems();
+ for (Items item : items) {
+ nameList.add(item.getName());
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error(ex.getMessage());
}
return nameList;
}
+
+ /**
+ * 妫�鏌ュ悕绉版槸鍚﹀瓨鍦�
+ * 鍒樿嫃涔�
+ * 2023/10/19 15:18:45
+ */
+ @Override
+ public boolean checkNameExist(String name) {
+ boolean result = false;
+ List<String> nameList = getNameList();
+ if (nameList.contains(name)) {
+ result = true;
+ }
+ return result;
+ }
+
/**
* 閰嶇疆娴佸獟浣撳弬鏁�
*/
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
index 05cc175..aac11e5 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
@@ -9,6 +9,8 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.device.camera.domain.CameraCmd;
+import com.ruoyi.device.camera.service.ICameraSdkService;
import com.ruoyi.media.service.IMediaService;
import com.ruoyi.utils.forest.MediaClient;
import lombok.extern.slf4j.Slf4j;
@@ -43,6 +45,7 @@
*/
@Override
public Vtdu selectVtduByName(String name) {
+
return vtduMapper.selectVtduByName(name);
}
@@ -121,6 +124,7 @@
*/
@Override
public int deleteVtduByName(String name) {
+ mediaService.removePath(name);
return vtduMapper.deleteVtduByName(name);
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/tools/ArdTool.java b/ard-work/src/main/java/com/ruoyi/utils/tools/ArdTool.java
index ded00ce..6c3522b 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/tools/ArdTool.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/tools/ArdTool.java
@@ -1,9 +1,7 @@
package com.ruoyi.utils.tools;
-import com.ruoyi.common.core.redis.RedisCache;
import lombok.extern.slf4j.Slf4j;
-import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.time.LocalTime;
@@ -121,4 +119,18 @@
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
return new DecimalFormat("#,###.##").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
}
+
+ /**
+ * byte鏁扮粍杞瓧绗︿覆
+ * 鍒樿嫃涔�
+ * 2023/10/18 8:42:59
+ * @param byteArray
+ */
+ public static String byteArrayToString(byte[] byteArray) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (byte b : byteArray) {
+ stringBuilder.append(String.valueOf(b));
+ }
+ return stringBuilder.toString();
+ }
}
diff --git a/ard-work/src/main/resources/templates/test.html b/ard-work/src/main/resources/templates/test.html
index 5b3d7d9..8c81faf 100644
--- a/ard-work/src/main/resources/templates/test.html
+++ b/ard-work/src/main/resources/templates/test.html
@@ -136,7 +136,7 @@
window.onload = function () {
console.log(RTCRtpReceiver.getCapabilities('video').codecs)
$.ajax({
- url: "../hik/list",
+ url: "../cameraSdk/list",
type: "get",
success: function (data) {
console.log(data);
@@ -144,7 +144,8 @@
for (var i = 0; i < arr.length; i++) {
console.log(arr[i].id);
var camera = {
- type: arr[i].gdtype,
+ name: arr[i].name,
+ factory: arr[i].factory,
ipaddr: arr[i].ip,
username: arr[i].username,
password: arr[i].password,
@@ -183,125 +184,125 @@
}
//浜戝彴涓婁笅宸﹀彸
$("#up").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 2;
var enable = true;
commondMethod(url, code, enable);
})
$("#up").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 2;
var enable = false;
commondMethod(url, code, enable);
})
$("#down").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 8;
var enable = true;
commondMethod(url, code, enable);
})
$("#down").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 8;
var enable = false;
commondMethod(url, code, enable);
})
$("#left").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 4;
var enable = true;
commondMethod(url, code, enable);
})
$("#left").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 4;
var enable = false;
commondMethod(url, code, enable);
})
$("#right").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 6;
var enable = true;
commondMethod(url, code, enable);
})
$("#right").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 6;
var enable = false;
commondMethod(url, code, enable);
})
//鍙樺��
$("#controlZoomIn").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 10;
var enable = true;
commondMethod(url, code, enable);
})
$("#controlZoomIn").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 10;
var enable = false;
commondMethod(url, code, enable);
})
$("#controlZoomOut").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 11;
var enable = true;
commondMethod(url, code, enable);
})
$("#controlZoomOut").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 11;
var enable = false;
commondMethod(url, code, enable);
})
//鍙樼劍
$("#controlFocusNear").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 12;
var enable = true;
commondMethod(url, code, enable);
})
$("#controlFocusNear").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 12;
var enable = false;
commondMethod(url, code, enable);
})
$("#controlFocusFar").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 13;
var enable = true;
commondMethod(url, code, enable);
})
$("#controlFocusFar").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 13;
var enable = false;
commondMethod(url, code, enable);
})
//鍏夊湀
$("#controlIrisOpen").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 14;
var enable = true;
commondMethod(url, code, enable);
})
$("#controlIrisOpen").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 14;
var enable = false;
commondMethod(url, code, enable);
})
$("#controlIrisClose").mousedown(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 15;
var enable = true;
commondMethod(url, code, enable);
})
$("#controlIrisClose").mouseup(function () {
- var url = "../hik/PTZControlWithSpeed";
+ var url = "../cameraSdk/PTZControlWithSpeed";
var code = 15;
var enable = false;
commondMethod(url, code, enable);
@@ -316,7 +317,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/setPreset",
+ url: "../cameraSdk/setPreset",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
@@ -334,7 +335,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/gotoPreset",
+ url: "../cameraSdk/gotoPreset",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
@@ -352,7 +353,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/getPTZ",
+ url: "../cameraSdk/getPTZ",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
@@ -386,7 +387,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/setPTZ",
+ url: "../cameraSdk/setPTZ",
type: "post",
dataType: "json",
data: JSON.stringify(myEntity),
@@ -414,7 +415,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/setTargetPosition",
+ url: "../cameraSdk/setTargetPosition",
type: "post",
dataType: "json",
data: JSON.stringify(myEntity),
@@ -432,7 +433,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/setZeroPTZ",
+ url: "../cameraSdk/setZeroPTZ",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
@@ -450,7 +451,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/PTZControlWithSpeed",
+ url: "../cameraSdk/PTZControlWithSpeed",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
@@ -473,7 +474,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/defogcfg",
+ url: "../cameraSdk/defogcfg",
type: "post",
dataType: "json",
data: JSON.stringify(optOpen),
@@ -490,7 +491,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/defogcfg",
+ url: "../cameraSdk/defogcfg",
type: "post",
dataType: "json",
data: JSON.stringify(optClose),
@@ -515,7 +516,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/infrarecfg",
+ url: "../cameraSdk/infrarecfg",
type: "post",
dataType: "json",
data: JSON.stringify(optOpen),
@@ -533,7 +534,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/infrarecfg",
+ url: "../cameraSdk/infrarecfg",
type: "post",
dataType: "json",
data: JSON.stringify(optClose),
@@ -557,7 +558,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/focusMode",
+ url: "../cameraSdk/focusMode",
type: "post",
dataType: "json",
data: JSON.stringify(optOpen),
@@ -574,7 +575,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/focusMode",
+ url: "../cameraSdk/focusMode",
type: "post",
dataType: "json",
data: JSON.stringify(optClose),
@@ -593,13 +594,13 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/getFocusPos",
+ url: "../cameraSdk/getFocusPos",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
success: function (datas) {
console.log(datas);
- $("#focus").val(datas.data.dwFocus);
+ $("#focus").val(datas.data);
}
})
})
@@ -617,7 +618,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/heateRpwron",
+ url: "../cameraSdk/heateRpwron",
type: "post",
dataType: "json",
data: JSON.stringify(optOpen),
@@ -634,7 +635,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/heateRpwron",
+ url: "../cameraSdk/heateRpwron",
type: "post",
dataType: "json",
data: JSON.stringify(optClose),
@@ -657,7 +658,7 @@
'Accept': 'application/json',
'Content-Type': 'application/json'
},
- url: "../hik/cameraDeicing",
+ url: "../cameraSdk/cameraDeicing",
type: "post",
dataType: "json",
data: JSON.stringify(optOpen),
@@ -674,7 +675,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/cameraDeicing",
+ url: "../cameraSdk/cameraDeicing",
type: "post",
dataType: "json",
data: JSON.stringify(optClose),
@@ -693,7 +694,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/captureJPEGPicture",
+ url: "../cameraSdk/captureJPEGPicture",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
@@ -712,13 +713,16 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/picCutCate",
+ url: "../cameraSdk/picCutCate",
type: "post",
dataType: "json",
data: JSON.stringify(opt),
success: function (data) {
console.log(data.data);
- $('#imgContainer').attr('src', data.data);
+ setTimeout(() => {
+ $('#imgContainer').attr('src', data.data);
+ }, 1000 )
+
}
})
})
@@ -736,7 +740,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/record",
+ url: "../cameraSdk/record",
type: "post",
dataType: "json",
data: JSON.stringify(optOpen),
@@ -753,7 +757,7 @@
'Content-Type': 'application/json',
'Authorization': token
},
- url: "../hik/record",
+ url: "../cameraSdk/record",
dataType: "json",
data: JSON.stringify(optClose),
type: "post",
@@ -769,7 +773,7 @@
/*浜戝彴鍏叡鏂规硶*/
function commondMethod(url, code, enable) {
cameraId = $('#select option:selected').val();
- opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "enable": enable, "code": code};
+ opt = {"cameraId": cameraId, "chanNo": 1, "speed": 4, "enable": enable, "code": code};
$.ajax({
headers: {
'Accept': 'application/json',
@@ -797,9 +801,9 @@
var cameraId = $('#select option:selected').val();
let camera = cameraMap.get(cameraId);
console.log(camera);
- if (camera.type == "ys") {
+ if (camera.factory == "3") {
realViewYs("127.0.0.1", ID, camera.username, camera.password, camera.ipaddr, camera.port);
- } else if (camera.type == "dh") {
+ } else if (camera.factory == "2") {
realViewDh("127.0.0.1", ID, camera.username, camera.password, camera.ipaddr, camera.port);
} else {
realViewHik("127.0.0.1", ID, camera.username, camera.password, camera.ipaddr, camera.port);
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java
index c2fee6a..ad26400 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java
@@ -6,6 +6,7 @@
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.service.IArdCamerasService;
import com.ruoyi.device.channel.domain.ArdChannel;
+import com.ruoyi.device.dhsdk.service.IDhClientService;
import com.ruoyi.device.hiksdk.service.IHikClientService;
import com.ruoyi.media.domain.Items;
import com.ruoyi.media.domain.JsonsRoot;
@@ -37,7 +38,9 @@
@Resource
IArdCamerasService iArdCamerasService;
@Resource
- IHikClientService iHikClientService;
+ IHikClientService hikClientService;
+ @Resource
+ IDhClientService dhClientService;
@Resource
IVtduService vtduService;
@Resource
@@ -50,15 +53,20 @@
*/
public void cameraState() {
try {
- ArdCameras ardCamera = new ArdCameras();
- ardCamera.setFactory("1");
+ ArdCameras ardCamera = new ArdCameras();
+ //璋冪敤鏌ヨ鏂规硶
List<ArdCameras> ardCameras = iArdCamerasService.selectArdCamerasListNoDataScope(ardCamera);
for (ArdCameras camera : ardCameras) {
CameraCmd cmd = new CameraCmd();
cmd.setCameraId(camera.getId());
- boolean onLineNew = iHikClientService.isOnLine(cmd);//鐩告満瀹炴椂鐘舵��
- boolean onLineOld = "1".equals(camera.getState());//鐩告満鍘嗗彶鐘舵��
- //褰撶姸鎬佸彂鐢熷彉鍖栨椂锛屾洿鏂板疄鏃剁姸鎬�
+ boolean onLineNew = false;
+ // 鍒ゆ柇鏄�1杩樻槸2
+ if (camera.getFactory().equals("1")) {
+ onLineNew = hikClientService.isOnLine(cmd);
+ } else if (camera.getFactory().equals("2")) {
+ onLineNew = dhClientService.isOnLine(cmd);
+ }
+ boolean onLineOld = "1".equals(camera.getState());
if (onLineNew != onLineOld) {
if (onLineNew) {
camera.setState("1");
@@ -67,7 +75,6 @@
}
iArdCamerasService.updateArdCameras(camera);
}
-
}
} catch (Exception ex) {
log.error("鍚屾鐩告満鍦ㄧ嚎鐘舵�佸紓甯�:" + ex.getMessage());
@@ -107,10 +114,11 @@
* 2023/10/13 14:13:53
*/
public void vtdu() {
- List<String> nameList = mediaService.getNameList();
+
List<Vtdu> vtdus = vtduService.selectVtduList(new Vtdu());
for (Vtdu vtdu : vtdus) {
- if (!nameList.contains(vtdu.getName())) {
+ boolean nameExist = mediaService.checkNameExist(vtdu.getName());
+ if (!nameExist) {
mediaService.addPath(vtdu.getName(), vtdu.getRtspSource(), vtdu.getMode(), vtdu.getIsCode());
}
}
--
Gitblit v1.9.3