From c47c3ec2488961b3a006aaebcb03dba582f8b19b Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期四, 12 三月 2020 17:08:42 +0800 Subject: [PATCH] 2020-03-12-1 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs | 126 +++++++++++++++++++++++++++++------------ 1 files changed, 89 insertions(+), 37 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs index 6993d9f..619dd26 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs @@ -51,8 +51,8 @@ /// <param name="gatewayId">缃戝叧ID</param> /// <param name="topic">鏁翠釜涓婚</param> /// <param name="reportTopic">涓婃姤鏁版嵁鐨勪富棰�</param> - /// <param name="receiveData">鎺ユ敹鐨勬暟鎹�</param> - public void GatewayOverallMsgReceive(string gatewayId, string topic, string reportTopic, JObject receiveData) + /// <param name="msgData">鎺ユ敹鐨勬暟鎹�</param> + public void GatewayOverallMsgReceive(string gatewayId, string topic, string reportTopic, string msgData) { if (topic == "AppNoLogin") { @@ -67,7 +67,7 @@ }); return; } - else if (topic == "BeingSqueezedOffline") + else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.ConnEmqClientId + "/Push/NotifySqueeze") { HdlThreadLogic.Current.RunMain(() => { @@ -93,6 +93,23 @@ }); return; } + else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted" + || topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/DeletedShareData") + { + if (UserCenterResourse.UserInfo.AuthorityNo == 3) + { + HdlThreadLogic.Current.RunMain(() => + { + //鍒嗕韩鏁版嵁宸茬粡鍙樻洿,璇烽噸鏂扮櫥闄� + string msg = Language.StringByID(R.MyInternationalizationString.uShardDataIsChangedPleaseLoginAgain); + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); + + UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); + }); + } + return; + } try { if (HdlGatewayLogic.Current.IsGatewayExist(gatewayId) == false) @@ -100,52 +117,56 @@ //涓嶆槸鑷繁缁戝畾鐨勭綉鍏筹紝鍒欎笉澶勭悊 return; } - //璁惧灞炴�т笂鎶� if (reportTopic == "DeviceStatusReport") { //璁惧灞炴�т笂鎶� - this.DeviceAttributeReportPush(receiveData); + this.DeviceAttributeReportPush(JObject.Parse(msgData)); } //浼犳劅鍣ㄤ笂鎶� else if (reportTopic == "IASInfoReport") { - this.SensorDeviceReportPush(receiveData); + this.SensorDeviceReportPush(JObject.Parse(msgData)); } //闂ㄩ攣涓婃姤 else if (topic == gatewayId + "/Alarms/SendAlarmInform") { - this.DoorLockDeviceReportPush(receiveData); + this.DoorLockDeviceReportPush(null); } //閫氳繃澶栭儴鏂瑰紡甯冮槻鎾ら槻鎴愬姛鏃舵姤鍛� else if (topic == gatewayId + "/Security/EnOrWithdrawSucceedReport") { - this.SecurityEnOrWithdrawSucceedReport(receiveData); + this.SecurityEnOrWithdrawSucceedReport(JObject.Parse(msgData)); } //璁惧鍦ㄧ嚎鐘舵�佹洿鏂板弽棣� else if (reportTopic == "OnlineStatusChange_Respon") { - this.DeviceOnlineChangePush(receiveData); + this.DeviceOnlineChangePush(JObject.Parse(msgData)); + } + //璁惧鎺у埗鐘舵�佸弽棣� + else if (reportTopic == "DeviceDefaultAck") + { + this.DeviceControlResponePush(JObject.Parse(msgData)); } //鎾ら槻 else if (topic == gatewayId + "/Security/WithdrawMode_Respon") { - this.RemoveSafetyGarrisonPush(receiveData); + this.RemoveSafetyGarrisonPush(JObject.Parse(msgData)); } //甯冮槻 else if (topic == gatewayId + "/Security/EnableMode_Respon") { - this.SetSafetyGarrisonPush(receiveData); + this.SetSafetyGarrisonPush(JObject.Parse(msgData)); } //閫昏緫瑙﹀彂涓婃姤 else if (topic == gatewayId + "/Logic/Execute_Respon") { - this.LogicExecutePush(receiveData); + this.LogicExecutePush(null); } //鍦烘櫙瑙﹀彂涓婃姤 else if (topic == gatewayId + "/Scene/Exec_Respon") { - this.SceneExecPush(receiveData); + this.SceneExecPush(null); } } catch (Exception ex) @@ -165,6 +186,11 @@ /// <param name="receiveData"></param> private void DeviceAttributeReportPush(JObject receiveData) { + if (this.dicDeviceEvent.Count == 0) + { + //娌℃湁娣诲姞鐩戝惉 + return; + } var deviceAddr = receiveData.Value<string>("DeviceAddr"); var deviceEpoint = receiveData.Value<int>("Epoint"); @@ -211,7 +237,7 @@ private void DoorLockDeviceReportPush(JObject receiveData) { //淇濆瓨闂ㄩ攣淇℃伅鍒版湰鍦� - HdlAlarmsLogic.Current.SaveDoorLockAlarmInfo(receiveData); + //HdlAlarmsLogic.Current.SaveDoorLockAlarmInfo(receiveData); //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁� this.ShowHadNewMessageAppeal(); @@ -227,10 +253,35 @@ /// <param name="receiveData"></param> private void DeviceOnlineChangePush (JObject receiveData) { + if (this.dicDeviceEvent.Count == 0) + { + //娌℃湁娣诲姞鐩戝惉 + return; + } var tempDevice = new CommonDevice() { DeviceAddr = receiveData.Value<string>("DeviceAddr"), DeviceEpoint = receiveData.Value<int>("Epoint") }; - tempDevice.IsOnline = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(receiveData["Data"]["IsOnline"].ToString()); + tempDevice.IsOnline = Convert.ToInt32(receiveData["Data"]["IsOnline"].ToString()); this.DeviceReportPush(tempDevice, ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤); + } + + #endregion + + #region 鈻� 璁惧鎺у埗鐘舵�佸弽棣坃__________________ + + /// <summary> + /// 璁惧鎺у埗鐘舵�佸弽棣� + /// </summary> + /// <param name="receiveData"></param> + private void DeviceControlResponePush(JObject receiveData) + { + if (this.dicDeviceEvent.Count == 0) + { + //娌℃湁娣诲姞鐩戝惉 + return; + } + var tempDevice = new CommonDevice() { DeviceAddr = receiveData.Value<string>("DeviceAddr"), DeviceEpoint = receiveData.Value<int>("Epoint") }; + + this.DeviceReportPush(tempDevice, ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉); } #endregion @@ -391,10 +442,12 @@ #endregion + + #region 鈻� 娣诲姞璁惧浜嬩欢_______________________ /// <summary> - /// 娣诲姞鑾峰彇璁惧灞炴�х殑浜嬩欢(鎺ㄩ�佸凡缁忓己鍒舵寚瀹氳繍琛屼簬涓荤嚎绋嬶紝灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport) + /// 娣诲姞鑾峰彇璁惧灞炴�х殑浜嬩欢(灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport) /// </summary> /// <param name="mainKeys">鏍囪瘑浜嬩欢鐨勪富閿�(鍙互闅忎究濉�,涓昏鏄拡瀵瑰涓晫闈竴璧蜂娇鐢ㄧ殑鎯呭喌)</param> /// <param name="comand">鍛戒护鍖哄垎</param> @@ -470,14 +523,13 @@ /// <param name="comand"></param> private void DeviceReportPush(CommonDevice common, ReceiveComandDiv comand) { + if (this.dicDeviceEvent.Count == 0) + { + //娌℃湁娣诲姞鐩戝惉 + return; + } lock (this.dicDeviceEvent) { - if (this.dicDeviceEvent.Count == 0) - { - //娌℃湁娣诲姞鐩戝惉 - return; - } - var list = new List<Action<CommonDevice>>(); foreach (string keys in this.dicDeviceEvent.Keys) { @@ -490,23 +542,19 @@ list.Add(this.dicDeviceEvent[keys]); } //鏈夊彲鑳藉湪鍥炶皟鍑芥暟涓Щ闄や簡浜嬩欢锛屽鑷存姤閿欙紝鎵�浠ュ厛鏀堕泦锛屽啀璋冪敤 - Application.RunOnMainThread(() => + foreach (var action in list) { - foreach (var action in list) + try { - try - { - action?.Invoke(common); - } - catch (Exception ex) - { - //Log鍑哄姏 - string msg = "褰撳墠婵�娲荤殑鐣岄潰[" + UserCenterResourse.NowActionFormID + "]"; - HdlLogLogic.Current.WriteLog(-1, msg); - HdlLogLogic.Current.WriteLog(ex); - } + action?.Invoke(common); } - }); + catch (Exception ex) + { + //Log鍑哄姏 + string msg = "鎺ㄩ�侀敊璇�! 褰撳墠婵�娲荤殑鐣岄潰[" + UserCenterResourse.NowActionFormID + "]"; + HdlLogLogic.Current.WriteLog(ex, msg); + } + } } } @@ -559,6 +607,10 @@ /// <summary> /// 璁惧鍦ㄧ嚎涓婃姤 /// </summary> - A璁惧鍦ㄧ嚎涓婃姤 = 3 + A璁惧鍦ㄧ嚎涓婃姤 = 3, + /// <summary> + /// 褰撳鎴风鍙戦�佹帶鍒惰澶囨寚浠わ紝濡傛墦寮�鎴栧叧闂澶囥�佽皟鑺備寒搴︺�侀鑹层�傚鏋滆鎺у埗鐨勮妭鐐硅澶囧湪绾匡紝鑺傜偣璁惧灏嗗弽棣� + /// </summary> + A鑺傜偣鎺у埗鍙嶉 = 4 } } -- Gitblit v1.8.0