陈嘉乐
2020-09-02 652243206427f35a256400a149a1734085824cb9
ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
@@ -2,110 +2,739 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Shared.Common;
using Shared.Phone.Device.Category;
using Shared.Phone.UserCenter.Device;
using ZigBee.Device;
using static ZigBee.Device.BindObj;
using static ZigBee.Device.Panel;
namespace Shared.Phone.UserCenter.DeviceBind
{
    public class BindInfo
    {
        #region 绑定设计的变量定义
        /// <summary>
        /// 当前按键配置的功能
        /// 当前设备绑定类型
        /// </summary>
        public static int clusterID = 0;
        /// <summary>
        /// 记录旧的目标列表
        /// </summary>
        public static List<CommonDevice> oldTargetList = new List<CommonDevice>();
        //public static async System.Threading.Tasks.Task<int> RemoveTargets(BindObj.BindListResponseObj bindDevice, Panel currentKey)
        //{
        //    var delDevice = new BindObj.DelDeviceBindData();
        //    delDevice.DeviceAddr = currentKey.DeviceAddr;
        //    delDevice.Epoint = currentKey.DeviceEpoint;
        //    if (bindDevice.BindType == 0 || bindDevice.BindType == 1)
        //    {
        //        var removeDevice = new BindObj.RemoveBindListObj();
        //        removeDevice.BindCluster = bindDevice.BindCluster;
        //        removeDevice.BindType = 0;
        //        removeDevice.BindMacAddr = bindDevice.BindMacAddr;
        //        removeDevice.BindEpoint = bindDevice.BindEpoint;
        //        delDevice.RemoveBindList.Add(removeDevice);
        //    }
        //    else if (bindDevice.BindType == 2)
        //    {
        //        var removeDevice = new BindObj.RemoveBindListObj();
        //        removeDevice.BindCluster = bindDevice.BindCluster;
        //        removeDevice.BindType = 1;
        //        removeDevice.BindScenesId = bindDevice.BindScenesId;
        //        delDevice.RemoveBindList.Add(removeDevice);
        //    }
        //    var delResult = await currentKey.DelDeviceBindAsync(delDevice);
        //    foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList)
        //    {
        //        switch (re.Result)
        //        {
        //            case 0:
        //                return 0;
        //                break;
        //            case 4:
        //                if (delResult.removeBindResultResponseData != null)
        //                {
        //                    if (delResult.removeBindResultResponseData.Result == 0)
        //                    {
        //                        return 0;
        //                    }
        //                }
        //                break;
        //        }
        //    }
        //    return -1;
        //}
        public static async System.Threading.Tasks.Task<int> RemoveTargets(BindObj.BindListResponseObj bindDevice, Panel currentKey)
        public enum BindType
        {
            var delDevice = new BindObj.DelDeviceBindData();
            delDevice.DeviceAddr = currentKey.DeviceAddr;
            delDevice.Epoint = currentKey.DeviceEpoint;
            /// <summary>
            /// 新风
            /// </summary>
            FreshAir = 1,
            /// <summary>
            /// 温度传感器
            /// </summary>
            Temperature = 2,
            /// <summary>
            /// 湿度传感器
            /// </summary>
            Humidity = 3,
            /// <summary>
            /// PM2.5传感器
            /// </summary>
            PM = 4,
            /// <summary>
            /// 空调目标
            /// </summary>
            AC = 5,
            /// <summary>
            /// 地暖目标
            /// </summary>
            Fh = 6,
        }
            if (bindDevice.BindType == 0 || bindDevice.BindType == 1)
        #endregion
        #region 绑定涉及的数据处理
        /// <summary>
        /// 获取当前楼层名称
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentKeyAllRoomList()
        {
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
            foreach (var floorId in dicFloor.Keys)
            {
                var removeDevice = new BindObj.RemoveBindListObj();
                removeDevice.BindCluster = bindDevice.BindCluster;
                removeDevice.BindType = 0;
                removeDevice.BindMacAddr = bindDevice.BindMacAddr;
                removeDevice.BindEpoint = bindDevice.BindEpoint;
                delDevice.RemoveBindList.Add(removeDevice);
                //第一个楼层
                return dicFloor[floorId];
                break;
            }
            else if (bindDevice.BindType == 2)
            return null;
        }
        /// <summary>
        /// 获取当前楼层
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentSelectFloorId()
        {
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();//
            foreach (var floorId in dicFloor.Keys)
            {
                var removeDevice = new BindObj.RemoveBindListObj();
                removeDevice.BindCluster = bindDevice.BindCluster;
                removeDevice.BindType = 1;
                removeDevice.BindScenesId = bindDevice.BindScenesId;
                delDevice.RemoveBindList.Add(removeDevice);
                //第一个楼层
                return floorId;
                break;
            }
            var delResult = await currentKey.DelDeviceBindAsync(delDevice);
            if (delResult != null && delResult.removeBindResultResponseData != null)
            return null;
        }
        /// <summary>
        /// 获取当前楼层名称
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentSelectFloorIdName()
        {
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
            foreach (var floorId in dicFloor.Keys)
            {
                if (delResult.removeBindResultResponseData.Result == 0)
                //第一个楼层
                return dicFloor[floorId];
                break;
            }
            return null;
        }
        /// <summary>
        /// 获取当前楼层名称
        /// fllodID:楼层ID
        /// </summary>
        /// <returns></returns>
        public static string GetBindTargetsFloorIdName(string curFllodID)
        {
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
            foreach (var floorId in dicFloor.Keys)
            {
                //当前楼层
                if (curFllodID == floorId)
                {
                    return 0;
                    return dicFloor[floorId];
                    break;
                }
                else
            }
            return null;
        }
        /// <summary>
        /// 获取当前房间中匹配的支持绑定的设备列表
        /// currentRoomSupportBindDeviceList 当前房间中支持被绑定的设备列表
        /// curRoom 当前房间
        /// curDeviceBindType 当前设备绑定类型
        /// </summary>
        /// <returns></returns>
        public static List<CommonDevice> GetCurRoomSupportDeviceList(List<CommonDevice> currentRoomSupportBindDeviceList, Room curRoom, BindInfo.BindType curDeviceBindType)
        {
            currentRoomSupportBindDeviceList.Clear();
            List<CommonDevice> curRoomDeviceListTemp = new List<CommonDevice>();
            switch (curDeviceBindType)
            {
                case BindType.FreshAir:
                    foreach (var deviceKeys in curRoom.ListDevice)
                    {
                        var device = LocalDevice.Current.GetDevice(deviceKeys);
                        if (device != null)
                        {
                            if (BindInfo.checkRealFreshAirDevice(device) == false)
                            {
                                continue;
                            }
                            if (device.Type == DeviceType.FreshAir)
                            {
                                curRoomDeviceListTemp.Add(device);
                            }
                        }
                    }
                    break;
                case BindType.Temperature:
                    curRoomDeviceListTemp = GetMatchTemperatureSensorDevice(curRoom);
                    break;
                case BindType.Humidity:
                    curRoomDeviceListTemp = GetMatchHumiditySensorDevice(curRoom);
                    foreach (var deviceKeys in curRoom.ListDevice)
                    {
                        var device = LocalDevice.Current.GetDevice(deviceKeys);
                        if (device != null)
                        {
                            if (device.Type == DeviceType.FreshAirHumiditySensor)
                            {
                                curRoomDeviceListTemp.Add(device);
                            }
                        }
                    }
                    break;
                case BindType.PM:
                    foreach (var deviceKeys in curRoom.ListDevice)
                    {
                        var device = LocalDevice.Current.GetDevice(deviceKeys);
                        if (device != null)
                        {
                            if (device.Type == DeviceType.PMSensor)
                            {
                                curRoomDeviceListTemp.Add(device);
                            }
                        }
                    }
                    break;
                case BindType.AC:
                    foreach (var deviceKeys in curRoom.ListDevice)
                    {
                        var device = LocalDevice.Current.GetDevice(deviceKeys);
                        if (device != null)
                        {
                            if (device.Type == DeviceType.Thermostat)
                            {
                                if (BindInfo.checkRealAcDevice(device) == false)
                                {
                                    continue;
                                }
                                curRoomDeviceListTemp.Add(device);
                            }
                        }
                    }
                    break;
            }
            return curRoomDeviceListTemp;
        }
        /// <summary>
        /// 匹配温度传感器
        /// </summary>
        /// <param name="room"></param>
        public static List<CommonDevice> GetMatchTemperatureSensorDevice(Room room)
        {
            List<CommonDevice> roomIncludeMatchTempDevice = new List<CommonDevice>();
            foreach (var de in room.ListDevice)
            {
                var device = LocalDevice.Current.GetDevice(de);
                if (device != null)
                {
                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance);
                    //电池设备不支持绑定
                    if (device.ZigbeeType != 1)
                    {
                        continue;
                    }
                    if (device.Type == DeviceType.TemperatureSensor)
                    {
                        var dev = device as TemperatureSensor;
                        if (dev.SensorDiv == 1)
                        {
                            roomIncludeMatchTempDevice.Add(device);
                        }
                    }
                    else if (device.Type == DeviceType.PMSensor)
                    {
                        var dev = device as PMSensor;
                        foreach (var clu in dev.InClusterList)
                        {
                            if (clu.InCluster == 1026)
                            {
                                roomIncludeMatchTempDevice.Add(device);
                            }
                        }
                    }
                }
            }
            return roomIncludeMatchTempDevice;
        }
        /// <summary>
        /// 匹配湿度传感器
        /// </summary>
        /// <param name="room"></param>
        public static List<CommonDevice> GetMatchHumiditySensorDevice(Room room)
        {
            List<CommonDevice> roomIncludeMatchHumpDevice = new List<CommonDevice>();
            foreach (var de in room.ListDevice)
            {
                var device = LocalDevice.Current.GetDevice(de);
                if (device != null)
                {
                    //电池设备不支持绑定
                    if (device.ZigbeeType != 1)
                    {
                        continue;
                    }
                    if (device.Type == DeviceType.TemperatureSensor)
                    {
                        var dev = device as TemperatureSensor;
                        if (dev.SensorDiv == 2)
                        {
                            roomIncludeMatchHumpDevice.Add(device);
                        }
                    }
                    else if (device.Type == DeviceType.PMSensor)
                    {
                        var dev = device as PMSensor;
                        foreach (var clu in dev.InClusterList)
                        {
                            if (clu.InCluster == 1029)
                            {
                                roomIncludeMatchHumpDevice.Add(device);
                            }
                        }
                    }
                }
            }
            return roomIncludeMatchHumpDevice;
        }
        /// <summary>
        /// 获取支持的房间列表
        /// </summary>
        /// <returns></returns>
        public static List<Room> GetSupportRoomList()
        {
            var supportRoomListTemp = new List<Room>();
            var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
            if (Common.Config.Instance.Home.FloorDics.Count == 0)
            {
                // 获取没有楼层房间
                foreach (var room in listAllRoom)
                {
                    if (string.IsNullOrEmpty(room.FloorId))
                    {
                        if (room.IsLove)
                        {
                            continue;
                        }
                        supportRoomListTemp.Add(room);
                    }
                }
            }
            else
            {
                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance);
                // 获取支持的房间
                foreach (var room in listAllRoom)
                {
                    if (room.IsLove)
                    {
                        continue;
                    }
                    supportRoomListTemp.Add(room);
                }
            }
            return -1;
            return supportRoomListTemp;
        }
        /// <summary>
        /// 能显示的房间列表
        /// curControlDev 控制设备
        /// supportRoomList 本地房间列表
        /// curDeviceBindType 当前设备绑定类型
        /// </summary>
        public static List<Room> GetSupportRoomList(Panel curControlDev, List<Room> supportRoomList, BindInfo.BindType curDeviceBindType)
        {
            var roomTempList = new List<Room>();
            for (int i = 0; i < supportRoomList.Count; i++)
            {
                var room = supportRoomList[i];
                //如果房间为喜爱[后来改名为常用房间],则不显示
                if (room.IsLove == true)
                {
                    continue;
                }
                //如果房间中没有设备,则不显示
                if (room.ListDevice.Count == 0)
                {
                    continue;
                }
                else
                {
                    List<CommonDevice> roomIncludeMatchDevice = new List<CommonDevice>();
                    //房间中没有对应的支持绑定的目标
                    switch (curDeviceBindType)
                    {
                        case BindInfo.BindType.FreshAir:
                            foreach (var de in room.ListDevice)
                            {
                                var device = LocalDevice.Current.GetDevice(de);
                                if (device != null)
                                {
                                    if (BindInfo.checkRealFreshAirDevice(device) == false)
                                    {
                                        continue;
                                    }
                                    if (device.Type == DeviceType.FreshAir)
                                    {
                                        roomIncludeMatchDevice.Add(device);
                                    }
                                }
                            }
                            break;
                        case BindInfo.BindType.Temperature:
                            roomIncludeMatchDevice = BindInfo.GetMatchTemperatureSensorDevice(room);
                            break;
                        case BindInfo.BindType.Humidity:
                            roomIncludeMatchDevice = GetMatchHumiditySensorDevice(room);
                            foreach (var de in room.ListDevice)
                            {
                                var device = LocalDevice.Current.GetDevice(de);
                                if (device != null)
                                {
                                    if (device.Type == DeviceType.FreshAirHumiditySensor)
                                    {
                                        roomIncludeMatchDevice.Add(device);
                                    }
                                }
                            }
                            break;
                        case BindInfo.BindType.PM:
                            foreach (var de in room.ListDevice)
                            {
                                var device = LocalDevice.Current.GetDevice(de);
                                if (device != null)
                                {
                                    if (device.Type == DeviceType.PMSensor)
                                    {
                                        roomIncludeMatchDevice.Add(device);
                                    }
                                }
                            }
                            break;
                        case BindInfo.BindType.AC:
                            foreach (var de in room.ListDevice)
                            {
                                var device = LocalDevice.Current.GetDevice(de);
                                if (device != null)
                                {
                                    if (device.Type == DeviceType.Thermostat)
                                    {
                                        if (BindInfo.checkRealAcDevice(device) == false)
                                        {
                                            continue;
                                        }
                                        roomIncludeMatchDevice.Add(device);
                                    }
                                }
                            }
                            break;
                    }
                    if (roomIncludeMatchDevice.Count == 0)
                    {
                        continue;
                    }
                    if (!string.IsNullOrEmpty(room.FloorId))
                    {
                        //有楼层
                        if (room.FloorId == curControlDev.currentSelectFloorId)
                        {
                            roomTempList.Add(room);
                        }
                    }
                    else
                    {
                        //没有楼层
                        roomTempList.Add(room);
                    }
                }
            }
            return roomTempList;
        }
        /// <summary>
        /// 获取本地未分配的支持当前类型的绑定设备列表
        /// </summary>
        /// <returns></returns>
        public static List<CommonDevice> GetUndistributeDeviceList(List<CommonDevice> undistruibuteDevList, DeviceBind.BindInfo.BindType curDeviceBindType)
        {
            undistruibuteDevList.Clear();
            List<CommonDevice> UndistributeCommonDeviceListTemp = new List<CommonDevice>();
            //获取本地设备列表
            foreach (var tempDev in Shared.Common.LocalDevice.Current.listAllDevice)
            {
                //获取设备所属房间
                var tempDevRoom = HdlRoomLogic.Current.GetRoomByDevice(tempDev);
                if (tempDevRoom == null)
                {
                    UndistributeCommonDeviceListTemp.Add(tempDev);
                }
            }
            switch (curDeviceBindType)
            {
                case BindType.FreshAir:
                    foreach (var device in UndistributeCommonDeviceListTemp)
                    {
                        if (BindInfo.checkRealFreshAirDevice(device) == false)
                        {
                            continue;
                        }
                        if (device.Type == DeviceType.FreshAir)
                        {
                            undistruibuteDevList.Add(device);
                        }
                    }
                    break;
                case BindType.Temperature:
                    foreach (var device in UndistributeCommonDeviceListTemp)
                    {
                        //电池设备不支持绑定
                        if (device.ZigbeeType != 1)
                        {
                            continue;
                        }
                        if (device.Type == DeviceType.TemperatureSensor)
                        {
                            var dev = device as TemperatureSensor;
                            if (dev.SensorDiv == 1)
                            {
                                undistruibuteDevList.Add(device);
                            }
                        }
                        else if (device.Type == DeviceType.PMSensor)
                        {
                            var dev = device as PMSensor;
                            foreach (var clu in dev.InClusterList)
                            {
                                if (clu.InCluster == 1026)
                                {
                                    undistruibuteDevList.Add(device);
                                }
                            }
                        }
                    }
                    break;
                case BindType.Humidity:
                    foreach (var device in UndistributeCommonDeviceListTemp)
                    {
                        //电池设备不支持绑定
                        if (device.ZigbeeType != 1)
                        {
                            continue;
                        }
                        if (device.Type == DeviceType.TemperatureSensor)
                        {
                            var dev = device as TemperatureSensor;
                            if (dev.SensorDiv == 2)
                            {
                                undistruibuteDevList.Add(device);
                            }
                        }
                        else if (device.Type == DeviceType.PMSensor)
                        {
                            var dev = device as PMSensor;
                            foreach (var clu in dev.InClusterList)
                            {
                                if (clu.InCluster == 1029)
                                {
                                    undistruibuteDevList.Add(device);
                                }
                            }
                        }
                        if (device.Type == DeviceType.FreshAirHumiditySensor)
                        {
                            undistruibuteDevList.Add(device);
                        }
                    }
                    break;
                case BindType.PM:
                    foreach (var device in UndistributeCommonDeviceListTemp)
                    {
                        if (device.Type == DeviceType.PMSensor)
                        {
                            undistruibuteDevList.Add(device);
                        }
                    }
                    break;
                case BindType.AC:
                    foreach (var device in UndistributeCommonDeviceListTemp)
                    {
                        if (device.Type == DeviceType.Thermostat)
                        {
                            if (BindInfo.checkRealAcDevice(device) == false)
                            {
                                continue;
                            }
                            undistruibuteDevList.Add(device);
                        }
                    }
                    break;
            }
            return undistruibuteDevList;
        }
        /// <summary>
        /// 所有房间中匹配的支持绑定的所有目标列表
        /// </summary>
        /// <returns></returns>
        public static List<CommonDevice> GetAllRoomSupportDeviceList(List<CommonDevice> currentPanelSupportBindDeviceList, List<Room> supportRoomList, DeviceBind.BindInfo.BindType curDeviceBindType)
        {
            currentPanelSupportBindDeviceList.Clear();
            List<CommonDevice> currentPanelBindSupportDeviceListTemp = new List<CommonDevice>();
            switch (curDeviceBindType)
            {
                case BindInfo.BindType.FreshAir:
                    foreach (var r in supportRoomList)
                    {
                        if (r.ListDevice.Count == 0)
                        {
                            continue;
                        }
                        foreach (var deviceKeys in r.ListDevice)
                        {
                            var device = LocalDevice.Current.GetDevice(deviceKeys);
                            if (device != null)
                            {
                                if (BindInfo.checkRealFreshAirDevice(device) == false)
                                {
                                    continue;
                                }
                                if (device.Type == DeviceType.FreshAir)
                                {
                                    currentPanelBindSupportDeviceListTemp.Add(device);
                                }
                            }
                        }
                    }
                    break;
                case BindInfo.BindType.Temperature:
                    foreach (var r in supportRoomList)
                    {
                        if (r.ListDevice.Count == 0)
                        {
                            continue;
                        }
                        var deviceListTemp = GetMatchTemperatureSensorDevice(r);
                        foreach (var dev in deviceListTemp)
                        {
                            currentPanelBindSupportDeviceListTemp.Add(dev);
                        }
                    }
                    break;
                case BindInfo.BindType.Humidity:
                    foreach (var r in supportRoomList)
                    {
                        if (r.ListDevice.Count == 0)
                        {
                            continue;
                        }
                        var deviceListTemp = GetMatchHumiditySensorDevice(r);
                        foreach (var dev in deviceListTemp)
                        {
                            currentPanelBindSupportDeviceListTemp.Add(dev);
                        }
                        foreach (var deviceKeys in r.ListDevice)
                        {
                            var device = LocalDevice.Current.GetDevice(deviceKeys);
                            if (device != null)
                            {
                                if (device.Type == DeviceType.FreshAirHumiditySensor)
                                {
                                    currentPanelBindSupportDeviceListTemp.Add(device);
                                }
                            }
                        }
                    }
                    break;
                case BindInfo.BindType.PM:
                    foreach (var r in supportRoomList)
                    {
                        if (r.ListDevice.Count == 0)
                        {
                            continue;
                        }
                        foreach (var deviceKeys in r.ListDevice)
                        {
                            var device = LocalDevice.Current.GetDevice(deviceKeys);
                            if (device != null)
                            {
                                if (device.Type == DeviceType.PMSensor)
                                {
                                    currentPanelBindSupportDeviceListTemp.Add(device);
                                }
                            }
                        }
                    }
                    break;
                case BindInfo.BindType.AC:
                    foreach (var r in supportRoomList)
                    {
                        if (r.ListDevice.Count == 0)
                        {
                            continue;
                        }
                        foreach (var deviceKeys in r.ListDevice)
                        {
                            var device = LocalDevice.Current.GetDevice(deviceKeys);
                            if (device != null)
                            {
                                if (device.Type == DeviceType.Thermostat)
                                {
                                    if (BindInfo.checkRealAcDevice(device) == false)
                                    {
                                        continue;
                                    }
                                    currentPanelBindSupportDeviceListTemp.Add(device);
                                }
                            }
                        }
                    }
                    break;
            }
            return currentPanelBindSupportDeviceListTemp;
        }
        /// <summary>
        /// 检测目标是否被绑定过
        /// targetList 按键配置的目标列表
        /// oldTargetList 面板中已经存在的目标列表
        /// </summary>
        /// <returns></returns>
        public static bool checkExistDevice(List<CommonDevice> targetList, List<CommonDevice> oldTargetList)
        {
            bool exist = false;
            foreach (var oldDev in oldTargetList)
            {
                var key = oldDev.DeviceAddr + oldDev.DeviceEpoint;
                var result = targetList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == key));
                if (result != null)
                {
                    exist = true;
                }
                else
                {
                    exist = false;
                }
            }
            return exist;
        }
        /// <summary>
        /// 是否是真实的空调设备 【部分是能绑定空调的设备】
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public static bool checkRealAcDevice(CommonDevice device)
        {
            bool result = true;
            //获取设备类型的
            var clu = device.OutClusterList.Find((obj) => obj.OutCluster == 513 || obj.OutCluster == 514);
            if (clu != null)
            {
                result = false;
            }
            return result;
        }
        /// <summary>
        /// 是否是真实的新风设备 【部分是能绑定新风的设备】
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public static bool checkRealFreshAirDevice(CommonDevice device)
        {
            bool result = true;
            //获取设备类型的
            var clu = device.OutClusterList.Find((obj) => obj.OutCluster == 514);
            if (clu != null)
            {
                result = false;
            }
            return result;
        }
        /// <summary>
