From 23420922845c9e77019a55c3b3e3271eb1ec261e Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 13 七月 2020 11:42:18 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Common/Device.cs |   86 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 71 insertions(+), 15 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index 9ba510c..1435f45 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -434,7 +434,7 @@
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
                 //淇敼璁惧鍚嶅瓧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
-                Phone.UserView.UserPage.Instance.RefreshForm = true;
+                Phone.UserView.UserPage.Instance.RefreshAllForm = true;
                 return true;
             }
 
@@ -458,7 +458,7 @@
                 }
             }
             //淇敼璁惧鍚嶅瓧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
-            Phone.UserView.UserPage.Instance.RefreshForm = true;
+            Phone.UserView.UserPage.Instance.RefreshAllForm = true;
             return true;
         }
 
@@ -719,7 +719,7 @@
         public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
         {
             //鍒犻櫎缂撳瓨璁惧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
-            Phone.UserView.UserPage.Instance.RefreshForm = true;
+            Phone.UserView.UserPage.Instance.RefreshAllForm = true;
 
             if (deleteRoom == true)
             {
@@ -796,6 +796,35 @@
 
         #endregion
 
+        #region 鈻� 鍚屾璁惧___________________________
+        /// <summary>
+        ///  鍚屾璁惧骞朵笖鍒锋柊缂撳瓨(鍚屾澶辫触鏃讹紝浼氭樉绀轰俊鎭�)
+        /// </summary>
+        /// <param name="litdevice">璁惧瀵硅薄(MAC鍦板潃蹇呴』瑕佺浉鍚�)</param>
+        public async Task<bool> SynchronizationDevice(List<CommonDevice> listdevice)
+        {
+            //铏氭嫙浣忓畢鐨勮瘽,涓嶉渶瑕佸垹闄ょ綉鍏崇殑璁惧
+            if (Config.Instance.Home.IsVirtually == false)
+            {
+                //鍚屾
+                var result = await listdevice[0].SyncMsgToBindSource(listdevice[0].DeviceAddr, listdevice[0].DeviceEpoint);
+                if (result == null || result.result != 0)
+                {
+                    //鍚屾鍒犻櫎澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.SynchronizationFailed);
+                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                    this.ShowErrorMsg(msg);
+                    return false;
+                }
+            }
+            return true;
+        }
+        #endregion
+
+
+
         #region 鈻� 娴嬭瘯璁惧___________________________
 
         /// <summary>
@@ -831,6 +860,11 @@
                     //浼犳劅鍣ㄩ櫎浜哖ir閮芥病鏈夊畾浣嶅姛鑳�
                     return true;
                 }
+                else if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_SphericalMotion)
+                {
+                    //鐞冨瀷绉诲姩浼犳劅鍣ㄨ櫧鐒舵槸鐢垫睜璁惧,浣嗘槸瀹冩湁瀹氫綅鍔熻兘
+                    return true;
+                }
                 return false;
             }
 
@@ -841,6 +875,22 @@
                 {
                     return true;
                 }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 妫�娴嬭澶囨槸鍚︽嫢鏈変竴閿悓姝ュ姛鑳�
+        /// </summary>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        public bool DeviceIsCanSynchronization(CommonDevice device)
+        {
+            //鑾峰彇璁惧绫诲瀷鐨�
+            var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+            if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
+            {
+                return true;
             }
             return false;
         }
@@ -1044,8 +1094,9 @@
             if (sort == false)
             {
                 return list;
-            } 
-            list.Sort((obj1, obj2) => {
+            }
+            list.Sort((obj1, obj2) =>
+            {
 
                 if (obj1.DeviceEpoint > obj2.DeviceEpoint)
                 {
@@ -1110,7 +1161,7 @@
         public List<string> GetAllDeviceFile()
         {
             List<string> listDeviceFile = new List<string>();
-            List<string> listAllFile = Global.FileListByHomeId();
+            List<string> listAllFile = HdlFileLogic.Current.GetRootPathListFile();
 
             foreach (string file in listAllFile)
             {
@@ -2461,15 +2512,6 @@
                     return false;
                 }
             }
-            //濡傛灉鏄柊椋庨潰鏉跨殑鏂伴璁惧,鍒欎笉鏄剧ず
-            else if (i_device.Type == DeviceType.FreshAir)
-            {
-                var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
-                if (myInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
-                {
-                    return false;
-                }
-            }
             //2020.03.30杩藉姞寮忔牱:濡傛灉鏄潰鏉跨殑娓╁害鎺㈠ご,涓嶆樉绀�
             else if (i_device.Type == DeviceType.TemperatureSensor && ((TemperatureSensor)i_device).SensorDiv == 1)
             {
@@ -2484,6 +2526,20 @@
                 //鏂伴鐨勬箍搴︿紶鎰熷櫒涓嶆樉绀�
                 return false;
             }
+
+            //濡傛灉鏄柊椋庨潰鏉挎垨鐜闈㈡澘,鍒欓兘涓嶆樉绀轰换浣曞洖璺�
+            var myInfoTypeTemp = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
+            if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir || myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
+            {
+                return false;
+            }
+            else if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
+            {
+                if (i_device.Type != DeviceType.OnOffOutput)
+                {
+                    return false;
+                }
+            }
             return true;
         }
 

--
Gitblit v1.8.0