From 4d14154c36ac5692aadc036eed97fb9f1c410e2a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期日, 23 五月 2021 14:46:03 +0800
Subject: [PATCH] Merge branch 'WJC' into temp-wxr
---
HDL_ON/Entity/Function/Curtain.cs | 81 ++--------------------------------------
1 files changed, 5 insertions(+), 76 deletions(-)
diff --git a/HDL_ON/Entity/Function/Curtain.cs b/HDL_ON/Entity/Function/Curtain.cs
index ce40e73..630b044 100644
--- a/HDL_ON/Entity/Function/Curtain.cs
+++ b/HDL_ON/Entity/Function/Curtain.cs
@@ -1,86 +1,15 @@
锘縰sing System;
+using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace HDL_ON.Entity
{
- public class Curtain : Function
+ public class Curtain
{
- /*
- 绐楀笜灞炴�у垪琛細trait: [switch,openLevel,lock]
- 灞炴�� 鎻忚堪
- on_off on/off/stop;
- openLevel 0-100;
- lock boolean (Lock閿佸畾鎺у埗)
- */
- public Curtain()
+ public int GetPercent(Function function)
{
+ return Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Percent));
}
- /// <summary>
- /// 寮�鍏崇櫨鍒嗘瘮
- /// 0-100
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int openLevel
- {
- get
- {
- try
- {
- string o = "0";
- dicPropert.TryGetValue("openLevel", out o);
- return o == "" ? 0 : Convert.ToInt32(o);
- }
- catch
- {
- MainPage.Log("openLevel 鏁版嵁鑾峰彇澶辫触.");
- return 0;
- }
- }
- set
- {
- try
- {
- dicPropert["openLevel"] = value.ToString();
- }
- catch
- {
- MainPage.Log("openLevel 鏁版嵁鍒锋柊澶辫触.");
- }
- }
- }
-
- /// <summary>
- /// 鎷兼帴銆佽幏鍙朅鍗忚鎿嶄綔鏁版嵁
- /// </summary>
- public override JObject GetSendJObject(string command)
- {
- var sendJob = new JObject();
- if (command == "write")
- {
-
- sendJob = new JObject { { "vendor_code", vendor_code }, { "Command", command }, { "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 == "read")
- {
- sendJob = new JObject { { "vendor_code", vendor_code }, { "Command", command }, { "Type", "device" } };
- var data = new JObject { { "sid", sid } };
- sendJob.Add("objects", data);
- }
- return sendJob;
- }
-
-
+
}
}
--
Gitblit v1.8.0