From 8b9ce384b26c414db32f98e94e088f5334869c2d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 13 十一月 2019 15:36:28 +0800
Subject: [PATCH] 全部合并了代码,安卓和 IOS 都测试通过了

---
 ZigbeeApp/Shared/Common/Device.cs |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index 3ef2309..b9086a3 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -454,6 +454,11 @@
                 }
                 //澶囦唤鏁版嵁
                 await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.AMac鍚嶇О, newMacName);
+                //濡傛灉瀹冨彧鏈変竴涓洖璺�,鍒欐洿鏀圭鐐瑰悕瀛�
+                if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && this.dicDeviceEpoint[device.DeviceAddr].Count == 1)
+                {
+                    return await this.ReName(device, newMacName);
+                }
             }
             return true;
         }
@@ -739,6 +744,20 @@
                 return -1;
             });
             return list;
+        }
+
+        /// <summary>
+        /// 鏍规嵁MAC鍦板潃,鑾峰彇鍏ㄩ儴鍥炶矾鐨勬暟閲�
+        /// </summary>
+        /// <param name="DeviceAddr">Mac鍦板潃</param>
+        /// <returns></returns>
+        public int GetDevicesCountByMac(string DeviceAddr)
+        {
+            if (dicDeviceEpoint.ContainsKey(DeviceAddr) == false)
+            {
+                return 0;
+            }
+            return dicDeviceEpoint[DeviceAddr].Count;
         }
 
         /// <summary>
@@ -1507,14 +1526,17 @@
         /// <param name="roomId">闇�瑕佷繚瀛樼殑鍝釜璁惧鐨勬埧闂碔D</param>
         public void SaveRealDeviceRoomId(List<CommonDevice> listDevice, string roomId)
         {
-            this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
+            if (listDevice != null)
+            {
+                this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
+            }
 
             //淇濆瓨璁板綍
             string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
             UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId);
 
             //濡傛灉璁惧鍙湁涓�涓洖璺紝濡傛灉鏀瑰彉浜嗙湡瀹炶澶囧尯鍩燂紝鍒欏畠鐨勫洖璺殑鍖哄煙涔熶竴璧锋敼浜�
-            if (listDevice.Count == 1)
+            if (listDevice != null && listDevice.Count == 1)
             {
                 Common.Room.CurrentRoom.ChangedRoom(listDevice[0], roomId);
             }

--
Gitblit v1.8.0