From f23ad1b3f9f6193f35f72104d690b21dc67d5c1f Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 06 七月 2020 12:35:25 +0800
Subject: [PATCH] 去掉了访问外网的异步

---
 ZigbeeApp/Shared/Common/Device.cs |   75 ++++++++++++++++++++-----------------
 1 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index cd8dc6a..a436fb3 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -551,7 +551,7 @@
 
             //鑾峰彇缂栬緫璁惧Mac鍚嶅瓧鐨勫懡浠ゅ瓧绗�
             var sendData = this.GetReDeviceMacNameCommandText(device.DeviceAddr, device.DeviceEpoint, macName);
-            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "MacRename", sendData, "MacRename_Respon");
+            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "MacRename", sendData, "MacRename_Respon", 8);
             if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
             {
                 return null;
@@ -578,7 +578,7 @@
             }
             //鑾峰彇缂栬緫璁惧绔偣鍚嶅瓧鐨勫懡浠ゅ瓧绗�
             var sendData = this.GetReDeviceEpointNameCommandText(device.DeviceAddr, device.DeviceEpoint, deviceName);
-            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "DeviceRename", sendData, "DeviceRenameRespon");
+            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "DeviceRename", sendData, "DeviceRenameRespon", 8);
             if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
             {
                 return null;
@@ -2161,6 +2161,12 @@
                 info.ConcreteType = DeviceConcreteType.Sensor_DoorWindow;
                 info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1301;
             }
+            else if (iasZone.IasDeviceType == 541)
+            {
+                //鐞冨瀷绉诲姩浼犳劅鍣�
+                info.ConcreteType = DeviceConcreteType.Sensor_SphericalMotion;
+                info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1205;
+            }
         }
 
         #endregion
@@ -2400,39 +2406,6 @@
             list.Add(DeviceBeloneType.A鏈煡璁惧);
             
             return list;
-        }
-
-        #endregion
-
-        #region 鈻� 鑾峰彇璁惧鍦ㄧ嚎鐘舵�佸垪琛╛______________
-
-        /// <summary>
-        /// 鑾峰彇璁惧鍦ㄧ嚎鐘舵�佸垪琛�(娉ㄦ剰,涓�涓澶囧彧杩斿洖涓�涓洖璺�)
-        /// </summary>
-        /// <param name="gwId">缃戝叧id</param>
-        /// <returns></returns>
-        public List<CommonDevice> GetDeviceOnlineList(string gwId)
-        {
-            var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
-            int statu = 0;
-            var listDevice = this.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
-            if (statu == -1)
-            {
-                //褰撳嚭鐜板紓甯告椂,浣跨敤鍚庡鎿嶄綔,鐩存帴鑾峰彇鏈湴鐨勮澶囧垪琛�
-                listDevice = this.GetDeviceByGatewayID(gwId);
-            }
-
-            var listCheck = new HashSet<string>();
-            var listReturn = new List<CommonDevice>();
-            foreach (var device in listDevice)
-            {
-                if (listCheck.Contains(device.DeviceAddr) == false)
-                {
-                    listCheck.Add(device.DeviceAddr);
-                    listReturn.Add(device);
-                }
-            }
-            return listReturn;
         }
 
         #endregion
@@ -2862,6 +2835,8 @@
             mainDevice.ModelIdentifier = device.DeviceInfo.ModelIdentifier;
             //搴忓垪鍙�
             mainDevice.SerialNumber = device.DeviceInfo.ProductCode;
+            //璁惧鍔熻兘绫诲瀷
+            mainDevice.DfunctionType = (DeviceFunctionType)device.DeviceInfo.FunctionType;
 
             mainDevice.InClusterList.Clear();
             mainDevice.InClusterList.AddRange(device.DeviceInfo.InClusterList);
@@ -2888,6 +2863,11 @@
             else if (mainDevice.Type == DeviceType.DimmableLight)
             {
                 mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+                if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+                {
+                    //璋冨厜鍣ㄥ浐瀹氱伅鍏�
+                    this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
+                }
                 if (mainDevice.IsCustomizeImage == false)
                 {
                     mainDevice.IconPath = "Device/Light.png";
@@ -2897,6 +2877,11 @@
             else if (mainDevice.Type == DeviceType.ColorTemperatureLight)
             {
                 mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+                if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+                {
+                    //鑹叉俯鐏浐瀹氱伅鍏�
+                    this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
+                }
                 if (mainDevice.IsCustomizeImage == false)
                 {
                     mainDevice.IconPath = "Device/ColorLightTemperature.png";
@@ -2912,6 +2897,11 @@
                     if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
                     {
                         mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+                        if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+                        {
+                            //缁х數鍣ㄩ粯璁や负鐏厜
+                            this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
+                        }
                     }
                     if (mainDevice.IsCustomizeImage == false)
                     {
@@ -2926,6 +2916,11 @@
                 if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
                 {
                     mainDevice.DfunctionType = DeviceFunctionType.A寮�鍏�;
+                    if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A寮�鍏�)
+                    {
+                        //绌烘皵寮�鍏抽粯璁や负寮�鍏�
+                        this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A寮�鍏�);
+                    }
                 }
                 if (mainDevice.IsCustomizeImage == false)
                 {
@@ -2936,6 +2931,11 @@
             else if (mainDevice.Type == DeviceType.ColorDimmableLight)
             {
                 mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+                if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+                {
+                    //褰╃伅榛樿涓哄紑鍏�
+                    this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
+                }
                 if (mainDevice.IsCustomizeImage == false)
                 {
                     mainDevice.IconPath = "Device/ColorLight.png";
@@ -3060,6 +3060,7 @@
 
             //=========鈽呪槄PIR浼犳劅鍣ㄧ被(1200-1299)鈽呪槄=========
             this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir浼犳劅鍣�220
+            this.dicDeviceModelIdEnum["MSPIRB-ZB.10"] = "1205-1200-60000";//鐞冨瀷绉诲姩浼犳劅鍣�
 
             //=========鈽呪槄瀹夐槻绫讳紶鎰熷櫒绫�(1300-2299)鈽呪槄=========
             //杩欓噷鏄害涔愬厠鐨�
@@ -3249,6 +3250,10 @@
         /// pir浼犳劅鍣�220 闀滃儚id锛�1200
         /// </summary>
         Sensor_Pir = 1200,
+        /// <summary>
+        /// 鐞冨舰绉诲姩浼犳劅鍣� 闀滃儚id锛�1205
+        /// </summary>
+        Sensor_SphericalMotion = 1205,
 
         //=========鈽呪槄瀹夐槻绫讳紶鎰熷櫒绫�(1300-2299)鈽呪槄=========
         /// <summary>

--
Gitblit v1.8.0