From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码

---
 ZigbeeApp/Shared/Common/Device.cs |  794 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 569 insertions(+), 225 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index 35989ca..0f8e7c2 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -45,12 +45,14 @@
             {
                 lock (dicAllDevice)
                 {
-                    var list = new List<CommonDevice>();
-                    foreach (var device in dicAllDevice.Values)
+                    //鍏堣幏鍙栧叏閮ㄧ殑Mac
+                    var listMac = new List<string>();
+                    foreach (var strMac in this.dicDeviceEpoint.Keys)
                     {
-                        list.Add(device);
+                        listMac.Add(strMac);
                     }
-                    return list;
+                    //鏍规嵁MAC鍦板潃,鑾峰彇鍏ㄩ儴鍥炶矾鐨勮澶囧璞�(寮哄埗鎺掑簭)
+                    return this.GetDevicesByMac(listMac);
                 }
             }
         }
@@ -60,9 +62,9 @@
         /// </summary>
         public const string deviceModelIdName = "uDeviceModelId";
         /// <summary>
-        /// R鏂囦欢閲岄潰璁惧榛樿鍚嶅瓧鐨処D
+        /// R鏂囦欢閲岄潰鎵�鏈夎澶囧悕瀛楃殑ID
         /// </summary>
-        public Dictionary<string, int> dicDeviceDefultNameID = null;
+        public Dictionary<string, int> dicDeviceAllNameID = null;
         /// <summary>
         /// 璁惧鐨勬ā鍧桰D鐨勬灇涓�(keys:妯″潡ID  value:璁惧鍏蜂綋绫诲瀷鍊�-璁惧鎵�灞炵被鍨嬪��(鑷畾涔夌殑鍊�,鍢�,鍙涓嶉噸澶嶅氨鍙互)
         /// </summary>
@@ -241,7 +243,16 @@
 
             //鑾峰彇杩欎釜缃戝叧鐨勬湰鍦版墍鏈夎澶�
             string gwID = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
-            List<CommonDevice> listLocalDevices = this.GetDeviceByGatewayID(gwID, true);
+            List<CommonDevice> listLocalDevices = this.GetDeviceByGatewayID(gwID);
+            //鑾峰彇ota璁惧
+            foreach (var ota in this.dicOTADevice.Values)
+            {
+                if (ota.CurrentGateWayId == gwID)
+                {
+                    listLocalDevices.Add(ota);
+                }
+            }
+
             Dictionary<string, CommonDevice> dicExist = new Dictionary<string, CommonDevice>();
             foreach (var device in listLocalDevices)
             {
@@ -295,6 +306,7 @@
             }
 
             //濡傛灉鏈湴鍜岀綉鍏崇殑璁惧涓嶄竴鑷寸殑鏃跺�欙紝鍒犻櫎鏈湴鐨勮澶�
+            var listDeleteMac = new List<string>();
             foreach (var device in dicExist.Values)
             {
                 if (device is OTADevice)
@@ -305,6 +317,16 @@
                 {
                     this.DeleteMemmoryDevice(device, true);
                 }
+                if (listDeleteMac.Contains(device.DeviceAddr) == false)
+                {
+                    //鏀堕泦琚垹闄ょ殑Mac
+                    listDeleteMac.Add(device.DeviceAddr);
+                }
+            }
+            if (listDeleteMac.Count > 0)
+            {
+                //灏嗙湡瀹炵墿鐞嗚澶囦粠鎴块棿涓Щ闄�
+                this.DeleteRealDeviceFromRoom(listDeleteMac);
             }
 
             return statu;
@@ -383,7 +405,7 @@
         #region 鈻� 淇敼璁惧___________________________
 
         /// <summary>
-        /// 鏇存敼鍚嶅瓧骞朵笖鍒锋柊缂撳瓨(淇敼澶辫触鏃讹紝浼氭樉绀轰俊鎭�)
+        /// 鏇存敼绔偣鍚嶅瓧骞朵笖鍒锋柊缂撳瓨(淇敼澶辫触鏃讹紝浼氭樉绀轰俊鎭�)
         /// </summary>
         /// <param name="device">璁惧瀵硅薄</param>
         /// <param name="newName">鏂板悕瀛�</param>
@@ -464,9 +486,28 @@
                 //澶囦唤鏁版嵁
                 await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.AMac鍚嶇О, newMacName);
                 //濡傛灉瀹冨彧鏈変竴涓洖璺�,鍒欐洿鏀圭鐐瑰悕瀛�
-                if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && this.dicDeviceEpoint[device.DeviceAddr].Count == 1)
+                if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true)
                 {
-                    return await this.ReName(device, newMacName);
+                    //鍙湁涓�涓鐐�
+                    if (this.dicDeviceEpoint[device.DeviceAddr].Count == 1)
+                    {
+                        return await this.ReName(device, newMacName);
+                    }
+                    //濡傛灉瀹冩湁涓や釜绔偣鏃�,pir浼犳劅鍣ㄧ壒娈婂鐞�
+                    else if (this.dicDeviceEpoint[device.DeviceAddr].Count == 2)
+                    {
+                        var myType = this.GetMyDeviceEnumInfo(listDevice);
+                        if (myType.ConcreteType == DeviceConcreteType.Sensor_Pir)
+                        {
+                            foreach (var myDevice in listDevice)
+                            {
+                                if (myDevice.Type == DeviceType.IASZone)
+                                {
+                                    return await this.ReName(myDevice, newMacName);
+                                }
+                            }
+                        }
+                    }
                 }
             }
             return true;
@@ -555,12 +596,12 @@
         /// <param name="deleteRoom">鏄惁浠庢埧闂村垹闄�</param>
         public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
         {
-            if (deleteRoom == true && Room.CurrentRoom != null)
+            if (deleteRoom == true)
             {
                 //浠庢埧闂翠腑鍒犻櫎
-                Room.CurrentRoom.DeleteDevice(device);
+                HdlRoomLogic.Current.DeleteDevice(device);
                 //鍒犻櫎鎴戠殑鍠滅埍鐨勮澶�
-                Room.CurrentRoom.DeleteLoveDevice(device);
+                HdlRoomLogic.Current.DeleteLoveDevice(device);
             }
 
             //鍒犻櫎缂撳瓨
@@ -648,6 +689,22 @@
         /// <returns></returns>
         public bool DeviceIsCanFixedPosition(CommonDevice device)
         {
+            if (device.Type == DeviceType.DoorLock)
+            {
+                //闂ㄩ攣娌℃湁瀹氫綅鍔熻兘
+                return false;
+            }
+            if (device.Type == DeviceType.IASZone)
+            {
+                var myTypeInfo = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+                if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_Pir)
+                {
+                    //浼犳劅鍣ㄩ櫎浜哖ir閮芥病鏈夊畾浣嶅姛鑳�
+                    return true;
+                }
+                return false;
+            }
+
             foreach (var data in device.InClusterList)
             {
                 //鎷ユ湁on/off鍔熻兘鐨勶紝鎵嶆敮鎸佹祴璇�
@@ -702,36 +759,23 @@
         /// <summary>
         /// 鏍规嵁缃戝叧ID鑾峰彇鎵�鏈夌殑璁惧
         /// </summary>
-        /// <param name="gwId">缃戝叧ID</param>
-        /// <param name="getOtaDevice">鏄惁鑾峰彇ota璁惧</param>
+        /// <param name="gwId">缃戝叧ID</param>>
         /// <returns></returns>
-        public List<CommonDevice> GetDeviceByGatewayID(string gwId, bool getOtaDevice = false)
+        public List<CommonDevice> GetDeviceByGatewayID(string gwId)
         {
-            List<CommonDevice> list = new List<CommonDevice>();
             lock (dicAllDevice)
             {
-                //鍚勭綉鍏崇殑鎵�鏈夎澶�
+                var listMac = new List<string>();
+                //鍚勭綉鍏崇殑鎵�鏈夎澶囩殑Mac
                 foreach (CommonDevice device in this.dicAllDevice.Values)
                 {
                     if (gwId == device.CurrentGateWayId)
                     {
-                        list.Add(device);
+                        listMac.Add(device.DeviceAddr);
                     }
                 }
-                if (getOtaDevice == true)
-                {
-                    //鑾峰彇ota璁惧
-                    foreach (var ota in this.dicOTADevice.Values)
-                    {
-                        if (ota.CurrentGateWayId == gwId)
-                        {
-                            list.Add(ota);
-                        }
-                    }
-                }
+                return this.GetDevicesByMac(listMac);
             }
-
-            return list;
         }
 
         /// <summary>
@@ -798,6 +842,39 @@
                 }
                 return -1;
             });
