From da3634e011bbda29cf4e1c168997b780fe795b20 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期三, 13 五月 2020 09:05:23 +0800 Subject: [PATCH] 优化新风模块和新风面板的测试功能,请合并代码 --- ZigbeeApp/Shared/Common/Device.cs | 67 +++++++++++++++++++++++++++++++-- 1 files changed, 62 insertions(+), 5 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index 9c73532..53787a6 100644 --- 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) { //浠庢埧闂翠腑鍒犻櫎 @@ -1811,6 +1814,14 @@ info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul; info.ObjectTypeNameId = 60011;//鏂伴 } + //15 PM2.5浼犳劅鍣ㄨ澶� + else if (dicType.ContainsKey(DeviceType.PMSensor) == true) + { + info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1307; + info.BeloneType = DeviceBeloneType.A浼犳劅鍣�; + info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive; + info.ObjectTypeNameId = 60000;//浼犳劅鍣� + } int value = (int)info.BeloneType; if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true) @@ -2082,6 +2093,50 @@ 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 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 @@ -2454,6 +2509,7 @@ mainDevice.DeviceEpointName = device.DeviceInfo.DeviceName; } mainDevice.CurrentGateWayId = device.CurrentGateWayId; + mainDevice.ZigbeeType = device.DeviceInfo.ZigbeeType; mainDevice.IsOnline = device.DeviceInfo.IsOnline; mainDevice.DriveCode = device.DeviceInfo.DriveCode; mainDevice.IasDeviceType = device.DeviceInfo.DeviceType; @@ -2567,6 +2623,7 @@ 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.PMSensor) { device = new PMSensor(); } else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); } else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); } else { return null; } @@ -2865,12 +2922,12 @@ /// <summary> /// 鍚搁《鐕冩皵浼犳劅鍣� /// </summary> - Sensor_CeilingGas = 1306, - /// <summary> - /// PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� - /// </summary> + Sensor_CeilingGas = 1306, + /// <summary> + /// PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� + /// </summary> Sensor_PMTwoPointFive = 1307, - + /// <summary> /// 杩愬姩浼犳劅鍣� /// </summary> -- Gitblit v1.8.0