From 0087dd7734e71dfcfd1bb54db394ad7855021ffd Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 24 七月 2020 10:18:08 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Common/Device.cs |   93 ++++++++++++++++++++++++++++++----------------
 1 files changed, 60 insertions(+), 33 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index b94b3e0..8b92a87 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -267,22 +267,8 @@
                     listDriveDevice.Add(device);
                 }
             }
-            if (listDriveDevice.Count > 0)
-            {
-                //濡傛灉铏氭嫙璁惧杩樻病鏈夊悕瀛楃殑璇�
-                HdlThreadLogic.Current.RunThread(() =>
-                {
-                    //濡傛灉涓嶈繖鏍锋斁鍦ㄤ竴涓嚎绋嬮噷,鏈夊彲鑳藉Dictionary浜х敓褰卞搷
-                    foreach (var myDevice in listDriveDevice)
-                    {
-                        //鏍规嵁璁惧绫诲瀷鑾峰彇鍚嶇О
-                        var dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false);
-                        //鍦ㄧ鐐瑰悕瀛楃殑鍚庨潰闄勫姞銆愬洖璺�戝瓧鏍�
-                        dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
-                        this.ReName(myDevice, dName, ShowErrorMode.NO);
-                    }
-                });
-            }
+            //璁剧疆铏氭嫙璁惧鐨勯粯璁ゅ悕瀛�
+            this.SetDriveDeviceDefultName(listDriveDevice);
 
             //鍙湁瀹屽叏鑾峰彇鐨勬椂鍊�,鎵嶄細鍘诲鐞嗗垹闄ょ殑闂
             if (statu != 1)
@@ -532,6 +518,42 @@
                 }
             }
             return true;
+        }
+
+        /// <summary>
+        /// 璁剧疆铏氭嫙璁惧鐨勯粯璁ゅ悕瀛�
+        /// </summary>
+        /// <param name="listDriveDevice">铏氭嫙璁惧鍒楄〃</param>
+        private void SetDriveDeviceDefultName(List<CommonDevice> listDriveDevice)
+        {
+            if (listDriveDevice.Count == 0)
+            {
+                return;
+            }
+            //濡傛灉铏氭嫙璁惧杩樻病鏈夊悕瀛楃殑璇�
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //濡傛灉涓嶈繖鏍锋斁鍦ㄤ竴涓嚎绋嬮噷,鏈夊彲鑳藉Dictionary浜х敓褰卞搷
+                foreach (var myDevice in listDriveDevice)
+                {
+                    string dName = string.Empty;
+                    if (this.IsMiniLight(myDevice) == true)
+                    {
+                        //Mini澶滅伅
+                        dName = Language.StringByID(R.MyInternationalizationString.uMiniNightLight);
+                    }
+                    else
+                    {
+                        //鏍规嵁璁惧绫诲瀷鑾峰彇鍚嶇О
+                        dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false);
+                        //鍦ㄧ鐐瑰悕瀛楃殑鍚庨潰闄勫姞銆愬洖璺�戝瓧鏍�
+                        dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
+                    }
+                    this.ReName(myDevice, dName, ShowErrorMode.NO);
+
+                    System.Threading.Thread.Sleep(100);
+                }
+            });
         }
 
         ///<summary >
@@ -847,9 +869,9 @@
                 //闂ㄩ攣娌℃湁瀹氫綅鍔熻兘
                 return false;
             }
+            var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
             if (device.Type == DeviceType.IASZone)
             {
-                var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
                 if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_Pir)
                 {
                     //浼犳劅鍣ㄩ櫎浜哖ir閮芥病鏈夊畾浣嶅姛鑳�
@@ -860,6 +882,11 @@
                     //鐞冨瀷绉诲姩浼犳劅鍣ㄨ櫧鐒舵槸鐢垫睜璁惧,浣嗘槸瀹冩湁瀹氫綅鍔熻兘
                     return true;
                 }
+                return false;
+            }
+            //娓╂箍搴︿紶鎰熷櫒娌℃湁瀹氫綅鍔熻兘
+            if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_TemperatrueHumidity)
+            {
                 return false;
             }
 
