From 23532fa8ad34c89b6d24b01eaef6475fd0aad898 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 15 四月 2020 18:08:24 +0800
Subject: [PATCH] ???????

---
 ZigbeeApp/Shared/Common/Device.cs |   97 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 79 insertions(+), 18 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index 85f3d03..0f8e7c2 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -980,17 +980,45 @@
                 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) + device.DeviceEpoint;
+                return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + epointNo;
             }
-            else if (device.Type == DeviceType.Thermostat)
+            if (device.Type == DeviceType.Thermostat)
             {
                 //绌鸿皟閮藉彨瀹ゅ唴鏈�
-                return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + device.DeviceEpoint;
+                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 (device.Type == DeviceType.OnOffSwitch)
@@ -998,16 +1026,29 @@
                 //闈㈡澘鐨勫共鎺ョ偣鍙寜閿�
                 if (deviceInfoType.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
                 {
-                    return Language.StringByID(R.MyInternationalizationString.uPanelButton) + device.DeviceEpoint;
+                    return Language.StringByID(R.MyInternationalizationString.uPanelButton) + epointNo;
                 }
                 //鍏朵粬鐨勫共鎺ョ偣鍙共鎺ョ偣
                 else
                 {
-                    return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + device.DeviceEpoint;
+                    return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + epointNo;
+                }
+            }
+            else if (device.Type == DeviceType.TemperatureSensor)
+            {
+                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 Language.StringByID(deviceInfoType.DefultNameId) + device.DeviceEpoint;
+            return Language.StringByID(deviceInfoType.DefultNameId) + epointNo;
         }
 
         /// <summary>
@@ -1571,7 +1612,7 @@
             {
                 //榛樿鍊�
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId4100;
-                info.BeloneType = DeviceBeloneType.A鏅鸿兘绌哄紑;
+                info.BeloneType = DeviceBeloneType.A寮�鍏�;
                 info.ConcreteType = DeviceConcreteType.AirSwitch;
                 info.ObjectTypeNameId = 60001;//寮�鍏虫ā鍧�
 
@@ -1869,12 +1910,7 @@
                 return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
             }
             var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
-            if (room != null)
-            {
-                return room.Name;
-            }
-            //鏈垎閰嶅尯鍩�
-            return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
+            return HdlRoomLogic.Current.GetFloorRoomName(room);
         }
 
         /// <summary>
@@ -2009,10 +2045,22 @@
                 //杩欎釜璁惧涓嶈浜�
                 return false;
             }
-            if (i_device.Type == DeviceType.OnOffOutput && i_device.DfunctionType == DeviceFunctionType.A鏈畾涔�)
+            if (i_device.Type == DeviceType.OnOffOutput || i_device.Type == DeviceType.AirSwitch)
             {
                 //2020.03.23杩藉姞寮忔牱:鏈寚瀹氱被鍨嬬殑缁х數鍣�,涓嶆樉绀�
-                return false;
+                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)
@@ -2178,7 +2226,7 @@
             var listCheck = new HashSet<string>();
             Action<string, string> getDeviceAction = (topic, message) =>
             {
-                if (topic == gatewayID + "/" + "DeviceInfoRespon")
+                if (topic == gatewayID + "/DeviceInfoRespon")
                 {
                     try
                     {
@@ -2226,6 +2274,9 @@
                         //璁惧鍏ㄩ儴鎺ユ敹瀹屾垚
                         canBreak = true;
                     }
+                }
+                else if (topic == gatewayID + "/DeviceInfoResponEnd")
+                {
                 }
             };
 
@@ -2447,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; }
 
@@ -2501,7 +2554,7 @@
 
             //鍓嶈█锛氬洜涓簔igbeehome鐨勮澶囨嫢鏈夊洓绉嶅悕瀛楋細
             //1銆佽澶囧畼鏂瑰悕绉�            ----瀹冪敱DeviceConcreteType鐨勬暟鍊兼墍鍐冲畾(涓汉涓績涓撶敤)
-            //2銆佽澶囧叆缃戝悗鐨勯粯璁ゅ悕绉�    ----瀹冧笉闇�瑕佸啀浠g爜閲岄潰瀹氫箟,瀹冪洿鎺ュ湪Language鏂囦欢閲岄潰瀹氫箟
+            //2銆佽澶囧叆缃戝悗鐨勯粯璁ゅ悕绉�    ----瀹冧笉闇�瑕佸湪浠g爜閲岄潰瀹氫箟,瀹冪洿鎺ュ湪Language鏂囦欢閲岄潰瀹氫箟
             //                               鑼冨洿锛�50000寮�濮�,瀹冪殑瑙勫垯鏄疍eviceConcreteType瀵瑰簲鐨凴鏂囦欢閲岄潰鐨処D鐨勬暟鍊�+20000,
             //3銆佽澶囨墍灞炲悕绉�            ----瀹冩湁DeviceBeloneType鐨勬暟鍊兼墍鍐冲畾
             //4銆佽澶囩被鍨嬪悕绉�            ----瀹冪敱銆愯澶囩被鍨嬬殑缈昏瘧ID銆戞墍鍐冲畾,杩欎釜鍊兼槸涓汉涓績涓撶敤,
@@ -2538,16 +2591,24 @@
             this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir浼犳劅鍣�220
 
             //=========鈽呪槄瀹夐槻绫讳紶鎰熷櫒绫�(1300-2299)鈽呪槄=========
+            //杩欓噷鏄害涔愬厠鐨�
             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-60001";//3璺户鐢靛櫒灏忔ā鍧�
-            this.dicDeviceModelIdEnum["MFA01-ZB1.0"] = "2310-2300-60001";//鏂规偊鏂伴灏忔ā鍧�
+            this.dicDeviceModelIdEnum["MFA01-ZB.10"] = "2310-2300-60011";//鏂规偊鏂伴灏忔ā鍧�
 
             //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄=========
             this.dicDeviceModelIdEnum["MPD0101-ZB.10"] = "2500-2500-60007";//1璺皟鍏夊櫒灏忔ā鍧�

--
Gitblit v1.8.0