黄学彪
2019-11-28 3a26f6025130dcaae4aa82ea19b16ad902450eb8
ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
@@ -65,7 +65,7 @@
                            //最后再断开mqtt连接
                            for (int i = 0; i < list.Count; i++)
                            {
                                list[i].DisConnect("1");
                                list[i].DisConnectLocalMqttClient("1");
                            }
                            list.Clear();
                            oldHomeID = Shared.Common.Config.Instance.HomeId;
@@ -111,6 +111,10 @@
                        else
                        {
                            ZbGateway.IsRemote = true;
                            for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
                            {
                                 ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1");
                            }
                        }
                        searchCount--;
@@ -208,8 +212,8 @@
                                    var gateWay = ZbGateway.GateWayList.Find(obj => obj.getGatewayBaseInfo != null && obj.getGatewayBaseInfo.gwID == zbGateWay.getGatewayBaseInfo.gwID);
                                    if (gateWay == null)
                                    {
                                        await zbGateWay.StartLocalMqtt(ipAddress);
                                        ZbGateway.GateWayList.Add(zbGateWay);
                                        await zbGateWay.StartLocalMqtt(ipAddress);
                                        NewGateWayAction?.Invoke(zbGateWay);
                                    }
                                    else
@@ -219,11 +223,11 @@
                                        gateWay.GatewayOnlineFlage = true;
                                        if (gateWay.getGatewayBaseInfo.IpAddress != ipAddress)
                                        {
                                            gateWay.DisConnect("2");
                                            await gateWay.DisConnectLocalMqttClient("2");
                                            ZbGateway.GateWayList.Remove(gateWay);
                                            gateWay = zbGateWay;
                                            await zbGateWay.StartLocalMqtt(ipAddress);
                                            ZbGateway.GateWayList.Add(gateWay);
                                            await zbGateWay.StartLocalMqtt(ipAddress);
                                        }
                                        else
                                        {
@@ -270,7 +274,7 @@
                    try
                    {
                        //定时检测远程连接情况
                        await ZbGateway.StartCloudMqtt();
                        await ZbGateway.StartRemoteMqtt();
                        if (!ZbGateway.IsRemote)
                        {
                            System.Threading.Thread.Sleep(500);