From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs | 72 +++++++++++++++++++++++++++++------ 1 files changed, 59 insertions(+), 13 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs index 1f1c62e..5bb5fac 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Newtonsoft.Json.Linq; +using Shared; namespace ZigBee.Device { @@ -413,6 +414,43 @@ } /// <summary> + /// 鍒ゆ柇鏄惁鏄┖姘旇川閲忎紶鎰熷櫒 + /// </summary> + /// <param name="dev"></param> + /// <returns></returns> + public bool isAirQualitySensor(CommonDevice dev) + { + bool hasT = false; + bool hasH = false; + bool hasPM = false; + bool hasCo2 = false; + foreach (var clu in dev.InClusterList) + { + switch (clu.InCluster) + { + case 1026: + hasT = true; + break; + case 1029: + hasH = true; + break; + case 1037: + hasCo2 = true; + break; + case 1066: + hasPM = true; + break; + } + } + + if (hasT == true && hasH == true && hasPM == true && hasCo2 == true) + { + return true; + } + return false; + } + + /// <summary> /// 淇濆瓨璁惧鍥炬爣 /// </summary> private void SaveDeviceIcon() @@ -466,15 +504,23 @@ } else if (this.Type == DeviceType.TemperatureSensor) { - if (((TemperatureSensor)this).SensorDiv == 1) + if (isAirQualitySensor(this)) { - //娓╁害浼犳劅鍣� - IconPath = "Device/SensorTemperature.png"; + //绌烘皵璐ㄩ噺浼犳劅鍣� + IconPath = "Device/AirQualitySensorEpoint.png"; } - else if (((TemperatureSensor)this).SensorDiv == 2) + else { - //婀垮害浼犳劅鍣� - IconPath = "Device/SensorHumidity.png"; + if (((TemperatureSensor)this).SensorDiv == 1) + { + //娓╁害浼犳劅鍣� + IconPath = "Device/SensorTemperature.png"; + } + else if (((TemperatureSensor)this).SensorDiv == 2) + { + //婀垮害浼犳劅鍣� + IconPath = "Device/SensorHumidity.png"; + } } } else if (this.Type != DeviceType.UnKown) @@ -2453,13 +2499,13 @@ public static void DebugPrintLog(string msg, bool flage = true) { #if DEBUG - if (flage == true) - { - if (msg.Contains("DeviceStatusReport") == false) - { - System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); - } - } + if (flage == true) + { + if (msg.Contains("DeviceStatusReport") == false) + { + System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); + } + } #endif } -- Gitblit v1.8.0