| | |
| | | { |
| | | public Light() |
| | | { |
| | | bus_DeviceType = "Relay"; |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | protected override string GetFunctionType() |
| | | { |
| | | string type = "Relay"; |
| | | if (PropertyArray.Contains("brightness")) |
| | | { |
| | | type = "Dimmer"; |
| | | if (PropertyArray.Contains("color")) |
| | | { |
| | | type = "RGB"; |
| | | } |
| | | } |
| | | return type; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public int state = 0; |
| | | |
| | | public List<string> PropertyArray = new List<string>(); |
| | | |
| | | /// <summary> |
| | | /// 拼接、获取A协议操作数据 |
| | |
| | | { |
| | | |
| | | sendJob = new JObject { { "Namespace", a_Protocol_Namespace }, { "Command", command }, { "Type", "device" } }; |
| | | var data = new JObject { { "Switch", state }, { "sid", sid } }; |
| | | JObject data = null; |
| | | switch (functionType) |
| | | { |
| | | case "Relay"://继电器控制 |
| | | data = new JObject { { "switch", state }, { "sid", sid } }; |
| | | break; |
| | | case "Dimmer": |
| | | data = new JObject { { "Switch", state }, { "brightness", dicPropert["brightness"] }, { "sid", sid } }; |
| | | break; |
| | | } |
| | | sendJob.Add("objects", data); |
| | | return sendJob; |
| | | } |
| | | 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; |
| | | } |