| | |
| | | using System; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | public class AC : Function |
| | | { |
| | | /* |
| | | * 空调:trait: [switch, mode, fan, temperature, swing, lock]
|
| | | * 属性 描述
|
| | | * switch on/off
|
| | | * mode mode: auto, cool, heat, dry, fan
|
| | | * fan high, medium, low, auto
|
| | | * temperature up,down,value
|
| | | * swing up/down/left/right
|
| | | * lock boolean (Lock锁定控制) |
| | | */ |
| | | public AC() |
| | | { |
| | | } |
| | | /// <summary> |
| | | /// 空调电源 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public bool power |
| | | { |
| | | get |
| | | { |
| | | return dicPropert["switch"] == "on"; |
| | | } |
| | | set |
| | | { |
| | | dicPropert["switch"] = value == true ? "on" : "off"; |
| | | } |
| | | } |
| | | |
| | | public string mode; |
| | | //public |
| | | |
| | | public string fanSpeed; |
| | | /// <summary> |
| | | /// 拼接、获取A协议操作数据 |
| | | /// </summary> |
| | | public override JObject GetSendJObject(string command) |
| | | { |
| | | var sendJob = new JObject(); |
| | | if (command == "write") |
| | | { |
| | | |
| | | sendJob = new JObject { { "Namespace", a_Protocol_Namespace }, { "Command", command }, { "Type", "device" } }; |
| | | JObject data = new JObject { { "openLevel", dicPropert["openLevel"] }, { "sid", sid } }; |
| | | sendJob.Add("objects", data); |
| | | } |
| | | else if (command == "read") |
| | | { |
| | | sendJob = new JObject { { "Namespace", a_Protocol_Namespace }, { "Command", command }, { "Type", "device" } }; |
| | | var data = new JObject { { "sid", sid } }; |
| | | sendJob.Add("objects", data); |
| | | } |
| | | return sendJob; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |