| | |
| | | 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);
|
| | |
| | | {
|
| | | if (topic == listReceiptTopic[i])
|
| | | {
|
| | | if (listCheckTopic.Contains(topic) == true)
|
| | | {
|
| | | //这里写这个东西是有点用处的
|
| | | continue;
|
| | | }
|
| | | string deviceMac = jobject["DeviceAddr"].ToString();
|
| | | int deviceEpoint = 200;
|
| | | if (jobject.Property("Epoint") != null)
|
| | |
| | | jobject.Remove("Time");
|
| | | }
|
| | | reResult.JsonData[i] = jobject.ToString();
|
| | | receiptCount++;
|
| | | if (listCheckTopic.Contains(topic) == false)
|
| | | {
|
| | | //加到检测主题对象中
|
| | | listCheckTopic.Add(topic);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //超时时间
|
| | | int TimeOut = 0;
|
| | | waitTime = 20 * waitTime;
|
| | | while (receiptCount != listReceiptTopic.Count && TimeOut < waitTime)
|
| | | while (listCheckTopic.Count != listReceiptTopic.Count && TimeOut < waitTime)
|
| | | {
|
| | | //全部接收才退出
|
| | | System.Threading.Thread.Sleep(50);
|
| | |
| | | }
|
| | | myGateway.Actions -= receiptAction;
|
| | | receiptAction = null;
|
| | | if (receiptCount != listReceiptTopic.Count)
|
| | | if (listCheckTopic.Count != listReceiptTopic.Count)
|
| | | {
|
| | | reResult.ErrorMsgDiv = 0;
|
| | | }
|