From d5088d3bb198c0f53d4716022f010a02ac393977 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 25 八月 2022 15:06:01 +0800
Subject: [PATCH] 2022年08月25日15:04:41

---
 HDL-ON_Android/Assets/Language.ini                                |    7 
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs    |  179 ++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |  170 ++++
 HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs              |   73 ++
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs              |   22 
 HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs               |   20 
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs           |   30 
 HDL-ON_Android/SplashActivity.cs                                  |    2 
 HDL-ON_iOS/Resources/Language.ini                                 |    6 
 HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs                    |   26 
 HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs      |   39 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs            |   92 ++
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs   |    7 
 HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs     |   12 
 HDL_ON/DAL/DriverLayer/Control.cs                                 |   33 
 HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs             |   12 
 HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs       |   12 
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs        |   21 
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs      |    2 
 HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs           |   62 +
 HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs                  |   12 
 HDL_ON/UI/UI2/FuntionControlView/Video/ObjectClass.cs             |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs    |  103 ++
 HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs                |   20 
 HDL_ON/DAL/Server/NewAPI.cs                                       |   16 
 HDL_ON/Entity/Function/Function.cs                                |    8 
 HDL_ON/DAL/Server/HttpUtil.cs                                     |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs      |   66 -
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs    |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs                  |    5 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs           |    4 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs               |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs               |   68 -
 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs                   |  901 ++++++++++++++-----------
 HDL_ON/Common/R.cs                                                |   12 
 HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs               |   22 
 HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs          |    2 
 HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs               |    4 
 38 files changed, 1,372 insertions(+), 714 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 4bd96bc..e4a22f1 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -1051,6 +1051,10 @@
 7158=is
 7159=Fall in the alarm
 7160=Someone called the police
+7161=Warning tone
+7162=Face to open the door
+7163=Video call
+
 
 
 
@@ -2198,6 +2202,9 @@
 7158=鏄�
 7159=璺屽�掓姤璀�
 7160=鏈変汉鎶ヨ
+7161=鎻愮ず闊�
+7162=浜鸿劯寮�闂�
+7163=瑙嗛閫氳瘽鍛煎彨
 
 
  
diff --git a/HDL-ON_Android/SplashActivity.cs b/HDL-ON_Android/SplashActivity.cs
index 3c6626e..aae212a 100644
--- a/HDL-ON_Android/SplashActivity.cs
+++ b/HDL-ON_Android/SplashActivity.cs
@@ -237,7 +237,7 @@
                     }
                     isfirst = false;
                     ///鐩戝惉缁忕含搴�
-                    HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.CurrLogicMethod.AppLatAndLonEvent(lon, lat);
+                    HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.Current.AppLatAndLonEvent(lon, lat);
                     //鍏抽棴瀹氫綅鏈嶅姟
                     //Shared.Application.StopGPSLocationService();
                 }
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 55ffaab..90a6827 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -1051,6 +1051,9 @@
 7158=is
 7159=Fall in the alarm
 7160=Someone called the police
+7161=Warning tone
+7162=Face to open the door
+7163=Video call
 
 
 
@@ -2197,6 +2200,9 @@
 7158=鏄�
 7159=璺屽�掓姤璀�
 7160=鏈変汉鎶ヨ
+7161=鎻愮ず闊�
+7162=浜鸿劯寮�闂�
+7163=瑙嗛閫氳瘽鍛煎彨
 
 
  
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index 21c027a..5116dcd 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -2786,6 +2786,18 @@
         /// 鏈変汉鎶ヨ
         /// </summary>
         public const int yourenbaojing = 7160;
+        /// <summary>
+        /// 鎻愮ず闊�
+        /// </summary>
+        public const int tishiyin = 7161;
+        /// <summary>
+        /// 浜鸿劯寮�闂�
+        /// </summary>
+        public const int renliankaimen = 7162;
+        /// <summary>
+        /// 瑙嗛閫氳瘽鍛煎彨
+        /// </summary>
+        public const int shipintonghuahujiao = 7163; 
 
 
 
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index c5cd85e..c443445 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -793,6 +793,33 @@
                 new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id,0);
             }
         }
+
+
+        /// <summary>
+        /// 鑾峰彇闊充箰鐩綍
+        /// </summary>
+        public void GetMusicDirectory(Function function)
+        {
+            if (Ins.GatewayOnline_Local)
+            {
+                var objects = new List<Dictionary<string, string>>();
+                var readKey = new Dictionary<string, string>();
+                readKey.Add("sid", function.sid);
+                objects.Add(readKey);
+                var readDataObj = new AlinkReadFunctionStatusObj()
+                {
+                    id = Ins.msg_id.ToString(),
+                    objects = objects,
+                    time_stamp = Utlis.GetTimestamp()
+                };
+                var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj);
+                var sendBytes = Ins.ConvertSendBodyData($"/base/{DB_ResidenceData.Instance.HomeGateway.gatewayId}/thing/service/MusicPlayGroupListGet/down", functionControlDataJson);
+                MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}");
+                new Control_Udp().SendLocalHdlLinkData(sendBytes, readDataObj.id);
+            }
+
+        }
+
         /// <summary>
         /// 缃戝叧杩涘叆閰嶇綉妯″紡
         /// </summary>
@@ -904,6 +931,8 @@
                 //}
                 receiveObj.BodyDataString = res[1];
 
+
+
                 //2021-09-23 杩囨护涓嶉渶瑕佽В瀵嗙殑涓婚 鐩墠鎼滅储缃戝叧涓婚涓嶅姞瀵�
                 if (receiveObj.Topic != CommunicationTopic.SearchLoaclGatewayReply)
                 {
@@ -941,6 +970,10 @@
                     }
                 }
 
+                if (receiveObj.Topic.Contains("/thing/service/MusicPlayGroupListGet/down_reply")) {
+
+
+                }
 
                 if (receiveObj.Topic == CommunicationTopic.SearchLoaclGatewayReply || receiveObj.Topic == CommunicationTopic.GatewayBroadcast)
                 {
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index fef52b7..015e50c 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
 
-        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
+        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
         /// <summary>
         /// RegionMark
         /// </summary>
diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs
index 817e699..ca8c967 100644
--- a/HDL_ON/DAL/Server/NewAPI.cs
+++ b/HDL_ON/DAL/Server/NewAPI.cs
@@ -719,6 +719,12 @@
         /// 浣忓畢sip璐﹀彿鑾峰彇
         /// </summary>
         public const string API_POST_VideoDevice_GetSipAccount = "/home-wisdom/app/home/getSipAccount";
+        /// <summary>
+        /// 鑾峰彇浣忓畢宸插綍鍏ヤ汉鑴镐俊鎭紙鍙瀵硅浜鸿劯寮�闂ㄨЕ鍙戣嚜鍔ㄥ寲閰嶇疆鐢級
+        /// </summary>
+        public const string Api_Post_GetListHomeFace = "/home-wisdom/app/logic/listHomeFace";
+
+       
         #endregion
 
 
@@ -759,6 +765,16 @@
         /// 鑾峰彇闊充箰鍒楄〃
         /// </summary>
         public const string Api_Post_PlayerList = "/home-wisdom/app/wise/music/playerList";
+        /// <summary>
+        /// 鑾峰彇闊充箰鍒嗙粍鍒楄〃
+        /// </summary>
+        public const string Api_Post_GroupList = "/home-wisdom/app/wise/music/groupList";
+        /// <summary>
+        /// 鑾峰彇鍒嗙粍鐨勯煶涔愬垪琛�
+        /// </summary>
+        public const string Api_Post_GroupPlayerList = "/home-wisdom/app/wise/music/groupPlayerList";
+
+
         #endregion
 
     }
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 747df45..a24cde6 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -1217,6 +1217,7 @@
         }
 
 
+
         #region 鐏厜
         /// <summary>
         /// 锛堝紑鍏崇伅锛�
@@ -1748,6 +1749,13 @@
         }
         #endregion
 
+        #region 鍙瀵硅
+        /// <summary>
+        /// HDL鍙瀵硅
+        /// </summary>
+        public const string doorgate="door.gate";
+        #endregion
+
         #region 绗笁鏂箂pk鍒楄〃
         /// <summary>
         /// 鑾峰彇鎵�鏈夌涓夋柟鍝佺墝鍔熻兘鐨剆pk
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
index 2072723..ab6ff1e 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -117,7 +117,7 @@
         /// </summary>
         public void SceneMethod()
         {
-            var sceneList = LogicMethod.CurrLogicMethod.GetSceneList();
+            var sceneList = LogicMethod.Current.GetSceneList();
             List<string> nameList = new List<string>();
             for (int i = 0; i < sceneList.Count; i++)
             {
@@ -125,20 +125,20 @@
                 nameList.Add(scene.name);
             }
             PublicInterface publicInterface = new PublicInterface();
-            publicInterface.FrameOrVv(this, nameList, new List<string> { }, StringId.addSceneLogic, (index) =>
+            publicInterface.FrameOrVv(this, nameList, new List<string> { }, Language.StringByID(StringId.addSceneLogic), (index) =>
             {
                 var sceneSelecetd = sceneList[index];
                 Input input = new Input();
                 input.sid = sceneSelecetd.sid;
                 input.condition_type = "10";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "scene");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "value", "on");
+                LogicMethod.Current.dictionary(dic, "key", "scene");
+                LogicMethod.Current.dictionary(dic, "comparator", "=");
+                LogicMethod.Current.dictionary(dic, "data_type", "string");
+                LogicMethod.Current.dictionary(dic, "value", "on");
                 input.condition.Add(dic);
                 AddCondition(input);
-                LogicMethod.CurrLogicMethod.RemoveAllView();
+                LogicMethod.Current.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
@@ -156,7 +156,7 @@
             ///閫氳繃璋冭瘯瀹濈粰鐨勭粡绾害<鏍囧噯GPS>
             double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//绾害
             double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//缁忓害
-            LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude);
+            LogicMethod.Current.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude);
             int r = 500;//榛樿鍗婂緞
             if (edit)
             {
@@ -257,15 +257,15 @@
             {
                 //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS)
                 double out_lng, out_lat;
-                LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
+                LogicMethod.Current.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
                 Input input = new Input();
-                input.sid = LogicMethod.CurrLogicMethod.NewSid();
+                input.sid = LogicMethod.Current.NewSid();
                 input.condition_type = "8";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "value", valueStr);
+                LogicMethod.Current.dictionary(dic, "key", "direction");
+                LogicMethod.Current.dictionary(dic, "comparator", "=");
+                LogicMethod.Current.dictionary(dic, "data_type", "string");
+                LogicMethod.Current.dictionary(dic, "value", valueStr);
                 input.condition.Add(dic);
                 //绾害
                 input.geo_fence.latitude = out_lat.ToString();
@@ -274,7 +274,7 @@
                 //鍗婂緞<鍗曚綅绫�>
                 input.geo_fence.radius = mRadius.ToString();
                 AddCondition(input);
-                LogicMethod.CurrLogicMethod.RemoveAllView();
+                LogicMethod.Current.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
index 05dbc80..5b00d80 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -70,7 +70,7 @@
             }
 
             // 鏉′欢澶勭悊鏂规硶
-            InpOrOutLogicMethod.InputCondition(this, viewLayout);
+            InpOrOutLogicMethod.Current.InputCondition(this, viewLayout);
             ///娣诲姞鍥炬爣鐨刅iew
             LogicView.LogicAddView addInputIcon = new LogicView.LogicAddView();
             addInputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
@@ -89,7 +89,7 @@
             titleOutpu.btnNextIcon.Visible = false;
             viewLayout.AddChidren(titleOutpu.FLayoutView());
             //鐩爣澶勭悊鏂规硶
-            InpOrOutLogicMethod.OutputTarget(this, viewLayout);
+            InpOrOutLogicMethod.Current.OutputTarget(this, viewLayout);
             ///娣诲姞鍥炬爣鐨刅iew
             LogicView.LogicAddView addOutputIcon = new LogicView.LogicAddView();
             addOutputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
@@ -238,13 +238,9 @@
                     new LogicView.TipPopView().TipBox(StringId.tip, StringId.targetNull);
                     return;
                 }
-
-                
-
-
                 Loading loading = new Loading();
                 this.AddChidren(loading);
-                HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+                HDL_ON.DAL.Server.ResponsePackNew r = null; 
                 if (string.IsNullOrEmpty(Logic.currlogic.userLogicId))
                 {
                     List<string> list = new List<string>();
@@ -252,11 +248,11 @@
                     {
                         list.Add(logic.name);
                     }
-                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view
+                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.Current.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view
                         ) =>
                     {
                         Logic.currlogic.name = logicName;
-                        Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid();
+                        Logic.currlogic.sid = LogicMethod.Current.NewSid();
                         loading.Start();
                         new System.Threading.Thread(() =>
                         {
@@ -265,7 +261,7 @@
                                 if (!MainPage.NoLoginMode)
                                 {
                                     //鍙戦�佹柊鍔犻�昏緫鍛戒护锛�
-                                    responsePackNew = Send.AddLogic(Logic.currlogic);
+                                    r = Send.Current.AddLogic(Logic.currlogic,true);
                                 }
 
                             }
@@ -278,46 +274,30 @@
                                     if(MainPage.NoLoginMode)
                                     {
                                         Logic.LogicList.Add(Logic.currlogic);
-                                        LogicMethod.CurrLogicMethod.RemoveAllView();
+                                        LogicMethod.Current.RemoveAllView();
                                         MainView.MainShow();
                                         return;
                                     }
 
-                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                    if (r != null)
                                     {
-                                        //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�);
-                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
-                                        for (int a = 0; a < jArray.Count; a++)
+                                        var userLogicIdList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(r.Data.ToString());
+                                        for (int i = 0; i < userLogicIdList.Count; i++)
                                         {
-                                            var jay = jArray[a];
-                                            //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
-                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                                            var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
-                                            if (logic.userLogicId != "")
-                                            {
-                                                //鏇存柊浜戠鍞竴鑷姩鍖杋d;
-                                                Logic.currlogic.userLogicId = logic.userLogicId;
-                                            }
-                                            else
+                                            var logic = userLogicIdList[i];
+                                            if (string.IsNullOrEmpty(logic.userLogicId))
                                             {
                                                 //鑷繁鐪嬬殑鎵�浠ヤ笉闇�瑕佹敮鎸佷腑鑻辨枃
                                                 new LogicView.TipPopView().FlashingBox("娌℃湁杩斿洖浜戠鍞竴鑷姩鍖杋d");
                                             }
-
+                                            //鏇存柊浜戠鍞竴鑷姩鍖杋d;
+                                            Logic.currlogic.userLogicId = logic.userLogicId;
                                         }
-
                                         Logic.LogicList.Add(Logic.currlogic);
-                                        LogicMethod.CurrLogicMethod.RemoveAllView();
+                                        LogicMethod.Current.RemoveAllView();
                                         MainView.MainShow();
                                     }
-                                    else
-                                    {
-                                        if (responsePackNew != null)
-                                        {
-                                            new LogicView.TipPopView().FlashingBox(responsePackNew.message);
-                                        }
-
-                                    }
+                                   
                                 });
                             }
 
@@ -336,7 +316,7 @@
                         try
                         {
                             //鍙戦�佷慨鏀归�昏緫鍛戒护锛�
-                            responsePackNew = Send.UpdateLogic(Logic.currlogic);
+                            r = Send.Current.UpdateLogic(Logic.currlogic,true);
 
                         }
                         catch { }