+            return list;
+        }
+
+        /// <summary>
+        /// 鏍规嵁MAC鍦板潃,鑾峰彇鍏ㄩ儴鍥炶矾鐨勮澶囧璞�(寮哄埗鎺掑簭)
+        /// </summary>
+        /// <param name="DeviceAddr">Mac鍦板潃</param>
+        /// <returns></returns>
+        public List<CommonDevice> GetDevicesByMac(List<string> listMacAddr)
+        {
+            //鍏堟帓搴�
+            listMacAddr.Sort();
+
+            var list = new List<CommonDevice>();
+            foreach (string strMac in listMacAddr)
+            {
+                var listEpoint = new List<int>();
+                //鑾峰彇鍏ㄩ儴鐨勭鐐�
+                foreach (int epoint in this.dicDeviceEpoint[strMac])
+                {
+                    listEpoint.Add(epoint);
+                }
+                //鐒跺悗鎺掑簭
+                listEpoint.Sort();
+                foreach (int epoint in listEpoint)
+                {
+                    var device = this.GetDevice(strMac, epoint);
+                    if (device != null)
+                    {
+                        list.Add(device);
+                    }
+                }
+            }
             return list;
         }
 
@@ -897,41 +974,81 @@
             {
                 return dName;
             }
-            //鏍规嵁璁惧绫诲瀷鑾峰彇鍚嶇О
-            var tempValue = this.GetDeviceObjectText(new List<CommonDevice>() { device }, false);
-            var arry = tempValue.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
-            dName = arry[0].Trim();
-
-            //濡傛灉鏄櫄鎷熻澶�
-            if (device.DriveCode > 0)
+            //濡傛灉杩欎釜璁惧鍙湁涓�涓洖璺殑璇�,杩斿洖Mac鍚嶅瓧缁欏畠
+            if (this.GetDevicesCountByMac(device.DeviceAddr) <= 1)
             {
-                //鍦ㄧ鐐瑰悕瀛楃殑鍚庨潰闄勫姞銆愬洖璺�戝瓧鏍�
-                dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
-                return dName;
+                return this.GetDeviceMacName(device);
+            }
+
+            //鍚屼竴璁惧閲岄潰,涓嶅悓绫诲瀷鐨勫洖璺�,瀹冪殑鍛藉悕閮戒粠1寮�濮�
+            int epointNo = 0;
+            var listSort = this.GetDevicesByMac(device.DeviceAddr);
+            foreach (var myDevice in listSort)
+            {
+                if (myDevice.Type == device.Type)
+                {
+                    //鍚屼竴绫诲瀷缂栧彿+1
+                    epointNo++;
+                    if (myDevice.DeviceEpoint == device.DeviceEpoint)
+                    {
+                        //宸茬粡鍒拌揪瀹冭嚜宸�
+                        break;
+                    }
+                }
+            }
+
+            if (device.Type == DeviceType.OnOffOutput
+                || device.Type == DeviceType.DimmableLight || device.Type == DeviceType.ColorDimmableLight)
+            {
+                //缁х數鍣�,鎺夊厜鍣ㄩ兘鍙洖璺�
+                return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + epointNo;
+            }
+            if (device.Type == DeviceType.Thermostat)
+            {
+                //绌鸿皟閮藉彨瀹ゅ唴鏈�
+                return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + epointNo;
+            }
+            else if (device.Type == DeviceType.FreshAir)
+            {
+                //鏂伴闈㈡澘涓殑鎸夐敭鍙柊椋�
+                return Language.StringByID(R.MyInternationalizationString.FreshAir);
+            }
+            else if (device.Type == DeviceType.FreshAirHumiditySensor)
+            {
+                //鏂伴闈㈡澘婀垮害浼犳劅鍣�
+                return Language.StringByID(R.MyInternationalizationString.HumiditySensor);
             }
 
             //鑾峰彇璁惧绫诲瀷
             var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
-            if (deviceInfoType.BeloneType == Common.DeviceBeloneType.A鎸夐敭闈㈡澘 && device.Type == DeviceType.TemperatureSensor)
+            if (device.Type == DeviceType.OnOffSwitch)
             {
-                //闈㈡澘鐨勬渶鍚庝竴涓洖璺槸娓╁害浼犳劅鍣�
-                dName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId11);
-            }
-            else if (deviceInfoType.ConcreteType == Common.DeviceConcreteType.Sensor_Pir)
-            {
-                //pir浼犳劅鍣�,瀹冨張鎼炵壒娈婁笢瑗�,浼犳劅鍣ㄨ嚜韬敤鑷繁鐨勫悕瀛�,缁х數鍣ㄥ洖璺殑璇濃�︹��
-                if (device.Type == DeviceType.OnOffOutput)
+                //闈㈡澘鐨勫共鎺ョ偣鍙寜閿�
+                if (deviceInfoType.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
                 {
-                    dName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2300);
+                    return Language.StringByID(R.MyInternationalizationString.uPanelButton) + epointNo;
+                }
+                //鍏朵粬鐨勫共鎺ョ偣鍙共鎺ョ偣
+                else
+                {
+                    return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + epointNo;
                 }
             }
-            else if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && this.dicDeviceEpoint[device.DeviceAddr].Count > 1)
+            else if (device.Type == DeviceType.TemperatureSensor)
             {
-                //XXXXX(N鍥炶矾)
-                dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
+                if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
+                {
+                    //鏂伴闈㈡澘涓殑Thermostat涓烘俯搴︿紶鎰熷櫒
+                    return Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                }
+                else if (deviceInfoType.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
+                {
+                    //闈㈡澘鐨勬俯搴︽帰澶村彨  闈㈡澘鍚嶅瓧+娓╁害
+                    return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.uTemperature);
+                }
             }
-
-            return dName;
+            //鍏朵粬鎯呭喌,浣跨敤瀹冪殑榛樿鍚嶇О
+            return Language.StringByID(deviceInfoType.DefultNameId) + epointNo;
         }
 
         /// <summary>
@@ -947,52 +1064,9 @@
                 return dName;
             }
 
-            //鏄惁鎷ユ湁閰嶇疆鐨勬ā鍧桰D
-            if (this.dicDeviceModelIdEnum.ContainsKey(device.ModelIdentifier) == true)
-            {
-                //鑾峰彇妯″潡ID鍚嶅瓧
-                return this.GetNameByModelId(device);
-            }
-            else
-            {
-                //鑾峰彇绗笁鏂硅澶囩殑缈昏瘧鍚嶅瓧
-                var myDeviceType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
-                return Language.StringByID(myDeviceType.ConcreteTextId);
-            }
-        }
-
-        /// <summary>
-        /// 鏍规嵁妯″潡ID锛岃幏鍙栫炕璇戝悕瀛�
-        /// </summary>
-        /// <param name="device"></param>
-        /// <returns></returns>
-        private string GetNameByModelId(CommonDevice device)
-        {
-            if (device.ModelIdentifier == string.Empty)
-            {
-                //鏈煡璁惧
-                return Language.StringByID(R.MyInternationalizationString.UnknowDevice);
-            }
-
-            string modelKeys = device.ModelIdentifier;
-            if (this.dicDeviceModelIdEnum.ContainsKey(modelKeys) == false)
-            {
-                //鏈煡璁惧
-                return Language.StringByID(R.MyInternationalizationString.UnknowDevice);
-            }
-
-            string[] strValue = this.dicDeviceModelIdEnum[modelKeys].Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
-            int ConcreteValue = Convert.ToInt32(strValue[0]);
-
-            string keyName = deviceModelIdName + ConcreteValue;
-            if (this.dicDeviceDefultNameID.ContainsKey(keyName) == true)
-            {
-                //R鏂囦欢閲岄潰璁剧疆鐨勫悕瀛�
-                return Language.StringByID(this.dicDeviceDefultNameID[keyName]);
-            }
-
-            //鏈煡璁惧
-            return Language.StringByID(R.MyInternationalizationString.UnknowDevice);
+            //鑾峰彇璁惧绫诲瀷
+            var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+            return Language.StringByID(deviceInfoType.DefultNameId);
         }
 
         /// <summary>
