HDL Home App 第二版本 旧平台金堂用 正在使用
陈嘉乐
2020-12-29 71c7ad13169695913282962a460858e13b6c0969
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs
old mode 100755 new mode 100644
@@ -87,8 +87,8 @@
                listReceiptTopic[i] = gatewayID + "/" + listReceiptTopic[i];
            }
            //接收数
            int receiptCount = 0;
            //蓝才刚整了个同一个主题可能会推送多个过来的机能
            var listCheckTopic = new HashSet<string>();
            Action<string, string> receiptAction = (topic, message) =>
            {
                var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
@@ -104,6 +104,11 @@
                {
                    if (topic == listReceiptTopic[i])
                    {
                        if (listCheckTopic.Contains(topic) == true)
                        {
                            //这里写这个东西是有点用处的
                            continue;
                        }
                        string deviceMac = jobject["DeviceAddr"].ToString();
                        int deviceEpoint = 200;
                        if (jobject.Property("Epoint") != null)
@@ -128,7 +133,11 @@
                            jobject.Remove("Time");
                        }
                        reResult.JsonData[i] = jobject.ToString();
                        receiptCount++;
                        if (listCheckTopic.Contains(topic) == false)
                        {
                            //加到检测主题对象中
                            listCheckTopic.Add(topic);
                        }
                    }
                }
@@ -137,10 +146,25 @@
            //发送数据
            myGateway.Send(sendTopic, sendData);
            int receveCount = listCheckTopic.Count;
            if (receveCount > 1)
            {
                //看看里面有没有重复的
                var listTemp = new HashSet<string>();
                foreach (var value in listCheckTopic)
                {
                    if (listTemp.Contains(value) == false)
                    {
                        listTemp.Add(value);
                    }
                }
                receveCount = listTemp.Count;
            }
            //超时时间
            int TimeOut = 0;
            waitTime = 20 * waitTime;
            while (receiptCount != listReceiptTopic.Count && TimeOut < waitTime)
            while (receveCount != listReceiptTopic.Count && TimeOut < waitTime)
            {
                //全部接收才退出
                System.Threading.Thread.Sleep(50);
@@ -148,7 +172,7 @@
            }
            myGateway.Actions -= receiptAction;
            receiptAction = null;
            if (receiptCount != listReceiptTopic.Count)
            if (receveCount != listReceiptTopic.Count)
            {
                reResult.ErrorMsgDiv = 0;
            }