| | |
| | | |
| | | public class PirSend |
| | | { |
| | | |
| | | public static string pirId = "1367032976869658625"; |
| | | /// <summary> |
| | | /// 网关ID(获取嘉乐网关ID) |
| | | /// </summary> |
| | | public static string GatewayId |
| | | { |
| | | get |
| | | { |
| | | if (Entity.DB_ResidenceData.Instance.HomeGateway == null) |
| | | { |
| | | return DriverLayer.Control.Ins.GatewayId; |
| | | } |
| | | return Entity.DB_ResidenceData.Instance.HomeGateway.gatewayId; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 住宅ID |
| | | /// </summary> |
| | |
| | | { |
| | | get |
| | | { |
| | | return Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID; |
| | | return Entity.DB_ResidenceData.Instance.CurrentRegion.id; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 乐橙subAccessToken |
| | | /// </summary> |
| | | public static string LcSubAccessToken = ""; |
| | | |
| | | /// <summary> |
| | | /// 是否为其他主用户分享过来的住宅 |
| | | /// </summary> |
| | |
| | | { |
| | | get |
| | | { |
| | | return Entity.DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; |
| | | return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare; |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | public static ResponsePackNew ControlList(Pir pir) |
| | | public static ResponsePackNew ControlList(string deviceId) |
| | | { |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId} }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List); |
| | | return responsePackNew; |
| | | } |
| | |
| | | /// 红外码学习 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action) |
| | | public static void CodeStudy(Control control, AttributesStatus buttonObj, Action<Cloud> 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 job = new JObject { }; |
| | | job.Add("key", buttonObj.key); |
| | | job.Add("data_type", "string"); |
| | |
| | | var jArray = new JArray { }; |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } }; |
| | | ResponsePackNew responsePackNew = null; |
| | | Cloud cloud = null; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | |
| | | try |
| | | { |
| | | //发送红外码学习命令 |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy); |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | PirMethod method = new PirMethod(); |
| | | PirMethod.buttondata = ""; |
| | | cloud = method.MqttDate("按键", control.sid, 25); |
| | | } |
| | | else |
| | | { |
| | | PirMethod method = new PirMethod(); |
| | | method.ErrorShow(responsePackNew, ""); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | action(responsePackNew); |
| | | action(cloud); |
| | | }); |
| | | } |
| | | |
| | |
| | | /// 自学按键删除 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew CodeRemove(AttributesStatus buttonObj) |
| | | public static ResponsePackNew CodeRemove(AttributesStatus buttonObj,string deviceId) |
| | | { |
| | | var job = new JObject { }; |
| | | job.Add("key", buttonObj.key); |
| | |
| | | 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", deviceId }, { "attributes", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove); |
| | | return responsePackNew; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 红外宝/遥控器删除 |
| | | /// </summary> |
| | |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | | /// 修改红外宝名称 |
| | | /// 修改红外宝/设备名称 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew DeviceRename(Pir pir) |
| | | public static ResponsePackNew DeviceRename(string deviceId,string name) |
| | | { |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "name", name} }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename); |
| | | return responsePackNew; |
| | | } |
| | |
| | | url = "/smart-footstone/app/ir/code/list"; |
| | | jObject.Add("brandId", id); |
| | | } |
| | | responsePackNew = RequestServerhomeId(jObject, url); |
| | | responsePackNew = RequestServerhomeId(jObject, url,5); |
| | | } |
| | | catch { } |
| | | finally |
| | |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
| | | /// </summary> |