| | |
| | | int i = hCNetSDK.NET_DVR_Login_V40(m_strLoginInfo, m_strDeviceInfo); |
| | | if (i < 0) { |
| | | int errorCode = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("ç»å½å¼å¸¸ï¼" + errorCode); |
| | | log.error("ç»å½å¼å¸¸ï¼" + errorCode); |
| | | } |
| | | } |
| | | |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_PTZControlWithSpeed_Other(userId, channelNum, dwPTZCommand, dwStop, speed); |
| | | if (!bool) { |
| | | int errorCode = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("æ§å¶å¤±è´¥,请ç¨åéè¯" + errorCode); |
| | | log.error("æ§å¶å¤±è´¥,请ç¨åéè¯" + errorCode); |
| | | } |
| | | return bool; |
| | | } |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置èç¦å¼å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("设置èç¦å¼å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | return bool; |
| | | } |
| | |
| | | return map; |
| | | } else { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("è·åèç¦å¼å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.debug("è·åèç¦å¼å¤±è´¥,请ç¨åéè¯" + code); |
| | | return new HashMap<>(); |
| | | } |
| | | } |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_PTZPreset_Other(userId, channelNum, SET_PRESET, PresetIndex); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("é¢ç½®ç¹è®¾ç½®å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("é¢ç½®ç¹è®¾ç½®å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | return bool; |
| | | } |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_PTZPreset_Other(userId, channelNum, GOTO_PRESET, PresetIndex); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("é¢ç½®ç¹è®¾ç½®å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("é¢ç½®ç¹è®¾ç½®å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | return bool; |
| | | } |
| | |
| | | } |
| | | } else { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | System.out.println("æ§å¶å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("æ§å¶å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage()); |
| | |
| | | return ptzMap; |
| | | } else { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("æ§å¶å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("æ§å¶å¤±è´¥,请ç¨åéè¯" + code); |
| | | return new HashMap<>(); |
| | | } |
| | | |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_PTZPOS, channelNum, point, m_ptzPosCurrent.size()); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置ptz失败,请ç¨åéè¯" + code); |
| | | log.error("设置ptz失败,请ç¨åéè¯" + code); |
| | | } |
| | | return bool; |
| | | } catch (Exception ex) { |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_PTZPOS, channelNum, point, m_ptzPosCurrent.size()); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置ptz失败,请ç¨åéè¯" + code); |
| | | log.error("设置ptz失败,请ç¨åéè¯" + code); |
| | | } |
| | | return bool; |
| | | } catch (Exception ex) { |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_PTZLOCKCFG, channelNum, point, netDvrPtzLockcfg.size(), ibrBytesReturned); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("è·åptzéå®ä¿¡æ¯å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("è·åptzéå®ä¿¡æ¯å¤±è´¥,请ç¨åéè¯" + code); |
| | | return -1; |
| | | } else { |
| | | netDvrPtzLockcfg.read(); |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_PTZSCOPE, channelNum, point, m_ptzPosCurrent.size(), ibrBytesReturned); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置ptz失败,请ç¨åéè¯" + code); |
| | | log.error("设置ptz失败,请ç¨åéè¯" + code); |
| | | return new HashMap<>(); |
| | | } else { |
| | | m_ptzPosCurrent.read(); |
| | |
| | | log.error("è·ååç«¯åæ°å¤±è´¥ï¼é误ç ï¼" + hCNetSDK.NET_DVR_GetLastError()); |
| | | } |
| | | struCameraParam.read(); |
| | | log.info("æ¯å¦å¼å¯éé¾ï¼" + struCameraParam.struDefogCfg.byMode); |
| | | log.debug("æ¯å¦å¼å¯éé¾ï¼" + struCameraParam.struDefogCfg.byMode); |
| | | |
| | | NET_DVR_DEFOGCFG defogcfg = new NET_DVR_DEFOGCFG(); |
| | | if (enable) { |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_CCDPARAMCFG_EX, channelNum, point, struCameraParam.size()); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置éé¾å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("设置éé¾å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | log.info("设置é龿å"); |
| | | log.debug("设置é龿å"); |
| | | return bool; |
| | | } |
| | | |
| | |
| | | log.error("è·ååç«¯åæ°å¤±è´¥ï¼é误ç ï¼" + hCNetSDK.NET_DVR_GetLastError()); |
| | | } |
| | | struDayNigh.read(); |
| | | log.info("æ¯å¦å¼å¯å¤è§ï¼" + struDayNigh.struDayNight.byDayNightFilterType); |
| | | log.debug("æ¯å¦å¼å¯å¤è§ï¼" + struDayNigh.struDayNight.byDayNightFilterType); |
| | | |
| | | NET_DVR_DAYNIGHT daynight = new NET_DVR_DAYNIGHT(); |
| | | if (enable) { |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_CCDPARAMCFG_EX, channelNum, point, struDayNigh.size()); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置å¤è§å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("设置å¤è§å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | log.info("设置å¤è§æå"); |
| | | log.debug("设置å¤è§æå"); |
| | | return bool; |
| | | } |
| | | |
| | |
| | | IntByReference ibrBytesReturned = new IntByReference(0); |
| | | boolean b_GetCameraParam = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, struFocusMode.size(), ibrBytesReturned); |
| | | if (!b_GetCameraParam) { |
| | | System.out.println("è·ååç«¯åæ°å¤±è´¥ï¼é误ç ï¼" + hCNetSDK.NET_DVR_GetLastError()); |
| | | log.error("è·ååç«¯åæ°å¤±è´¥ï¼é误ç ï¼" + hCNetSDK.NET_DVR_GetLastError()); |
| | | } |
| | | struFocusMode.read(); |
| | | log.info("å½åèç¦æ¨¡å¼ï¼" + struFocusMode.byFocusMode); |
| | | log.debug("å½åèç¦æ¨¡å¼ï¼" + struFocusMode.byFocusMode); |
| | | |
| | | if (enable) { |
| | | struFocusMode.byFocusMode = 1;//æå¨èç¦ |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_FOCUSMODECFG, channelNum, point, struFocusMode.size()); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置èç¦æ¨¡å¼å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("设置èç¦æ¨¡å¼å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | log.info("设置èç¦æ¨¡å¼æå"); |
| | | log.debug("设置èç¦æ¨¡å¼æå"); |
| | | return bool; |
| | | } |
| | | |
| | |
| | | IntByReference ibrBytesReturned = new IntByReference(0); |
| | | boolean b_GetCameraParam = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, struFocusMode.size(), ibrBytesReturned); |
| | | if (!b_GetCameraParam) { |
| | | System.out.println("è·ååç«¯åæ°å¤±è´¥ï¼é误ç ï¼" + hCNetSDK.NET_DVR_GetLastError()); |
| | | log.error("è·ååç«¯åæ°å¤±è´¥ï¼é误ç ï¼" + hCNetSDK.NET_DVR_GetLastError()); |
| | | } |
| | | struFocusMode.read(); |
| | | log.info("å½åèç¦æ¨¡å¼ï¼" + struFocusMode.byFocusMode); |
| | | log.debug("å½åèç¦æ¨¡å¼ï¼" + struFocusMode.byFocusMode); |
| | | return String.valueOf(struFocusMode.byFocusMode); |
| | | } |
| | | |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_PTZControl_Other(userId, channelNum, HEATER_PWRON, dwStop); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置äºå°å ç失败,请ç¨åéè¯" + code); |
| | | log.error("设置äºå°å ç失败,请ç¨åéè¯" + code); |
| | | } |
| | | log.info("设置äºå°å çæå"); |
| | | log.debug("设置äºå°å çæå"); |
| | | return bool; |
| | | } |
| | | |
| | |
| | | log.error("è·ååç«¯åæ°å¤±è´¥ï¼é误ç ï¼" + hCNetSDK.NET_DVR_GetLastError()); |
| | | } |
| | | struDeicing.read(); |
| | | log.info("æ¯å¦å¼å¯é¤å°ï¼" + struDeicing.byEnableDeicing); |
| | | log.debug("æ¯å¦å¼å¯é¤å°ï¼" + struDeicing.byEnableDeicing); |
| | | |
| | | if (enable) { |
| | | struDeicing.byEnableDeicing = 1;//å¼å¯ |
| | |
| | | boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_DEVSERVER_CFG, channelNum, point, struDeicing.size()); |
| | | if (!bool) { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("设置é头é¤å°å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("设置é头é¤å°å¤±è´¥,请ç¨åéè¯" + code); |
| | | } |
| | | log.info("设置é头é¤å°æå"); |
| | | log.debug("设置é头é¤å°æå"); |
| | | return bool; |
| | | } |
| | | |
| | |
| | | ByteBuffer jpegBuffer = ByteBuffer.allocate(1024 * 1024); |
| | | // æå¾å°å
åï¼åå¸§æ°æ®æè·å¹¶ä¿åæJPEG忾卿å®çå
å空é´ä¸ |
| | | boolean is = hCNetSDK.NET_DVR_CaptureJPEGPicture_NEW(userId, channelNum, jpeg, jpegBuffer, 1024 * 1024, a); |
| | | log.info("-----------è¿éå¼å§å¾çåå
¥å
å----------" + is); |
| | | log.debug("-----------è¿éå¼å§å¾çåå
¥å
å----------" + is); |
| | | |
| | | Base64.Encoder decoder = Base64.getEncoder(); |
| | | // BASE64Encoder encoder = new BASE64Encoder(); |
| | | String png_base64 = decoder.encodeToString(jpegBuffer.array());//è½¬æ¢æbase64串 |
| | | png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//å é¤ \r\n |
| | | log.info("-----------å¤ç宿æªå¾æ°æ®----------"); |
| | | log.debug("-----------å¤ç宿æªå¾æ°æ®----------"); |
| | | return png_base64; |
| | | } |
| | | |
| | |
| | | //设置å¾çå¤§å° |
| | | ByteBuffer jpegBuffer = ByteBuffer.allocate(1024 * 1024); |
| | | // æå¾å°å
åï¼åå¸§æ°æ®æè·å¹¶ä¿åæJPEG忾卿å®çå
å空é´ä¸ |
| | | log.info("-----------è¿éå¼å§å°è£
NET_DVR_CaptureJPEGPicture_NEW---------"); |
| | | log.debug("-----------è¿éå¼å§å°è£
NET_DVR_CaptureJPEGPicture_NEW---------"); |
| | | boolean is = hCNetSDK.NET_DVR_CaptureJPEGPicture_NEW(userId, channelNum, jpeg, jpegBuffer, 1024 * 1024, a); |
| | | log.info("-----------è¿éå¼å§å¾çåå
¥å
å----------" + is); |
| | | log.debug("-----------è¿éå¼å§å¾çåå
¥å
å----------" + is); |
| | | if (is) { |
| | | log.info("hksdk(æå¾)-ç»æç¶æå¼(0表示æå):" + hCNetSDK.NET_DVR_GetLastError()); |
| | | log.debug("hksdk(æå¾)-ç»æç¶æå¼(0表示æå):" + hCNetSDK.NET_DVR_GetLastError()); |
| | | byte[] array = jpegBuffer.array(); |
| | | //åå¨å°minio |
| | | String BucketName = "pic"; |
| | |
| | | boolean b = MinioUtils.uploadObject(BucketName, ObjectName, input, input.available(), ContentType); |
| | | if (b) { |
| | | url = MinioUtils.getBucketObjectUrl(BucketName, ObjectName); |
| | | log.info("ä¸ä¼ æä»¶æå!" + url); |
| | | log.debug("ä¸ä¼ æä»¶æå!" + url); |
| | | } |
| | | } catch (IOException ex) { |
| | | log.error("ä¸ä¼ æä»¶å¼å¸¸ï¼" + ex.getMessage()); |
| | |
| | | return url; |
| | | } else { |
| | | int code = hCNetSDK.NET_DVR_GetLastError(); |
| | | log.info("æå¾å¤±è´¥,请ç¨åéè¯" + code); |
| | | log.error("æå¾å¤±è´¥,请ç¨åéè¯" + code); |
| | | return ""; |
| | | } |
| | | } |
| | |
| | | log.error("åæµå¤±è´¥" + hCNetSDK.NET_DVR_GetLastError()); |
| | | return ""; |
| | | } |
| | | log.info("åæµæå"); |
| | | log.debug("åæµæå"); |
| | | GlobalVariable.previewMap.put(cameraId, lRealHandle); |
| | | } |
| | | if (!hCNetSDK.NET_DVR_SaveRealData_V30(GlobalVariable.previewMap.get(cameraId), 2, path)) { |
| | | log.error("ä¿åè§é¢æä»¶å°ä¸´æ¶æä»¶å¤¹å¤±è´¥ é误ç 为: " + hCNetSDK.NET_DVR_GetLastError()); |
| | | return ""; |
| | | } |
| | | log.info("å½åå¼å§"); |
| | | log.debug("å½åå¼å§"); |
| | | } else { |
| | | if (GlobalVariable.previewMap.containsKey(cameraId)) { |
| | | Integer lRealHandle = GlobalVariable.previewMap.get(cameraId); |
| | | hCNetSDK.NET_DVR_StopRealPlay(lRealHandle); |
| | | GlobalVariable.previewMap.remove(cameraId); |
| | | } |
| | | log.info("å½å忢"); |
| | | log.debug("å½å忢"); |
| | | } |
| | | return url; |
| | | } catch (Exception ex) { |