@@ -1042,11 +1116,11 @@
         /// </summary>
         private void InitDeviceDefultNameIDList()
         {
-            if (this.dicDeviceDefultNameID != null)
+            if (this.dicDeviceAllNameID != null)
             {
                 return;
             }
-            this.dicDeviceDefultNameID = new Dictionary<string, int>();
+            this.dicDeviceAllNameID = new Dictionary<string, int>();
             Type type = typeof(R.MyInternationalizationString);
 
             var PropertyList = type.GetFields();
@@ -1055,7 +1129,7 @@
                 if (item.Name.StartsWith(deviceModelIdName) == true
                     || item.Name.StartsWith("uDeviceBelongId") == true)
                 {
-                    this.dicDeviceDefultNameID[item.Name] = Convert.ToInt32(item.GetValue(null));
+                    this.dicDeviceAllNameID[item.Name] = Convert.ToInt32(item.GetValue(null));
                 }
             }
 
@@ -1103,9 +1177,41 @@
 
             //鑾峰彇璁惧銆愬浘鏍囥��
             this.GetDeviceIcon(device, ref unSelectFilePath, ref selectFilePath);
+            if (btnIcon.UnSelectedImagePath != unSelectFilePath)
+            {
+                btnIcon.UnSelectedImagePath = unSelectFilePath;
+            }
+            if (btnIcon.SelectedImagePath != selectFilePath)
+            {
+                btnIcon.SelectedImagePath = selectFilePath;
+            }
+        }
 
-            btnIcon.UnSelectedImagePath = unSelectFilePath;
-            btnIcon.SelectedImagePath = selectFilePath;
+        /// <summary>
+        /// 璁剧疆璁惧銆愬浘鏍囥�戝埌鎸囧畾鐨勬帶浠�(娉ㄦ剰,姝ゅ嚱鏁拌缃殑閫夋嫨鐘舵�佺殑鍥剧墖鏄櫧鑹茬殑)
+        /// </summary>
+        /// <param name="btnIcon">鎺т欢瀵硅薄</param>
+        /// <param name="device">璁惧瀵硅薄</param>
+        /// <returns></returns>
+        public void SetDeviceIconToControl2(Button btnIcon, CommonDevice device)
+        {
+            if (device == null)
+            {
+                btnIcon.UnSelectedImagePath = "Device/ThirdPartyDevice.png";
+                return;
+            }
+            string unSelectFilePath = device.IconPath;
+            string selectFilePath = unSelectFilePath.Replace(".png", "Selected2.png");
+
+            //鑾峰彇璁惧銆愬浘鏍囥��
+            if (btnIcon.UnSelectedImagePath != unSelectFilePath)
+            {
+                btnIcon.UnSelectedImagePath = unSelectFilePath;
+            }
+            if (btnIcon.SelectedImagePath != selectFilePath)
+            {
+                btnIcon.SelectedImagePath = selectFilePath;
+            }
         }
 
         /// <summary>
@@ -1266,43 +1372,6 @@
 
         #endregion
 
-        #region 鈻� 璁惧UI鐩稿叧_________________________
-
-        /// <summary>
-        /// 鑾峰彇璁惧鎵�鍖归厤鐨勮澶嘦I瀵硅薄
-        /// </summary>
-        /// <param name="device"></param>
-        /// <returns></returns>
-        public DeviceUI GetDeviceUI(CommonDevice device)
-        {
-            //鍒涘缓涓�涓柊鐨勪笢瑗跨粰杩囧幓
-            var deviceUi = new DeviceUI();
-            deviceUi.DeviceAddr = device.DeviceAddr;
-            deviceUi.DeviceEpoint = device.DeviceEpoint;
-            return deviceUi;
-        }
-
-        /// <summary>
-        /// 鑾峰彇璁惧鎵�鍖归厤鐨勮澶嘦I瀵硅薄
-        /// </summary>
-        /// <param name="filePath"></param>
-        /// <returns></returns>
-        public DeviceUI GetDeviceUI(string filePath)
-        {
-            string[] arry = filePath.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
-            if (arry.Length != 4)
-            {
-                return null;
-            }
-            //鍒涘缓涓�涓柊鐨勪笢瑗跨粰杩囧幓
-            var deviceUi = new DeviceUI();
-            deviceUi.DeviceAddr = arry[2];
-            deviceUi.DeviceEpoint = Convert.ToInt32(arry[3]);
-            return deviceUi;
-        }
-
-        #endregion
-
         #region 鈻� 鑾峰彇鑷畾涔夌殑璁惧绫诲瀷_______________
 
         /// <summary>
@@ -1329,7 +1398,11 @@
                 return info;
             }
             //鑾峰彇绗笁鏂硅澶囩殑銆愯澶囩被鍨嬨��
-            return this.GetNotHdlMyDeviceEnumInfo(listdevice);
+            info = this.GetNotHdlMyDeviceEnumInfo(listdevice);
+            //杩欓噷鍐嶆鍒ゆ柇鏄惁鏄渤涓滆澶�,鏈夊彲鑳藉畠鐨勬ā鍧桰D鍐欓敊浜�
+            info.IsHdlDevice = this.IsHdlDevice(checkDevice);
+
+            return info;
         }
 
         /// <summary>
@@ -1349,28 +1422,39 @@
                     checkDevice = temp;
                 }
             }
+            //鑾峰彇鑷畾涔夎澶囩被鍨�
+            var myInfoType = this.GetMyDeviceEnumInfo(listDevice);
+            //鑾峰彇璁惧绫诲瀷鐨勭炕璇戝悕瀛�
+            string strName = Language.StringByID(myInfoType.ObjectTypeNameId);
+            if (strName == string.Empty)
+            {
+                //鍔犱竴灞備繚闄�,鏈煡璁惧
+                strName = Language.StringByID(R.MyInternationalizationString.UnknowDevice);
+            }
 
-            string strName = string.Empty;
-            if (this.dicDeviceModelIdEnum.ContainsKey(checkDevice.ModelIdentifier) == true)
+            if (ApendFalge == true)
             {
-                //鏍规嵁妯″潡ID锛岃幏鍙栬澶囧悕瀛�
-                strName = this.GetNameByModelId(checkDevice);
-            }
-            else
-            {
-                //鑾峰彇绗笁鏂硅澶囩殑銆愯澶囩被鍨嬨��
-                var myDeviceType = this.GetNotHdlMyDeviceEnumInfo(listDevice);
-                strName = Language.StringByID(myDeviceType.ConcreteTextId);
-            }
-            if (ApendFalge == true && listDevice[0].DriveCode > 0)
-            {
-                //铏氭嫙璁惧鍔犱釜鏍囪瘑
-                strName += "鉁�";
-            }
-            else if (ApendFalge == true && this.IsHdlDevice(checkDevice) == false)
-            {
-                //绗笁鏂硅澶囧姞涓爣璇�
-                strName += "鈽�";
+                if (listDevice[0].DriveCode > 0)
+                {
+                    //铏氭嫙璁惧鍔犱釜鏍囪瘑
+                    strName += "鉁�";
+                }
+                else
+                {
+                    foreach (var temp in listDevice)
+                    {
+                        //鎷挎嫢鏈夋ā鍧桰D鐨勯偅涓洖璺潵鍒ゆ柇
+                        if (temp.ModelIdentifier != string.Empty)
+                        {
+                            if (this.IsHdlDevice(checkDevice) == false)
+                            {
+                                //绗笁鏂硅澶囧姞涓爣璇�
+                                strName += "鈽�";
+                                break;
+                            }
+                        }
+                    }
+                }
             }
             return strName;
         }
@@ -1394,6 +1478,9 @@
                 return null;
             }
             string modelKeys = device.ModelIdentifier;
+            //浜ゆ崲涓�涓嬫ā鍧桰D(楹︿箰鍏嬮偅杈圭殑浼犳劅鍣�)
+            this.ChangedDeviceModeId(ref modelKeys);
+
             if (this.dicDeviceModelIdEnum.ContainsKey(modelKeys) == false)
             {
                 //娌℃湁鍖归厤鍒版ā鍧桰D锛屽垯鐩存帴璧扮涓夋柟璁惧鐨勫垽鏂�
@@ -1405,10 +1492,10 @@
             int BeloneValue = Convert.ToInt32(strValue[1]);
             //璁剧疆璁惧鐨勩�愯澶囨墍灞炵被鍨嬨��
             info.BeloneType = (DeviceBeloneType)BeloneValue;
-            if (dicDeviceDefultNameID.ContainsKey("uDeviceBelongId" + BeloneValue) == true)
+            if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + BeloneValue) == true)
             {
                 //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
-                info.BeloneTextId = dicDeviceDefultNameID["uDeviceBelongId" + BeloneValue];
+                info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + BeloneValue];
             }
 
             //璁惧鍏蜂綋绫诲瀷
@@ -1417,6 +1504,16 @@
             {
                 info.ConcreteType = DeviceConcreteType.UnKownDevice;
             }
+            string keyName = deviceModelIdName + ConcreteValue;
+            if (this.dicDeviceAllNameID.ContainsKey(keyName) == true)
+            {
+                //璁惧鐨勫畼鏂瑰悕绉�
+                info.ConcreteTextId = this.dicDeviceAllNameID[keyName];
+            }
+
+            //璁惧鐨勭被鍨嬬炕璇戝悕绉�
+            info.ObjectTypeNameId = Convert.ToInt32(strValue[2]);
+
             return info;
         }
 
@@ -1439,12 +1536,13 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId15;
                 info.BeloneType = DeviceBeloneType.A鐏厜;
                 info.ConcreteType = DeviceConcreteType.Light;
+                info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
 
                 int value = (int)info.BeloneType;
-                if (dicDeviceDefultNameID.ContainsKey("uDeviceBelongId" + value) == true)
+                if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
                 {
                     //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
-                    info.BeloneTextId = dicDeviceDefultNameID["uDeviceBelongId" + value];
+                    info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + value];
                 }
             }
             else if (info.BeloneType == DeviceBeloneType.A浼犳劅鍣�
@@ -1454,12 +1552,13 @@
                 info.BeloneType = DeviceBeloneType.A浼犳劅鍣�;
                 info.ConcreteType = DeviceConcreteType.Sensor;
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId1200;
+                info.ObjectTypeNameId = 60000;//浼犳劅鍣�
 
                 int value = (int)info.BeloneType;
-                if (dicDeviceDefultNameID.ContainsKey("uDeviceBelongId" + value) == true)
+                if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
                 {
                     //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
-                    info.BeloneTextId = dicDeviceDefultNameID["uDeviceBelongId" + value];
+                    info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + value];
                 }
             }
 
@@ -1498,6 +1597,7 @@
                     info.BeloneType = DeviceBeloneType.A骞叉帴鐐�;
                     info.ConcreteType = DeviceConcreteType.DryContact;
                 }
+                info.ObjectTypeNameId = 60003;//鏅鸿兘闈㈡澘
             }
             //3鍖呭惈绐楀笜鐨勮瘽,褰撶獥甯樺鐞�
             else if (dicType.ContainsKey(DeviceType.WindowCoveringDevice) == true)
@@ -1505,14 +1605,16 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId100;
                 info.BeloneType = DeviceBeloneType.A绐楀笜;
                 info.ConcreteType = DeviceConcreteType.Curtain;
+                info.ObjectTypeNameId = 60002;//閬槼妯″潡
             }
             //4绌烘皵寮�鍏�
             else if (dicType.ContainsKey(DeviceType.AirSwitch) == true)
             {
                 //榛樿鍊�
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId4100;
-                info.BeloneType = DeviceBeloneType.A鏅鸿兘绌哄紑;
+                info.BeloneType = DeviceBeloneType.A寮�鍏�;
                 info.ConcreteType = DeviceConcreteType.AirSwitch;
+                info.ObjectTypeNameId = 60001;//寮�鍏虫ā鍧�
 
                 if (dicType[DeviceType.AirSwitch].DfunctionType == DeviceFunctionType.A寮�鍏�)
                 {
@@ -1540,6 +1642,7 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId2300;
                 info.BeloneType = DeviceBeloneType.A缁х數鍣�;
                 info.ConcreteType = DeviceConcreteType.Relay;
+                info.ObjectTypeNameId = 60001;//寮�鍏虫ā鍧�
 
                 if (dicType[DeviceType.OnOffOutput].DfunctionType == DeviceFunctionType.A寮�鍏�)
                 {
@@ -1566,6 +1669,7 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId2500;
                 info.BeloneType = DeviceBeloneType.A璋冨厜鍣�;
                 info.ConcreteType = DeviceConcreteType.DimmableLight;
+                info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
             }
             //7褰╃伅
             else if (dicType.ContainsKey(DeviceType.ColorDimmableLight) == true)
@@ -1573,6 +1677,7 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId9;
                 info.BeloneType = DeviceBeloneType.A褰╃伅;
                 info.ConcreteType = DeviceConcreteType.ColorLight;
+                info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
             }
             //8绌鸿皟
             else if (dicType.ContainsKey(DeviceType.Thermostat) == true)
@@ -1580,6 +1685,7 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId3600;
                 info.BeloneType = DeviceBeloneType.A绌鸿皟;
                 info.ConcreteType = DeviceConcreteType.AirConditioner;
+                info.ObjectTypeNameId = 60009;//绌鸿皟妯″潡
             }
             //9涓户鍣�
             else if (dicType.ContainsKey(DeviceType.Repeater) == true)
@@ -1587,6 +1693,7 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId3900;
                 info.BeloneType = DeviceBeloneType.A涓户鍣�;
                 info.ConcreteType = DeviceConcreteType.Repeater;
+                info.ObjectTypeNameId = 60006;//绯荤粺璁惧
             }
             //10杞崲鍣�
             else if (dicType.ContainsKey(DeviceType.Transverter) == true)
@@ -1594,6 +1701,7 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId4200;
                 info.BeloneType = DeviceBeloneType.A杞崲鍣�;
                 info.ConcreteType = DeviceConcreteType.Converter;
+                info.ObjectTypeNameId = 60008;//杞崲鍣�
             }
             //11鏅鸿兘闂ㄩ攣
             else if (dicType.ContainsKey(DeviceType.DoorLock) == true)
@@ -1601,6 +1709,7 @@
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId2800;
                 info.BeloneType = DeviceBeloneType.A鏅鸿兘闂ㄩ攣;
                 info.ConcreteType = DeviceConcreteType.IntelligentLocks;
+                info.ObjectTypeNameId = 60010;//鏅鸿兘闂ㄩ攣
             }
             //12鍖呭惈浼犳劅鍣ㄧ殑璇�,褰撲紶鎰熷櫒澶勭悊
             else if (dicType.ContainsKey(DeviceType.IASZone) == true)
