| | |
| | | /// </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"; |
| | | //设备温度传感器 |
| | | 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; |
| | | } |
| | | |
| | | } |
| | | 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) |
| | | { |
| | | var iASZonedevice = common as IASZone; |
| | | if (iASZonedevice.ModelIdentifier == "MSPIRB-ZB.10") |
| | | {//球形移动传感器 |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"] == objecttype["Cluster_ID"]) |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); |
| | | return; |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); |
| | | return; |
| | | |
| | | } |
| | | else |
| | |
| | | /// <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) |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="common">Common.</param> |
| | | /// <param name="actionsInfo">Objecttype.</param> |
| | | public static void AddDeviceactions(ZigBee.Device.CommonDevice common, Dictionary<string, object> actionsInfo) |
| | | public static void AddDeviceActions(ZigBee.Device.CommonDevice common, Dictionary<string, object> actionsInfo) |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Actions.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["LinkType"].ToString() == "0") |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() == common.DeviceAddr && Common.Logic.CurrentLogic.Actions[i]["Epoint"].ToString() == common.DeviceEpoint.ToString()) |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Actions.Insert(i, actionsInfo); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | Common.Logic.CurrentLogic.Actions.Add(actionsInfo); |
| | | } |
| | | /// <summary> |
| | | /// 添加门锁设备输出的方法 |
| | | /// </summary> |
| | | /// <param name="common">Common.</param> |
| | | /// <param name="actionsInfo">Objecttype.</param> |
| | | public static void AddDoorLockActions(ZigBee.Device.CommonDevice common, Dictionary<string, object> actionsInfo) |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Actions.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["LinkType"].ToString() == "8") |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() == common.DeviceAddr && Common.Logic.CurrentLogic.Actions[i]["Epoint"].ToString() =="200") |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Actions.Insert(i, actionsInfo); |
| | |
| | | /// <summary> |
| | | /// 添加安防输出的方法 |
| | | /// </summary> |
| | | /// <param name="objecttype">Objecttype.</param> |
| | | /// <param name="o">O.</param> |
| | | /// <param name="actionsInfo">actionsInfo.</param> |
| | | public static void AddSecurityactions(Dictionary<string, object> actionsInfo) |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Actions.Count; i++) |
| | |
| | | /// <summary> |
| | | /// 添加自动化输出的方法 |
| | | /// </summary> |
| | | /// <param name="objecttype">Objecttype.</param> |
| | | /// <param name="o">O.</param> |
| | | /// <param name="actionsInfo">Objecttype.</param> |
| | | /// <param name="logic">logic</param> |
| | | public static void AddLogicactions(Common.Logic logic, Dictionary<string, object> actionsInfo) |
| | | { |
| | | |
| | |
| | | Common.Logic.CurrentLogic.Accounts.Add(accountsInfo); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |