黄学彪
2020-04-29 b68cdc7e103a00d5df73e4b75603be8da1815b4a
ZigbeeApp/Shared/Common/Device.cs
@@ -400,6 +400,27 @@
            }
        }
        /// <summary>
        /// 添加虚拟设备到缓存
        /// </summary>
        /// <param name="device">设备对象</param>
        public void AddVirtualDeviceToMemory(CommonDevice device)
        {
            string mainKeys = this.GetDeviceMainKeys(device);
            this.dicAllDevice[mainKeys] = device;
            //设备回路收集
            if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == false)
            {
                this.dicDeviceEpoint[device.DeviceAddr] = new HashSet<int>();
            }
            if (this.dicDeviceEpoint[device.DeviceAddr].Contains(device.DeviceEpoint) == false)
            {
                this.dicDeviceEpoint[device.DeviceAddr].Add(device.DeviceEpoint);
            }
            device.ReSave();
        }
        #endregion
        #region ■ 修改设备___________________________
@@ -416,6 +437,12 @@
            this.SetEpointName(device, newName);
            this.BackupDeviceAfterReName(device);
            //如果住宅为虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                return true;
            }
            //不再检测名字是否一样
            //成员只能修改自己本地的名字
@@ -462,6 +489,11 @@
                //更改名字后,刷新设备缓存
                this.BackupDeviceAfterReName(device2);
            }
            //如果住宅为虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                return true;
            }
            CommonDevice device = listDevice[0];
@@ -679,7 +711,11 @@
        /// <param name="device"></param>
        public void SetFixedPositionCommand(CommonDevice device)
        {
            device.IdentifyControl(device.DeviceAddr, device.DeviceEpoint, 5);
            //如果当前住宅不是虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == false)
            {
                device.IdentifyControl(device.DeviceAddr, device.DeviceEpoint, 5);
            }
        }
        /// <summary>
@@ -1003,15 +1039,8 @@
                //继电器,掉光器都叫回路
                return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + epointNo;
            }
            //获取设备类型
            var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
            if (device.Type == DeviceType.Thermostat)
            {
                //新风面板中的Thermostat叫温度传感器
                if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
                {
                    return Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                }
                //空调都叫室内机
                return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + epointNo;
            }
@@ -1025,7 +1054,10 @@
                //新风面板湿度传感器
                return Language.StringByID(R.MyInternationalizationString.HumiditySensor);
            }
            else if (device.Type == DeviceType.OnOffSwitch)
            //获取设备类型
            var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
            if (device.Type == DeviceType.OnOffSwitch)
            {
                //面板的干接点叫按键
                if (deviceInfoType.BeloneType == DeviceBeloneType.A按键面板)
@@ -1036,6 +1068,19 @@
                else
                {
                    return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + epointNo;
                }
            }
            else if (device.Type == DeviceType.TemperatureSensor)
            {
                if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
                {
                    //新风面板中的Thermostat为温度传感器
                    return Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                }
                else if (deviceInfoType.BeloneType == DeviceBeloneType.A按键面板)
                {
                    //面板的温度探头叫  面板名字+温度
                    return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.uTemperature);
                }
            }
            //其他情况,使用它的默认名称
@@ -1758,6 +1803,14 @@
                }
                info.ObjectTypeNameId = 60000;//传感器
            }
            //14新风设备
            else if (dicType.ContainsKey(DeviceType.FreshAir) == true)
            {
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId2310;
                info.BeloneType = DeviceBeloneType.A新风;
                info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul;
                info.ObjectTypeNameId = 60011;//新风
            }
            int value = (int)info.BeloneType;
            if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
@@ -2007,6 +2060,7 @@
            list.Add(DeviceBeloneType.A插座);
            list.Add(DeviceBeloneType.A调光器);
            list.Add(DeviceBeloneType.A窗帘);
            list.Add(DeviceBeloneType.A新风);
            list.Add(DeviceBeloneType.A空调);
            list.Add(DeviceBeloneType.A继电器);
            list.Add(DeviceBeloneType.A干接点);
@@ -2040,6 +2094,15 @@
            {
                //2020.03.23追加式样:未指定类型的继电器,不显示
                if (i_device.DfunctionType == DeviceFunctionType.A未定义)
                {
                    return false;
                }
            }
            //如果是新风面板的新风设备,则不显示
            else if (i_device.Type == DeviceType.FreshAir)
            {
                var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
                if (myInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
                {
                    return false;
                }
@@ -2590,7 +2653,7 @@
            //=========★★继电器类(2300-2499)★★=========
            this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3路继电器小模块
            this.dicDeviceModelIdEnum["MFA01-ZB1.0"] = "2310-2300-60001";//方悦新风小模块
            this.dicDeviceModelIdEnum["MFA01-ZB.10"] = "2310-2300-60011";//方悦新风小模块
            //=========★★调光器类(2500-2799)★★=========
            this.dicDeviceModelIdEnum["MPD0101-ZB.10"] = "2500-2500-60007";//1路调光器小模块
@@ -2930,6 +2993,10 @@
        /// </summary>
        A继电器 = 2300,
        /// <summary>
        /// 新风
        /// </summary>
        A新风 = 2310,
        /// <summary>
        /// 调光器(2500-2799)
        /// </summary>
        A调光器 = 2500,
@@ -2984,7 +3051,7 @@
        /// <summary>
        /// 干接点
        /// </summary>
        A干接点 = 16
        A干接点 = 16,
    }
    #endregion