From 882220761e90faa279f7b3908d916495d058142a Mon Sep 17 00:00:00 2001 From: 4670101279 Date: Wed, 6 Jul 2022 14:04:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=89=E7=81=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/utils/CameraUtil.java | 2 + .../src/main/java/utils/run_device_cfg.java | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/ruoyi-code/src/main/java/utils/CameraUtil.java b/ruoyi-code/src/main/java/utils/CameraUtil.java index c87fcee..904ec14 100644 --- a/ruoyi-code/src/main/java/utils/CameraUtil.java +++ b/ruoyi-code/src/main/java/utils/CameraUtil.java @@ -25,6 +25,8 @@ public class CameraUtil { NativeLong loginID = NetLib.instance.Net_LoginDevice(strIp, nPort, strUsername, strPassword, null, nError); System.out.println("loginID = "+loginID); + run_device_cfg cfg = new run_device_cfg(); + cfg.getLigntCfg(loginID); } /** diff --git a/ruoyi-code/src/main/java/utils/run_device_cfg.java b/ruoyi-code/src/main/java/utils/run_device_cfg.java index 2093e28..f6240fc 100644 --- a/ruoyi-code/src/main/java/utils/run_device_cfg.java +++ b/ruoyi-code/src/main/java/utils/run_device_cfg.java @@ -40,6 +40,7 @@ import sdk.java.lib.netmanager.NetDefs; import sdk.java.lib.netmanager.NetLib; import sdk.java.lib.netmanager.NetEnums.EM_DEVICE_CFG_TYPE; import sdk.java.lib.netmanager.NetEnums.EM_WHITE_BALANCE; +import sdk.java.lib.netmanager.NetStructs; import sdk.java.lib.netmanager.NetStructs.STU_CFG_ALARM_IN_PARAM; import sdk.java.lib.netmanager.NetStructs.STU_CFG_ALARM_OUT_PARAM; import sdk.java.lib.netmanager.NetStructs.STU_CFG_ALARM_PARAM; @@ -661,6 +662,9 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_ZK == command) { stu = new STU_CFG_ZK_SERVICE(); + }else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP == command) + { + stu = new NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM(); } return stu; @@ -3517,6 +3521,40 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { System.out.println("result = " + result); } + public void getLigntCfg(NativeLong loginID){ + int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP; + NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfgSupplementLightItem = getCfgSupplementLightItem(loginID,nCommand); + System.out.println(JSON.toJSONString(cfgSupplementLightItem.stSOCLamps[0])); + } + + + public NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM getCfgSupplementLightItem(NativeLong loginID, int nCommand){ + + IntByReference outBufferSize = new IntByReference(0); + IntByReference nReturnSize = new IntByReference(0); + Pointer ptrOutBuffer = initStuData(nCommand, outBufferSize); + boolean bResult = NetLib.instance.Net_GetDeviceCfg( + loginID, + nCommand, + 0, + ptrOutBuffer, + outBufferSize.getValue(), + nReturnSize, + 6000); + + if(!bResult) + { + int error = NetLib.instance.Net_LastError(); + String strError = String.format("Net_GetDeviceCfg fail, command = %d, errorCode = %d", nCommand, error); + System.out.println(strError); + return null; + } + + NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfg = new NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM(); + DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, cfg); + + return cfg; + } /** * * @param bRealtimeEnable 使能 0-否 1-是