@@ -345,24 +325,14 @@
                             Application.RunOnMainThread(() =>
                             {
                                 loading.Hide();
-                                if (responsePackNew != null && responsePackNew.Code == "0")
+                                if (r != null )
                                 {
-                                    LogicMethod.CurrLogicMethod.RemoveAllView();
+                                    LogicMethod.Current.RemoveAllView();
                                     MainView.MainShow();
-                                }
-                                else
-                                {
-                                    if (responsePackNew != null)
-                                    {
-                                        new LogicView.TipPopView().FlashingBox(responsePackNew.message);
-                                    }
-
                                 }
 
                             });
                         }
-
-
 
                     })
                     { IsBackground = true }.Start();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
index 839696d..b4e06aa 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -90,14 +90,14 @@
         /// </summary>
         public void SceneMethod()
         {
-            var sceneList = LogicMethod.CurrLogicMethod.GetSceneList();
+            var sceneList = LogicMethod.Current.GetSceneList();
             List<string> nameList = new List<string>();
             for (int i = 0; i < sceneList.Count; i++) {
                 var scene = sceneList[i];
                 nameList.Add(scene.name);
             }
             PublicInterface publicInterface = new PublicInterface();
-            publicInterface.FrameOrVv(this, nameList,new List<string> { }, StringId.addSceneLogic, (index) =>
+            publicInterface.FrameOrVv(this, nameList,new List<string> { },Language.StringByID(StringId.addSceneLogic), (index) =>
             {
                 var sceneSelecetd = sceneList[index];
                 Output outputDevice = new Output();
@@ -106,7 +106,7 @@
                 //娌″暐浣滅敤锛屼负浜嗗彂閫佹暟鎹牸寮忕粺涓�;
                 outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene" }, { "value", "0" } } };
                 AddOutput(outputDevice);
-                LogicMethod.CurrLogicMethod.RemoveAllView();
+                LogicMethod.Current.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
@@ -121,10 +121,10 @@
             List<string> stateList = new List<string>();
             if (edit&& index1 != -1) {
                 Output output = Logic.currlogic.output[index1];
-                var security = LogicMethod.CurrLogicMethod.GetSecurity(output.sid);
+                var security = LogicMethod.Current.GetSecurity(output.sid);
                 stateList.Add(security.name);
             }
-            var securityList = LogicMethod.CurrLogicMethod.GetSecurityList(); 
+            var securityList = LogicMethod.Current.GetSecurityList(); 
             List<string> nameList = new List<string>();
             for (int i = 0; i < securityList.Count; i++)
             {
@@ -132,7 +132,7 @@
                 nameList.Add(security.name); 
             }
             PublicInterface publicInterface = new PublicInterface();
-            publicInterface.FrameOrVv(frameLayout, nameList, stateList, StringId.addSecurityLogic,(index) =>
+            publicInterface.FrameOrVv(frameLayout, nameList, stateList,Language.StringByID(StringId.addSecurityLogic),(index) =>
             {
                 var securitySelecetd = securityList[index];
                 Output outputDevice = new Output();
@@ -141,7 +141,7 @@
                 //娌″暐浣滅敤锛屼负浜嗗彂閫佹暟鎹牸寮忕粺涓�;
                 outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "security" }, { "value", "0" } } };
                 AddOutput(outputDevice,true);
-                LogicMethod.CurrLogicMethod.RemoveAllView();
+                LogicMethod.Current.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
@@ -207,11 +207,11 @@
                     return;
                 }
                 Output outputTime= new Output();
-                outputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
+                outputTime.sid = LogicMethod.Current.NewSid();
                 outputTime.target_type = "4";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "delay");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "value", timepoint);
+                LogicMethod.Current.dictionary(dic, "key", "delay");
+                LogicMethod.Current.dictionary(dic, "value", timepoint);
                 outputTime.status.Add(dic);
                 if (edit)
                 {
@@ -226,7 +226,7 @@
                     AddOutput(outputTime);
                 }
                 fLayout.RemoveFromParent();
-                LogicMethod.CurrLogicMethod.RemoveAllView();
+                LogicMethod.Current.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
index 92d1584..093a2d2 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
@@ -81,13 +81,13 @@
         private void AddDic(string value)
         {
             Input input = new Input();
-            input.sid = LogicMethod.CurrLogicMethod.NewSid();
+            input.sid = LogicMethod.Current.NewSid();
             input.condition_type = "6";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.CurrLogicMethod.dictionary(dic, "key", "airquality");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
+            LogicMethod.Current.dictionary(dic, "key", "airquality");
+            LogicMethod.Current.dictionary(dic, "comparator", "=");
+            LogicMethod.Current.dictionary(dic, "data_type", "string");
+            LogicMethod.Current.dictionary(dic, "value", value);
             input.condition.Add(dic);
             AddCondition(input, "airquality" ,"=");
         }
@@ -125,7 +125,7 @@
                 Logic.currlogic.input.Add(input);
             }
 
-            LogicMethod.CurrLogicMethod.RemoveAllView();
+            LogicMethod.Current.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 24f5dc4..ec9fca3 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -32,6 +32,24 @@
         /// 杈撳叆鏉′欢鍒楄〃绱㈠紩鍊�
         /// </summary>
         private int mIndex;
+        /// <summary>
+        /// 鍙瀵硅涓撶敤
+        /// </summary>
+        private string identifier;
+
+        private static ConditionDeviceFunList m_Current = null;
+
+        public static ConditionDeviceFunList Current
+        {
+            get
+            {
+                if (m_Current == null)
+                {
+                    m_Current = new ConditionDeviceFunList();
+                }
+                return m_Current;
+            }
+        }
 
         public void Show(Entity.Function device, int index, bool edit)
         {
@@ -264,8 +282,8 @@
                 //姣背娉紶鎰熷櫒(鑷爺鍖楅偖)
                 case SPK.SenesorMegahealth:
                     {
-                        
-                        LogicView.FunTypeView view1= new LogicView.FunTypeView(); 
+
+                        LogicView.FunTypeView view1 = new LogicView.FunTypeView();
                         view1.btnText.TextID = StringId.diedaobaojing;
                         view1.btnState.Name = Language.StringByID(StringId.diedaobaojing);
                         fLayout.AddChidren(view1.FLayoutView());
@@ -273,7 +291,7 @@
                         {
                             DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
                         };
-                        
+
                         LogicView.FunTypeView view2 = new LogicView.FunTypeView();
                         view2.frameLayout.Y = view1.frameLayout.Bottom;
                         view2.btnText.TextID = StringId.yourenbaojing;
@@ -372,7 +390,7 @@
                         {
                             fLayout.AddChidren(tvocView.FLayoutView());
                         }
-                        
+
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
                         ///娓╁害鐐瑰嚮浜嬩欢
@@ -380,7 +398,7 @@
                         {
                             new PublicInterface { }.ViewZuHe(this, StringId.wendugaoyu, StringId.wendudiyu, (intText, view) =>
                             {
-                                InputBoxAction(device,intText, index, edit);
+                                InputBoxAction(device, intText, index, edit);
                             });
                         };
                         ///婀垮害鐐瑰嚮浜嬩欢
@@ -388,30 +406,30 @@
                         {
                             new PublicInterface { }.ViewZuHe(this, StringId.shidugaoyu, StringId.shidudiyu, (intText, view) =>
                             {
-                                InputBoxAction(device,intText, index, edit);
+                                InputBoxAction(device, intText, index, edit);
                             });
 
                         };
                         ///pm2.5鐐瑰嚮浜嬩欢
                         pm25View.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            PmCo2TvocAction(this,device, "pm25",StringId.pm25, index,edit);
+                            PmCo2TvocAction(this, device, "pm25", StringId.pm25, index, edit);
                         };
                         ///co2鐐瑰嚮浜嬩欢
                         co2View.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            PmCo2TvocAction(this,device, "co2", StringId.co2, index, edit);
+                            PmCo2TvocAction(this, device, "co2", StringId.co2, index, edit);
                         };
                         ///tvoc鐐瑰嚮浜嬩欢
                         tvocView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            PmCo2TvocAction(this,device, "tvoc", StringId.tvoc, index, edit);
+                            PmCo2TvocAction(this, device, "tvoc", StringId.tvoc, index, edit);
 
                         };
                         #endregion
                     }
                     break;
-                    //娓╁害浼犳劅鍣�
+                //娓╁害浼犳劅鍣�
                 case SPK.SensorTemperature:
                     {
                         ///娓╁害
@@ -482,7 +500,7 @@
                 //tvoc
                 case SPK.SensorTVOC:
                     {
-                        
+
                         ///tvoc
                         LogicView.FunTypeView tvocView = new LogicView.FunTypeView();
                         tvocView.btnText.TextID = StringId.tvoc;
@@ -520,11 +538,65 @@
                         fLayout.AddChidren(view.FLayoutView());
                         view.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            DeviceView(device, view.btnState, StringId.shi, StringId.offLogic,1);
+                            DeviceView(device, view.btnState, StringId.shi, StringId.offLogic, 1);
                         };
                         if (edit)
                         {
                             GetEditState(device, index, view.btnState, null, null, null);
+                        }
+                    }
+                    break;
+                //鍙瀵硅
+                case SPK.doorgate:
+                    {
+
+                        LogicView.FunTypeView view1 = new LogicView.FunTypeView();
+                        view1.btnText.TextID = StringId.shipintonghuahujiao;
+                        view1.btnText.Name = Language.StringByID(StringId.shipintonghuahujiao);
+                        fLayout.AddChidren(view1.FLayoutView());
+                        view1.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            identifier = "door_call_cloud_event";
+                            DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
+                        };
+
+                        LogicView.FunTypeView view2 = new LogicView.FunTypeView();
+                        view2.frameLayout.Y = view1.frameLayout.Bottom;
+                        view2.btnText.TextID = StringId.renliankaimen;
+                        fLayout.AddChidren(view2.FLayoutView());
+                        view2.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            identifier = "door_pedestrian_records";
+                            this.FaceAction(this, device, view2.btnState);
+                        };
+
+                        int intValue = 0;
+                        if (edit)
+                        {
+                            Input inputs = Logic.currlogic.input[index];
+                            if (inputs.identifier == "door_call_cloud_event")
+                            {
+                                intValue = 1;
+                            }
+                            else
+                            {
+                                intValue = 2;
+                            }
+                        }
+                        if (intValue == 1)
+                        {
+                            //璺屽�掓姤璀�
+                            view2.frameLayout.Visible = false;
+
+                        }
+                        else if (intValue == 2)
+                        {
+                            //鏈変汉鎶ヨ
+                            view2.frameLayout.Y = Application.GetRealHeight(0);
+                        }
+                        if (edit)
+                        {
+                            GetEditState(device, index, view1.btnState, view2.btnState, null, null);
                         }
                     }
                     break;
@@ -557,6 +629,18 @@
                 inputDevice.condition_type = "3";
                 inputDevice.sid = device.sid;
                 inputDevice.condition = dicSateteList;
+                if (device.spk == SPK.doorgate)
+                {
+                    //鍙瀵硅
+                    inputDevice.condition_type = "9";
+                    inputDevice.identifier = this.identifier;
+                    if (this.identifier == "door_call_cloud_event")
+                    {
+                        inputDevice.condition = new List<Dictionary<string, string>>();
+                    }
+                }
+               
+               
                 if (edit)
                 {
                     //绉婚櫎鏃ф暟鎹�
@@ -580,7 +664,7 @@
                 this.RemoveFromParent();
                 return;
             }
-            LogicMethod.CurrLogicMethod.RemoveAllView();
+            LogicMethod.Current.RemoveAllView();
             if (MainView.IsGatewayType)
             { //A缃戝叧
                 var addLogic = new AddLogic();
@@ -783,9 +867,14 @@
                 if (button != null)
                 {
 
+
                     if (button.Name == Language.StringByID(StringId.yourenbaojing)
                     || (button.Name == Language.StringByID(StringId.diedaobaojing)))
                     {
+                        //鍙湁姣背娉紶鎰熷櫒(鑷爺)
+                        Save(device, mIndex, mEdit);
+                    }
+                    else if (button.Name == Language.StringByID(StringId.shipintonghuahujiao)) {
                         //鍙湁姣背娉紶鎰熷櫒(鑷爺)
                         Save(device, mIndex, mEdit);
                     }
@@ -906,6 +995,51 @@
                });
         }
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="frame">褰撳墠鐣岄潰</param>
+        /// <param name="device">褰撳墠璁惧</param>
+        /// <param name="btnState">鏃х姸鎬�</param>
+        public void FaceAction(FrameLayout frame, Entity.Function device,Button btnState) {
+            selectedState = device.spk + "_";
+            Loading loading = new Loading();
+            frame.AddChidren(loading);
+            loading.Start();
+            System.Threading.Tasks.Task.Run(() =>
+            {
+                try
+                {
+                   var faceIDList = Send.Current.GetListHomeFace(device.deviceId,true);
+                    List<string> faceNameList = new List<string>();
+                    for (int i = 0; i < faceIDList.Count; i++)
+                    {
+                        var face = faceIDList[i];
+                        faceNameList.Add(face.userName);
+                    }
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                        PublicInterface publicInterface = new PublicInterface();
+                        publicInterface.FrameOrVv(this, faceNameList, new List<string> { btnState.Text }, device.name, (index) =>
+                        {
+                            var face = faceIDList[index];
+                            //鐣岄潰鏄剧ず閫変腑鍊�
+                            btnState.Text = face.userName;
+                            //鏁版嵁灏佽
+                            AddDictionary("open_type", "1", "string");
+                            AddDictionary("user_id", face.userId, "string");
+
+                        }, false);
+
+                    });
+                }
+                catch { }
+
+            });
+
+        }
+
+        /// <summary>
         /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
         /// </summary>
         /// <param name="device">缂栬緫璁惧</param>
@@ -925,7 +1059,7 @@
                 //鏈夋暟鎹噸鏂拌祴鍊�
                 dicSateteList = dicList;
             }
-            InpOrOutLogicMethod.EditState(device, dicList, button1, button2, button3, button4);
+            InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4);
         }
         /// <summary>
         /// 娣诲姞閫変腑鏁版嵁
@@ -938,10 +1072,10 @@
         {
             //鏁版嵁灏佽
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.CurrLogicMethod.dictionary(dic, "key", KeyValue);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", data_type);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "value", selectedValue);
+            LogicMethod.Current.dictionary(dic, "key", KeyValue);
+            LogicMethod.Current.dictionary(dic, "comparator", comparator);
+            LogicMethod.Current.dictionary(dic, "data_type", data_type);
+            LogicMethod.Current.dictionary(dic, "value", selectedValue);
             AddDictionaryList(dic);
         }
         /// <summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
index d75a820..8564f29 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
@@ -77,7 +77,7 @@
                     Width = Application.GetRealWidth(144),
                     Height = Application.GetRealHeight(44 * 5),
                 };
-                var roomList = LogicMethod.CurrLogicMethod.GetGatewayRoomList(Language.StringByID(StringId.allAreas));
+                var roomList = LogicMethod.Current.GetGatewayRoomList(Language.StringByID(StringId.allAreas));
 
                 if (roomList.Count > 5)
                 {
@@ -121,7 +121,7 @@
                         ///鍒囨崲鎴块棿榛樿:鍏ㄩ儴鍔熻兘
                         UserInfo.Current.logicselectedFunction = Language.StringByID(StringId.allFun);
                         ///鑾峰彇鏄剧ず璁惧鍒楄〃
-                        var list = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room, if_Type);
+                        var list = LogicMethod.Current.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room, if_Type);
 
                         this.LoadingDeviceListView(vv, list);
                     };
