From b2f2494386c4629cf0e0f0a3740e7672919d53a2 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 06 一月 2021 17:09:55 +0800 Subject: [PATCH] 修改了彩灯的百分比计算 --- ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs | 63 ++++++++++++++++++++++++------- 1 files changed, 48 insertions(+), 15 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs index 9725229..4ae3a2a 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs @@ -13,7 +13,7 @@ /// </summary> /// <param name="common">Common.</param> /// <param name="objecttype">Objecttype.</param> - public static void AddDeviceconditions(CommonDevice common, Dictionary<string, string> objecttype) + public static void AddDeviceconditions(CommonDevice common, Dictionary<string, string> objecttype) { for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) { @@ -21,25 +21,55 @@ { if ((Common.Logic.CurrentLogic.Conditions[i]["MacAddr"] == common.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == common.DeviceEpoint.ToString())) { - if (common.Type == DeviceType.TemperatureSensor)//璁惧娓╁害浼犳劅鍣ㄦ湁鐐圭壒鍒� + if (common.Type == DeviceType.TemperatureSensor) { - var dev = common as TemperatureSensor; - string str = ""; - if (dev.SensorDiv == 1) + + //鑾峰彇璁惧绫诲瀷 + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { common }); + + //绌烘皵璐ㄩ噺浼犳劅鍣� + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) { - str = "1026"; + var cluster_ID1 = Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"]; + var attriButeId1 = Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"]; + var cluster_ID2 = objecttype["Cluster_ID"]; + var attriButeId2 = objecttype["AttriButeId"]; + + bool cluster_ID = false; + if (cluster_ID1 == cluster_ID2 && attriButeId1 == attriButeId2) + { + cluster_ID = true; + } + + if (cluster_ID) + { + //宸茬粡瀛樺湪绉婚櫎鍐嶉噸鏂版坊鍔� + Common.Logic.CurrentLogic.Conditions.RemoveAt(i); + Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); + return; + } } else { - str = "1029"; - } - if (Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"] == str) - { - Common.Logic.CurrentLogic.Conditions.RemoveAt(i); - Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); - return; - } + //璁惧娓╁害浼犳劅鍣� + var dev = common as TemperatureSensor; + string str = ""; + if (dev.SensorDiv == 1) + { + str = "1026"; + } + else + { + str = "1029"; + } + if (Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"] == str) + { + Common.Logic.CurrentLogic.Conditions.RemoveAt(i); + Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); + return; + } + } } else if (common.Type == DeviceType.IASZone) { @@ -75,7 +105,7 @@ /// <summary> /// 娣诲姞Logic鏉′欢鐨勬柟娉� /// </summary> - /// <param name="common">Common.</param> + /// <param name="logic">Common.</param> /// <param name="objecttype">Objecttype.</param> public static void AddLogicconditions(Common.Logic logic, Dictionary<string, string> objecttype) { @@ -264,6 +294,9 @@ Common.Logic.CurrentLogic.Accounts.Add(accountsInfo); } #endregion + + + } -- Gitblit v1.8.0