From fd78a0c0e444b83f40a9225c98adceb87bbda329 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期六, 18 一月 2020 15:10:34 +0800 Subject: [PATCH] 2020-1-18 1.修复RCU混合调光混合开关 类模块,使用物理回路问题。 --- hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java | 184 +++++++++++++++++++++++++++------------------ 1 files changed, 111 insertions(+), 73 deletions(-) diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java index 114e312..ed821a7 100644 --- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java +++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java @@ -485,6 +485,116 @@ } } + + /** + * 澶勭悊鐏厜杩斿洖 + * 2020-1-18 + * 淇娣峰悎璋冨厜娣峰悎寮�鍏� 绫绘ā鍧楅棶棰� + * @param getDatas + */ + private static void handleLightCtrlData(UdpDataBean getDatas){ + + if (TextUtils.isEmpty(HandleSearch.rcuIp)) { + outter: + for (int i = 0, len = devicesDataList.size(); i < len; i++) { + if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID + && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID + ) { + List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); + for (int j = 0, len2 = infos.size(); j < len2; j++) { + if(infos.get(j).getLittleType() == 9 || infos.get(j).getLittleType() == 10 ){ + + if (infos.get(j).getPhysicsChannelNum() == (getDatas.addBytes[0] & 0xFF)) { + + devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF); + devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF); + AppliancesInfo lightInfo1 = infos.get(j); + lightInfo1.setCurState(getDatas.addBytes[2] & 0xFF); + LightCtrlBackInfo info1 = new LightCtrlBackInfo(); + info1.setParentRemarks(lightInfo1.getParentRemarks()); + info1.setAppliancesInfo(lightInfo1); + info1.setRemarks(lightInfo1.getRemarks()); + info1.setChannelNum(lightInfo1.getChannelNum()); + info1.setPhysicsChannelNum(lightInfo1.getPhysicsChannelNum()); + info1.setBrightness(getDatas.addBytes[2] & 0xFF); + setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); + EventBus.getDefault().post(new LightFeedBackEvent(info1, true)); + break outter; + } + + + }else { + + + if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { + AppliancesInfo lightInfo = infos.get(j); + devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF); + devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF); + LightCtrlBackInfo info = new LightCtrlBackInfo(); + info.setParentRemarks(lightInfo.getParentRemarks()); + info.setAppliancesInfo(lightInfo); + info.setRemarks(lightInfo.getRemarks()); + info.setChannelNum(getDatas.addBytes[0] & 0xFF); +// info.setIsSuccess(getDatas.AddBytes[1] & 0xFF); + info.setBrightness(getDatas.addBytes[2] & 0xFF); +// info.setChannelCount(getDatas.AddBytes[3] & 0xFF); +// info.setDeviceChannelCount(getDatas.AddBytes[4] & 0xFF); +// isLightCtrlSuccess = true; + setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); + EventBus.getDefault().post(new LightFeedBackEvent(info, true)); + break outter; + } + } + + } + } + } + + + } else { + if (getDatas.addBytes.length != 0) { + outter: + for (int i = 0, len = devicesDataList.size(); i < len; i++) { + if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID + && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID + ) { + List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); + for (int j = 0, len2 = infos.size(); j < len2; j++) { + if (infos.get(j).getPhysicsChannelNum() == (getDatas.addBytes[0] & 0xFF) + ) { + devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF); + devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF); + for (int k = 0; k < rcuLightList.size(); k++) { + if (devicesDataList.get(i).getAppliancesInfoList().get(j).getPhysicsChannelNum() == rcuLightList.get(k).getPhysicsChanelNum() + ) { + rcuLightList.get(k).setCurState(getDatas.addBytes[2] & 0xFF); + break; + } + } + AppliancesInfo lightInfo1 = infos.get(j); + lightInfo1.setCurState(getDatas.addBytes[2] & 0xFF); + LightCtrlBackInfo info1 = new LightCtrlBackInfo(); + info1.setParentRemarks(lightInfo1.getParentRemarks()); + info1.setAppliancesInfo(lightInfo1); + info1.setRemarks(lightInfo1.getRemarks()); + info1.setChannelNum(lightInfo1.getChannelNum()); +// info1.setIsSuccess(getDatas.AddBytes[1] & 0xFF); + info1.setBrightness(getDatas.addBytes[2] & 0xFF); + info1.setChannelCount(getDatas.addBytes[3] & 0xFF); + info1.setDeviceChannelCount(getDatas.addBytes[4] & 0xFF); +// isLightCtrlSuccess = true; + setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); + EventBus.getDefault().post(new LightFeedBackEvent(info1, true)); + break outter; + } + } + } + } + } + } + + } + /** * 澶勭悊璁惧鎺у埗鏁版嵁 * @@ -493,79 +603,7 @@ private static void handleCtrlData(UdpDataBean getDatas) { switch (getDatas.command) { case Configuration.LIGHT_CTRL_BACK_COMMAND: - if (TextUtils.isEmpty(HandleSearch.rcuIp)) { - outter: - for (int i = 0, len = devicesDataList.size(); i < len; i++) { - if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID - && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID - ) { - List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); - for (int j = 0, len2 = infos.size(); j < len2; j++) { - if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { - AppliancesInfo lightInfo = infos.get(j); - devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF); - devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF); - LightCtrlBackInfo info = new LightCtrlBackInfo(); - info.setParentRemarks(lightInfo.getParentRemarks()); - info.setAppliancesInfo(lightInfo); - info.setRemarks(lightInfo.getRemarks()); - info.setChannelNum(getDatas.addBytes[0] & 0xFF); -// info.setIsSuccess(getDatas.AddBytes[1] & 0xFF); - info.setBrightness(getDatas.addBytes[2] & 0xFF); -// info.setChannelCount(getDatas.AddBytes[3] & 0xFF); -// info.setDeviceChannelCount(getDatas.AddBytes[4] & 0xFF); -// isLightCtrlSuccess = true; - setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); - EventBus.getDefault().post(new LightFeedBackEvent(info, true)); - break outter; - } - - } - } - } - - - } else { - if (getDatas.addBytes.length != 0) { - outter: - for (int i = 0, len = devicesDataList.size(); i < len; i++) { - if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID - && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID - ) { - List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); - for (int j = 0, len2 = infos.size(); j < len2; j++) { - if (infos.get(j).getPhysicsChannelNum() == (getDatas.addBytes[0] & 0xFF) - ) { - devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF); - devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF); - for (int k = 0; k < rcuLightList.size(); k++) { - if (devicesDataList.get(i).getAppliancesInfoList().get(j).getPhysicsChannelNum() == rcuLightList.get(k).getPhysicsChanelNum() - ) { - rcuLightList.get(k).setCurState(getDatas.addBytes[2] & 0xFF); - break; - } - } - AppliancesInfo lightInfo1 = infos.get(j); - lightInfo1.setCurState(getDatas.addBytes[2] & 0xFF); - LightCtrlBackInfo info1 = new LightCtrlBackInfo(); - info1.setParentRemarks(lightInfo1.getParentRemarks()); - info1.setAppliancesInfo(lightInfo1); - info1.setRemarks(lightInfo1.getRemarks()); - info1.setChannelNum(lightInfo1.getChannelNum()); -// info1.setIsSuccess(getDatas.AddBytes[1] & 0xFF); - info1.setBrightness(getDatas.addBytes[2] & 0xFF); - info1.setChannelCount(getDatas.addBytes[3] & 0xFF); - info1.setDeviceChannelCount(getDatas.addBytes[4] & 0xFF); -// isLightCtrlSuccess = true; - setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); - EventBus.getDefault().post(new LightFeedBackEvent(info1, true)); - break outter; - } - } - } - } - } - } + handleLightCtrlData(getDatas); break; case Configuration.CURTAIN_CTRL_BACK_COMMAND: -- Gitblit v1.8.0