@@ -1608,6 +1717,7 @@
                 info.BeloneType = DeviceBeloneType.A浼犳劅鍣�;
                 info.ConcreteType = DeviceConcreteType.Sensor;
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId1200;
+                info.ObjectTypeNameId = 60000;//浼犳劅鍣�
                 //璁剧疆浼犳劅鍣ㄥ叿浣撶殑绫诲瀷
                 this.SetSensorDeviceSpecificType(ref info, listdevice);
             }
@@ -1655,13 +1765,14 @@
                     info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId12;
                     info.ConcreteType = DeviceConcreteType.Sensor_Humidity;
                 }
+                info.ObjectTypeNameId = 60000;//浼犳劅鍣�
             }
 
             int value = (int)info.BeloneType;
-            if (dicDeviceDefultNameID.ContainsKey("uDeviceBelongId" + value) == true)
+            if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
             {
                 //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
-                info.BeloneTextId = dicDeviceDefultNameID["uDeviceBelongId" + value];
+                info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + value];
             }
 
             return info;
@@ -1756,7 +1867,15 @@
         {
             if (listDevice != null)
             {
-                this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
+                if (roomId == string.Empty)
+                {
+                    //閫夋嫨鐨勬槸鏈垎閰�
+                    this.dicDeviceRoomId.Remove(listDevice[0].DeviceAddr);
+                }
+                else
+                {
+                    this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
+                }
             }
 
             //淇濆瓨璁板綍
@@ -1774,7 +1893,7 @@
                     //鍗曠函鍙槸Ota璁惧鍒欎笉澶勭悊
                     return;
                 }
-                Common.Room.CurrentRoom.ChangedRoom(listDevice[0], roomId, false);
+                HdlRoomLogic.Current.ChangedRoom(listDevice[0], roomId, false);
             }
         }
 
@@ -1790,13 +1909,8 @@
                 //鏈垎閰嶅尯鍩�
                 return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
             }
-            var room = Room.CurrentRoom.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
-            if (room != null)
-            {
-                return room.Name;
-            }
-            //鏈垎閰嶅尯鍩�
-            return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
+            var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
+            return HdlRoomLogic.Current.GetFloorRoomName(room);
         }
 
         /// <summary>
@@ -1810,12 +1924,155 @@
             {
                 return null;
             }
-            return Room.CurrentRoom.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
+            return HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
+        }
+
+        /// <summary>
+        /// 灏嗙湡瀹炵墿鐞嗚澶囦粠鎴块棿涓Щ闄�
+        /// </summary>
+        /// <param name="device">闅忎究涓�涓洖璺�</param>
+        public void DeleteRealDeviceFromRoom(CommonDevice device)
+        {
+            //灏嗙湡瀹炵墿鐞嗚澶囦粠鎴块棿涓Щ闄�
+            this.DeleteRealDeviceFromRoom(new List<string>() { device.DeviceAddr });
+        }
+
+        /// <summary>
+        /// 灏嗙湡瀹炵墿鐞嗚澶囦粠鎴块棿涓Щ闄�
+        /// </summary>
+        /// <param name="listMac">璁惧Mac鍦板潃</param>
+        public void DeleteRealDeviceFromRoom(List<string> listMac)
+        {
+            foreach (var deviceMacAddr in listMac)
+            {
+                this.dicDeviceRoomId.Remove(deviceMacAddr);
+            }
+            //淇濆瓨璁板綍
+            string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
+            UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId);
+
+            //娣诲姞鑷姩澶囦唤
+            HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
+        }
+
+        #endregion
+
+        #region 鈻� 璁惧鎺掑簭___________________________
+
+        /// <summary>
+        /// 璁惧鎺掑簭
+        /// </summary>
+        /// <param name="i_listDevice">璇风‘淇濊繖涓笢瑗垮凡缁忔寜mac鍜岀鐐规帓搴忎簡</param>
+        /// <returns></returns>
+        public List<CommonDevice> SortDeviceByBelongType(List<CommonDevice> i_listDevice)
+        {
+            //鑾峰彇鎺掑簭瑙勫垯
+            var listRule = this.GetBelongTypeSortRule();
+            var dicDevice = new Dictionary<DeviceBeloneType, List<CommonDevice>>();
+            dicDevice[DeviceBeloneType.A鏈煡璁惧] = new List<CommonDevice>();
+
+            foreach (var device in i_listDevice)
+            {
+                //鑾峰彇鎵�灞炵被鍨�
+                var typeInfo = this.GetDeviceBelongEnumInfo(device);
+                if (listRule.Contains(typeInfo.BeloneType) == false)
+                {
+                    //涓嶅湪鎺掑簭鑼冨洿鍐�,閮戒涪鍦ㄦ渶鍚庨潰
+                    dicDevice[DeviceBeloneType.A鏈煡璁惧].Add(device);
+                    continue;
+                }
+                if (dicDevice.ContainsKey(typeInfo.BeloneType) == false)
+                {
+                    dicDevice[typeInfo.BeloneType] = new List<CommonDevice>();
+                }
+                dicDevice[typeInfo.BeloneType].Add(device);
+            }
+
+            var listSort = new List<CommonDevice>();
+            foreach (var myType in listRule)
+            {
+                //鏍规嵁瑙勫垯椤哄簭,娣诲姞璁惧
+                if (dicDevice.ContainsKey(myType) == false || dicDevice[myType].Count == 0)
+                {
+                    continue;
+                }
+                listSort.AddRange(dicDevice[myType]);
+            }
+
+            return listSort;
+        }
+
+        /// <summary>
+        /// 鑾峰彇璁惧鎵�灞炵被鍨嬬殑鐨勬帓搴忚鍒�
+        /// </summary>
+        /// <returns></returns>
+        public HashSet<DeviceBeloneType> GetBelongTypeSortRule()
+        {
+            //璋佸湪鍓嶉潰,璋佸氨浼樺厛鏄剧ず
+            var list = new HashSet<DeviceBeloneType>();
+            list.Add(DeviceBeloneType.A鐏厜);
+            list.Add(DeviceBeloneType.A褰╃伅);
+            list.Add(DeviceBeloneType.A寮�鍏�);
+            list.Add(DeviceBeloneType.A鎻掑骇);
+            list.Add(DeviceBeloneType.A璋冨厜鍣�);
+            list.Add(DeviceBeloneType.A绐楀笜);
+            list.Add(DeviceBeloneType.A绌鸿皟);
+            list.Add(DeviceBeloneType.A缁х數鍣�);
+            list.Add(DeviceBeloneType.A骞叉帴鐐�);
+            list.Add(DeviceBeloneType.A鏅鸿兘闂ㄩ攣);
+            list.Add(DeviceBeloneType.A鏅鸿兘绌哄紑);
+            list.Add(DeviceBeloneType.A浼犳劅鍣�);
+
+            //鍏朵粬鐨勭湅鐫�鍔炲憲,閮芥槸鎺掑湪鍚庨潰鐨�,閮藉綊涓鸿繖涓睘鎬�
+            list.Add(DeviceBeloneType.A鏈煡璁惧);
+            
+            return list;
         }
 
         #endregion
 
         #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 鍒ゆ柇璇ヨ澶囨槸鍚﹀彲浠ユ樉绀哄湪涓婚〉
+        /// </summary>
+        /// <param name="i_device"></param>
+        /// <returns></returns>
+        public bool CanShowInHomeHomeMainPage(CommonDevice i_device)
+        {
+            if (i_device == null || i_device.Type == DeviceType.OnOffSwitch)//骞叉帴鐐�
+            {
+                //杩欎釜璁惧涓嶈浜�
+                return false;
+            }
+            if (i_device.Type == DeviceType.OnOffOutput || i_device.Type == DeviceType.AirSwitch)
+            {
+                //2020.03.23杩藉姞寮忔牱:鏈寚瀹氱被鍨嬬殑缁х數鍣�,涓嶆樉绀�
+                if (i_device.DfunctionType == DeviceFunctionType.A鏈畾涔�)
+                {
+                    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)
+            {
+                var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
+                if (myInfoType.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
 
         /// <summary>
         /// 鍒ゆ柇鏄笉鏄渤涓滅殑璁惧
@@ -1834,7 +2091,7 @@
         /// <returns></returns>
         public string GetDeviceMainKeys(CommonDevice device)
         {
-            return device.DeviceAddr + device.DeviceEpoint;
+            return this.GetDeviceMainKeys(device.DeviceAddr, device.DeviceEpoint);
         }
 
         /// <summary>
@@ -1845,7 +2102,7 @@
         /// <returns></returns>
         public string GetDeviceMainKeys(string DeviceAddr, int DeviceEpoint)
         {
-            return DeviceAddr + DeviceEpoint;
+            return DeviceAddr + "_" + DeviceEpoint;
         }
 
         /// <summary>
@@ -1969,7 +2226,7 @@
             var listCheck = new HashSet<string>();
             Action<string, string> getDeviceAction = (topic, message) =>
             {
-                if (topic == gatewayID + "/" + "DeviceInfoRespon")
+                if (topic == gatewayID + "/DeviceInfoRespon")
                 {
                     try
                     {
@@ -2018,6 +2275,9 @@
                         canBreak = true;
                     }
                 }
+                else if (topic == gatewayID + "/DeviceInfoResponEnd")
+                {
+                }
             };
 
             realWay.Actions += getDeviceAction;
@@ -2063,6 +2323,10 @@
                     }
                     statu = 2;
                 }
+            }
+            else
+            {
+                statu = 1;
             }
             return listDevice;
         }
@@ -2175,6 +2439,35 @@
                     mainDevice.IconPath = "Device/Light.png";
                 }
             }
+            //濡傛灉鏄笁璺户鐢靛櫒鐨勫洖璺殑璇�,榛樿涓虹伅鍏�
+            else if (mainDevice.Type == DeviceType.OnOffOutput)
+            {
+                var myType = this.GetHdlMyDeviceEnumInfo(mainDevice);
+                if (myType != null && myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad)
+                {
+                    if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
+                    {
+                        mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+                    }
+                    if (mainDevice.IsCustomizeImage == false)
+                    {
+                        mainDevice.IconPath = "Device/Light.png";
+                    }
+                }
+            }
+            //濡傛灉鏄┖姘斿紑鍏崇殑璇�
+            else if (mainDevice.Type == DeviceType.AirSwitch)
+            {
+                //绌烘皵寮�鍏抽粯璁や负寮�鍏�
+                if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
+                {
+                    mainDevice.DfunctionType = DeviceFunctionType.A寮�鍏�;
+                }
+                if (mainDevice.IsCustomizeImage == false)
+                {
+                    mainDevice.IconPath = "Device/Switch.png";
+                }
+            }
             //濡傛灉鏄僵鐏殑璇�
             else if (mainDevice.Type == DeviceType.ColorDimmableLight)
             {
@@ -2205,8 +2498,10 @@
             else if (deviceType == DeviceType.IASZone) { device = new IASZone(); }
             else if (deviceType == DeviceType.Repeater) { device = new Repeater(); }
             else if (deviceType == DeviceType.Thermostat) { device = new AC(); }
+            else if (deviceType == DeviceType.FreshAir) { device = new FreshAir(); }
             else if (deviceType == DeviceType.DoorLock) { device = new DoorLock(); }
             else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); }
+            else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); }
             else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
             else { return null; }
 
@@ -2248,68 +2543,92 @@
             }
             this.dicDeviceModelIdEnum = new Dictionary<string, string>();
 
-            //瀹氫箟瑙勫垯锛氭ā鍧桰D(宸茬炕璇�)=璁惧鍏蜂綋绫诲瀷鍊�-璁惧鎵�灞炵被鍨嬪��(鑷畾涔夌殑鍊�,鍢�,鍙涓嶉噸澶嶅氨鍙互)
-            //绗竴涓�兼槸:DeviceConcreteType  绗簩涓�兼槸:DeviceBeloneType
-
             //*********************************************************************
             //鏂拌澶囨坊鍔犳柟娉曪細
-            //1銆佸湪杩欓噷濉啓涓婃ā鍧桰D锛岀劧鍚庢槸 DeviceConcreteType 锛岀劧鍚庢槸 DeviceBeloneType
-            //2銆佺劧鍚庡湪鏈�涓嬮潰娣诲姞銆愯澶囩殑鍏蜂綋绫诲瀷銆戯紝銆愯澶囩殑鎵�灞炵被鍨嬨��
+            //1銆佸湪杩欓噷濉啓涓婃ā鍧桰D锛岀劧鍚庢槸 DeviceConcreteType 锛岀劧鍚庢槸 DeviceBeloneType , 鐒跺悗鏄� 璁惧绫诲瀷鐨勭炕璇慖D
+            //2銆佺劧鍚庡湪鏈�涓嬮潰鐨勩�愯嚜瀹氫箟璁惧绫诲瀷銆戞姌鍙犳爮閲屾坊鍔犮�愯澶囩殑鍏蜂綋绫诲瀷銆戯紝銆愯澶囩殑鎵�灞炵被鍨嬨��
             //3銆佷互璁惧鐨勫叿浣撶被鍨嬩负鍚嶅瓧(鍘绘帀銆�-銆�)娣诲姞璁惧鐨勩�愭墍灞炲浘鐗囥�戯紝銆愮湡瀹炵墿鐞嗗浘鐗囥�戙�傚洖璺浘鐗囬渶瑕佺壒娈婂鐞�
-            //4銆佹坊鍔燫鏂囦欢,娣诲姞Language鏂囦欢
+            //4銆佹坊鍔燫鏂囦欢(uDeviceModelId),娣诲姞Language鏂囦欢
+            //5銆佸鏋滈渶瑕佸叡鏈夊浘鐗�,鍒欏湪杩欎釜鍑芥暟鐨勬渶搴曚笅娣诲姞
             //*********************************************************************
 
+            //鍓嶈█锛氬洜涓簔igbeehome鐨勮澶囨嫢鏈夊洓绉嶅悕瀛楋細
+            //1銆佽澶囧畼鏂瑰悕绉�            ----瀹冪敱DeviceConcreteType鐨勬暟鍊兼墍鍐冲畾(涓汉涓績涓撶敤)
+            //2銆佽澶囧叆缃戝悗鐨勯粯璁ゅ悕绉�    ----瀹冧笉闇�瑕佸湪浠g爜閲岄潰瀹氫箟,瀹冪洿鎺ュ湪Language鏂囦欢閲岄潰瀹氫箟
+            //                               鑼冨洿锛�50000寮�濮�,瀹冪殑瑙勫垯鏄疍eviceConcreteType瀵瑰簲鐨凴鏂囦欢閲岄潰鐨処D鐨勬暟鍊�+20000,
+            //3銆佽澶囨墍灞炲悕绉�            ----瀹冩湁DeviceBeloneType鐨勬暟鍊兼墍鍐冲畾
+            //4銆佽澶囩被鍨嬪悕绉�            ----瀹冪敱銆愯澶囩被鍨嬬殑缈昏瘧ID銆戞墍鍐冲畾,杩欎釜鍊兼槸涓汉涓績涓撶敤,
+            //                               瀹冩槸Language鏂囦欢閲岄潰鐨� 60000涔嬪悗鐨勯偅浜涘��
+
+            //瀹氫箟瑙勫垯锛氭ā鍧桰D(宸茬炕璇�) = 璁惧鍏蜂綋绫诲瀷鍊� - 璁惧鎵�灞炵被鍨嬪�� - 璁惧绫诲瀷鐨勭炕璇慖D
+            //璁惧鍏蜂綋绫诲瀷鍊硷細DeviceConcreteType(鍦ㄨ繖涓枃浠舵渶涓嬮潰杩涜瀹氫箟)
+            //璁惧鎵�灞炵被鍨嬪��: DeviceBeloneType(鑷畾涔夌殑鍊�,鍢�,鍙涓嶉噸澶嶅氨鍙互,鍦ㄨ繖涓枃浠舵渶涓嬮潰杩涜瀹氫箟)
+            //璁惧绫诲瀷鐨勭炕璇慖D:杩欎釜鍊兼槸涓汉涓績涓撶敤,瀹冩槸Language鏂囦欢閲岄潰鐨� 60000涔嬪悗鐨勯偅浜涘��
+
             //=========鈽呪槄寮�鍚堝笜绫�(100-199)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MWM65B-ZB.20"] = "100-100";//鏅鸿兘寮�鍚堝笜鐢垫満
