陈嘉乐
2020-05-15 d5b9ff8bf8cc36f5b13c46b66682f5988d3a6f36
ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs
old mode 100644 new mode 100755
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using Shared;
using ZigBee.Device;
namespace Shared.Phone.Device.Logic
{
    public class LogicIfon
@@ -11,7 +13,7 @@
        /// </summary>
        /// <param name="common">Common.</param>
        /// <param name="objecttype">Objecttype.</param>
        public static void AddDeviceconditions(ZigBee.Device.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++)
            {
@@ -19,9 +21,32 @@
                {
                    if ((Common.Logic.CurrentLogic.Conditions[i]["MacAddr"] == common.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == common.DeviceEpoint.ToString()))
                    {
                        Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
                        Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype);
                        return;
                        if (common.Type == DeviceType.TemperatureSensor)//设备温度传感器有点特别
                        {
                            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
                        {
                            Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
                            Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype);
                            return;
                        }
                    }
                }
@@ -94,7 +119,6 @@
            Common.Logic.CurrentLogic.Conditions.Add(objecttype);
        }
        #endregion
        #region ----逻辑输出目标----
        /// <summary>
@@ -102,7 +126,7 @@
        /// </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++)
            {
@@ -119,6 +143,27 @@
            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);
                        return;
                    }
                }
            }
            Common.Logic.CurrentLogic.Actions.Add(actionsInfo);
        }
        /// <summary>
        /// 添加Scene输出的方法
        /// </summary>
        /// <param name="Scene">Common.</param>