From d87400af518ebc9274f4447f06476959c3aa5102 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 14 七月 2020 16:29:42 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into dev-2020xm

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs |   94 +++++++++++++++++++++++++----------------------
 1 files changed, 50 insertions(+), 44 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs
old mode 100755
new mode 100644
index c1bac93..c654ee7
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs
@@ -15,7 +15,7 @@
     /// </summary>
     public class MutilfunctionPanelMethod
     {
-        #region  鍙橀噺鐢虫槑 
+        #region  鍙橀噺鐢虫槑
         /// <summary>
         /// 寮�鍏崇殑涓暟聽[姣忔杩涘叆鍒板鍔熻兘缁戝畾鐣岄潰锛岄兘瑕佽閲嶆柊鍙栧�糫
         /// </summary>
@@ -53,15 +53,21 @@
                 var bList = bindTargetsFromMutilfunctionPanelList[key];
                 foreach (var bDev in bList)
                 {
+                    if (curBindType == 0)
+                    {
+                        if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
+                        {
+                            tempList.Add(bDev);
+                        }
+                    }
+
                     var device = LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint);
+                    if (device == null)
+                    {
+                        continue;
+                    }
                     switch (curBindType)
                     {
-                        case 0:
-                            if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
-                            {
-                                tempList.Add(bDev);
-                            }
-                            break;
                         case 1:
                             if (bDev.KeyEpoint >= 52 && bDev.KeyEpoint <= 61)
                             {
@@ -128,7 +134,6 @@
                                     //绌鸿皟缁戝畾绫诲瀷
                                     if (device.Type == DeviceType.Thermostat && bDev.BindCluster == 513)
                                     {
-                                        //Thermostat鏄┖璋�
                                         tempList.Add(bDev);
                                     }
                                 }
@@ -222,15 +227,21 @@
                 var bList = bindTargetsFromMutilfunctionPanelList[key];
                 foreach (var bDev in bList)
                 {
+                    if (curBindType == 0)
+                    {
+                        if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
+                        {
+                            tempList.Remove(bDev.KeyEpoint);
+                        }
+                    }
+
                     var device = LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint);
+                    if (device == null)
+                    {
+                        continue;
+                    }
                     switch (curBindType)
                     {
-                        case 0:
-                            if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
-                            {
-                                tempList.Remove(bDev.KeyEpoint);
-                            }
-                            break;
                         case 1:
                         case 2:
                             if (bDev.KeyEpoint >= 52 && bDev.KeyEpoint <= 61)
@@ -296,7 +307,6 @@
                                     //绌鸿皟缁戝畾绫诲瀷
                                     if (device.Type == DeviceType.Thermostat && bDev.BindCluster == 513)
                                     {
-                                        //Thermostat鏄┖璋�
                                         tempList.Remove(bDev.KeyEpoint);
                                     }
                                 }
@@ -393,10 +403,10 @@
                                                 roomIncludeMatchDevice.Add(device);
                                             }
                                         }
-                                        if (device.Type == DeviceType.DimmableLight)
-                                        {
-                                            roomIncludeMatchDevice.Add(device);
-                                        }
+                                        //if (device.Type == DeviceType.DimmableLight)
+                                        //{
+                                        //    roomIncludeMatchDevice.Add(device);
+                                        //}
                                         break;
                                     case 4:
                                         if (device.Type == DeviceType.WindowCoveringDevice)
@@ -407,7 +417,10 @@
                                     case 5:
                                         if (device.Type == DeviceType.Thermostat)
                                         {
-                                            //Thermostat鏄┖璋�
+                                            if (BindInfo.checkRealAcDevice(device) == false)
+                                            {
+                                                continue;
+                                            }
                                             roomIncludeMatchDevice.Add(device);
                                         }
                                         break;
@@ -527,7 +540,7 @@
         /// <param name="currentPanelSupportBindDeviceList"></param>
         /// <param name="supportRoomList"></param>
         /// <param name="curDeviceBindType">褰撳墠璁惧缁戝畾绫诲瀷 1:寮�鍏�  2:鎻掑骇  3:鐏厜  4:閬槼 5:绌鸿皟 6:鏂伴</param>