@@ -139,9 +139,9 @@
             {
 
                 //鑾峰彇鏈�缁堟樉绀哄垪琛�
-                var functionList = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(UserInfo.Current.logicselectedRoom, if_Type);
+                var functionList = LogicMethod.Current.GetFunctionDeviceList(UserInfo.Current.logicselectedRoom, if_Type);
                 //鑾峰彇璁惧鍒楄〃鐨勭被鍨嬶紙渚嬪锛氱伅鍏夌被锛岀獥甯樼被銆傘�傘�傦級
-                var deviceTypeList = LogicMethod.CurrLogicMethod.GetDeviceTypeList(functionList);
+                var deviceTypeList = LogicMethod.Current.GetDeviceTypeList(functionList);
                 if (deviceTypeList.Count == 0)
                 {
                     //娌℃湁绫诲瀷鐩存帴杩斿洖鍘�;
@@ -223,9 +223,9 @@
                         funAllAreaView.btnText2.Text = clickText;
                         UserInfo.Current.logicselectedFunction = clickText;
                         ///鑾峰彇璁惧鍗曚釜澶х被spk鍒楄〃锛堜緥濡�:鐏厜绫�,绌鸿皟绫�...锛�
-                        var typeFunctionList2 = LogicMethod.CurrLogicMethod.GetDeviceTypeFunctionList(clickText);
+                        var typeFunctionList2 = LogicMethod.Current.GetDeviceTypeFunctionList(clickText);
                         ///鑾峰彇璁惧鍗曚釜灏忕被鍒楄〃锛堜緥濡傦細鐏厜1,鐏厜2...锛�
-                        var lists2 = LogicMethod.CurrLogicMethod.GetShowDeviceList(typeFunctionList2, functionList);
+                        var lists2 = LogicMethod.Current.GetShowDeviceList(typeFunctionList2, functionList);
                        this.LoadingDeviceListView(vv, lists2);
 
                     };
@@ -239,11 +239,11 @@
             funAllAreaView.btnText2.MouseUpEventHandler += funClick;
             funAllAreaView.btnIcon2.MouseUpEventHandler += funClick;
             ///鑾峰彇鎴块棿鏀寔鐨勮澶囧垪琛�
-            var deviceList = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(UserInfo.Current.logicselectedRoom, if_Type);
+            var deviceList = LogicMethod.Current.GetFunctionDeviceList(UserInfo.Current.logicselectedRoom, if_Type);
             ///鑾峰彇璁惧鍗曚釜澶х被spk鍒楄〃锛堜緥濡�:鐏厜绫�,绌鸿皟绫�...锛�
-            var typeFunctionList = LogicMethod.CurrLogicMethod.GetDeviceTypeFunctionList(UserInfo.Current.logicselectedFunction);
+            var typeFunctionList = LogicMethod.Current.GetDeviceTypeFunctionList(UserInfo.Current.logicselectedFunction);
             ///鑾峰彇璁惧鍗曚釜灏忕被鍒楄〃锛堜緥濡傦細鐏厜1,鐏厜2...锛�
-            var lists = LogicMethod.CurrLogicMethod.GetShowDeviceList(typeFunctionList, deviceList);
+            var lists = LogicMethod.Current.GetShowDeviceList(typeFunctionList, deviceList);
             ///鎴块棿鍚嶇О
             funAllAreaView.btnText1.Text = UserInfo.Current.logicselectedRoom.roomName;
             ///璁惧澶х被鍚嶇О<鐏厜绫汇�傘�傘�傘�傘��>
@@ -275,7 +275,7 @@
                         funView.btnLine.X = Application.GetRealWidth(16);
                         funView.btnLine.Width = Application.GetRealWidth(343);
                         verticalScrolView.AddChidren(funView.FLayoutView());
-                        funView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(dev.spk);
+                        funView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(dev.spk);
                         funView.btnDeviceName.Text = dev.name;
                         funView.btnRoomName.Text = dev.GetRoomListName();
                         funView.btnClick.MouseUpEventHandler += (sen, e) =>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index d88fe55..d9f0de4 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -7,12 +7,27 @@
 {
     public class InpOrOutLogicMethod
     {
+
+        private static InpOrOutLogicMethod s_Current = null;
+
+        public static InpOrOutLogicMethod Current
+        {
+            get
+            {
+                if (s_Current == null)
+                {
+                    s_Current = new InpOrOutLogicMethod();
+
+                }
+                return s_Current;
+            }
+        }
         /// <summary>
         /// 杈撳叆鏉′欢澶勭悊鏂规硶
         /// </summary>
         /// <param name="thisView">褰撳墠鐣岄潰</param>
         /// <param name="viewLayout">涓婁笅婊戝姩鎺т欢</param>
-        public static void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
+        public void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
         {
             for (int i = 0; i < Logic.currlogic.input.Count; i++)
             {
@@ -123,11 +138,12 @@
                         }
                         break;
                     case "3":
+                    case "9"://鍙瀵硅:9
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
+                            var device = LogicMethod.Current.GetDevice(inputCondition.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk);
+                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
                             //鏄剧ず璁惧鍚嶇О
                             inputView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -358,7 +374,8 @@
                                             }
 
                                         }
-                                    }break;
+                                    }
+                                    break;
                                 case SPK.SenesorMegahealth2:
                                     {
                                         foreach (var dic in dicList)
@@ -445,7 +462,7 @@
                                     break;
                                 case SPK.SensorHumidity:
                                     {
-                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity");
+                                        string str = this.GetText(dicList, "humidity");
                                         inputView.btnState.Text = str;
 
                                     }
@@ -455,7 +472,7 @@
                                 case SPK.SensorTVOC:
                                 case SPK.SensorHcho:
                                     {
-                                        string strvalue = ""; 
+                                        string strvalue = "";
                                         foreach (var dic in dicList)
                                         {
                                             strvalue = dic["value"];
@@ -475,6 +492,30 @@
                                                 inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
                                             }
 
+                                        }
+                                    }
+                                    break;
+                                case SPK.doorgate:
+                                    {
+                                        if (inputCondition.identifier == "door_call_cloud_event")
+                                        {
+                                            inputView.btnState.Text = Language.StringByID(StringId.shipintonghuahujiao);
+                                        }
+                                        else
+                                        {
+
+                                            foreach (var dic in dicList)
+                                            {
+                                                string key = dic["key"];
+                                                if (key == "user_id")
+                                                {
+                                                    string userId = dic["value"];
+                                                    var FaceItem = this.FaceItem(userId, device.deviceId);
+                                                    inputView.btnState.Text = FaceItem.userName;
+                                                    // Language.StringByID(StringId.kaiqi);
+                                                }
+
+                                            }
                                         }
                                     }
                                     break;
@@ -623,7 +664,7 @@
                     case "10":
                         {
                             //鐢╯id鎵惧埌鍦烘櫙锛�
-                            var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
+                            var scene = LogicMethod.Current.GetSecne(inputCondition.sid);
                             inputView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
                             inputView.btnNextIcon.Visible = false;
                             inputView.btnClick.Visible = false;
@@ -638,19 +679,19 @@
                 {
                     Button button = (Button)sen;
                     //褰撳墠缂栬緫鐨勬潯浠�
-                    Input ckcliInput = inputView.btnClick.Tag as Input;
+                    Input clickInput = inputView.btnClick.Tag as Input;
                     //鎵惧埌褰撳墠缂栬緫鐨勭储寮�
                     int indexVulae = 0;
                     for (int index = 0; index < Logic.currlogic.input.Count; index++)
                     {
                         Input input = Logic.currlogic.input[index];
-                        if (input.sid == ckcliInput.sid)
+                        if (input.sid == clickInput.sid)
                         {
-                            if (button.Name == "3")
+                            if (button.Name == "3" || button.Name == "9")
                             {
                                 //鏈変簺璁惧姣旇緝鐗规畩锛堜緥濡傦細娴锋灄浼犳劅鍣ㄨ繕鏄鍒ゆ柇灞炴�у�硷紝娓╂箍搴﹀睘鎬ц繕瑕佸垽鏂瘮杈冨叧绯伙紝鎵嶈兘纭鏄惁宸茬粡瀛樺湪璇ユ潯浠讹紝鍏朵粬璁惧鏉′欢鐩存帴鐢╯id鍒ゆ柇鍗冲彲锛�
                                 //鍔犱竴绾у垽鏂槸涓哄吋瀹圭壒娈婅澶�
-                                if (new ConditionDeviceFunList { }.IsContainsAll(ckcliInput.condition, input.condition))
+                                if (new ConditionDeviceFunList { }.IsContainsAll(clickInput.condition, input.condition))
                                 {
                                     //鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛�
                                     //閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊�
@@ -724,10 +765,11 @@
                                 timeTpye.TimeHorizon(fLayout, edit, indexVulae);
                             }
                             break;
+                        case "9":
                         case "3":
                             {
                                 //鐢╯id鎵惧埌璁惧锛�
-                                var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
+                                var device = LogicMethod.Current.GetDevice(inputCondition.sid);
                                 if (device.spk == SPK.SensorEnvironment
                                 || device.spk == SPK.SensorEnvironment2
                                 || device.spk == SPK.SensorEnvironment3
@@ -957,7 +999,7 @@
         /// </summary>
         /// <param name="thisView">褰撳墠鐣岄潰</param>
         /// <param name="viewLayout">涓婁笅婊戝姩鎺т欢</param>
-        public static void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
+        public void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout)
         {
 
             for (int i = 0; i < Logic.currlogic.output.Count; i++)
@@ -980,9 +1022,9 @@
                     case "1":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
+                            var device = LogicMethod.Current.GetDevice(outputTarget.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk);
+                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
                             //鏄剧ず璁惧鍚嶇О
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -1069,7 +1111,7 @@
                                 case SPK.CurtainRoller:
                                     {
                                         string on_off = GetKeyValue("on_off", dicList);
-                                        string percent = GetKeyValue("percent", dicList); 
+                                        string percent = GetKeyValue("percent", dicList);
                                         if (on_off == "on" && percent != "")
                                         {
                                             stateStr = Language.StringByID(StringId.onLogic) + percent + "%";
@@ -1095,7 +1137,7 @@
                                         if (percent != "" && angle != "")
                                         {
                                             stateStr += Language.StringByID(StringId.onLogic) + percent + "%;";
-                                            stateStr +=Language.StringByID(StringId.Angle)+angle + "掳";
+                                            stateStr += Language.StringByID(StringId.Angle) + angle + "掳";
                                         }
                                         else if (percent != "")
                                         {
@@ -1207,7 +1249,8 @@
 
                                     }
                                     break;
-                                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+                                case SPK.FloorHeatStandard:
+                                case SPK.HvacFloorHeat:
                                     {
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string set_temp = GetKeyValue("set_temp", dicList);
@@ -1339,13 +1382,25 @@
                                         }
                                     }
                                     break;
+                                case SPK.MusicStandard:
+                                case SPK.AvMusic:
+                                    {
+                                        foreach (var dic in dicList)
+                                        {
+                                            if (dic["key"] == "song_name")
+                                            {
+                                                stateStr = dic["value"]?.ToString();
+                                            }
+                                        }
+                                    }
+                                    break;
                             }
                         }
                         break;
                     case "2":
                         {
                             //鐢╯id鎵惧埌鍦烘櫙锛�
-                            var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid);
+                            var scene = LogicMethod.Current.GetSecne(outputTarget.sid);
                             targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
                             targetView.btnNextIcon.Visible = false;
                             //鏄剧ず鍦烘櫙鍚嶇О
@@ -1355,7 +1410,7 @@
                     case "3":
                         {
                             //鐢╯id鎵惧埌瀹夐槻锛�
-                            var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
+                            var security = LogicMethod.Current.GetSecurity(outputTarget.sid);
                             targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
                             targetView.btnDelay.Visible = false;
                             //鏄剧ず瀹夐槻鍚嶇О 
@@ -1417,7 +1472,7 @@
                         case "1":
                             {
                                 //鐢╯id鎵惧埌璁惧锛�
-                                var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
+                                var device = LogicMethod.Current.GetDevice(outputTarget.sid);
                                 TargetDeviceFunList deviceFunList = new TargetDeviceFunList();
                                 MainPage.BasePageView.AddChidren(deviceFunList);
                                 deviceFunList.Show(device, indexVulae, edit);
@@ -1479,8 +1534,8 @@
         /// <param name="button1">鏄剧ずBtn</param>
         /// <param name="button2">鏄剧ずBtn</param>
         /// <param name="button3">鏄剧ずBtn</param>
-        /// <param name="button4">鏄剧ずBtn</param>
-        public static void EditState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4)
+        /// <param name="button4">鏄剧ずBtn</param> 
+        public void EditDeviceState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4)
         {
             switch (device.spk)
             {
@@ -1611,7 +1666,7 @@
                             }
 
                         }
-                        
+
                     }
                     break;
                 case SPK.CurtainDream:
@@ -1759,7 +1814,8 @@
 
                     }
                     break;
-                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+                case SPK.FloorHeatStandard:
+                case SPK.HvacFloorHeat:
                     {
 
                         foreach (var dic in dicList)
@@ -2057,7 +2113,7 @@
                             string value = dic["value"];
                             switch (dic["key"])
                             {
-                               
+
                                 case "target_status":
                                     {
                                         if (value == "4")
@@ -2109,7 +2165,30 @@
                             {
                                 button1.Text = Language.StringByID(StringId.shi);
                             }
-                           
+
+                        }
+                    }
+                    break;
+                case SPK.MusicStandard:
+                case SPK.AvMusic:
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            if (dic["key"] == "song_name")
+                            {
+                                button1.Text = dic["value"]?.ToString();
+                            }
+                        }
+                    }
+                    break;
+                case SPK.doorgate:
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            if (dic["key"] == "user_id")
+                            {
+                                button2.Text = dic["value"]?.ToString();
+                            }
                         }
                     }
                     break;
@@ -2121,7 +2200,7 @@
         /// <param name="keyValue"></param>
         /// <param name="dicList"></param>
         /// <returns></returns>
-        public static string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList)
+        public string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList)
         {
 
             string valueStr = "";
@@ -2140,7 +2219,7 @@
         ///鑾峰彇鑷姩鍖栧悕绉�
         /// </summary>
         /// <returns> 鏂板缓鑷姩鍖栧懡鍚嶈鍒�</returns>
-        public static string GetLogicName(Logic logic)
+        public string GetLogicName(Logic logic)
         {
 
             string name = "";
@@ -2163,16 +2242,17 @@
                         }
                         break;
                     case "3":
+                    case "9":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
+                            var device = LogicMethod.Current.GetDevice(inputCondition.sid);
                             name = device.name + "-";
                         }
                         break;
                     case "10":
                         {
                             //鐢╯id鎵惧埌鍦烘櫙锛�
-                            var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
+                            var scene = LogicMethod.Current.GetSecne(inputCondition.sid);
                             name = scene.name + "-";
                         }
                         break;
@@ -2187,7 +2267,7 @@
                     case "1":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
+                            var device = LogicMethod.Current.GetDevice(outputTarget.sid);
                             //鏄剧ず璁惧鍚嶇О
                             name += device.name;
                             string stateStr = "";
