From 136b9e2fc48249a5ff89874f1080ba94130e7a9e Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期二, 19 五月 2020 11:12:29 +0800 Subject: [PATCH] Merge branch 'dev-tzy' into dev-2020xm --- ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 35 ++++++++++++++++++++++++----------- 1 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs old mode 100755 new mode 100644 index f8b36df..8a07d57 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -2758,8 +2758,8 @@ .WithTcpServer(domain, int.Parse(port)) .WithCredentials(connEmqUserName, connEmqPwd) .WithKeepAlivePeriod(TimeSpan.FromSeconds(20)) - .WithCleanSession() - //.WithCommunicationTimeout(TimeSpan.FromSeconds(10)) + .WithCleanSession() + //.WithCommunicationTimeout(TimeSpan.FromSeconds(10)) .Build(); await DisConnectRemoteMqttClient("StartRemoteMqtt"); await RemoteMqttClient.ConnectAsync(options, CancellationToken.None); @@ -3184,9 +3184,23 @@ { jobject = Newtonsoft.Json.Linq.JObject.Parse(message); } + + #region 璁惧鐘舵�佷笂鎶ャ�愬鎬紝涓轰粈涔堟斁鍦ㄥ師鏉ョ殑浣嶇疆浼氫笉鎵ц杩欏潡浠g爜銆嬶紵锛燂紵銆� + if (topic == gatewayID + "/" + "DeviceStatusReport" + "/" + addr + "/" + epoint + "/" + cluID + "/" + attrId) + { + var deviceID = jobject.Value<int>("Device_ID"); + var deviceAddr = jobject.Value<string>("DeviceAddr"); + var tempEpoint = jobject.Value<int>("Epoint"); + var dataId = jobject.Value<int>("Data_ID"); + + var tempDevice = new CommonDevice { DeviceID = deviceID, DeviceAddr = deviceAddr, DeviceEpoint = tempEpoint }; + tempDevice.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceStatusReportData>(jobject["Data"].ToString()); + UpdateDeviceInfo(tempDevice, "DeviceStatusReport"); + } + #endregion #region 杩滅▼,涓荤綉鍏充笂鎶ラ�氱煡 - if (IsRemote) + else if (IsRemote) { if (topic == gatewayID + "/" + "BeMainGw_Report") { @@ -3208,7 +3222,6 @@ } } } - #endregion #region 璁惧鍦ㄧ嚎鐘舵�佹洿鏂板弽棣� @@ -3511,13 +3524,13 @@ public static void DebugPrintLog(string msg, bool flage = true) { #if DEBUG - if (flage == true) - { - if (msg.Contains("DeviceStatusReport") == false) - { - System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); - } - } + //if (flage == true) + //{ + //if (msg.Contains("DeviceStatusReport") == false) + //{ + System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); + // } + // } #endif } -- Gitblit v1.8.0