From e6a26ee148587327478d9a82624a820c907b6e16 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 04 十一月 2020 14:58:15 +0800 Subject: [PATCH] 20201104 --- HDL_ON/Entity/Function/Function.cs | 80 ++++++++++++++++++++++++++++++++------- 1 files changed, 65 insertions(+), 15 deletions(-) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 053e45b..909a146 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -246,6 +246,65 @@ /// 鏇存柊鏃堕棿 /// </summary> public DateTime refreshTime = DateTime.MinValue; + + /// <summary> + /// 鑾峰彇鎺у埗鍙戦�佹暟鎹� + /// </summary> + public AprotocolControlObj GetControlSendData(Dictionary<string, string> commandDictionary) + { + var sendDataObj = new AprotocolControlObj(); + sendDataObj.from_oid = ""; + sendDataObj.to_oid = ""; + sendDataObj.time_stamp = ""; + sendDataObj.type = "device_sid"; + sendDataObj.command = "write"; + + var acoList = new AprotocolControlData(); + acoList.sid = sid; + var aco = new AprotocolControlAttribute(); + foreach(var dic in commandDictionary) + { + aco.name = dic.Key; + aco.value = dic.Value; + acoList.function.Add(aco); + } + + sendDataObj.objects.Add(acoList); + + + return sendDataObj; + } + } + + /// <summary> + /// A鍗忚鎺у埗鏁版嵁鐨勫璞� + /// </summary> + public class AprotocolControlObj + { + public List<AprotocolControlData> objects = new List<AprotocolControlData>(); + + public string from_oid = ""; + public string to_oid = ""; + public string time_stamp = ""; + public string type = ""; + public string command = ""; + } + /// <summary> + /// A鍗忚鎺у埗鏁版嵁 + /// </summary> + public class AprotocolControlData + { + + public string sid = ""; + public List<AprotocolControlAttribute> function = new List<AprotocolControlAttribute>(); + } + /// <summary> + /// A鍗忚鎺у埗灞炴�у璞� + /// </summary> + public class AprotocolControlAttribute + { + public string name; + public string value; } /// <summary> @@ -258,22 +317,10 @@ /// 灞炴�у悕绉� /// </summary> public string name; - List<string> _value_key; /// <summary> /// 灞炴�х殑鍊煎垪琛� /// </summary> - [Newtonsoft.Json.JsonIgnore] - public List<string> value_key - { - get - { - return _value_key; - } - set - { - _value_key = value; - } - } + public List<string> value_key = new List<string>(); /// <summary> /// 鏈�澶у�� /// </summary> @@ -312,6 +359,7 @@ switch (name) { case "temperature": + case "set_temperature": us = "掳C"; break; case "percent": @@ -351,6 +399,7 @@ text = Language.StringByID(StringId.FanSpeed); break; case "temperature": + case "set_temperature": text = Language.StringByID(StringId.Temp); break; case "delay": @@ -366,7 +415,7 @@ //case "lock": //case "ico": //case "swing": - //case "set_ point": + //case "set_point": //case "pm25": //case "volume": //case "vol_step": @@ -413,6 +462,7 @@ text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); break; case "temperature": + case "set_temperature": case "brightness": case "percent": if (value == "") @@ -521,7 +571,7 @@ //case "lock": //case "ico": //case "swing": - //case "set_ point": + //case "set_point": //case "pm25": //case "volume": //case "vol_step": -- Gitblit v1.8.0