aijinhui
2023-09-06 cfa36565f54f4274e415af9899db2aedadbd7b76
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
@@ -385,8 +385,8 @@
        NET_DVR_FOCUSMODE_CFG focusmodeCfg = new NET_DVR_FOCUSMODE_CFG();
        Pointer point = focusmodeCfg.getPointer();
        IntByReference ibrBytesReturned = new IntByReference(0);
        focusmodeCfg.byFocusMode=1;
        focusmodeCfg.byAutoFocusMode=0;
        focusmodeCfg.byFocusMode = 1;
        focusmodeCfg.byAutoFocusMode = 0;
        focusmodeCfg.write();
        boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned);
        if (bool) {
@@ -975,6 +975,7 @@
        log.debug("设置聚焦模式成功");
        return bool;
    }
    /**
     * @描述 获取聚焦模式
     * @参数 [userId, channelNum]
@@ -1343,7 +1344,7 @@
            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");
            if (b) {
@@ -1409,7 +1410,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();
@@ -1433,4 +1434,47 @@
        }
        return channelList;
    }
    /**
     * @描述 获取GIS信息数据
     * @参数 [userId, channelNum]
     * @返回值 boolean
     * @创建人 刘苏义
     * @创建时间 2023/1/17 16:36
     * @修改人和其它信息 0-解锁 1-锁定
     */
    @Override
    public Map<String, Object> getGisInfo(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        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;
        }
    }
}