From b80cff6055cd8c261393698deb897e86a6f4dc1d Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期二, 17 十月 2023 13:18:55 +0800
Subject: [PATCH] 1. 增加聚焦模式切换接口 2. 增加短时录像接口 3. 增加目标引导接口 4. 增加预置点设置调取接口
---
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java | 48 +---
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/ConfigModule.java | 36 +++
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/LoginModule.java | 6
ard-work/src/main/java/com/ruoyi/device/dhsdk/service/IDhClientService.java | 7
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/RealPlayModule.java | 75 ++++++
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java | 4
ard-work/src/main/java/com/ruoyi/device/dhsdk/module/PtzControlModule.java | 309 ++++++++++++++-------------
ard-work/src/main/java/com/ruoyi/device/camera/service/ICameraSdkService.java | 3
ard-work/src/main/java/com/ruoyi/device/dhsdk/service/impl/DhClientServiceImpl.java | 164 +++++++++++++-
ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java | 2
10 files changed, 437 insertions(+), 217 deletions(-)
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 7bb9070..81adfa8 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
@@ -210,7 +210,7 @@
@ApiOperation("璁剧疆闆舵柟浣嶈")
@PostMapping("/setZeroPTZ")
@Log(title = "璁剧疆闆舵柟浣嶈", businessType = BusinessType.CONTROL)
- @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.cmd.chanNo"})
+ @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
public @ResponseBody
AjaxResult setZeroPTZ(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
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 c39fe05..dc7f5cf 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
@@ -17,9 +17,6 @@
//寮傛鐧诲綍
void asyncLogin(ArdCameras cameras);
- //鐧诲綍鎵�鏈夌浉鏈�
- void loginAll();
-
//娉ㄩ攢
boolean logout(String cameraId);
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 bc888e1..97591be 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
@@ -48,7 +48,6 @@
dhClientService.loginAll();//鐧诲綍鍏ㄩ儴澶у崕鐩告満
}
}
-
@Override
public void syncLogin(ArdCameras cameras) {
@@ -60,15 +59,10 @@
}
@Override
- public void loginAll() {
-
- }
-
- @Override
public boolean logout(String cameraId) {
return false;
}
-
+ //鍦ㄧ嚎妫�娴�
@Override
public boolean isOnLine(CameraCmd cmd) {
try {
@@ -89,7 +83,7 @@
return false;
}
}
-
+ //浜戝彴鎺у埗
@Override
public boolean pTZControl(CameraCmd cmd) {
try {
@@ -110,7 +104,6 @@
return false;
}
}
-
//璁剧疆鑱氱劍鍊�
@Override
public boolean setFocusPos(CameraCmd cmd) {
@@ -132,8 +125,6 @@
}
return result;
}
-
-
//鑾峰彇鑱氱劍鍊�
@Override
public Map<String, Object> getFocusPos(CameraCmd cmd) {
@@ -154,7 +145,6 @@
}
return map;
}
-
//璁剧疆棰勭疆浣�
@Override
public boolean setPreset(CameraCmd cmd) {
@@ -167,7 +157,7 @@
if (factory.equals("1")) {
result = hikClientService.setPreset(cmd);
} else if (factory.equals("2")) {
-
+ result = dhClientService.setPreset(cmd);
}
}
} catch (Exception ex) {
@@ -175,7 +165,6 @@
}
return result;
}
-
//璋冪敤棰勭疆浣�
@Override
public boolean gotoPreset(CameraCmd cmd) {
@@ -188,7 +177,7 @@
if (factory.equals("1")) {
result = hikClientService.gotoPreset(cmd);
} else if (factory.equals("2")) {
-
+ result = dhClientService.gotoPreset(cmd);
}
}
} catch (Exception ex) {
@@ -196,7 +185,6 @@
}
return result;
}
-
//鑾峰彇鐮佹祦鍘嬬缉鍙傛暟
@Override
public Map<String, String> getVideoCompressionCfg(CameraCmd cmd) {
@@ -217,7 +205,6 @@
}
return map;
}
-
//閫忛浘寮�鍏�
@Override
public boolean controlDefogcfg(CameraCmd cmd) {
@@ -238,7 +225,6 @@
}
return result;
}
-
//绾㈠寮�鍏�
@Override
public boolean controlInfrarecfg(CameraCmd cmd) {
@@ -259,8 +245,6 @@
}
return result;
}
-
-
//鎵嬪姩/鑷姩鑱氱劍
@Override
public boolean controlFocusMode(CameraCmd cmd) {
@@ -273,7 +257,7 @@
if (factory.equals("1")) {
result = hikClientService.controlFocusMode(cmd);
} else if (factory.equals("2")) {
-
+ result = dhClientService.controlFocusMode(cmd);
}
}
} catch (Exception ex) {
@@ -281,7 +265,6 @@
}
return result;
}
-
//鑾峰彇鑱氱劍妯″紡
@Override
public String getFocusMode(CameraCmd cmd) {
@@ -302,7 +285,6 @@
}
return result;
}
-
//浜戝彴鍔犵儹
@Override
public boolean controlPTHeateRpwron(CameraCmd cmd) {
@@ -323,7 +305,6 @@
}
return result;
}
-
//闀滃ご鍔犵儹
@Override
public boolean controlCameraDeicing(CameraCmd cmd) {
@@ -344,7 +325,6 @@
}
return result;
}
-
//鎿嶆帶閿佸畾
@Override
public boolean controlLock(CameraCmd cmd) {
@@ -365,8 +345,6 @@
}
return result;
}
-
-
//璁剧疆瑙i攣
@Override
public boolean controlUnLock(CameraCmd cmd) {
@@ -387,7 +365,6 @@
}
return result;
}
-
//鑾峰彇浜戝彴閿佸畾淇℃伅
@Override
public int getPTZLockInfo(CameraCmd cmd) {
@@ -413,7 +390,7 @@
public String captureJPEGPicture(CameraCmd cmd) {
return null;
}
-
+ //鎶撳浘
@Override
public String picCutCate(CameraCmd cmd) {
String url = "";
@@ -453,7 +430,6 @@
}
return map;
}
-
//鑾峰彇ptz鑼冨洿
@Override
public Map<String, Object> getPtzScope(CameraCmd cmd) {
@@ -474,7 +450,7 @@
}
return map;
}
-
+ //璁剧疆ptz
@Override
public boolean setPtz(CameraCmd cmd) {
boolean result = false;
@@ -494,7 +470,7 @@
}
return result;
}
-
+ //璁剧疆闆舵柟浣嶈
@Override
public boolean setZeroPtz(CameraCmd cmd) {
boolean result = false;
@@ -514,8 +490,6 @@
}
return result;
}
-
-
//寮曞鎸囧悜鐩爣
@Override
public boolean guideTargetPosition(CameraCmd cmd) {
@@ -536,7 +510,7 @@
}
return result;
}
-
+ //寮�濮嬪綍鍍�
@Override
public boolean recordStart(CameraCmd cmd) {
boolean result = false;
@@ -556,7 +530,7 @@
}
return result;
}
-
+ //鍋滄褰曞儚骞跺瓨鍏inio
@Override
public String recordStopToMinio(CameraCmd cmd) {
String url = "";
@@ -576,7 +550,7 @@
}
return url;
}
-
+ //鍋滄褰曞儚骞朵笉瀛樺叆minio
@Override
public void recordStopNotToMinio(CameraCmd cmd) {
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java
index 8c15c38..0b1c73d 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/CapturePictureModule.java
@@ -14,6 +14,8 @@
*/
public class CapturePictureModule {
+ public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
+
/**
* \if ENGLISH_LANG
* Local Capture Picture
@@ -23,7 +25,7 @@
*/
public static boolean localCapturePicture(NetSDKLib.LLong hPlayHandle, String picFileName) {
- if (!LoginModule.netsdk.CLIENT_CapturePictureEx(hPlayHandle, picFileName, NetSDKLib.NET_CAPTURE_FORMATS.NET_CAPTURE_JPEG)) {
+ if (!netsdk.CLIENT_CapturePictureEx(hPlayHandle, picFileName, NetSDKLib.NET_CAPTURE_FORMATS.NET_CAPTURE_JPEG)) {
System.err.printf("CLIENT_CapturePicture Failed!" + ToolKits.getErrorCodePrint());
return false;
} else {
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 a435d75..bb99075 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
@@ -3,6 +3,7 @@
import com.ruoyi.device.dhsdk.lib.NetSDKLib;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
+import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint;
/**
* @Description:
@@ -12,6 +13,7 @@
**/
public class ConfigModule {
public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
+ public static NetSDKLib configsdk = NetSDKLib.CONFIG_INSTANCE;
/**
* 鏌ヨ璁惧鐘舵��
*/
@@ -19,10 +21,42 @@
IntByReference intRetLen = new IntByReference();
stuInfo.write();
- if (!LoginModule.netsdk.CLIENT_QueryDevState(hLoginHandle, nType, stuInfo.getPointer(), stuInfo.size(), intRetLen, 3000)) {
+ if (!netsdk.CLIENT_QueryDevState(hLoginHandle, nType, stuInfo.getPointer(), stuInfo.size(), intRetLen, 3000)) {
return false;
}
stuInfo.read();
return true;
}
+ /**
+ * 璁剧疆鍗曚釜閰嶇疆
+ * @param hLoginHandle 鐧婚檰鍙ユ焺
+ * @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;
+ byte szBuffer[] = new byte[nBufferLen];
+ 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)) {
+ result = true;
+ } else {
+ System.err.printf("Set %s Config Failed! Last Error = %s\n" , strCmd , getErrorCodePrint());
+ result = false;
+ }
+ } else {
+ System.err.println("Packet " + strCmd + " Config Failed!" + getErrorCodePrint());
+ result = false;
+ }
+
+ return result;
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/LoginModule.java b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/LoginModule.java
index dff3f36..da42a76 100644
--- a/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/LoginModule.java
+++ b/ard-work/src/main/java/com/ruoyi/device/dhsdk/module/LoginModule.java
@@ -4,13 +4,8 @@
import com.ruoyi.device.dhsdk.lib.NetSDKLib.LLong;
import com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY;
import com.ruoyi.device.dhsdk.lib.NetSDKLib.NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY;
-import com.ruoyi.device.dhsdk.lib.ToolKits;
-import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
import lombok.extern.slf4j.Slf4j;
-
-import java.io.File;
-
import static com.ruoyi.device.dhsdk.lib.ToolKits.getErrorCodePrint;
/**
@@ -21,7 +16,6 @@
public class LoginModule {
public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
- public static NetSDKLib configsdk = NetSDKLib.CONFIG_INSTANCE;
// 璁惧淇℃伅
public static NetSDKLib.NET_DEVICEINFO_Ex m_stDeviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
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 5885eee..31ecfe6 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
@@ -7,200 +7,215 @@
* 涓昏鏈� 锛氬叓涓柟鍚戞帶鍒躲�佸彉鍊嶃�佸彉鐒︺�佸厜鍦堝姛鑳�
*/
public class PtzControlModule {
+ public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
- /**
- * 鍚戜笂
- */
- public static boolean ptzControlUpStart(NetSDKLib.LLong lLoginID,int nChannelID, int lParam1, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlUpEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
- 0, 0, 0, 1);
- }
-
- /**
- * 鍚戜笅
- */
- public static boolean ptzControlDownStart(int nChannelID, int lParam1, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlDownEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
- 0, 0, 0, 1);
- }
-
- /**
- * 鍚戝乏
- */
- public static boolean ptzControlLeftStart(int nChannelID, int lParam1, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlLeftEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
- 0, 0, 0, 1);
- }
-
- /**
- * 鍚戝彸
- */
- public static boolean ptzControlRightStart(int nChannelID, int lParam1,int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlRightEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
- 0, 0, 0, 1);
- }
-
- /**
- * 鍚戝乏涓�
- */
- public static boolean ptzControlLeftUpStart(int nChannelID, int lParam1, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlLeftUpEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
- 0, 0, 0, 1);
- }
-
- /**
- * 鍚戝彸涓�
- */
- public static boolean ptzControlRightUpStart(int nChannelID, int lParam1, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlRightUpEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
- 0, 0, 0, 1);
- }
+ /**
+ * 鍚戜笂
+ */
+ public static boolean ptzControlUpStart(NetSDKLib.LLong lLoginID, int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
+ lParam1, lParam2, 0, 0);
+ }
- /**
- * 鍚戝乏涓�
- */
- public static boolean ptzControlLeftDownStart(int nChannelID, int lParam1, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlLeftDownEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
- 0, 0, 0, 1);
- }
-
- /**
- * 鍚戝彸涓�
- */
- public static boolean ptzControlRightDownStart(int nChannelID, int lParam1, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
- lParam1, lParam2, 0, 0);
- }
- public static boolean ptzControlRightDownEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
- 0, 0, 0, 1);
- }
-
+ public static boolean ptzControlUpEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL,
+ 0, 0, 0, 1);
+ }
+
+ /**
+ * 鍚戜笅
+ */
+ public static boolean ptzControlDownStart(int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
+ lParam1, lParam2, 0, 0);
+ }
+
+ public static boolean ptzControlDownEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL,
+ 0, 0, 0, 1);
+ }
+
+ /**
+ * 鍚戝乏
+ */
+ public static boolean ptzControlLeftStart(int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
+ lParam1, lParam2, 0, 0);
+ }
+
+ public static boolean ptzControlLeftEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL,
+ 0, 0, 0, 1);
+ }
+
+ /**
+ * 鍚戝彸
+ */
+ public static boolean ptzControlRightStart(int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
+ lParam1, lParam2, 0, 0);
+ }
+
+ public static boolean ptzControlRightEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL,
+ 0, 0, 0, 1);
+ }
+
+ /**
+ * 鍚戝乏涓�
+ */
+ 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,
+ lParam1, lParam2, 0, 0);
+ }
+
+ public static boolean ptzControlLeftUpEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP,
+ 0, 0, 0, 1);
+ }
+
+ /**
+ * 鍚戝彸涓�
+ */
+ public static boolean ptzControlRightUpStart(int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
+ lParam1, lParam2, 0, 0);
+ }
+
+ public static boolean ptzControlRightUpEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP,
+ 0, 0, 0, 1);
+ }
+
+ /**
+ * 鍚戝乏涓�
+ */
+ public static boolean ptzControlLeftDownStart(int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
+ lParam1, lParam2, 0, 0);
+ }
+
+ public static boolean ptzControlLeftDownEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN,
+ 0, 0, 0, 1);
+ }
+
+ /**
+ * 鍚戝彸涓�
+ */
+ public static boolean ptzControlRightDownStart(int nChannelID, int lParam1, int lParam2) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
+ lParam1, lParam2, 0, 0);
+ }
+
+ public static boolean ptzControlRightDownEnd(int nChannelID) {
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN,
+ 0, 0, 0, 1);
+ }
+
/**
* 鍙樺��+
*/
public static boolean ptzControlZoomAddStart(int nChannelID, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
- 0, lParam2, 0, 0);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
+ 0, lParam2, 0, 0);
}
+
public static boolean ptzControlZoomAddEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
- 0, 0, 0, 1);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL,
+ 0, 0, 0, 1);
}
/**
* 鍙樺��-
*/
public static boolean ptzControlZoomDecStart(int nChannelID, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
- 0, lParam2, 0, 0);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
+ 0, lParam2, 0, 0);
}
+
public static boolean ptzControlZoomDecEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
- 0, 0, 0, 1);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL,
+ 0, 0, 0, 1);
}
/**
* 鍙樼劍+
*/
public static boolean ptzControlFocusAddStart(int nChannelID, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
- 0, lParam2, 0, 0);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
+ 0, lParam2, 0, 0);
}
+
public static boolean ptzControlFocusAddEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
- 0, 0, 0, 1);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_ADD_CONTROL,
+ 0, 0, 0, 1);
}
/**
* 鍙樼劍-
*/
public static boolean ptzControlFocusDecStart(int nChannelID, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
- 0, lParam2, 0, 0);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
+ 0, lParam2, 0, 0);
}
+
public static boolean ptzControlFocusDecEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
- 0, 0, 0, 1);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_FOCUS_DEC_CONTROL,
+ 0, 0, 0, 1);
}
/**
* 鍏夊湀+
*/
public static boolean ptzControlIrisAddStart(int nChannelID, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
- 0, lParam2, 0, 0);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
+ 0, lParam2, 0, 0);
}
+
public static boolean ptzControlIrisAddEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
- 0, 0, 0, 1);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_ADD_CONTROL,
+ 0, 0, 0, 1);
}
/**
* 鍏夊湀-
*/
public static boolean ptzControlIrisDecStart(int nChannelID, int lParam2) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
- 0, lParam2, 0, 0);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
+ 0, lParam2, 0, 0);
}
+
public static boolean ptzControlIrisDecEnd(int nChannelID) {
- return LoginModule.netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
- NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
- 0, 0, 0, 1);
+ return netsdk.CLIENT_DHPTZControlEx(LoginModule.m_hLoginHandle, nChannelID,
+ NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL,
+ 0, 0, 0, 1);
}
}
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 46e6fc7..a397132 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
@@ -2,6 +2,10 @@
import com.ruoyi.device.dhsdk.lib.NetSDKLib;
import com.ruoyi.device.dhsdk.lib.ToolKits;
+import com.sun.jna.Pointer;
+
+import static com.ruoyi.device.dhsdk.module.LoginModule.netsdk;
+
/**
* 瀹炴椂棰勮鎺ュ彛瀹炵幇
* 涓昏鏈� 锛氬紑濮嬫媺娴併�佸仠姝㈡媺娴佸姛鑳�
@@ -15,7 +19,26 @@
* \endif
*/
public static NetSDKLib.LLong startRealPlay(NetSDKLib.LLong m_hLoginHandle, int channel, int stream) {
- NetSDKLib.LLong m_hPlayHandle = LoginModule.netsdk.CLIENT_RealPlayEx(m_hLoginHandle, channel, null, 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) {
+ 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) {
System.err.println("寮�濮嬪疄鏃堕瑙堝け璐ワ紝閿欒鐮�" + ToolKits.getErrorCodePrint());
} else {
@@ -35,10 +58,56 @@
if (m_hPlayHandle.longValue() == 0) {
return;
}
-
- boolean bRet = LoginModule.netsdk.CLIENT_StopRealPlayEx(m_hPlayHandle);
+ boolean bRet = netsdk.CLIENT_StopRealPlayEx(m_hPlayHandle);
if (bRet) {
m_hPlayHandle.setValue(0);
}
}
+
+ /**
+ * 瀹炴椂棰勮鏁版嵁鍥炶皟鍑芥暟--鎵╁睍(pBuffer鍐呭瓨鐢盨DK鍐呴儴鐢宠閲婃斁)
+ */
+ private static class CbfRealDataCallBackEx implements NetSDKLib.fRealDataCallBackEx {
+ private CbfRealDataCallBackEx() {
+ }
+
+ private static class CallBackHolder {
+ private static CbfRealDataCallBackEx instance = new CbfRealDataCallBackEx();
+ }
+
+ public static CbfRealDataCallBackEx getInstance() {
+ return CallBackHolder.instance;
+ }
+
+ @Override
+ public void invoke(NetSDKLib.LLong lRealHandle, int dwDataType, Pointer pBuffer,
+ int dwBufSize, int param, Pointer dwUser) {
+ int bInput = 0;
+ if (0 != lRealHandle.longValue()) {
+ switch (dwDataType) {
+ case 0:
+ System.out.println("鐮佹祦澶у皬涓�" + dwBufSize + "\n" + "鐮佹祦绫诲瀷涓哄師濮嬮煶瑙嗛娣峰悎鏁版嵁");
+ break;
+ case 1:
+ //鏍囧噯瑙嗛鏁版嵁
+ System.out.println("鐮佹祦澶у皬涓�" + dwBufSize + "\n" + "鐮佹祦绫诲瀷涓烘爣鍑嗚棰戞暟鎹�");
+ break;
+ case 2:
+ //yuv 鏁版嵁
+ System.out.println("鐮佹祦澶у皬涓�" + dwBufSize + "\n" + "鐮佹祦绫诲瀷涓簓uv鏁版嵁");
+ break;
+ case 3:
+ //pcm 闊抽鏁版嵁
+ System.out.println("鐮佹祦澶у皬涓�" + dwBufSize + "\n" + "鐮佹祦绫诲瀷涓洪煶棰戞暟鎹�");
+ break;
+ case 4:
+ //鍘熷闊抽鏁版嵁
+ System.out.println("鐮佹祦澶у皬涓�" + dwBufSize + "\n" + "鐮佹祦绫诲瀷涓哄師濮嬮煶棰戞暟鎹�");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
}
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 538a049..32ad998 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
@@ -54,4 +54,11 @@
//寮曞鐩爣浣嶇疆
boolean guideTargetPosition(CameraCmd cmd);
+
+ //璋冪敤棰勭疆浣�
+ boolean gotoPreset(CameraCmd cmd);
+ //璁剧疆棰勭疆浣�
+ boolean setPreset(CameraCmd cmd);
+ //鑱氱劍妯″紡
+ boolean controlFocusMode(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 5e66b18..b7aadfb 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,6 +13,8 @@
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.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;
@@ -38,6 +40,8 @@
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.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;
@@ -66,7 +70,11 @@
// 缃戠粶杩炴帴鎭㈠
private static HaveReConnect haveReConnect = new HaveReConnect();
-
+ /**
+ * 鐧诲綍鎵�鏈夌浉鏈�
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:28:13
+ */
@Override
public void loginAll() {
try {
@@ -83,11 +91,21 @@
}
}
+ /**
+ * sdk鍒濆鍖�
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:28:13
+ */
@Override
public Boolean init() {
return LoginModule.init(disConnect, haveReConnect); // 鎵撳紑宸ョ▼锛屽垵濮嬪寲
}
+ /**
+ * 鐧诲綍
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:28:13
+ */
@Override
@Async
public Boolean login(ArdCameras camera) {
@@ -127,6 +145,11 @@
return true;
}
+ /**
+ * 娉ㄩ攢
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:28:13
+ */
@Override
public Boolean logout(String cameraId) {
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
@@ -136,6 +159,11 @@
return LoginModule.logout(loginId);
}
+ /**
+ * 鏄惁鍦ㄧ嚎妫�娴�
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:28:13
+ */
@Override
public boolean isOnLine(CameraCmd cmd) {
try {
@@ -156,6 +184,11 @@
return true;
}
+ /**
+ * 浜戝彴鎺у埗
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:28:13
+ */
@Override
public boolean pTZControl(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
@@ -189,7 +222,7 @@
dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL;
break;
case 5:
- dwPTZCommand = HCNetSDK.RUN_SEQ;
+ dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_LOOP_CONTROL;
break;
case 6:
dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL;
@@ -224,6 +257,9 @@
case 15:
dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_APERTURE_DEC_CONTROL;
break;
+ case 16:
+ dwPTZCommand = NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LAMP_CONTROL;
+ break;
}
boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, dwPTZCommand, speed, speed, 0, dwStop);
if (!bool) {
@@ -232,6 +268,11 @@
return bool;
}
+ /**
+ * 鑾峰彇PTZ鍊�
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:28:13
+ */
@Override
public Map<String, Object> getPtz(CameraCmd cmd) {
Map<String, Object> ptzMap = new HashMap<>();
@@ -276,6 +317,9 @@
int p = (int) (ptz.get("p") * 10);
int t = (int) (ptz.get("t") * 10);
int z = ptz.get("z").intValue();
+ if (z == 0) {
+ z = 1;
+ }
boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_EXACTGOTO, p, t, z, 0);
if (!bool) {
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
@@ -304,7 +348,7 @@
return false;
}
LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
- boolean bool = NetSDKLib.NETSDK_INSTANCE.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RESETZERO, 0, 0, 1, 0);
+ boolean bool = NetSDKLib.NETSDK_INSTANCE.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RESETZERO, 0, 0, 0, 0);
if (!bool) {
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
}
@@ -352,7 +396,7 @@
@Override
public String record(CameraCmd cmd) {
try {
- String url="";
+ String url = "";
String cameraId = cmd.getCameraId();
Integer chanNo = cmd.getChanNo();
String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
@@ -392,6 +436,7 @@
return "";
}
}
+
@Override
public boolean recordStart(CameraCmd cmd) {
try {
@@ -401,25 +446,25 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- LLong loginId = (LLong)GlobalVariable.loginMap.get(cameraId);
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
LLong lRealHandle;
if (GlobalVariable.previewMap.containsKey(cameraId)) {
lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
- netsdk.CLIENT_StopSaveRealData(lRealHandle);
+ netsdk.CLIENT_StopRealPlayEx(lRealHandle);
GlobalVariable.previewMap.remove(cameraId);
log.debug("鍋滄褰撳墠褰曞儚");
}
- lRealHandle = RealPlayModule.startRealPlay(loginId, chanNo-1, 0);
+ lRealHandle = RealPlayModule.startRealPlay1(loginId, chanNo - 1, path);
if (lRealHandle.longValue() <= 0) {
log.error("鍙栨祦澶辫触" + getErrorCodePrint());
}
log.debug("鍙栨祦鎴愬姛");
GlobalVariable.previewMap.put(cameraId, lRealHandle.intValue());
GlobalVariable.threadMap.put(cameraId, Thread.currentThread().getName());
- if (!netsdk.CLIENT_SaveRealData(lRealHandle, path)) {
- log.error("淇濆瓨瑙嗛鏂囦欢鍒颁复鏃舵枃浠跺す澶辫触 閿欒鐮佷负: " +getErrorCodePrint());
- return false;
- }
+ //if (!netsdk.CLIENT_SaveRealData(lRealHandle, path)) {
+ // log.error("淇濆瓨瑙嗛鏂囦欢鍒颁复鏃舵枃浠跺す澶辫触 閿欒鐮佷负: " +getErrorCodePrint());
+ // return false;
+ //}
log.debug("褰曞儚寮�濮�");
return true;
} catch (Exception ex) {
@@ -427,6 +472,7 @@
return false;
}
}
+
@Override
public String recordStopToMinio(CameraCmd cmd) {
String url = "";
@@ -439,7 +485,7 @@
LLong lRealHandle;
if (GlobalVariable.previewMap.containsKey(cameraId)) {
lRealHandle = new LLong(GlobalVariable.previewMap.get(cameraId));
- netsdk.CLIENT_StopSaveRealData(lRealHandle);
+ netsdk.CLIENT_StopRealPlayEx(lRealHandle);
GlobalVariable.previewMap.remove(cameraId);
log.debug("鍋滄褰撳墠褰曞儚");
}
@@ -459,6 +505,11 @@
}
}
+ /**
+ * 寮曞鐩爣浣嶇疆
+ * 鍒樿嫃涔�
+ * 2023/10/17 8:27:48
+ */
@Override
public boolean guideTargetPosition(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
@@ -466,7 +517,7 @@
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
- LLong loginId = (LLong)GlobalVariable.loginMap.get(cameraId);
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
try {
ArdCameras cameras = ardCamerasService.selectArdCamerasById(cameraId);
double[] cameraPositon = new double[]{cameras.getLongitude(), cameras.getLatitude(), cameras.getAltitude()};
@@ -474,7 +525,7 @@
double[] cameraPTZ = GisUtil.getCameraPTZ(cameraPositon, targetPositions, 20, 150);
int p = (int) (cameraPTZ[0] * 10);
int t = (int) (cameraPTZ[1] * 10);
- int z = (int)(cameraPTZ[2]);
+ int z = (int) (cameraPTZ[2]);
boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_EXACTGOTO, p, t, z, 0);
if (!bool) {
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
@@ -486,22 +537,99 @@
}
}
- // 璁惧鏂嚎鍥炶皟: 閫氳繃 CLIENT_Init 璁剧疆璇ュ洖璋冨嚱鏁帮紝褰撹澶囧嚭鐜版柇绾挎椂锛孲DK浼氳皟鐢ㄨ鍑芥暟
+ //杞嚦棰勭疆鐐�
+ @Override
+ public boolean gotoPreset(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ Integer PresetIndex = cmd.getPresetIndex();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return false;
+ }
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
+ try {
+
+ boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NET_PTZ_POINT_MOVE_CONTROL, 0, PresetIndex, 0, 0);
+ if (!bool) {
+ log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
+ }
+ return bool;
+ } catch (Exception ex) {
+ log.error("杞嚦棰勭疆鐐瑰紓甯�:" + ex.getMessage());
+ return false;
+ }
+ }
+
+ @Override
+ //璁剧疆棰勭疆浣�
+ public boolean setPreset(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ Integer PresetIndex = cmd.getPresetIndex();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return false;
+ }
+ LLong loginId = (LLong) GlobalVariable.loginMap.get(cameraId);
+ try {
+
+ boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NET_PTZ_POINT_SET_CONTROL, 0, PresetIndex, 0, 0);
+ if (!bool) {
+ log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + getErrorCodePrint());
+ }
+ return bool;
+ } catch (Exception ex) {
+ log.error("璁剧疆棰勭疆鐐瑰紓甯�:" + ex.getMessage());
+ return false;
+ }
+ }
+
+ //鍒囨崲鑱氱劍妯″紡
+ @Override
+ public boolean controlFocusMode(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_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.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());
+ }
+ return bool;
+ } catch (Exception ex) {
+ log.error("鍒囨崲鑱氱劍妯″紡寮傚父:" + ex.getMessage());
+ return false;
+ }
+ }
+
+ // 璁惧鏂嚎鍥炶皟: 褰撹澶囧嚭鐜版柇绾挎椂锛孲DK浼氳皟鐢ㄨ鍑芥暟
private static class DisConnect implements NetSDKLib.fDisConnect {
public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) {
System.out.printf("Device[%s] Port[%d] DisConnect!\n", pchDVRIP, nDVRPort);
}
}
- // 缃戠粶杩炴帴鎭㈠锛岃澶囬噸杩炴垚鍔熷洖璋�
- // 閫氳繃 CLIENT_SetAutoReconnect 璁剧疆璇ュ洖璋冨嚱鏁帮紝褰撳凡鏂嚎鐨勮澶囬噸杩炴垚鍔熸椂锛孲DK浼氳皟鐢ㄨ鍑芥暟
+ // 缃戠粶杩炴帴鎭㈠鍥炶皟:璁惧閲嶈繛鎴愬姛鍥炶皟锛屽綋宸叉柇绾跨殑璁惧閲嶈繛鎴愬姛鏃讹紝SDK浼氳皟鐢ㄨ鍑芥暟
private static class HaveReConnect implements NetSDKLib.fHaveReConnect {
@Override
public void invoke(LLong lLoginID, String pchDVRIP, int nDVRPort, Pointer dwUser) {
System.out.printf("ReConnect Device[%s] Port[%d]\n", pchDVRIP, nDVRPort);
}
}
- // 鎶撳浘鎺ユ敹鍥炶皟
+
+ // 鎶撳浘鎺ユ敹鍥炶皟:褰撴姄鍥炬垚鍔燂紝sdk浼氳皟鐢ㄨ鍑芥暟
public static class fCaptureReceiveCB implements NetSDKLib.fSnapRev {
private String minioEndPoint;
private String ObjectName;
--
Gitblit v1.9.3