From d78515ac4ac8cf4a1785d9df18058d6724f12b79 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 14 一月 2021 19:34:59 +0800
Subject: [PATCH] 合并xm2021-01-13  wjc2021-02-06

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs |  117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 112 insertions(+), 5 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs
index ad5d45e..f507873 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs
@@ -17,7 +17,7 @@
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="device"></param>
-        /// <param name="deviceBindType">1:鏂伴;2:娓╁害浼犳劅鍣�;3:婀垮害浼犳劅鍣�;4:PM2.5浼犳劅鍣�;5:绌鸿皟鐩爣,6:鍦版殩鐩爣銆愭殏鏃舵病鍋氾紝鍥犱负娌℃湁璇ヨ澶囷紝鍚庢湡澧炲姞銆�</param>
+        /// <param name="deviceBindType">1:鏂伴;2:娓╁害浼犳劅鍣�;3:婀垮害浼犳劅鍣�;4:PM2.5浼犳劅鍣�;5:绌鸿皟鐩爣,6:鍦版殩鐩爣,7:Co2鐩爣</param>
         /// <param name="bindDev">缁戝畾鐩爣 </param>
         public PaneTargetsBaseForm(CommonDevice device, CommonDevice bindDev, DeviceBind.BindInfo.BindType deviceBindType)
         {
@@ -71,7 +71,8 @@
         /// 3:婀垮害浼犳劅鍣�
         /// 4:PM2.5浼犳劅鍣�
         /// 5:绌鸿皟鐩爣
-        /// 6:鍦版殩鐩爣銆愭殏鏃舵病鍋氾紝鍥犱负娌℃湁璇ヨ澶囷紝鍚庢湡澧炲姞銆�
+        /// 6:鍦版殩鐩爣
+        /// 7:Co2鐩爣
         /// </summary>
         DeviceBind.BindInfo.BindType curDeviceBindType = 0;
         /// <summary>
@@ -131,6 +132,10 @@
         /// </summary>
         public Action<string> actionPMTarget = null;
         /// <summary>
+        /// Co2缁戝畾鐩爣鍥炶皟
+        /// </summary>
+        public Action<string> actionCo2Target = null;
+        /// <summary>
         /// Ac缁戝畾鐩爣鍥炶皟
         /// </summary>
         public Action<string> actionAcTarget = null;
@@ -184,6 +189,9 @@
                 case DeviceBind.BindInfo.BindType.Fh:
                     titleText = Language.StringByID(R.MyInternationalizationString.uFloorHeatingTarget);
                     break;
+                    //case DeviceBind.BindInfo.BindType.CO2:
+                    //titleText = Language.StringByID(R.MyInternationalizationString.CO2Source);
+                    //break;
             }
             this.TopFrameLayout(this, titleText);
             EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
@@ -564,6 +572,8 @@
                 {
                     btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
                 }
+                //鑾峰彇璁惧绫诲瀷
+                var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { device });
                 switch (curDeviceBindType)
                 {
                     case DeviceBind.BindInfo.BindType.FreshAir:
@@ -575,6 +585,11 @@
                         {
                             btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                         }
+                        //绌烘皵璐ㄩ噺浼犳劅鍣�
+                        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                        {
+                            btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                        }
                         break;
                     case DeviceBind.BindInfo.BindType.Humidity:
                         devicePic.UnSelectedImagePath = "Device/SensorHumidity.png";
@@ -582,8 +597,16 @@
                         {
                             btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
                         }
+                        //绌烘皵璐ㄩ噺浼犳劅鍣�
+                        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                        {
+                            btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                        }
                         break;
                     case DeviceBind.BindInfo.BindType.PM:
+                        devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png";
+                        break;
+                    case DeviceBind.BindInfo.BindType.CO2:
                         devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png";
                         break;
                     case DeviceBind.BindInfo.BindType.AC:
@@ -848,6 +871,8 @@
                                     else
                                     {
                                         curControlDev.currentSelectRoomId = "UndistributedId";
+                                        //鐩爣鍦ㄦ湭鍒嗛厤鏃讹紝榛樿绗竴涓ゼ灞�
+                                        curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId();
                                     }
                                 }
 