@@ -2218,8 +2298,8 @@
                                 case SPK.LightCCT:
                                 case SPK.LightDimming:
                                     {
-                                        string on_off = InpOrOutLogicMethod.GetKeyValue("on_off", dicList);
-                                        string brightness = InpOrOutLogicMethod.GetKeyValue("brightness", dicList);
+                                        string on_off = this.GetKeyValue("on_off", dicList);
+                                        string brightness = this.GetKeyValue("brightness", dicList);
                                         if (on_off == "on" && brightness != "")
                                         {
                                             stateStr = Language.StringByID(StringId.onLogic) + brightness + "%";
@@ -2268,7 +2348,8 @@
                                     break;
                                 case SPK.AcStandard:
                                 case SPK.HvacAC:
-                                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+                                case SPK.FloorHeatStandard:
+                                case SPK.HvacFloorHeat:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -2294,7 +2375,7 @@
                     case "2":
                         {
                             //鐢╯id鎵惧埌鍦烘櫙锛�
-                            var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid);
+                            var scene = LogicMethod.Current.GetSecne(outputTarget.sid);
                             name += scene.name;
 
                         }
@@ -2302,7 +2383,7 @@
                     case "3":
                         {
                             //鐢╯id鎵惧埌瀹夐槻锛�
-                            var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
+                            var security = LogicMethod.Current.GetSecurity(outputTarget.sid);
                             name += security.name;
 
                         }
@@ -2423,7 +2504,7 @@
         /// </summary>
         /// <param name="dicList">鐘舵�佹暟鎹垪琛�</param>
         /// <returns></returns>
-        private string GetText(List<Dictionary<string, string>> dicList,string key)
+        private string GetText(List<Dictionary<string, string>> dicList, string key)
         {
             string strtext = "";
             foreach (var dic in dicList)
@@ -2483,7 +2564,8 @@
             }
             return strtext;
         }
-        private void SensorView(FrameLayout thisView, Function device,string key, int indexVulae) {
+        private void SensorView(FrameLayout thisView, Function device, string key, int indexVulae)
+        {
             //杩欎釜璁惧姣旇緝鐗规畩
             ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList();
             ///褰撳墠鐨勭储寮曞�兼暟鎹璞�
@@ -2548,6 +2630,25 @@
                 }
             }
         }
+        /// <summary>
+        /// 鏌ユ壘鎸囧畾userId
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        public Face FaceItem(string userId, string deviceId)
+        {
+            if (Send.Current.faceList.Count == 0)
+            {
+                Send.Current.GetListHomeFace(deviceId, false);
+            }
+            var face = Send.Current.faceList.Find((o) => { return o.userId == userId; });
+            if (face == null)
+            {
+                face = new Face();
+            }
+            return face;
+        }
+
     }
 }
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs
index b05e5c7..6325102 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs
@@ -82,7 +82,7 @@
                 {
                     try
                     {
-                         userList = Send.GetResidenceMemberAccount();
+                         userList = Send.Current.GetResidenceMemberAccount();
                      
                     }
                     catch { }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
index 6f70600..370900f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -98,9 +98,14 @@
         /// 鏌愪釜閫昏緫/鍦烘櫙鐨勮緭鍑烘潯浠�=7;
         /// 鍦扮悊鍥存爮=8;
         /// 绌烘皵璐ㄩ噺=9(搴熷純);
+        /// 鍙瀵硅=9;
         /// 鍦烘櫙=10;
         /// </summary>
         public string condition_type = "";
+        /// <summary>
+        /// condition_type=9鏃朵娇鐢�
+        /// </summary>
+        public string identifier = "";
         public List<Dictionary<string, string>> condition = new List<Dictionary<string, string>>();
         /// <summary>
         /// 鍦扮悊鍥存爮閰嶇疆
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 60eb6a9..e1a5520 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -10,20 +10,20 @@
     {
         /// <summary>
         /// 瀹氫箟涓�涓潤鎬佸璞�
-        /// </summary>
-        private static LogicMethod logicMethod = null;
+        /// </summary> 
+        private static LogicMethod s_Current = null;   
         /// <summary>
         /// 鑾峰彇闈欐�佸璞�
         /// </summary>
-        public static LogicMethod CurrLogicMethod
+        public static LogicMethod Current
         {
             get
             {
-                if (logicMethod == null)
+                if (s_Current == null)
                 {
                     return new LogicMethod();
                 }
-                return logicMethod;
+                return s_Current;
             }
 
         }
@@ -182,9 +182,35 @@
         /// <returns></returns>
         public List<HDL_ON.Entity.Function> GetGatewayDeviceList()
         {
-            var list = Entity.FunctionList.List.GetDeviceFunctionList();
+            var list = new List<HDL_ON.Entity.Function>();
+            var list1 = Entity.FunctionList.List.GetDeviceFunctionList();
+            var list2 = this.GetVideoDeviceList();
+            list.AddRange(list1);
+            list.AddRange(list2);
             //GetTestDevice(ref list, true);
             return list;
+        }
+        /// <summary>
+        /// 鑾峰彇鍙瀵硅璁惧鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public List<HDL_ON.Entity.Function> GetVideoDeviceList()
+        {
+            var functionList = new List<Function>();
+            foreach (var videoDevice in FunctionList.List.videoIntercom) {
+                Function function = new Function();
+                function.spk = videoDevice.spk;
+                function.name = videoDevice.deviceName;
+                function.deviceId = videoDevice.deviceId;
+                function.online = videoDevice.status== "online";
+                function.sid = videoDevice.sid;
+                var video = functionList.Find((o) => o.deviceId == function.deviceId);
+                if (video == null) {
+                    functionList.Add(function);
+                }
+
+            }
+            return functionList;
         }
         /// <summary>
         /// 鑾峰彇鍦烘櫙鍒楄〃
@@ -326,7 +352,11 @@
             string strPath = "";
             switch (functionType)
             {
-
+                case SPK.doorgate:
+                    {
+                        strPath = "VideoIcon/keshiduijiang.png";
+                    }
+                    break;
                 case SPK.AirSwitch:
                     {
                         strPath = "FunctionIcon/Icon/electricalbreaker.png";
@@ -405,6 +435,12 @@
                 case SPK.DoorLock:
                     {
                         strPath = "FunctionIcon/DoorLock/DoorLock.png";
+                    }
+                    break;
+                case SPK.MusicStandard:
+                case SPK.AvMusic:
+                    {
+                        strPath = "MusicIcon/localMusic.png";
                     }
                     break;
 
@@ -505,6 +541,18 @@
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.DoorLock));
             }
+            ///闊充箰绫�
+            var music = deviceList.Find((device) => device.spk == SPK.MusicStandard || device.spk == SPK.AvMusic);
+            if (music != null)
+            {
+                deviceStrTypeList.Add(Language.StringByID(StringId.Music));
+            }
+            ///鍙瀵硅
+            var doorgate = deviceList.Find((device) => device.spk == SPK.doorgate);
+            if (doorgate != null)
+            {
+                deviceStrTypeList.Add(Language.StringByID(StringId.VideoIntercom));
+            }
             return deviceStrTypeList;
 
         }
@@ -592,6 +640,17 @@
             {
                 functionTypeList.Add(SPK.DoorLock);
             }
+            ///闊充箰绫�
+            else if (deviceType == Language.StringByID(StringId.Music))
+            {
+                functionTypeList.Add(SPK.MusicStandard);
+                functionTypeList.Add(SPK.AvMusic);
+            }
+            ///HDL鍙瀵硅
+            else if (deviceType == Language.StringByID(StringId.VideoIntercom))
+            {
+                functionTypeList.Add(SPK.doorgate);
+            }
             else
             {
                 //鍏ㄩ儴鍖哄煙
@@ -640,6 +699,10 @@
                 functionTypeList.Add(SPK.SensorHelp);
                 functionTypeList.Add(SPK.DoorLock);
                 functionTypeList.Add(SPK.CurtainDream);
+                functionTypeList.Add(SPK.MusicStandard);
+                functionTypeList.Add(SPK.AvMusic);
+                functionTypeList.Add(SPK.doorgate);
+
             }
 
 
@@ -694,6 +757,7 @@
                         deviceTypeList.Add(SPK.HvacCac);
                         deviceTypeList.Add(SPK.SensorHelp);
                         deviceTypeList.Add(SPK.DoorLock);
+                        deviceTypeList.Add(SPK.doorgate); 
 
                     }
                     break;
@@ -714,6 +778,8 @@
                         deviceTypeList.Add(SPK.PanelSocket);
                         deviceTypeList.Add(SPK.ElectricSocket);
                         deviceTypeList.Add(SPK.CurtainDream);
+                        deviceTypeList.Add(SPK.MusicStandard);
+                        deviceTypeList.Add(SPK.AvMusic);
                     }
                     break;
             }
@@ -948,8 +1014,8 @@
                 try
                 {
                     //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻>
-                    var idStr = Send.GetLogicIdList();
-                    if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
+                    var idStr = Send.Current.GetLogicIdList();
+                    if (idStr != null)
                     {
                         var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
                         logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
@@ -993,7 +1059,7 @@
                             if (isPush == null)
                             {
                                 //鎺ㄩ�佺粰浜戠鏄惁鎴愬姛
-                                bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction);
+                                bool push = Send.Current.GetFenceStateReport(logicDate.userLogicId, logicDate.sid, direction);
                                 if (push)
                                 {
                                     ///娣诲姞鍒版帹閫佸垪琛�
@@ -1029,8 +1095,10 @@
             {
                 //妯℃嫙璁惧
                 var functions = new List<Function> {
-                 new Entity.Function { sid = "0123456789", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic },
-                 };
+                 new Entity.Function { sid = "1234567890", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic },
+                  new Entity.Function { sid = "1234567891", name = "娓╁害浼犳劅鍣�", spk = Entity.SPK.SensorTemperature },
+                   new Entity.Function { sid = "1234567892", name = "婀垮害浼犳劅鍣�", spk = Entity.SPK.SensorHumidity },
+            };
                 foreach (var function in functions)
                 {
                     var device = list.Find((o) => { return o.sid == function.sid; });
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
index c842a69..31feff1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
@@ -893,9 +893,12 @@
         /// 淇℃伅鎻愮ず绐楀彛锛岃嚜鍔ㄥ叧闂�
         /// </summary>
         /// <param name="msg">鎻愮ず閿欒鏂囨湰</param>
-        public void FlashingBox(string msg,int time=2)
+        public void FlashingBox(string msg, int time = 2)
         {
-            new PublicAssmebly().TipMsgAutoClose(msg, false, time*1000);
+            Application.RunOnMainThread(() =>
+            {
+                new PublicAssmebly().TipMsgAutoClose(msg, false, time * 1000);
+            });
         }
 
         /// <summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
index 66fe538..1a14583 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -73,7 +73,7 @@
                         try
                         {
                             //閫昏緫浣胯兘鐨勫懡浠�
-                            Send.SwitchLogic(currLogic);
+                            Send.Current.SwitchLogic(currLogic);
 
                         }
                         catch { }
@@ -268,8 +268,8 @@
             }
             List<string> logicIdList = new List<string>();
             //鑾峰彇閫昏緫ID鍒楄〃
-            var idStr = Send.GetLogicIdList();
-            if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
+            var idStr = Send.Current.GetLogicIdList();
+            if (idStr != null)
             {
                 var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
                 var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
@@ -280,17 +280,13 @@
                 }
             }
             //鑾峰彇鑷姩鍖栧垪琛�
-            var logicStr = Send.GetLogic(logicIdList);
-            if (logicStr.Code == "0" && logicStr.Data != null && logicStr.Data.ToString() != "")
+            var logicListStr = Send.Current.GetLogic(logicIdList);
+            if (logicListStr != null)
             {
-                //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�);
-                var jArray = JArray.Parse(logicStr.Data.ToString());
-                for (int a = 0; a < jArray.Count; a++)
+                var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(logicListStr.Data.ToString());
+                for (int j = 0; j < logicList.Count; j++)
                 {
-                    var jay = jArray[a];
-                    //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
-                    var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                    var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
+                    var logic = logicList[j];
                     if (logic != null)
                     {
                         //鏌ユ壘鏄惁宸茬粡瀛樺湪璇ラ�昏緫
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs
index 6da7fb2..e548adf 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs
@@ -67,7 +67,7 @@
             }
 
             // 鏉′欢澶勭悊鏂规硶
-            InpOrOutLogicMethod.InputCondition(this, viewLayout);
+            InpOrOutLogicMethod.Current.InputCondition(this, viewLayout);
             ///娣诲姞鍥炬爣鐨刅iew
             LogicView.LogicAddView addInputIcon = new LogicView.LogicAddView();
             addInputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
@@ -79,7 +79,7 @@
             LogicView.AddOutputInputTextView addOutpuTextView = new LogicView.AddOutputInputTextView();
             addOutpuTextView.btnIf.TextID = StringId.isExecuted;
             viewLayout.AddChidren(addOutpuTextView.FLayoutView(54, 20));
-            
+
 
             #region  鎵ц鎺ㄩ�� 鍙戦�侀�氱煡
             ///涓婁笅闂撮殧12鍍忕礌
@@ -187,7 +187,7 @@
                 }
                 Loading loading = new Loading();
                 this.AddChidren(loading);
-                HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+                HDL_ON.DAL.Server.ResponsePackNew r = null;
                 if (string.IsNullOrEmpty(Logic.currlogic.userLogicId))
                 {
                     List<string> list = new List<string>();
@@ -195,15 +195,15 @@
                     {
                         list.Add(logic.name);
                     }
-                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view) =>
+                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.Current.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view) =>
                     {
                         Logic.currlogic.name = logicName;
-                        Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid();
+                        Logic.currlogic.sid = LogicMethod.Current.NewSid();
                         if (MainPage.NoLoginMode)
                         {
                             Logic.currlogic.userLogicId = Guid.NewGuid().ToString();
                             Logic.LogicList.Add(Logic.currlogic);
-                            LogicMethod.CurrLogicMethod.RemoveAllView();
+                            LogicMethod.Current.RemoveAllView();
                             MainView.MainShow();
                             return;
                         }
@@ -213,8 +213,7 @@
                             try
                             {
                                 //鍙戦�佹柊鍔犻�昏緫鍛戒护锛�
-                                responsePackNew = Send.AddLogic(Logic.currlogic);
-
+                                r = Send.Current.AddLogic(Logic.currlogic, true);
                             }
                             catch { }
                             finally
@@ -222,42 +221,24 @@
                                 Application.RunOnMainThread(() =>
                                 {
                                     loading.Hide();
-                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                    if (r != null)
                                     {
-
-
-                                        //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�);
-                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
-                                        for (int a = 0; a < jArray.Count; a++)
+                                        var userLogicIdList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(r.Data.ToString());
+                                        for (int i = 0; i < userLogicIdList.Count; i++)
                                         {
-                                            var jay = jArray[a];
-                                            //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
-                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                                            var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
-                                            if (logic.userLogicId != "")
-                                            {
-                                                //鏇存柊浜戠鍞竴鑷姩鍖杋d;
-                                                Logic.currlogic.userLogicId = logic.userLogicId;
-                                            }
-                                            else
+                                            var logic = userLogicIdList[i];
+                                            if (string.IsNullOrEmpty(logic.userLogicId))
                                             {
                                                 //鑷繁鐪嬬殑鎵�浠ヤ笉闇�瑕佹敮鎸佷腑鑻辨枃
                                                 new LogicView.TipPopView().FlashingBox("娌℃湁杩斿洖浜戠鍞竴鑷姩鍖杋d");
                                             }
-
+                                            //鏇存柊浜戠鍞竴鑷姩鍖杋d;
+                                            Logic.currlogic.userLogicId = logic.userLogicId;
                                         }
 
                                         Logic.LogicList.Add(Logic.currlogic);
-                                        LogicMethod.CurrLogicMethod.RemoveAllView();
+                                        LogicMethod.Current.RemoveAllView();
                                         MainView.MainShow();
-                                    }
-                                    else if (responsePackNew != null && responsePackNew.Code == "14005")
-                                    {
-                                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
-                                    }
-                                    else
-                                    {
-                                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                                     }
                                 });
                             }
@@ -277,7 +258,7 @@
                         try
                         {
                             //鍙戦�佷慨鏀归�昏緫鍛戒护锛�
-                            responsePackNew = Send.UpdateLogic(Logic.currlogic);
+                            r = Send.Current.UpdateLogic(Logic.currlogic, true);
 
                         }
                         catch { }
@@ -286,23 +267,14 @@
                             Application.RunOnMainThread(() =>
                             {
                                 loading.Hide();
-                                if (responsePackNew != null && responsePackNew.Code == "0")
+                                if (r != null)
                                 {
-                                    LogicMethod.CurrLogicMethod.RemoveAllView();
+                                    LogicMethod.Current.RemoveAllView();
                                     MainView.MainShow();
                                 }
-                                else if (responsePackNew != null && responsePackNew.Code == "14005")
-                                {
-                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
-                                }
-                                else
-                                {
-                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
-                                }
+
                             });
                         }
-
-
 
                     })
                     { IsBackground = true }.Start();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
