| | |
| | | /// </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++) |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | /// <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) |
| | | { |
| | |
| | | Common.Logic.CurrentLogic.Accounts.Add(accountsInfo); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |