陈嘉乐
2021-03-05 b1ced15165c0c120483f821079fc23c63d455e8e
2021-3-5-1

备份一下
9个文件已修改
622 ■■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewAPI.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs 103 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs 258 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs 126 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,27 +1,42 @@
<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs">
    <Files>
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="234" Column="18" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" />
      <File FileName="HDL-ON_Android/Assets/Language.ini" />
      <File FileName="HDL_ON/Common/R.cs" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" />
      <File FileName="HDL_ON/UI/CSS/CSS.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="276" Column="82" />
      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="294" Column="1" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="170" Column="1" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" Line="12" Column="33" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="10" Column="23" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="50" Column="46" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs" Line="11" Column="57" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="267" Column="70" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="435" Column="63" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="147" Column="32" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs" Line="8" Column="16" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" Line="252" Column="18" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL_ON" expanded="True">
              <Node name="Common" expanded="True" />
              <Node name="DAL" expanded="True">
                <Node name="Mqtt" expanded="True" />
                <Node name="Server" expanded="True" />
              </Node>
              <Node name="Entity" expanded="True">
                <Node name="Function" expanded="True" />
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI2" expanded="True">
                  <Node name="3-Intelligence" expanded="True">
                    <Node name="Automation" expanded="True" />
                  </Node>
                  <Node name="4-PersonalCenter" expanded="True">
                    <Node name="PirDevice" expanded="True">
                      <Node name="PirSend.cs" selected="True" />
                      <Node name="View" expanded="True" />
                      <Node name="Method.cs" selected="True" />
                    </Node>
                  </Node>
                </Node>
@@ -41,7 +56,9 @@
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore />
    <BreakpointStore>
      <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" line="274" column="1" />
    </BreakpointStore>
  </MonoDevelop.Ide.DebuggingService.Breakpoints>
  <MultiItemStartupConfigurations />
</Properties>
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -194,7 +194,7 @@
                    //App订阅红外宝 / 网关遥控器添加成功通知
                    var pirStatus = new MqttTopicFilter()
                    {
                        Topic = $"/user/${DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found",
                        Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found",
                        QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
                    };
@@ -287,10 +287,11 @@
                                    ReceiveNotifySqueezeAsync(mMes);
                                }
                                //App订阅红外宝/网关遥控器添加成功通知
                                else if (topic == $"/user/${DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found")
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found")
                                {
                                    var ss = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = ss;
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString;
                                    //ReceiveCheckGateway(ss);
                                    //return;
                                }
