wxr
2023-08-03 1789f33db1b549f0211258d828c551cc33c7c407
HDL_ON/DAL/DriverLayer/Control.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using HDL_ON.DAL.Mqtt;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI;
@@ -124,6 +125,10 @@
                        HomePage.LoadEvent_CheckLinkStatus();
                    }
                }
                else
                {
                    MainPage.Log($"状态一致,不更新数据(本地)");
                }
            }
        }
        bool _GatewayOnline_Cloud = false;
@@ -169,7 +174,16 @@
                            MainPage.Log($"网关云端在线,刷新设备状态");
                            new System.Threading.Thread(() =>
                            {
                                System.Threading.Thread.Sleep(1000);
                                int count = 20;
                                while (true)
                                {
                                    System.Threading.Thread.Sleep(500);
                                    if (MqttClient.isSubscribeSuccess || count<1)
                                    {
                                        break;
                                    }
                                    count--;
                                }
                                FunctionList.List.ReadAllFunctionStatus();
                            })
                            { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start();
@@ -179,6 +193,10 @@
                            //修改主页连接状态
                            HomePage.LoadEvent_CheckLinkStatus();
                        }
                    }
                    else
                    {
                        MainPage.Log($"状态一致,不更新数据(云端)");
                    }
                }catch(Exception ex)
                {
@@ -277,6 +295,7 @@
            }
            else if (MainPage.InternetStatus == 2)
            {
                DAL.Mqtt.MqttClient.InitState();
                OpenUdp(DB_ResidenceData.Instance.GatewayType == 0 ? 6000 : 8585);
                //重置搜索网关标志
                IsSearchLocalGatewaySuccessful = false;
@@ -303,7 +322,6 @@
                        System.Threading.Thread.Sleep(500);
                    }
                    DAL.Mqtt.MqttClient.InitState();
                })
                { IsBackground = true }.Start();
            }
@@ -317,6 +335,7 @@
        /// </summary>
        public void LoginGateway()
        {
            return;//tcp控制存在问题,但是先不用tcp控制了,要经过测试先  2023-07-29 10:14:32
            if (loginGatewayThread == null)
            {
                loginGatewayThread = new System.Threading.Thread(() =>
@@ -1190,7 +1209,7 @@
        /// <summary>
        /// 更新设备状态
        /// 更新群控设备状态
        /// A协议数据
        /// </summary>
        public void UpdataGroupControlStatus(string revString, byte[] usefulBytes, bool isCloudData = false)
@@ -1329,6 +1348,10 @@
                                    EnergyMainPage.UpdataStatus(localFunction);
                                }
                                break;
                            case SPK.AirSwitchP3:
                                AirSwitchP3Page.UpdataState(localFunction);
                                AirSwitchP3SubloopEnergyPage.UpdataStatus(localFunction);
                                break;
                            case SPK.ElectricEnergy:
                                EnergyMainPage.UpdataStatus(localFunction);
                                break;