From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
old mode 100755
new mode 100644
index 9290671..20b9eea
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
@@ -462,7 +462,13 @@
                 //搴曠嚎
                 btnRow.AddBottomLine();
 
-                var doorLock = (ZigBee.Device.DoorLock)listNewDevice[0];
+                var doorLock = (ZigBee.Device.DoorLock)listNewDevice[0];
+                ///鍊间负绌哄啀鍘昏鍙栨湰鍦�
+                if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword))
+                {
+                    ///璇诲彇鏈湴杩滅▼寮�閿佸瘑鐮侊紝鐪嬬湅涔嬪墠鏄惁閰嶇疆杩�
+                    doorLock.RemoteUnlockPassword = ReadLocalPassword();
+                }
                 if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword) == false)
                 {
                     btnswitch.IsSelected = true;
@@ -518,7 +524,24 @@
                  };
             }
         }
-
+        /// <summary>
+        /// 淇濆瓨杩滅▼闂ㄩ攣瀵嗙爜
+        /// </summary>
+        /// <param name="password">瀵嗙爜</param>
+        public void SaveLocalPassword(string password) {
+            var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(password));
+            IO.FileUtils.WriteFileByBytes(Config.Instance.HomeId + "_" + Config.Instance.Guid, bytes);
+        }
+        /// <summary>
+        /// 璇诲彇杩滅▼闂ㄩ攣瀵嗙爜
+        /// </summary>
+        /// <returns></returns>
+        public string ReadLocalPassword()
+        {
+            var str = System.Text.Encoding.UTF8.GetString(IO.FileUtils.ReadFile(Config.Instance.HomeId + "_" + Config.Instance.Guid));
+            //Newtonsoft.Json.JsonConvert.DeserializeObject<瀵瑰儚>(str);
+            return str;
+        }
         #endregion
 
         #region 鈻� 闂ㄩ攣鏃堕棿(闂ㄩ攣)_____________________
@@ -1201,6 +1224,7 @@
                         if (string.IsNullOrEmpty(bindName))
                         {
                             btnHumidityStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
+                            bindHumidityDev = null;
                         }
                         else
                         {
@@ -1252,6 +1276,7 @@
                         if (string.IsNullOrEmpty(bindName))
                         {
                             btnTemperatureStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
+                            bindTemperatureDev = null;
                         }
                         else
                         {
@@ -1335,6 +1360,8 @@
                     {
                         continue;
                     }
+                    //鑾峰彇璁惧绫诲瀷鐨�
+                    var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
                     if (device.Type == DeviceType.TemperatureSensor)
                     {
                         var bD = device as TemperatureSensor;
@@ -1348,12 +1375,40 @@
                             bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                             bindHumidityDev = device;
                         }
+
+                        //绌烘皵璐ㄩ噺浼犳劅鍣�
+                        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                        {
+                            if (bDev.BindCluster == 1026)
+                            {
+                                bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                                bindTemperatureDev = device;
+                            }
+                            if (bDev.BindCluster == 1029)
+                            {
+                                bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                                bindHumidityDev = device;
+                            }
+                        }
                     }
                     if (device.Type == DeviceType.FreshAirHumiditySensor)
                     {
                         bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                         bindHumidityDev = device;
                     }
+                    else if (device.Type == DeviceType.PMSensor)
+                    {
+                        if (bDev.BindCluster == 1026)
+                        {
+                            bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                            bindTemperatureDev = device;
+                        }
+                        if (bDev.BindCluster == 1029)
+                        {
+                            bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                            bindHumidityDev = device;
+                        }
+                    }
                 }
                 result = true;
             }

--
Gitblit v1.8.0