From 45e4e387f3ef259b9e225fdd543e20be285a5112 Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期二, 29 十月 2019 13:42:57 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-wjc --- ZigbeeApp/Shared/Common/Room.cs | 76 +++++++++++++++++++++++++++++++++++++- 1 files changed, 74 insertions(+), 2 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs index c7a830e..676bce3 100755 --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -960,6 +960,78 @@ return sceneList; } + /// <summary> + /// 鑾峰彇褰撳墠鎴块棿涓嬬殑鍏ㄩ儴璁惧 + /// </summary> + /// <returns></returns> + public List<CommonDevice> GetRoomListDevice() + { + var listDevice = new List<CommonDevice>(); + foreach (var device in this.DeviceUIList) + { + if (device == null || device.CommonDevice == null) + { + continue; + } + listDevice.Add(device.CommonDevice); + } + if (listDevice.Count == 0) + { + return listDevice; + } + return Common.LocalDevice.Current.SortDevice(listDevice); + } + + /// <summary> + /// 鑾峰彇鎴块棿璁惧绫诲瀷 + /// </summary> + /// <param name="room"></param> + /// <returns></returns> + public static List<DeviceType> GetdeviceTypes(Room room) + { + List<DeviceType> typeList = new List<DeviceType> { }; + foreach (var deviceUI in room.DeviceUIList) + { + if (deviceUI == null || deviceUI.CommonDevice == null) + { + continue; + } + if (!typeList.Contains(deviceUI.CommonDevice.Type)) + { + typeList.Add(deviceUI.CommonDevice.Type); + } + } + return typeList; + } + + /// <summary> + /// 鑾峰彇璇ョ被鍨嬬殑璁惧 + /// </summary> + /// <param name="room"></param> + /// <param name="deviceType"></param> + /// <returns></returns> + public static List<DeviceUI> GetDeviceUIs(Room room ,DeviceType deviceType) + { + List<DeviceUI> typeList = new List<DeviceUI> { }; + foreach (var deviceUI in room.DeviceUIList) + { + if (deviceUI == null || deviceUI.CommonDevice == null) + { + continue; + } + if(deviceUI.CommonDevice.Type!=deviceType) + { + continue; + } + if (!typeList.Contains(deviceUI)) + { + typeList.Add(deviceUI); + } + } + return typeList; + } + + #endregion #region 鈼� 娣诲姞鍦烘櫙_________________________ @@ -982,7 +1054,7 @@ return -1; } } - + var getSceneIdAllData = await ZigBee.Device.Scene.GetSceneNewIdAsync(sceneName); if (getSceneIdAllData == null || getSceneIdAllData.getSceneIdData == null) { @@ -1468,6 +1540,6 @@ } #endregion - + } } -- Gitblit v1.8.0