-        /// <param name="curBindTypeList">褰撳墠绫诲瀷鐨勭粦瀹氳〃</param> 
+        /// <param name="curBindTypeList">褰撳墠绫诲瀷鐨勭粦瀹氳〃</param>
         /// <returns></returns>
         public static List<CommonDevice> GetAllRoomSupportDeviceList(List<CommonDevice> currentPanelSupportBindDeviceList, List<Room> supportRoomList, List<BindListAllInfo> curBindTypeList, int curDeviceBindType)
         {
@@ -579,10 +592,10 @@
                                 {
                                     currentPanelBindSupportDeviceListTemp.Add(device);
                                 }
-                                if (device.Type == DeviceType.DimmableLight)
-                                {
-                                    currentPanelBindSupportDeviceListTemp.Add(device);
-                                }
+                                //if (device.Type == DeviceType.DimmableLight)
+                                //{
+                                //    currentPanelBindSupportDeviceListTemp.Add(device);
+                                //}
                                 break;
                             case 4:
                                 if (device.Type == DeviceType.WindowCoveringDevice)
@@ -593,7 +606,10 @@
                             case 5:
                                 if (device.Type == DeviceType.Thermostat)
                                 {
-                                    //Thermostat鏄┖璋�
+                                    if (BindInfo.checkRealAcDevice(device) == false)
+                                    {
+                                        continue;
+                                    }
                                     currentPanelBindSupportDeviceListTemp.Add(device);
                                 }
                                 break;
@@ -620,7 +636,7 @@
         /// </summary>
         /// <param name="currentPanelSupportBindSceneList"></param>
         /// <param name="supportRoomList"></param>
-        /// <param name="curBindTypeList">褰撳墠绫诲瀷鐨勭粦瀹氳〃</param> 
+        /// <param name="curBindTypeList">褰撳墠绫诲瀷鐨勭粦瀹氳〃</param>
         /// <param name="curDeviceBindType">褰撳墠璁惧缁戝畾绫诲瀷 0:鍦烘櫙</param>
         /// <returns></returns>
         public static List<SceneUI> GetAllRoomSupportSceneList(List<SceneUI> currentPanelSupportBindSceneList, List<Room> supportRoomList, List<BindListAllInfo> curBindTypeList, int curDeviceBindType = 0)
@@ -715,10 +731,6 @@
                                     undistruibuteDevList.Add(device);
                                 }
                             }
-                            if (device.Type == DeviceType.DimmableLight)
-                            {
-                                undistruibuteDevList.Add(device);
-                            }
                             break;
                         case 4:
                             if (device.Type == DeviceType.WindowCoveringDevice)
@@ -729,7 +741,10 @@
                         case 5:
                             if (device.Type == DeviceType.Thermostat)
                             {
-                                //Thermostat鏄┖璋�
+                                if (BindInfo.checkRealAcDevice(device) == false)
+                                {
+                                    continue;
+                                }
                                 undistruibuteDevList.Add(device);
                             }
                             break;
@@ -826,21 +841,12 @@
                                     curRoomDeviceListTemp.Add(device);
                                 }
                             }
-                            if (device.Type == DeviceType.DimmableLight)
-                            {
-                                if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleMultifunction)
-                                {
-                                    //Thermostat鏄┖璋�
-                                    curRoomDeviceListTemp.Add(device);
-                                }
-                            }
                             break;
                         case 4:
                             if (device.Type == DeviceType.WindowCoveringDevice)
                             {
                                 if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleMultifunction)
                                 {
-                                    //Thermostat鏄┖璋�
                                     curRoomDeviceListTemp.Add(device);
                                 }
                             }
@@ -848,11 +854,11 @@
                         case 5:
                             if (device.Type == DeviceType.Thermostat)
                             {
-                                if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleMultifunction)
+                                if (BindInfo.checkRealAcDevice(device) == false)
                                 {
-                                    //Thermostat鏄┖璋�
-                                    curRoomDeviceListTemp.Add(device);
+                                    continue;
                                 }
+                                curRoomDeviceListTemp.Add(device);
                             }
                             break;
                         case 6:

--
Gitblit v1.8.0