From c7df85937f73fb347ee0b19e9c052d2d00a6df6c Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 18 九月 2020 13:58:19 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs |   57 +++++++++++++++++++++++++--------------------------------
 1 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
index 4a49fa5..1758563 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
@@ -77,7 +77,7 @@
                 this.ShowTipMsg(msg);
                 return false;
             }
-            var mainWayId = HdlGatewayLogic.Current.GetGatewayId(mainGateway);
+            var mainWayId = mainGateway.GwId;
 
             //涓婚鏁板浐瀹�5+3+1
             int topicCount = 9;
@@ -104,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);
@@ -184,9 +184,11 @@
             var dateTime = DateTime.Now;
             while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
             {
-                if (topicCount <= 0 || error == true)
+                //if (error == true) { break; }
+                if (topicCount <= 0)
                 {
                     //9娆′富棰樺叏閮ㄦ帴鏀跺畬鎴�
+                    await Task.Delay(1000);
                     break;
                 }
                 await Task.Delay(50);
@@ -230,6 +232,9 @@
             SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[allData.ZoneId];
             zoneInfo.ZoneId = allData.ZoneId;
             zoneInfo.ZoneName = allData.ZoneName;
+
+            //淇℃伅鎺ㄩ��
+            zoneInfo.InformationPush = allData.IsDisablePushMessage;
 
             //澶勭悊璁惧
             foreach (var data2 in allData.DeviceList)
@@ -285,9 +290,6 @@
 
             zoneInfo.dicAlarmDevice.Clear();
             zoneInfo.dicScenes.Clear();
-
-            //淇℃伅鎺ㄩ��
-            zoneInfo.InformationPush = resData.IsDisablePushMessage;
 
             foreach (var data in resData.Actions)
             {
@@ -455,7 +457,7 @@
             foreach (var device in listdevice)
             {
                 int MomentStatus = 1;
-                int TriggerZoneStatus = 1;
+                int TriggerZoneStatus = 3;
                 //鑾峰彇瀹夐槻浼犳劅鍣ㄧ殑鐬棿鐘舵�佽瀹氬��
                 this.GetSafeguardSensorMomentStatus(device, ref MomentStatus, ref TriggerZoneStatus);
 
@@ -594,43 +596,43 @@
             if (device.IasDeviceType == 13)
             {
                 MomentStatus = 1;
-                TriggerZoneStatus = 1;
+                TriggerZoneStatus = 3;
             }
             //鐑熼浘浼犳劅鍣�
             else if (device.IasDeviceType == 40)
             {
                 MomentStatus = 1;
-                TriggerZoneStatus = 1;
+                TriggerZoneStatus = 3;
             }
             //姘翠镜浼犳劅鍣�
             else if (device.IasDeviceType == 42)
             {
                 MomentStatus = 1;
-                TriggerZoneStatus = 1;
+                TriggerZoneStatus = 3;
             }
             //鐕冩皵浼犳劅鍣�
             else if (device.IasDeviceType == 43)
             {
                 MomentStatus = 1;
-                TriggerZoneStatus = 1;
+                TriggerZoneStatus = 3;
             }
             //绱ф�ユ寜閽�
             else if (device.IasDeviceType == 44)
             {
                 MomentStatus = 1;
-                TriggerZoneStatus = 1;
+                TriggerZoneStatus = 3;
             }
             //閽ュ寵鎵�
             else if (device.IasDeviceType == 277)
             {
                 MomentStatus = 1;
-                TriggerZoneStatus = 1;
+                TriggerZoneStatus = 3;
             }
             //闂ㄧ獥浼犳劅鍣�
             else if (device.IasDeviceType == 21 || device.IasDeviceType == 22)
             {
                 MomentStatus = 0;
-                TriggerZoneStatus = 1;
+                TriggerZoneStatus = 3;
             }
             //濡傛灉鏄櫄鎷熻澶囷紝鍒欒繖涓笢瑗挎案鎭掍负0
             if (device.DriveCode > 0)
@@ -1154,10 +1156,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);
@@ -1366,7 +1368,7 @@
 
             if (this.UserPassword == null)
             {
-                var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword);
+                var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.SafeguardUserPassword);
                 if (data != null)
                 {
                     this.UserPassword = System.Text.Encoding.UTF8.GetString(data);
@@ -1384,7 +1386,7 @@
                 if (result != GarrisonMode.None && result != GarrisonMode.RemoveGarrison)
                 {
                     //淇濆瓨鍔犲瘑鐨勫瘑鐮佸埌鏈湴
-                    Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
+                    HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
                 }
                 return result;
             }
@@ -1473,7 +1475,7 @@
                     if (result2 != GarrisonMode.None && result2 != GarrisonMode.RemoveGarrison)
                     {
                         //淇濆瓨鍔犲瘑瀵嗙爜鍒版湰鍦�
-                        Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
+                        HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
                     }
                     return result2;
                 }
@@ -1588,7 +1590,7 @@
                     if (result2 != -1)
                     {
                         //淇濆瓨鍒板姞瀵嗗瘑鐮佹湰鍦�
-                        Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
+                        HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
                     }
                     return result2;
                 }
@@ -1708,11 +1710,6 @@
             {
                 return false;
             }
-
-            if (zoneId > 3)
-            {
-                zoneId = 3;
-            }
             //鐘舵�佸彉鏇�
             var result = await Safeguard.DisablePushMessageAsync(zoneId, statu);
             if (result == null || result.disablePushMessageResponseData == null || result.disablePushMessageResponseData.Result == 1)
@@ -1742,10 +1739,6 @@
         /// <returns>0:鎺ㄩ��  1:涓嶆帹閫�</returns>
         public int GetGarrisonInformationPushStatu(int zoneId)
         {
-            if (zoneId > 3)
-            {
-                zoneId = 3;
-            }
             if (this.dicAllZoneInfo.ContainsKey(zoneId) == false)
             {
                 return 1;
@@ -2085,7 +2078,7 @@
                             dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Dry);
                         }
                     }
-                    else if (info.Data1 == 4 || info.Data1 == 5)
+                    else if (info.Data1 == 4 || info.Data1 == 5|| info.Data1 == 7)
                     {
                         //娓╁害
                         dicSort[temparetureNo] = $"{ info.Data2 / 100}鈩�";
@@ -2154,7 +2147,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
@@ -2340,7 +2333,7 @@
             /// </summary>
             public string ZoneName;
             /// <summary>
-            /// 淇℃伅鎺ㄩ�� 0:鎺ㄩ��  1:涓嶆帹閫� (鍙湁闃插尯ID:1,2,3鎵嶄細鏈夈��4,5鐨勯兘褰掍负3,鍥犱负瀹冩槸浠ラ槻鍖烘ā寮廔D(ActionType)涓哄崟浣嶇殑)
+            /// 淇℃伅鎺ㄩ�� 0:鎺ㄩ��  1:涓嶆帹閫� 
             /// </summary>
             public int InformationPush = 1;
             /// <summary>

--
Gitblit v1.8.0