From 3272ca5b51e19f7f8a827b0f68400570a547fe60 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 28 四月 2020 15:02:44 +0800
Subject: [PATCH] 2020-04-28-1

---
 ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs |   44 ++++++++++++++++++++++++++++++++++----------
 1 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
index 31d21c8..89ec837 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
@@ -118,7 +118,7 @@
                             ZbGateway.IsRemote = true;
                             for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
                             {
-                                 ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1");
+                                ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1");
                             }
                         }
 
@@ -145,7 +145,11 @@
                                         FindGateWaySocket.BeginSend(new System.Net.IPEndPoint(broadcastIpAddress, 7624), broadBytes);
                                     }
                                 }
-                                catch { }
+                                catch
+                                {   
+                                    //鍏抽棴Socket,涓嬫鍙戦�佷細鑷姩杩炴帴
+                                    FindGateWaySocket.Stop();
+                                }
                                 System.Threading.Thread.Sleep(500);
                             }
                         })
@@ -207,11 +211,11 @@
                                         {
                                             gateWayList.Add(zbGateWay);
                                         }
-                                        //缃戝叧涓埌浣忓畢ID涓虹┖姝ゆ椂涔熼�氳
-                                        else if (homeID == string.Empty)
-                                        {
-                                            gateWayList.Add(zbGateWay);
-                                        }
+                                        //缃戝叧涓埌浣忓畢ID涓虹┖姝ゆ椂涔熼�氳 2020.01.14鍙樻洿锛氭病杩欎釜蹇呰,涓婇潰閭d釜鍙橀噺灏辫兘澶勭悊
+                                        //else if (homeID == string.Empty)
+                                        //{
+                                        //    gateWayList.Add(zbGateWay);
+                                        //}
                                     }
                                     //缃戝叧鍒楄〃瀛樺偍澶勭悊
                                     var gateWay = ZbGateway.GateWayList.Find(obj => obj.getGatewayBaseInfo != null && obj.getGatewayBaseInfo.gwID == zbGateWay.getGatewayBaseInfo.gwID);
@@ -258,10 +262,30 @@
                                             //鏍囪褰撳墠缃戝叧鏄富缃戝叧
                                             gateWay.getGatewayBaseInfo.IsMainGateWay = true;
                                         }
+                                    }
+
+                                    //娴嬭瘯鑳藉惁骞挎挱寰楀埌缃戝叧,閫氬父鎯呭喌涓嬩笉妫�娴�
+                                    if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.CheckCanReceiveGateway == 1)
+                                    {
+                                        if (Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest.ContainsKey(id) == false)
+                                        {
+                                            if (gateWay == null)
+                                            {
+                                                Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest[id] = zbGateWay;
+                                            }
+                                            else
+                                            {
+                                                Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest[id] = gateWay;
+                                            }
+                                        }
                                     }
                                 }
                             }
-                            catch { }
+                            catch
+                            {
+                                //鍏抽棴Socket,涓嬫鍙戦�佷細鑷姩杩炴帴
+                                FindGateWaySocket.Stop();
+                            }
                         }
                         #endregion
                     }
@@ -279,13 +303,13 @@
                     try
                     {
                         //瀹氭椂妫�娴嬭繙绋嬭繛鎺ユ儏鍐�
-                        await ZbGateway.StartRemoteMqtt(); 
+                        await ZbGateway.StartRemoteMqtt();
                         if (!ZbGateway.IsRemote)
                         {
                             System.Threading.Thread.Sleep(500);
                             continue;
                         }
-                        var gateWayList =ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId);
+                        var gateWayList = ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId);
 
                         if (gateWayList.Count == 1)
                         {

--
Gitblit v1.8.0