Browse Source

Merge remote-tracking branch 'origin/master'

platform-api
yx 2 years ago
parent
commit
aa0d7fc09a
  1. 5
      ruoyi-code/src/main/java/utils/CameraUtil.java
  2. 18
      ruoyi-code/src/main/java/utils/RegisterUtil.java
  3. 83
      ruoyi-code/src/main/java/utils/run_device_cfg.java

5
ruoyi-code/src/main/java/utils/CameraUtil.java

@ -29,6 +29,11 @@ public class CameraUtil { @@ -29,6 +29,11 @@ public class CameraUtil {
run_device_cfg cfg = new run_device_cfg();
cfg.getLigntCfg(loginID);
System.out.println("==================================");
//设置参数
cfg.setLightCfg(loginID, NetEnums.EM_DEV_SUP_LIGHT_MODE.EM_DEV_SUP_LIGHT_MODE_FORCE_AUTO,30,60,"13:50:00","14:00:00");
System.out.println("==================================");
cfg.getLigntCfg(loginID);
}
/**

18
ruoyi-code/src/main/java/utils/RegisterUtil.java

@ -1077,9 +1077,23 @@ public class RegisterUtil implements ActionListener { @@ -1077,9 +1077,23 @@ public class RegisterUtil implements ActionListener {
/**
* Launch the application.
*/
// public static void main(String[] args) {
// RegisterUtil window = new RegisterUtil();
// window.onBtnStartRegServer();
// }
public static void main(String[] args) {
RegisterUtil window = new RegisterUtil();
window.onBtnStartRegServer();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
RegisterUtil window = new RegisterUtil();
window.m_frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public List<NativeLong> getLoginIDs(){

83
ruoyi-code/src/main/java/utils/run_device_cfg.java

@ -38,6 +38,7 @@ import com.sun.jna.ptr.IntByReference; @@ -38,6 +38,7 @@ import com.sun.jna.ptr.IntByReference;
import sdk.java.common.GlobalTool;
import sdk.java.lib.DataUtils;
import sdk.java.lib.netmanager.NetDefs;
import sdk.java.lib.netmanager.NetEnums;
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;
@ -3525,9 +3526,89 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3525,9 +3526,89 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
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]));
NetStructs.STU_CFG_SOC_CONSTANT_LAMP_ITEM item = cfgSupplementLightItem.stSOCLamps[0];
System.out.println(JSON.toJSON(item).toString());
// 工作模式 EM_DEV_SUP_LIGHT_MODE (0-强制关闭 1-强制开启 2-自动 3-自动时间)
int emMode = item.emMode;
//亮度预设值,取值范围为0~100,无光敏时使用
int nPreValue = item.nPreValue;
// 常亮灯亮度,范围[0, 100]
int nBrightness = item.nBrightness;
NetStructs.STU_TIME_SECTION_SCHEDULE timeInterval = item.stuWeekTimeSection.stuTimeDay[0].stuTimeSection[0];
int isEnable = timeInterval.bValue;
int startHour = timeInterval.nStartHour;
int startMinute = timeInterval.nStartMinute;
int startSecond = timeInterval.nStartSecond;
int endHour = timeInterval.nEndHour;
int endMinute = timeInterval.nEndMinute;
int endSecond = timeInterval.nEndSecond;
System.out.println("emMode="+emMode);
System.out.println("nPreValue="+nPreValue);
System.out.println("nBrightness="+nBrightness);
System.out.println("isEnable="+isEnable);
System.out.println("startHour="+startHour);
System.out.println("startMinute="+startMinute);
System.out.println("startSecond="+startSecond);
System.out.println("endHour="+endHour);
System.out.println("endMinute="+endMinute);
System.out.println("endSecond="+endSecond);
}
/**
*
* @param loginID 登录id
* @param emMode 工作模式 EM_DEV_SUP_LIGHT_MODE
* @param nPreValue 亮度预设值取值范围为0~100无光敏时使用
* @param nBrightness 常亮灯亮度范围[0, 100]
* @param startTime 开始时间 ::
* @param endTime 结束时间 ::
*/
public void setLightCfg(NativeLong loginID,int emMode,int nPreValue,int nBrightness,String startTime , String endTime){
//10:10:11
int startHour = Integer.parseInt(startTime.substring(0,2));
int startMinute = Integer.parseInt(startTime.substring(3,5));
int startSecond = Integer.parseInt(startTime.substring(6,8));
int endHour = Integer.parseInt(endTime.substring(0,2));
int endMinute = Integer.parseInt(endTime.substring(3,5));
int endSecond = Integer.parseInt(endTime.substring(6,8));
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP;
NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfgSupplementLightItem = getCfgSupplementLightItem(loginID,nCommand);
cfgSupplementLightItem.stSOCLamps[0].emMode = emMode;
cfgSupplementLightItem.stSOCLamps[0].nPreValue = nPreValue;
cfgSupplementLightItem.stSOCLamps[0].nBrightness = nBrightness;
if(emMode == NetEnums.EM_DEV_SUP_LIGHT_MODE.EM_DEV_SUP_LIGHT_MODE_AUTO_TIME)
for (NetStructs.STU_DAY_TIME_SECTION_SCHEDULE s : cfgSupplementLightItem.stSOCLamps[0].stuWeekTimeSection.stuTimeDay) {
s.stuTimeSection[0].bValue = (byte) 1;
s.stuTimeSection[0].nStartHour= startHour;
s.stuTimeSection[0].nStartMinute= startMinute;
s.stuTimeSection[0].nStartSecond= startSecond;
s.stuTimeSection[0].nEndHour= endHour;
s.stuTimeSection[0].nEndMinute= endMinute;
s.stuTimeSection[0].nEndSecond= endSecond;
}
IntByReference inBufferSize = new IntByReference(0);
inBufferSize.setValue(cfgSupplementLightItem.size());
Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue());
assert ptrInBuffer != null;
DataUtils.sdk_data_structureToPtr(cfgSupplementLightItem, ptrInBuffer, 0);
boolean result = NetLib.instance.Net_SetDeviceCfg(
loginID,
nCommand,
0,
ptrInBuffer,
inBufferSize.getValue(),
6000);
System.out.println("set light config result = " + result);
}
public NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM getCfgSupplementLightItem(NativeLong loginID, int nCommand){

Loading…
Cancel
Save