@@ -862,11 +887,31 @@
                                             {
                                                 bindName += "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                                             }
+                                            if (dev.Type == ZigBee.Device.DeviceType.TemperatureSensor)
+                                            {
+                                                //鑾峰彇璁惧绫诲瀷
+                                                var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { dev });
+                                                //绌烘皵璐ㄩ噺浼犳劅鍣�
+                                                if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                                                {
+                                                    bindName += "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                                                }
+                                            }
                                             break;
                                         case BindInfo.BindType.Humidity:
                                             if (dev.Type == DeviceType.PMSensor)
                                             {
                                                 bindName += "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                                            }
+                                            if (dev.Type == ZigBee.Device.DeviceType.TemperatureSensor)
+                                            {
+                                                //鑾峰彇璁惧绫诲瀷
+                                                var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { dev });
+                                                //绌烘皵璐ㄩ噺浼犳劅鍣�
+                                                if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                                                {
+                                                    bindName += "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                                                }
                                             }
                                             break;
                                     }
@@ -1192,11 +1237,17 @@
                                 case BindInfo.BindType.AC:
                                     addBindInfo.BindCluster = 513;
                                     break;
+                                case BindInfo.BindType.CO2:
+                                    addBindInfo.BindCluster = 1037;
+                                    break;
                             }
                             addBindInfo.BindType = 0;
                             addBindInfo.BindMacAddr = de.DeviceAddr;
                             addBindInfo.BindEpoint = de.DeviceEpoint;
                             addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de);
+
+                            //鑾峰彇璁惧绫诲瀷
+                            var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { de });
                             switch (curDeviceBindType)
                             {
                                 case BindInfo.BindType.Temperature:
@@ -1204,9 +1255,20 @@
                                     {
                                         addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                                     }
+
+                                    //绌烘皵璐ㄩ噺浼犳劅鍣�
+                                    if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                                    {
+                                        addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+                                    }
                                     break;
                                 case BindInfo.BindType.Humidity:
                                     if (de.Type == DeviceType.PMSensor)
+                                    {
+                                        addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+                                    }
+                                    //绌烘皵璐ㄩ噺浼犳劅鍣�
+                                    if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
                                     {
                                         addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
                                     }
@@ -1402,11 +1464,12 @@
         /// <param name="bindDev"></param>
         void BindTypeTargetsList(CommonDevice device, BindListResponseObj bindDev)
         {
+            //鑾峰彇璁惧绫诲瀷鐨�
+            var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
             switch (curDeviceBindType)
             {
                 case BindInfo.BindType.FreshAir:
-                    //鑾峰彇璁惧绫诲瀷鐨�
-                    var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+
                     //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず
                     if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir)
                     {
@@ -1422,7 +1485,18 @@
                         var bDev = device as TemperatureSensor;
                         if (bDev.SensorDiv == 1)
                         {
-                            oldTargetList.Add(device);
+                            //绌烘皵璐ㄩ噺浼犳劅鍣�
+                            if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                            {
+                                if (bindDev.BindCluster == 1026)
+                                {
+                                    oldTargetList.Add(device);
+                                }
+                            }
+                            else
+                            {
+                                oldTargetList.Add(device);
+                            }
                         }
                     }
                     if (device.Type == DeviceType.PMSensor)
@@ -1440,6 +1514,15 @@
                         if (bDev.SensorDiv == 2)
                         {
                             oldTargetList.Add(device);
+                        }
+
+                        //绌烘皵璐ㄩ噺浼犳劅鍣�
+                        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                        {
+                            if (bindDev.BindCluster == 1029)
+                            {
+                                oldTargetList.Add(device);
+                            }
                         }
                     }
                     if (device.Type == DeviceType.FreshAirHumiditySensor)
@@ -1462,6 +1545,17 @@
                             oldTargetList.Add(device);
                         }
                     }
+                    else if (device.Type == ZigBee.Device.DeviceType.TemperatureSensor)
+                    {
+                        //绌烘皵璐ㄩ噺浼犳劅鍣�
+                        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                        {
+                            if (bindDev.BindCluster == 1066)
+                            {
+                                oldTargetList.Add(device);
+                            }
+                        }
+                    }
                     break;
                 case BindInfo.BindType.AC:
                     if (device.Type == DeviceType.Thermostat)
@@ -1472,6 +1566,19 @@
                         }
                     }
                     break;
+                case BindInfo.BindType.CO2:
+                    if (device.Type == ZigBee.Device.DeviceType.TemperatureSensor)
+                    {
+                        //绌烘皵璐ㄩ噺浼犳劅鍣�
+                        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+                        {
+                            if (bindDev.BindCluster == 1037)
+                            {
+                                oldTargetList.Add(device);
+                            }
+                        }
+                    }
+                    break;
             }
 
             targetList.Clear();

--
Gitblit v1.8.0