11
wei
2021-02-23 d89a8ccb3d48d39f920b294c1966a3522ee8adbc
HDL_ON/Entity/FunctionList.cs
@@ -241,7 +241,8 @@
                            break;
                        case SPK.SensorSmoke:
                        case SPK.SensorWater:
                        case SPK.SensorGas:
                        case SPK.SensorDoorWindow:
                        case SPK.SensorPir:
                            var ser = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(functionDataString);
                            List.sensorsArm.Add(ser);
                            deviceFunctionList.Add(ser);
@@ -565,6 +566,33 @@
        }
        bool lockReadFunctionStatus = false;
        /// <summary>
        /// 读取第三方设备状态
        /// </summary>
        public void Read3tyFunctionStatus()
        {
            //读取涂鸦设备状态
            if (GetDeviceFunctionList(SPK.BrandType.Tuya).Count > 0)
            {
                var page = new List<string>();
                int count = 0;
                foreach (var function in GetDeviceFunctionList(SPK.BrandType.Tuya))
                {
                    page.Add(function.deviceId);
                    count++;
                    if (count > 9)
                    {
                        DriverLayer.Control.Ins.ReadFunctionsInfo(page);
                        page.Clear();
                        count = 0;
                    }
                }
                DriverLayer.Control.Ins.ReadFunctionsInfo(page);
            }
        }
        /// <summary>
        /// 读取全部功能的状态
        /// </summary>
@@ -586,26 +614,25 @@
                lockReadFunctionStatus = true;
                try
                {
                    //读取涂鸦设备状态
                    if (GetDeviceFunctionList(SPK.BrandType.Tuya).Count > 0)
                    Read3tyFunctionStatus();
                    if(DriverLayer.Control.Ins.GatewayOnline_Local)
                    {
                        var page = new List<string>();
                        int count = 0;
                        foreach (var function in GetDeviceFunctionList(SPK.BrandType.Tuya))
                        foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl))
                        {
                            page.Add(function.deviceId);
                            count++;
                            if (count > 9)
                            switch (function.Spk_Prefix)
                            {
                                DriverLayer.Control.Ins.ReadFunctionsInfo(page);
                                page.Clear();
                                count = 0;
                                case FunctionCategory.Light:
                                case FunctionCategory.Electric:
                                case FunctionCategory.Curtain:
                                case FunctionCategory.AC:
                                case FunctionCategory.FloorHeat:
                                    DriverLayer.Control.Ins.SendReadCommand(function);
                                    break;
                            }
                        }
                        DriverLayer.Control.Ins.ReadFunctionsInfo(page);
                    }
                    if (DriverLayer.Control.Ins.IsRemote)
                    else
                    {
                        var page = new List<string>();
                        int count = 0;
@@ -622,22 +649,6 @@
                            }
                        }
                        DriverLayer.Control.Ins.SendApiReadCommand(page);
                    }
                    else
                    {
                        foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl))
                        {
                            switch (function.Spk_Prefix)
                            {
                                case FunctionCategory.Light:
                                case FunctionCategory.Electric:
                                case FunctionCategory.Curtain:
                                case FunctionCategory.AC:
                                case FunctionCategory.FloorHeat:
                                    DriverLayer.Control.Ins.SendReadCommand(function);
                                    break;
                            }
                        }
                    }
                }
                catch (Exception ex)