| | |
| | | /// 遥控器红外码学习 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew CodeStudy(ButtonObj buttonObj) |
| | | public static void CodeStudy(ButtonObj buttonObj, Action<ResponsePackNew> action) |
| | | { |
| | | //var whichDayJson = jay["whichDay"].ToString(); |
| | | //var whichDayAry = Newtonsoft.Json.Linq.JArray.Parse(whichDayJson); |
| | | //for (int b = 0; b < whichDayAry.Count; b++) |
| | | //{ |
| | | // var days = whichDayAry[b].ToString(); |
| | | // timer.whichDay.Add(int.Parse(days)); |
| | | //} |
| | | |
| | | var jArray = new JArray { }; |
| | | var job = new JObject { }; |
| | | job.Add("key", buttonObj.Key); |
| | | job.Add("value", buttonObj.value); |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "status", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy); |
| | | return responsePackNew; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } }; |
| | | ResponsePackNew responsePackNew = null; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | |
| | | try |
| | | { |
| | | //发送红外码学习命令 |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | action(responsePackNew); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | /// <summary> |
| | | /// 获取逻辑 |