From 21736b2944d5e88cd705a39ff87fd73d5a16e609 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期六, 09 五月 2020 11:06:35 +0800
Subject: [PATCH] 安川

---
 ZigbeeApp/Shared/Common/Device.cs |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index fa6b160..97dbff4 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -628,6 +628,9 @@
         /// <param name="deleteRoom">鏄惁浠庢埧闂村垹闄�</param>
         public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
         {
+            //鍒犻櫎缂撳瓨璁惧鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
+            Phone.UserView.UserPage.Instance.RefreshForm = true;
+
             if (deleteRoom == true)
             {
                 //浠庢埧闂翠腑鍒犻櫎
@@ -2086,6 +2089,50 @@
 
         #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 dicDevice = new Dictionary<string, CommonDevice>();
+            foreach (var device in listDevice)
+            {
+                if (dicDevice.ContainsKey(device.DeviceAddr) == false)
+                {
+                    dicDevice[device.DeviceAddr] = device;
+                    continue;
+                }
+                //璁惧鏄惁澶勪簬鍦ㄧ嚎鐘舵��
+                bool online = this.CheckDeviceIsOnline(device);
+                if (online == true)
+                {
+                    //濡傛灉璁惧鍥炶矾鍦ㄧ嚎,鍒欎紭鍏堜娇鐢ㄥ湪绾跨殑鍥炶矾,鍚庢潵鐨勭洿鎺ヨ鐩�
+                    dicDevice[device.DeviceAddr] = device;
+                }
+            }
+            var listReturn = new List<CommonDevice>();
+            foreach (var device in dicDevice.Values)
+            {
+                listReturn.Add(device);
+            }
+            return listReturn;
+        }
+
+        #endregion
+
         #region 鈻� 涓�鑸柟娉昣__________________________
 
         /// <summary>
@@ -2673,6 +2720,9 @@
             this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1200-60000";//绱ф�ユ寜閿�
             this.dicDeviceModelIdEnum["MGCD01/ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣�
 
+            //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 銆愯璁惧灞炰簬绗笁鏂硅澶囷紝娌℃湁闀滃儚ID銆�
+            this.dicDeviceModelIdEnum["SZ_PM100"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 
+
             //=========鈽呪槄缁х數鍣ㄧ被(2300-2499)鈽呪槄=========
             this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3璺户鐢靛櫒灏忔ā鍧�
             this.dicDeviceModelIdEnum["MFA01-ZB.10"] = "2310-2300-60011";//鏂规偊鏂伴灏忔ā鍧�
@@ -2864,6 +2914,11 @@
         /// </summary>
         Sensor_CeilingGas = 1306,
         /// <summary>
+        /// PM2.5绌烘皵璐ㄩ噺浼犳劅鍣�
+        /// </summary>
+        Sensor_PMTwoPointFive = 1307,
+
+        /// <summary>
         /// 杩愬姩浼犳劅鍣�
         /// </summary>
         Sensor_Motion = -1306,

--
Gitblit v1.8.0