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/HDLAppliances/HDLLight/LightCtrlBackInfo.java | 10 ++
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java | 4
app/src/main/res/values/strings.xml | 2
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java | 184 +++++++++++++++++++++++++++------------------
4 files changed, 123 insertions(+), 77 deletions(-)
diff --git a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java
index 543a8af..c20867d 100644
--- a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java
+++ b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java
@@ -702,7 +702,7 @@
if (event.getLightCtrlBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
&& event.getLightCtrlBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
- && event.getLightCtrlBackInfo().getChannelNum() == appliancesInfo.getChannelNum()
+ && event.getLightCtrlBackInfo().getChannelNum() == appliancesInfo.getChannelNum() && event.getLightCtrlBackInfo().getPhysicsChannelNum() == appliancesInfo.getPhysicsChannelNum()
) {
// 鍏堝垽鏂槸鍚﹁秴鏃�
if (!event.isSuccess()) {
@@ -945,7 +945,7 @@
case HDLApConfig.TYPE_LIGHT_RELAY:
case HDLApConfig.TYPE_LIGHT_MIX_DIMMER:
case HDLApConfig.TYPE_LIGHT_MIX_RELAY:
- if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
+ if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum() && appliancesInfo.getPhysicsChannelNum() == event.getAppliancesInfo().getPhysicsChannelNum()) {
if (!event.isSuccess()) {
showToast("鑾峰彇鐏厜鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
return;
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3d676c0..1f5a0aa 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,4 +1,4 @@
<resources>
<string name="app_name">HDL_SDK</string>
- <string name="app_version">hdl_lib_v1.6.4.20191015_beta</string>
+ <string name="app_version">hdl_lib_v1.6.5.20200117_beta</string>
</resources>
diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/LightCtrlBackInfo.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/LightCtrlBackInfo.java
index 5b97f29..9611c48 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/LightCtrlBackInfo.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/LightCtrlBackInfo.java
@@ -18,7 +18,7 @@
int deviceChannelCount;//璁惧鍥炶矾鎬绘暟
String remarks ;//澶囨敞
String parentRemarks;//妯″潡澶囨敞
-
+ int physicsChannelNum;//RCU 鐏厜鐗规湁
public String getParentRemarks() {
return parentRemarks;
@@ -77,6 +77,14 @@
this.deviceChannelCount = deviceChannelCount;
}
+ public int getPhysicsChannelNum() {
+ return physicsChannelNum;
+ }
+
+ public void setPhysicsChannelNum(int physicsChannelNum) {
+ this.physicsChannelNum = physicsChannelNum;
+ }
+
@Override
public String toString() {
return "LightCtrlBackInfo{" +
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