index 0e7d6c0..5c4ec9f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
@@ -181,13 +181,13 @@
         public void AddDic(string keyValue, string comparator,string value,string data_type)
         {
             Input input = new Input();
-            input.sid = LogicMethod.CurrLogicMethod.NewSid();
+            input.sid = LogicMethod.Current.NewSid();
             input.condition_type = "6";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", data_type);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
+            LogicMethod.Current.dictionary(dic, "key", keyValue);
+            LogicMethod.Current.dictionary(dic, "comparator", comparator);
+            LogicMethod.Current.dictionary(dic, "data_type", data_type);
+            LogicMethod.Current.dictionary(dic, "value", value);
             input.condition.Add(dic);
             AddCondition(input, keyValue, comparator);
         }
@@ -227,7 +227,7 @@
                 Logic.currlogic.input.Add(input);
             }
 
-            LogicMethod.CurrLogicMethod.RemoveAllView();
+            LogicMethod.Current.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index ee921ce..0dc90c0 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -261,9 +261,10 @@
         /// </summary>
         /// <param name="frame">鏄剧ず鍦ㄥ摢涓晫闈㈢殑鐖舵帶浠�</param>
         /// <param name="list">鏄剧ず鏁版嵁婧�</param>
+        /// <param name="stateList">涔嬪墠鐘舵�佹暟鎹簮</param>
         /// <param name="titleText">鏍囬</param>
         /// <param name="action">杩斿洖鍊肩储寮曞��</param>
-        public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
+        public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, string titleText, Action<int> action,bool isIcon=true)
         {
 
             int line = 0;
@@ -284,7 +285,7 @@
             frame.AddChidren(frameLayout);
 
             LogicView.DateView view = new LogicView.DateView();
-            view.btnTitle.TextID = titleText;
+            view.btnTitle.Text = titleText;
             view.FLayoutView(frameLayout, line);
             view.btnCancel.MouseUpEventHandler += (sender, e) =>
             {
@@ -310,7 +311,7 @@
                 verticalRefresh.EndHeaderRefreshing();
             };
 
-            if (list.Count == 0)
+            if (list.Count == 0&&isIcon)
             {
                 Button btnTipNot = new Button
                 {
@@ -367,12 +368,18 @@
                     verticalRefresh.AddChidren(checkView.FLayoutView());
                 }
 
-                if (stateList.Contains(strName))
-                {
-                    checkView.btnCheckIcon.IsSelected = true;
-                }
                 checkView.btnText.Text = strName;
                 checkView.btnClick.Tag = i;//鏍囪
+
+                if (stateList.Contains(strName))
+                {
+                    //checkView.btnCheckIcon.IsSelected = true;
+
+                    checkBtn.IsSelected = false;
+                    checkView.btnCheckIcon.IsSelected = true;
+                    checkBtn = checkView.btnCheckIcon;
+                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
+                }
                 //鐐瑰嚮浜嬩欢
                 checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                 {
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs
index 548c92b..062e4c5 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs
@@ -28,7 +28,7 @@
                 BackgroundColor = CSS.CSS_Color.viewMiddle,
             };
             this.AddChidren(viewLayout);
-            var securityList = LogicMethod.CurrLogicMethod.GetSecurityList();
+            var securityList = LogicMethod.Current.GetSecurityList();
             for (int i = 0; i < securityList.Count; i++)
             {
                 var security = securityList[i];
@@ -93,7 +93,7 @@
              outputDevice.sid = sid;
              outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "security" }, { "value", selecttionMode } } };
              AddOutput(outputDevice, true);
-             LogicMethod.CurrLogicMethod.RemoveAllView();
+             LogicMethod.Current.RemoveAllView();
              AddLogic addLogic = new AddLogic();
              MainPage.BasePageView.AddChidren(addLogic);
              addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
index d955285..0e4c022 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -8,410 +8,537 @@
 
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
-  public class Send
-  {
-
-    /// <summary>
-    /// 璋冪敤鑾峰彇浣忓畢瀛愯处鍙峰垪琛�
-    /// </summary>
-    public static List<ResidenceMemberInfo> GetResidenceMemberAccount()
+    public class Send
     {
-
-      var responePack = new HttpServerRequest().GetResidenceMemberAccount();
-      if (responePack.Code == StateCode.SUCCESS)
-      {
-        return Newtonsoft.Json.JsonConvert.DeserializeObject<List<ResidenceMemberInfo>>(responePack.Data.ToString());
-      }
-      //澶辫触
-      else
-      {
-        //鎻愮ず
-        IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
-      }
-      return new List<ResidenceMemberInfo>();
-    }
-    /// <summary>
-    /// 鑾峰彇閫昏緫ID鍒楄〃
-    /// </summary>
-    /// <returns></returns>
-    public static ResponsePackNew GetLogicIdList()
-    {
-      var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId } };
-      var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List);
-      //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-      if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
-      {
-        RefreshToken();
-        GetLogicIdList();
-      }
-      return responsePackNew;
-    }
-    /// <summary>
-    /// 鑾峰彇閫昏緫
-    /// </summary>
-    /// <param name="listIdList">閫昏緫ID鍒楄〃</param>
-    /// <returns></returns>
-    public static ResponsePackNew GetLogic(List<string> listIdList)
-    {
-      var jArray = new JArray { };
-      for (int i = 0; i < listIdList.Count; i++)
-      {
-        jArray.Add(listIdList[i]);
-      }
-      var jObject = new JObject { { "userLogicIds", jArray } };
-      var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info);
-      //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-      if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
-      {
-        RefreshToken();
-        GetLogic(listIdList);
-      }
-      return responsePackNew;
-    }
-    /// <summary>
-    /// 娣诲姞鑷姩鍖栧懡浠� 
-    /// </summary>
-    /// <param name="logic"></param>
-    /// <returns></returns>
-    public static ResponsePackNew AddLogic(Logic logic)
-    {
-      ResponsePackNew responsePackNew = null;
-      try
-      {
-
-        var cycleJObject = new JObject { };
-        var cyclevaluejArray = new JArray { };
-        cycleJObject.Add("type", logic.cycle.type);
-        foreach (var dictionary in logic.cycle.value)
+        private static Send s_Current = null;  
+        public static Send Current
         {
-          cyclevaluejArray.Add(dictionary);
-        }
-        cycleJObject.Add("value", cyclevaluejArray);
-
-        var inputArray = new JArray { };
-        foreach (var dictionary in logic.input)
-        {
-          var inputTypeJOb = new JObject { };
-          inputTypeJOb.Add("sid", dictionary.sid);
-          inputTypeJOb.Add("condition_type", dictionary.condition_type);
-
-          var conditionArray = new JArray { };
-          foreach (var dic in dictionary.condition)
-          {
-            var conditionJOb = new JObject { };
-            conditionJOb.Add("key", dic["key"]);
-            conditionJOb.Add("comparator", dic["comparator"]);
-            conditionJOb.Add("data_type", dic["data_type"]);
-            conditionJOb.Add("value", dic["value"]);
-            conditionArray.Add(conditionJOb);
-          }
-          inputTypeJOb.Add("condition", conditionArray);
-          if (dictionary.condition_type == "8")
-          {
-            ///鍦扮悊鍥存爮
-            var geo_fencejob = new JObject();
-            geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
-            geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
-            geo_fencejob.Add("radius", dictionary.geo_fence.radius);
-            inputTypeJOb.Add("geo_fence", geo_fencejob);
-          }
-          inputArray.Add(inputTypeJOb);
-        }
-
-        var outputArray = new JArray { };
-        foreach (var dictionary in logic.output)
-        {
-          var outputTypeJOb = new JObject { };
-          outputTypeJOb.Add("sid", dictionary.sid);
-          outputTypeJOb.Add("delay", dictionary.delay);
-          outputTypeJOb.Add("target_type", dictionary.target_type);
-          var statusArray = new JArray { };
-          foreach (var dic in dictionary.status)
-          {
-            var statusJOb = new JObject { };
-            statusJOb.Add("key", dic["key"]);
-            statusJOb.Add("value", dic["value"]);
-            statusArray.Add(statusJOb);
-          }
-          outputTypeJOb.Add("status", statusArray);
-          outputArray.Add(outputTypeJOb);
-        }
-
-
-        var noticeConfigJObject = new JObject();
-        noticeConfigJObject.Add("enable", logic.noticeConfig.enable);
-        noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent);
-
-        var pushConfigsArray = new JArray { };
-        if (logic.pushConfigs.Count > 0)
-        {   //聽鎺ㄩ�佹枃鏈�
-          foreach (var pushConfig in logic.pushConfigs)
-          {
-
-            var pushConfigJob = new JObject { };
-            pushConfigJob.Add("pushMethod", pushConfig.pushMethod);
-            var accountArray = new JArray { };
-            foreach (var account in pushConfig.pushTarget)
+            get
             {
-              accountArray.Add(account);
+                if (s_Current == null)
+                {
+                    s_Current = new Send();
+                }
+                return s_Current;
             }
-            pushConfigJob.Add("pushTarget", accountArray);
-            pushConfigsArray.Add(pushConfigJob);
-          }
         }
-
-        var logicjArray = new JArray { };
-        var logicIfon = new JObject { };
-        logicIfon.Add("sid", logic.sid);
-        logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId);
-        logicIfon.Add("tag", logic.tag);
-        logicIfon.Add("name", logic.name);
-        logicIfon.Add("relation", logic.relation);
-        logicIfon.Add("enable", logic.enable);
-        logicIfon.Add("cycle", cycleJObject);
-        logicIfon.Add("input", inputArray);
-        logicIfon.Add("output", outputArray);
-        logicIfon.Add("noticeConfig", noticeConfigJObject);
-        logicIfon.Add("pushConfigs", pushConfigsArray);
-        logicjArray.Add(logicIfon);
-       //string str = logicIfon.ToString();
-        var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } };
-        responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add, 5);
-        //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-        if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+        public List<Face> faceList = new List<Face>();
+        /// <summary>
+        /// 璋冪敤鑾峰彇浣忓畢瀛愯处鍙峰垪琛�
+        /// </summary>
+        public  List<ResidenceMemberInfo> GetResidenceMemberAccount()
         {
-          RefreshToken();
-          AddLogic(logic);
-        }
-      }
-      catch (Exception e)
-      {
-        var dd = e.Message;
-      }
-      return responsePackNew;
-    }
-    /// <summary>
-    /// 缂栬緫鏇存柊閫昏緫
-    /// </summary>
-    /// <param name="logic"></param>
-    /// <returns></returns>
-    public static ResponsePackNew UpdateLogic(Logic logic)
-    {
-      ResponsePackNew responsePackNew = null;
-      try
-      {
-        var cycleJObject = new JObject { };
-        var cyclevaluejArray = new JArray { };
-        cycleJObject.Add("type", logic.cycle.type);
-        foreach (var dictionary in logic.cycle.value)
-        {
-          cyclevaluejArray.Add(dictionary);
-        }
-        cycleJObject.Add("value", cyclevaluejArray);
 
-        var inputArray = new JArray { };
-        foreach (var dictionary in logic.input)
-        {
-          var inputTypeJOb = new JObject { };
-          inputTypeJOb.Add("sid", dictionary.sid);
-          inputTypeJOb.Add("condition_type", dictionary.condition_type);
-
-          var conditionArray = new JArray { };
-          foreach (var dic in dictionary.condition)
-          {
-
-            var conditionJOb = new JObject { };
-            conditionJOb.Add("key", dic["key"]);
-            var c1 = "";
-            dic.TryGetValue("comparator", out c1);
-            c1 = string.IsNullOrEmpty(c1) ? "" : c1;
-            conditionJOb.TryAdd("comparator", c1);
-            conditionJOb.Add("data_type", dic["data_type"]);
-            conditionJOb.Add("value", dic["value"]);
-            conditionArray.Add(conditionJOb);
-            if (dictionary.condition_type == "8")
+            var responePack = new HttpServerRequest().GetResidenceMemberAccount();
+            if (responePack.Code == StateCode.SUCCESS)
             {
-              ///鍦扮悊鍥存爮
-              var geo_fencejob = new JObject();
-              geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
-              geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
-              geo_fencejob.Add("radius", dictionary.geo_fence.radius);
-              inputTypeJOb.Add("geo_fence", geo_fencejob);
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<List<ResidenceMemberInfo>>(responePack.Data.ToString());
             }
-          }
-          inputTypeJOb.Add("condition", conditionArray);
-          inputArray.Add(inputTypeJOb);
-        }
-
-        var outputArray = new JArray { };
-        foreach (var dictionary in logic.output)
-        {
-          var outputTypeJOb = new JObject { };
-          outputTypeJOb.Add("sid", dictionary.sid);
-          outputTypeJOb.Add("delay", dictionary.delay);
-          outputTypeJOb.Add("target_type", dictionary.target_type);
-          var statusArray = new JArray { };
-          foreach (var dic in dictionary.status)
-          {
-            var statusJOb = new JObject { };
-            statusJOb.Add("key", dic["key"]);
-            statusJOb.Add("value", dic["value"]);
-            statusArray.Add(statusJOb);
-          }
-          outputTypeJOb.Add("status", statusArray);
-          outputArray.Add(outputTypeJOb);
-        }
-
-        var noticeConfigJObject = new JObject();
-        noticeConfigJObject.Add("enable", logic.noticeConfig.enable);
-        noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent);
-
-        var pushConfigsArray = new JArray { };
-        if (logic.pushConfigs.Count > 0)
-        {
-          //聽鎺ㄩ�佹枃鏈�
-          foreach (var pushConfig in logic.pushConfigs)
-          {
-
-            var pushConfigJob = new JObject { };
-            pushConfigJob.Add("pushMethod", pushConfig.pushMethod);
-            var accountArray = new JArray { };
-            foreach (var account in pushConfig.pushTarget)
+            //澶辫触
+            else
             {
-              accountArray.Add(account);
+                //鎻愮ず
+                IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
             }
-            pushConfigJob.Add("pushTarget", accountArray);
-            pushConfigsArray.Add(pushConfigJob);
-          }
+            return new List<ResidenceMemberInfo>();
         }
-
-        var logicjArray = new JArray { };
-        var logicIfon = new JObject { };
-        logicIfon.Add("userLogicId", logic.userLogicId);
-        logicIfon.Add("sid", logic.sid);
-        logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId);
-        logicIfon.Add("tag", logic.tag);
-        logicIfon.Add("name", logic.name);
-        logicIfon.Add("relation", logic.relation);
-        logicIfon.Add("enable", logic.enable);
-        logicIfon.Add("cycle", cycleJObject);
-        logicIfon.Add("input", inputArray);
-        logicIfon.Add("output", outputArray);
-        logicIfon.Add("noticeConfig", noticeConfigJObject);
-        logicIfon.Add("pushConfigs", pushConfigsArray);
-
-        logicjArray.Add(logicIfon);
-        var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } };
-
-        string str = jObject.ToString();
-        responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update, 5);
-        //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-        if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+        /// <summary>
+        /// 鑾峰彇閫昏緫ID鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetLogicIdList(bool isTip = false)
         {
-          RefreshToken();
-          UpdateLogic(logic);
+            var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List, "鑾峰彇閫昏緫ID鍒楄〃");
+            //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+            {
+                RefreshToken();
+                GetLogicIdList(isTip);
+            }
+            if (Check(responsePackNew, isTip) == false)
+            {
+                return null;
+            }
+            return responsePackNew;
         }
