From d6d95564b016c281bfa2e8c2454db8d71083e858 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 26 十一月 2019 17:48:09 +0800 Subject: [PATCH] 2019-11-26 1.控制命令改为广播模式。 --- hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java index 2a44bd2..4dc6b19 100644 --- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java +++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java @@ -27,6 +27,7 @@ import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent; import com.hdl.sdk.hdl_core.Util.LogUtil.HDLLog; +import com.hdl.sdk.hdl_core.Util.NetUtil.NetWorkUtil; import com.hdl.sdk.hdl_core.Util.SPUtil.SPUtils; import com.hdl.sdk.hdl_core.Util.TransformUtil.HDLUtlis; @@ -63,6 +64,21 @@ HDLDeviceManager.init(context); } +// /** +// * 鑾峰彇鏈湴骞挎挱IP +// * @return +// */ +// public static String getLocalBroadCastIp(){ +// return NetWorkUtil.getLocalBroadCast(); +// } + + /** + * 鑾峰彇鏈湴骞挎挱IP + * @return + */ + public static String getLocalBroadCastIp(){ + return NetWorkUtil.getLocalBroadCast(); + } /** * 鏄惁寮�鍚疭DK鏃ュ織鎵撳嵃 @@ -617,7 +633,7 @@ } } //鏇存柊鎵�鏈夎澶囩姸鎬� - HandleSearch.refreshAllDevicesState(); +// HandleSearch.refreshAllDevicesState(30); if (!deviceStateBeanList.isEmpty()) { return deviceStateBeanList; } else { @@ -649,7 +665,7 @@ ) { // curState = (int) infos.get(j).getCurState();//鏃� //20190712瑙e喅寮哄埗杞崲int绫诲瀷闂�� - curState = HDLUtlis.getIntegerByObject(infos.get(j).getCurState()); + curState = HDLUtlis.getIntegerByObject(infos.get(j).getCurStateObject()); break outter; } @@ -680,7 +696,7 @@ ) { //杩欓噷搴旇鏄淇鐨勶紝鏆傛椂鏈壘鍒般�� //20190712瑙e喅寮哄埗杞崲int绫诲瀷闂�� - int state = HDLUtlis.getIntegerByObject(infos.get(j).getCurState()); + int state = HDLUtlis.getIntegerByObject(infos.get(j).getCurStateObject()); switch (state) { case -1: curState = 0; @@ -815,7 +831,7 @@ // HDLLog.info("鍙戝嚭鏁版嵁锛�"+sendData+"瀛愮綉id:"+info.getDeviceSubnetID()+" 璁惧id锛�"+info.getDeviceDeviceID()); cusSendCommand(command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), musicBytes, - info.getPort(), info.getIpAddress()); + info.getPort(), getLocalBroadCastIp()); } } @@ -857,7 +873,7 @@ // HDLLog.info("鍙戝嚭鏁版嵁锛�"+sendData+"瀛愮綉id:"+info.getDeviceSubnetID()+" 璁惧id锛�"+info.getDeviceDeviceID()); cusSendCommand(command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), musicBytes, - info.getPort(), info.getIpAddress()); + info.getPort(), getLocalBroadCastIp()); } } @@ -891,7 +907,7 @@ // HDLLog.info("鍙戝嚭鏁版嵁锛�"+sendData+"瀛愮綉id:"+info.getDeviceSubnetID()+" 璁惧id锛�"+info.getDeviceDeviceID()); cusSendCommand(command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), musicBytes, - info.getPort(), info.getIpAddress()); + info.getPort(), getLocalBroadCastIp()); } } @@ -920,7 +936,7 @@ */ private static void addSendData(final AppliancesInfo info, byte[] addBytes, final int type) { - final Crc sendDatas = new Crc(info.getStateCommand(), info.getDeviceSubnetID(), info.getDeviceDeviceID(), addBytes, info.getPort(), info.getIpAddress()); + final Crc sendDatas = new Crc(info.getStateCommand(), info.getDeviceSubnetID(), info.getDeviceDeviceID(), addBytes, info.getPort(), getLocalBroadCastIp()); sendDatas.count = 0; @@ -966,7 +982,7 @@ // } } if (!sendDatas.isCtrlSuccess) { - cusSendCommand(sendDatas.command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendDatas.addBytes, info.getPort(), info.getIpAddress()); + cusSendCommand(sendDatas.command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendDatas.addBytes, info.getPort(), getLocalBroadCastIp()); } else { // HDLLog.info("鎺у埗宸叉垚鍔燂紝鍋滄"); sendCycleTimer.cancel(); -- Gitblit v1.8.0