From 490696fba6c1f1318e088c439ee81d536126581b Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 18 五月 2020 10:35:26 +0800 Subject: [PATCH] 优化门锁远程问题 --- ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 49 ++++++++++++++++++++++++------------------------- 1 files changed, 24 insertions(+), 25 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 64b9859..7c8edec --- 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,27 +3222,12 @@ } } } - #endregion #region 璁惧鍦ㄧ嚎鐘舵�佹洿鏂板弽棣� //2020.05.11 鍒犻櫎 - #endregion - - #region 璁惧鐘舵�佷笂鎶� - else 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 闂ㄩ攣鎿嶄綔浜嬩欢閫氱煡 else if (topic == gatewayID + "/" + "DoorLock/DoorLockOperatingEventNotificationCommand") @@ -3511,13 +3510,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