From 740f379847e21878429b7cb48bebfa9d2b72ab94 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期三, 20 九月 2023 11:38:57 +0800
Subject: [PATCH] 设备健康列表
---
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java | 309 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 213 insertions(+), 96 deletions(-)
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 4ed6415..3485345 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
@@ -9,11 +9,11 @@
import com.ruoyi.device.channel.domain.ArdChannel;
import com.ruoyi.device.hiksdk.common.GlobalVariable;
import com.ruoyi.device.camera.domain.ArdCameras;
-import com.ruoyi.device.hiksdk.util.hikSdkUtil.GisUtil;
-import com.ruoyi.device.hiksdk.util.hikSdkUtil.HCNetSDK;
+import com.ruoyi.utils.gis.GisUtil;
+import com.ruoyi.device.hiksdk.sdk.HCNetSDK;
import com.ruoyi.device.hiksdk.service.IHikClientService;
-import com.ruoyi.device.hiksdk.util.hikSdkUtil.LoginResultCallBack;
-import com.ruoyi.storage.minio.utils.MinioUtils;
+import com.ruoyi.device.hiksdk.sdk.LoginResultCallBack;
+import com.ruoyi.utils.minio.MinioUtil;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Platform;
@@ -29,10 +29,9 @@
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
import java.util.*;
-import static com.ruoyi.device.hiksdk.util.hikSdkUtil.HCNetSDK.*;
+import static com.ruoyi.device.hiksdk.sdk.HCNetSDK.*;
/**
* @ClassName: hikClientServiceImpl
@@ -49,8 +48,6 @@
private static String endpoint;
@Resource
private IArdCamerasService ardCamerasService;
- @Resource
- private MinioUtils minioUtil;
private static HCNetSDK hCNetSDK;
@@ -265,7 +262,7 @@
public boolean pTZControlWithSpeed(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
Integer speed = cmd.getSpeed();
Integer code = cmd.getCode();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
@@ -351,23 +348,31 @@
@SdkOperate
public boolean setFocusPos(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
Integer dwFocusPos = cmd.getDwFocusPos();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
+ // 鑾峰彇鍙傛暟
Integer userId = GlobalVariable.loginMap.get(cameraId);
-
- NET_DVR_FOCUSMODE_CFG focusmodeCfg = new NET_DVR_FOCUSMODE_CFG();
- Pointer point = focusmodeCfg.getPointer();
- IntByReference ibrBytesReturned = new IntByReference(0);
- focusmodeCfg.dwFocusPos = dwFocusPos;
- boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned);
+ 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;
+ struStdCfg.read();
+ IntByReference lchannel = new IntByReference(channelNum);
+ struStdCfg.lpInBuffer = struGisInfo.getPointer();
+ struStdCfg.lpCondBuffer = lchannel.getPointer();
+ struStdCfg.dwCondSize = 4;
+ struStdCfg.dwInSize = struGisInfo.size();
+ struStdCfg.write();//璁剧疆鍓嶄箣鍓嶈write()
+ boolean bool = hCNetSDK.NET_DVR_SetSTDConfig(userId, NET_DVR_GET_GISINFO, struStdCfg);
if (!bool) {
int code = hCNetSDK.NET_DVR_GetLastError();
- log.error("璁剧疆鑱氱劍鍊煎け璐�,璇风◢鍚庨噸璇�" + code);
+ log.error("璁剧疆GIS淇℃伅鏁版嵁澶辫触,璇风◢鍚庨噸璇�" + code);
+ return false;
+ } else {
+ return true;
}
- return bool;
}
/**
@@ -378,28 +383,31 @@
@Override
public Map<String, Object> getFocusPos(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
-
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return new HashMap<>();
}
+ // 鑾峰彇鍙傛暟
Integer userId = GlobalVariable.loginMap.get(cameraId);
-
- NET_DVR_FOCUSMODE_CFG focusmodeCfg = new NET_DVR_FOCUSMODE_CFG();
- Pointer point = focusmodeCfg.getPointer();
- IntByReference ibrBytesReturned = new IntByReference(0);
- boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned);
- if (bool) {
- focusmodeCfg.read();
- Map<String, Object> map = new HashMap<>();
- map.put("dwFocusPos", focusmodeCfg.dwFocusPos);
- map.put("byFocusDefinitionDisplay ", focusmodeCfg.byFocusDefinitionDisplay);
- map.put("dwRelativeFocusPos", focusmodeCfg.dwRelativeFocusPos);
- return map;
- } else {
+ 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();
+ IntByReference lchannel = new IntByReference(channelNum);
+ struStdCfg.lpCondBuffer = lchannel.getPointer();
+ struStdCfg.dwCondSize = 4;
+ struStdCfg.lpOutBuffer = struGisInfo.getPointer();
+ struStdCfg.dwOutSize = struGisInfo.size();
+ struStdCfg.write();//璁剧疆鍓嶄箣鍓嶈write()
+ boolean bool = hCNetSDK.NET_DVR_GetSTDConfig(userId, NET_DVR_GET_GISINFO, struStdCfg);
+ if (!bool) {
int code = hCNetSDK.NET_DVR_GetLastError();
- log.debug("鑾峰彇鑱氱劍鍊煎け璐�,璇风◢鍚庨噸璇�" + code);
+ log.error("鑾峰彇GIS淇℃伅鏁版嵁澶辫触,璇风◢鍚庨噸璇�" + code);
return new HashMap<>();
+ } else {
+ struGisInfo.read();
+ Map<String, Object> map = new HashMap<>();
+ map.put("dwFocus", struGisInfo.struPtzPosEx.dwFocus);
+ return map;
}
}
@@ -412,7 +420,7 @@
@SdkOperate
public boolean setPreset(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
Integer PresetIndex = cmd.getPresetIndex();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
@@ -435,7 +443,7 @@
@SdkOperate
public boolean gotoPreset(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
Integer PresetIndex = cmd.getPresetIndex();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
@@ -450,7 +458,7 @@
}
/**
- * @鎻忚堪 鑾峰彇鍒嗚鲸鐜�
+ * @鎻忚堪 鑾峰彇閫氶亾鍘嬬缉鍙傛暟
* @鍙傛暟 [cameraId, channelNum]
* @杩斿洖鍊� java.lang.String
* @鍒涘缓浜� 鍒樿嫃涔�
@@ -458,92 +466,150 @@
* @淇敼浜哄拰鍏跺畠淇℃伅
*/
@Override
- public String getVideoResolution(CameraCmd cmd) {
+ public Map<String,String> getVideoCompressionCfg(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer chanNo = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
- return " ";
+ return null;
}
Integer userId = GlobalVariable.loginMap.get(cameraId);
- String ResResolution = "";
- NET_DVR_COMPRESSIONCFG_V30 resolution = new NET_DVR_COMPRESSIONCFG_V30();
- resolution.write();
- Pointer pioint = resolution.getPointer();
+ Map<String,String> map=new HashMap<>();
+ NET_DVR_COMPRESSIONCFG_V30 compressioncfg = new NET_DVR_COMPRESSIONCFG_V30();
+ compressioncfg.write();
+ Pointer pioint = compressioncfg.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
try {
- boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, HCNetSDK.NET_DVR_GET_COMPRESSCFG_V30, channelNum, pioint, resolution.size(), ibrBytesReturned);
+ boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, HCNetSDK.NET_DVR_GET_COMPRESSCFG_V30, chanNo, pioint, compressioncfg.size(), ibrBytesReturned);
if (bool) {
- resolution.read();
+ compressioncfg.read();
+ //鐮佹祦绫诲瀷锛�0-瑙嗛娴侊紝1-澶嶅悎娴侊紝0xfe- 鑷姩锛堝拰婧愪竴鑷达級
+ String streamType="";
+ switch(compressioncfg.struNormHighRecordPara.byStreamType)
+ {
+ case 0: streamType="瑙嗛娴�";break;
+ case 1: streamType="澶嶅悎娴�";break;
+ default:streamType="鏈煡";break;
+ }
+ //瑙嗛缂栫爜绫诲瀷锛�0-绉佹湁264锛�1-鏍囧噯h264锛�2-鏍囧噯mpeg4锛�7-M-JPEG锛�8-MPEG2锛�9-SVAC锛�10-鏍囧噯h265锛�0xfe- 鑷姩锛堝拰婧愪竴鑷达級锛�0xff-鏃犳晥
+ String videoEncType="";
+ switch (compressioncfg.struNormHighRecordPara.byVideoEncType)
+ {
+ case 0:videoEncType="绉佹湁264";break;
+ case 1:videoEncType="鏍囧噯h264";break;
+ case 2:videoEncType="鏍囧噯mpeg4";break;
+ case 7:videoEncType="M-JPEG";break;
+ case 8:videoEncType="MPEG2";break;
+ case 9:videoEncType="SVAC";break;
+ case 10:videoEncType="鏍囧噯h265";break;
+ default: videoEncType="鏈煡";break;
+ }
+ //瑙嗛鐮佺巼
+ String videoBitrate="";
+ switch (compressioncfg.struNormHighRecordPara.dwVideoBitrate)
+ {
+ case 0:videoBitrate="淇濈暀";break;
+ case 1:videoBitrate="16K(淇濈暀)";break;
+ case 2:videoBitrate="32K";break;
+ case 3:videoBitrate="48k";break;
+ case 4:videoBitrate="64k";break;
+ case 5:videoBitrate="80k";break;
+ case 6:videoBitrate="96k";break;
+ case 7:videoBitrate="128k";break;
+ case 8:videoBitrate="160k";break;
+ case 9:videoBitrate="192k";break;
+ case 10:videoBitrate="224k";break;
+ case 11:videoBitrate="256K";break;
+ case 12:videoBitrate="320K";break;
+ case 13:videoBitrate="384K";break;
+ case 14:videoBitrate="448K";break;
+ case 15:videoBitrate="512K";break;
+ case 16:videoBitrate="640K";break;
+ case 17:videoBitrate="768K";break;
+ case 18:videoBitrate="896K";break;
+ case 19:videoBitrate="1024K";break;
+ case 20:videoBitrate="1280K";break;
+ case 21:videoBitrate="1536K";break;
+ case 22:videoBitrate="1792K";break;
+ case 23:videoBitrate="2048K";break;
+ case 24:videoBitrate="3072K";break;
+ case 25:videoBitrate="4096K";break;
+ case 26:videoBitrate="8192K";break;
+ case 27:videoBitrate="16384K";break;
+ default:videoBitrate="鍏朵粬";break;
+ }
//瑙嗛杈撳嚭鍙e垎杈ㄧ巼锛�0- 1024x768锛�1- 1280x720锛�2-1280x1024锛�3- 1680x1050锛�4- 1920x1080锛�5- 3840*2160
-// byte byStreamType = resolution.struNormHighRecordPara.byStreamType;
-// int dwVideoBitrate = resolution.struNormHighRecordPara.dwVideoBitrate;
- int byResolution = resolution.struNormHighRecordPara.byResolution;
- switch (byResolution) {
+ String resolution="";
+ switch (compressioncfg.struNormHighRecordPara.byResolution) {
case 0:
- ResResolution = "DCIF(528*384/528*320)";
+ resolution = "DCIF(528*384/528*320)";
break;
case 1:
- ResResolution = "CIF(352*288/352*240)";
+ resolution = "CIF(352*288/352*240)";
break;
case 2:
- ResResolution = "QCIF(176*144/176*120)";
+ resolution = "QCIF(176*144/176*120)";
break;
case 3:
- ResResolution = "4CIF(704*576/704*480)";
+ resolution = "4CIF(704*576/704*480)";
break;
case 4:
- ResResolution = "2CIF(704*288/704*240)";
+ resolution = "2CIF(704*288/704*240)";
break;
case 6:
- ResResolution = "QVGA(320*240)";
+ resolution = "QVGA(320*240)";
break;
case 7:
- ResResolution = "QQVGA(160*120)";
+ resolution = "QQVGA(160*120)";
break;
case 16:
- ResResolution = "VGA(640*480)";
+ resolution = "VGA(640*480)";
break;
case 17:
- ResResolution = "UXGA(1600*1200)";
+ resolution = "UXGA(1600*1200)";
break;
case 18:
- ResResolution = "SVGA(800*600)";
+ resolution = "SVGA(800*600)";
break;
case 19:
- ResResolution = "HD720P(1280*720)";
+ resolution = "HD720P(1280*720)";
break;
case 20:
- ResResolution = "XVGA(1280*960)";
+ resolution = "XVGA(1280*960)";
break;
case 21:
- ResResolution = "HD900P(1600*900)";
+ resolution = "HD900P(1600*900)";
break;
case 22:
- ResResolution = "1360*1024";
+ resolution = "1360*1024";
break;
case 23:
- ResResolution = "1536*1536";
+ resolution = "1536*1536";
break;
case 24:
- ResResolution = "1920*1920";
+ resolution = "1920*1920";
break;
case 27:
- ResResolution = "1920*1080p";
+ resolution = "1920*1080p";
break;
case 28:
- ResResolution = "2560*1920";
+ resolution = "2560*1920";
break;
case 29:
- ResResolution = "1600*304";
+ resolution = "1600*304";
break;
case 30:
- ResResolution = "2048*1536";
+ resolution = "2048*1536";
break;
default:
- ResResolution = "涓嶅湪褰撳墠鍒嗚鲸鐜囩储寮曪紝璇疯仈绯荤鐞嗗憳娣诲姞";
+ resolution = "涓嶅湪褰撳墠鍒嗚鲸鐜囩储寮曪紝璇疯仈绯荤鐞嗗憳娣诲姞";
break;
}
+ map.put("resolution",resolution);
+ map.put("videoBitrate",videoBitrate);
+ map.put("videoEncType",videoEncType);
+ map.put("streamType",streamType);
+
} else {
int code = hCNetSDK.NET_DVR_GetLastError();
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + code);
@@ -551,7 +617,7 @@
} catch (Exception ex) {
log.error(ex.getMessage());
}
- return ResResolution;
+ return map;
}
/**
@@ -565,7 +631,7 @@
@Override
public Map<String, Object> getPtz(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return null;
}
@@ -616,7 +682,7 @@
@SdkOperate
public boolean setPtz(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
Map<String, Double> ptz = cmd.getPtzMap();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
@@ -649,7 +715,7 @@
@SdkOperate
public boolean guideTargetPosition(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -736,7 +802,7 @@
@Override
public int getPTZLockInfo(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return -1;
}
@@ -768,7 +834,7 @@
@SdkOperate
public boolean setZeroPtz(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -800,7 +866,7 @@
@Override
public Map<String, Object> getPtzScope(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return new HashMap<>();
}
@@ -849,7 +915,7 @@
public boolean controlDefogcfg(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -895,7 +961,7 @@
public boolean controlInfrarecfg(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -943,7 +1009,7 @@
public boolean controlFocusMode(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -976,9 +1042,17 @@
return bool;
}
+ /**
+ * @鎻忚堪 鑾峰彇鑱氱劍妯″紡
+ * @鍙傛暟 [userId, channelNum]
+ * @杩斿洖鍊� boolean
+ * @鍒涘缓浜� 鍒樿嫃涔�
+ * @鍒涘缓鏃堕棿 2023/1/18 13:07
+ * @淇敼浜哄拰鍏跺畠淇℃伅
+ */
public String getFocusMode(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
@@ -1008,7 +1082,7 @@
public boolean controlPTHeateRpwron(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -1041,7 +1115,7 @@
public boolean controlCameraDeicing(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -1078,7 +1152,7 @@
*/
public String captureJPEGPicture(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
@@ -1121,7 +1195,7 @@
@SdkOperate
public String picCutCate(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
}
@@ -1155,9 +1229,9 @@
InputStream input = new ByteArrayInputStream(array);
String url = "";
try {
- boolean b = minioUtil.uploadObject(BucketName, ObjectName, input, input.available(), MimeTypeUtils.IMAGE_JPEG);
+ boolean b = MinioUtil.uploadObject(BucketName, ObjectName, input, input.available(), MimeTypeUtils.IMAGE_JPEG);
if (b) {
- url = minioUtil.getBucketObjectUrl(BucketName, ObjectName);
+ url = MinioUtil.getBucketObjectUrl(BucketName, ObjectName);
log.debug("涓婁紶鏂囦欢鎴愬姛!" + url);
}
} catch (IOException ex) {
@@ -1183,7 +1257,7 @@
public String record(CameraCmd cmd) {
try {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
boolean enable = cmd.isEnable();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
@@ -1245,7 +1319,7 @@
public void recordStart(CameraCmd cmd) {
try {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return;
@@ -1300,7 +1374,7 @@
String url = "";
try {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return "";
@@ -1336,11 +1410,11 @@
log.debug("褰曞儚鍋滄");
//瀛樺叆minio
String BucketName = cmd.getRecordBucketName();
- String ObjectName = cmd.getRecordObjectName()+".mp4";
+ String ObjectName = cmd.getRecordObjectName() + ".mp4";
FileInputStream stream = new FileInputStream(path);
- boolean b = minioUtil.uploadObject(BucketName, ObjectName, stream, stream.available(), "video/MP4");
+ boolean b = MinioUtil.uploadObject(BucketName, ObjectName, stream, stream.available(), "video/MP4");
if (b) {
- url = minioUtil.getBucketObjectUrl(BucketName, ObjectName);
+ url = MinioUtil.getBucketObjectUrl(BucketName, ObjectName);
log.debug("涓婁紶鏂囦欢鎴愬姛!" + url);
}
return url;
@@ -1354,7 +1428,7 @@
public void recordStopNotToMinio(CameraCmd cmd) {
try {
String cameraId = cmd.getCameraId();
- Integer channelNum = cmd.getChannelNum();
+ Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return;
}
@@ -1402,7 +1476,7 @@
// 鑾峰彇閫氶亾鍙�
for (int iChannum = 0; iChannum < chanNum; iChannum++) {
ArdChannel ardChannel = new ArdChannel();
- int channum = iChannum + startDChan+1;
+ int channum = iChannum + startDChan + 1;
HCNetSDK.NET_DVR_PICCFG_V40 strPicCfg = new HCNetSDK.NET_DVR_PICCFG_V40();
strPicCfg.dwSize = strPicCfg.size();
strPicCfg.write();
@@ -1426,4 +1500,47 @@
}
return channelList;
}
+
+ /**
+ * @鎻忚堪 鑾峰彇GIS淇℃伅鏁版嵁
+ * @鍙傛暟 [userId, channelNum]
+ * @杩斿洖鍊� boolean
+ * @鍒涘缓浜� 鍒樿嫃涔�
+ * @鍒涘缓鏃堕棿 2023/1/17 16:36
+ * @淇敼浜哄拰鍏跺畠淇℃伅 0-瑙i攣 1-閿佸畾
+ */
+ @Override
+ public Map<String, Object> getGisInfo(CameraCmd cmd) {
+ String cameraId = cmd.getCameraId();
+ Integer channelNum = cmd.getChanNo();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return new HashMap<>();
+ }
+ // 鑾峰彇鍙傛暟
+ Integer userId = 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();
+ IntByReference lchannel = new IntByReference(channelNum);
+ struStdCfg.lpCondBuffer = lchannel.getPointer();
+ struStdCfg.dwCondSize = 4;
+ struStdCfg.lpOutBuffer = struGisInfo.getPointer();
+ struStdCfg.dwOutSize = struGisInfo.size();
+ struStdCfg.write();//璁剧疆鍓嶄箣鍓嶈write()
+ boolean bool = hCNetSDK.NET_DVR_GetSTDConfig(userId, NET_DVR_GET_GISINFO, struStdCfg);
+ if (!bool) {
+ int code = hCNetSDK.NET_DVR_GetLastError();
+ log.error("鑾峰彇GIS淇℃伅鏁版嵁澶辫触,璇风◢鍚庨噸璇�" + code);
+ return new HashMap<>();
+ } else {
+ struGisInfo.read();
+ Map<String, Object> map = new HashMap<>();
+ map.put("p", struGisInfo.struPtzPos.fPanPos);
+ map.put("t", struGisInfo.struPtzPos.fTiltPos < 0 ? struGisInfo.struPtzPos.fTiltPos + 360 : struGisInfo.struPtzPos.fTiltPos);
+ map.put("z", struGisInfo.struPtzPos.fZoomPos);
+ map.put("fHorFieldAngle", struGisInfo.fHorizontalValue);// 姘村钩瑙嗗満瑙�
+ map.put("fVerFieldAngle", struGisInfo.fVerticalValue);// 鍨傜洿瑙嗗満瑙�
+ return map;
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3