HDL_ON/DAL/Server/NewAPI.cs
@@ -495,11 +495,7 @@
        /// </summary>
        public const string API_POST_Ir_CodeRemove = "/home-wisdom/app/device/ir/codeRemove";
        /// <summary>
        /// 遥控器删除
        /// </summary>
        public const string API_POST_Ir_DeviceRemove = "/home-wisdom/program/device/delete";
        /// <summary>
        /// 红外宝删除
        /// 红外宝/遥控器删除
        /// </summary>
        public const string API_POST_Ir_DeviceDel= "/home-wisdom/app/device/remove";
        /// <summary>
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -263,10 +263,17 @@
                // var page = new ThirdPartyBrandListPage();
                // MainPage.BasePageView.AddChidren(page);
                // page.LoadPage();
                var page = new UI2.PersonalCenter.PirDevice.PirMain();
                MainPage.BasePageView.AddChidren(page);
                page.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                //获取列表
                HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () =>
                {
                    Application.RunOnMainThread(() =>
                    {
                        var page = new UI2.PersonalCenter.PirDevice.PirMain();
                        MainPage.BasePageView.AddChidren(page);
                        page.Show();
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    });
                });
            };
            btnResidenceAddFunctionIcon.MouseUpEventHandler = eventHandler;
            btnResidenceAddFunctionText.MouseUpEventHandler = eventHandler;
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
@@ -11,7 +11,8 @@
        {
            Tag = "PirView";
        }
        public void Show() {
        public void Show()
        {
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
@@ -19,10 +20,25 @@
            topView.topIconBtn.Visible = true;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
            VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
            VerticalRefreshLayout vv = new VerticalRefreshLayout();
            vv.Height = Application.GetRealHeight(667 - 64);
            vv.Y = Application.GetRealHeight(64);
            this.AddChidren(vv);
            vv.BeginHeaderRefreshingAction += () =>
            {
                //关闭刷新View;
                vv.EndHeaderRefreshing();
                //获取列表
                Method.GetPirDeviceList(this,() =>
                {
                    Application.RunOnMainThread(() =>
                    {
                        //刷新界面
                        UIView(vv);
                    });
                });
            };
            #endregion
            UIView(vv);
@@ -31,16 +47,17 @@
        /// 加载UI界面
        /// </summary>
        /// <param name="vv">上下滑控件</param>
        void UIView(VerticalScrolViewLayout vv) {
        void UIView(VerticalRefreshLayout vv)
        {
            vv.RemoveAll();
            int a = 3;
            for (int i = 0; i < Pir.pirDeviceList.Count; i++)
            {
                var pirDevice = Pir.pirDeviceList[i];
                #region 红外宝图标 版本号 名称 状态
                FrameLayout fLayout = new FrameLayout
                {
                    Width = Application.GetRealWidth(375),
                    Height = Application.GetRealHeight(12 + 92 + (50 * a)),
                    Height = Application.GetRealHeight(12 + 92 + (50 * pirDevice.FunctioList.Count)),
                };
                vv.AddChidren(fLayout);
@@ -50,7 +67,7 @@
                    Y = Application.GetRealHeight(12),
                    X = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(375 - 16 * 2),
                    Height = Application.GetRealHeight(92 + (50 * a)),
                    Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)),
                    BackgroundColor = CSS.CSS_Color.view,
                    Radius = (uint)Application.GetRealHeight(12),
                };
@@ -75,7 +92,7 @@
                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
                    Width = Application.GetRealWidth(120),
                    Height = Application.GetRealHeight(20),
                    Text = "红外宝A" + i.ToString(),
                    Text = pirDevice.name,
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text14,
                    TextColor = CSS.CSS_Color.textColor,
@@ -102,7 +119,7 @@
                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
                    Width = Application.GetRealWidth(120),
                    Height = Application.GetRealHeight(17),
                    Text = "2",
                    Text = pirDevice.FunctioList.Count.ToString(),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text12,
                    TextColor = CSS.CSS_Color.textConfirmColor,
@@ -163,15 +180,16 @@
                    X = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(375 - 16 * 2),
                    Height = Application.GetRealHeight(92),
                    BackgroundColor = CSS.CSS_Color.view,
                    BackgroundColor = 0x00000000, //CSS.CSS_Color.view,
                    Radius = (uint)Application.GetRealHeight(12),
                    Tag = Pir.pirDeviceList[i],
                };
                fLayout.AddChidren(clickFram);
                clickFram.MouseUpEventHandler += (sender, e) => {
                clickFram.MouseUpEventHandler += (sender, e) =>
                {
                    var pirclick = (clickFram.Tag as Pir);
                    NewSwitchView( pirclick,  vv);
                    NewSwitchView(pirclick, vv);
                };
                if (Pir.pirDeviceList.Count - 1 == i)
@@ -181,8 +199,9 @@
                }
                #endregion
                for (int j = 0; j < a; j++)
                for (int j = 0; j < pirDevice.FunctioList.Count; j++)
                {
                    var control = pirDevice.FunctioList[i];
                    RowLayout funControlRow = new RowLayout
                    {
                        Y = Application.GetRealHeight(92 + (50 * j)),
@@ -198,7 +217,7 @@
                        X = Application.GetRealWidth(16),
                        Width = Application.GetRealWidth(150),
                        Height = Application.GetRealHeight(20),
                        Text = j.ToString(),
                        Text = control.name,
                        TextAlignment = TextAlignment.CenterLeft,
                        TextSize = TextSize.text14,
                        TextColor = CSS.CSS_Color.textColor,
@@ -239,6 +258,7 @@
                        TextColor = CSS.CSS_Color.textWhiteColor,
                        IsBold = true,
                        BackgroundColor = CSS.CSS_Color.textRedColor,
                        Tag = control,
                    };
                    funControlRow.AddRightView(delBtn);
                    //线
@@ -251,15 +271,54 @@
                        BackgroundColor = CSS.CSS_Color.viewLine,
                    };
                    funControlRow.AddChidren(line1Btn);
                    if (j == a - 1)
                    if (j == pirDevice.FunctioList.Count - 1)
                    {
                        //最后改变一个线的颜色
                        line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence;
                        funControlRow.LineColor = CSS.CSS_Color.viewTranslucence;
                    }
                    delBtn.MouseUpEventHandler += (sender, e) => {
                    delBtn.MouseUpEventHandler += (sender, e) =>
                    {
                        var Function = delBtn.Tag as Entity.Function;
                        //加载log
                        Loading loading = new Loading();
                        this.AddChidren(loading);
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        loading.Start();
                        new System.Threading.Thread(() =>
                        {
                            try
                            {
                                responsePackNew = PirSend.DeleteDevice(Function.deviceId);
                            }
                            catch { }
                            finally
                            {
                                Application.RunOnMainThread(() =>
                                {
                                    loading.Hide();
                                    try
                                    {
                                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                        {
                                            pirDevice.FunctioList.Remove(Function);
                                            UIView(vv);
                                        }
                                        else
                                        {
                                            Method method = new Method();
                                            method.ErrorShow(responsePackNew);
                                        }
                                    }
                                    catch { }
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                    };
                }
@@ -272,7 +331,8 @@
        /// </summary>
        /// <param name="pirclick"></param>
        /// <param name="vv"></param>
        void NewSwitchView(Pir pirclick,VerticalScrolViewLayout vv) {
        void NewSwitchView(Pir pirclick, VerticalRefreshLayout vv)
        {
            FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence };
            this.AddChidren(frame);
            SwitchView switchView = new SwitchView();
@@ -324,7 +384,8 @@
                        })
                        { IsBackground = true }.Start();
                    }, () => {
                    }, () =>
                    {
                        NewSwitchView(pirclick, vv);
                    }, false);
@@ -333,7 +394,8 @@
                {
                    string text = Language.StringByID(StringId.shanchushebei) + pirclick.name + "?";
                    TipPopView tipPopView = new TipPopView();
                    tipPopView.TipBox(StringId.tip, text, (dialog) => {
                    tipPopView.TipBox(StringId.tip, text, (dialog) =>
                    {
                        //加载log
                        Loading loading = new Loading();
                        dialog.AddChidren(loading);
@@ -368,12 +430,15 @@
                        })
                        { IsBackground = true }.Start();
                    }, () => {
                    }, () =>
                    {
                        NewSwitchView(pirclick, vv);
                    }, false);
                }
            });
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -11,26 +11,26 @@
        /// <summary>
        /// 添加遥控器的方法
        /// </summary>
        public void AddControl(FrameLayout frameLayout,Action<Control> action)
        public void AddControl(FrameLayout frameLayout, Action<Control> action)
        {
            View.TipView tipView = new View.TipView();
            tipView.InputBox(frameLayout,"", (name, frame) =>
            {
                ///清除之前列表数据
                Pir.BuottonList.Clear();
                if (!string.IsNullOrEmpty(name))
                {
                    Control control = new Control();
                    control.name = name;
                    control.type = "learn";
                    control.spk = "ir.learn";
                    ThreadAddControl(control, frame, action);
            tipView.InputBox(frameLayout, "", (name, frame) =>
             {
                 ///清除之前列表数据
                 Pir.BuottonList.Clear();
                 if (!string.IsNullOrEmpty(name))
                 {
                     Control control = new Control();
                     control.name = name;
                     control.type = "learn";
                     control.spk = "ir.learn";
                     control.deviceId = Pir.currPir.deviceId;
                     ThreadAddControl(control, frame, action);
                }
            }, false);
                 }
             }, false);
        }
        /// <summary>
@@ -38,7 +38,8 @@
        /// </summary>
        /// <param name="control"></param>
        /// <param name="frame"></param>
        public void ThreadAddControl(Control control, FrameLayout frame,Action<Control> action) {
        public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action)
        {
            DAL.Server.ResponsePackNew responsePackNew = null;
            Loading loading = new Loading();
@@ -56,10 +57,26 @@
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                        {
                            bool bool_if = false;
                            string sid = responsePackNew.Data.ToString();
                            if (string.IsNullOrEmpty(Sid(sid)))
                            var mqttdate = MqttDate();
                            for (int i = 0; i < mqttdate.objects.Count; i++) {
                                var objects = mqttdate.objects[i];
                                if (sid == objects.sid) {
                                    bool_if = true;
                                    break;
                                }
                            }
                            if (bool_if)
                            {
                                control.deviceId = mqttdate.id;
                                ///这里:监听MTTP推送下来主题,才知道是否添加成功
                                frame.RemoveFromParent();//添加成功关闭弹窗
                                action(control);
                            }
                            else
                            {
                                //监听Mqtt推送下来状态码做提示
                                View.FailView failView = new View.FailView();
@@ -69,14 +86,8 @@
                                    ThreadAddControl(control, frame, action);
                                });
                            }
                            else
                            {
                                ///这里:监听MTTP推送下来主题,才知道是否添加成功
                                frame.RemoveFromParent();//添加成功关闭弹窗
                                action(control);
                            }
                        }
                        else
                        {
@@ -88,7 +99,152 @@
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 获取红外设备列表
        /// </summary>
        public static void GetPirDeviceList(FrameLayout frame, Action action)
        {
            //清除之前列表;
            Pir.pirDeviceList.Clear();
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    responsePackNew = PirSend.GetDeviceList("ir.module");
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        try
                        {
                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                            {
                                var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString());
                                string list = jobject["list"].ToString();
                                var jArray = Newtonsoft.Json.Linq.JArray.Parse(list);
                                for (int a = 0; a < jArray.Count; a++)
                                {
                                    var jay = jArray[a];
                                    string spk = jay["spk"].ToString();
                                    if (spk == "ir.module")
                                    {
                                        //数据返序列化为Logic对象
                                        var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                        var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
                                        if (pirJosn != null)
                                        {
                                            if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
                                            {
                                                Pir.pirDeviceList.Add(pirJosn);
                                            }
                                        }
                                    }
                                }
                                GetControlList(frame, action);
                            }
                            else
                            {
                                Method method = new Method();
                                method.ErrorShow(responsePackNew);
                            }
                        }
                        catch { }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 获取遥控器列表
        /// </summary>
        public static void GetControlList(FrameLayout frame, Action action)
        {
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    for (int i = 0; i < Pir.pirDeviceList.Count; i++)
                    {
                        var pirDevice = Pir.pirDeviceList[i];
                        try
                        {
                            responsePackNew = PirSend.ControlList(pirDevice);
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                try
                                {
                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                    {
                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
                                        for (int a = 0; a < jArray.Count; a++)
                                        {
                                            var jay = jArray[a];
                                            //数据返序列化为Logic对象
                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                            var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
                                            if (pirJosn != null)
                                            {
                                                if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
                                                {
                                                    pirDevice.FunctioList.Add(pirJosn);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        //Method method = new Method();
                                        //method.ErrorShow(responsePackNew);
                                    }
                                }
                                catch { }
                            });
                        }
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        action();
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// MQTT主题推送下来的数据(遥控器添加)
        /// </summary>
@@ -96,26 +252,40 @@
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sid"></param>
        /// <returns></returns>
        public string Sid(string sid)
        public Cloud MqttDate()
        {
            var dateTime = DateTime.Now;
            while ((DateTime.Now - dateTime).TotalMilliseconds < 5* 1000)
            while ((DateTime.Now - dateTime).TotalMilliseconds < 5 * 1000)
            {
                if (!string.IsNullOrEmpty(addcontronsid) && addcontronsid == sid)
                if (!string.IsNullOrEmpty(addcontronsid))
                {
                    break;
                }
            }
            return addcontronsid;
            return PushData();
        }
        public Cloud PushData()
        {
            Cloud cloud = new Cloud();
            if (addcontronsid != "")
            {
                //var date = Newtonsoft.Json.JsonConvert.SerializeObject(addcontronsid);
                cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid);
            }
            return cloud;
        }
        /// <summary>
        /// 错误码提示
        /// </summary>
        /// <param name="responsePackNew"></param>
        public  void ErrorShow(ResponsePackNew responsePackNew)
        public void ErrorShow(ResponsePackNew responsePackNew)
        {
            if (responsePackNew != null && responsePackNew.Code == "14005")
@@ -129,7 +299,25 @@
            }
        }
    }
    [Serializable]
    public class Cloud
    {
        /// <summary>
        /// 设备id
        /// </summary>
        public string id = string.Empty;
        public List<Objects> objects = new List<Objects>();
        public string time_stamp = string.Empty;
    }
    [Serializable]
    public class Objects
    {
        public string sid = string.Empty;
        public string spk = string.Empty;
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
@@ -3,7 +3,7 @@
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    [System.Serializable]
    public class Pir
    public class Pir: Entity.Function
    {
        /// <summary>
        /// 添加按键列表
@@ -15,36 +15,15 @@
        /// </summary>
        public static Pir currPir;
        /// <summary>
        /// 设备ID
        /// 遥控器列表
        /// </summary>
        public string deviceId = string.Empty;
        public string homeId = string.Empty;
        public string gatewayId = string.Empty;
        public string name = string.Empty;
        public string sid = string.Empty;
        public string spk = string.Empty;
        public string oid = string.Empty;
        public string omodel = string.Empty;
        public bool collect =false;
        public bool online = false;
        public string controlCounter = string.Empty;
        public List<Entity.Function> FunctioList = new List<Entity.Function>();
        public  List<Attributes> attributes = new List<Attributes>();
    }
}
[Serializable]
public class Attributes
{
    public string key = string.Empty;
    public string data_type = string.Empty;
    public int max = 0;
    public int min = 0;
    public int sort = 0;
    public List<string> value = new List<string>();
}
public class Control
    [System.Serializable]
    public class Control
    {
        /// <summary>
        /// 红外宝设备Id
@@ -75,6 +54,7 @@
        /// </summary>
        public List<ButtonObj> status = new List<ButtonObj>();
    }
    [System.Serializable]
    public class ButtonObj
    {
        public string Key = string.Empty;
@@ -83,6 +63,7 @@
        /// </summary>
        public string value = string.Empty;
    }
    [System.Serializable]
    public class DeviceType
    {
        /// <summary>
@@ -94,6 +75,7 @@
        /// </summary>
        public string deviceType = string.Empty;
    }
    [System.Serializable]
    public class Brand
    {
        /// <summary>
@@ -127,5 +109,5 @@
        public string irIndex = string.Empty;
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -10,7 +10,7 @@
        public PirMain()
        {
            Tag = "PirMain";
            GetPirDeviceList();
        }
        /// <summary>
        /// 临时储存设备类型列表
@@ -179,7 +179,8 @@
                Text = "mini智能遥控器",
            };
            deviceListFLayout.AddChidren(deviceNameBtn);
            if (Pir.pirDeviceList.Count!=0) {
            if (Pir.pirDeviceList.Count != 0)
            {
                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
                Pir.currPir = Pir.pirDeviceList[0];
            }
@@ -209,7 +210,7 @@
                    fLayout.RemoveFromParent();
                };
                FrameLayout iconFLyout = new FrameLayout
                FrameLayout iconFLyout = new FrameLayout
                {
                    X = Application.GetRealWidth(205),
                    Y = Application.GetRealHeight(314),
@@ -219,14 +220,14 @@
                };
                fLayout.AddChidren(iconFLyout);
                FrameLayout textFLyout = new FrameLayout
                FrameLayout textFLyout = new FrameLayout
                {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(14),
                    Width = Application.GetRealWidth(144),
                    Height = Application.GetRealHeight(44),
                };
                VerticalScrolViewLayout vv = new VerticalScrolViewLayout
                VerticalScrolViewLayout vv = new VerticalScrolViewLayout
                {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(14),
@@ -234,7 +235,7 @@
                    Height = Application.GetRealHeight(44 * 4),
                };
                if (Pir.pirDeviceList.Count >4)
                if (Pir.pirDeviceList.Count > 4)
                {
                    iconFLyout.Height = Application.GetRealHeight(21 + 44 * 4);
                    iconFLyout.AddChidren(vv);
@@ -252,8 +253,8 @@
                for (int i = 0; i < Pir.pirDeviceList.Count; i++)
                {
                    var pirJson = Pir.pirDeviceList[i];
                    View.PirNameView pirNameView = new View.PirNameView();
                    var pirJson = Pir.pirDeviceList[i];
                    View.PirNameView pirNameView = new View.PirNameView();
                    if (Pir.pirDeviceList.Count > 4)
                    {
                        vv.AddChidren(pirNameView.FLayoutView());
@@ -330,7 +331,8 @@
                    if (if_value == 7)
                    {
                        Method method = new Method();
                        method.AddControl(this,(control) => {
                        method.AddControl(this, (control) =>
                        {
                            AddButton addButton = new AddButton();
                            MainPage.BasePageView.AddChidren(addButton);
                            addButton.Show(control);
@@ -347,35 +349,36 @@
                        }
                        GetBrandList(jobDeviceType.id, (brandList) =>
                        {
                          var brandSupportStrList= GetBrandSupport(if_value);
                            var brandSupportStrList = GetBrandSupport(if_value);
                            var strList = new List<string>();
                            for (int str = 0; str < brandList.Count; str++)
                            {
                                string s = brandList[str].brandName;
                                var bool_if = brandSupportStrList.Find((c)=>s.Contains(c));
                                if (bool_if!=null)
                                var bool_if = brandSupportStrList.Find((c) => s.Contains(c));
                                if (bool_if != null)
                                {
                                    strList.Add(s);
                                }
                            }
                            Application.RunOnMainThread(()=> {
                            Application.RunOnMainThread(() =>
                            {
                                BrandList brandObj = new BrandList();
                                MainPage.BasePageView.AddChidren(brandObj);
                                brandObj.Show(brandList, strList, strings[1]);
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            });
                        });
                    }
                };
            }
            GetDeviceTypeList();
        }
        /// <summary>
        /// 获取品牌支持
@@ -425,7 +428,7 @@
                    {
                    }
                    break;
            }
            return strList;
@@ -442,13 +445,13 @@
                case 1:
                    {
                        //空调
                        type = "ac-"+SPK.AcIr;
                        type = "ac-" + SPK.AcIr;
                    }
                    break;
                case 2:
                    {
                        //电视
                        type = "tv-"+SPK.ElectricTV;
                        type = "tv-" + SPK.ElectricTV;
                    }
                    break;
                case 3:
@@ -460,22 +463,22 @@
                case 4:
                    {
                        //机顶盒
                      //  type = "set_top_box-" + SPK.ElectricTV;
                        //  type = "set_top_box-" + SPK.ElectricTV;
                    }
                    break;
                case 5:
                    {
                      //影碟机
                      // type = "dvd-" + SPK.ElectricTV;
                        //影碟机
                        // type = "dvd-" + SPK.ElectricTV;
                    }
                    break;
                case 6:
                    {
                        //投影仪
                      //  type = "projector-" + SPK.ElectricTV;
                        //  type = "projector-" + SPK.ElectricTV;
                    }
                    break;
            }
            return type;
@@ -573,11 +576,10 @@
                }
            }, "", "设备类型列表");
        }
        /// <summary>
        /// 读取红外设备类型的品牌列表
        /// </summary>
        private void GetBrandList(string id,Action<List<Brand>> actionBrand)
        private void GetBrandList(string id, Action<List<Brand>> actionBrand)
        {
            List<Brand> brandList = new List<Brand>();
            PirSend.GetDeviceTypesList(this, (responsePackNew) =>
@@ -610,74 +612,6 @@
                }
            }, id, "品牌列表");
        }
        /// <summary>
        /// 获取红外设备列表
        /// </summary>
        private void GetPirDeviceList( )
        {
            //加载log
            Loading loading = new Loading();
            this.AddChidren(loading);
            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    responsePackNew = PirSend.GetDeviceList("ir.module");
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        try {
                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                        {
                            var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString());
                            string list = jobject["list"].ToString();
                            var jArray = Newtonsoft.Json.Linq.JArray.Parse(list);
                            for (int a = 0; a < jArray.Count; a++)
                            {
                                var jay = jArray[a];
                                string spk = jay["spk"].ToString();
                                if (spk == "ir.module")
                                {
                                    //数据返序列化为Logic对象
                                    var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                    var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
                                    if (pirJosn != null)
                                    {
                                        if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
                                        {
                                            Pir.pirDeviceList.Add(pirJosn);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            Method method = new Method();
                            method.ErrorShow(responsePackNew);
                        }
                        }
                        catch { }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -53,9 +53,9 @@
        /// <summary>
        /// 获取遥控器列表
        /// </summary>
        public static ResponsePackNew GetList()
        public static ResponsePackNew ControlList(Pir pir)
        {
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId } };
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List);
            return responsePackNew;
        }
@@ -69,7 +69,7 @@
        {
            var jObject = new JObject { }; 
            jObject.Add("homeId", HomeId);
            jObject.Add("deviceId", pirId);
            jObject.Add("deviceId", control.deviceId);
            jObject.Add("name", control.name);
            jObject.Add("spk", control.spk);
            jObject.Add("type", control.type);
@@ -95,7 +95,7 @@
        {
            var jObject = new JObject { }; 
            jObject.Add("homeId", HomeId);
            jObject.Add("deviceId", pirId);
            jObject.Add("deviceId", control.deviceId);
            jObject.Add("spk", control.spk);
            if (control.spk== Entity.SPK.AcStandard) {
                jObject.Add("group_id", control.group_id);
@@ -181,23 +181,9 @@
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove);
            return responsePackNew;
        }
        /// <summary>
        /// 遥控器删除
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew DeleteControl(string deviceId)
        {
            var job = new JObject { };
            job.Add("deviceId", deviceId);
            var jArray = new JArray { };
            jArray.Add(job);
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "devices", jArray } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRemove);
            return responsePackNew;
        }
        /// <summary>
        /// 红外宝设备删除
        /// 红外宝/遥控器删除
        /// </summary>
        /// <returns></returns>
        public static ResponsePackNew DeleteDevice(string deviceId)