From f4c86f68b900bd506ef7214b2ae9bd23a9d2ffa8 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期六, 19 十二月 2020 17:48:11 +0800
Subject: [PATCH] 完成筛选房间的功能
---
HDL_ON/Entity/Function/Curtain.cs | 69 +++++++++++-----------------------
1 files changed, 22 insertions(+), 47 deletions(-)
diff --git a/HDL_ON/Entity/Function/Curtain.cs b/HDL_ON/Entity/Function/Curtain.cs
old mode 100644
new mode 100755
index 9a1702f..ee1da9d
--- a/HDL_ON/Entity/Function/Curtain.cs
+++ b/HDL_ON/Entity/Function/Curtain.cs
@@ -7,48 +7,55 @@
public class Curtain : Function
{
/*
- 绐楀笜灞炴�у垪琛細trait: [switch,openLevel,lock]
+ 绐楀笜灞炴�у垪琛細trait: [switch,percent,lock]
灞炴�� 鎻忚堪
on_off on/off/stop;
- openLevel 0-100;
+ percent 0-100;
lock boolean (Lock閿佸畾鎺у埗)
*/
public Curtain()
{
- }
+ }//percent
[Newtonsoft.Json.JsonIgnore]
- public Trait trait_openLevel;
+ public FunctionAttributes trait_percent;
/// <summary>
/// 寮�鍏崇櫨鍒嗘瘮
/// 0-100
/// </summary>
[Newtonsoft.Json.JsonIgnore]
- public int openLevel
+ public int percent
{
get
{
try
{
- if(trait_openLevel==null)
+ if(trait_percent==null)
{
- trait_openLevel = function.Find((obj) => obj.attri == "openLevel");
- if (trait_openLevel == null)
+ trait_percent = attributes.Find((obj) => obj.key == "percent");
+ if (trait_percent == null)
{
- trait_openLevel = new Trait()
+ trait_percent = new FunctionAttributes()
{
- attri = "openLevel",
+ key = "percent",
value = new List<string> { "up", "down" },
max = 100,
min = 0,
+ curValue = 0
};
}
- trait_openLevel.curValues = trait_openLevel.min;
+ if (trait_percent.curValue.ToString() == "{}")
+ trait_percent.curValue = 0;
+ }
+ string textValue = trait_percent.curValue.ToString();
+ if (textValue == string.Empty)
+ {
+ trait_percent.curValue = 0;
}
- return Convert.ToInt32( trait_openLevel.curValues);
+ return Convert.ToInt32( trait_percent.curValue);
}
catch
{
- MainPage.Log("openLevel 鏁版嵁鑾峰彇澶辫触.");
+ MainPage.Log("percent 鏁版嵁鑾峰彇澶辫触.");
return 0;
}
}
@@ -56,46 +63,14 @@
{
try
{
- trait_openLevel.curValues = value;
+ trait_percent.curValue = value;
}
catch
{
- MainPage.Log("openLevel 鏁版嵁鍒锋柊澶辫触.");
+ MainPage.Log("percent 鏁版嵁鍒锋柊澶辫触.");
}
}
}
-
- /// <summary>
- /// 鎷兼帴銆佽幏鍙朅鍗忚鎿嶄綔鏁版嵁
- /// </summary>
- public override JObject GetSendJObject(CommandType_A command)
- {
- var sendJob = new JObject();
- if (command == CommandType_A.write)
- {
- sendJob = new JObject { { "vendor_code", vendor_code }, { "Command", command.ToString() }, { "Type", "device" } };
- JObject data = null;
- switch (functionType)
- {
- case FunctionType.Curtain:
- data = new JObject { { "on_off", on_off }, { "sid", sid } };
- break;
- case FunctionType.MotorCurtain:
- case FunctionType.RollingShutter:
- data = new JObject { { "openLevel", openLevel}, { "sid", sid } };
- break;
- }
- sendJob.Add("objects", data);
- }
- else if (command == CommandType_A.read)
- {
- sendJob = new JObject { { "vendor_code", vendor_code }, { "Command", command.ToString() }, { "Type", "device" } };
- var data = new JObject { { "sid", sid } };
- sendJob.Add("objects", data);
- }
- return sendJob;
- }
-
}
}
--
Gitblit v1.8.0