| | |
| | | /// <summary> |
| | | /// 获取设备功能列表 |
| | | /// </summary> |
| | | public List<Function> GetDeviceFunctionList() |
| | | public List<Function> GetDeviceFunctionList(SPK.BrandType brandType = SPK.BrandType.All) |
| | | { |
| | | if (deviceFunctionList == null || deviceFunctionList.Count == 0) |
| | | { |
| | |
| | | deviceFunctionList.AddRange(sensorsEnvironmentalScience); |
| | | deviceFunctionList.AddRange(sensorsArm); |
| | | deviceFunctionList.AddRange(UI.Music.A31MusicModel.A31MusicModelList); |
| | | try |
| | | { |
| | | deviceFunctionList = deviceFunctionList.OrderByDescending(o => o.controlCounter).ToList(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"设备功能排序异常:{ex.Message}"); |
| | | } |
| | | } |
| | | try |
| | | |
| | | List<Function> resultFunctions = new List<Function>(); |
| | | if (brandType == SPK.BrandType.All) |
| | | { |
| | | deviceFunctionList = deviceFunctionList.OrderByDescending(o => o.controlCounter).ToList(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"设备功能排序异常:{ex.Message}"); |
| | | else |
| | | { |
| | | switch (brandType) |
| | | { |
| | | case SPK.BrandType.Hdl: |
| | | foreach (var function in deviceFunctionList) |
| | | { |
| | | if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk)) |
| | | { |
| | | resultFunctions.Add(function); |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case SPK.BrandType.Tuya: |
| | | foreach (var function in deviceFunctionList) |
| | | { |
| | | if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk)) |
| | | { |
| | | resultFunctions.Add(function); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | return resultFunctions; |
| | | } |
| | | |
| | | return deviceFunctionList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 清空设备功能列表 |
| | | /// </summary> |
| | |
| | | lockReadFunctionStatus = true; |
| | | try |
| | | { |
| | | //读取涂鸦设备状态 |
| | | 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); |
| | | } |
| | | |
| | | if (DriverLayer.Control.Ins.IsRemote) |
| | | { |
| | | var page = new List<string>(); |
| | | int count = 0; |
| | | |
| | | foreach (var function in GetDeviceFunctionList()) |
| | | foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl)) |
| | | { |
| | | page.Add(function.deviceId); |
| | | count++; |
| | |
| | | } |
| | | else |
| | | { |
| | | foreach (var function in GetDeviceFunctionList()) |
| | | foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl)) |
| | | { |
| | | switch (function.Spk_Prefix) |
| | | { |
| | |
| | | lockReadFunctionStatus = false; |
| | | MainPage.Log($"结束--读取"); |
| | | } |
| | | |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |