HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-10-28 1f5636d69332170ea3a41c76c9519f6ff6f0a8d9
ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
@@ -14,7 +14,7 @@
        /// 获取LogicId的方法
        /// </summary>
        /// <returns>The logic identifier.</returns>
        public static async System.Threading.Tasks.Task<List<int>> GetLogicId()
        public static async System.Threading.Tasks.Task<List<int>> GetLogicId(int LogicType)
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
@@ -53,6 +53,8 @@
                mainGateWay.GwResDataAction += action;
                var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 2004 } };
                var jObjectdata1 = new JObject { { "LogicType", LogicType } };
                jObject.Add("Data", jObjectdata1);
                mainGateWay?.Send("Logic/GetLogicList", jObject.ToString());
                //await System.Threading.Tasks.Task.Run(async () =>
                //{
@@ -74,7 +76,7 @@
        /// 获取Logic的方法
        /// </summary>
        /// <returns>The logic identifier.</returns>
        public static async System.Threading.Tasks.Task<Common.Logic> GetLogic(int LogicId)
        public static async System.Threading.Tasks.Task<Common.Logic> GetLogic(int LogicId,int LogicType)
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
@@ -149,7 +151,8 @@
                {
                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 2002 } };
                    var data = new JObject {
                        { "LogicId",LogicId}
                        { "LogicId",LogicId},
                        { "LogicType",LogicType}
                        };
                    jObject.Add("Data", data);
                    ZbGateway.MainGateWay?.Send("Logic/GetLogicInfo", jObject.ToString());
@@ -566,13 +569,13 @@
        /// 获取Logic列表的方法
        /// </summary>
        /// <returns>The logic identifier.</returns>
        public static async System.Threading.Tasks.Task<List<Common.Logic>> ReadList(int sum)
        public static async System.Threading.Tasks.Task<List<Common.Logic>> ReadList(int sum,int LogicType)
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
                var listLogic = new List<Common.Logic>();
                bool @bool = false;
               // bool @bool = false;
                Action<string, string> action = (topic, data) =>
                {
                    var gatewayID = topic.Split('/')[0];
@@ -590,6 +593,7 @@
                        logic.LogicId = int.Parse(Logicifon["LogicId"].ToString());
                        logic.IsEnable = int.Parse(Logicifon["IsEnable"].ToString());
                        logic.LogicName = Logicifon["LogicName"].ToString();
                        logic.LogicType = int.Parse(Logicifon["LogicType"].ToString());
                        logic.Relationship = int.Parse(Logicifon["Relationship"].ToString());
                        logic.TimeAttribute = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.TimeAttributeObj>(Logicifon["TimeAttribute"].ToString());
                        logic.Conditions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(Logicifon["Conditions"].ToString());
@@ -639,10 +643,10 @@
                        }
                    }
                    if (topic == $"{gatewayID}/Logic/AllLogicNum_Respon")
                    {
                        @bool = true;
                    }
                    //if (topic == $"{gatewayID}/Logic/AllLogicNum_Respon")
                    //{
                    //    @bool = true;
                    //}
                };
                var mainGateWay = ZbGateway.MainGateWay;
                if (mainGateWay == null)
@@ -654,6 +658,8 @@
                try
                {
                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 2015 } };
                    var jObjectdata = new JObject { { "LogicType", LogicType } };
                    jObject.Add("Data", jObjectdata);
                    ZbGateway.MainGateWay?.Send("Logic/GetAllLogicListInfo", jObject.ToString());
                }
                catch { }
@@ -661,14 +667,14 @@
                while ((DateTime.Now - dateTime).TotalMilliseconds < 8 * 1000)
                {
                    await System.Threading.Tasks.Task.Delay(100);
                    //if (sum == listLogic.Count)
                    //{
                    //    break;
                    //}
                    if (@bool)
                    if (sum == listLogic.Count)
                    {
                        break;
                    }
                    //if (@bool)
                    //{
                    //    break;
                    //}
                }
                ZbGateway.MainGateWay.GwResDataAction -= action;
                return listLogic;
@@ -695,7 +701,7 @@
        public static List<DoorLock> ReadDoorLockIfon(string doorlockMac)
        {
            List<DoorLock> list = new List<DoorLock>();
            string url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager";
            string url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager";//子账号和主账号可能链接不同
            System.Net.WebClient webClient = new System.Net.WebClient();
            System.Collections.Specialized.NameValueCollection postValues = new System.Collections.Specialized.NameValueCollection();
            postValues.Add("RequestVersion", CommonPage.RequestVersion);
@@ -735,7 +741,7 @@
                           }
                           else
                           {
                               residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetDoorLockPager";
                               residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/DoorLock/GetDoorLockPager";
                               residential.Token = Config.Instance.Token;
                               residential.Id = Config.Instance.HomeId;
                               residential.IsOtherAccountCtrl = false;