From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001 From: lss <316519258@qq.com> Date: 星期五, 12 六月 2020 09:22:04 +0800 Subject: [PATCH] 2020.06.12 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs | 159 +++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 119 insertions(+), 40 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs index 9f5fe85..afe0b4c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs @@ -56,18 +56,7 @@ /// 瀹夐槻鏁版嵁缂撳瓨 /// </summary> private Dictionary<int, SafeguardZoneInfo> dicAllZoneInfo = new Dictionary<int, SafeguardZoneInfo>(); - /// <summary> - /// 瀹夐槻涓婃姤淇℃伅 - /// </summary> - public List<SafeguardAlarmInfo> listAlarmInfo = new List<SafeguardAlarmInfo>(); - /// <summary> - /// 涓婁竴娆″畨闃蹭笂鎶ヤ俊鎭繚瀛樼殑鏂囦欢鍚嶅瓧(鑰冭檻鍒扮敤鎴锋湁鍙兘24鐐圭殑鏃跺�欙紝涓嶉��鍑篈PP) - /// </summary> - private string oldDeviceAlarmFile = string.Empty; - /// <summary> - /// 閿� - /// </summary> - private object objLock = new object(); + #endregion #region 鈻� 鍒锋柊瀹夐槻___________________________ @@ -88,7 +77,7 @@ this.ShowTipMsg(msg); return false; } - var mainWayId = HdlGatewayLogic.Current.GetGatewayId(mainGateway); + var mainWayId = mainGateway.GwId; //涓婚鏁板浐瀹�5+3+1 int topicCount = 9; @@ -115,7 +104,7 @@ { var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); - var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.Safeguard.ErrorResponData>(jobject["Data"].ToString()); + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); if (temp != null) { string msg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error); @@ -188,7 +177,7 @@ try { var jObject = new Newtonsoft.Json.Linq.JObject() { { "Cluster_ID", 0 }, { "Command", 4036 } }; - await mainGateway.Send("Security/GetSecurityInfo", jObject.ToString()); + mainGateway.Send("Security/GetSecurityInfo", jObject.ToString()); } catch { } @@ -245,7 +234,7 @@ //澶勭悊璁惧 foreach (var data2 in allData.DeviceList) { - string mainKey = data2.MacAddr + data2.Epoint; + string mainKey = LocalDevice.Current.GetDeviceMainKeys(data2.MacAddr, data2.Epoint); //浼犳劅鍣ㄨ澶囦俊鎭� var Deviceinfo = new Safeguard.ZoneDeviceListData(); Deviceinfo.IsBypass = data2.IsBypass; @@ -306,7 +295,7 @@ if (data.Type == 0) { //鏈湴鏄惁鏈夎繖涓澶� - string mainKey = data.DeviceAddr + data.Epoint; + string mainKey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint); //鎶ヨ淇℃伅 zoneInfo.dicAlarmDevice[mainKey] = data; CommonDevice device = LocalDevice.Current.GetDevice(mainKey); @@ -570,7 +559,7 @@ //涓�鎵硅澶囬噷闈紝鎴愬姛娣诲姞鐨� if (data.Status == 0) { - listSuccess.Add(data.MacAddr + data.Epoint); + listSuccess.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint)); } else if (data.Status == 1) { @@ -756,7 +745,7 @@ { if (data.Status == 0) { - listKeys.Add(data.MacAddr + data.Epoint); + listKeys.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint)); } } @@ -1165,10 +1154,10 @@ } else if (data.Type == "1") { - var scene = Common.SceneRoomUI.AllSceneRoomUIList.Find((obj) => obj.sceneUI.Id == data.ScenesId); + var scene = HdlSceneLogic.Current.GetSceneUIBySceneId(data.ScenesId); if (scene != null) { - string msg = scene.sceneUI.Name + "\r\n"; + string msg = scene.Name + "\r\n"; //鐩爣鍦烘櫙涓嶅瓨鍦� msg += Language.StringByID(R.MyInternationalizationString.uTargetSceneIsNotExsit); this.ShowTipMsg(msg); @@ -1419,6 +1408,13 @@ { return GarrisonMode.None; } + //鍒ゆ柇鏈夋病鏈夊叾浠栭�昏緫鍘讳慨鏀逛簡甯冮槻妯″紡 + //鎵�浠ュ啀娆¤幏鍙栨ā寮� + var safetyMode = await this.GetSafetyMode(); + if (safetyMode != null) + { + return GarrisonMode.None; + } //鍙傛暟 var Pra = new Safeguard.EnableModeData(); @@ -1504,10 +1500,6 @@ this.ShowErrorMsg(msg); return GarrisonMode.RemoveGarrison; } - - //淇濆瓨甯冮槻鎿嶄綔淇℃伅鍒版湰鍦� - HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(garrison); - return garrison; } @@ -1608,13 +1600,6 @@ this.ShowErrorMsg(msg); return -1; } - - if (garrison == GarrisonMode.RemoveGarrison) - { - //淇濆瓨甯冮槻鎿嶄綔淇℃伅鍒版湰鍦� - HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(garrison); - } - return 1; } @@ -1978,14 +1963,14 @@ #endregion - #region 鈻� 鎶ヨ鐩爣鐘舵�佺殑缈昏瘧鏂囨湰_____________ + #region 鈻� 鎵ц鐩爣鐘舵�佺殑缈昏瘧鏂囨湰_____________ /// <summary> - /// 鑾峰彇鐏厜绫诲瀷鐨勬姤璀︾洰鏍囩殑鐘舵�佹枃鏈� + /// 鑾峰彇鎵ц鐩爣鐨勭姸鎬佹枃鏈� /// </summary> /// <param name="listTaskInfo">鍔ㄤ綔瀵硅薄,鍙互涓虹┖</param> /// <returns></returns> - public string GetLightAlarmStatuText(List<Safeguard.TaskListInfo> listTaskInfo) + public string GetAdjustTargetStatuText(List<Safeguard.TaskListInfo> listTaskInfo) { if (listTaskInfo == null || listTaskInfo.Count == 0) { @@ -1994,13 +1979,22 @@ } //瑕佽�冭檻瀹冪殑鎺掑垪椤哄簭(鍙互鎸夐渶姹傚彉鏇寸紪鍙�) Dictionary<int, string> dicSort = new Dictionary<int, string>(); + //鏈�澶х紪鍙� + int MaxNo = 4; //寮�鍏崇殑浣嶇疆缂栧彿 int ControlNo = 0; //鐧惧垎姣旂殑浣嶇疆缂栧彿 int persentNo = 1; + //绌鸿皟娓╁害鐨勪綅缃紪鍙� + int temparetureNo = 2; + //绌鸿皟妯″紡鐨勪綅缃紪鍙� + int modelNo = 3; + //绌鸿皟椋庨�熺殑浣嶇疆缂栧彿 + int windNo = 4; foreach (var info in listTaskInfo) { + #region 鈻� 寮�鍏虫帶鍒禵___ //寮�鍏虫帶鍒� if (info.TaskType == 1) { @@ -2015,11 +2009,25 @@ dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose); } } + #endregion + + #region 鈻� 浜害璋冭妭____ //浜害璋冭妭 else if (info.TaskType == 3) { - dicSort[persentNo] = info.Data1 + "%"; + if (info.Data1 == 0) + { + //鍏� + dicSort[persentNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose); + } + else + { + dicSort[persentNo] = $"{(int)(info.Data1 * 1.0 / 254 * 100)}%"; + } } + #endregion + + #region 鈻� 绐楀笜璁惧____ //绐楀笜璁惧(瀹冪殑寮�鍏冲拰寮�鍏虫帶鍒舵槸鍙嶈繃鏉ョ殑) else if (info.TaskType == 6) { @@ -2039,13 +2047,84 @@ dicSort[persentNo] = info.Data2 + "%"; } } + #endregion + + #region 鈻� 绌鸿皟璁惧____ + //绌鸿皟璁惧 + else if (info.TaskType == 5) + { + if (info.Data1 == 3) + { + if (info.Data2 == 0) + { + return Language.StringByID(R.MyInternationalizationString.uSimpleClose); + } + else if (info.Data2 == 1) + { + //鑷姩 + dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Auto); + } + else if (info.Data2 == 3) + { + //鍒跺喎 + dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Cool); + } + else if (info.Data2 == 4) + { + //鍒剁儹 + dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Heat); + } + else if (info.Data2 == 7) + { + //閫侀 + dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly); + } + else if (info.Data2 == 8) + { + //闄ゆ箍 + dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Dry); + } + } + else if (info.Data1 == 4 || info.Data1 == 5|| info.Data1 == 7) + { + //娓╁害 + dicSort[temparetureNo] = $"{ info.Data2 / 100}鈩�"; + } + else if (info.Data1 == 6) + { + if (info.Data2 == 1) + { + //浣庨 + dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Low); + } + else if (info.Data2 == 2) + { + //涓 + dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Middle); + } + else if (info.Data2 == 3) + { + //楂橀 + dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Height); + } + } + } + #endregion + } + //濡傛灉寮�鍏冲拰鐧惧垎姣斾竴璧峰瓨鍦ㄧ殑璇�,鍒欎笉鏄剧ず寮�鍏虫枃瀛� + if (dicSort.ContainsKey(ControlNo) == true && dicSort.ContainsKey(persentNo) == true) + { + dicSort.Remove(ControlNo); } //鎷兼帴鏂囨湰 string txtvalue = string.Empty; - for (int i = 0; i < dicSort.Count; i++) + for (int i = 0; i <= MaxNo; i++) { - txtvalue += dicSort[i] + " "; + if (dicSort.ContainsKey(i) == true) + { + txtvalue += dicSort[i] + " "; + } } return txtvalue.Trim(); @@ -2075,7 +2154,7 @@ bool success = false; //瓒呮椂鏃堕棿 int TimeOut = 0; - string checkTopic = HdlGatewayLogic.Current.GetGatewayId(realWay) + "/Security/AdminSetNewPassword_Respon"; + string checkTopic = realWay.GwId + "/Security/AdminSetNewPassword_Respon"; Action<string, string> getResultAction = (topic, message) => { try @@ -2098,7 +2177,7 @@ var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 4033 } }; var data = new Newtonsoft.Json.Linq.JObject { { "HomeId", Common.Config.Instance.HomeId }, { "Password", password } }; jObject.Add("Data", data); - await realWay.Send("Security/AdminSetNewPassword", jObject.ToString()); + realWay.Send("Security/AdminSetNewPassword", jObject.ToString()); } catch { -- Gitblit v1.8.0