@@ -1854,7 +1881,8 @@
                 info.ObjectTypeName = this.dicDeviceModelIdEnum["A418"].A绫诲瀷鍚嶅瓧;//璋冨厜妯″潡
             }
             else if (info.BeloneType == DeviceBeloneType.A浼犳劅鍣�
-                || device.Type == DeviceType.TemperatureSensor)
+                || device.Type == DeviceType.TemperatureSensor
+                || device.Type == DeviceType.FreshAirHumiditySensor)
             {
                 //浼犳劅鍣ㄥ悎骞�
                 info.ConcreteType = DeviceConcreteType.Sensor;
@@ -2051,14 +2079,14 @@
                     //璁剧疆浼犳劅鍣ㄥ叿浣撶殑绫诲瀷
                     info.BeloneType = DeviceBeloneType.A娓╂箍搴︿紶鎰熷櫒;
                     info.ConcreteText = this.dicDeviceModelIdEnum["A411"].A瀹樻柟鍚嶅瓧;
-                    info.ConcreteType = DeviceConcreteType.Sensor_TemperatureHumidity;
+                    info.ConcreteType = DeviceConcreteType.Sensor_TemperatrueHumidity;
                 }
                 else if (temperatrue == true && humidity == false)
                 {
                     //璁剧疆浼犳劅鍣ㄥ叿浣撶殑绫诲瀷
                     info.BeloneType = DeviceBeloneType.A娓╁害浼犳劅鍣�;
                     info.ConcreteText = this.dicDeviceModelIdEnum["A412"].A瀹樻柟鍚嶅瓧;
-                    info.ConcreteType = DeviceConcreteType.Sensor_Temperature;
+                    info.ConcreteType = DeviceConcreteType.Sensor_Temperatrue;
                 }
                 else if (temperatrue == false && humidity == true)
                 {
@@ -2707,15 +2735,14 @@
                                     listCheck.Add(mainkeys);
                                     //鍒锋柊涓�涓嬫湰鍦扮紦瀛�
                                     var localDevice = this.GetDevice(mainkeys);
-                                    if (localDevice != null)
+                                    var tempDevice = localDevice == null ? device : localDevice;
+
+                                    //鍒锋柊灞炴��
+                                    this.SetDeviceInfoToMain(tempDevice, device);
+                                    if (this.RefreshDeviceFunctionType(tempDevice, device, false) == true)
                                     {
-                                        //鍒锋柊灞炴��
-                                        this.SetDeviceInfoToMain(localDevice, device);
-                                        if (this.RefreshDeviceFunctionType(localDevice, device, false) == true)
-                                        {
-                                            //闇�瑕佸彂閫佸姛鑳界被鍨嬬粰缃戝叧
-                                            listFucDevice.Add(localDevice);
-                                        }
+                                        //闇�瑕佸彂閫佸姛鑳界被鍨嬬粰缃戝叧
+                                        listFucDevice.Add(tempDevice);
                                     }
                                 }
                             }
@@ -3371,6 +3398,10 @@
         /// PM2.5绌烘皵璐ㄩ噺浼犳劅鍣�
         /// </summary>
         Sensor_PMTwoPointFive = 1307,
+        /// <summary>
+        /// 娓╂箍搴︿紶鎰熷櫒
+        /// </summary>
+        Sensor_TemperatrueHumidity = 1308,
 
         /// <summary>
         /// 杩愬姩浼犳劅鍣�
@@ -3381,13 +3412,9 @@
         /// </summary>
         Sensor_Keyfob = -1307,
         /// <summary>
-        /// 娓╂箍搴︿紶鎰熷櫒
-        /// </summary>
-        Sensor_TemperatureHumidity = -1308,
-        /// <summary>
         /// 娓╁害浼犳劅鍣�
         /// </summary>
-        Sensor_Temperature = -1309,
+        Sensor_Temperatrue = -1309,
         /// <summary>
         /// 婀垮害浼犳劅鍣�
         /// </summary>

--
Gitblit v1.8.0