@ -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 ) {