| | |
| | | using Newtonsoft.Json.Linq; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | | { |
| | |
| | | jObject.Add("type", control.type); |
| | | if (control.type=="library") |
| | | { |
| | | jObject.Add("group_id", control.group_id); |
| | | jObject.Add("groupId", control.groupId); |
| | | var libraryjay = new JArray { }; |
| | | for (int i = 0; i < control.library.Count; i++) |
| | | { |
| | |
| | | jObject.Add("homeId", HomeId); |
| | | jObject.Add("deviceId", control.deviceId); |
| | | jObject.Add("spk", control.spk); |
| | | if (control.spk== Entity.SPK.AcStandard) { |
| | | jObject.Add("group_id", control.group_id); |
| | | if (control.spk== SPK.AcIr) { |
| | | jObject.Add("groupId", control.groupId); |
| | | } |
| | | var libraryJay = new JArray { }; |
| | | for (int i = 0; i < control.library.Count; i++) |
| | |
| | | { |
| | | var statusJob = new JObject { }; |
| | | var job = control.status[i]; |
| | | statusJob.Add("key", job.Key); |
| | | statusJob.Add("key", job.key); |
| | | statusJob.Add("value", job.value); |
| | | statusJay.Add(statusJob); |
| | | } |
| | |
| | | /// 红外码学习 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static void CodeStudy(ButtonObj buttonObj, Action<ResponsePackNew> action) |
| | | public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action) |
| | | { |
| | | //var whichDayJson = jay["whichDay"].ToString(); |
| | | //var whichDayAry = Newtonsoft.Json.Linq.JArray.Parse(whichDayJson); |
| | |
| | | // timer.whichDay.Add(int.Parse(days)); |
| | | //} |
| | | var job = new JObject { }; |
| | | job.Add("key", buttonObj.Key); |
| | | job.Add("key", buttonObj.key); |
| | | job.Add("data_type", "string"); |
| | | var valuejArray = new JArray { }; |
| | | valuejArray.Add(buttonObj.value); |
| | | job.Add("value", valuejArray); |
| | | var jArray = new JArray { }; |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } }; |
| | | ResponsePackNew responsePackNew = null; |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | /// 自学按键删除 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew CodeRemove(ButtonObj buttonObj) |
| | | public static ResponsePackNew CodeRemove(AttributesStatus buttonObj) |
| | | { |
| | | var job = new JObject { }; |
| | | job.Add("key", buttonObj.Key); |
| | | job.Add("key", buttonObj.key); |
| | | job.Add("data_type", "string"); |
| | | var valuejArray = new JArray { }; |
| | | valuejArray.Add(buttonObj.value); |