From ef0c6b76b06590b38f6e87d1e4efb35b81374502 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 25 五月 2020 09:49:02 +0800 Subject: [PATCH] 请合并代码,优化逻辑执行提示和撤销门锁定时功能。 --- ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs | 96 ++++++++++++++++++++++++++--------------------- 1 files changed, 53 insertions(+), 43 deletions(-) diff --git a/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs old mode 100755 new mode 100644 index f64c0b6..63c7c0b --- a/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs +++ b/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Newtonsoft.Json.Linq; +using Shared.Common; using ZigBee.Device; namespace Shared.Phone.UserCenter @@ -600,8 +601,7 @@ /// <param name="receiveData"></param> private void DoorLockDeviceReportPush(JObject receiveData) { - //鍙湁寰愭鐨勯棬閿佺晫闈㈡病鏈夋墦寮�鐨勬儏鍐典笅,鎵嶄細澶勭悊杩欎釜涓滆タ - if (ControlCommonResourse.IsDoorLockPageOpen == false && UserCenterResourse.UserInfo.AuthorityNo == 1) + if (UserCenterResourse.UserInfo.AuthorityNo == 1) { var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint")); if (device.Type != DeviceType.DoorLock) @@ -609,40 +609,36 @@ //瀹冧笉鏄棬閿� return; } + var info = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockAlarmsResult>(receiveData["Data"].ToString()); if (info.Clusterid == 257) { - //甯稿紑妯″紡鍏抽棴 - if (info.AlarmCode == 217 || info.AlarmCode == 219) + //216锛氶攣涓婅缃殑甯稿紑 + if (info.AlarmCode == 216) { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunMain(() => { - //娓╁眳鍩庣殑瑕佺綉鍏充腑鏄惁鏈夐�昏緫瀛樺湪 - //鍙傛暟:2-甯稿紑鑷姩鍖�;3-澶辨晥鏃堕棿鑷姩鍖� - var result = await Shared.Phone.Device.Logic.SkipView.Exist(3, (ZigBee.Device.DoorLock)device); - HdlThreadLogic.Current.RunMain(() => + //鏇存柊闂ㄩ攣娑夊強鐨勫父寮�/甯稿叧鐨勭晫闈� + if (UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction != null) { - //寮瑰嚭寰愭鐨勯偅涓獥鍙� - DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, - result != 0 ? true : false, null); - }); + UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction(device.DeviceAddr + device.DeviceEpoint, true); + } }); } } + //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁� + this.ShowHadNewMessageAppeal(); } - //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁� - this.ShowHadNewMessageAppeal(); } - #endregion - + #region 鈻� 璁惧鍦ㄧ嚎鐘舵�佹洿鏂板弽棣坃______________ - + /// <summary> /// 璁惧鍦ㄧ嚎鐘舵�佹洿鏂板弽棣� /// </summary> /// <param name="receiveData"></param> - private void DeviceOnlineChangePush (JObject receiveData) + private void DeviceOnlineChangePush(JObject receiveData) { if (this.dicDeviceEvent.Count == 0) { @@ -827,33 +823,47 @@ //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁� this.ShowHadNewMessageAppeal(); - //杩欎釜涓滆タ鏆傛椂涓嶅鐞� - ////鍙湁寰愭鐨勯棬閿佺晫闈㈡病鏈夋墦寮�鐨勬儏鍐典笅,鎵嶄細澶勭悊杩欎釜涓滆タ - //if (ControlCommonResourse.IsDoorLockPageOpen == false && UserCenterResourse.UserInfo.AuthorityNo == 1) - //{ - // var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint")); - // if (device.Type != DeviceType.DoorLock) - // { - // return; - // } - // //鑷姩鍖栨墽琛� 甯稿紑鍏抽棴 - // var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString()); - // if (data.ActionData != null && data.ActionData.Actiontype == 8 - // && data.ActionData.PassDataString == "055704010113") - // { - // HdlThreadLogic.Current.RunMain(() => - // { - // //寮瑰嚭寰愭鐨勯偅涓獥鍙� - // DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, null); - // }); - // } - //} + // 閫昏緫鎵ц甯稿紑妯″紡澶辨晥鐨勬儏鍐� + if (UserCenterResourse.UserInfo.AuthorityNo == 1) + { + //鑷姩鍖栨墽琛� 甯稿紑鍏抽棴 + var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString()); + if (data != null && data.ActionData != null) + { + if (data.ActionData.Actiontype == 8 && data.ActionData.PassDataString == "055704010113") + { + var deviceAddr = data.ActionData.MacStr; + var device = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr, false); + if (device.Count > 0 && device[0].Type != DeviceType.DoorLock) + { + return; + } + + HdlThreadLogic.Current.RunThread(async () => + { + HdlThreadLogic.Current.RunMain(() => + { + //鎻愮ず闂ㄩ攣宸茬粡澶辨晥 + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NormallyClosed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + }); + + //鏇存柊闂ㄩ攣鐨勬繁搴︽帶鍒堕〉 + ControlCommonResourse.UpdateDoorLockStatusAction?.Invoke(false); + + //閫昏緫鎵ц鐨勫け鏁堣鏇存柊鐘舵�� + if (DoorLock.DoorLockCommonInfo.LogicAction != null) + { + DoorLock.DoorLockCommonInfo.LogicAction(false); + } + }); + } + } + } } - #endregion - + #region 鈻� 鍦烘櫙瑙﹀彂涓婃姤_______________________ - + /// <summary> /// 鍦烘櫙瑙﹀彂涓婃姤 /// </summary> -- Gitblit v1.8.0