-      }
-      catch (Exception e)
-      {
-        var dd = e.Message;
-      }
-      return responsePackNew;
-    }
-    /// <summary>
-    /// 鍒犻櫎閫昏緫
-    /// </summary>
-    /// <returns></returns>
-    public static ResponsePackNew DelLogic(Logic logic)
-    {
-      var jArray = new JArray { };
-      jArray.Add(logic.userLogicId);
-      var jObject = new JObject { { "userLogicIds", jArray } };
-      var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete);
-      //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-      if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
-      {
-        RefreshToken();
-        DelLogic(logic);
-      }
-      return responsePackNew;
-    }
-    /// <summary> 
-    /// 閫昏緫寮�鍏�
-    /// </summary>
-    /// <returns></returns>
-    public static ResponsePackNew SwitchLogic(Logic logic)
-    {
-      var jArray = new JArray { };
-      var job = new JObject { { "userLogicId", logic.userLogicId }, { "enable", logic.enable } };
-      jArray.Add(job);
-      var jObject = new JObject { { "logics", jArray } };
-      var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable);
-      //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-      if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
-      {
-        RefreshToken();
-        SwitchLogic(logic);
-      }
-      return responsePackNew;
-    }
-    /// <summary> 
-    /// 鑷姩鍖栧湴鐞嗗洿鏍忕姸鎬佷笂鎶�
-    /// </summary>
-    /// <param name="userLogicId">鑷姩鍖栦簯绔痠d<澶囨敞锛歭ogicSid涓巙serLogicId 涓嶈兘鍚屾椂涓虹┖></param>
-    /// <param name="logicSid">鑷姩鍖杝id<澶囨敞锛歭ogicSid涓巙serLogicId 涓嶈兘鍚屾椂涓虹┖></param>
-    /// <param name="direction">arrive:鍒拌揪(杩涘叆) leave锛氱寮�</param>
-    /// <returns></returns>
-    public static bool GeoFenceStateReport(string userLogicId, string logicSid, string direction)
-    {
-      var jObject = new JObject();
-      jObject.Add("homeId", LogicMethod.CurrLogicMethod.HomeId);
-      jObject.Add("userLogicId", userLogicId);
-      jObject.Add("sid", logicSid);
-      jObject.Add("direction", direction);
-      var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_GeoFenceStateReport);
-      //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-      if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
-      {
-        RefreshToken();
-        GeoFenceStateReport(userLogicId, logicSid, direction);
-      }
-      if (responsePackNew.Code == "0")
-      {
-        //鎴愬姛
-        return true;
-      }
-      //澶辫触
-      return false;
-    }
+        /// <summary>
+        /// 鑾峰彇鑷姩鍖栬鎯�
+        /// </summary>
+        /// <param name="listIdList">鑷姩鍖朓D鍒楄〃</param>
+        /// <returns></returns>
+        public  ResponsePackNew GetLogic(List<string> listIdList, bool isTip = false)
+        {
+            var jArray = new JArray { };
+            for (int i = 0; i < listIdList.Count; i++)
+            {
+                jArray.Add(listIdList[i]);
+            }
+            var jObject = new JObject { { "userLogicIds", jArray } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info, "鑾峰彇鑷姩鍖栬鎯�");
+            //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+            {
+                RefreshToken();
+                GetLogic(listIdList,isTip);
+            }
+            if (Check(responsePackNew, isTip) == false)
+            {
+                return null;
+            }
+            return responsePackNew;
+        }
+        /// <summary>
+        /// 娣诲姞鑷姩鍖栧懡浠� 
+        /// </summary>
+        /// <param name="logic"></param>
+        /// <returns></returns>
+        public  ResponsePackNew AddLogic(Logic logic,bool isTip)
+        {
+            ResponsePackNew responsePackNew = null;
+            try
+            {
 
-    /// <summary>
-    ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� 
-    /// </summary>
-    /// <returns></returns>
-    public static ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 3)
-    {
-      var requestJson = HttpUtil.GetSignRequestJson(o);
-      return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout);
+                var cycleJObject = new JObject { };
+                var cyclevaluejArray = new JArray { };
+                cycleJObject.Add("type", logic.cycle.type);
+                foreach (var dictionary in logic.cycle.value)
+                {
+                    cyclevaluejArray.Add(dictionary);
+                }
+                cycleJObject.Add("value", cyclevaluejArray);
+
+                var inputArray = new JArray { };
+                foreach (var dictionary in logic.input)
+                {
+                    var inputTypeJOb = new JObject { };
+                    inputTypeJOb.Add("sid", dictionary.sid);
+                    inputTypeJOb.Add("condition_type", dictionary.condition_type);
+                    if (dictionary.condition_type=="9") {
+                        inputTypeJOb.Add("identifier", dictionary.identifier);
+                    }
+                    var conditionArray = new JArray { };
+                    foreach (var dic in dictionary.condition)
+                    {
+                        var conditionJOb = new JObject { };
+                        conditionJOb.Add("key", dic["key"]);
+                        conditionJOb.Add("comparator", dic["comparator"]);
+                        conditionJOb.Add("data_type", dic["data_type"]);
+                        conditionJOb.Add("value", dic["value"]);
+                        conditionArray.Add(conditionJOb);
+                    }
+                    inputTypeJOb.Add("condition", conditionArray);
+                    if (dictionary.condition_type == "8")
+                    {
+                        ///鍦扮悊鍥存爮
+                        var geo_fencejob = new JObject();
+                        geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
+                        geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
+                        geo_fencejob.Add("radius", dictionary.geo_fence.radius);
+                        inputTypeJOb.Add("geo_fence", geo_fencejob);
+                    }
+                    inputArray.Add(inputTypeJOb);
+                }
+
+                var outputArray = new JArray { };
+                foreach (var dictionary in logic.output)
+                {
+                    var outputTypeJOb = new JObject { };
+                    outputTypeJOb.Add("sid", dictionary.sid);
+                    outputTypeJOb.Add("delay", dictionary.delay);
+                    outputTypeJOb.Add("target_type", dictionary.target_type);
+                    var statusArray = new JArray { };
+                    foreach (var dic in dictionary.status)
+                    {
+                        var statusJOb = new JObject { };
+                        statusJOb.Add("key", dic["key"]);
+                        statusJOb.Add("value", dic["value"]);
+                        statusArray.Add(statusJOb);
+                    }
+                    outputTypeJOb.Add("status", statusArray);
+                    outputArray.Add(outputTypeJOb);
+                }
+
+
+                var noticeConfigJObject = new JObject();
+                noticeConfigJObject.Add("enable", logic.noticeConfig.enable);
+                noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent);
+
+                var pushConfigsArray = new JArray { };
+                if (logic.pushConfigs.Count > 0)
+                {   //聽鎺ㄩ�佹枃鏈�
+                    foreach (var pushConfig in logic.pushConfigs)
+                    {
+
+                        var pushConfigJob = new JObject { };
+                        pushConfigJob.Add("pushMethod", pushConfig.pushMethod);
+                        var accountArray = new JArray { };
+                        foreach (var account in pushConfig.pushTarget)
+                        {
+                            accountArray.Add(account);
+                        }
+                        pushConfigJob.Add("pushTarget", accountArray);
+                        pushConfigsArray.Add(pushConfigJob);
+                    }
+                }
+
+                var logicjArray = new JArray { };
+                var logicIfon = new JObject { };
+                logicIfon.Add("sid", logic.sid);
+                logicIfon.Add("gatewayId", LogicMethod.Current.GatewayId);
+                logicIfon.Add("tag", logic.tag);
+                logicIfon.Add("name", logic.name);
+                logicIfon.Add("relation", logic.relation);
+                logicIfon.Add("enable", logic.enable);
+                logicIfon.Add("cycle", cycleJObject);
+                logicIfon.Add("input", inputArray);
+                logicIfon.Add("output", outputArray);
+                logicIfon.Add("noticeConfig", noticeConfigJObject);
+                logicIfon.Add("pushConfigs", pushConfigsArray);
+                logicjArray.Add(logicIfon);
+                 var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId }, { "logics", logicjArray } };
+                responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add, "娣诲姞鑷姩鍖�", 5);
+                //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+                if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+                {
+                    RefreshToken();
+                    AddLogic(logic,isTip);
+                }
+                if (Check(responsePackNew, isTip) == false)
+                {
+                    return null;
+                }
+            }
+            catch (Exception e)
+            {
+                var dd = e.Message;
+            }
+            return responsePackNew;
+        }
+        /// <summary>
+        /// 缂栬緫鏇存柊鑷姩鍖�
+        /// </summary>
+        /// <param name="logic"></param>
+        /// <returns></returns>
+        public  ResponsePackNew UpdateLogic(Logic logic,bool isTip)
+        {
+            ResponsePackNew responsePackNew = null;
+            try
+            {
+                var cycleJObject = new JObject { };
+                var cyclevaluejArray = new JArray { };
+                cycleJObject.Add("type", logic.cycle.type);
+                foreach (var dictionary in logic.cycle.value)
+                {
+                    cyclevaluejArray.Add(dictionary);
+                }
+                cycleJObject.Add("value", cyclevaluejArray);
+
+                var inputArray = new JArray { };
+                foreach (var dictionary in logic.input)
+                {
+                    var inputTypeJOb = new JObject { };
+                    inputTypeJOb.Add("sid", dictionary.sid);
+                    inputTypeJOb.Add("condition_type", dictionary.condition_type);
+
+                    var conditionArray = new JArray { };
+                    foreach (var dic in dictionary.condition)
+                    {
+
+                        var conditionJOb = new JObject { };
+                        conditionJOb.Add("key", dic["key"]);
+                        var c1 = "";
+                        dic.TryGetValue("comparator", out c1);
+                        c1 = string.IsNullOrEmpty(c1) ? "" : c1;
+                        conditionJOb.TryAdd("comparator", c1);
+                        conditionJOb.Add("data_type", dic["data_type"]);
+                        conditionJOb.Add("value", dic["value"]);
+                        conditionArray.Add(conditionJOb);
+                        if (dictionary.condition_type == "8")
+                        {
+                            ///鍦扮悊鍥存爮
+                            var geo_fencejob = new JObject();
+                            geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
+                            geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
+                            geo_fencejob.Add("radius", dictionary.geo_fence.radius);
+                            inputTypeJOb.Add("geo_fence", geo_fencejob);
+                        }
+                    }
+                    inputTypeJOb.Add("condition", conditionArray);
+                    inputArray.Add(inputTypeJOb);
+                }
+
+                var outputArray = new JArray { };
+                foreach (var dictionary in logic.output)
+                {
+                    var outputTypeJOb = new JObject { };
+                    outputTypeJOb.Add("sid", dictionary.sid);
+                    outputTypeJOb.Add("delay", dictionary.delay);
+                    outputTypeJOb.Add("target_type", dictionary.target_type);
+                    var statusArray = new JArray { };
+                    foreach (var dic in dictionary.status)
+                    {
+                        var statusJOb = new JObject { };
+                        statusJOb.Add("key", dic["key"]);
+                        statusJOb.Add("value", dic["value"]);
+                        statusArray.Add(statusJOb);
+                    }
+                    outputTypeJOb.Add("status", statusArray);
+                    outputArray.Add(outputTypeJOb);
+                }
+
+                var noticeConfigJObject = new JObject();
+                noticeConfigJObject.Add("enable", logic.noticeConfig.enable);
+                noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent);
+
+                var pushConfigsArray = new JArray { };
+                if (logic.pushConfigs.Count > 0)
+                {
+                    //聽鎺ㄩ�佹枃鏈�
+                    foreach (var pushConfig in logic.pushConfigs)
+                    {
+
+                        var pushConfigJob = new JObject { };
+                        pushConfigJob.Add("pushMethod", pushConfig.pushMethod);
+                        var accountArray = new JArray { };
+                        foreach (var account in pushConfig.pushTarget)
+                        {
+                            accountArray.Add(account);
+                        }
+                        pushConfigJob.Add("pushTarget", accountArray);
+                        pushConfigsArray.Add(pushConfigJob);
+                    }
+                }
+
+                var logicjArray = new JArray { };
+                var logicIfon = new JObject { };
+                logicIfon.Add("userLogicId", logic.userLogicId);
+                logicIfon.Add("sid", logic.sid);
+                logicIfon.Add("gatewayId", LogicMethod.Current.GatewayId);
+                logicIfon.Add("tag", logic.tag);
+                logicIfon.Add("name", logic.name);
+                logicIfon.Add("relation", logic.relation);
+                logicIfon.Add("enable", logic.enable);
+                logicIfon.Add("cycle", cycleJObject);
+                logicIfon.Add("input", inputArray);
+                logicIfon.Add("output", outputArray);
+                logicIfon.Add("noticeConfig", noticeConfigJObject);
+                logicIfon.Add("pushConfigs", pushConfigsArray);
+
+                logicjArray.Add(logicIfon);
+                var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId }, { "logics", logicjArray } };
+
+                string str = jObject.ToString();
+                responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update, "缂栬緫鏇存柊鑷姩鍖�", 5);
+                //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+                if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+                {
+                    RefreshToken();
+                    UpdateLogic(logic, isTip);
+                }
+                if (Check(responsePackNew, isTip) == false)
+                {
+                    return null;
+                }
+            }
+            catch (Exception e)
+            {
+                return null;
+            }
+            return responsePackNew;
+        }
+       
+        /// <summary>
+        /// 鍒犻櫎鑷姩鍖�
+        /// </summary>
+        /// <param name="logic">褰撳墠瀵硅薄</param>
+        /// <param name="isTip">鏄惁瑕佹彁绀�</param>
+        /// <returns></returns>
+        public ResponsePackNew DelLogic(Logic logic,bool isTip)
+        {
+            var jArray = new JArray { };
+            jArray.Add(logic.userLogicId);
+            var jObject = new JObject { { "userLogicIds", jArray } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete, "鍒犻櫎鑷姩鍖�");
+            //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+            {
+                RefreshToken();
+                DelLogic(logic, isTip);
+            }
+            if (Check(responsePackNew, isTip) == false)
+            {
+                return null;
+            }
+            return responsePackNew;
+        }
+        /// <summary>
+        /// 鑷姩鍖栦娇鑳�
+        /// </summary>
+        /// <param name="logic">褰撳墠瀵硅薄</param>
+        /// <param name="isTip">鏄惁瑕佹彁绀�</param>
+        /// <returns></returns>
+        public ResponsePackNew SwitchLogic(Logic logic,bool isTip=false)
+        {
+            var jArray = new JArray { };
+            var job = new JObject { { "userLogicId", logic.userLogicId }, { "enable", logic.enable } };
+            jArray.Add(job);
+            var jObject = new JObject { { "logics", jArray } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable, "鑷姩鍖栧紑鍏�");
+            //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+            {
+                RefreshToken();
+                SwitchLogic(logic, isTip);
+            }
+            if (Check(responsePackNew, isTip) == false)
+            {
+                return null;
+            }
+            return responsePackNew;
+        }
+        /// <summary> 
+        /// 鑷姩鍖栧湴鐞嗗洿鏍忕姸鎬佷笂鎶�
+        /// </summary>
+        /// <param name="userLogicId">鑷姩鍖栦簯绔痠d<澶囨敞锛歭ogicSid涓巙serLogicId 涓嶈兘鍚屾椂涓虹┖></param>
+        /// <param name="logicSid">鑷姩鍖杝id<澶囨敞锛歭ogicSid涓巙serLogicId 涓嶈兘鍚屾椂涓虹┖></param>
+        /// <param name="direction">arrive:鍒拌揪(杩涘叆) leave锛氱寮�</param>
+        /// <returns></returns>
+        public  bool GetFenceStateReport(string userLogicId, string logicSid, string direction)
+        {
+            var jObject = new JObject();
+            jObject.Add("homeId", LogicMethod.Current.HomeId);
+            jObject.Add("userLogicId", userLogicId);
+            jObject.Add("sid", logicSid);
+            jObject.Add("direction", direction);
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_GeoFenceStateReport, "鑷姩鍖栧湴鐞嗗洿鏍忕姸鎬佷笂鎶�");
+            //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+            {
+                RefreshToken();
+                GetFenceStateReport(userLogicId, logicSid, direction);
+            }
+            if (responsePackNew.Code == "0")
+            {
+                //鎴愬姛
+                return true;
+            }
+            //澶辫触
+            return false;
+        }
+
+        /// <summary> 
+        /// 鑾峰彇浣忓畢宸插綍鍏ヤ汉鑴镐俊鎭紙鍙瀵硅浜鸿劯寮�闂ㄨЕ鍙戣嚜鍔ㄥ寲閰嶇疆鐢級
+        /// </summary>
+        /// <param name="deviceId">鍙瀵硅璁惧id</param>
+        /// <returns></returns>
+        public List<Face> GetListHomeFace(string deviceId, bool isTip)
+        {
+            var jObject = new JObject();
+            jObject.Add("homeId", LogicMethod.Current.HomeId);
+            jObject.Add("deviceId", deviceId);
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.Api_Post_GetListHomeFace, "鑾峰彇浣忓畢宸插綍鍏ヤ汉鑴镐俊鎭�");
+            //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+            {
+                RefreshToken();
+                GetListHomeFace(deviceId, isTip);
+            }
+            if (Check(responsePackNew, isTip) == false)
+            {
+                return new List<Face>();
+            }
+            var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Face>>(responsePackNew.Data.ToString());
+            if (list == null)
+            {
+                list = new List<Face>();
+            }
+            faceList.Clear();
+            faceList.AddRange(list);
+            return list;
+
+        }
+
+        /// <summary>
+        ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� 
+        /// </summary>
+        /// <returns></returns>
+        public  ResponsePackNew RequestServerhomeId(object o, string api_Url, string tag,int mTimeout = 3)
+        {
+            Log($"{DateTime.Now}->鍙戦��->{tag}", o.ToString());
+            var requestJson = HttpUtil.GetSignRequestJson(o);
+            var r= HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout);
+            Log($"{DateTime.Now}->鍥炲->{tag}", Newtonsoft.Json.JsonConvert.SerializeObject(r));
+            return r;
+
+        }
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣�
+        /// </summary>
+        /// <param name="o">鍙戦�佹暟鎹�</param>
+        /// <param name="api_Url">璇锋眰鍦板潃(涓嶆槸缁濆鍦板潃)</param>
+        /// <param name="tag">鏍囪</param>
+        /// <returns></returns>
+        public  ResponsePackNew RequestServer(object o, string api_Url,string tag)
+        {
+            Log($"鍙戦��->{tag}", o.ToString());
+            var requestJson = HttpUtil.GetSignRequestJson(o);
+            var r = HttpUtil.RequestHttpsPost(api_Url, requestJson);
+            Log($"鍥炲->{tag}", Newtonsoft.Json.JsonConvert.SerializeObject(r));
+            return r;
+        }
+        /// <summary>
+        /// 鍒锋柊Token
+        /// </summary>
+        public  void RefreshToken()
+        {
+            IMessageCommon.Current.StartRefreshToken();
+        }
+        /// <summary>
+        /// 妫�楠屾暟鎹槸鍚﹀悎娉曠殑
+        /// </summary>
+        /// <param name="r"></param>
+        /// <param name="isTip">鏄惁瑕佸脊绐楋紙榛樿鏄痜alse涓嶉渶瑕侊級</param>
+        /// <returns></returns>
+        public bool Check(ResponsePackNew r, bool isTip)
+        {
+            if (r.Code == "0" && r.Data != null && r.Data.ToString() != "")
+            {
+                return true;
+            }
+            if (r.Code != "0")
+            {
+                //澶辫触鏃舵槸鍚﹁鎻愮ず
+                if (isTip)
+                {
+                    new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})");
+                }
+            }
+            return false;
+        }
+        /// <summary>
+        /// 鎵撳嵃鏃ュ織
+        /// </summary>
+        /// <param name="tag">鎵撳嵃鏍囪</param>
+        /// <param name="content">鎵撳嵃鍐呭</param>
+        public void Log(string tag, string content)
+        {
+         #if DEBUG
+            Console.WriteLine(tag + $"\r\n鏁版嵁鍐呭->->{content}");
+         #endif
+        }
+
 
     }
