HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-05-09 21736b2944d5e88cd705a39ff87fd73d5a16e609
ZigbeeApp/Shared/Common/Device.cs
@@ -628,6 +628,9 @@
        /// <param name="deleteRoom">是否从房间删除</param>
        public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
        {
            //删除缓存设备的话,主页需要重新刷新
            Phone.UserView.UserPage.Instance.RefreshForm = true;
            if (deleteRoom == true)
            {
                //从房间中删除
@@ -2086,6 +2089,50 @@
        #endregion
        #region ■ 获取设备在线状态列表_______________
        /// <summary>
        /// 获取设备在线状态列表(注意,一个设备只返回一个回路)
        /// </summary>
        /// <param name="gwId">网关id</param>
        /// <returns></returns>
        public List<CommonDevice> GetDeviceOnlineList(string gwId)
        {
            var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
            int statu = 0;
            var listDevice = this.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
            if (statu == -1)
            {
                //当出现异常时,使用后备操作,直接获取本地的设备列表
                listDevice = this.GetDeviceByGatewayID(gwId);
            }
            var dicDevice = new Dictionary<string, CommonDevice>();
            foreach (var device in listDevice)
            {
                if (dicDevice.ContainsKey(device.DeviceAddr) == false)
                {
                    dicDevice[device.DeviceAddr] = device;
                    continue;
                }
                //设备是否处于在线状态
                bool online = this.CheckDeviceIsOnline(device);
                if (online == true)
                {
                    //如果设备回路在线,则优先使用在线的回路,后来的直接覆盖
                    dicDevice[device.DeviceAddr] = device;
                }
            }
            var listReturn = new List<CommonDevice>();
            foreach (var device in dicDevice.Values)
            {
                listReturn.Add(device);
            }
            return listReturn;
        }
        #endregion
        #region ■ 一般方法___________________________
        /// <summary>
@@ -2673,6 +2720,9 @@
            this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1200-60000";//紧急按键
            this.dicDeviceModelIdEnum["MGCD01/ZB.10"] = "1306-1200-60000";//吸顶燃气传感器
            //PM2.5空气质量传感器 【该设备属于第三方设备,没有镜像ID】
            this.dicDeviceModelIdEnum["SZ_PM100"] = "1307-1200-60000";//PM2.5空气质量传感器
            //=========★★继电器类(2300-2499)★★=========
            this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3路继电器小模块
            this.dicDeviceModelIdEnum["MFA01-ZB.10"] = "2310-2300-60011";//方悦新风小模块
@@ -2864,6 +2914,11 @@
        /// </summary>
        Sensor_CeilingGas = 1306,
        /// <summary>
        /// PM2.5空气质量传感器
        /// </summary>
        Sensor_PMTwoPointFive = 1307,
        /// <summary>
        /// 运动传感器
        /// </summary>
        Sensor_Motion = -1306,