wxr
2020-01-18 4cc04639fbadde3a7f3b9875353df0d90fc09043
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
 
namespace HDL_ON.Entity
{
    public class Light : Function
    {
        public Light()
        {
            bus_DeviceType = "Relay";
        }
 
        /// <summary>
        /// 开关状态
        /// 0:关
        /// 1:开
        /// </summary>
        public int state = 0;
 
        public List<string> PropertyArray = new List<string>();
 
        /// <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" } };
                var data = new JObject { { "Switch", state }, { "sid", sid } };
                sendJob.Add("objects", data);
                return sendJob;
            }
            else if(command == "read")
            {
 
            }
            return sendJob;
        }
    }
}