wei
2021-08-27 eda3fb873e59544ff36301b51e05aef64f87b0f9
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -12,7 +12,20 @@
    public class PirSend
    {
        /// <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>
@@ -20,9 +33,16 @@
        {
            get
            {
                return Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID;
                return Entity.DB_ResidenceData.Instance.CurrentRegion.id;
            }
        }
        /// <summary>
        /// 乐橙subAccessToken
        /// </summary>
        public static string LcSubAccessToken = "";
        /// <summary>
        /// 是否为其他主用户分享过来的住宅
        /// </summary>
@@ -30,7 +50,7 @@
        {
            get
            {
                return Entity.DB_ResidenceData.Instance.CurrentRegion.IsOthreShare;
                return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare;
            }
        }
        /// <summary>
@@ -66,9 +86,9 @@
        /// <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;
        }
@@ -137,15 +157,8 @@
        /// 红外码学习
        /// </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");
@@ -155,21 +168,32 @@
            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);
                    });
                }
@@ -194,7 +218,6 @@
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove);
            return responsePackNew;
        }
        /// <summary>
        /// 红外宝/遥控器删除
        /// </summary>
@@ -262,7 +285,6 @@
            { IsBackground = true }.Start();
        }
        /// <summary>
        ///请求服务器(与住宅有关:例如;homeId) 
        /// </summary>