-            this.dicDeviceModelIdEnum["MVSM35B-ZB.20"] = "101-100";//鏅鸿兘绠$姸鐢垫満
+            this.dicDeviceModelIdEnum["MWM65B-ZB.20"] = "100-100-60002";//鏅鸿兘寮�鍚堝笜鐢垫満
+            this.dicDeviceModelIdEnum["MVSM35B-ZB.20"] = "101-100-60002";//鏅鸿兘绠$姸鐢垫満
 
             //=========鈽呪槄鎸夐敭闈㈡澘绫�(200-1199)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MPT4/R4-ZB.18"] = "200-200";//4鎸夐敭瑙︽懜闈㈡澘(甯�4璺户鐢靛櫒搴曞骇)
-            this.dicDeviceModelIdEnum["MPT3/R3-ZB.18"] = "201-200";//3鎸夐敭瑙︽懜闈㈡澘
-            this.dicDeviceModelIdEnum["MPT2/R2-ZB.18"] = "202-200";//2鎸夐敭瑙︽懜闈㈡澘
-            this.dicDeviceModelIdEnum["MPT1/R1-ZB.18"] = "203-200";//12鎸夐敭瑙︽懜闈㈡澘
-            this.dicDeviceModelIdEnum["MPT4-ZB.18"] = "210-200";//4鎸夐敭瑙︽懜闈㈡澘(鍙甫鐢垫簮搴曞骇)
-            this.dicDeviceModelIdEnum["MPT4R4L/S-ZB.18"] = "220-200";//绠�绾�4鎸夐敭闈㈡澘
-            this.dicDeviceModelIdEnum["MPT3R3L/S-ZB.18"] = "221-200";//绠�绾�3鎸夐敭闈㈡澘
-            this.dicDeviceModelIdEnum["MPT2R2L/S-ZB.18"] = "222-200";//绠�绾�2鎸夐敭闈㈡澘
-            this.dicDeviceModelIdEnum["MP2B/TILE-ZB.18"] = "240-200";//鏂规偊2鎸夐敭杞昏Е寮忛潰鏉�
-            this.dicDeviceModelIdEnum["MP4B/TILE-ZB.18"] = "241-200";//鏂规偊4鎸夐敭杞昏Е寮忛潰鏉�
-            this.dicDeviceModelIdEnum["MP8B/TILE-ZB.18"] = "242-200";//鏂规偊8鎸夐敭杞昏Е寮忛潰鏉�
-            this.dicDeviceModelIdEnum["MPFA/TILE-ZB.18"] = "250-200";//鏂规偊鏂伴闈㈡澘
-            this.dicDeviceModelIdEnum["MPTE3/TILE-ZB.18"] = "253-200";//鏂规偊鐜闈㈡澘
+            this.dicDeviceModelIdEnum["MPT4/R4-ZB.18"] = "200-200-60003";//4鎸夐敭瑙︽懜闈㈡澘(甯�4璺户鐢靛櫒搴曞骇)
+            this.dicDeviceModelIdEnum["MPT3/R3-ZB.18"] = "201-200-60003";//3鎸夐敭瑙︽懜闈㈡澘
+            this.dicDeviceModelIdEnum["MPT2/R2-ZB.18"] = "202-200-60003";//2鎸夐敭瑙︽懜闈㈡澘
+            this.dicDeviceModelIdEnum["MPT1/R1-ZB.18"] = "203-200-60003";//12鎸夐敭瑙︽懜闈㈡澘
+            this.dicDeviceModelIdEnum["MPT4-ZB.18"] = "210-200-60003";//4鎸夐敭瑙︽懜闈㈡澘(鍙甫鐢垫簮搴曞骇)
+            this.dicDeviceModelIdEnum["MPT4R4L/S-ZB.18"] = "220-200-60003";//绠�绾�4鎸夐敭闈㈡澘
+            this.dicDeviceModelIdEnum["MPT3R3L/S-ZB.18"] = "221-200-60003";//绠�绾�3鎸夐敭闈㈡澘
+            this.dicDeviceModelIdEnum["MPT2R2L/S-ZB.18"] = "222-200-60003";//绠�绾�2鎸夐敭闈㈡澘
+            this.dicDeviceModelIdEnum["MPT4SC/S-ZB.18"] = "224-200-60003";//绠�绾�4鎸夐敭鍦烘櫙闈㈡澘
+            this.dicDeviceModelIdEnum["MPT2W/S-ZB.18"] = "226-200-60003";//绠�绾�2璺獥甯橀潰鏉�
+            this.dicDeviceModelIdEnum["MP2B/TILE-ZB.18"] = "240-200-60003";//鏂规偊鍗曞紑鍙屾帶闈㈡澘
+            this.dicDeviceModelIdEnum["MP4B/TILE-ZB.18"] = "241-200-60003";//鏂规偊鍙屽紑鍥涙帶闈㈡澘
+            this.dicDeviceModelIdEnum["MP8B/TILE-ZB.18"] = "242-200-60003";//鏂规偊鍥涘紑鍏帶闈㈡澘
+            this.dicDeviceModelIdEnum["MPFA/TILE-ZB.18"] = "250-200-60003";//鏂规偊鏂伴闈㈡澘
+            this.dicDeviceModelIdEnum["MPTE3/TILE-ZB.18"] = "253-200-60003";//鏂规偊鐜闈㈡澘
+            this.dicDeviceModelIdEnum["MP2W/TILE-ZB.18"] = "256-200-60003";//绐楀笜闈㈡澘
 
             //=========鈽呪槄PIR浼犳劅鍣ㄧ被(1200-1299)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200";//pir浼犳劅鍣�220
+            this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir浼犳劅鍣�220
 
             //=========鈽呪槄瀹夐槻绫讳紶鎰熷櫒绫�(1300-2299)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MULTI-GASE--EA07"] = "1300-1300";//鐕冩皵浼犳劅鍣�
-            this.dicDeviceModelIdEnum["MULTI-MECI--EA01"] = "1301-1300";//闂ㄧ獥纾佷紶鎰熷櫒
-            this.dicDeviceModelIdEnum["MULTI-FIRE--EA05"] = "1302-1300";//鐑熼浘浼犳劅鍣�
-            this.dicDeviceModelIdEnum["MULTI-MOTI--EA04"] = "1303-1300";//绾㈠浼犳劅鍣�
-            this.dicDeviceModelIdEnum["MULTI-WATE--EA02"] = "1304-1300";//姘存蹈浼犳劅鍣�
-            this.dicDeviceModelIdEnum["MULTI-BURO--EA06"] = "1305-1300";//绱ф�ユ寜閿�
+            //杩欓噷鏄害涔愬厠鐨�
+            this.dicDeviceModelIdEnum["MULTI-GASE--EA07"] = "1300-1300-60000";//鐕冩皵浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MULTI-MECI--EA01"] = "1301-1300-60000";//闂ㄧ獥纾佷紶鎰熷櫒
+            this.dicDeviceModelIdEnum["MULTI-FIRE--EA05"] = "1302-1300-60000";//鐑熼浘浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MULTI-MOTI--EA04"] = "1303-1300-60000";//绾㈠浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MULTI-WATE--EA02"] = "1304-1300-60000";//姘存蹈浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MULTI-BURO--EA06"] = "1305-1300-60000";//绱ф�ユ寜閿�
+            //杩欓噷鏄渤涓滅殑
+            this.dicDeviceModelIdEnum["MSG01/M-ZB.10"] = "1300-1300-60000";//鐕冩皵浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MSDC01/M-ZB.10"] = "1301-1300-60000";//闂ㄧ獥纾佷紶鎰熷櫒
+            this.dicDeviceModelIdEnum["MSS01/M-ZB.10"] = "1302-1300-60000";//鐑熼浘浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MSPIR01/M-ZB.10"] = "1303-1300-60000";//绾㈠浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1304-1300-60000";//姘存蹈浼犳劅鍣�
+            this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1300-60000";//绱ф�ユ寜閿�
 
             //=========鈽呪槄缁х數鍣ㄧ被(2300-2499)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300";//3璺户鐢靛櫒灏忔ā鍧�
