From e90209beae6a4e822cecb18e6889f8bda23f630e Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 14 十二月 2020 11:16:06 +0800 Subject: [PATCH] 合并了晾衣架(非新云端) --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs | 213 +++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 156 insertions(+), 57 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Common/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs similarity index 83% rename from ZigbeeApp/Shared/Phone/Common/Logic/HdlGatewayReceiveLogic.cs rename to ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs index eab944a..f263cf4 100644 --- a/ZigbeeApp/Shared/Phone/Common/Logic/HdlGatewayReceiveLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json.Linq; using ZigBee.Device; -namespace Shared.Phone +namespace Shared.Phone.UserCenter { /// <summary> /// 鍏ㄥ眬鎺ユ敹缃戝叧鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�) @@ -73,9 +73,10 @@ { //鐧诲綍瀵嗗寵宸茬粡杩囨湡,璇烽噸鏂扮櫥褰� string msg = Language.StringByID(R.MyInternationalizationString.uTokenIsOldAndLoginAgain); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); - HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); + UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); }); return; } @@ -85,9 +86,10 @@ { //姝ゅ笎鍙峰凡鍦ㄥ埆澶勭櫥褰�,鎮ㄨ杩笅绾� string msg = Language.StringByID(R.MyInternationalizationString.uHadBeenLoginAndOffLine); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); - HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); + UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); }); return; } @@ -97,9 +99,10 @@ { //鎮ㄥ綋鍓嶇殑IP鍙婄鍙e湪浜戠涓嶅瓨鍦�,璇烽噸鏂扮櫥褰�! string msg = Language.StringByID(R.MyInternationalizationString.uYouIpAndPortNoRecord); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); - HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); + UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); }); return; } @@ -109,9 +112,10 @@ { //鍒嗕韩浣忓畢宸叉洿鏀癸紝璇疯仈绯荤鐞嗗憳锛� string msg = Language.StringByID(R.MyInternationalizationString.uShardResidenceHadDeletePleaseTakeToAdmin); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); - HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); + UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); }); return; } @@ -121,13 +125,14 @@ { //鎮ㄧ殑鏉冮檺宸茬粡鍙樻洿,璇烽噸鏂扮櫥闄� string msg = Language.StringByID(R.MyInternationalizationString.uYouAccessHadChangedPleaseTakeToAdmin); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); - HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); + UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); }); return; } - else if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 3) + else if (UserCenterResourse.UserInfo.AuthorityNo == 3) { if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted" || topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/DeletedShareData") @@ -136,9 +141,10 @@ { //鍒嗕韩鏁版嵁宸茬粡鍙樻洿,璇烽噸鏂扮櫥闄� string msg = Language.StringByID(R.MyInternationalizationString.uShardDataIsChangedPleaseLoginAgain); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); - HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); + UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); }); return; } @@ -245,8 +251,15 @@ return; } + var tempList = Common.LocalDevice.Current.GetDevicesByMac(report.DeviceAddr, false); + var res = Common.LocalDevice.Current.GetMyDeviceEnumInfo(tempList); + if (res.ConcreteType == Common.DeviceConcreteType.Airer) + { + //鏅捐。鏋剁壒娈婂鐞嗭紝鏈湴鍙瓨浜嗙鐐�1锛屽叾浣�2锝�5绔偣閮戒笉瀛� + deviceEpoint = 1; + } //澶勭悊缃戝叧涓婃姤鐨勬暟鎹�,鐒跺悗鍙樻洿鏈湴缂撳瓨 - var locadevice = HdlDeviceCommonLogic.Current.GetDevice(deviceAddr, deviceEpoint); + var locadevice = Common.LocalDevice.Current.GetDevice(deviceAddr, deviceEpoint); if (locadevice != null) { //鏈夊弽棣�,杩欎釜璁惧鑲畾鏄湪绾跨殑 @@ -254,15 +267,98 @@ locadevice.LastDateTime = DateTime.Now; #region 鈻� 寮�鍏冲姛鑳� - //寮�鍏冲姛鑳� - if (report.DeviceStatusReport.CluterID == 6) + //鏅捐。鏋跺洖璺�2锛�3锛�4锛�5閮芥槸CluterID鏄�6 ,浣嗘槸鍔熻兘涓嶆槸寮�鍏� + if (locadevice.Type == DeviceType.Airer) { - if (locadevice is LightBase) + if (report.DeviceStatusReport.CluterID == 6) { - locadevice.DeviceStatusReport = report.DeviceStatusReport; - ((LightBase)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; - //宸茬粡鎺ユ敹鍒扮姸鎬� - locadevice.HadReadDeviceStatu = true; + foreach (var attData in report.DeviceStatusReport.AttriBute) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + if (attData.AttributeId == 0) + { + //娉ㄦ剰鏅捐。鏋跺洖璺笂鎶ラ兘绔偣閮芥槸琚浛鎹负鍥炶矾1锛屾墍浠ヨ繖閲岀敤涓婃姤閮藉洖璺� + switch (report.DeviceEpoint) + { + //鐓ф槑 + case 2: + ((Airer)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; + break; + //椋庡共 + case 3: + ((Airer)locadevice).WindOnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; + break; + //鐑樺共 + case 4: + ((Airer)locadevice).DryOnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; + break; + //娑堟瘨 + case 5: + ((Airer)locadevice).DisinfectOnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; + break; + } + } + + //鏅捐。鏋讹紙椋庡共/鐑樺共/娑堟瘨锛夎缃殑榛樿鏃堕棿 + // 娉ㄦ剰锛岀涓�闃舵鏃堕棿璁惧涓嶆敮鎸佽�屾殏鍋滐紝娌℃湁澶勭悊鍓╀綑澶氬皯鏃堕棿瑙﹀彂锛岀洿鎺ヤ笂鎶ュ洖澶嶄竴涓睘鎬D鐨勬儏鍐� + //if (attData.AttributeId == 16385) + //{ + // //娉ㄦ剰鏅捐。鏋跺洖璺笂鎶ラ兘绔偣閮芥槸琚浛鎹负鍥炶矾1锛屾墍浠ヨ繖閲岀敤涓婃姤閮藉洖璺� + // switch (report.DeviceEpoint) + // { + // //椋庡共 + // case 3: + // ((Airer)locadevice).WindTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; + // break; + // //鐑樺共 + // case 4: + // ((Airer)locadevice).DryTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; + // break; + // //娑堟瘨 + // case 5: + // ((Airer)locadevice).DisinfectTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; + // break; + // } + //} + //鏅捐。鏋讹紙椋庡共/鐑樺共/娑堟瘨锛夎缃殑鍓╀綑澶氬皯鏃堕棿瑙﹀彂 + // 娉ㄦ剰锛岀涓�闃舵鏃堕棿璁惧涓嶆敮鎸佽�屾殏鍋滐紝娌℃湁澶勭悊鍓╀綑澶氬皯鏃堕棿瑙﹀彂锛岀洿鎺ヤ笂鎶ュ洖澶嶄竴涓睘鎬D鐨勬儏鍐� + //if (attData.AttributeId == 16386) + //{ + // //娉ㄦ剰鏅捐。鏋跺洖璺笂鎶ラ兘绔偣閮芥槸琚浛鎹负鍥炶矾1锛屾墍浠ヨ繖閲岀敤涓婃姤閮藉洖璺� + // switch (report.DeviceEpoint) + // { + // //椋庡共 + // case 3: + // ((Airer)locadevice).WindRemainTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; + // break; + // //鐑樺共 + // case 4: + // ((Airer)locadevice).DryRemainTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; + // break; + // //娑堟瘨 + // case 5: + // ((Airer)locadevice).DisinfectRemainTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; + // break; + // } + //} + + //宸茬粡鎺ユ敹鍒扮姸鎬� + locadevice.HadReadDeviceStatu = true; + } + } + } + else + { + //寮�鍏冲姛鑳� + if (report.DeviceStatusReport.CluterID == 6) + { + if (locadevice is LightBase) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + ((LightBase)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; + //宸茬粡鎺ユ敹鍒扮姸鎬� + locadevice.HadReadDeviceStatu = true; + } } } #endregion @@ -298,7 +394,7 @@ else if (report.DeviceStatusReport.CluterID == 1282) { //mini澶滅伅 - if (HdlDeviceCommonLogic.Current.IsMiniLight(locadevice) == true) + if (Common.LocalDevice.Current.IsMiniLight(locadevice) == true) { foreach (var attData in report.DeviceStatusReport.AttriBute) { @@ -405,7 +501,7 @@ foreach (var attData in report.DeviceStatusReport.AttriBute) { //鍖哄垎鏄┖璋冭繕鏄柊椋� - var device = HdlDeviceCommonLogic.Current.GetDevice(report.DeviceAddr, report.DeviceEpoint); + var device = Shared.Common.LocalDevice.Current.GetDevice(report.DeviceAddr, report.DeviceEpoint); if (device.Type == DeviceType.FreshAir) { @@ -656,7 +752,7 @@ else if (report.DeviceStatusReport.CluterID == 0) { - var listLocalDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr, false); + var listLocalDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr, false); //灞炴�ч兘鏄竴鏍风殑 foreach (var myDevice in listLocalDevice) { @@ -669,7 +765,7 @@ { if (data.AttriButeDataHex.Length > 2) { - var value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); + var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); if (myDevice.ManufacturerName != value) { //灞炴�у彉鏇翠簡 @@ -683,7 +779,7 @@ { if (data.AttriButeDataHex.Length > 2) { - var value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); + var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); if (myDevice.ModelIdentifier != value) { //灞炴�у彉鏇翠簡 @@ -697,7 +793,7 @@ { if (data.AttriButeDataHex.Length > 2) { - var value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); + var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); if (myDevice.ProductionDate != value) { //灞炴�у彉鏇翠簡 @@ -717,7 +813,7 @@ if (data.AttriButeDataHex.Length > 2) { string value; - if (HdlDeviceCommonLogic.Current.IsHdlDevice(myDevice) == false) + if (Common.LocalDevice.Current.IsHdlDevice(myDevice) == false) { //绗笁鏂硅澶� value = data.AttriButeDataHex.Substring(2); @@ -725,7 +821,7 @@ else { //娌充笢璁惧 - value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); + value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); } if (myDevice.SerialNumber != value) { @@ -750,7 +846,7 @@ } else if (deviceEpoint == 200) { - var localOta = HdlDeviceCommonLogic.Current.GetOTADevice(deviceAddr); + var localOta = Common.LocalDevice.Current.GetOTADevice(deviceAddr); if (localOta != null) { #region 鈻� 鍥轰欢鐗堟湰 @@ -804,7 +900,7 @@ } //澶勭悊缃戝叧涓婃姤鐨勬暟鎹�,鐒跺悗鍙樻洿鏈湴缂撳瓨 - var locadevice = HdlDeviceCommonLogic.Current.GetDevice(ias.DeviceAddr, ias.DeviceEpoint); + var locadevice = Common.LocalDevice.Current.GetDevice(ias.DeviceAddr, ias.DeviceEpoint); if (locadevice != null) { ((IASZone)locadevice).iASInfo = ias.iASInfo; @@ -830,9 +926,9 @@ /// <param name="receiveData"></param> private void DoorLockDeviceReportPush(JObject receiveData) { - if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1) + if (UserCenterResourse.UserInfo.AuthorityNo == 1) { - var device = HdlDeviceCommonLogic.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint")); + var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint")); if (device.Type != DeviceType.DoorLock) { //瀹冧笉鏄棬閿� @@ -878,7 +974,7 @@ tempDevice.IsOnline = Convert.ToInt32(receiveData["Data"]["IsOnline"].ToString()); //澶勭悊缃戝叧涓婃姤鐨勬暟鎹�,鐒跺悗鍙樻洿鏈湴缂撳瓨 - var locadevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(tempDevice.DeviceAddr); + var locadevice = Common.LocalDevice.Current.GetDevicesByMac(tempDevice.DeviceAddr); for (int i = 0; i < locadevice.Count; i++) { bool onlineChanged = locadevice[i].IsOnline != tempDevice.IsOnline; @@ -937,11 +1033,12 @@ //淇濆瓨鎶ヨ淇℃伅鐒跺悗鎺ㄩ�佸埌鐣岄潰涓� HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(garrison); - - //鎺ㄩ�� - var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm") as UserCenter.Safety.SafetyManagementMainForm; - form?.GarrisonModePush(garrison); - + if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) + { + //鎺ㄩ�� + var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"]; + form?.GarrisonModePush(garrison); + } //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁� this.ShowHadNewMessageAppeal(); } @@ -962,11 +1059,12 @@ { //淇濆瓨鎶ヨ淇℃伅鐒跺悗鎺ㄩ�佸埌鐣岄潰涓� HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(GarrisonMode.RemoveGarrison); - - //鎺ㄩ�� - var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm") as UserCenter.Safety.SafetyManagementMainForm; - form?.GarrisonModePush(GarrisonMode.RemoveGarrison); - + if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) + { + //鎺ㄩ�� + var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"]; + form?.GarrisonModePush(GarrisonMode.RemoveGarrison); + } //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁� this.ShowHadNewMessageAppeal(); } @@ -1008,11 +1106,12 @@ //淇濆瓨鎶ヨ淇℃伅鐒跺悗鎺ㄩ�佸埌鐣岄潰涓� HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(garrison, appendText); - - //鎺ㄩ�� - var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm") as UserCenter.Safety.SafetyManagementMainForm; - form?.GarrisonModePush(garrison); - + if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) + { + //鎺ㄩ�� + var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"]; + form?.GarrisonModePush(garrison); + } //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁� this.ShowHadNewMessageAppeal(); } @@ -1050,7 +1149,7 @@ this.ShowHadNewMessageAppeal(); // 閫昏緫鎵ц甯稿紑妯″紡澶辨晥鐨勬儏鍐� - if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1) + if (UserCenterResourse.UserInfo.AuthorityNo == 1) { //鑷姩鍖栨墽琛� 甯稿紑鍏抽棴 var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString()); @@ -1059,7 +1158,7 @@ if (data.ActionData.Actiontype == 8 && data.ActionData.PassDataString == "055704010113") { var deviceAddr = data.ActionData.MacStr; - var device = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr, false); + var device = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr, false); if (device.Count > 0 && device[0].Type != DeviceType.DoorLock) { return; @@ -1235,7 +1334,7 @@ catch (Exception ex) { //Log鍑哄姏 - string msg = "鎺ㄩ�侀敊璇�! 褰撳墠婵�娲荤殑鐣岄潰[" + HdlFormLogic.Current.NowActionFormID + "]"; + string msg = "鎺ㄩ�侀敊璇�! 褰撳墠婵�娲荤殑鐣岄潰[" + UserCenterResourse.NowActionFormID + "]"; HdlLogLogic.Current.WriteLog(ex, msg); } } @@ -1258,16 +1357,16 @@ private void ShowHadNewMessageAppeal() { //鏈夋柊娑堟伅(鐗规晥杩樺湪鏃�,涓嶉渶瑕佸啀澶勭悊) - if (HdlControlResourse.HadNewMessage == false) + if (ControlCommonResourse.HadNewMessage == false) { HdlThreadLogic.Current.RunMain(() => { - for (int i = 0; i < HdlControlResourse.listMessageManaContr.Count; i++) + for (int i = 0; i < ControlCommonResourse.listMessageManaContr.Count; i++) { //鏄剧ず瑙掓爣鐗规晥 - HdlControlResourse.listMessageManaContr[i].IsSelected = true; + ControlCommonResourse.listMessageManaContr[i].IsSelected = true; } - HdlControlResourse.HadNewMessage = true; + ControlCommonResourse.HadNewMessage = true; }); } } -- Gitblit v1.8.0