xm
2020-05-13 99da2604f81af29afc6b3c6f4f128b4e5a8a5649
ZigbeeApp/Shared/Common/Device.cs
@@ -271,7 +271,7 @@
                //添加缓存
                this.AddDeviceToMemory(ref device);
                //移除存在的设备内存
                //移除存在的设备内存
                string maikey = this.GetDeviceMainKeys(device);
                if (dicExist.ContainsKey(maikey) == true)
                {
@@ -441,6 +441,8 @@
            //如果住宅为虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                //修改设备名字的话,主页需要重新刷新
                Phone.UserView.UserPage.Instance.RefreshForm = true;
                return true;
            }
@@ -465,6 +467,8 @@
                //备份数据
                await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A端点名称, newName);
            }
            //修改设备名字的话,主页需要重新刷新
            Phone.UserView.UserPage.Instance.RefreshForm = true;
            return true;
        }
@@ -1327,7 +1331,7 @@
        }
        /// <summary>
        /// 设置【设备类型】的图标到指定的控件
        /// 设置【设备类型】的图标到指定的控件(此方法不能用在设备功能类型菜单的图标)
        /// </summary>
        /// <param name="btnIcon">控件对象</param>
        /// <param name="listdevice">设备对象</param>
@@ -1349,7 +1353,7 @@
        }
        /// <summary>
        /// 获取【设备类型】的图标
        /// 获取【设备类型】的图标(此方法不能用在设备功能类型菜单的图标)
        /// </summary>
        /// <param name="listdevice">设备对象</param>
        /// <param name="unSelectPath">图片地址</param>
@@ -1365,13 +1369,42 @@
        }
        /// <summary>
        /// 获取【设备类型】的图标
        /// 获取【设备功能类型】的菜单图标
        /// </summary>
        /// <param name="specificType">自定义设备类型</param>
        /// <param name="unSelectPath">图片地址</param>
        /// <param name="selectPath">图片地址</param>
        /// <returns></returns>
        public void GetDeviceObjectIcon(DeviceConcreteType specificType, ref string unSelectPath, ref string selectPath)
        public void GetDeviceFunctionTypeMenuIcon(DeviceConcreteType specificType, ref string unSelectPath, ref string selectPath)
        {
            //新风小模块
            if (specificType == DeviceConcreteType.Relay_FangyueFreshAirModul)
            {
                unSelectPath = "Device/FreshAirEpoint.png";
                selectPath = "Device/FreshAirEpointSelected.png";
                return;
            }
            //PM2.5空气质量传感器
            else if (specificType == DeviceConcreteType.Sensor_PMTwoPointFive)
            {
                unSelectPath = "Device/AirQualitySensorEpoint.png";
                selectPath = "Device/AirQualitySensorEpointSelected.png";
                return;
            }
            //上面需要特殊处理
            //获取【设备类型】的图标
            this.GetDeviceObjectIcon(specificType, ref unSelectPath, ref selectPath);
        }
        /// <summary>
        /// 获取【设备类型】的图标 2020.05.13:次函数不再公开
        /// </summary>
        /// <param name="specificType">自定义设备类型</param>
        /// <param name="unSelectPath">图片地址</param>
        /// <param name="selectPath">图片地址</param>
        /// <returns></returns>
        private void GetDeviceObjectIcon(DeviceConcreteType specificType, ref string unSelectPath, ref string selectPath)
        {
            //将具体类型转字符串
            string strSpecific = Enum.GetName(typeof(DeviceConcreteType), specificType);
@@ -1408,6 +1441,7 @@
            unSelectPath = imageFilePath;
            selectPath = imageSelectFilePath;
        }
        #endregion
@@ -1818,7 +1852,7 @@
            else if (dicType.ContainsKey(DeviceType.PMSensor) == true)
            {
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1307;
                info.BeloneType = DeviceBeloneType.A传感器;
                info.BeloneType = DeviceBeloneType.APM2点5空气质量传感器;
                info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive;
                info.ObjectTypeNameId = 60000;//传感器
            }
@@ -2150,7 +2184,7 @@
        /// <returns></returns>
        public bool CheckDeviceIsOnline(CommonDevice i_device)
        {
            //0:离线 1:在线 2:正在刷新状态
            //0:离线 1:在线 2:正在刷新状态
            return i_device.IsOnline == 1 || i_device.IsOnline == 2;
        }
@@ -2533,8 +2567,6 @@
            mainDevice.InClusterList.AddRange(device.DeviceInfo.InClusterList);
            mainDevice.OutClusterList.Clear();
            mainDevice.OutClusterList.AddRange(device.DeviceInfo.OutClusterList);
            mainDevice.AttributeStatus.Clear();
            mainDevice.AttributeStatus.AddRange(device.DeviceInfo.AttributeStatus);
            //如果是温度传感器
            if (mainDevice.Type == DeviceType.TemperatureSensor)
@@ -2642,11 +2674,9 @@
        public void SetNewDeviceMainKeys(CommonDevice device, Newtonsoft.Json.Linq.JObject jobject)
        {
            //设置设备主键类
            device.Time = jobject.Value<int>("Time");
            device.DeviceID = jobject.Value<int>("Device_ID");
            device.DeviceAddr = jobject.Value<string>("DeviceAddr");
            device.DeviceEpoint = jobject.Value<int>("Epoint");
            device.DataID = jobject.Value<int>("Data_ID");
        }
        #endregion
@@ -2731,7 +2761,7 @@
            this.dicDeviceModelIdEnum["MGCD01/ZB.10"] = "1306-1200-60000";//吸顶燃气传感器
            //PM2.5空气质量传感器 【该设备属于第三方设备,没有镜像ID】
            this.dicDeviceModelIdEnum["SZ_PM100"] = "1307-1200-60000";//PM2.5空气质量传感器
            this.dicDeviceModelIdEnum["SZ_PM100"] = "1307-1200-60000";//PM2.5空气质量传感器
            //=========★★继电器类(2300-2499)★★=========
            this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3路继电器小模块
@@ -3079,6 +3109,10 @@
        /// </summary>
        A传感器 = 1200,
        /// <summary>
        /// PM2.5空气质量传感器
        /// </summary>
        APM2点5空气质量传感器 = 1307,
        /// <summary>
        /// 继电器(2300-2499)
        /// </summary>
        A继电器 = 2300,