+            this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3璺户鐢靛櫒灏忔ā鍧�
+            this.dicDeviceModelIdEnum["MFA01-ZB.10"] = "2310-2300-60011";//鏂规偊鏂伴灏忔ā鍧�
 
             //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MPD0101-ZB.10"] = "2500-2500";//1璺皟鍏夊櫒灏忔ā鍧�
+            this.dicDeviceModelIdEnum["MPD0101-ZB.10"] = "2500-2500-60007";//1璺皟鍏夊櫒灏忔ā鍧�
 
             //=========鈽呪槄鏅鸿兘闂ㄩ攣绫�(2800-????)鈽呪槄=========
-            this.dicDeviceModelIdEnum["H06C"] = "2800-2800";//鏅鸿兘闂ㄩ攣(H06C)
+            this.dicDeviceModelIdEnum["H06C"] = "2800-2800-60010";//鏅鸿兘闂ㄩ攣(H06C)
+            this.dicDeviceModelIdEnum["S-one"] = "2802-2800-60010";//鏅鸿兘闂ㄩ攣(S-one)
 
             //=========鈽呪槄绌鸿皟绫�(3600-3899)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MAC/GW-ZB.10"] = "3600-3600";//zigbee绌鸿皟缃戝叧妯″潡
+            this.dicDeviceModelIdEnum["MAC/GW-ZB.10"] = "3600-3600-60009";//zigbee绌鸿皟缃戝叧妯″潡
 
             //=========鈽呪槄涓户鍣ㄧ被(3900-3999)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MSR-ZB.10"] = "3900-3900"; //zigbee涓户鍣�
+            this.dicDeviceModelIdEnum["MSR-ZB.10"] = "3900-3900-60006"; //zigbee涓户鍣�
 
             //=========鈽呪槄绌烘皵寮�鍏崇被(4100-4199)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MBCI01-ZB.10"] = "4100-4100";//zigbee寰柇浜戞帶鍒跺櫒
+            this.dicDeviceModelIdEnum["MBCI01-ZB.10"] = "4100-4100-60001";//zigbee寰柇浜戞帶鍒跺櫒
 
             //=========鈽呪槄杞崲鍣ㄧ被(4200-4699)鈽呪槄=========
-            this.dicDeviceModelIdEnum["MBUS/GW-ZB.10"] = "4200-4200";//zigbee杞琤uspro鍗忚杞崲鍣�
-            this.dicDeviceModelIdEnum["M485/GW-ZB.10"] = "4201-4200";//zigbee杞�485鍗忚杞崲鍣�
+            this.dicDeviceModelIdEnum["MBUS/GW-ZB.10"] = "4200-4200-60008";//zigbee杞琤uspro鍗忚杞崲鍣�
+            this.dicDeviceModelIdEnum["M485/GW-ZB.10"] = "4201-4200-60008";//zigbee杞�485鍗忚杞崲鍣�
 
 
 
@@ -2326,10 +2645,15 @@
 
 
             //鉁┾湬鉁┾湬鉁╅渶瑕佸叡鏈夌殑鍥剧墖瀵硅薄鉁┾湬鉁┾湬鉁�
+            //涓よ�呴兘鏄疍eviceConcreteType
+            //Keys:鎸囧畾鐨勮澶�    value:娌跨敤鐨勫浘鐗囨槸鍝璁惧鐨�
             this.dicPictrueShard = new Dictionary<string, string>();
             this.dicPictrueShard["ButtonPanel_SimpleFour"] = "ButtonPanel_Four";//绠�绾�4鎸夐敭闈㈡澘 娌跨敤 4鎸夐敭鐨勫浘鏍�
             this.dicPictrueShard["ButtonPanel_SimpleThree"] = "ButtonPanel_Three";//绠�绾�3鎸夐敭闈㈡澘 娌跨敤 3鎸夐敭鐨勫浘鏍�
             this.dicPictrueShard["ButtonPanel_SimpleTwo"] = "ButtonPanel_Two";//绠�绾�2鎸夐敭闈㈡澘 娌跨敤 2鎸夐敭鐨勫浘鏍�
+            this.dicPictrueShard["IntelligentLocks_Sone"] = "IntelligentLocks_H06C";//S-one鐨勯棬閿佸浘鐗囨部鐢℉06C鐨勫浘鏍�
+            this.dicPictrueShard["Relay_FangyueFreshAirModul"] = "Relay_ThreeLoad";//鏂规偊鏂伴灏忔ā鍧楀浘鐗囨部鐢�3璺户鐢靛櫒鐨勫浘鏍�
+
         }
 
         #endregion
@@ -2402,6 +2726,14 @@
         /// </summary>
         ButtonPanel_SimpleTwo = 222,
         /// <summary>
+        /// 绠�绾�4鎸夐敭鍦烘櫙闈㈡澘 闀滃儚id锛�224
+        /// </summary>
+        ButtonPanel_FourButtonScene = 224,
+        /// <summary>
+        /// 绠�绾�2璺獥甯橀潰鏉� 闀滃儚id锛�226
+        /// </summary>
+        ButtonPanel_TwoButtonCurtain = 226,
+        /// <summary>
         /// 鏂规偊2鎸夐敭杞昏Е寮忛潰鏉� 闀滃儚id锛�240
         /// </summary>
         ButtonPanel_FangyueTwo = 240,
@@ -2416,11 +2748,15 @@
         /// <summary>
         /// 鏂规偊鏂伴闈㈡澘 闀滃儚id锛�250
         /// </summary>
-        ButtonPanel_FangyueNewWind = 250,
+        ButtonPanel_FangyueFreshAir = 250,
         /// <summary>
         /// 鏂规偊鐜闈㈡澘 闀滃儚id锛�253
         /// </summary>
         ButtonPanel_FangyueEnvironment = 253,
+        /// <summary>
+        /// 绐楀笜闈㈡澘 闀滃儚id锛�256
+        /// </summary>
+        ButtonPanel_Curtain = 256,
 
         //=========鈽呪槄PIR浼犳劅鍣ㄧ被(1200-1299)鈽呪槄=========
         /// <summary>
@@ -2487,7 +2823,11 @@
         /// 涓夎矾缁х數鍣� 闀滃儚id锛�2300
         /// </summary>
         Relay_ThreeLoad = 2300,
-
+        /// <summary>
+        /// 鏂规偊鏂伴灏忔ā鍧� 闀滃儚id锛�2310
+        /// </summary>
+        Relay_FangyueFreshAirModul = 2310,
+		
         //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄=========
         /// <summary>
         /// 璋冨厜鍣�
@@ -2507,6 +2847,10 @@
         /// H06C
         /// </summary>
         IntelligentLocks_H06C = 2800,
+        /// <summary>
+        /// S-one
+        /// </summary>
+        IntelligentLocks_Sone = 2802,
 
         //=========鈽呪槄褰╃伅绫�(????-????)鈽呪槄=========
         /// <summary>

--
Gitblit v1.8.0