-    /// <summary>
-    /// 璇锋眰鏈嶅姟鍣�
-    /// </summary>
-    /// <returns></returns>
-    public static ResponsePackNew RequestServer(object o, string api_Url)
+    public class Face
     {
-      var requestJson = HttpUtil.GetSignRequestJson(o);
-      return HttpUtil.RequestHttpsPost(api_Url, requestJson);
-
+        /// <summary>
+        /// 鐢ㄦ埛鍚嶇О
+        /// </summary>
+        public string userName = string.Empty;
+        /// <summary>
+        /// 鐢ㄦ埛浜鸿劯id
+        /// </summary>
+        public string userId = string.Empty;
     }
-    /// <summary>
-    /// 鍒锋柊Token
-    /// </summary>
-    public static void RefreshToken()
-    {
-      IMessageCommon.Current.StartRefreshToken();
-    }
-
-  }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
index 06795e1..bffd42c 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
@@ -49,7 +49,7 @@
                 X = Application.GetRealWidth(40),
                 Gravity = Gravity.CenterVertical,
                 TextAlignment = TextAlignment.CenterRight,
-                Text =Logic.currlogic.name,
+                Text = Logic.currlogic.name,
             };
             nameView.frameLayout.AddChidren(btnAutomationName);
 
@@ -57,17 +57,18 @@
             EventHandler<MouseEventArgs> editClick = (sender, e) =>
             {
                 List<string> list = new List<string>();
-                foreach (var logic in Logic.LogicList) {
+                foreach (var logic in Logic.LogicList)
+                {
                     list.Add(logic.name);
                 }
 
-                new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view
+                new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view
                     ) =>
                 {
                     btnAutomationName.Text = logicName;
                     Logic.currlogic.name = logicName;
 
-                },()=> { });
+                }, () => { });
             };
             nameView.btnClick.MouseUpEventHandler += editClick;
             btnAutomationName.MouseUpEventHandler += editClick;
@@ -112,8 +113,7 @@
                         try
                         {
                             //鍙戦�佸垹闄ら�昏緫鍛戒护锛�
-                            responsePackNew = Send.DelLogic(Logic.currlogic);
-
+                            responsePackNew = Send.Current.DelLogic(Logic.currlogic, true);
                         }
                         catch { }
                         finally
@@ -121,27 +121,19 @@
                             Application.RunOnMainThread(() =>
                             {
                                 loading.Hide();
-                                if (responsePackNew != null && responsePackNew.Code == "0")
+                                if (responsePackNew != null)
                                 {
-                                    LogicMethod.CurrLogicMethod.RemoveAllView();
+                                    LogicMethod.Current.RemoveAllView();
                                     Logic.LogicList.Remove(Logic.currlogic);
                                     MainView.MainShow();
                                     //鍙戦�佸垹闄ら�昏緫鍛戒护锛�
-                                }
-                                else if (responsePackNew != null && responsePackNew.Code == "14005")
-                                {
-                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
-                                }
-                                else
-                                {
-                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail));
                                 }
                             });
                         }
 
                     })
                     { IsBackground = true }.Start();
-                   
+
                 });
 
             };
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 2fe4c85..8ca2a76 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -81,7 +81,7 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, lightSwitchView.btnState, null, null, null);
+                            GetEditDeviceState(device, index, lightSwitchView.btnState, null, null, null);
                         }
                         #endregion
                     }
@@ -121,7 +121,7 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null);
+                            GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null);
                         }
                         #endregion
                     }
@@ -145,7 +145,7 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, curtainSwitchView.btnState, null, null, null);
+                            GetEditDeviceState(device, index, curtainSwitchView.btnState, null, null, null);
                         }
                         #endregion
                     }
@@ -181,7 +181,7 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, curtainSwitchView.btnState, crtainPercentumView.btnState, null, null);
+                            GetEditDeviceState(device, index, curtainSwitchView.btnState, crtainPercentumView.btnState, null, null);
                         }
                         #endregion
                     }
@@ -218,7 +218,7 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, crtainPercentumView.btnState, AngleView.btnState, null, null);
+                            GetEditDeviceState(device, index, crtainPercentumView.btnState, AngleView.btnState, null, null);
                         }
                         #endregion
                     }
@@ -322,13 +322,14 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, acSwitchVie.btnState, temperatureView.btnState, acModehView.btnState, acSpeedView.btnState);
+                            GetEditDeviceState(device, index, acSwitchVie.btnState, temperatureView.btnState, acModehView.btnState, acSpeedView.btnState);
                         }
 
                         #endregion
                     }
                     break;
-                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+                case SPK.FloorHeatStandard:
+                case SPK.HvacFloorHeat:
                     {
                         #region 鐣岄潰
                         ///寮�鍏�
@@ -402,7 +403,7 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, floorHeatingSwitchVie.btnState, temperatureView.btnState, floorHeatingModehView.btnState, null);
+                            GetEditDeviceState(device, index, floorHeatingSwitchVie.btnState, temperatureView.btnState, floorHeatingModehView.btnState, null);
                         }
 
                         #endregion
@@ -488,7 +489,72 @@
                         if (edit)
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
-                            GetEditState(device, index, AirFreshSwitchVie.btnState, AirFreshSpeedView.btnState, null, null);
+                            GetEditDeviceState(device, index, AirFreshSwitchVie.btnState, AirFreshSpeedView.btnState, null, null);
+                        }
+
+                        #endregion
+                    }
+                    break;
+                //闊充箰
+                case SPK.MusicStandard:
+                case SPK.AvMusic:
+                    {
+                        #region 鐣岄潰
+                        //鎻愮ず璇煶
+                        LogicView.FunTypeView funTypeView = new LogicView.FunTypeView();
+                        funTypeView.btnText.TextID = StringId.tishiyin;
+                        fLayout.AddChidren(funTypeView.FLayoutView());
+
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, funTypeView.frameLayout.Bottom);
+                        #endregion
+                        #region 鐐瑰嚮浜嬩欢
+                        ///鎻愮ず璇煶鐐瑰嚮浜嬩欢
+                        funTypeView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            selectedState = device.spk + "_";
+                            Loading loading = new Loading();
+                            this.AddChidren(loading);
+                            loading.Start();
+                            System.Threading.Tasks.Task.Run(() =>
+                            {
+                                try
+                                {
+                                    //HDL_ON.DriverLayer.Control.Ins.GetMusicDirectory(device);
+                                    //var palyListName = Music.SendMethod.mMethod.GetListName(device); 
+                                    var palyList= Music.SendMethod.mMethod.GetListMusic(device, "hdl_special");
+                                    List<string> musicNameList = new List<string>();
+                                    for (int i = 0; i < palyList.songs.Count; i++)
+                                    {
+                                        var music = palyList.songs[i];
+                                        musicNameList.Add(music.name);
+                                    }
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        loading.Hide();
+                                        PublicInterface publicInterface = new PublicInterface();
+                                        publicInterface.FrameOrVv(this, musicNameList, new List<string> { funTypeView.btnState.Text }, palyList.group, (index) =>
+                                        {
+                                            var musicSelecetd = palyList.songs[index];
+                                            //鐣岄潰鏄剧ず閫変腑鍊�
+                                            funTypeView.btnState.Text = musicSelecetd.name;
+                                            //鏁版嵁灏佽
+                                            AddDictionary("playlist_name", palyList.group);//鍒楄〃鍚�
+                                            AddDictionary("song_name", musicSelecetd.name);//姝屾洸鍚�
+
+                                        },false);
+
+                                    });
+                                }
+                                catch { }
+
+                            });
+                        };
+
+                        if (edit)
+                        {
+                            //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
+                            GetEditDeviceState(device, index, funTypeView.btnState, null, null, null);
                         }
 
                         #endregion
@@ -505,7 +571,7 @@
                     Output outputDevice = new Output();
                     outputDevice.target_type = "1";
                     outputDevice.sid = device.sid;
-                    outputDevice.delay= strdelay;
+                    outputDevice.delay = strdelay;
                     switch (device.spk)
                     {
                         case SPK.LightDimming:
@@ -539,7 +605,8 @@
                             }
                         case SPK.HvacAC:
                         case SPK.AcStandard:
-                        case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
+                        case SPK.FloorHeatStandard:
+                        case SPK.HvacFloorHeat:
                             {
                                 //鍋氫簡涓�涓壒娈婂鐞嗭紱
                                 bool _bool = false;
@@ -563,7 +630,7 @@
                                 }
                             }
                             break;
-                      
+
                     }
                     outputDevice.status = dicSateteList;
 
@@ -592,7 +659,7 @@
                     this.RemoveFromParent();
                     return;
                 }
-                LogicMethod.CurrLogicMethod.RemoveAllView();
+                LogicMethod.Current.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
@@ -716,7 +783,7 @@
                         break;
                 }
                 //鏁版嵁灏佽
-                AddDictionary(keyVlaue, brightnesValue);
+                AddDictionary(keyVlaue, brightnesValue); 
             });
             #endregion
 
@@ -730,7 +797,7 @@
         /// <param name="button2">鏄剧ずBtn</param>
         /// <param name="button3">鏄剧ずBtn</param>
         /// <param name="button4">鏄剧ずBtn</param>
-        private void GetEditState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4)
+        private void GetEditDeviceState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4)
         {
             Output outputs = Logic.currlogic.output[index];
             var dicList = outputs.status;
@@ -747,7 +814,7 @@
                 this.btnDelay.Text = outputs.delay + "s";
                 this.strdelay = outputs.delay;
             }