@@ -134,7 +763,7 @@
        /// <returns></returns>
        public static bool CheckCanShowRoom(Common.Room room, string curDeviceBindType = "AddSwitch")
        {
            if (room.DeviceUIList.Count == 0)
            if (room.ListDevice.Count == 0)
            {
                return false;
            }
@@ -142,10 +771,11 @@
            {
                return false;
            }
            foreach (var deviceUi in room.DeviceUIList)
            foreach (var deviceKeys in room.ListDevice)
            {
                var device = Common.LocalDevice.Current.GetDevice(deviceKeys);
                //检测该设备能否显示
                if (CheckCanShowDevice(deviceUi.CommonDevice, curDeviceBindType) == false)
                if (CheckCanShowDevice(device, curDeviceBindType) == false)
                {
                    continue;
                }
@@ -189,72 +819,6 @@
                }
            }
            return false;
        }
        /// <summary>
        /// 底部完成按钮显示
        /// </summary>
        /// <returns></returns>
        public static void FinishDisplay(List<Room> roomTempList, Button btnFinish)
        {
            if (roomTempList.Count == 0)
            {
                btnFinish.Enable = false;
                btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
            }
            else
            {
                btnFinish.Enable = true;
                btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
            }
        }
        /// <summary>
        /// 获取当前楼层名称
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentKeyAllRoomList()
        {
            var dicFloor = Common.Room.CurrentRoom.GetFloorSortList();
            foreach (var floorId in dicFloor.Keys)
            {
                //第一个楼层
                return dicFloor[floorId];
                break;
            }
            return null;
        }
        /// <summary>
        /// 获取当前楼层
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentSelectFloorId()
        {
            var dicFloor = Common.Room.CurrentRoom.GetFloorSortList();
            foreach (var floorId in dicFloor.Keys)
            {
                //第一个楼层
                return floorId;
                break;
            }
            return null;
        }
        /// <summary>
        /// 获取当前楼层名称
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentSelectFloorIdName()
        {
            var dicFloor = Common.Room.CurrentRoom.GetFloorSortList();
            foreach (var floorId in dicFloor.Keys)
            {
                //第一个楼层
                return dicFloor[floorId];
                break;
            }
            return null;
        }
        /// <summary>
@@ -464,11 +1028,26 @@
                    }
                }
            }
            return dicCheck;
        }
        /// <summary>
        /// 底部完成按钮显示
        /// </summary>
        /// <returns></returns>
        public static void FinishDisplay(List<Room> roomTempList, Button btnFinish)
        {
            if (roomTempList.Count == 0)
            {
                btnFinish.Enable = false;
                btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
            }
            else
            {
                btnFinish.Enable = true;
                btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
            }
        }
        #endregion
    }
}