From 617a02739b82ae30772de25b4f9a8f6e9460f468 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 12 八月 2020 17:42:36 +0800
Subject: [PATCH] 请合并代码:新增多功能面板一对一绑定机制
---
ZigbeeApp20200810/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionAddTargetsForm.cs | 114 +++++++++++++++++++++++----------------------------------
1 files changed, 46 insertions(+), 68 deletions(-)
diff --git a/ZigbeeApp20200810/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionAddTargetsForm.cs b/ZigbeeApp20200810/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionAddTargetsForm.cs
index 14a496b..2ac771c 100644
--- a/ZigbeeApp20200810/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionAddTargetsForm.cs
+++ b/ZigbeeApp20200810/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionAddTargetsForm.cs
@@ -1027,22 +1027,20 @@
for (int i = 0; i < targetScList.Count; i++)
{
//缁戝畾鏂扮殑鏁版嵁
- var addBindeDev = new AddBindData();
- addBindeDev.DeviceAddr = curControlDev.DeviceAddr;
+ var addSingleBindData = new AddSingleBindData();
+ addSingleBindData.DeviceAddr = curControlDev.DeviceAddr;
for (int j = 0; j < curSupportBindEpointList.Count; j++)
{
curSendEpointList.Add(curSupportBindEpointList[0]);
- addBindeDev.Epoint = curControlDev.DeviceEpoint = curSupportBindEpointList[0];
+ addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportBindEpointList[0];
break;
}
var de = targetScList[i];
- var addBindInfo = new AddBindListObj();
- addBindInfo.BindType = 1;
- addBindInfo.BindCluster = 6;
- addBindInfo.BindScenesId = de.Id;
- addBindeDev.BindList.Add(addBindInfo);
+ addSingleBindData.BindType = 1;
+ addSingleBindData.BindClusterList.Add(6);
+ addSingleBindData.BindScenesId = de.Id;
- var resT = AddDeviceBind(addBindeDev, targetSendCount, ref targetRecCount);
+ var resT = AddDeviceBind(addSingleBindData, targetSendCount, ref targetRecCount);
if (!resT)
{
break;
@@ -1071,8 +1069,8 @@
foreach (var de in targetList)
{
//缁戝畾鏂扮殑鏁版嵁
- var addBindeDev = new AddBindData();
- addBindeDev.DeviceAddr = curControlDev.DeviceAddr;
+ var addSingleBindData = new AddSingleBindData();
+ addSingleBindData.DeviceAddr = curControlDev.DeviceAddr;
if (curBindType == 3)
{
@@ -1081,7 +1079,7 @@
for (int j = 0; j < curSupportDimmerEpointList.Count; j++)
{
curSendEpointList.Add(curSupportDimmerEpointList[0]);
- addBindeDev.Epoint = curControlDev.DeviceEpoint = curSupportDimmerEpointList[0];
+ addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportDimmerEpointList[0];
break;
}
}
@@ -1091,7 +1089,7 @@
for (int j = 0; j < curSupportLightEpointList.Count; j++)
{
curSendEpointList.Add(curSupportLightEpointList[0]);
- addBindeDev.Epoint = curControlDev.DeviceEpoint = curSupportLightEpointList[0];
+ addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportLightEpointList[0];
break;
}
}
@@ -1101,68 +1099,48 @@
for (int j = 0; j < curSupportBindEpointList.Count; j++)
{
curSendEpointList.Add(curSupportBindEpointList[0]);
- addBindeDev.Epoint = curControlDev.DeviceEpoint = curSupportBindEpointList[0];
+ addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportBindEpointList[0];
break;
}
}
- var addBindInfo = new AddBindListObj();
- addBindInfo.BindType = 0;
- addBindInfo.BindMacAddr = de.DeviceAddr;
- addBindInfo.BindEpoint = de.DeviceEpoint;
+ addSingleBindData.BindType = 0;
+ addSingleBindData.BindMacAddr = de.DeviceAddr;
+ addSingleBindData.BindEpoint = de.DeviceEpoint;
switch (curBindType)
{
case 0:
- addBindInfo.BindCluster = 6;
- break;
case 1:
- addBindInfo.BindCluster = 6;
- break;
case 2:
- addBindInfo.BindCluster = 6;
+ addSingleBindData.BindClusterList.Add(6);
break;
case 3:
- addBindInfo.BindCluster = 6;
- break;
- case 4:
- addBindInfo.BindCluster = 258;
- break;
- case 5:
- addBindInfo.BindCluster = 513;
- break;
- case 6:
- addBindInfo.BindCluster = 514;
- break;
- }
- addBindeDev.BindList.Add(addBindInfo);
-
- //閮ㄥ垎鐩爣闇�瑕佷簩娆$粦瀹氱浜岀鍔熻兘
- var addBindInfo2 = new AddBindListObj();
- addBindInfo2.BindType = 0;
- addBindInfo2.BindMacAddr = de.DeviceAddr;
- addBindInfo2.BindEpoint = de.DeviceEpoint;
- switch (curBindType)
- {
- case 3:
+ addSingleBindData.BindClusterList.Add(6);
var device = LocalDevice.Current.GetDevice(de.DeviceAddr, de.DeviceEpoint);
if (device != null)
{
if (device.Type == DeviceType.DimmableLight)
{
//鐏厜涓鸿皟鍏夋椂闇�瑕佺粦瀹�6锛�8
- addBindInfo2.BindCluster = 8;
- addBindeDev.BindList.Add(addBindInfo2);
+ addSingleBindData.BindClusterList.Add(8);
}
}
break;
+ case 4:
+ addSingleBindData.BindClusterList.Add(258);
+ break;
case 5:
//瑕佺粦瀹氱┖璋冿細闇�瑕佺粦瀹�513锛�514
- addBindInfo2.BindCluster = 514;
- addBindeDev.BindList.Add(addBindInfo2);
+ addSingleBindData.BindClusterList.Add(513);
+ addSingleBindData.BindClusterList.Add(514);
+ break;
+ case 6:
+ addSingleBindData.BindClusterList.Add(514);
break;
}
- var resT = AddDeviceBind(addBindeDev, targetSendCount, ref targetRecCount);
+
+ var resT = AddDeviceBind(addSingleBindData, targetSendCount, ref targetRecCount);
if (!resT)
{
break;
@@ -1186,36 +1164,36 @@
/// <summary>
/// AddDeviceBind
/// </summary>
- /// <param name="addBindeDev"></param>
+ /// <param name="addSingleBindData"></param>
/// <param name="targetSendCount"></param>
/// <param name="targetRecCount"></param>
/// <returns></returns>
- private bool AddDeviceBind(AddBindData addBindeDev, int targetSendCount, ref int targetRecCount)
+ private bool AddDeviceBind(AddSingleBindData addSingleBindData, int targetSendCount, ref int targetRecCount)
{
var addSuccess = false;
- var dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev);
- if (dev != null && dev.addedDeviceBindResponseData != null)
+ var dev = HdlDeviceBindLogic.Current.AddDeviceSingleBindAsync(addSingleBindData);
+ if (dev != null && dev.addedDeviceSingleBindResponseData != null)
{
addSuccess = true;
targetRecCount++;
- if (dev.addedDeviceBindResponseData.Result == 0)
+ if (dev.addedDeviceSingleBindResponseData.Result == 0)
{
var countTotal = targetRecCount;
-
var bList = new List<BindListAllInfo>();
- foreach (var devB in dev.addedDeviceBindResponseData.BindList)
+ foreach (var cluster in dev.addedDeviceSingleBindResponseData.BindClusterList)
{
var curD = new BindListAllInfo();
curD.KeyMacAddr = curControlDev.DeviceAddr;
curD.KeyEpoint = curControlDev.DeviceEpoint;
- curD.BindCluster = devB.BindCluster;
- curD.BindScenesId = devB.BindScenesId;
- curD.BindMacAddr = devB.BindMacAddr;
- curD.BindEpoint = devB.BindEpoint;
- curD.ESName = devB.ESName;
- curD.BindType = devB.BindType;
+ curD.BindCluster = cluster;
+ curD.BindScenesId = dev.addedDeviceSingleBindResponseData.BindScenesId;
+ curD.BindMacAddr = dev.addedDeviceSingleBindResponseData.BindMacAddr;
+ curD.BindEpoint = dev.addedDeviceSingleBindResponseData.BindEpoint;
+ curD.ESName = dev.addedDeviceSingleBindResponseData.ESName;
+ curD.BindType = dev.addedDeviceSingleBindResponseData.BindType;
bList.Add(curD);
}
+
if (MutilfunctionPanelMethod.bindTargetsFromMutilfunctionPanelList.ContainsKey(curControlDev.DeviceAddr + curControlDev.DeviceEpoint))
{
MutilfunctionPanelMethod.bindTargetsFromMutilfunctionPanelList[curControlDev.DeviceAddr + curControlDev.DeviceEpoint] = bList;
@@ -1227,12 +1205,12 @@
if (curBindType == 3)
{
- if (addBindeDev.Epoint >= 22 && addBindeDev.Epoint <= 28)
+ if (addSingleBindData.Epoint >= 22 && addSingleBindData.Epoint <= 28)
{
curSupportDimmerEpointList.RemoveAt(0);
}
- if (addBindeDev.Epoint >= 52 && addBindeDev.Epoint <= 61)
+ if (addSingleBindData.Epoint >= 52 && addSingleBindData.Epoint <= 61)
{
curSupportLightEpointList.RemoveAt(0);
}
@@ -1257,7 +1235,7 @@
}
});
}
- else if (dev.addedDeviceBindResponseData.Result == 1)
+ else if (dev.addedDeviceSingleBindResponseData.Result == 1)
{
Application.RunOnMainThread(() =>
{
@@ -1268,7 +1246,7 @@
new Tip()
{
MaxWidth = 150,
- Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5001_1" + ")",
+ Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5020_1" + ")",
Direction = AMPopTipDirection.Up,
CloseTime = 1
}.Show(btnFinifh);
@@ -1285,7 +1263,7 @@
new Tip()
{
MaxWidth = 150,
- Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError) + "(" + "5001_2" + ")",
+ Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError) + "(" + "5020_2" + ")",
Direction = AMPopTipDirection.Up,
CloseTime = 1
}.Show(btnFinifh);
--
Gitblit v1.8.0