-            InpOrOutLogicMethod.EditState(device, dicList, button1, button2, button3, button4);
+            InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4);
         }
         /// <summary>
         /// 娣诲姞閫変腑鏁版嵁
@@ -758,8 +825,8 @@
         {
             //鏁版嵁灏佽
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.CurrLogicMethod.dictionary(dic, "key", KeyValue);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "value", selectedValue);
+            LogicMethod.Current.dictionary(dic, "key", KeyValue);
+            LogicMethod.Current.dictionary(dic, "value", selectedValue);
             AddDictionaryList(KeyValue, dic);
         }
         /// <summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs
index 3ace301..19a4a02 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs
@@ -222,13 +222,13 @@
         private void AddDic(string keyValue, string value, bool edit, int index)
         {
             Input inputTime = new Input();
-            inputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
+            inputTime.sid = LogicMethod.Current.NewSid();
             inputTime.condition_type = "1";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue);
-            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
+            LogicMethod.Current.dictionary(dic, "key", keyValue);
+            LogicMethod.Current.dictionary(dic, "comparator", "=");
+            LogicMethod.Current.dictionary(dic, "data_type", "string");
+            LogicMethod.Current.dictionary(dic, "value", value);
             inputTime.condition.Add(dic);
             AddCondition(inputTime, edit, index);
         }
@@ -250,7 +250,7 @@
                 //娣诲姞涓�涓柊鐨勬椂闂存潯浠�
                 Logic.currlogic.input.Add(input);
             }
-            LogicMethod.CurrLogicMethod.RemoveAllView();
+            LogicMethod.Current.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
index 2181e67..84822aa 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
@@ -134,13 +134,13 @@
             timePointView.FLayoutView(fLayout);
             timePointView.TimePoint(fLayout, editTime, (timeValue)=>{
                 Input inputTime = new Input();
-                inputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
+                inputTime.sid = LogicMethod.Current.NewSid();
                 inputTime.condition_type = "1";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "timepoint");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "value", timeValue);
+                LogicMethod.Current.dictionary(dic, "key", "timepoint");
+                LogicMethod.Current.dictionary(dic, "comparator", "=");
+                LogicMethod.Current.dictionary(dic, "data_type", "string");
+                LogicMethod.Current.dictionary(dic, "value", timeValue);
                 inputTime.condition.Add(dic);
                 AddCondition(inputTime, edit, index);
             });
@@ -257,13 +257,13 @@
                 }
 
                 Input inputTime = new Input();
-                inputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
+                inputTime.sid = LogicMethod.Current.NewSid();
                 inputTime.condition_type = "2";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "timesection");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-                LogicMethod.CurrLogicMethod.dictionary(dic, "value", btnStartTimeText.Text + "-" + btnEndTimeText.Text);
+                LogicMethod.Current.dictionary(dic, "key", "timesection");
+                LogicMethod.Current.dictionary(dic, "comparator", "=");
+                LogicMethod.Current.dictionary(dic, "data_type", "string");
+                LogicMethod.Current.dictionary(dic, "value", btnStartTimeText.Text + "-" + btnEndTimeText.Text);
                 inputTime.condition.Add(dic);
                 AddCondition(inputTime, edit, index);
 
@@ -354,7 +354,7 @@
                 //娣诲姞涓�涓柊鐨勬椂闂存潯浠�
                 Logic.currlogic.input.Add(input);
             }
-            LogicMethod.CurrLogicMethod.RemoveAllView();
+            LogicMethod.Current.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
index f4e8760..d9a1fd1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -78,13 +78,13 @@
         private void AddDic(string value)
         {
             Input input = new Input(); 
-            input.sid = LogicMethod.CurrLogicMethod.NewSid();
+            input.sid = LogicMethod.Current.NewSid();
             input.condition_type = "6";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.CurrLogicMethod.dictionary(dic, "key", "weather");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
+            LogicMethod.Current.dictionary(dic, "key", "weather");
+            LogicMethod.Current.dictionary(dic, "comparator", "=");
+            LogicMethod.Current.dictionary(dic, "data_type", "string");
+            LogicMethod.Current.dictionary(dic, "value", value);
             input.condition.Add(dic);
             AddCondition(input, "weather",  "=");
         }
@@ -122,7 +122,7 @@
                 Logic.currlogic.input.Add(input);
             }
 
-            LogicMethod.CurrLogicMethod.RemoveAllView();
+            LogicMethod.Current.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index c770e5a..edbf966 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -82,7 +82,7 @@
             quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
             this.AddChidren(quyuPatchView.FLayoutView());
             quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
-            quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(GetFunction(control.deviceId));
+            quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.Current.GetGetRoomName(GetFunction(control.deviceId));
 
             //缁х画娣诲姞
             Button addBtn = new Button
@@ -137,7 +137,7 @@
                 method.ManagementPosition(GetFunction(control.deviceId), () =>
                 {
                     //鏇存柊鍖哄煙
-                    quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(GetFunction(control.deviceId));
+                    quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.Current.GetGetRoomName(GetFunction(control.deviceId));
                 });
             };
             //缁х画娣诲姞鐐瑰嚮浜嬩欢
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
index 547e878..8bce9f1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
@@ -43,7 +43,7 @@
             //閬ユ帶鍣ㄦ墍灞炲尯鍩�:
             FrameLayout50 areaFLayout = new FrameLayout50(); 
             areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu);
-            areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(control);
+            areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.Current.GetGetRoomName(control);
             areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
             viewLayout.AddChidren(areaFLayout.FLayoutView());
             #endregion
@@ -77,7 +77,7 @@
                 method.ManagementPosition(control, () =>
                 {
                     //鏇存柊鍖哄煙
-                    areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(control);
+                    areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.Current.GetGetRoomName(control);
                 });
             };
             #endregion
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
index 38b713e..7a80226 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -197,7 +197,7 @@
                 //閬ユ帶鍣ㄥ悕绉�
                 controlView.nameBtn.Text = control.name;
                 //閬ユ帶鍣ㄥ瓨鏀惧尯鍩�
-                controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(control);
+                controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.Current.GetGetRoomName(control);
                 //鏍囪閬ユ帶鍣�
                 controlView.delBtn.Tag = control;
                 //鍒犻櫎鐐瑰嚮浜嬩欢
@@ -236,7 +236,7 @@
                     {
                         //鍥炶皟鏇存柊鍚嶅瓧/鍖哄煙
                         controlView.nameBtn.Text = device.name;
-                        controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(device);
+                        controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.Current.GetGetRoomName(device);
 
                     });
                     MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs
index 6576dcb..39eb4ac 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs
@@ -82,7 +82,7 @@
                 {
                     try
                     {
-                        userList = Send.GetResidenceMemberAccount();
+                        userList = Send.Current.GetResidenceMemberAccount();
 
                     }
                     catch { }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
index 698abcd..360d7c0 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
@@ -16,13 +16,13 @@
             //Refresh();
         }
 
-     
+
         /// <summary>
         /// 闊充箰鍔熻兘
         /// </summary>
         public Function functionMusic = new Function();
-       
-      
+
+
         /// <summary>
         ///淇濆瓨褰撳墠闊充箰鍒楄〃
         /// </summary>
@@ -50,7 +50,7 @@
             A31MusicModelList.RemoveAll((obj) => obj == null);
         }
 
-     
+
         /// <summary>
         /// 涓婁竴娆℃洿鏂扮殑鏃堕棿
         /// 璁板綍鏁版嵁鍙嶉鐨勬椂闂�(鍥犱负鏈夋椂鍊欑綉缁滃樊鏁版嵁涓嶅洖澶嶏紝瀵艰嚧鍒锋柊褰撳墠鎾斁闊充箰鏃堕棿涓嶆纭�)
@@ -81,7 +81,7 @@
         /// <summary>
         /// 鍒楄〃
         /// </summary>
-        public List<PalyList> palyLists = new List<PalyList>(); 
+        public List<PalyList> palyLists = new List<PalyList>();
 
         /// <summary>
         ///  鍠滅埍闊充箰鍒楄〃
@@ -97,8 +97,8 @@
         /// </summary>
         public static A31MusicModel Current;
 
-       
-   
+
+
 
         /// <summary>
         /// 鎸囧畾鍒楄〃鍚嶈幏鍙栭煶涔愬垪琛�
@@ -106,16 +106,17 @@
         /// <returns></returns>
         public List<Songs> GetSongList(string listName)
         {
-            var list = palyLists.Find((o)=>o.group==listName);
-            if (list==null) {
+            var list = palyLists.Find((o) => o.group == listName);
+            if (list == null)
+            {
                 return new List<Songs>();
             }
             return list.songs;
         }
-       
+
 
         public Slaves Slave = new Slaves();
-       
+
 
         /// <summary>
         /// 鍒ゆ柇鏄惁鏄痡son鏁版嵁
@@ -222,7 +223,7 @@
         public List<Songs> songs = new List<Songs>();
     }
     [System.Serializable]
-    public class Songs:MusicInfo
+    public class Songs : MusicInfo
     {
         /// <summary>
         /// 姝屾洸鍚嶇О
@@ -240,11 +241,40 @@
         /// 绫诲瀷<鑷繁鐢�>
         /// </summary>
         public string type = string.Empty;
-
-
-
-
+        /// <summary>
+        /// 鍒楄〃鍚嶅拰group缁勫悕鏄竴鏍风殑
+        /// </summary>
+        public string listName = string.Empty;
     }
 
 
+    [System.Serializable]
+    /// <summary>
+    /// 鍒楄〃鍚嶅垪琛�
+    /// </summary>
+    public class GroupList
+    {
+        /// <summary>
+        ///璁惧sid
+        /// </summary>
+        public string sid = string.Empty;
+        /// <summary>
+        /// 鍒楄〃鍚嶉泦鍚�
+        /// </summary>
+        public List<ListName> groupList = new List<ListName>();
+
+    }
+    [System.Serializable]
+    /// <summary>
+    /// 鍒楄〃鍚�
+    /// </summary>
+    public class ListName
+    {
+        /// <summary>
+        /// 缁勫悕=鍒楄〃鍚�
+        /// </summary>
+        public string group = string.Empty;
+
+    }
+
 }
\ No newline at end of file
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs
index 8dba2e9..a3aa12c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs
@@ -230,11 +230,40 @@
             ///鎴戠殑鍒楄〃浜嬩欢
             myListView.clickBtn.MouseUpEventHandler += (sender, e) =>
             {
-                A31MyList a31MyList = new A31MyList();
-                MainPage.BasePageView.AddChidren(a31MyList);
-                a31MyList.Show();
-                a31MyList.UpdateSelectedFile();
-                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                //A31MyList a31MyList = new A31MyList();
+                //MainPage.BasePageView.AddChidren(a31MyList);
+                //a31MyList.Show();
+                //a31MyList.UpdateSelectedFile();
+                //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                
+                System.Threading.Tasks.Task.Run(() =>
+                {
+                    try
+                    {
+
+                        //HDL_ON.DriverLayer.Control.Ins.GetMusicDirectory(device);
+                        var palyListName = Music.SendMethod.mMethod.GetListName(A31MusicModel.Current.functionMusic);
+                        var palyList = Music.SendMethod.mMethod.GetListMusic(A31MusicModel.Current.functionMusic, "hdl_special");
+                        List<string> musicNameList = new List<string>();
+                        for (int i = 0; i < palyList.songs.Count; i++)
+                        {
+                            var music = palyList.songs[i];
+                            musicNameList.Add(music.name);
+                        }
+                        Application.RunOnMainThread(() =>
+                        {
+                            UI2.Intelligence.Automation.PublicInterface publicInterface = new UI2.Intelligence.Automation.PublicInterface();
+                            publicInterface.FrameOrVv(this, musicNameList, new List<string> { "123" }, palyList.group, (index) =>
+                            {
+                               
+                                
+                            }, false);
+
+                        });
+                    }
+                    catch { }
+
+                });
             };
           
      
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
index 0fde19f..0372c54 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
@@ -60,7 +60,7 @@
             {
                 //RefreshDeviceStatus(functionIds);
                 //a31Music.LastDateTime = DateTime.Now;
-                ///浠庣紦瀛橀噷闈㈡煡鎵鹃煶涔愭挱鏀惧櫒瀵硅薄<缂撳瓨鏁版嵁鏀跺埌鎺ㄩ�佽繃鏉ョ殑鐘舵�佷細鏇存柊缂撳瓨鏁版嵁>
+                ///浠庣紦瀛橀噷闈㈡煡鎵鹃煶涔愭挱鏀惧櫒瀵硅薄<鏀跺埌鎺ㄩ�佽繃鏉ョ殑鐘舵�佷細鏇存柊缂撳瓨鏁版嵁>
                 var allLocalFuntion = FunctionList.List.GetDeviceFunctionList();
                 var localFunction = allLocalFuntion.Find((obj) => obj.sid == sid);
                 if (localFunction == null)
@@ -152,6 +152,77 @@
             }
 
         }
+        /// <summary>
+        /// 鑾峰彇鍒楄〃鍚嶅垪琛�
+        /// </summary>
+        /// <param name="music"></param>
+        /// <returns></returns>
+        public List<GroupList> GetListName(Function music)
+        {
+            try
+            {
+                Dictionary<string, object> d = new Dictionary<string, object>();
+                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+                d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+                d.Add("deviceIds", new List<string> { music.deviceId });
+                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupList);
+                if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "")
+                {
+                    return new List<GroupList>();
+                }
+                //鏁版嵁杩斿簭鍒楀寲涓篎unction瀵硅薄
+                var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data);
+                var groupLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupList>>(str);
+                if (groupLists == null)
+                {
+                    groupLists = new List<GroupList>();
+                }
+                return groupLists;
+            }
+            catch
+            {
+                return new List<GroupList>();
+            }
+        }
+        /// <summary>
+        /// 鑾峰彇鍒楄〃闊充箰
+        /// </summary>
+        /// <param name="music"></param>
+        /// <param name="listName">鍒楄〃鍚�</param>
+        /// <returns></returns>
+        public PalyList GetListMusic(Function music, string listName)
+        {
+            try
+            {
+                Dictionary<string, object> d = new Dictionary<string, object>();
+                Dictionary<string, object> d1 = new Dictionary<string, object>();
+                Dictionary<string, object> d2 = new Dictionary<string, object>();
+                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+                d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+                d2.Add("group", listName);
+                d1.Add("sid", music.sid);
+                d1.Add("groupList", new List<Dictionary<string, object>> { d2 });
+                d.Add("sidGroups", new List<Dictionary<string, object>> { d1 });
+
+                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupPlayerList);
+                if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "")
+                {
+                    return new PalyList();
+                }
+                //鏁版嵁杩斿簭鍒楀寲涓篎unction瀵硅薄
+                var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data);
+                var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<PalyList>(str);
+                if (palyLists == null)
+                {
+                    palyLists = new PalyList();
+                }
+                return palyLists;
+            }
+            catch
+            {
+                return new PalyList();
+            }
+        }
 
         /// <summary>
         ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/ObjectClass.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/ObjectClass.cs
index 36e51aa..d0def5a 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Video/ObjectClass.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Video/ObjectClass.cs
@@ -168,6 +168,10 @@
         ///  homeId
         /// </summary>
         public string homeId;
+        /// <summary>
+        ///  sid
+        /// </summary>
+        public string sid=string.Empty;
     }
 
     /// <summary>

--
Gitblit v1.8.0