From c0c734d7a84cf7105401878ffc4b64cbb67621d1 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期五, 01 十一月 2024 15:02:24 +0800
Subject: [PATCH] 更新极光Sdk531
---
HDL_ON/Entity/Function/Sensor.cs | 143 ++++++++++++++++++++++++++++++++---------------
1 files changed, 96 insertions(+), 47 deletions(-)
diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs
index b53b38a..51e0716 100644
--- a/HDL_ON/Entity/Function/Sensor.cs
+++ b/HDL_ON/Entity/Function/Sensor.cs
@@ -1,5 +1,7 @@
锘縰sing System;
using System.Collections.Generic;
+using Newtonsoft.Json.Linq;
+using Shared;
namespace HDL_ON.Entity
{
@@ -61,6 +63,10 @@
case SPK.SensorHumidity:
attr = function.GetAttribute(FunctionAttributeKey.Humidity);
break;
+ case SPK.SensorPm10:
+ attr = function.GetAttribute(FunctionAttributeKey.Pm10);
+ break;
+
}
}
double value = 0.0;
@@ -78,26 +84,37 @@
function.SetAttrState(FunctionAttributeKey.Value, value);
}
- List<string> _intervalValue = new List<string>();
-
- public void SetIntervalValue(List<string> intervalValue)
- {
- _intervalValue = intervalValue;
- }
/// <summary>
/// 姣忎釜绛夌骇瀵瑰尯闂村��
/// </summary>
- public List<string> GetIntervalValue(string spk)
+ public List<string> GetIntervalValue(Function function)
{
- if(_intervalValue.Count != 0)
+ List<string> _intervalValue = new List<string>();
+ if (function.attrKeyConfigs.Count > 0)
{
- return _intervalValue;
+ foreach (var attrKey in function.attrKeyConfigs)
+ {
+ if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", "")))
+ {
+ foreach (var info in attrKey.configs)
+ {
+ _intervalValue.Add(info.start + " ~ " + info.end);
+ }
+ return _intervalValue;
+ }
+ }
}
- _intervalValue = new List<string>();
- switch (spk)
+
+ switch (function.spk)
{
case SPK.SensorPm25:
+ _intervalValue.Add("0 ~ 50");
+ _intervalValue.Add("51 ~ 100");
+ _intervalValue.Add("101 ~ 150");
+ _intervalValue.Add("151 ~");
+ break;
+ case SPK.SensorPm10:
_intervalValue.Add("0 ~ 35");
_intervalValue.Add("36 ~ 75");
_intervalValue.Add("76 ~ 115");
@@ -145,7 +162,6 @@
if (function.attrKeyConfigs.Count > 0)
{
-
foreach (var attrKey in function.attrKeyConfigs)
{
if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", "")))
@@ -159,7 +175,7 @@
switch (function.spk)
{
case SPK.SensorPm25:
- unit = "ug/m虏";
+ unit = "ug/m鲁";
break;
case SPK.SensorTemperature:
unit = "掳C";
@@ -184,10 +200,25 @@
/// <summary>
/// 姣忎釜绛夌骇鐨勯鑹插��
/// </summary>
- public List<uint> GetLevelColorList(string spk)
+ public List<uint> GetLevelColorList(Function function)
{
var _levelColorList = new List<uint>();
- switch (spk)
+ if (function.attrKeyConfigs.Count > 0)
+ {
+ foreach (var attrKey in function.attrKeyConfigs)
+ {
+ if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", "")))
+ {
+ foreach (var info in attrKey.configs)
+ {
+ _levelColorList.Add(Convert.ToUInt32(info.color, 16));
+ }
+ return _levelColorList;
+ }
+ }
+ }
+
+ switch (function.spk)
{
case SPK.SensorPm25:
_levelColorList.Add(0xFFADE764);
@@ -211,6 +242,7 @@
_levelColorList.Add(0xFFFF3D3D);
break;
case SPK.SensorTVOC:
+ case SPK.SensorPm10:
_levelColorList.Add(0xFFADE764);
_levelColorList.Add(0xFFFFD154);
_levelColorList.Add(0xFFFF9D54);
@@ -240,52 +272,69 @@
/// <summary>
/// 姣忎釜绛夌骇鐨勫悕绉�
/// </summary>
- public List<int> GetLevelTextList(string spk)
+ public List<string> GetLevelTextList(Function function)
{
- var _levelTextList = new List<int>();
- switch (spk)
+ var _levelTextList = new List<string>();
+ if (function.attrKeyConfigs.Count > 0)
+ {
+ foreach (var attrKey in function.attrKeyConfigs)
+ {
+ if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", "")))
+ {
+ foreach (var info in attrKey.configs)
+ {
+ _levelTextList.Add(info.desc);
+ }
+ return _levelTextList;
+ }
+ }
+ }
+
+
+ switch (function.spk)
{
case SPK.SensorPm25:
- _levelTextList.Add(StringId.Great);
- _levelTextList.Add(StringId.Good);
- _levelTextList.Add(StringId.MildPollution);
- _levelTextList.Add(StringId.HeavyPollution);
+ case SPK.SensorPm10:
+ _levelTextList.Add(Language.StringByID(StringId.Great));
+ _levelTextList.Add(Language.StringByID(StringId.Good));
+ _levelTextList.Add(Language.StringByID(StringId.MildPollution));
+ _levelTextList.Add(Language.StringByID(StringId.HeavyPollution));
break;
case SPK.SensorCO2:
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level1);
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level2);
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level3);
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level4);
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level1));
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level2));
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level3));
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTipCO2Level4));
break;
case SPK.SensorTemperature:
- _levelTextList.Add(StringId.ExtremelyCold);
- _levelTextList.Add(StringId.Cold);
- _levelTextList.Add(StringId.SlightlyCold);
- _levelTextList.Add(StringId.Comfortable);
- _levelTextList.Add(StringId.TepidFever);
- _levelTextList.Add(StringId.Heat_SensorTip);
- _levelTextList.Add(StringId.ExtremeHeat);
+ _levelTextList.Add(Language.StringByID(StringId.ExtremelyCold));
+ _levelTextList.Add(Language.StringByID(StringId.Cold));
+ _levelTextList.Add(Language.StringByID(StringId.SlightlyCold));
+ _levelTextList.Add(Language.StringByID(StringId.Comfortable));
+ _levelTextList.Add(Language.StringByID(StringId.TepidFever));
+ _levelTextList.Add(Language.StringByID(StringId.Heat_SensorTip));
+ _levelTextList.Add(Language.StringByID(StringId.ExtremeHeat));
break;
case SPK.SensorTVOC:
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel1);
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel2);
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel3);
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel4);
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel1));
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel2));
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel3));
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceTVOCTipLevel4));
break;
case SPK.SensorHumidity:
- _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel1);
- _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel2);
- _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel3);
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceHumidityTipLevel1));//娼箍
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceHumidityTipLevel2));
+ _levelTextList.Add(Language.StringByID(StringId.SensorReferenceHumidityTipLevel3));//骞茬嚗
break;
case SPK.SensorHcho:
- _levelTextList.Add(StringId.Class_I_BuildingStandard);
- _levelTextList.Add(StringId.SecondaryBuildingStandard);
- _levelTextList.Add(StringId.ExceedingTheStandard);
+ _levelTextList.Add(Language.StringByID(StringId.Class_I_BuildingStandard));
+ _levelTextList.Add(Language.StringByID(StringId.SecondaryBuildingStandard));
+ _levelTextList.Add(Language.StringByID(StringId.ExceedingTheStandard));
break;
default:
- _levelTextList.Add(99999999);
- _levelTextList.Add(99999999);
- _levelTextList.Add(99999999);
+ _levelTextList.Add("");
+ _levelTextList.Add("");
+ _levelTextList.Add("");
break;
}
return _levelTextList;
@@ -378,7 +427,7 @@
}
foreach (var info in attrKey.configs)
{
- if ((Convert.ToDouble(info.start) < values) && (Convert.ToDouble(info.end) >= values))
+ if ((Convert.ToDouble(info.start) <= values) && (Convert.ToDouble(info.end) >= values))
{
return level;
}
--
Gitblit v1.8.0