From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/Safeguard.cs | 7012 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 7,012 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Safeguard.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Safeguard.cs
new file mode 100755
index 0000000..04f6b80
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Safeguard.cs
@@ -0,0 +1,7012 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using Newtonsoft.Json.Linq;
+
+namespace ZigBee.Device
+{
+    [System.Serializable]
+    public class Safeguard
+    {
+        /// <summary>
+        /// 褰撳墠涓荤綉鍏崇殑ID
+        /// </summary>
+        public string GateWayId;
+
+        /// <summary>
+        /// 缃戝叧杩斿洖鍦烘櫙鐨勫懡浠ゆ爣璇�
+        /// </summary>
+        public int DataID;
+
+        /// <summary>
+        /// 缃戝叧鍙嶉鐨勬椂闂存埑
+        /// </summary>
+        public int Time;
+
+        /// <summary>
+        /// 绛夊緟浠庣綉鍏虫帴鏀舵暟鎹殑鏃堕棿
+        /// </summary>
+        /// <value>The wait receive data time.</value>
+        public static int WaitReceiveDataTime
+        {
+            get
+            {
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    return 3000;
+                }
+                else if (mainGateway.IsVirtual)
+                {
+                    return 6000;
+                }
+                else
+                {
+                    return 3000;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 缃戝叧淇℃伅閿欒鍙嶉鍐呭
+        /// </summary>
+        static string ErrorMess(int err)
+        {
+            string message = "";
+            switch (err)
+            {
+                case 1:
+                    message = " 缃戝叧鏃犳硶瑙f瀽鍛戒护鏁版嵁銆�";
+                    break;
+                case 2:
+                    message = " 鍗忚皟鍣ㄦ鍦ㄥ崌绾ф垨澶囦唤 / 鎭㈠鏁版嵁銆�";
+                    break;
+                case 3:
+                    message = "鎿嶄綔璁惧 / 缁� / 鍦烘櫙涓嶅瓨鍦�";
+                    break;
+                case 4:
+                    message = " 鍏朵粬閿欒";
+                    break;
+                case 5:
+                    message = " 鏁版嵁浼犺緭閿欒锛堝湪鏌愭瀹㈡埛绔悜缃戝叧鍙戦�佹暟鎹殑杩囩▼涓紝缃戝叧鍦ㄥ悎鐞嗘椂闂磋寖鍥村唴鎺ユ敹瀹㈡埛绔暟鎹笉瀹屾暣瀵艰嚧璇ラ敊璇彂鐢熴�傚瀹㈡埛绔悜缃戝叧涓�娆″彂閫�100涓瓧鑺傜殑鏁版嵁锛屼絾缃戝叧绛夊緟鎺ユ敹浜嗕竴绉掑彧鎺ユ敹浜�80涓瓧鑺傘�傚彂鐢熻閿欒锛岀綉鍏冲皢涓诲姩鍏抽棴瀹㈡埛绔繛鎺ワ級";
+                    break;
+                default:
+                    break;
+            }
+            return message;
+        }
+
+        #region  *绠$悊鍛樺瘑鐮佺櫥闄�;
+        ///<summary >
+        /// *绠$悊鍛樺瘑鐮佺櫥闄�.(浠呯敤浜庝富缃戝叧鎺ュ彛锛�.
+        /// <para>password:绠$悊鍛樺瘑鐮�,鍒濆鍖栧瘑鐮佷负鈥渁dmin鈥濄��</para>
+        /// <para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆傚鏋滅櫥闄嗘垚鍔燂紝缃戝叧灏嗚褰曡鏍囪瘑锛宎pp闇�瑕佺鐞嗗憳鏉冮檺鐨勬寚浠ら兘搴旇甯︽湁璇ユ爣璇嗭紝缃戝叧浼氭牴鎹鏍囪瘑鏉ュ垽鏂槸鍚︿负绠$悊鍛樻搷浣滐紝濡傛灉鏍囪瘑閿欒锛屽皢杩斿洖鈥淪ecurity/Error_Respon鈥濅富棰樻暟鎹�� 銆�</para>
+        /// <para>杩斿洖缁撴灉Result</para>
+        /// <para>0锛氱櫥闄嗘垚鍔�</para>
+        /// <para>1锛氬瘑鐮侀敊璇紝鐧婚檰澶辫触銆�</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<AdminLoginResponAllData> AdminLoginResponAsync(string password, string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                AdminLoginResponAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new AdminLoginResponAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new AdminLoginResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new AdminLoginResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new AdminLoginResponAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AdminLogin_Respon")
+                    {
+                        var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (tempData == null)
+                        {
+                            d = new AdminLoginResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new AdminLoginResponAllData { Result = tempData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/AdminLogin_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+                try
+                {
+                    var bytes = new byte[32];
+                    var reamarkGwBytes = System.Text.Encoding.UTF8.GetBytes(password);
+                    System.Array.Copy(reamarkGwBytes, 0, bytes, 0, 32 < reamarkGwBytes.Length ? 32 : reamarkGwBytes.Length);
+                    password = System.Text.Encoding.UTF8.GetString(bytes);
+
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4001 }
+                                };
+                    var data = new JObject { { "Password", password }, { "LoginToken", loginToken } };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/AdminLogin", jObject.ToString());
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new AdminLoginResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/AdminLogin_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 绠$悊鍛樺瘑鐮佺櫥闄嗙殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public AdminLoginResponAllData adminLoginResponAllData;
+        /// <summary>
+        /// 绠$悊鍛樺瘑鐮佺櫥闄嗚繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class AdminLoginResponAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉Result
+            /// <para>0锛氱櫥闄嗘垚鍔�</para>
+            /// <para>1锛氬瘑鐮侀敊璇紝鐧婚檰澶辫触銆�</para>
+            /// </summary>
+            public int Result = 999;
+            /// <summary>
+            /// 杩斿洖閿欒缁撴灉
+            /// <para>1锛氱綉鍏充笉鏄富缃戝叧锛屾棤娉曡繘琛岃鎿嶄綔銆�</para>
+            /// <para>2锛氳鎿嶄綔闇�瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��</para>
+            /// </summary>
+            public int Error;
+        }
+
+        #endregion
+
+        #region 20淇敼绠$悊鍛樺瘑鐮�.
+        /// <summary>
+        /// 淇敼绠$悊鍛樺瘑鐮�(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// </summary>
+        /// <returns>The admin password async.</returns>
+        /// <param name="password">鏂扮鐞嗗憳瀵嗙爜 </param>
+        /// <param name="oldPassword">鏃у瘑鐮�/param>
+        public static async System.Threading.Tasks.Task<ChangeAdminPasswordResponseAllData> ChangeAdminPasswordAsync(string oldPassword, string password)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                ChangeAdminPasswordResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new ChangeAdminPasswordResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new ChangeAdminPasswordResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new ChangeAdminPasswordResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/ChangeAdminPassword_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var changeAdminPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ChangeAdminPasswordResponseData>(jobject["Data"].ToString());
+                            if (changeAdminPasswordResponseData != null)
+                            {
+                                d = new ChangeAdminPasswordResponseAllData { changeAdminPasswordResponseData = changeAdminPasswordResponseData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            }
+                        }
+                        else
+                        {
+                            d = new ChangeAdminPasswordResponseAllData { };
+                            var r = new ChangeAdminPasswordResponseData();
+                            if (result == 1)
+                            {
+                                r.Result = result;
+                                d.errorMessageBase = "淇敼澶辫触锛屽師瀵嗙爜閿欒";
+                            }
+                            if (result == 2)
+                            {
+                                r.Result = result;
+                                d.errorMessageBase = "2锛氫慨鏀瑰け璐ワ紝瀵嗙爜闀垮害涓嶆纭�";
+                            }
+                            d.changeAdminPasswordResponseData = r;
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/ChangeAdminPassword_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4023}
+                                };
+                    var data = new JObject
+                    {
+                     { "OldPassword", oldPassword },
+                     { "Password", password}
+                    };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/ChangeAdminPassword", jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new ChangeAdminPasswordResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/ChangeAdminPassword_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 淇敼绠$悊鍛樺瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public ChangeAdminPasswordResponseAllData changeAdminPasswordResponseAllData;
+        /// <summary>
+        /// 淇敼绠$悊鍛樺瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class ChangeAdminPasswordResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 淇敼绠$悊鍛樺瘑鐮佽繑鍥炵殑鏁版嵁
+            /// </summary>
+            public ChangeAdminPasswordResponseData changeAdminPasswordResponseData;
+
+        }
+
+
+        /// <summary>
+        /// 淇敼绠$悊鍛樺瘑鐮佽繑鍥炵殑鏁版嵁
+        /// </summary>
+        public ChangeAdminPasswordResponseData changeAdminPasswordResponseData;
+        /// <summary>
+        /// 淇敼绠$悊鍛樺瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class ChangeAdminPasswordResponseData
+        {
+            /// <summary>
+            /// 0锛氫慨鏀规垚鍔� 
+            ///<para>1锛氫慨鏀瑰け璐ワ紝鍘熷瘑鐮侀敊璇�</para>
+            ///<para>2锛氫慨鏀瑰け璐ワ紝瀵嗙爜闀垮害涓嶆纭�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 鏂板瘑鐮侊紝鏈�澶�32涓瓧绗︺��(褰揜esult = 0鏃跺瓨鍦ㄣ��)
+            /// </summary>
+            public string NewPassword;
+
+        }
+        #endregion
+
+        #region 16鏌ョ湅寤舵椂鏃堕棿;
+        ///<summary >
+        /// 鏌ョ湅寤舵椂鏃堕棿(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// </summary>
+        public static async System.Threading.Tasks.Task<CatDelayTimeResponseAllData> CatDelayTimeAsync()
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                CatDelayTimeResponseAllData d = null;
+
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new CatDelayTimeResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new CatDelayTimeResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new CatDelayTimeResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/CatDelayTime_Respon")
+                    {
+                        var catDelayTimeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatDelayTimeResponseData>(jobject["Data"].ToString());
+                        if (catDelayTimeResponseData == null)
+                        {
+                            d = new CatDelayTimeResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new CatDelayTimeResponseAllData { catDelayTimeResponseData = catDelayTimeResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/CatDelayTime_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4019}
+                                };
+                    mainGateway.Send("Security/CatDelayTime", jObject.ToString());
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new CatDelayTimeResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/CatDelayTime_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏌ョ湅寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public CatDelayTimeResponseAllData catDelayTimeResponseAllData;
+        /// <summary>
+        /// 鏌ョ湅寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class CatDelayTimeResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鏌ョ湅寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public CatDelayTimeResponseData catDelayTimeResponseData;
+
+        }
+
+        /// <summary>
+        /// 鏌ョ湅寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public CatDelayTimeResponseData catDelayTimeResponseData;
+        /// <summary>
+        /// 鏌ョ湅寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class CatDelayTimeResponseData
+        {
+            /// <summary>
+            /// 杩涘叆寤舵椂鏃堕棿锛屽崟浣嶇 鑼冨洿锛�0-65535
+            /// </summary>
+            public int EntranceDelayTime;
+            /// <summary>
+            /// 澶栧嚭寤舵椂鏃堕棿,鍗曚綅绉� 鑼冨洿锛�0-65535
+            /// </summary>
+            public int GoOutDelayTime;
+
+        }
+        #endregion
+
+        #region 17*璁剧疆鍑哄叆闃插尯寤舵椂鏃�;
+        ///<summary >
+        /// *璁剧疆鍑哄叆闃插尯寤舵椂鏃堕棿锛堥渶瑕佺鐞嗗憳鏉冮檺锛夛級
+        /// <para>entranceDelayTime:杩涘叆寤舵椂鏃堕棿锛屽崟浣嶇鑼冨洿锛�0-65535</para>
+        /// <para>goOutDelayTime:澶栧嚭寤舵椂鏃堕棿锛屽崟浣嶇鑼冨洿锛�0-65535</para>
+        /// <para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆傚鏋滅櫥闄嗘垚鍔燂紝缃戝叧灏嗚褰曡鏍囪瘑锛宎pp闇�瑕佺鐞嗗憳鏉冮檺鐨勬寚浠ら兘搴旇甯︽湁璇ユ爣璇嗭紝缃戝叧浼氭牴鎹鏍囪瘑鏉ュ垽鏂槸鍚︿负绠$悊鍛樻搷浣滐紝濡傛灉鏍囪瘑閿欒锛屽皢杩斿洖鈥淪ecurity/Error_Respon鈥濅富棰樻暟鎹�� 銆�</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<SetDelayTimeResponseAllData> SetDelayTimeAsync(int entranceDelayTime, int goOutDelayTime, string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                SetDelayTimeResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new SetDelayTimeResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new SetDelayTimeResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new SetDelayTimeResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId };
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new SetDelayTimeResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/SetDelayTime_Respon")
+                    {
+                        var setDelayTimeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetDelayTimeResponseData>(jobject["Data"].ToString());
+                        if (setDelayTimeResponseData == null)
+                        {
+                            d = new SetDelayTimeResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new SetDelayTimeResponseAllData { setDelayTimeResponseData = setDelayTimeResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/SetDelayTime_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4020}
+                                };
+                    var data = new JObject
+                    {
+                    { "EntranceDelayTime", entranceDelayTime},
+                    { "GoOutDelayTime", goOutDelayTime},
+                    { "LoginToken", loginToken}
+                };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/SetDelayTime", jObject.ToString());
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new SetDelayTimeResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/SetDelayTime_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 璁剧疆寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public SetDelayTimeResponseAllData setDelayTimeResponseAllData;
+        /// <summary>
+        /// 璁剧疆寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class SetDelayTimeResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 璁剧疆寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public SetDelayTimeResponseData setDelayTimeResponseData;
+
+        }
+
+
+        /// <summary>
+        /// 璁剧疆寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public SetDelayTimeResponseData setDelayTimeResponseData;
+        /// <summary>
+        /// 璁剧疆寤舵椂鏃堕棿杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class SetDelayTimeResponseData
+        {
+            /// <summary>
+            /// 杩涘叆寤舵椂鏃堕棿锛屽崟浣嶇 鑼冨洿锛�0-65535
+            /// </summary>
+            public int EntranceDelayTime;
+            /// <summary>
+            /// 澶栧嚭寤舵椂鏃堕棿,鍗曚綅绉� 鑼冨洿锛�0-65535
+            /// </summary>
+            public int GoOutDelayTime;
+
+        }
+        #endregion
+
+        #region 21*鏌ョ湅鐢ㄦ埛瀵嗙爜鍜岃儊杩瘑鐮�.;
+        ///<summary >
+        /// *鏌ョ湅鐢ㄦ埛瀵嗙爜鍜岃儊杩瘑鐮侊紙闇�瑕佺鐞嗗憳鏉冮檺锛�
+        /// <para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<CatUserPasswordResponseAllData> CatUserPasswordAsync(string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                CatUserPasswordResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new CatUserPasswordResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new CatUserPasswordResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new CatUserPasswordResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new CatUserPasswordResponseAllData { };
+
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/CatUserPassword_Respon")
+                    {
+                        var catUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatUserPasswordResponseData>(jobject["Data"].ToString());
+                        if (catUserPasswordResponseData == null)
+                        {
+                            d = new CatUserPasswordResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new CatUserPasswordResponseAllData { catUserPasswordResponseData = catUserPasswordResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/CatUserPassword_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4024}
+                                };
+                    var data = new JObject
+                    {
+                      { "LoginToken", loginToken}
+                    };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/CatUserPassword", jObject.ToString());
+                }
+                catch
+                {
+                }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new CatUserPasswordResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/CatDelayTime_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏌ョ湅鐢ㄦ埛瀵嗙爜鍜岃儊杩瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public CatUserPasswordResponseAllData catUserPasswordResponseAllData;
+        /// <summary>
+        /// 鏌ョ湅鐢ㄦ埛瀵嗙爜鍜岃儊杩瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class CatUserPasswordResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鏌ョ湅鐢ㄦ埛瀵嗙爜鍜岃儊杩瘑鐮佽繑鍥炵殑鏁版嵁
+            /// </summary>
+            public CatUserPasswordResponseData catUserPasswordResponseData;
+
+        }
+
+
+        /// <summary>
+        /// 鏌ョ湅鐢ㄦ埛瀵嗙爜鍜岃儊杩瘑鐮佽繑鍥炵殑鏁版嵁
+        /// </summary>
+        public CatUserPasswordResponseData catUserPasswordResponseData;
+        /// <summary>
+        /// 鏌ョ湅鐢ㄦ埛瀵嗙爜鍜岃儊杩瘑鐮佽繑鍥炵殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class CatUserPasswordResponseData
+        {
+            /// <summary>
+            /// 鐢ㄦ埛瀵嗙爜鍒楄〃 
+            /// </summary>
+            public List<UserPasswordListObj> UserPasswordList = new List<UserPasswordListObj>();
+
+        }
+
+        /// <summary>
+        /// 鐢ㄦ埛瀵嗙爜鍒楄〃鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class UserPasswordListObj
+        {
+
+            /// <summary>
+            /// 鐢ㄦ埛id銆侷d涓�5鏃朵负鑳佽揩瀵嗙爜
+            /// </summary>
+            public int UserId;
+            /// <summary>
+            /// 鏈�灏�4涓瓧绗︼紝鏈�澶�32涓瓧绗�
+            /// </summary>
+            public string Password;
+            /// <summary>
+            /// 鐢ㄦ埛瀵嗙爜鎻愮ず璇�
+            /// </summary>
+            public string PassWordTips = string.Empty;
+        }
+        #endregion
+
+        #region 22*鏂板鎴栭噸璁剧敤鎴峰瘑鐮�.;
+        /// <summary>
+        /// *鏂板鎴栭噸璁剧敤鎴峰瘑鐮侊紙闇�瑕佺鐞嗗憳鏉冮檺锛�
+        /// <para>userId:鐢ㄦ埛id 濡傛灉鐢ㄦ埛id瀛樺湪锛屽垯淇敼瀵嗙爜銆傚鏋滅敤鎴穒d涓嶅瓨鍦紝鍒欎负璇d鏂板瀵嗙爜
+        /// 涓�0鏃讹紝鑷姩鍒嗛厤鏂扮殑鐢ㄦ埛id銆備负5鏃讹紝鍒欎慨鏀硅儊杩瘑鐮併�傚彇鍊艰寖鍥�0-5銆�</para>
+        /// <para>password:鏂扮鐞嗗憳瀵嗙爜</para>
+        /// <para>passWordTips:瀵嗙爜鎻愮ず</para>
+        /// <para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��</para>
+        /// </summary> 
+        public static async System.Threading.Tasks.Task<SetUserPasswordResponseAllData> SetUserPasswordAsync(int userId, string password, string passWordTips, string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                SetUserPasswordResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new SetUserPasswordResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new SetUserPasswordResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new SetUserPasswordResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId };
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new SetUserPasswordResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/SetUserPassword_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var setUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetUserPasswordResponseData>(jobject["Data"].ToString());
+                            if (setUserPasswordResponseData != null)
+                            {
+                                d = new SetUserPasswordResponseAllData { setUserPasswordResponseData = setUserPasswordResponseData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+
+                            }
+                        }
+                        else
+                        {
+                            d = new SetUserPasswordResponseAllData { };
+                            var r = new SetUserPasswordResponseData();
+                            r.Result = result;
+                            d.setUserPasswordResponseData = r;
+                            System.Console.WriteLine($"澶辫触璁剧疆锛屾敹鍒伴�氱煡鍚庣殑涓婚");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/SetUserPassword_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4025}
+                                };
+                    var data = new JObject
+                    {
+                     { "UserId", userId  },
+                     { "Password", password},
+                     { "PassWordTips", passWordTips},
+                     { "LoginToken", loginToken}
+                    };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/SetUserPassword", jObject.ToString());
+                }
+                catch
+                {
+                }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new SetUserPasswordResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/SetUserPassword_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// *鏂板鎴栭噸璁剧敤鎴峰瘑鐮侊紙闇�瑕佺鐞嗗憳鏉冮檺锛�
+        /// <para>userId:鐢ㄦ埛id 濡傛灉鐢ㄦ埛id瀛樺湪锛屽垯淇敼瀵嗙爜銆傚鏋滅敤鎴穒d涓嶅瓨鍦紝鍒欎负璇d鏂板瀵嗙爜
+        /// 涓�0鏃讹紝鑷姩鍒嗛厤鏂扮殑鐢ㄦ埛id銆備负5鏃讹紝鍒欎慨鏀硅儊杩瘑鐮併�傚彇鍊艰寖鍥�0-5銆�</para>
+        /// <para>password:鏂扮鐞嗗憳瀵嗙爜</para>
+        /// <para>passWordTips:瀵嗙爜鎻愮ず</para>
+        /// <para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��</para>
+        /// </summary> 
+        public static async System.Threading.Tasks.Task<SetUserPasswordResponseAllData> SetPassWordTipsAsync(int userId, string password, string passWordTips, string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                SetUserPasswordResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new SetUserPasswordResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new SetUserPasswordResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new SetUserPasswordResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId };
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new SetUserPasswordResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AddPassWordTips_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var setUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetUserPasswordResponseData>(jobject["Data"].ToString());
+                            if (setUserPasswordResponseData != null)
+                            {
+                                d = new SetUserPasswordResponseAllData { setUserPasswordResponseData = setUserPasswordResponseData };
+                            }
+                        }
+                        else
+                        {
+                            d = new SetUserPasswordResponseAllData { };
+                            var r = new SetUserPasswordResponseData();
+                            r.Result = result;
+                            d.setUserPasswordResponseData = r;
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4037}
+                                };
+                    var data = new JObject
+                    {
+                     { "UserId", userId  },
+                     { "Password", password},
+                     { "PassWordTips", passWordTips},
+                     { "LoginToken", loginToken}
+                    };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/AddPassWordTips", jObject.ToString());
+                }
+                catch
+                {
+                }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new SetUserPasswordResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏂板鎴栭噸璁剧敤鎴峰瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public SetUserPasswordResponseAllData setUserPasswordResponseAllData;
+        /// <summary>
+        /// 鏂板鎴栭噸璁剧敤鎴峰瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class SetUserPasswordResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 淇敼绠$悊鍛樺瘑鐮佽繑鍥炵殑鏁版嵁
+            /// </summary>
+            public SetUserPasswordResponseData setUserPasswordResponseData;
+
+        }
+
+
+        /// <summary>
+        /// 鏂板鎴栭噸璁剧敤鎴峰瘑鐮佽繑鍥炵殑鏁版嵁
+        /// </summary>
+        public SetUserPasswordResponseData setUserPasswordResponseData;
+        /// <summary>
+        /// 鏂板鎴栭噸璁剧敤鎴峰瘑鐮佽繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class SetUserPasswordResponseData
+        {
+            /// <summary> 
+            /// 0锛氭垚鍔� 
+            ///<para>1锛氬け璐ワ紝鐢ㄦ埛瀵嗙爜鏁板凡婊★紙鏈�澶�4涓級</para>
+            ///<para>2锛氬け璐ワ紝瀵嗙爜闀垮害涓嶆纭��</para>
+            ///<para>3锛氬け璐ワ紝瀵嗙爜鍜屽凡瀛樺湪鐨勭敤鎴峰瘑鐮侀噸澶嶏紝4涓敤鎴峰瘑鐮佷笉鑳界浉鍚屻��</para>
+            /// </summary>
+            public int Result = 999;
+            /// <summary> 
+            /// 鐢ㄦ埛id
+            /// </summary>
+            public int UserId;
+            /// <summary>
+            /// 鏂板瘑鐮� 锛屾渶澶�32涓瓧绗︼紝鑷冲皯4涓瓧绗︺��
+            /// </summary>
+            public string password;
+
+        }
+        #endregion
+
+        #region 23*鍒犻櫎鐢ㄦ埛瀵嗙爜.
+        /// <summary>
+        /// *鍒犻櫎鐢ㄦ埛瀵嗙爜锛堥渶瑕佺鐞嗗憳鏉冮檺锛�
+        /// <para>userId:鐢ㄦ埛id 濡傛灉鐢ㄦ埛id瀛樺湪锛屽垯淇敼瀵嗙爜銆傚鏋滅敤鎴穒d涓嶅瓨鍦紝鍒欎负璇d鏂板瀵嗙爜
+        /// 涓�0鏃讹紝鑷姩鍒嗛厤鏂扮殑鐢ㄦ埛id銆備负5鏃讹紝鍒欎慨鏀硅儊杩瘑鐮併�傚彇鍊艰寖鍥�0-5銆�</para>
+        /// <para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��</para>
+        /// </summary> 
+        public static async System.Threading.Tasks.Task<DelUserPasswordResponseAllData> DelUserPasswordAsync(int userId, string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                DelUserPasswordResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new DelUserPasswordResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new DelUserPasswordResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new DelUserPasswordResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new DelUserPasswordResponseAllData { };
+
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+                    if (topic == gatewayID + "/" + "Security/DelUserPassword_Respon")
+                    {
+                        var delUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelUserPasswordResponseData>(jobject["Data"].ToString());
+                        if (delUserPasswordResponseData != null)
+                        {
+                            d = new DelUserPasswordResponseAllData { delUserPasswordResponseData = delUserPasswordResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+
+                        }
+                        else
+                        {
+                            d = new DelUserPasswordResponseAllData { errorMessageBase = "杩斿洖鏁版嵁涓虹┖" };
+                            System.Console.WriteLine("杩斿洖鏁版嵁涓虹┖");
+                        }
+
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/DelUserPassword_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4026}
+                                };
+                    var data = new JObject
+                    {
+                     { "UserId", userId  },
+                     { "LoginToken", loginToken}
+                    };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/DelUserPassword", jObject.ToString());
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new DelUserPasswordResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/DelUserPassword_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鐢ㄦ埛瀵嗙爜杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public DelUserPasswordResponseAllData delUserPasswordResponseAllData;
+        /// <summary>
+        /// 鍒犻櫎鐢ㄦ埛瀵嗙爜杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class DelUserPasswordResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鍒犻櫎鐢ㄦ埛瀵嗙爜杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public DelUserPasswordResponseData delUserPasswordResponseData;
+
+        }
+
+
+        /// <summary>
+        /// 鍒犻櫎鐢ㄦ埛瀵嗙爜杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public DelUserPasswordResponseData delUserPasswordResponseData;
+        /// <summary>
+        /// 鍒犻櫎鐢ㄦ埛瀵嗙爜杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class DelUserPasswordResponseData
+        {
+            /// <summary> 
+            /// 0锛氭垚鍔� 
+            ///<para>1:澶辫触锛岀敤鎴穒d涓嶅瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Result = 999;
+            /// <summary> 
+            /// 鐢ㄦ埛id
+            /// </summary>
+            public int UserId;
+
+        }
+        #endregion
+
+        //#region 鏂板缓鎴栦慨鏀归槻鍖�.
+        ///// <summary>
+        ///// 鏂板缓鎴栦慨鏀归槻鍖恒��
+        ///// </summary>
+        ///// <returns>The new zone async.</returns>
+        ///// <param name="addNewZoneData">鏂板缓鎴栦慨鏀归槻鍖虹殑鏁版嵁</param>
+        //public static async System.Threading.Tasks.Task<AddNewZoneDataResponseAllData> AddNewZoneAsync(AddNewZoneData addNewZoneData)
+        //{
+        //    return await System.Threading.Tasks.Task.Run(async () =>
+        //    {
+        //        var d = new AddNewZoneDataResponseAllData { };
+        //        if (ZbGateway.MainGateWay == null)
+        //        {
+        //            d.errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�";
+        //            return d;
+        //        }
+        //        Action<string, string> action = (topic, message) =>
+        //        {
+        //            var gatewayID = topic.Split('/')[0];
+        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+        //            if (topic == gatewayID + "/" + "Error_Respon")
+        //            {
+        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.GwId };
+        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+        //                if (temp == null)
+        //                {
+        //                    d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+        //                }
+        //                else
+        //                {
+        //                    d.errorResponData = temp;
+        //                    d.errorMessageBase = ErrorMess(temp.Error);
+        //                }
+        //            }
+
+        //            if (topic == gatewayID + "/" + "Security/AddNewZone_Respon")
+        //            {
+        //                var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = ZbGateway.MainGateWay.CurrentGateWayId };
+        //                security.addNewZoneDataResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddNewZoneDataResponseData>(jobject["Data"].ToString());
+        //                if (security.addNewZoneDataResponseData != null)
+        //                {
+        //                    d.addNewZoneDataResponseData = security.addNewZoneDataResponseData;
+        //                    System.Console.WriteLine($"鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+        //                }
+        //                else
+        //                {
+        //                    d.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
+        //                }
+        //            }
+        //        };
+        //        ZbGateway.MainGateWay.Actions += action;
+        //        System.Console.WriteLine("Security/AddNewZone_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+        //        if (addNewZoneData != null)
+        //        {
+        //            var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4002 } };
+        //            var data = new JObject
+        //            {
+        //                { "ZoneId", addNewZoneData.ZoneId },
+        //                { "ZoneName", addNewZoneData.ZoneName },
+        //                { "ZoneType", addNewZoneData.ZoneType },
+        //                { "Bypass", addNewZoneData.Bypass },
+        //                { "ElasticBypass", addNewZoneData.ElasticBypass }
+        //            };
+        //            jObject.Add("Data", data);
+        //            ZbGateway.MainGateWay?.Send(("Security/AddNewZone"), jObject.ToString());
+        //        }
+
+        //        var dateTime = DateTime.Now;
+        //        while ((DateTime.Now - dateTime).TotalMilliseconds < 1000)
+        //        {
+        //            await System.Threading.Tasks.Task.Delay(10);
+        //            if (d.addNewZoneDataResponseData != null)
+        //            {
+        //                break;
+        //            }
+        //        }
+        //        if ((DateTime.Now - dateTime).TotalMilliseconds > 10000)
+        //        {
+        //            d.errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
+        //        }
+
+        //        ZbGateway.MainGateWay.Actions -= action;
+        //        System.Console.WriteLine("Security/AddNewZone_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        //        return d;
+        //    });
+        //}
+
+        ///// <summary>
+        ///// 鏂板缓鎴栦慨鏀归槻鍖鸿繑鍥炵殑鏁版嵁 ,缃戝叧鍙嶉淇℃伅
+        ///// </summary>
+        //public AddNewZoneDataResponseAllData addNewZoneDataResponseAllData;
+        ///// <summary>
+        ///// 鏂板缓鎴栦慨鏀归槻鍖鸿繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        ///// </summary>
+        //[System.Serializable]
+        //public class AddNewZoneDataResponseAllData
+        //{
+        //    /// <summary>
+        //    /// 閿欒淇℃伅
+        //    /// </summary>
+        //    public string errorMessageBase;
+        //    /// <summary>
+        //    /// 缃戝叧淇℃伅閿欒鍙嶉
+        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+        //    /// </summary>
+        //    public ErrorResponData errorResponData;
+        //    /// <summary>
+        //    ///鏂板缓鎴栦慨鏀归槻鍖鸿繑鍥炵殑鏁版嵁
+        //    /// </summary>
+        //    public AddNewZoneDataResponseData addNewZoneDataResponseData;
+        //}
+
+        ///// <summary>
+        ///// 鏂板缓鎴栦慨鏀归槻鍖鸿繑鍥炵殑鏁版嵁
+        ///// </summary>
+        //public AddNewZoneDataResponseData addNewZoneDataResponseData;
+        ///// <summary>
+        ///// 鏂板缓鎴栦慨鏀归槻鍖鸿繑鍥炵殑鏁版嵁
+        ///// </summary>
+        //[System.Serializable]
+        //public class AddNewZoneDataResponseData
+        //{
+        //    /// <summary>
+        //    /// 杩斿洖缁撴灉
+        //    /// <para>0锛氭坊鍔犳垨淇敼鎴愬姛</para>
+        //    /// <para>1锛氬け璐ワ紝闃插尯涓嶅瓨鍦�</para>
+        //    /// </summary>
+        //    //public int Result = 2;
+
+        //    /// <summary>
+        //    /// 灞�閮ㄨ闃插垪琛╥d
+        //    /// </summary>
+        //    public int ZoneId;
+
+        //    /// <summary>
+        //    /// 闃插尯鍚嶇О 锛屾渶澶�32涓瓧绗�(褰揜esult = 0鏃舵墠瀛樺湪)
+        //    /// </summary>
+        //    public string ZoneName;
+
+        //    /// <summary>
+        //    /// 甯冮槻闃插尯绫诲瀷锛�(褰揜esult = 0鏃舵墠瀛樺湪)
+        //    ///<para>褰揟ype=1鏃讹紝璇ュ瓧娈垫墠瀛樺湪銆�</para>
+        //    ///<para>1锛�24灏忔椂闃插尯銆�</para>
+        //    ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+        //    ///<para>3锛氬嚭鍏ラ槻鍖恒��</para>
+        //    ///<para>4锛氬唴閮ㄩ槻鍖恒��</para>
+        //    ///<para>5锛氳窡闅忛槻鍖恒��</para>
+        //    ///<para>6锛氬懆鐣岄槻鍖恒��</para>
+        //    ///<para>7锛氬懆鐣屽欢鏃堕槻鍖恒��</para>
+        //    /// </summary>
+        //    public int ZoneType;
+
+        //    /// <summary>
+        //    /// 鏄惁鍏佽鏃佽矾(褰揜esult = 0鏃舵墠瀛樺湪)
+        //    ///<para>0锛氫笉鍏佽鏃佽矾</para>
+        //    ///<para>1锛氬厑璁告梺璺�</para>
+        //    /// </summary>
+        //    public int Bypass;
+
+        //    /// <summary>
+        //    /// 鏄惁鍏佽寮规�ф梺璺細(褰揜esult = 0鏃舵墠瀛樺湪)
+        //    ///<para>0锛氫笉鍏佽寮规�ф梺璺�</para>
+        //    ///<para>1锛氬厑璁稿脊鎬ф梺璺�</para>
+        //    /// </summary>
+        //    public int ElasticBypass;
+        //}
+
+        ///// <summary>
+        ///// 鏂板缓鎴栦慨鏀归槻鍖虹殑鏁版嵁
+        ///// </summary>
+        //public AddNewZoneData addNewZone;
+        ///// <summary>
+        ///// 鏂板缓鎴栦慨鏀归槻鍖虹殑鏁版嵁
+        ///// </summary>
+        //[System.Serializable]
+        //public class AddNewZoneData
+        //{
+        //    /// <summary>
+        //    /// 闃插尯id銆�
+        //    /// <para>0锛�0锛氭柊澧為槻鍖�</para>
+        //    /// <para>鍏朵粬锛氳淇敼鐨勯槻鍖篿d</para>
+        //    /// </summary>
+        //    public int ZoneId;
+
+        //    /// <summary>
+        //    /// 闃插尯鍚嶇О 锛屾渶澶�32涓瓧绗�
+        //    /// </summary>
+        //    public string ZoneName;
+
+        //    /// <summary>
+        //    /// 闃插尯绫诲瀷:
+        //    ///<para>褰揟ype=1鏃讹紝璇ュ瓧娈垫墠瀛樺湪銆�</para>
+        //    ///<para>1锛�24灏忔椂闃插尯銆�</para>
+        //    ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+        //    ///<para>3锛氬嚭鍏ラ槻鍖恒��</para>
+        //    ///<para>4锛氬唴閮ㄩ槻鍖恒��</para>
+        //    ///<para>5锛氳窡闅忛槻鍖恒��</para>
+        //    ///<para>6锛氬懆鐣岄槻鍖恒��</para>
+        //    ///<para>7锛氬懆鐣屽欢鏃堕槻鍖恒��</para>
+        //    ///<para>濡傛灉涓�24灏忔椂锛堥潤闊筹級绫诲瀷闃插尯灏嗚嚜鍔ㄥ姞鍏�24灏忔椂甯冮槻妯″紡涓紝骞朵粠鑷畾涔夋ā寮忎腑娓呴櫎璇ラ槻鍖恒�傚鏋滃師鏉ユ槸24灏忔椂锛堥潤闊筹級绫诲瀷闃插尯淇敼涓洪潪24灏忔椂绫诲瀷锛屽皢鍘熼槻鍖哄皢鑷姩浠�24灏忔椂甯冮槻妯″紡涓竻闄ゃ��</para>
+        //    /// </summary>
+        //    public int ZoneType;
+
+        //    /// <summary>
+        //    /// 鏄惁鍏佽鏃佽矾
+        //    ///<para>0锛氫笉鍏佽鏃佽矾</para>
+        //    ///<para>1锛氬厑璁告梺璺�</para>
+        //    ///<para>鑻ョ被鍨嬩负24灏忔椂闃插尯鎴�24灏忔椂闈欓煶闃插尯灏嗕笉鍏佽鏃佽矾锛岃瀛楁灏嗚蹇界暐銆�</para>
+        //    /// </summary>
+        //    public int Bypass;
+
+        //    /// <summary>
+        //    /// 鏄惁鍏佽寮规�ф梺璺細
+        //    ///<para>0锛氫笉鍏佽寮规�ф梺璺�</para>
+        //    ///<para>1锛氬厑璁稿脊鎬ф梺璺�</para>
+        //    ///<para>鑻ョ被鍨嬩负24灏忔椂闃插尯鎴�24灏忔椂闈欓煶闃插尯灏嗕笉鍏佽寮规�ф梺璺紝璇ュ瓧娈靛皢琚拷鐣ャ��</para>
+        //    /// </summary>
+        //    public int ElasticBypass;
+        //}
+        //#endregion
+
+        #region 2 *璁惧鍔犲叆闃插尯.;
+        /// <summary>
+        /// *璁惧鍔犲叆闃插尯锛堥渶瑕佺鐞嗗憳鏉冮檺锛�
+        /// <para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆傚鏋滅櫥闄嗘垚鍔燂紝缃戝叧灏嗚褰曡鏍囪瘑锛宎pp闇�瑕佺鐞嗗憳鏉冮檺鐨勬寚浠ら兘搴旇甯︽湁璇ユ爣璇嗭紝缃戝叧浼氭牴鎹鏍囪瘑鏉ュ垽鏂槸鍚︿负绠$悊鍛樻搷浣滐紝濡傛灉鏍囪瘑閿欒锛屽皢杩斿洖鈥淪ecurity/Error_Respon鈥濅富棰樻暟鎹�� 銆�</para>
+        /// </summary>
+        /// <returns>The device to zone async.</returns>
+        /// <param name="addDeviceToZoneData">璁惧鍔犲叆闃插尯鐨勬暟鎹�</param>
+        public static async System.Threading.Tasks.Task<AddDeviceToZoneResponseAllData> AddDeviceToZoneAsync(AddDeviceToZoneData addDeviceToZoneData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                AddDeviceToZoneResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new AddDeviceToZoneResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new AddDeviceToZoneResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new AddDeviceToZoneResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId };
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new AddDeviceToZoneResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AddEqToZone_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+
+                        if (result == 0)
+                        {
+                            var addDeviceToZoneResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddDeviceToZoneResponseData>(jobject["Data"].ToString());
+                            if (addDeviceToZoneResponseData != null)
+                            {
+                                d = new AddDeviceToZoneResponseAllData { addDeviceToPartResponseData = addDeviceToZoneResponseData };
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new AddDeviceToZoneResponseAllData { errorMessageBase = "娣诲姞澶辫触" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/AddEqToZone_Actions鍚姩_{System.DateTime.Now.ToString()}");
+                try
+                {
+                    if (addDeviceToZoneData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4003 } };
+                        var deviceList = new JArray { };
+                        foreach (var deviceInfo in addDeviceToZoneData.DeviceList)
+                        {
+                            var dInfo = new JObject{
+                            { "MacAddr", deviceInfo.MacAddr},
+                            { "Epoint",deviceInfo.Epoint},
+                            { "MomentStatus",deviceInfo.MomentStatus},
+                            { "TriggerZoneStatus",deviceInfo.TriggerZoneStatus}
+                            };
+                            deviceList.Add(dInfo);
+                        }
+                        var data = new JObject
+                    {
+                        { "ZoneId", addDeviceToZoneData.ZoneId },
+                        { "DeviceList", deviceList},
+                        { "LoginToken", addDeviceToZoneData.LoginToken}
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/AddEqToZone_Actions 鍚姩"), jObject.ToString());
+                    }
+                }
+                catch
+                {
+                }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new AddDeviceToZoneResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/AddEqToZone_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 璁惧鍔犲叆闃插尯鐨勮繑鍥炴暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public AddDeviceToZoneResponseAllData addDeviceToPartResponseAllData;
+        /// <summary>
+        /// 璁惧鍔犲叆闃插尯鐨勮繑鍥炴暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class AddDeviceToZoneResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 璁惧鍔犲叆闃插尯鐨勮繑鍥炴暟鎹�
+            /// </summary>
+            public AddDeviceToZoneResponseData addDeviceToPartResponseData;
+        }
+
+        /// <summary>
+        /// 璁惧鍔犲叆闃插尯鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        public AddDeviceToZoneResponseData addDeviceToZoneResponseData;
+        /// <summary>
+        /// 璁惧鍔犲叆闃插尯鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AddDeviceToZoneResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// <para>1锛氭坊鍔犲け璐ャ�傦紙灞�閮ㄥ竷闃插垪琛╥d涓嶅瓨鍦級</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 闃插尯id
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 瀹夐槻璁惧鍒楄〃(Result=0鏃跺瓨鍦�)
+            /// </summary>
+            public List<DeviceListResponseObj> DeviceList = new List<DeviceListResponseObj>();
+
+        }
+
+        /// <summary>
+        /// 瀹夐槻璁惧鍒楄〃鍥炲鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class DeviceListResponseObj
+        {
+            /// <summary>
+            /// 0锛氭坊鍔犳垚鍔�
+            ///<para>1锛氬け璐ワ紝璁惧涓嶅瓨鍦ㄣ��</para>
+            ///<para>2锛氬け璐ワ紝璁惧宸茬粡鍔犲叆浜嗗叾浠栭槻鍖恒��</para>
+            /// </summary>
+            public int Status;
+            /// <summary>
+            /// 璁惧mac鍦板潃
+            /// </summary>
+            public string MacAddr;
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            /// </summary>
+            public int Epoint;
+            /// <summary>
+            /// 璁惧涓婃姤鐨勭姸鎬佹槸鍚︿负鐬棿鐘舵�侊紝鐢ㄤ簬閰嶅悎涓嬮潰鐨凾riggerZoneStatus鍊间娇鐢ㄣ��
+            ///<pata>0锛氶潪鐬棿鐘舵�侊紝璇ヨ澶囦笂鎶ョ殑瀹夐槻鐘舵�佸彲鎸佺画锛岀洿鍒扮姸鎬佽鏀瑰彉浼氬啀娆℃姤鍛婂畨闃茬姸鎬佷俊鎭�傚闂ㄧ璁惧鐨勫紑鐘舵�佸拰鍏崇姸鎬侊紙寮�鍜屽叧鐘舵�佹槸鑳芥寔缁殑锛夈��</pata>
+            ///<pata>1锛氳〃绀哄畨闃茬姸鎬佷负鐬棿閲忥紝璁惧璀﹀憡婵�娲荤姸鎬佹墠涓婃姤瀹夐槻淇℃伅锛岃澶囨仮澶嶅父鎬佷笉鍙戦�侀�氱煡銆傚浜轰綋绾㈠浼犳劅鍣紙褰撴湁浜烘椂瑙﹀彂璀﹀憡锛屼絾浜鸿蛋浜嗗悗锛屼笉浼氬彂閫佹秷闄よ鍛婁俊鎭�傛棤娉曠煡閬撲汉杩樺湪涓嶅湪锛�</pata>
+            /// </summary>
+            public int MomentStatus;
+            /// <summary>
+            /// <pata>褰揗omentStatus涓�0鏃讹紝瀹夐槻璁惧琚Е鍙戜笂鎶ュ畨闃蹭俊鎭殑ZoneStatus鍊煎拰TriggerZoneStatus杩涜涓庤繍绠楋紙&锛夌粨鏋滀笉涓�0鏃舵縺娲婚槻鍖鸿鎶ワ紝涓�0鏃惰В闄ゆ縺娲汇�備緥濡傞棬纾佽澶囷紝濡傛灉鏈変汉寮�闂ㄥ叆渚靛皢婵�娲婚槻鍖烘姤璀︼紝鍙皢TriggerZoneStatus璁剧疆涓�17锛屽紑闂ㄦ椂涓婃姤鐨刏oneStatus鍊间负1锛岋紙17 & 1锛�>0锛屾鏃惰鏄庢湁鍏ヤ镜锛岄槻鍖哄皢琚縺娲伙紝鍙戦�佽鍛婁俊鎭埌瀹㈡埛绔拰鏈嶅姟鍣ㄥ苟鎵ц璁惧畾鐨勮鎴掑姩浣溿��</pata>
+            /// <pata>褰揗omentStatus涓�1鏃讹紝璇存槑瀹夐槻璁惧鐨勬縺娲荤姸鎬佸彧鏄灛闂寸殑锛屽彧鏈夊湪涓婃姤ZoneStatus鍊硷紙鍜孴riggerZoneStatus鐩镐笌涓嶄负0鏃讹級鐨勭灛闂存縺娲伙紝婵�娲诲悗灏嗙珛鍗宠嚜鍔ㄦ仮澶嶄负甯告�併��</pata>
+            /// <pata>璁剧疆甯冮槻鏃讹紝濡傛灉瀹夐槻璁惧琚Е鍙戯紝闃插尯澶勪簬璀﹀憡鐘舵�侊紝瑕佽В闄ゆ縺娲绘墠鑳藉竷闃叉垚鍔熴�傚鏋滀笂闈omentStatus涓�0锛屽垯闇�瑕佸畨闃茶澶囧啀娆′笂鎶ョ殑ZoneStatus鍊煎拰TriggerZoneStatus鍊艰繘琛屼笌杩愮畻缁撴灉涓�0鎵嶈兘瑙i櫎婵�娲荤姸鎬� 銆傚鏋淢omentStatus涓�1锛屽垯璇存槑璁惧宸茬粡鑷姩鎭㈠甯告�侊紝甯冮槻鍙互鎴愬姛銆�</pata>
+            /// <pata>濡傞棬纾佽澶囧叧闂ㄦ椂涓婃姤鐨刏oneStatus鍊间负32锛岋紙32&1锛�=0銆傚垯璇存槑闂ㄥ凡缁忓叧涓婏紝闃插尯婵�娲荤姸鎬佸皢瑙i櫎锛屽彲瀵归槻鍖鸿繘琛屽竷闃层�傚鏋淢omentStatus涓�1锛屽垯蹇界暐璇ヨ澶囩殑鏈�杩戣鍛婄姸鎬佽繘琛屽竷闃层��</pata>
+            /// </summary>
+            public int TriggerZoneStatus;
+        }
+
+        /// <summary>
+        /// 鏂板缓鎴栦慨鏀归槻鍖虹殑鏁版嵁
+        /// </summary>
+        public AddDeviceToZoneData addDeviceToZoneData;
+        /// <summary>
+        /// 璁惧鍔犲叆闃插尯鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AddDeviceToZoneData
+        {
+            /// <summary>
+            /// 闃插尯id銆�
+            ///<para>1锛�24灏忔椂闃插尯銆�</para>
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+            ///<para>3锛氬嚭鍏ラ槻鍖恒��</para>
+            ///<para>4锛氬唴閮ㄩ槻鍖恒��</para>
+            ///<para>5锛氬懆鐣岄槻鍖恒��</para>
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 瀹夐槻璁惧鍒楄〃
+            /// </summary>
+            public List<DeviceListObj> DeviceList = new List<DeviceListObj>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+
+        }
+
+        /// <summary>
+        /// 瀹夐槻璁惧鍒楄〃鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class DeviceListObj
+        {
+            /// <summary>
+            /// 璁惧mac鍦板潃
+            /// </summary>
+            public string MacAddr;
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            /// </summary>
+            public int Epoint;
+            /// <summary>
+            /// 璁惧涓婃姤鐨勭姸鎬佹槸鍚︿负鐬棿鐘舵�侊紝鐢ㄤ簬閰嶅悎涓嬮潰鐨凾riggerZoneStatus鍊间娇鐢ㄣ��
+            ///<pata>0锛氶潪鐬棿鐘舵�侊紝璇ヨ澶囦笂鎶ョ殑瀹夐槻鐘舵�佸彲鎸佺画锛岀洿鍒扮姸鎬佽鏀瑰彉浼氬啀娆℃姤鍛婂畨闃茬姸鎬佷俊鎭�傚闂ㄧ璁惧鐨勫紑鐘舵�佸拰鍏崇姸鎬侊紙寮�鍜屽叧鐘舵�佹槸鑳芥寔缁殑锛夈��</pata>
+            ///<pata>1锛氳〃绀哄畨闃茬姸鎬佷负鐬棿閲忥紝璁惧璀﹀憡婵�娲荤姸鎬佹墠涓婃姤瀹夐槻淇℃伅锛岃澶囨仮澶嶅父鎬佷笉鍙戦�侀�氱煡銆傚浜轰綋绾㈠浼犳劅鍣紙褰撴湁浜烘椂瑙﹀彂璀﹀憡锛屼絾浜鸿蛋浜嗗悗锛屼笉浼氬彂閫佹秷闄よ鍛婁俊鎭�傛棤娉曠煡閬撲汉杩樺湪涓嶅湪锛�</pata>
+            /// </summary>
+            public int MomentStatus;
+            /// <summary>
+            /// 
+            /// <pata>褰揗omentStatus涓�0鏃讹紝瀹夐槻璁惧琚Е鍙戜笂鎶ュ畨闃蹭俊鎭殑ZoneStatus鍊煎拰TriggerZoneStatus杩涜涓庤繍绠楋紙&锛夌粨鏋滀笉涓�0鏃舵縺娲婚槻鍖鸿鎶ワ紝涓�0鏃惰В闄ゆ縺娲汇�備緥濡傞棬纾佽澶囷紝濡傛灉鏈変汉寮�闂ㄥ叆渚靛皢婵�娲婚槻鍖烘姤璀︼紝鍙皢TriggerZoneStatus璁剧疆涓�17锛屽紑闂ㄦ椂涓婃姤鐨刏oneStatus鍊间负1锛岋紙17 & 1锛�>0锛屾鏃惰鏄庢湁鍏ヤ镜锛岄槻鍖哄皢琚縺娲伙紝鍙戦�佽鍛婁俊鎭埌瀹㈡埛绔拰鏈嶅姟鍣ㄥ苟鎵ц璁惧畾鐨勮鎴掑姩浣溿��</pata>
+            /// <pata>褰揗omentStatus涓�1鏃讹紝璇存槑瀹夐槻璁惧鐨勬縺娲荤姸鎬佸彧鏄灛闂寸殑锛屽彧鏈夊湪涓婃姤ZoneStatus鍊硷紙鍜孴riggerZoneStatus鐩镐笌涓嶄负0鏃讹級鐨勭灛闂存縺娲伙紝婵�娲诲悗灏嗙珛鍗宠嚜鍔ㄦ仮澶嶄负甯告�併��</pata>
+            /// <pata>璁剧疆甯冮槻鏃讹紝濡傛灉瀹夐槻璁惧琚Е鍙戯紝闃插尯澶勪簬璀﹀憡鐘舵�侊紝瑕佽В闄ゆ縺娲绘墠鑳藉竷闃叉垚鍔熴�傚鏋滀笂闈omentStatus涓�0锛屽垯闇�瑕佸畨闃茶澶囧啀娆′笂鎶ョ殑ZoneStatus鍊煎拰TriggerZoneStatus鍊艰繘琛屼笌杩愮畻缁撴灉涓�0鎵嶈兘瑙i櫎婵�娲荤姸鎬� 銆傚鏋淢omentStatus涓�1锛屽垯璇存槑璁惧宸茬粡鑷姩鎭㈠甯告�侊紝甯冮槻鍙互鎴愬姛銆�</pata>
+            /// <pata>濡傞棬纾佽澶囧叧闂ㄦ椂涓婃姤鐨刏oneStatus鍊间负32锛岋紙32&1锛�=0銆傚垯璇存槑闂ㄥ凡缁忓叧涓婏紝闃插尯婵�娲荤姸鎬佸皢瑙i櫎锛屽彲瀵归槻鍖鸿繘琛屽竷闃层�傚鏋淢omentStatus涓�1锛屽垯蹇界暐璇ヨ澶囩殑鏈�杩戣鍛婄姸鎬佽繘琛屽竷闃层��</pata>
+            /// </summary>
+            public int TriggerZoneStatus;
+        }
+        #endregion
+
+        #region 3 *鏂板缓鎴栦慨鏀瑰竷闃叉ā寮�;
+        /// <summary>
+        /// *鏂板缓鎴栦慨鏀瑰竷闃叉ā锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        /// <returns>The new mode async.</returns>
+        /// <param name="addNewModeData">鏂板缓鎴栦慨鏀瑰竷闃叉ā寮忕殑鏁版嵁.</param>
+        public static async System.Threading.Tasks.Task<AddNewModeResponseAllData> AddNewModeAsync(AddNewModeData addNewModeData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                AddNewModeResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new AddNewModeResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new AddNewModeResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new AddNewModeResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId };
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        d = new AddNewModeResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AddNewMode_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+
+                        if (result == 0)
+                        {
+                            var addNewModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddNewModeResponseData>(jobject["Data"].ToString());
+                            if (addNewModeResponseData != null)
+                            {
+                                d = new AddNewModeResponseAllData { addNewModeResponseData = addNewModeResponseData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+                            }
+                        }
+                        else
+                        {
+                            d = new AddNewModeResponseAllData { errorMessageBase = "鏂板缓鎴栦慨鏀规ā寮忓け璐�" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/AddNewMode_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    if (addNewModeData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4004 } };
+                        var data = new JObject
+                    {
+                        { "ModeId", addNewModeData.ModeId },
+                        { "ModeName", addNewModeData.ModeName },
+                        { "AllowDisable", addNewModeData.AllowDisable },
+                        { "LoginToken", addNewModeData.LoginToken }
+                     };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/AddNewMode"), jObject.ToString());
+                    }
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new AddNewModeResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/AddNewMode_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏂板缓鎴栦慨鏀归槻鍖鸿繑鍥炵殑鏁版嵁 ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public AddNewModeResponseAllData addNewModeResponseAllData;
+        /// <summary>
+        /// 鏂板缓鎴栦慨鏀瑰竷闃叉ā寮忚繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class AddNewModeResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            ///鏂板缓鎴栦慨鏀瑰竷闃叉ā寮忚繑鍥炵殑鏁版嵁
+            /// </summary>
+            public AddNewModeResponseData addNewModeResponseData;
+        }
+
+        /// <summary>
+        /// 鏂板缓鎴栦慨鏀瑰竷闃叉ā寮忚繑鍥炵殑鏁版嵁
+        /// </summary>
+        public AddNewModeResponseData addNewModeResponseData;
+        /// <summary>
+        /// 鏂板缓鎴栦慨鏀瑰竷闃叉ā寮忚繑鍥炵殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class AddNewModeResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// 0锛氭垚鍔燂紝淇敼鎴栨柊澧炴垚鍔� 
+            ///<para>1锛氬け璐ワ紝淇敼鐨勫竷闃叉ā寮忎笉瀛樺湪</para>
+            ///<para>2锛氬け璐ワ紝24灏忔椂甯冮槻妯″紡涓嶅厑璁镐慨鏀广�傦紙褰撲慨鏀筂odeId涓�255鏃讹紝灏嗚繑鍥炶閿欒锛�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 甯冮槻妯″紡ID
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 甯冮槻妯″紡鍚嶇О 锛屾渶澶�32涓瓧绗︺��
+            /// </summary>
+            public string ModeName;
+
+            /// <summary>
+            /// 鍏佽澶辫兘銆�
+            ///<para>0锛氫笉鍏佽澶辫兘銆�</para>
+            ///<para>1锛氬厑璁稿け鑳�</para>
+            /// </summary>
+            public int AllowDisable;
+        }
+
+        /// <summary>
+        /// 鏂板缓鎴栦慨鏀瑰竷闃叉ā寮忕殑鏁版嵁
+        /// </summary>
+        public AddNewModeData addNewModeData;
+        /// <summary>
+        /// 鏂板缓鎴栦慨鏀瑰竷闃叉ā寮忕殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class AddNewModeData
+        {
+            /// <summary>
+            /// 瑕佷慨鏀圭殑甯冮槻妯″紡ID銆�
+            ///<para>濡傛灉涓�0锛屽垯涓烘柊澧炲竷闃叉ā寮忋��</para> 
+            ///<para>绯荤粺鍐呯疆浜嗕袱绉嶅竷闃叉ā寮忥紝鍒嗗埆涓哄湪瀹跺竷闃诧紙ModeId涓�1锛夈�佺瀹跺竷闃诧紙ModeId涓�2锛夈�備袱绉嶅唴缃ā寮忎笉鍙垹闄ゃ��</para>
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 甯冮槻妯″紡鍚嶇О 锛屾渶澶�32涓瓧绗︺��
+            ///<para>涓嶉渶瑕佷慨鏀瑰彲蹇界暐璇ュ瓧娈点��</para>
+            /// </summary>
+            public string ModeName;
+
+            /// <summary>
+            /// 鍏佽澶辫兘銆�
+            ///<para>0锛氫笉鍏佽澶辫兘銆�</para>
+            ///<para>1锛氬厑璁稿け鑳�</para>
+            ///<para>濡傛灉涓嶉渶瑕佷慨鏀瑰彲蹇界暐璇ュ瓧娈点�傛柊澧炲竷闃叉椂锛岄粯璁や负0銆� </para>
+            /// </summary>
+            public int AllowDisable;
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+        }
+        #endregion
+
+        #region 4 *闃插尯鍔犲叆甯冮槻妯″紡.
+        /// <summary>
+        /// *闃插尯鍔犲叆甯冮槻妯″紡锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        /// <returns>The join mode async.</returns>
+        /// <param name="zoneJoinModeData">闃插尯鍔犲叆甯冮槻妯″紡鐨勬暟鎹�</param>
+        public static async System.Threading.Tasks.Task<ZoneJoinModeResponseAllData> ZoneJoinModeAsync(ZoneJoinModeData zoneJoinModeData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                ZoneJoinModeResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new ZoneJoinModeResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new ZoneJoinModeResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new ZoneJoinModeResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        d = new ZoneJoinModeResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/ZoneJoinMode_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        var modeId = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["ModeId"].ToString());
+                        if (result == 0)
+                        {
+                            var zoneJoinModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZoneJoinModeResponseData>(jobject["Data"].ToString());
+                            if (zoneJoinModeResponseData != null)
+                            {
+                                d = new ZoneJoinModeResponseAllData { zoneJoinModeResponseData = zoneJoinModeResponseData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+                            }
+                        }
+                        else
+                        {
+                            d = new ZoneJoinModeResponseAllData { };
+                            var r = new ZoneJoinModeResponseData();
+                            r.Result = result;
+                            r.ModeId = modeId;
+                            d.zoneJoinModeResponseData = r;
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/ZoneJoinMode_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    if (zoneJoinModeData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4005 } };
+                        var zoneList = new JArray { };
+                        foreach (var a in zoneJoinModeData.ZoneList)
+                        {
+                            var dInfo = new JObject{
+                            { "ZoneId", a.ZoneId}
+                        };
+                            zoneList.Add(dInfo);
+                        }
+                        var data = new JObject
+                    {
+                        { "ModeId", zoneJoinModeData.ModeId },
+                        { "ZoneList", zoneList },
+                        { "LoginToken", zoneJoinModeData.LoginToken }
+                        };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/ZoneJoinMode"), jObject.ToString());
+                    }
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new ZoneJoinModeResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/ZoneJoinMode_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 闃插尯鍔犲叆甯冮槻妯″紡杩斿洖鐨勬暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public ZoneJoinModeResponseAllData zoneJoinModeResponseAllData;
+        /// <summary>
+        /// 闃插尯鍔犲叆甯冮槻妯″紡杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class ZoneJoinModeResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            ///闃插尯鍔犲叆甯冮槻妯″紡杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public ZoneJoinModeResponseData zoneJoinModeResponseData;
+        }
+
+        /// <summary>
+        /// 闃插尯鍔犲叆甯冮槻妯″紡杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public ZoneJoinModeResponseData zoneJoinModeResponseData;
+        /// <summary>
+        /// 闃插尯鍔犲叆甯冮槻妯″紡杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class ZoneJoinModeResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// <para>1锛氬け璐ワ紝闃插尯ID涓嶅瓨鍦ㄣ��</para>
+            /// <para>2锛�24灏忔椂甯冮槻妯″紡锛屼笉鍏佽涓诲姩鍔犲叆闃插尯銆傦紙褰揗odeId璁剧疆涓�255鏃讹紝灏嗚繑鍥炶閿欒锛�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 甯冮槻妯″紡ID
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 闃插尯鍒楄〃(褰揜esult = 0鏃跺瓨鍦ㄣ��)
+            /// </summary>
+            public List<ZoneListResponseObj> ZoneList = new List<ZoneListResponseObj>();
+
+        }
+        /// <summary>
+        /// 闃插尯鍒楄〃
+        /// </summary>
+        [System.Serializable]
+        public class ZoneListResponseObj
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉0锛氬姞鍏ユ垚鍔�
+            ///<para>1锛氬け璐ワ紝闃插尯涓嶅瓨鍦�</para>
+            ///<para>2锛氬け璐ワ紝闃插尯宸插湪妯″紡涓瓨鍦�</para>
+            ///<para>3锛氬け璐ワ紝闃插尯涓�24灏忔椂锛堥潤闊筹級闃插尯绫诲瀷銆�</para>
+            /// </summary>
+            public int Status = 999;
+            /// <summary>
+            /// 闃插尯ID
+            /// </summary>
+            public int ZoneId;
+
+        }
+
+        /// <summary>
+        /// 闃插尯鍔犲叆甯冮槻妯″紡鐨勬暟鎹�
+        /// </summary>
+        public ZoneJoinModeData zoneJoinModeData;
+        /// <summary>
+        /// 闃插尯鍔犲叆甯冮槻妯″紡鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class ZoneJoinModeData
+        {
+            /// <summary>
+            /// 甯冮槻妯″紡ID銆�
+            /// </summary>
+            public int ModeId;
+            /// <summary>
+            /// 闃插尯鍒楄〃
+            /// <para>涓嶅寘鎷�24灏忔椂闃插尯銆佸拰24灏忔椂闈欓煶闃插尯銆�24灏忔椂闃插尯鍜�24灏忔椂闈欓煶闃插尯鏄劚绂诲竷闃叉ā寮忎笉鍙楀竷鎾ら槻褰卞搷鐨勮繍琛岋紝涓嶅姞鍏ヤ换浣曚竴绉嶆ā寮忋��</para>
+            /// </summary>
+            public List<ZoneListObj> ZoneList = new List<ZoneListObj>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+
+        }
+
+        /// <summary>
+        /// 闃插尯鍒楄〃
+        /// </summary>
+        [System.Serializable]
+        public class ZoneListObj
+        {
+            /// <summary>
+            /// 闃插尯ID
+            /// </summary>
+            public int ZoneId;
+
+        }
+        #endregion
+
+        #region 5 *浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯.
+        /// <summary>
+        /// *浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        /// <returns>removeZoneFromModeData:浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯鐨勬暟鎹�</returns>
+        /// <param name="removeZoneFromModeData">Remove zone from mode data.</param>
+        public static async System.Threading.Tasks.Task<RemoveZoneFromModeResponseAllData> RemoveZoneFromModeAsync(RemoveZoneFromModeData removeZoneFromModeData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                RemoveZoneFromModeResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new RemoveZoneFromModeResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new RemoveZoneFromModeResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new RemoveZoneFromModeResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        d = new RemoveZoneFromModeResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/RemoveZoneFromMode_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        var modeId = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["ModeId"].ToString());
+
+                        if (result == 0)
+                        {
+                            var removeZoneFromModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveZoneFromModeResponseData>(jobject["Data"].ToString());
+                            if (removeZoneFromModeResponseData != null)
+                            {
+                                d = new RemoveZoneFromModeResponseAllData { removeZoneFromModeResponseData = removeZoneFromModeResponseData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+                            }
+                        }
+                        else
+                        {
+                            d = new RemoveZoneFromModeResponseAllData { };
+                            var r = new RemoveZoneFromModeResponseData();
+                            r.ModeId = modeId;
+                            r.Result = result;
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/RemoveZoneFromMode_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    if (removeZoneFromModeData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4006 } };
+                        var zoneList = new JArray { };
+                        foreach (var a in removeZoneFromModeData.ZoneList)
+                        {
+                            var dInfo = new JObject{
+                            { "ZoneId", a.ZoneId}
+                        };
+                            zoneList.Add(dInfo);
+                        }
+                        var data = new JObject
+                    {
+                        { "ModeId", removeZoneFromModeData.ModeId },
+                        { "ZoneList", zoneList },
+                        { "LoginToken", removeZoneFromModeData.LoginToken }
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/RemoveZoneFromMode"), jObject.ToString());
+                    }
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new RemoveZoneFromModeResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/RemoveZoneFromMode_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯杩斿洖鐨勬暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public RemoveZoneFromModeResponseAllData removeZoneFromModeResponseAllData;
+        /// <summary>
+        /// 浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class RemoveZoneFromModeResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            ///浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public RemoveZoneFromModeResponseData removeZoneFromModeResponseData;
+        }
+
+        /// <summary>
+        /// 浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public RemoveZoneFromModeResponseData removeZoneFromModeResponseData;
+        /// <summary>
+        /// 浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class RemoveZoneFromModeResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// <para>1锛氬け璐ワ紝闃插尯ID涓嶅瓨鍦ㄣ��</para>
+            /// <para>2锛�24灏忔椂甯冮槻妯″紡锛屼笉鍏佽涓诲姩鍔犲叆闃插尯銆傦紙褰揗odeId璁剧疆涓�255鏃讹紝灏嗚繑鍥炶閿欒锛�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 甯冮槻妯″紡ID
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 闃插尯鍒楄〃(褰揜esult = 0鏃跺瓨鍦ㄣ��)
+            /// </summary>
+            public List<RemoveZoneListResponseObj> ZoneList = new List<RemoveZoneListResponseObj>();
+
+        }
+
+        /// <summary>
+        /// 闃插尯鍒楄〃
+        /// </summary>
+        [System.Serializable]
+        public class RemoveZoneListResponseObj
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉0锛氱Щ闄ゆ垚鍔�
+            ///<para>1锛氱Щ闄ゅけ璐�</para>
+            /// </summary>
+            public int Status;
+            /// <summary>
+            /// 闃插尯ID
+            /// </summary>
+            public int ZoneId;
+
+        }
+
+        /// <summary>
+        /// 浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯
+        /// </summary>
+        public RemoveZoneFromModeData removeZoneFromModeData;
+        /// <summary>
+        /// 浠庡竷闃叉ā寮忎腑绉婚櫎闃插尯
+        /// </summary>
+        [System.Serializable]
+        public class RemoveZoneFromModeData
+        {
+            /// <summary>
+            /// 甯冮槻妯″紡ID銆�
+            /// </summary>
+            public int ModeId;
+            /// <summary>
+            /// 闃插尯鍒楄〃
+            /// <para>涓嶅寘鎷�24灏忔椂闃插尯銆佸拰24灏忔椂闈欓煶闃插尯銆�24灏忔椂闃插尯鍜�24灏忔椂闈欓煶闃插尯鏄劚绂诲竷闃叉ā寮忎笉鍙楀竷鎾ら槻褰卞搷鐨勮繍琛岋紝涓嶅姞鍏ヤ换浣曚竴绉嶆ā寮忋��</para>
+            /// </summary>
+            public List<ZoneListObj> ZoneList = new List<ZoneListObj>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+        }
+        #endregion
+
+        #region 6 *娣诲姞妯″紡鎸囩ず鍔ㄤ綔;
+        /// <summary>
+        /// *瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        /// <returns>The scene all info async.</returns>
+        /// <param name="addModeActonData">瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勬暟鎹�.</param>
+        public static async System.Threading.Tasks.Task<AddModeActonResponAllData> AddModeActonAsync(AddModeActionData addModeActonData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                AddModeActonResponAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new AddModeActonResponAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                var dateTime = DateTime.Now;
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new AddModeActonResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new AddModeActonResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        d = new AddModeActonResponAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AddModeActon_Respon")
+                    {
+                        dateTime = DateTime.Now;
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        var modeId = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["ModeId"].ToString());
+                        var actionType = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["ActionType"].ToString());
+
+                        if (result == 0)
+                        {
+                            var addModeActonResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddModeActonResponData>(jobject["Data"].ToString());
+                            if (addModeActonResponData != null)
+                            {
+                                d = new AddModeActonResponAllData { addModeActonResponData = addModeActonResponData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            }
+                        }
+                        else
+                        {
+                            d = new AddModeActonResponAllData { };
+                            var r = new AddModeActonResponData();
+                            r.Result = result;
+                            r.ModeId = modeId;
+                            r.ActionType = actionType;
+                            d.addModeActonResponData = r;
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/AddModeActon_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    if (addModeActonData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4007 } };
+                        var acList = new JArray { };
+                        foreach (var act in addModeActonData.Actions)
+                        {
+                            if (act.Type == 0)
+                            {
+                                var taskList = new JArray { };
+                                foreach (var taskInfo in act.TaskList)
+                                {
+                                    var tInfo = new JObject{
+                            { "TaskType", taskInfo.TaskType},
+                            { "Data1", taskInfo.Data1},
+                            { "Data2",taskInfo.Data2}
+                            };
+                                    taskList.Add(tInfo);
+                                }
+
+                                var a = new JObject {
+                         { "Type",act.Type},
+                         { "DeviceAddr", act.DeviceAddr} ,
+                         { "Epoint",act.Epoint} ,
+                         { "TaskList", taskList}
+                            };
+                                acList.Add(a);
+                            }
+                            else if (act.Type == 1)
+                            {
+                                var b = new JObject {
+                         { "Type",act.Type},
+                         { "ScenesId", act.ScenesId}
+                         };
+                                acList.Add(b);
+                            }
+                        }
+                        var data = new JObject {
+                         { "ModeId",addModeActonData.ModeId},
+                         { "ActionType", addModeActonData.ActionType} ,
+                         { "Actions", acList},
+                         { "LoginToken", addModeActonData.LoginToken}
+                         };
+
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/AddModeActon"), jObject.ToString());
+                    }
+                }
+                catch { }
+
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/AddModeActon_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+        /// <summary>
+        /// 瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勮繑鍥炴暟鎹暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public AddModeActonResponAllData addModeActonResponAllData;
+        /// <summary>
+        /// 瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class AddModeActonResponAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勬暟鎹�
+            /// </summary>
+            public AddModeActonResponData addModeActonResponData;
+        }
+
+        /// <summary>
+        /// 瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勫洖澶嶆暟鎹�
+        /// </summary>
+        public AddModeActonResponData addModeActonResponData;
+        /// <summary>
+        /// 瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勫洖澶嶆暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AddModeActonResponData
+        {
+            /// <summary>
+            /// 0锛氶粯璁�
+            ///<para>1锛氬け璐ワ紝妯″紡涓嶅瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 瑕佷慨鏀圭殑甯冮槻妯″紡ID銆�
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 1锛氬竷闃叉垚鍔熸寚绀哄姩浣�
+            ///<para>2锛氬竷闃插け璐ユ寚绀哄姩浣�</para>
+            ///<para>3锛氭挙闃叉垚鍔熸寚绀哄姩浣�</para>
+            ///<para>4锛氭挙闃插け璐ユ寚绀哄姩浣�</para>
+            ///<para>5锛氬欢鏃堕槻鍖恒�佸懆鐣屽欢鏃堕槻鍖鸿瑙﹀彂杩涘叆寤舵椂鎸囩ず鍔ㄤ綔銆傚鏋滃欢鏃惰繃鍚庤繕娌℃挙闃插皢瑙﹀彂妯″紡瀹夐槻鍔ㄤ綔銆�</para>
+            ///<para>6锛氭ā寮忓畨闃插姩浣滐紝瀹夐槻琚渶缁堟縺娲诲悗鐨勬姤璀﹀姩浣滐紙濡傚欢鏃堕槻鍖鸿瑙﹀彂寤舵椂杩囧悗杩樻病鎾ら槻銆佸懆鐣岄槻鍖鸿瑙﹀彂銆佸嚭鍏ラ槻鍖烘病瑙﹀彂鍗磋Е鍙戜簡鍐呴儴闃插尯绛夋儏鍐靛皢鎵ц璇ュ姩浣滐級銆�</para>
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔銆�
+            ///<para>濡傛灉涓嶉渶瑕佷慨鏀规垨鏂板鏃跺�欏彲蹇界暐璇ュ瓧娈点��</para>
+            /// </summary>
+            public List<ActionsResponseData> Actions = new List<ActionsResponseData>();
+        }
+        /// <summary>
+        /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔鏁版嵁
+        /// </summary>
+        public class ActionsResponseData
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氭垚鍔�</para>
+            ///<para>1锛氬け璐ワ紝璁惧鎴栧満鏅笉瀛樺湪</para>
+            /// </summary>
+            public int Status = 999;
+
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public int Type;
+
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍙傛暟鍒楄〃銆傦紙褰揟ype=0鍜孲tatus = 0鏃跺瓨鍦級
+            /// </summary>
+            public List<TaskListInfo> TaskList = new List<TaskListInfo>();
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+
+            /// <summary>
+            /// 璁惧鎴栧満鏅悕绉帮紝Status = 0鏃跺瓨鍦�
+            /// </summary>
+            public string ESName;
+
+        }
+        /// <summary>
+        /// 瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勬暟鎹�
+        /// </summary>
+        public AddModeActionData addModeActionData;
+        /// <summary>
+        /// 瀹夐槻妯″紡瑙﹀彂鍔ㄤ綔娣诲姞鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AddModeActionData
+        {
+            /// <summary>
+            /// 瑕佷慨鏀圭殑甯冮槻妯″紡ID銆�
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 1锛氬竷闃叉垚鍔熸寚绀哄姩浣�
+            ///<para>2锛氬竷闃插け璐ユ寚绀哄姩浣�</para>
+            ///<para>3锛氭挙闃叉垚鍔熸寚绀哄姩浣�</para>
+            ///<para>4锛氭挙闃插け璐ユ寚绀哄姩浣�</para>
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔銆�
+            ///<para>濡傛灉涓嶉渶瑕佷慨鏀规垨鏂板鏃跺�欏彲蹇界暐璇ュ瓧娈点��</para>
+            /// </summary>
+            public List<ActionsData> Actions = new List<ActionsData>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+        }
+        /// <summary>
+        /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔鏁版嵁
+        /// </summary>
+        public class ActionsData
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public int Type = 999;
+
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍙傛暟鍒楄〃銆傚綋Type=0鏃跺瓨鍦�
+            ///<para>鍚屼竴涓澶囨渶澶氬彲璁剧疆8涓姩浣溿��</para>
+            /// </summary>
+            public List<TaskListInfo> TaskList = new List<TaskListInfo>();
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+
+        }
+        /// <summary>
+        /// 浠诲姟鍒楄〃涓殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class TaskListInfo
+        {
+            /// <summary>
+            /// 浠诲姟绫诲瀷銆�
+            ///<para>1锛氬紑鍏� 锛堣澶囧叿鏈夊紑鍏冲姛鑳芥椂鍙敤锛�</para> 
+            ///<para>3锛氫寒搴﹁皟鏁达紙璁惧鍏锋湁浜害璋冭妭鍔熻兘鏃跺彲鐢級</para> 
+            ///<para>4锛氶鑹茶皟鏁� 锛堣澶囧叿鏈夐鑹茶皟鑺傚姛鑳芥椂鍙敤锛�</para> 
+            ///<para>5锛氭亽娓╁櫒锛堣澶囧叿鏈夋亽娓╁櫒鍔熻兘鏃跺彲鐢級</para> 
+            ///<para>6: 绐楀笜璁惧锛堣澶囧叿鏈夌獥甯樺姛鑳芥椂鍙敤锛�</para> 
+            ///<para>7锛氳澶噄dentify璇嗗埆銆�</para> 
+            ///<para>8锛氬紑鍏虫姤璀︽ā寮�  </para> 
+            ///<para>9锛歴quawk command</para>
+            ///</summary>
+            public int TaskType;
+            /// <summary> 
+            /// Data1鍙栧��
+            /// <para>寮�鍏� :Data1锛堟暟鍊硷級: 0鍏�/1寮�</para>
+            ///<para>浜害璋冩暣 Data1锛堟暟鍊硷級锛氫寒搴﹀��</para>
+            ///<para>棰滆壊璋冩暣 Data1锛堟暟鍊硷級:鑹茶皟</para>
+            /// <para>鎭掓俯鍣� Data1锛堟暟鍊硷級: 0鍔犵儹/1鍒跺喎/2鑷姩璋冭妭/3 璁剧疆宸ヤ綔妯″紡/4 璁剧疆鍔犵儹搴︽暟 5/璁剧疆鍒跺喎搴︽暟 6/璁剧疆椋庢墖妯″紡</para>
+            /// <para>绐楀笜璁惧 Data1锛堟暟鍊硷級: 0 鎵撳紑/ 1鍏抽棴/ 2 鍋滄杞姩/ 4 璋冩暣鍒版寚瀹氶珮搴�/ 5 璋冩暣鍒版寚瀹氱殑鐧惧垎姣斿浣嶇疆 / 7 璋冩暣鍒版寚瀹氬�炬枩瑙�/ 8 璋冩暣鍒版寚瀹氱殑鐧惧垎姣斿�炬枩搴�</para>
+            /// <para>璁惧identify璇嗗埆銆侱ata1涓篿dentify闂儊闂儊鏃堕棿锛�0-65535绉掞級銆�</para>
+            /// <para>寮�鍏虫姤璀︽ā寮� Data1锛堟暟鍊硷紝4瀛楄妭鏁村瀷锛夌1瀛楄妭锛坆it0-bit7锛夎〃绀烘姤璀︽ā寮忥紝瀛楄妭鍊�0锛氬仠姝㈣渹楦e櫒1锛氱洍绐冩姤璀� 2锛氱伀鐏炬姤璀� 3锛氱揣鎬ユ儏鍐垫姤璀� 4锛氳杞﹀彂鍑虹殑鎶ヨ 5锛氭秷闃茶溅鍙戝嚭鐨勬姤璀� 6锛氬鐢ㄧ殑鎶ヨ銆傜2瀛楄妭锛坆it8-bit15锛夎〃绀烘槸鍚﹀惎鐢ㄦ姤璀︾伅锛屽瓧鑺傚�� 0锛氫笉鍚敤 1锛氬惎鐢ㄣ�傜3瀛楄妭锛坆it16-bit23锛夎〃绀烘姤璀﹂煶閲忥紝瀛楄妭鍊�0锛歀ow锛�1锛歁edium锛�2锛歨igh锛�3锛歷ery high銆�</para>
+            /// <para>squawk command Data1锛堟暟鍊硷紝4瀛楄妭鏁村瀷锛夌1瀛楄妭锛坆it0-bit7锛夎〃绀烘姤璀︽ā寮忥紝瀛楄妭鍊�0锛氬畨闃茬郴缁熲�滃竷闃测�濋煶鏁堚�� 锛�1锛氬畨闃茬郴缁熲�滄挙闃测�濋煶鏁堛�傜2瀛楄妭锛坆it8-bit15锛夎〃绀烘槸鍚﹀惎鍔ㄦ姤璀︾伅锛屽瓧鑺傚��0锛氫笉鍚姩锛�1锛氬惎鍔ㄣ�傜3瀛楄妭锛坆it16-bit23锛夎〃绀烘姤璀﹂煶閲忥紝瀛楄妭鍊�0锛歀ow 锛�1锛歁edium 锛�2锛歨igh 锛�3: very high銆�</para>
+            /// </summary>
+            public int Data1;
+            /// <summary>
+            /// Data2鍙栧�� 
+            /// <para>寮�鍏� Data2锛堟暟鍊硷級: 0</para>
+            /// <para>浜害璋冩暣 Data2锛堟暟鍊硷級: 0</para>
+            /// <para>棰滆壊璋冩暣 Data2锛堟暟鍊硷級锛氶ケ鍜屽害 </para>
+            ///<para> 鎭掓俯鍣―ata2鏁板�煎涓嬶細  
+            /// 銆愬綋Data1=0|1|2鏃讹紝Data2涓鸿鍙樺寲鐨勫害鏁帮紝鍗曚綅锛�0.1鈩� 銆傘��
+            ///銆愯嫢Data1=3锛孌ata2涓鸿璁惧畾鐨勭┖璋冩ā寮忥紙0-9锛夛紝0锛歰ff锛�1锛歛uto锛�3锛歝ool锛� 4锛歨eat 锛�5锛歟mergency heating, 6锛歱recooling锛�7锛歠an only 锛�8锛歞ry锛�9锛歴leep銆傘��
+            ///銆愯嫢Data1=4|5锛孌ata2涓哄姞鐑垨鍒跺喎搴︽暟锛屽崟浣�0.01鎽勬皬搴︺�傘��
+            ///銆愯嫢Data1=6锛孌ata2涓鸿璁惧畾鐨勯鎵囨ā寮忥紙0-6锛夛紝0锛歰ff锛�1锛歭ow锛�2锛歮edium锛�3锛歨igh锛�4锛歰n锛�5锛歛uto锛�6锛歴mart銆� </para>
+            ///<para>绐楀笜璁惧锛孌ata2鏁板�煎涓� 
+            ///銆愬綋Data1=4鎴�7锛孌ata2涓鸿皟鏁寸殑楂樺害鎴栧�炬枩瑙掑害 鍊炬枩瑙掑害鍗曚綅涓�0.1掳銆戙��
+            ///銆愬綋Data1=5 鎴� 8锛孌ata2涓虹櫨鍒嗘瘮锛�0-100琛ㄧず0%-100%銆�</para>
+            ///<para>璁惧identify璇嗗埆銆侱ata2锛堟暟鍊硷級: 0 </para>
+            ///<para>寮�鍏虫姤璀︽ā寮� Data2锛堟暟鍊硷紝4瀛楄妭鏁村瀷锛夌1銆�2瀛楄妭锛坆it0-bit15锛夎〃绀烘姤璀︽椂闀匡紝瀛楄妭鍊� 0-65535锛屽崟浣嶏細绉掋�傜3瀛楄妭锛坆it16-bit23锛夎〃绀洪棯鐑佸崰绌烘瘮锛屽瓧鑺傚��0-100銆傜4瀛楄妭锛坆it16-bit23锛夎〃绀烘姤璀︾伅浜害锛屽瓧鑺傚��0锛歀ow 锛�1锛歁edium 锛�2锛歨igh 锛�3: very high銆�</para>
+            ///<para>squawk command锛欴ata2锛堟暟鍊硷級: 0 </para>
+            /// </summary>
+            /// <value>The type of the task.</value>
+            public int Data2;
+
+        }
+        #endregion
+
+        #region 7 *灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄�.
+        /// <summary>
+        ///  *灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄わ紙闇�瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        /// <returns>The acton from mode async.</returns>
+        /// <param name="removeActonFromModeData"> 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鏁版嵁</param>
+        public static async System.Threading.Tasks.Task<RemoveActionFromModeAllData> RemoveActionFromModeAsync(RemoveActonFromModeData removeActonFromModeData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                RemoveActionFromModeAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new RemoveActionFromModeAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new RemoveActionFromModeAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new RemoveActionFromModeAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        d = new RemoveActionFromModeAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/RemoveActonFromMode_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var removeActonFromModeResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveActionFromModeResponData>(jobject["Data"].ToString());
+                            if (removeActonFromModeResponData != null)
+                            {
+                                d = new RemoveActionFromModeAllData { removeActonFromModeResponData = removeActonFromModeResponData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            }
+                        }
+                        else
+                        {
+                            d = new RemoveActionFromModeAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/RemoveActonFromMode_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    if (removeActonFromModeData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4008 } };
+                        var acList = new JArray { };
+                        foreach (var act in removeActonFromModeData.Actions)
+                        {
+                            if (act.Type == 0)
+                            {
+                                var a = new JObject {
+                         { "Type",act.Type},
+                         { "DeviceAddr", act.DeviceAddr} ,
+                         { "Epoint",act.Epoint}
+                             };
+                                acList.Add(a);
+                            }
+                            else if (act.Type == 1)
+                            {
+                                var b = new JObject {
+                         { "Type",act.Type},
+                         { "ScenesId", act.ScenesId}
+                         };
+                                acList.Add(b);
+                            }
+                        }
+                        var data = new JObject {
+                         { "ModeId",removeActonFromModeData.ModeId},
+                         { "ActionType", removeActonFromModeData.ActionType} ,
+                         { "Actions", acList},
+                         { "LoginToken", removeActonFromModeData.LoginToken}
+                         };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/RemoveActonFromMode"), jObject.ToString());
+                    }
+                }
+                catch
+                {
+
+                }
+
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new RemoveActionFromModeAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/RemoveActonFromMode_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+        /// <summary>
+        /// 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public RemoveActionFromModeAllData removeActonFromModeAllData;
+        /// <summary>
+        /// 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class RemoveActionFromModeAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鍥炲鏁版嵁
+            /// </summary>
+            public RemoveActionFromModeResponData removeActonFromModeResponData;
+        }
+
+        /// <summary>
+        /// 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鍥炲鏁版嵁
+        /// </summary>
+        public RemoveActionFromModeResponData removeActonFromModeResponData;
+        /// <summary>
+        /// 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鍥炲鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class RemoveActionFromModeResponData
+        {
+            /// <summary>
+            /// 0锛氶粯璁�
+            ///<para>1锛氬け璐ワ紝妯″紡涓嶅瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 妯″紡id
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 1锛氬竷闃叉垚鍔熸寚绀哄姩浣�
+            ///<para>2锛氬竷闃插け璐ユ寚绀哄姩浣�</para>
+            ///<para>3锛氭挙闃叉垚鍔熸寚绀哄姩浣�</para>
+            ///<para>4锛氭挙闃插け璐ユ寚绀哄姩浣�</para>
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍒楄〃
+            /// </summary>
+            public List<RemoveActionsResponData> Actions = new List<RemoveActionsResponData>();
+        }
+        /// <summary>
+        /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔鏁版嵁
+        /// </summary>
+        public class RemoveActionsResponData
+        {
+            /// <summary>
+            ///<para>0锛氭垚鍔�</para>
+            ///<para>1锛氬け璐ワ紝璁惧鎴栧満鏅笉瀛樺湪</para>
+            /// </summary>
+            public int Status = 999;
+
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氬満鏅�</para>
+            /// </summary>
+            public int Type;
+
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+        }
+        /// <summary>
+        /// 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        public RemoveActonFromModeData removeActonFromModeData;
+        /// <summary>
+        /// 灏嗗姩浣滀粠甯冮槻妯″紡涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class RemoveActonFromModeData
+        {
+            /// <summary>
+            /// 瑕佷慨鏀圭殑甯冮槻妯″紡ID銆�
+            /// <para>濡傛灉涓�0锛屽垯涓烘柊澧炲竷闃叉ā寮忋��</para>
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 1锛氬竷闃叉垚鍔熸寚绀哄姩浣�
+            ///<para>2锛氬竷闃插け璐ユ寚绀哄姩浣�</para>
+            ///<para>3锛氭挙闃叉垚鍔熸寚绀哄姩浣�</para>
+            ///<para>4锛氭挙闃插け璐ユ寚绀哄姩浣�</para>
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍒楄〃
+            /// </summary>
+            public List<RemoveActionsData> Actions = new List<RemoveActionsData>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+        }
+        /// <summary>
+        /// 鍔ㄤ綔鍒楄〃鐨勬暟鎹�
+        /// </summary>
+        public class RemoveActionsData
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public int Type = 999;
+
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+
+        }
+
+        #endregion
+
+        #region 8 鑾峰彇甯冮槻(瀹夐槻锛夋ā寮忓垪琛�.;
+        ///<summary >
+        /// 鑾峰彇甯冮槻妯″紡鍒楄〃.(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// </summary>
+        public static async System.Threading.Tasks.Task<GetModeListAllData> GetModeListAsync()
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                GetModeListAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new GetModeListAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new GetModeListAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new GetModeListAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/GetModeList_Repon")
+                    {
+                        var getModeListData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetModeListData>(jobject["Data"].ToString());
+                        if (getModeListData == null)
+                        {
+                            d = new GetModeListAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new GetModeListAllData { getModeListData = getModeListData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/GetModeList_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4009 }
+                                };
+                    mainGateway.Send("Security/GetModeList", jObject.ToString());
+
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new GetModeListAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/GetModeList_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鑾峰彇甯冮槻妯″紡鍒楄〃杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public GetModeListAllData getModeListAllData;
+        /// <summary>
+        /// 鑾峰彇甯冮槻妯″紡鍒楄〃杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class GetModeListAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鑾峰彇甯冮槻妯″紡鍒楄〃杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public GetModeListData getModeListData;
+
+        }
+
+        /// <summary>
+        /// 鑾峰彇甯冮槻妯″紡鍒楄〃杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public GetModeListData getModeListData;
+        /// <summary>
+        /// 鑾峰彇甯冮槻妯″紡鍒楄〃杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class GetModeListData
+        {
+            /// <summary>
+            /// 甯冮槻妯″紡鎬绘暟
+            /// </summary>
+            public int ModeSum;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍒楄〃
+            /// </summary>
+            public List<ModeListData> ModeList = new List<ModeListData>();
+        }
+        /// <summary>
+        /// 甯冮槻妯″紡鍒楄〃鏁版嵁
+        /// </summary>
+        public class ModeListData
+        {
+            /// <summary>
+            ///甯冮槻妯″紡ID
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 甯冮槻妯″紡鍚嶇О 锛屾渶澶�32涓瓧绗�
+            /// </summary>
+            public string ModeName;
+
+            /// <summary>
+            /// 鍏佽澶辫兘銆�
+            ///<para>0锛氫笉鍏佽澶辫兘銆�</para>
+            ///<para>1锛氬厑璁稿け鑳�</para>
+            /// </summary>
+            public string AllowDisable;
+
+            /// <summary>
+            /// 妯″紡褰撳墠甯冩挙闃茬姸鎬�
+            ///<para>0锛氭挙闃�</para>
+            ///<para>1锛氬竷闃�</para>
+            ///<para>2锛氫娇鑳戒竴娆�</para>
+            ///<para>3锛氬け鑳戒竴娆�</para>
+            /// </summary>
+            public int Setting;
+        }
+        #endregion
+
+        #region 9 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅.
+        ///<summary >
+        /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅.(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// <para>modeId:甯冮槻妯″紡id</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<GetModeInfoByIdResponAllData> GetModeInfoByIdAsync(int modeId)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                GetModeInfoByIdResponAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new GetModeInfoByIdResponAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new GetModeInfoByIdResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new GetModeInfoByIdResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+                    if (topic == gatewayID + "/" + "Security/GetModeInfoById_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var getModeInfoByIdResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetModeInfoByIdResponData>(jobject["Data"].ToString());
+                            if (getModeInfoByIdResponData != null)
+                            {
+                                d = new GetModeInfoByIdResponAllData { getModeInfoByIdResponData = getModeInfoByIdResponData };
+                            }
+                            System.Console.WriteLine("宸叉敹鍒伴�氱煡杩斿洖");
+                        }
+                        else
+                        {
+                            d = new GetModeInfoByIdResponAllData { };
+                            var r = new GetModeInfoByIdResponData();
+                            r.Result = result;
+                            d.getModeInfoByIdResponData = r;
+                            System.Console.WriteLine("宸叉敹鍒伴�氱煡杩斿洖");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/GetModeInfoById_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4010 }
+                                };
+                    var data = new JObject { { "ModeId", modeId } };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/GetModeInfoById", jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new GetModeInfoByIdResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/GetModeInfoById_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public GetModeInfoByIdResponAllData getModeInfoByIdResponAllData;
+        /// <summary>
+        /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class GetModeInfoByIdResponAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public GetModeInfoByIdResponData getModeInfoByIdResponData;
+        }
+
+        /// <summary>
+        /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public GetModeInfoByIdResponData getModeInfoByIdResponData;
+        /// <summary>
+        /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class GetModeInfoByIdResponData
+        {
+            /// <summary>
+            /// 0锛氶粯璁�
+            ///<para>1锛氬け璐ワ紝甯冮槻妯″紡涓嶅瓨鍦�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 甯冮槻妯″紡ID
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 甯冮槻妯″紡鍚嶇О 锛屾渶澶�32涓瓧绗�
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public string ModeName;
+
+            /// <summary>
+            /// 鍏佽澶辫兘銆�
+            ///<para>0锛氫笉鍏佽澶辫兘銆�</para>
+            ///<para>1锛氬厑璁稿け鑳�</para>
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public int AllowDisable = 100;
+
+            /// <summary>
+            /// 妯″紡褰撳墠甯冩挙闃茬姸鎬�
+            ///<para>0锛氭挙闃�</para>
+            ///<para>1锛氬竷闃�</para>
+            ///<para>2锛氫娇鑳戒竴娆�</para>
+            ///<para>3锛氬け鑳戒竴娆�</para>
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public int Setting = 100;
+
+            /// <summary>
+            /// 鍔犲叆妯″紡鐨勯槻鍖烘暟閲�
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public int ZoneNum;
+
+            /// <summary>
+            /// 鍔犲叆鎴愬姛鐨勯槻鍖哄垪琛紝涓嶅寘鎷�24灏忔椂闃插尯銆佸拰24灏忔椂闈欓煶闃插尯銆�24灏忔椂闃插尯鍜�24灏忔椂闈欓煶闃插尯鏄劚绂诲竷闃叉ā寮忎笉鍙楀竷鎾ら槻褰卞搷鐨勮繍琛岋紝鍔犲叆浠讳綍涓�绉嶆ā寮忋��
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public List<ZoneListData> ZoneList = new List<ZoneListData>();
+
+            /// <summary>
+            /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔銆�
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public List<ActionsInfo> ProtectionSucceedActions = new List<ActionsInfo>();
+            /// <summary>
+            /// 甯冮槻澶辫触鎸囩ず鍔ㄤ綔銆�
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public List<ActionsInfo> ProtectionFailActions = new List<ActionsInfo>();
+
+            /// <summary>
+            /// 鎾ら槻鎴愬姛鎸囩ず鍔ㄤ綔銆�
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public List<ActionsInfo> WithdrawSucceedActions = new List<ActionsInfo>();
+            /// <summary>
+            /// 鎾ら槻澶辫触鎸囩ず鍔ㄤ綔銆�
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public List<ActionsInfo> WithdrawFailActions = new List<ActionsInfo>();
+
+        }
+
+        /// <summary>
+        /// 鍔犲叆鎴愬姛鐨勯槻鍖哄垪琛ㄧ殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class ZoneListData
+        {
+            /// <summary>
+            /// 闃插尯ID
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 闃插尯鍚嶇О
+            /// </summary>
+            public string ZoneName;
+
+        }
+
+        /// <summary>
+        /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔鏁版嵁
+        /// </summary>
+        public class ActionsInfo
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public int Type = 999;
+
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍙傛暟鍒楄〃銆傚綋Type=0鏃跺瓨鍦�
+            /// </summary>
+            public List<TaskListInfo> TaskList = new List<TaskListInfo>();
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+
+            /// <summary>
+            /// 璁惧鎴栧満鏅悕绉�
+            /// </summary>
+            public string ESName;
+        }
+        #endregion
+
+        #region 10鏌ョ湅褰撳墠姝e湪浣跨敤鐨勫竷闃叉ā.
+        ///<summary >
+        /// 鏌ョ湅褰撳墠姝e湪浣跨敤鐨勫竷闃叉ā寮�.(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// </summary>
+        public static async System.Threading.Tasks.Task<GetModeUsingResponseAllData> GetModeUsingAsync()
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                GetModeUsingResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new GetModeUsingResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new GetModeUsingResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new GetModeUsingResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/GetModeUsing_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var getModeInfoByIdResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetModeUsingResponseData>(jobject["Data"].ToString());
+                            if (getModeInfoByIdResponData != null)
+                            {
+                                d = new GetModeUsingResponseAllData { getModeUsingResponseData = getModeInfoByIdResponData };
+                            }
+                            System.Console.WriteLine("宸叉敹鍒版纭殑閫氱煡杩斿洖");
+                        }
+                        else
+                        {
+                            d = new GetModeUsingResponseAllData { };
+                            var r = new GetModeUsingResponseData();
+                            r.Result = result;
+                            d.getModeUsingResponseData = r;
+                            System.Console.WriteLine("宸叉敹鍒伴�氱煡杩斿洖");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/GetModeUsing_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4011}
+                                };
+                    mainGateway.Send("Security/GetModeUsing", jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new GetModeUsingResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/GetModeUsing_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏌ョ湅褰撳墠姝e湪浣跨敤鐨勫竷闃叉ā寮忚繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public GetModeUsingResponseAllData getModeUsingResponseAllData;
+        /// <summary>
+        /// 鏌ョ湅褰撳墠姝e湪浣跨敤鐨勫竷闃叉ā寮忚繑鍥炵殑鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class GetModeUsingResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鏌ョ湅褰撳墠姝e湪浣跨敤鐨勫竷闃叉ā寮忚繑鍥炵殑鏁版嵁
+            /// </summary>
+            public GetModeUsingResponseData getModeUsingResponseData;
+
+        }
+
+
+        /// <summary>
+        /// 鏌ョ湅褰撳墠姝e湪浣跨敤鐨勫竷闃叉ā寮忚繑鍥炵殑鏁版嵁
+        /// </summary>
+        public GetModeUsingResponseData getModeUsingResponseData;
+        /// <summary>
+        /// 鏌ョ湅褰撳墠姝e湪浣跨敤鐨勫竷闃叉ā寮忚繑鍥炵殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class GetModeUsingResponseData
+        {
+            /// <summary>
+            /// 0锛氶粯璁�
+            /// <para>1锛氱郴缁熷綋鍓嶆病鏈夎繘琛屽竷闃�</para> 
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 鍚敤鐨勫竷闃叉ā寮廼d
+            /// </summary>
+            public int ModeId;
+            /// <summary>
+            /// 妯″紡鍚嶇О(Result =0鏃跺瓨鍦�)
+            /// </summary>
+            public string ModeName;
+            /// <summary>
+            /// 璁剧疆 (Result = 0鏃跺瓨鍦�)
+            /// <para>1锛氭案涔呭竷闃诧紝鐩村埌鎾ら槻</para>
+            /// <para>2锛氫娇鑳戒竴娆★紝瑙﹀彂涓�娆″悗灏嗘挙闃层��</para>
+            /// <para>3锛氬け鑳戒竴娆★紝绗竴娆¤婵�娲讳笉璀﹀憡涓嶈Е鍙戝姩浣溿��</para>
+            /// </summary>
+            public int Setting;
+
+        }
+        #endregion
+
+        #region 11甯冮槻 ;
+        ///<summary >
+        /// 甯冮槻  (浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// <para>EnableModeData:甯冮槻鐨勬暟鎹�</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<EnableModeResponAllData> EnableModeAsync(EnableModeData enableModeData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                EnableModeResponAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new EnableModeResponAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new EnableModeResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new EnableModeResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+                    if (topic == gatewayID + "/" + "Security/EnableMode_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        var modeId = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["ModeId"].ToString());
+                        var enableModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<EnableModeResponseData>(jobject["Data"].ToString());
+                        if (enableModeResponseData == null)
+                        {
+                            d = new EnableModeResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new EnableModeResponAllData { enableModeResponseData = enableModeResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/EnableMode_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+                try
+                {
+                    if (enableModeData != null)
+                    {
+                        var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4012 }
+                                };
+
+                        var data = new JObject
+                    {
+                    { "Setting", enableModeData.Setting },
+                    { "ModeId", enableModeData .ModeId},
+                    { "CheckIASStatus", enableModeData.CheckIASStatus},
+                    { "UserPassword", enableModeData .UserPassword }
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send("Security/EnableMode", jObject.ToString());
+                    }
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new EnableModeResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/EnableMode_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 甯冮槻杩斿洖鐨勬暟鎹�,,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public EnableModeResponAllData enableModeResponAllData;
+        /// <summary>
+        /// 甯冮槻杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class EnableModeResponAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 甯冮槻杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public EnableModeResponseData enableModeResponseData;
+        }
+
+        /// <summary>
+        /// 甯冮槻杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public EnableModeResponseData enableModeResponseData;
+        /// <summary>
+        /// 甯冮槻杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class EnableModeResponseData
+        {
+            /// <summary>
+            /// 0锛氳缃垚鍔�
+            ///<para>1锛氳缃け璐ワ紝甯冮槻妯″紡涓嶅瓨鍦�</para>
+            ///<para>2锛氳缃け璐ワ紝鐢ㄦ埛瀵嗙爜閿欒銆�</para>
+            ///<para>3锛氬竷闃插け璐ワ紝瀹夐槻璁惧鏈氨缁��</para>
+            ///<para>4锛氬竷闃插け璐ワ紝鏈夊叾浠栧竷闃叉ā寮忔鍦ㄥ惎鐢紙鍙兘浣跨敤涓�绉嶅竷闃叉ā寮忥紝闇�灏嗘鍦ㄥ惎鐢ㄧ殑甯冮槻妯″紡鎾ら槻鎵嶈兘甯冮槻鏂版ā寮忥級銆�</para>
+            ///<para>5锛氬け璐ワ紝妯″紡灞炴�т笉鍏佽澶辫兘锛堝鏋滄柊寤哄竷闃叉ā寮忔椂锛孉llowDisable璁剧疆涓�0锛屽垯甯冮槻Setting鍊间笉鑳戒负2鎴�3锛屽惁鍒欏皢鎶ュ憡璇ラ敊璇級</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 鍚敤鐨勫竷闃叉ā寮廼d
+            /// </summary>
+            public int ModeId;
+            /// <summary>
+            /// 妯″紡鍚嶇О(Result =0鏃跺瓨鍦�)
+            /// </summary>
+            public string ModeName;
+            /// <summary>
+            /// 璁剧疆
+            /// <para>1锛氭案涔呭竷闃诧紝鐩村埌鎾ら槻</para>
+            /// <para>2锛氫娇鑳戒竴娆★紝瑙﹀彂涓�娆″悗灏嗘挙闃层��</para>
+            /// <para>3锛氬け鑳戒竴娆★紝绗竴娆¤婵�娲讳笉璀﹀憡涓嶈Е鍙戝姩浣溿��</para>
+            /// </summary>
+            public int Setting;
+
+            /// <summary>
+            ///褰撳墠姝e湪鍚敤鐨勫竷闃叉ā寮廔D锛堝綋Result = 4鏃跺瓨鍦ㄣ�傦級
+            /// </summary>
+            public int ModeIdBeUsing;
+
+            /// <summary>
+            ///鏈氨缁澶囩殑mac鍦板潃锛堝綋Result =3鏃跺瓨鍦級
+            /// </summary>
+            public string IASMac;
+
+            /// <summary>
+            ///鏈氨缁澶囩殑绔彛鍙凤紙褰揜esult = 3鏃跺瓨鍦ㄣ�傦級
+            /// </summary>
+            public int IASEpoint;
+
+            /// <summary>
+            ///鏈氨缁澶囧悕绉帮紙褰揜esult = 3鏃跺瓨鍦級
+            /// </summary>
+            public string IASName;
+
+            /// <summary>
+            ///璁惧鏈�杩戜竴娆′笂鎶ョ殑瀹夐槻鐘舵�佸�硷紙褰揜esult=3鏃跺瓨鍦級
+            /// </summary>
+            public int IASStatus;
+            /// <summary>
+            ///鏈氨缁澶囨墍鍦ㄩ槻鍖猴紙褰揜esult=3鏃跺瓨鍦級
+            /// </summary>
+            public int ZoneId;
+            /// <summary>
+            ///鏈氨缁澶囨墍鍦ㄩ槻鍖猴紙褰揜esult=3鏃跺瓨鍦ㄥ綋Result = 3鏃跺瓨鍦級
+            /// </summary>
+            public string ZoneName;
+        }
+
+        /// <summary>
+        /// 甯冮槻
+        /// </summary>
+        public EnableModeData enableModeData;
+        /// <summary>
+        /// 甯冮槻
+        /// </summary>
+        [System.Serializable]
+        public class EnableModeData
+        {
+            /// <summary>
+            /// 1锛涙案涔呭竷闃诧紝鐩村埌鎾ら槻
+            ///<para>2锛氫娇鑳戒竴娆★紝瑙﹀彂涓�娆″悗灏嗘挙闃层��</para>
+            ///<para>3锛氬け鑳戒竴娆★紝绗竴娆¤婵�娲讳笉璀﹀憡涓嶈Е鍙戝姩浣溿��</para>
+            /// </summary>
+            public int Setting;
+
+            /// <summary>
+            /// 鍚敤鐨勫竷闃叉ā寮廼d
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            ///妫�鏌ラ槻鍖鸿澶囨渶杩戜笂鎶ョ殑瀹夐槻淇℃伅鐘舵�佽繘琛屽竷闃层��
+            ///<para>0锛氫笉妫�鏌�</para>
+            ///<para>1锛氭鏌�</para>
+            /// </summary>
+            public int CheckIASStatus;
+
+            /// <summary>
+            ///鐢ㄦ埛瀵嗙爜锛屾渶澶�32涓瓧绗�
+            /// </summary>
+            public string UserPassword;
+        }
+
+        #endregion
+
+        #region 12鎾ら槻.;
+        ///<summary >
+        /// 鎾ら槻.(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// </summary>
+        public static async System.Threading.Tasks.Task<WithdrawModeResponseAllData> WithdrawModeAsync(string userPassword)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                WithdrawModeResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new WithdrawModeResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new WithdrawModeResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new WithdrawModeResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/WithdrawMode_Respon")
+                    {
+                        var withdrawModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<WithdrawModeResponseData>(jobject["Data"].ToString());
+                        if (withdrawModeResponseData == null)
+                        {
+                            d = new WithdrawModeResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new WithdrawModeResponseAllData { withdrawModeResponseData = withdrawModeResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/WithdrawMode_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4013}
+                                };
+                    var data = new JObject
+                {
+                    { "UserPassword", userPassword}
+                };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/WithdrawMode", jObject.ToString());
+
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new WithdrawModeResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/WithdrawMode_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鎾ら槻杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public WithdrawModeResponseAllData withdrawModeResponseAllData;
+        /// <summary>
+        /// 鎾ら槻杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class WithdrawModeResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鎾ら槻杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public WithdrawModeResponseData withdrawModeResponseData;
+
+        }
+
+        /// <summary>
+        /// 鎾ら槻杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public WithdrawModeResponseData withdrawModeResponseData;
+        /// <summary>
+        /// 鎾ら槻杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class WithdrawModeResponseData
+        {
+            /// <summary>
+            /// 0锛氭挙闃叉垚鍔熴��
+            ///<para>1锛氬け璐ワ紝褰撳墠涓嶅瓨鍦ㄥ竷闃层��</para>
+            ///<para>2锛氭挙闃插け璐ワ紝瀵嗙爜閿欒銆�</para>
+            ///<para>3锛氭挙闃插け璐ワ紝妯″紡涓嶅彲鎾ら槻銆傦紙鏂板缓妯″紡鏃讹紝妯″紡灞炴�ц涓轰笉鍙挙闃插垯甯冮槻鍚庡皢涓嶈兘鎾ら槻锛�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 琚挙闃茬殑妯″紡
+            /// </summary>
+            public int ModeId;
+            /// <summary>
+            /// 琚挙闃茬殑妯″紡鍚嶇О
+            /// </summary>
+            public string ModeName;
+            /// <summary>
+            /// 鎾ら槻鎵�鐢ㄧ殑瀵嗙爜绫诲瀷锛�
+            ///<para>0锛氱敤鎴峰瘑鐮�</para>
+            ///<para>1锛氳儊杩瘑鐮�</para>
+            /// </summary>
+            public int PasswordType;
+
+        }
+        #endregion
+
+        #region 13鍒犻櫎甯冮槻妯″紡.
+        ///<summary >
+        /// 鍒犻櫎甯冮槻妯″紡锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        public static async System.Threading.Tasks.Task<RemoveModeResponseAllData> RemoveModeAsync(int modeId)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                RemoveModeResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new RemoveModeResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new RemoveModeResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new RemoveModeResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new RemoveModeResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/RemoveMode_Respon")
+                    {
+                        var removeModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveModeResponseData>(jobject["Data"].ToString());
+                        if (removeModeResponseData == null)
+                        {
+                            d = new RemoveModeResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                        }
+                        else
+                        {
+                            d = new RemoveModeResponseAllData { removeModeResponseData = removeModeResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/RemoveMode_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4014}
+                                };
+                    var data = new JObject
+                {
+                    { "ModeId", modeId}
+                 };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/RemoveMode", jObject.ToString());
+
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new RemoveModeResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/RemoveMode_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鍒犻櫎甯冮槻妯″紡杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public RemoveModeResponseAllData removeModeResponseAllData;
+        /// <summary>
+        /// 鍒犻櫎甯冮槻妯″紡杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class RemoveModeResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鍒犻櫎甯冮槻妯″紡杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public RemoveModeResponseData removeModeResponseData;
+
+        }
+
+
+        /// <summary>
+        /// 鍒犻櫎甯冮槻妯″紡杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public RemoveModeResponseData removeModeResponseData;
+        /// <summary>
+        /// 鍒犻櫎甯冮槻妯″紡杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class RemoveModeResponseData
+        {
+            /// <summary>
+            /// 0锛氬垹闄ゆ垚鍔熴��
+            ///<para>1锛氬け璐ワ紝涓嶅瓨鍦ㄨ甯冮槻妯″紡銆�</para>
+            ///<para>2锛氬垹闄ゅけ璐ワ紝涓嶅厑璁稿垹闄ゃ�傦紙褰揗odeId涓�1鎴�2鏃讹紝绂诲甯冮槻鍜屽湪瀹跺竷闃叉ā寮忎笉鍏佽鍒犻櫎锛�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 妯″紡id
+            /// </summary>
+            public int ModeId;
+            /// <summary>
+            /// 妯″紡鍚� (褰揜esult=0鏃跺瓨鍦�)銆�
+            /// </summary>
+            public string ModeName;
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+
+        }
+        #endregion
+
+        #region *14灏嗚澶囦粠闃插尯涓Щ闄�.
+        /// <summary>
+        /// *灏嗚澶囦粠闃插尯涓Щ闄わ紙闇�瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        /// <returns>The device to zone async.</returns>
+        /// <param name="removeEqToZoneData">灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁.</param>
+        public static async System.Threading.Tasks.Task<RemoveDeviceToZoneAllData> RemoveDeviceToZoneAsync(RemoveEqToZoneData removeEqToZoneData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                RemoveDeviceToZoneAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new RemoveDeviceToZoneAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new RemoveDeviceToZoneAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new RemoveDeviceToZoneAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        d = new RemoveDeviceToZoneAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/RemoveEqToZone_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var removeDeviceToZoneResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveDeviceToZoneResponseData>(jobject["Data"].ToString());
+                            if (removeDeviceToZoneResponseData != null)
+                            {
+                                d = new RemoveDeviceToZoneAllData { removeDeviceToZoneResponseData = removeDeviceToZoneResponseData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            }
+                        }
+                        else
+                        {
+                            d = new RemoveDeviceToZoneAllData { };
+                            var r = new RemoveDeviceToZoneResponseData();
+                            r.Result = result;
+                            d.removeDeviceToZoneResponseData = r;
+                            System.Console.WriteLine("宸叉敹鍒伴�氱煡杩斿洖");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/RemoveEqToZone_Actions鍚姩_{System.DateTime.Now.ToString()}");
+
+                try
+                {
+                    if (removeEqToZoneData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4016 } };
+                        var deviceList = new JArray { };
+                        foreach (var deviceInfo in removeEqToZoneData.RemoveDeviceList)
+                        {
+                            var dInfo = new JObject{
+                            { "MacAddr", deviceInfo.MacAddr},
+                            { "Epoint",deviceInfo.Epoint}
+                             };
+                            deviceList.Add(dInfo);
+                        }
+                        var data = new JObject
+                    {
+                        { "ZoneId", removeEqToZoneData.ZoneId },
+                        { "RemoveDeviceList", deviceList},
+                        { "LoginToken", removeEqToZoneData.LoginToken}
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/RemoveEqToZone_Actions 鍚姩"), jObject.ToString());
+                    }
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new RemoveDeviceToZoneAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/RemoveEqToZone_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑杩斿洖鏁版嵁 ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public RemoveDeviceToZoneAllData removeDeviceToZoneAllData;
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑杩斿洖鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class RemoveDeviceToZoneAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑杩斿洖鏁版嵁
+            /// </summary>
+            public RemoveDeviceToZoneResponseData removeDeviceToZoneResponseData;
+        }
+
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑杩斿洖鏁版嵁
+        /// </summary>
+        public RemoveDeviceToZoneResponseData removeDeviceToZoneResponseData;
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑杩斿洖鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class RemoveDeviceToZoneResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// <para>1锛氭坊鍔犲け璐ャ�傦紙灞�閮ㄥ竷闃插垪琛╥d涓嶅瓨鍦級</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 瀹夐槻璁惧鍒楄〃(Result=0鏃跺瓨鍦�)
+            /// </summary>
+            public List<RemoveDeviceListResponseObj> RemoveDeviceList = new List<RemoveDeviceListResponseObj>();
+
+        }
+
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class RemoveDeviceListResponseObj
+        {
+            /// <summary>
+            /// 璁惧mac鍦板潃
+            /// </summary>
+            public string MacAddr;
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            /// </summary>
+            public int Epoint;
+            /// <summary>
+            /// 璁惧琚Щ闄ょ姸鎬�
+            /// </summary>
+            public int Status;
+        }
+
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        public RemoveEqToZoneData removeEqToZoneData;
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class RemoveEqToZoneData
+        {
+            /// <summary>
+            /// 灞�閮ㄨ闃插垪琛╥d
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 瀹夐槻璁惧鍒楄〃
+            /// </summary>
+            public List<RemoveDeviceListObj> RemoveDeviceList = new List<RemoveDeviceListObj>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+        }
+
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class RemoveDeviceListObj
+        {
+            /// <summary>
+            /// 璁惧mac鍦板潃
+            /// </summary>
+            public string MacAddr;
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            /// </summary>
+            public int Epoint;
+        }
+        #endregion
+
+        //#region 鑾峰彇闃插尯淇℃伅.
+        /////<summary >
+        ///// 鑾峰彇闃插尯淇℃伅.(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        ///// </summary>
+        //public static async System.Threading.Tasks.Task<GetZoneInfoResponAllData> GetZoneInfoAsync()
+        //{
+        //    return await System.Threading.Tasks.Task.Run(async () =>
+        //    {
+        //        var d = new GetZoneInfoResponAllData { };
+        //        if (ZbGateway.MainGateWay == null)
+        //        {
+        //            d.errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�";
+        //            return d;
+        //        }
+
+        //        Action<string, string> action = (topic, message) =>
+        //        {
+        //            var gatewayID = topic.Split('/')[0];
+        //            var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+        //            if (topic == gatewayID + "/" + "Error_Respon")
+        //            {
+        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.GwId };
+        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+        //                if (temp == null)
+        //                {
+        //                    d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+        //                }
+        //                else
+        //                {
+        //                    d.errorResponData = temp;
+        //                    d.errorMessageBase = ErrorMess(temp.Error);
+        //                }
+        //            }
+
+        //            if (topic == gatewayID + "/" + "Security/GetZoneInfo_Respon")
+        //            {
+        //                var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = ZbGateway.MainGateWay.CurrentGateWayId };
+        //                security.getZoneInfoResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetZoneInfoResponData>(jobject["Data"].ToString());
+        //                if (security.getZoneInfoResponData == null)
+        //                {
+        //                    d.errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�";
+        //                }
+        //                else
+        //                {
+        //                    d.getZoneInfoResponData = security.getZoneInfoResponData;
+        //                    System.Console.WriteLine($"鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+        //                }
+        //            }
+        //        };
+        //        ZbGateway.MainGateWay.Actions += action;
+        //        System.Console.WriteLine("Security/GetZoneInfo_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+        //        var jObject = new Newtonsoft.Json.Linq.JObject() {
+        //                            { "Cluster_ID", 0 },
+        //                            { "Command", 4017 }
+        //                        };
+        //        ZbGateway.MainGateWay?.Send("Security/GetZoneInfo", jObject.ToString());
+
+        //        var dateTime = DateTime.Now;
+        //        while ((DateTime.Now - dateTime).TotalMilliseconds < 1000)
+        //        {
+        //            await System.Threading.Tasks.Task.Delay(10);
+        //            if (d.getZoneInfoResponData != null)
+        //            {
+        //                break;
+        //            }
+        //        }
+        //        if ((DateTime.Now - dateTime).TotalMilliseconds > 10000)
+        //        {
+        //            d.errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔";
+        //        }
+        //        ZbGateway.MainGateWay.Actions -= action;
+        //        System.Console.WriteLine("Security/GetZoneInfo_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+        //        return d;
+        //    });
+        //}
+
+        ///// <summary>
+        ///// 鑾峰彇闃插尯淇℃伅杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        ///// </summary>
+        //public GetZoneInfoResponAllData getZoneInfoResponAllData;
+        ///// <summary>
+        ///// 鑾峰彇闃插尯淇℃伅杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        ///// </summary>
+        //[System.Serializable]
+        //public class GetZoneInfoResponAllData
+        //{
+        //    /// <summary>
+        //    /// 閿欒淇℃伅
+        //    /// </summary>
+        //    public string errorMessageBase;
+        //    /// <summary>
+        //    /// 缃戝叧淇℃伅閿欒鍙嶉
+        //    /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para>
+        //    /// </summary>
+        //    public ErrorResponData errorResponData;
+        //    /// <summary>
+        //    /// 鑾峰彇闃插尯淇℃伅杩斿洖鐨勬暟鎹�
+        //    /// </summary>
+        //    public GetZoneInfoResponData getZoneInfoResponData;
+
+        //}
+
+        ///// <summary>
+        ///// 鑾峰彇闃插尯淇℃伅杩斿洖鐨勬暟鎹�
+        ///// </summary>
+        //public GetZoneInfoResponData getZoneInfoResponData;
+        ///// <summary>
+        ///// 鑾峰彇闃插尯淇℃伅杩斿洖鐨勬暟鎹�
+        ///// </summary>
+        //[System.Serializable]
+        //public class GetZoneInfoResponData
+        //{
+        //    /// <summary>
+        //    /// 闃插尯鎬绘暟
+        //    /// </summary>
+        //    public int ZoneNum;
+
+        //    /// <summary>
+        //    /// 闃插尯淇℃伅鍒楄〃
+        //    /// </summary>
+        //    public List<ZoneInfoListData> ZoneList = new List<ZoneInfoListData>();
+        //}
+        ///// <summary>
+        ///// 闃插尯淇℃伅鍒楄〃鏁版嵁
+        ///// </summary>
+        //public class ZoneInfoListData
+        //{
+        //    /// <summary>
+        //    ///灞�閮ㄨ闃插垪琛╥d
+        //    /// </summary>
+        //    public int ZoneId;
+
+        //    /// <summary>
+        //    /// 甯冮槻闃插尯鍚嶇О 锛屾渶澶�32涓瓧绗�
+        //    /// </summary>
+        //    public string ZoneName;
+
+        //    /// <summary>
+        //    /// 闃插尯绫诲瀷:
+        //    ///<para>1锛�24灏忔椂闃插尯銆�</para>
+        //    ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+        //    ///<para>3锛氬嚭鍏ラ槻鍖恒��</para>
+        //    ///<para>4锛氬唴閮ㄩ槻鍖恒��</para>
+        //    ///<para>5锛氳窡闅忛槻鍖恒��</para>
+        //    ///<para>6锛氬懆鐣岄槻鍖恒��</para>
+        //    ///<para>7锛氬懆鐣屽欢鏃堕槻鍖恒��</para>
+        //    /// </summary>
+        //    public int ZoneType;
+
+        //    /// <summary>
+        //    /// 鏄惁鍏佽鏃佽矾
+        //    ///<para>0锛氫笉鍏佽鏃佽矾</para>
+        //    ///<para>1锛氬厑璁告梺璺�</para>
+        //    ///<para>鑻ョ被鍨嬩负24灏忔椂闃插尯鎴�24灏忔椂闈欓煶闃插尯灏嗕笉鍏佽鏃佽矾锛岃瀛楁灏嗚蹇界暐銆�</para>
+        //    /// </summary>
+        //    public int Bypass;
+
+        //    /// <summary>
+        //    /// 鏄惁鍏佽寮规�ф梺璺細
+        //    ///<para>0锛氫笉鍏佽寮规�ф梺璺�</para>
+        //    ///<para>1锛氬厑璁稿脊鎬ф梺璺�</para>
+        //    ///<para>鑻ョ被鍨嬩负24灏忔椂闃插尯鎴�24灏忔椂闈欓煶闃插尯灏嗕笉鍏佽寮规�ф梺璺紝璇ュ瓧娈靛皢琚拷鐣ャ��</para>
+        //    /// </summary>
+        //    public int ElasticBypass;
+        //}
+        //#endregion
+
+        #region 15閫氳繃闃插尯ID鏌ョ湅闃插尯璁惧鍒楄〃.锛�
+        ///<summary >
+        /// 閫氳繃闃插尯ID鏌ョ湅闃插尯璁惧鍒楄〃.(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        /// <para>zoneId:甯冮槻妯″紡id</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<GetZoneDeviceListByIdResponAllData> getZoneDeviceListByIdAsync(int zoneId)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                GetZoneDeviceListByIdResponAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new GetZoneDeviceListByIdResponAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new GetZoneDeviceListByIdResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new GetZoneDeviceListByIdResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+                    if (topic == gatewayID + "/" + "Security/GetZoneDeviceListById_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var getZoneDeviceListByIdResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetZoneDeviceListByIdResponData>(jobject["Data"].ToString());
+                            if (getZoneDeviceListByIdResponData != null)
+                            {
+                                d = new GetZoneDeviceListByIdResponAllData { getZoneDeviceListByIdResponData = getZoneDeviceListByIdResponData };
+                            }
+                            System.Console.WriteLine($"UI宸叉敹鍒伴�氱煡鐨勪富棰榑{topic}");
+                        }
+                        else
+                        {
+                            d = new GetZoneDeviceListByIdResponAllData { };
+                            var r = new GetZoneDeviceListByIdResponData();
+                            r.Result = result;
+                            d.getZoneDeviceListByIdResponData = r;
+                            System.Console.WriteLine("宸叉敹鍒伴�氱煡杩斿洖");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/GetZoneDeviceListById_Actions 鍚姩" + System.DateTime.Now.ToString());
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4018 }
+                                };
+                    var data = new JObject { { "ZoneId", zoneId } };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/GetZoneDeviceListById", jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new GetZoneDeviceListByIdResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/GetZoneDeviceListById_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 閫氳繃闃插尯ID鏌ョ湅闃插尯璁惧鍒楄〃鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public GetZoneDeviceListByIdResponAllData getZoneDeviceListByIdResponAllData;
+        /// <summary>
+        /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class GetZoneDeviceListByIdResponAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 閫氳繃甯冮槻妯″紡ID鏌ョ湅妯″紡淇℃伅杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public GetZoneDeviceListByIdResponData getZoneDeviceListByIdResponData;
+        }
+
+        /// <summary>
+        /// 閫氳繃闃插尯ID鏌ョ湅闃插尯璁惧鍒楄〃杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public GetZoneDeviceListByIdResponData getZoneDeviceListByIdResponData;
+        /// <summary>
+        /// 閫氳繃闃插尯ID鏌ョ湅闃插尯璁惧鍒楄〃杩斿洖鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class GetZoneDeviceListByIdResponData
+        {
+            /// <summary>
+            /// 0锛氶粯璁�
+            ///<para>1锛氬け璐ワ紝甯冮槻妯″紡涓嶅瓨鍦�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 闃插尯id
+            ///<para>1锛�24灏忔椂闃插尯銆�</para>
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+            ///<para>3锛氬嚭鍏ラ槻鍖恒��</para>
+            ///<para>4锛氬唴閮ㄩ槻鍖恒��</para>
+            ///<para>5锛氬懆鐣岄槻鍖恒�倂
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 闃插尯鍚嶇О 锛屾渶澶�32涓瓧绗�
+            /// </summary>
+            public string ZoneName;
+
+            /// <summary>
+            /// 瀹夐槻璁惧鍒楄〃
+            ///<para> (Result=0鏃跺�兼湁鏁�)</para>
+            /// </summary>
+            public List<ZoneDeviceListData> DeviceList = new List<ZoneDeviceListData>();
+
+        }
+
+        /// <summary>
+        /// 閫氳繃闃插尯ID鏌ョ湅闃插尯璁惧鍒楄〃鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class ZoneDeviceListData
+        {
+            /// <summary>
+            /// 璁惧mac鍦板潃
+            /// </summary>
+            public string MacAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 璁惧涓婃姤鐨勭姸鎬佹槸鍚︿负鐬棿鐘舵�侊紝鐢ㄤ簬閰嶅悎涓嬮潰鐨凾riggerZoneStatus鍊间娇鐢ㄣ��
+            ///<pata>0锛氶潪鐬棿鐘舵�侊紝璇ヨ澶囦笂鎶ョ殑瀹夐槻鐘舵�佸彲鎸佺画锛岀洿鍒扮姸鎬佽鏀瑰彉浼氬啀娆℃姤鍛婂畨闃茬姸鎬佷俊鎭�傚闂ㄧ璁惧鐨勫紑鐘舵�佸拰鍏崇姸鎬侊紙寮�鍜屽叧鐘舵�佹槸鑳芥寔缁殑锛夈��</pata>
+            ///<pata>1锛氳〃绀哄畨闃茬姸鎬佷负鐬棿閲忥紝璁惧璀﹀憡婵�娲荤姸鎬佹墠涓婃姤瀹夐槻淇℃伅锛岃澶囨仮澶嶅父鎬佷笉鍙戦�侀�氱煡銆傚浜轰綋绾㈠浼犳劅鍣紙褰撴湁浜烘椂瑙﹀彂璀﹀憡锛屼絾浜鸿蛋浜嗗悗锛屼笉浼氬彂閫佹秷闄よ鍛婁俊鎭�傛棤娉曠煡閬撲汉杩樺湪涓嶅湪锛�</pata>
+            /// </summary>
+            public int MomentStatus;
+            /// <summary>
+            /// <pata>褰揗omentStatus涓�0鏃讹紝瀹夐槻璁惧琚Е鍙戜笂鎶ュ畨闃蹭俊鎭殑ZoneStatus鍊煎拰TriggerZoneStatus杩涜涓庤繍绠楋紙&锛夌粨鏋滀笉涓�0鏃舵縺娲婚槻鍖鸿鎶ワ紝涓�0鏃惰В闄ゆ縺娲汇�備緥濡傞棬纾佽澶囷紝濡傛灉鏈変汉寮�闂ㄥ叆渚靛皢婵�娲婚槻鍖烘姤璀︼紝鍙皢TriggerZoneStatus璁剧疆涓�17锛屽紑闂ㄦ椂涓婃姤鐨刏oneStatus鍊间负1锛岋紙17 & 1锛�>0锛屾鏃惰鏄庢湁鍏ヤ镜锛岄槻鍖哄皢琚縺娲伙紝鍙戦�佽鍛婁俊鎭埌瀹㈡埛绔拰鏈嶅姟鍣ㄥ苟鎵ц璁惧畾鐨勮鎴掑姩浣溿��</pata>
+            /// <pata>褰揗omentStatus涓�1鏃讹紝璇存槑瀹夐槻璁惧鐨勬縺娲荤姸鎬佸彧鏄灛闂寸殑锛屽彧鏈夊湪涓婃姤ZoneStatus鍊硷紙鍜孴riggerZoneStatus鐩镐笌涓嶄负0鏃讹級鐨勭灛闂存縺娲伙紝婵�娲诲悗灏嗙珛鍗宠嚜鍔ㄦ仮澶嶄负甯告�併��</pata>
+            /// <pata>璁剧疆甯冮槻鏃讹紝濡傛灉瀹夐槻璁惧琚Е鍙戯紝闃插尯澶勪簬璀﹀憡鐘舵�侊紝瑕佽В闄ゆ縺娲绘墠鑳藉竷闃叉垚鍔熴�傚鏋滀笂闈omentStatus涓�0锛屽垯闇�瑕佸畨闃茶澶囧啀娆′笂鎶ョ殑ZoneStatus鍊煎拰TriggerZoneStatus鍊艰繘琛屼笌杩愮畻缁撴灉涓�0鎵嶈兘瑙i櫎婵�娲荤姸鎬� 銆傚鏋淢omentStatus涓�1锛屽垯璇存槑璁惧宸茬粡鑷姩鎭㈠甯告�侊紝甯冮槻鍙互鎴愬姛銆�</pata>
+            /// <pata>濡傞棬纾佽澶囧叧闂ㄦ椂涓婃姤鐨刏oneStatus鍊间负32锛岋紙32&1锛�=0銆傚垯璇存槑闂ㄥ凡缁忓叧涓婏紝闃插尯婵�娲荤姸鎬佸皢瑙i櫎锛屽彲瀵归槻鍖鸿繘琛屽竷闃层�傚鏋淢omentStatus涓�1锛屽垯蹇界暐璇ヨ澶囩殑鏈�杩戣鍛婄姸鎬佽繘琛屽竷闃层��</pata>
+            /// </summary>
+            public int TriggerZoneStatus;
+
+            /// <summary>
+            /// 鏄惁鏃佽矾
+            ///<para>0锛氫笉鏃佽矾</para>
+            ///<para>1锛氭梺璺�</para>
+            /// </summary>
+            public int IsBypass = 999;
+        }
+
+        #endregion
+
+        #region 24*鎵ц瀹夐槻妯″紡鍔ㄤ綔.
+        /// <summary>
+        /// *鎵ц瀹夐槻妯″紡鍔ㄤ綔锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        ///<para>modeId:甯冮槻妯″紡ID</para>
+        ///<para>actionType:鍔ㄤ綔绫诲瀷</para>
+        ///<para>1锛氬竷闃叉垚鍔熸寚绀哄姩浣�</para>
+        ///<para>2锛氬竷闃插け璐ユ寚绀哄姩浣�</para>
+        ///<para>3锛氭挙闃叉垚鍔熸寚绀哄姩浣�</para>
+        ///<para>4锛氭挙闃插け璐ユ寚绀哄姩浣�</para>
+        ///<para>loginToken:鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��</para>
+        ///</summary> 
+        public static async System.Threading.Tasks.Task<ActionTestResponseAllData> ActionTestAsync(int modeId, int actionType, string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                ActionTestResponseAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new ActionTestResponseAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new ActionTestResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new ActionTestResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId };
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new ActionTestResponseAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/ActionTest_Respon")
+                    {
+                        var actionTestResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ActionTestResponseData>(jobject["Data"].ToString());
+                        if (actionTestResponseData != null)
+                        {
+                            d = new ActionTestResponseAllData { actionTestResponseData = actionTestResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+
+                        }
+                        else
+                        {
+                            d = new ActionTestResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
+                            System.Console.WriteLine($"鍥炲鏁版嵁涓虹┖");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine("Security/ActionTest_Actions 鍚姩" + System.DateTime.Now.ToString());
+
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4027}
+                                };
+                    var data = new JObject
+                    {
+                     { "ModeId", modeId  },
+                     { "ActionType", actionType},
+                     { "LoginToken", loginToken}
+                    };
+                    jObject.Add("Data", data);
+                    mainGateway.Send("Security/ActionTest", jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new ActionTestResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+                mainGateway.Actions -= action;
+                System.Console.WriteLine("Security/ActionTest_Actions 閫�鍑�" + System.DateTime.Now.ToString());
+
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鎵ц瀹夐槻妯″紡鍔ㄤ綔杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public ActionTestResponseAllData actionTestResponseAllData;
+        /// <summary>
+        /// 鎵ц瀹夐槻妯″紡鍔ㄤ綔杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class ActionTestResponseAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鎵ц瀹夐槻妯″紡鍔ㄤ綔杩斿洖鐨勬暟鎹�
+            /// </summary>
+            public ActionTestResponseData actionTestResponseData;
+
+        }
+
+        /// <summary>
+        /// 鎵ц瀹夐槻妯″紡鍔ㄤ綔杩斿洖鐨勬暟鎹�
+        /// </summary>
+        public ActionTestResponseData actionTestResponseData;
+        /// <summary>
+        /// 鎵ц瀹夐槻妯″紡鍔ㄤ綔杩斿洖鐨勬暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class ActionTestResponseData
+        {
+            /// <summary> 
+            /// 0锛氭垚鍔� 
+            ///<para>1锛氬け璐ワ紝瀹夐槻妯″紡涓嶅瓨鍦�</para>
+            /// </summary>
+            public int Result = 999;
+            /// <summary> 
+            /// 瀹夐槻妯″紡id
+            /// </summary>
+            public int ModeId;
+            /// <summary> 
+            /// 1锛氬竷闃叉垚鍔熸寚绀哄姩浣�
+            ///<para>2锛氬竷闃插け璐ユ寚绀哄姩浣溿��</para>
+            ///<para>3锛氭挙闃叉垚鍔熸寚绀哄姩浣溿��</para>
+            ///<para>4锛氭挙闃插け璐ユ寚绀哄姩浣�</para>
+            /// </summary>
+            public int ActionType;
+        }
+
+        /// <summary>
+        /// 鎵ц瀹夐槻妯″紡鍔ㄤ綔(浠呯敤浜庝富缃戝叧鎺ュ彛锛�
+        ///<para>modeId:甯冮槻妯″紡ID</para>
+        ///<para>actionType:鍔ㄤ綔绫诲瀷</para>
+        ///<para>1锛氬竷闃叉垚鍔熸寚绀哄姩浣�</para>
+        ///<para>2锛氬竷闃插け璐ユ寚绀哄姩浣�</para>
+        ///<para>3锛氭挙闃叉垚鍔熸寚绀哄姩浣�</para>
+        ///<para>4锛氭挙闃插け璐ユ寚绀哄姩浣�</para>
+        /// </summary> 
+        public static void ActionTest(int modeId, int actionType)
+        {
+            var mainGateway = ZbGateway.MainGateWay;
+            if (mainGateway == null)
+            {
+                return;
+            }
+
+            Action<string, string> action = (topic, message) => { };
+
+            mainGateway.Actions += action;
+            var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4027}
+                                };
+            var data = new JObject
+                    {
+                     { "ModeId", modeId  },
+                     { "ActionType", actionType}
+                    };
+            jObject.Add("Data", data);
+            mainGateway.Send("Security/ActionTest", jObject.ToString());
+            mainGateway.Actions -= action;
+        }
+        #endregion
+
+        #region 18闃插尯琚Е鍙戞椂鎶ュ憡
+        /// <summary>
+        /// 闃插尯琚Е鍙戞椂鎶ュ憡 
+        /// </summary> 
+        public ZoneTriggerReportData zoneTriggerReportData;
+        /// <summary>
+        /// 闃插尯琚Е鍙戞椂鎶ュ憡 
+        /// <para>甯冮槻妯″紡涓嬬殑闈炴梺璺槻鍖鸿瑙﹀彂鏃跺皢鍙嶉瑙﹀彂淇℃伅</para>
+        /// </summary> 
+        [System.Serializable]
+        public class ZoneTriggerReportData
+        {
+            /// <summary>
+            /// 闃插尯id 
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 鏄惁涓哄己杩瘑鐮佹挙闃茶Е鍙戦潤闊抽槻鍖�
+            ///<para>0锛氫笉鏄�</para>
+            ///<para>1锛氭槸</para>
+            /// </summary>
+            public int ForceToWithdraw;
+
+            /// <summary>
+            /// 瑙﹀彂璁惧鐨刴ac鍦板潃锛屽綋ForceToWithdraw涓�0鏃跺瓨鍦�
+            /// </summary>
+            public string MacAddr;
+
+            /// <summary>
+            /// 瑙﹀彂璁惧鐨勭鍙e彿锛屽綋ForceToWithdraw涓�0鏃跺瓨鍦�
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            ///瑙﹀彂璁惧涓婃姤鐨刏oneStatus鍊硷紝褰揊orceToWithdraw涓�0鏃跺瓨鍦�
+            /// </summary>
+            public int ZoneStatus;
+
+        }
+        #endregion
+
+        #region 19妯″紡瀹夐槻鍔ㄤ綔琚渶缁堟縺娲绘椂鍙戦�佹姤璀︿俊鎭�
+        /// <summary>
+        /// 闃插尯琚Е鍙戞椂鎶ュ憡 
+        /// </summary> 
+        public ModeTriggerReportData modeTriggerReportData;
+        /// <summary>
+        /// 妯″紡瀹夐槻鍔ㄤ綔琚渶缁堟縺娲绘椂鍙戦�佹姤璀︿俊鎭� 
+        /// <para>濡傚欢鏃堕槻鍖鸿瑙﹀彂寤舵椂杩囧悗杩樻病鎾ら槻銆佸懆鐣岄槻鍖鸿瑙﹀彂銆佸嚭鍏ラ槻鍖烘病瑙﹀彂鍗磋Е鍙戜簡鍐呴儴闃插尯绛夋儏鍐甸兘灏嗘縺娲绘ā寮忓畨闃插姩浣滐紝灏嗗彂閫佷互涓嬬粰璀︽姤銆�</para>
+        /// </summary> 
+        [System.Serializable]
+        public class ModeTriggerReportData
+        {
+            /// <summary>
+            /// 褰撳墠甯冮槻妯″紡id
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 鎶ヨ鏃舵渶鍚庤婵�娲荤殑闃插尯 
+            /// </summary>
+            public string ModeName;
+
+            /// <summary>
+            /// 鎶ヨ鏃舵渶鍚庤婵�娲荤殑闃插尯
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 鏄惁涓哄己杩瘑鐮佹挙闃茶Е鍙戦潤闊抽槻鍖�
+            ///<para>0锛氫笉鏄�</para>
+            ///<para>1锛氭槸</para>
+            /// </summary>
+            public int ForceToWithdraw;
+
+            /// <summary>
+            /// 鎶ヨ璁惧鐨刴ac鍦板潃(ForceToWithdraw涓�0鏃舵墠瀛樺湪)
+            /// </summary>
+            public string MacAddr;
+            /// <summary>
+            /// 鎶ヨ璁惧鐨勭鍙e彿(ForceToWithdraw涓�0鏃舵墠瀛樺湪)
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鎶ヨ璁惧鐨勫悕绉� (ForceToWithdraw涓�0鏃舵墠瀛樺湪)
+            /// </summary>
+            public string DeviceName;
+            /// <summary>
+            /// 鎶ヨ璁惧涓婃姤鐨刏oneStatus鍊�
+            /// </summary>
+            public int ZoneStatus;
+            /// <summary>
+            /// 淇℃伅鎺ㄩ�佺洰鏍� 
+            /// </summary>
+            public List<PushTargetInfo> PushTarget = new List<PushTargetInfo>();
+
+        }
+        #endregion
+
+        #region 25閫氳繃澶栭儴鏂瑰紡甯冮槻鎾ら槻鎴愬姛鏃舵姤鍛�
+        /// <summary>
+        /// 閫氳繃澶栭儴鏂瑰紡甯冮槻鎾ら槻鎴愬姛鏃舵姤鍛� 
+        /// </summary> 
+        public EnOrWithdrawSucceedReportData enOrWithdrawSucceedReportData;
+        /// <summary>
+        /// 閫氳繃澶栭儴鏂瑰紡甯冮槻鎾ら槻鎴愬姛鏃舵姤鍛� 
+        /// <para>褰撶敤鎴烽�氳繃澶栭儴鏂瑰紡锛堥潪app鎴栦簯绔搷浣滐紝濡傞�昏緫瑙﹀彂鎵ц鎾ら槻甯冮槻锛屾寜閿搷浣滃竷闃叉挙闃诧級杩涜甯冮槻鎾ら槻鎴愬姛</para>
+        /// </summary> 
+        [System.Serializable]
+        public class EnOrWithdrawSucceedReportData
+        {
+            /// <summary>
+            /// 0锛氬竷闃叉垚鍔�
+            ///<para>1锛氭挙闃叉垚鍔�</para>
+            /// </summary>
+            public int EnOrWithdraw;
+
+            /// <summary>
+            /// 瀹夐槻妯″紡id銆�
+            /// </summary>
+            public int ModeId;
+
+            /// <summary>
+            /// 澶栭儴甯冩挙闃叉柟寮忥細
+            ///<para>0锛氭墽琛岄�昏緫鍔ㄤ綔</para>
+            ///<para>1锛氭寜閿搷浣�</para>
+            /// </summary>
+            public int OperationWay;
+        }
+        #endregion
+
+        #region 26*瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾;
+        /// <summary>
+        /// *瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        /// <returns>The device to zone async.</returns>
+        /// <param name="removeEqToZoneData">灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁.</param>
+        public static async System.Threading.Tasks.Task<EqByPassAllData> EqByPassAllDataAsync(EqByPassData eqByPassData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                EqByPassAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new EqByPassAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new EqByPassAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new EqByPassAllData { errorMessageBase = ErrorMess(temp.Error), errorResponData = temp };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new EqByPassAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/EqByPass_Respon")
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        if (result == 0)
+                        {
+                            var eqByPassResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<EqByPassResponseData>(jobject["Data"].ToString());
+                            if (eqByPassResponseData != null)
+                            {
+                                d = new EqByPassAllData { eqByPassResponseData = eqByPassResponseData };
+                                System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            }
+                        }
+                        else
+                        {
+                            var r = new EqByPassResponseData();
+                            r.Result = result;
+                            d = new EqByPassAllData { eqByPassResponseData = r };
+
+                            System.Console.WriteLine("宸叉敹鍒伴�氱煡杩斿洖");
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/EqByPass_Actions鍚姩_{System.DateTime.Now.ToString()}");
+
+                try
+                {
+                    if (eqByPassData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4029 } };
+
+                        var data = new JObject
+                    {
+                        { "ZoneId", eqByPassData.ZoneId },
+                        { "MacAddr", eqByPassData.MacAddr },
+                        { "Epoint", eqByPassData.Epoint },
+                        { "IsByPass", eqByPassData.IsByPass},
+                        { "LoginToken", eqByPassData.LoginToken}
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/EqByPass"), jObject.ToString());
+                    }
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new EqByPassAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/EqByPass_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾鐨勮繑鍥炴暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public EqByPassAllData eqByPassAllData;
+        /// <summary>
+        /// 瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾鐨勮繑鍥炴暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class EqByPassAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾鐨勮繑鍥炴暟鎹�
+            /// </summary>
+            public EqByPassResponseData eqByPassResponseData;
+        }
+
+        /// <summary>
+        /// 瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        public EqByPassResponseData eqByPassResponseData;
+        /// <summary>
+        /// 瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class EqByPassResponseData
+        {
+            /// <summary>
+            /// 0锛氭垚鍔�
+            ///<para>1锛氬け璐ワ紝闃插尯涓嶅瓨鍦�</para>
+            ///<para>2锛氬け璐ワ紝璁惧涓嶅湪闃插尯涓�</para>
+            ///<para>3锛氬け璐ワ紝绯荤粺褰撳墠澶勪簬鎾ら槻鐘舵�併��</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 闃插尯id銆�
+            ///<para>1锛�24灏忔椂闃插尯銆�</para>
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+            ///<para>3锛氬嚭鍏ラ槻鍖恒��</para>
+            ///<para>4锛氬唴閮ㄩ槻鍖恒��</para>
+            ///<para>5锛氬懆鐣岄槻鍖恒��</para>
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 璁惧mac鍦板潃
+            /// </summary>
+            public string MacAddr;
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            /// </summary>
+            public int Epoint;
+            /// <summary>
+            /// 0锛氫笉鏃佽矾
+            ///<para>1锛氭梺璺澶�</para>
+            /// </summary>
+            public int IsByPass;
+
+        }
+
+        /// <summary>
+        /// 瀵归槻鍖哄畨闃茶澶囪繘琛屾梺璺垨鎾ら攢鏃佽矾鐨勬暟鎹�
+        /// </summary>
+        public EqByPassData eqByPassData;
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class EqByPassData
+        {
+            /// <summary>
+            /// 闃插尯id銆�
+            ///<para>1锛�24灏忔椂闃插尯銆�</para>
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+            ///<para>3锛氬嚭鍏ラ槻鍖恒��</para>
+            ///<para>4锛氬唴閮ㄩ槻鍖恒��</para>
+            ///<para>5锛氬懆鐣岄槻鍖恒��</para>
+            /// </summary>
+            public int ZoneId;
+
+            /// <summary>
+            /// 璁惧mac鍦板潃
+            /// </summary>
+            public string MacAddr;
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            /// </summary>
+            public int Epoint;
+            /// <summary>
+            /// 0锛氫笉鏃佽矾
+            ///<para>1锛氭梺璺澶�</para>
+            /// </summary>
+            public int IsByPass = 999;
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+        }
+        #endregion
+
+        #region 27*娣诲姞闃插尯鎶ヨ鐩爣;
+        /// <summary>
+        /// *娣诲姞闃插尯鎶ヨ鐩爣锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        public static async System.Threading.Tasks.Task<AddZoneActionAllData> AddZoneActionAsync(AddZoneActionData addZoneActionData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                AddZoneActionAllData d = null;
+
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new AddZoneActionAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new AddZoneActionAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new AddZoneActionAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new AddZoneActionAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AddZoneAction_Respon")
+                    {
+                        var addZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddZoneActionResponseData>(jobject["Data"].ToString());
+                        if (addZoneActionResponseData != null)
+                        {
+                            d = new AddZoneActionAllData { addZoneActionResponseData = addZoneActionResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new AddZoneActionAllData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/AddZoneAction_Actions鍚姩_{System.DateTime.Now.ToString()}");
+
+                try
+                {
+                    if (addZoneActionData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4030 } };
+                        var actionsList = new JArray { };
+                        foreach (var act in addZoneActionData.Actions)
+                        {
+                            if (act.Type == 0)
+                            {
+                                var taskList = new JArray { };
+                                foreach (var taskInfo in act.TaskList)
+                                {
+                                    var tInfo = new JObject{
+                            { "TaskType", taskInfo.TaskType},
+                            { "Data1", taskInfo.Data1},
+                            { "Data2",taskInfo.Data2}
+                            };
+                                    taskList.Add(tInfo);
+                                }
+
+                                var a = new JObject {
+                         { "Type",act.Type},
+                         { "DeviceAddr", act.DeviceAddr} ,
+                         { "Epoint",act.Epoint} ,
+                         { "TaskList", taskList}
+                            };
+                                actionsList.Add(a);
+                            }
+                            else if (act.Type == 1)
+                            {
+                                var b = new JObject {
+                         { "Type",act.Type},
+                         { "ScenesId", act.ScenesId}
+                         };
+                                actionsList.Add(b);
+                            }
+                        }
+                        var data = new JObject
+                    {
+                        { "ActionType", addZoneActionData.ActionType },
+                        { "Actions", actionsList},
+                        { "LoginToken", addZoneActionData.LoginToken}
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/AddZoneAction"), jObject.ToString());
+                    }
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new AddZoneActionAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/AddZoneAction_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public AddZoneActionAllData addZoneActionAllData;
+        /// <summary>
+        /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class AddZoneActionAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+            /// </summary>
+            public AddZoneActionResponseData addZoneActionResponseData;
+        }
+
+        /// <summary>
+        /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        public AddZoneActionResponseData addZoneActionResponseData;
+        /// <summary>
+        /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AddZoneActionResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// <para>1锛氬け璐ワ紝ActionType涓嶅瓨鍦�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔銆�
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔銆�</para>
+            ///<para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔銆�</para>
+            /// </summary>
+            public int ActionType;
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<AlarmActionResponseObj> Actions = new List<AlarmActionResponseObj>();
+
+        }
+
+        /// <summary>
+        /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AlarmActionResponseObj
+        {
+            /// <summary>
+            /// 0锛氭垚鍔�
+            ///<para>1锛氬け璐ワ紝璁惧鎴栧満鏅笉瀛樺湪</para>
+            /// </summary>
+            public string Status;
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            ///<para>2锛氫俊鎭帹閫�</para>
+            /// </summary>
+            public string Type;
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍙傛暟鍒楄〃銆傦紙褰揟ype=0鍜孲tatus = 0鏃跺瓨鍦級
+            /// </summary>
+            public List<TaskListInfo> TaskList = new List<TaskListInfo>();
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+            /// <summary>
+            /// 璁惧鎴栧満鏅悕绉帮紝Status = 0鏃跺瓨鍦�
+            /// </summary>
+            public string ESName;
+        }
+
+        /// <summary>
+        /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        public AddZoneActionData addZoneActionData;
+        /// <summary>
+        /// 灏嗚澶囦粠闃插尯涓Щ闄ょ殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class AddZoneActionData
+        {
+            /// <summary>
+            /// 1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔銆�
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔銆�</para>
+            ///<para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔銆�</para>
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<AlarmActionObj> Actions = new List<AlarmActionObj>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+
+        }
+
+        /// <summary>
+        /// 娣诲姞闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AlarmActionObj
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public int Type;
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍙傛暟鍒楄〃銆傦紙褰揟ype=0鍜孲tatus = 0鏃跺瓨鍦級
+            /// </summary>
+            public List<TaskListInfo> TaskList = new List<TaskListInfo>();
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+        }
+
+        #endregion
+
+        #region 28*鍒犻櫎闃插尯鎶ヨ鐩�;
+        /// <summary>
+        /// *鍒犻櫎闃插尯鎶ヨ鐩爣锛堥渶瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        public static async System.Threading.Tasks.Task<DelZoneActionResposeAllData> DelZoneActionAsync(DelZoneActionData delZoneActionData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                DelZoneActionResposeAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new DelZoneActionResposeAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new DelZoneActionResposeAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new DelZoneActionResposeAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new DelZoneActionResposeAllData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/DelZoneAction_Respon")
+                    {
+                        var delZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelZoneActionResponseData>(jobject["Data"].ToString());
+                        if (delZoneActionResponseData != null)
+                        {
+                            d = new DelZoneActionResposeAllData { delZoneActionResponseData = delZoneActionResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new DelZoneActionResposeAllData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/DelZoneAction_Actions鍚姩_{System.DateTime.Now.ToString()}");
+
+                try
+                {
+                    if (delZoneActionData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4031 } };
+                        var actionsList = new JArray { };
+                        foreach (var act in delZoneActionData.Actions)
+                        {
+                            if (act.Type == 0)
+                            {
+                                var a = new JObject {
+                         { "Type",act.Type},
+                         { "DeviceAddr", act.DeviceAddr} ,
+                         { "Epoint",act.Epoint}
+                            };
+                                actionsList.Add(a);
+                            }
+                            else if (act.Type == 1)
+                            {
+                                var b = new JObject {
+                         { "Type",act.Type},
+                         { "ScenesId", act.ScenesId}
+                         };
+                                actionsList.Add(b);
+                            }
+                        }
+                        var data = new JObject
+                    {
+                        { "ActionType", delZoneActionData.ActionType },
+                        { "Actions", actionsList},
+                        { "LoginToken", delZoneActionData.LoginToken}
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/DelZoneAction"), jObject.ToString());
+                    }
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new DelZoneActionResposeAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/DelZoneAction_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public DelZoneActionResposeAllData delZoneActionResposeAllData;
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class DelZoneActionResposeAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+            /// </summary>
+            public DelZoneActionResponseData delZoneActionResponseData;
+        }
+
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        public DelZoneActionResponseData delZoneActionResponseData;
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class DelZoneActionResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氭垚鍔�</para>
+            /// <para>1锛氬け璐ワ紝ActionType涓嶅瓨鍦�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔銆�
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔銆�</para>
+            ///<para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔銆�</para>
+            /// </summary>
+            public int ActionType;
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<DelAlarmActionResponseObj> Actions = new List<DelAlarmActionResponseObj>();
+
+        }
+
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class DelAlarmActionResponseObj
+        {
+            /// <summary>
+            /// 0锛氭垚鍔�
+            ///<para>1锛氬け璐ワ紝璁惧鎴栧満鏅笉瀛樺湪</para>
+            /// </summary>
+            public string Status;
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public string Type;
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+        }
+
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        public DelZoneActionData delZoneActionData;
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class DelZoneActionData
+        {
+            /// <summary>
+            /// 1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔銆�
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔銆�</para>
+            ///<para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔銆�</para>
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<DelAlarmActionObj> Actions = new List<DelAlarmActionObj>();
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+        }
+
+        /// <summary>
+        /// 鍒犻櫎闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class DelAlarmActionObj
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public int Type;
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+        }
+        #endregion
+
+        #region 29鏌ョ湅闃插尯鎶ヨ鐩爣;
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣
+        /// <para>1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔銆�</para>
+        /// <para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔銆�</para>
+        /// <para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔銆�</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<CatZoneActionResposeAllData> CatZoneActionAsync(int actionType)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                CatZoneActionResposeAllData d = null;
+                var mainGateWay = ZbGateway.MainGateWay;
+                if (mainGateWay == null)
+                {
+                    d = new CatZoneActionResposeAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new CatZoneActionResposeAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new CatZoneActionResposeAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/CatZoneAction_Respon")
+                    {
+                        var catZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatZoneActionResponseData>(jobject["Data"].ToString());
+                        if (catZoneActionResponseData != null)
+                        {
+                            d = new CatZoneActionResposeAllData { catZoneActionResponseData = catZoneActionResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new CatZoneActionResposeAllData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateWay.Actions += action;
+                System.Console.WriteLine($"Security/CatZoneAction_Actions鍚姩_{System.DateTime.Now.ToString()}");
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4032 }
+                                };
+                    var data = new JObject
+                    {
+                        { "ActionType", actionType }
+                };
+                    jObject.Add("Data", data);
+                    mainGateWay.Send("Security/CatZoneAction", jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new CatZoneActionResposeAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateWay.Actions -= action;
+                System.Console.WriteLine($"Security/CatZoneAction_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public CatZoneActionResposeAllData catZoneActionResposeAllData;
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class CatZoneActionResposeAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+            /// </summary>
+            public CatZoneActionResponseData catZoneActionResponseData;
+        }
+
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        public CatZoneActionResponseData catZoneActionResponseData;
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class CatZoneActionResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// <para>1锛氬け璐ワ紝ActionType涓嶅瓨鍦�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔銆�
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔銆�</para>
+            ///<para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔銆�</para>
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 鏄惁绂佺敤淇℃伅鎺ㄩ�侊細
+            ///<para>0锛氫笉绂佺敤</para>
+            ///<para>1锛氱鐢�</para>
+            ///<para>褰撻槻鍖虹殑淇℃伅鎺ㄩ�佽绂佺敤鏃讹紝闃插尯琚Е鍙戞椂涓嶄細鍙戦��18灏忚妭鐨勨�濋槻鍖鸿瑙﹀彂鏄姤鍛娾�濈殑涓婚淇℃伅銆�</para>
+            /// </summary>
+            public int IsDisablePushMessage = 999;
+
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<CatActionResponseObj> Actions = new List<CatActionResponseObj>();
+
+        }
+
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勬暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class CatActionResponseObj
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            ///<para>0锛氳妭鐐硅澶囧姩浣�</para>
+            ///<para>1锛氭墦寮�鍦烘櫙</para>
+            /// </summary>
+            public int Type;
+            /// <summary>
+            /// 璁惧mac鍦板潃 锛�
+            ///<para>褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public string DeviceAddr;
+
+            /// <summary>
+            /// 璁惧绔彛鍙�
+            ///<para>璁惧绔彛鍙� 鍜宮ac鍦板潃鍏卞悓鏍囪瘑鍞竴鐨剒igbee璁惧 鏁板�艰寖鍥�0-255銆� 褰揟ype=0鏃跺瓨鍦ㄣ��</para>
+            /// </summary>
+            public int Epoint;
+
+            /// <summary>
+            /// 鍔ㄤ綔鍙傛暟鍒楄〃銆傦紙褰揟ype=0鏃跺瓨鍦級
+            /// </summary>
+            public List<TaskListInfo> TaskList = new List<TaskListInfo>();
+
+
+            /// <summary>
+            /// 鍦烘櫙ID 銆傚綋Type=1鏃跺瓨鍦�
+            /// </summary>
+            public int ScenesId;
+
+            /// <summary>
+            /// 璁惧鎴栧満鏅悕绉�(褰揟ype=0 鎴朤ype=1鏃跺瓨鍦ㄣ��)
+            /// </summary>
+            public string ESName;
+        }
+
+        #endregion
+
+        #region 30*璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮�;
+        /// <summary>
+        /// *璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮侊紙闇�瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        public static async System.Threading.Tasks.Task<SetCoercePhoneNumberAllResponseData> SetCoercePhoneNumberAsync(SetCoercePhoneNumberData setCoercePhoneNumberData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                SetCoercePhoneNumberAllResponseData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new SetCoercePhoneNumberAllResponseData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new SetCoercePhoneNumberAllResponseData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new SetCoercePhoneNumberAllResponseData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new SetCoercePhoneNumberAllResponseData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AddZoneAction_Respon")
+                    {
+                        var setCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetCoercePhoneNumberResponseData>(jobject["Data"].ToString());
+                        if (setCoercePhoneNumberResponseData != null)
+                        {
+                            d = new SetCoercePhoneNumberAllResponseData { setCoercePhoneNumberResponseData = setCoercePhoneNumberResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new SetCoercePhoneNumberAllResponseData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/AddZoneAction(璁剧疆鑳佽揩鐘舵�佷笅鐨勭數璇濆彿鐮侊級_Actions鍚姩_{System.DateTime.Now.ToString()}");
+                try
+                {
+                    if (setCoercePhoneNumberData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4030 } };
+                        var actionsList = new JArray { };
+                        foreach (var act in setCoercePhoneNumberData.Actions)
+                        {
+                            if (act.Type == 2)
+                            {
+                                var pushTargetList = new JArray { };
+                                foreach (var pushInfo in act.PushTarget)
+                                {
+                                    var pInfo = new JObject{
+                            { "PushNumber", pushInfo.PushNumber}
+                            };
+                                    pushTargetList.Add(pInfo);
+                                }
+                                var c = new JObject {
+                         { "Type",act.Type},
+                         { "PushTarget", pushTargetList}
+                         };
+                                actionsList.Add(c);
+                            }
+                        }
+                        var data = new JObject
+                    {
+                        { "ActionType", 253},
+                        { "Actions", actionsList},
+                        { "LoginToken", setCoercePhoneNumberData.LoginToken}
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/AddZoneAction"), jObject.ToString());
+                    }
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new SetCoercePhoneNumberAllResponseData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/AddZoneAction(璁剧疆鑳佽揩鐘舵�佷笅鐨勭數璇濆彿鐮侊級_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// *璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑澶囨敞锛堥渶瑕佺鐞嗗憳鏉冮檺锛�. -2:涓荤綉鍏充涪澶�
+        /// </summary>
+        /// <param name="strPhone">鍦板尯鐮�-鑱旂郴鏂瑰紡</param>
+        /// <param name="strNote">澶囨敞,鏈�澶�63byte</param>
+        /// <returns></returns>
+        public static async System.Threading.Tasks.Task<SetCoercePhoneNumberResponseData> SetCoercePhoneNumberNoteAsync(string strPhone, string strNote)
+        {
+            SetCoercePhoneNumberResponseData d = null;
+            var mainGateway = ZbGateway.MainGateWay;
+            if (mainGateway == null)
+            {
+                d = new SetCoercePhoneNumberResponseData();
+                d.Result = -2;
+                return d;
+            }
+            Action<string, string> action = (topic, message) =>
+            {
+                var gatewayID = topic.Split('/')[0];
+                if (topic == gatewayID + "/" + "Security/AddPushNumberNote_Respon")
+                {
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+                    d = Newtonsoft.Json.JsonConvert.DeserializeObject<SetCoercePhoneNumberResponseData>(jobject["Data"].ToString());
+                }
+            };
+
+            mainGateway.Actions += action;
+            try
+            {
+                var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4038 } };
+                var data = new JObject
+                    {
+                        { "ActionType", 253},
+                        { "LoginToken", Shared.Phone.UserCenter.HdlSafeguardLogic.Current.GetLoginToken()},
+                        { "PushNumber", strPhone},
+                        { "PushNumberNote", strNote}
+                    };
+                jObject.Add("Data", data);
+                mainGateway.Send("Security/AddPushNumberNote", jObject.ToString());
+            }
+            catch { }
+
+            int timeOut = 0;
+            while (timeOut <= 60)
+            {
+                await System.Threading.Tasks.Task.Delay(50);
+                if (d != null)
+                {
+                    break;
+                }
+                timeOut++;
+            }
+
+            mainGateway.Actions -= action;
+            return d;
+        }
+
+
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁 ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public SetCoercePhoneNumberAllResponseData setCoercePhoneNumberAllResponseData;
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class SetCoercePhoneNumberAllResponseData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+            /// </summary>
+            public SetCoercePhoneNumberResponseData setCoercePhoneNumberResponseData;
+        }
+
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+        /// </summary>
+        public SetCoercePhoneNumberResponseData setCoercePhoneNumberResponseData;
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class SetCoercePhoneNumberResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 绫诲瀷
+            /// </summary>
+            public int ActionType;
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<PushTargetActionResponseObj> Actions = new List<PushTargetActionResponseObj>();
+
+        }
+
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class PushTargetActionResponseObj
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷 
+            ///<para>2锛氫俊鎭帹閫�</para>
+            /// </summary>
+            public string Type;
+
+            /// <summary>
+            /// 淇℃伅鎺ㄩ�佺洰鏍�,褰揟ype=2鏃跺瓨鍦ㄣ��
+            /// </summary>
+            public List<PushTargetInfo> PushTarget = new List<PushTargetInfo>();
+        }
+
+        /// <summary>
+        /// 浠诲姟鍒楄〃涓殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class PushTargetInfo
+        {
+            /// <summary>
+            /// 鎺ㄩ�佷俊鎭殑鐩爣鎵嬫満鍙风爜
+            ///</summary>
+            public string PushNumber;
+            /// <summary>
+            /// 澶囨敞淇℃伅
+            /// </summary>
+            public string PushNumberNote;
+        }
+
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑鏁版嵁
+        /// </summary>
+        public SetCoercePhoneNumberData setCoercePhoneNumberData;
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class SetCoercePhoneNumberData
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑鏁版嵁
+            /// </summary>
+            //public int ActionType = 253;
+
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<PushTargetActionObj> Actions = new List<PushTargetActionObj>();
+
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+
+        }
+
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class PushTargetActionObj
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷 
+            ///<para>2锛氫俊鎭帹閫�</para>
+            /// </summary>
+            public int Type;
+
+            /// <summary>
+            /// 淇℃伅鎺ㄩ�佺洰鏍�,褰揟ype=2鏃跺瓨鍦ㄣ��
+            /// </summary>
+            public List<PushTargetInfo> PushTarget = new List<PushTargetInfo>();
+        }
+        #endregion
+
+        #region 31*鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮侊紱
+        /// <summary>
+        /// *鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮侊紙闇�瑕佺鐞嗗憳鏉冮檺锛�.
+        /// </summary>
+        public static async System.Threading.Tasks.Task<DelCoercePhoneNumberAllResponseData> DelCoercePhoneNumberAsync(DelCoercePhoneNumberData delCoercePhoneNumberData)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                DelCoercePhoneNumberAllResponseData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new DelCoercePhoneNumberAllResponseData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new DelCoercePhoneNumberAllResponseData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new DelCoercePhoneNumberAllResponseData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                        d = new DelCoercePhoneNumberAllResponseData { };
+                        if (temp == null)
+                        {
+                            d.errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖";
+                        }
+                        else
+                        {
+                            if (temp.Error == 1)
+                            {
+                                d.errorMessageBase = "缃戝叧涓嶆槸涓荤綉鍏筹紝鏃犳硶杩涜璇ユ搷浣溿��";
+                            }
+                            else if (temp.Error == 2)
+                            {
+                                d.errorMessageBase = "璇ユ搷浣滈渶瑕佸畨闃茬鐞嗗憳鏉冮檺锛岄渶鍏堜互绠$悊鍛樿韩浠借繘琛岀櫥闄嗐��";
+
+                            }
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                            d.errorResponData = temp;
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/DelZoneAction_Respon")
+                    {
+                        var delCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelCoercePhoneNumberResponseData>(jobject["Data"].ToString());
+                        if (delCoercePhoneNumberResponseData != null)
+                        {
+                            d = new DelCoercePhoneNumberAllResponseData { delCoercePhoneNumberResponseData = delCoercePhoneNumberResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new DelCoercePhoneNumberAllResponseData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/AddZoneAction(鍒犻櫎鑳佽揩鐘舵�佷笅鐨勭數璇濆彿鐮侊級_Actions鍚姩_{System.DateTime.Now.ToString()}");
+                try
+                {
+                    if (delCoercePhoneNumberData != null)
+                    {
+                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4031 } };
+                        var actionsList = new JArray { };
+                        foreach (var act in delCoercePhoneNumberData.Actions)
+                        {
+                            if (act.Type == 2)
+                            {
+                                var pushTargetList = new JArray { };
+                                foreach (var pushInfo in act.PushTarget)
+                                {
+                                    var pInfo = new JObject{
+                            { "PushNumber", pushInfo.PushNumber}
+                            };
+                                    pushTargetList.Add(pInfo);
+                                }
+                                var c = new JObject {
+                         { "Type",act.Type},
+                         { "PushTarget", pushTargetList}
+                         };
+                                actionsList.Add(c);
+                            }
+                        }
+                        var data = new JObject
+                    {
+                        { "ActionType", 253},
+                        { "Actions", actionsList},
+                        { "LoginToken", delCoercePhoneNumberData.LoginToken}
+                    };
+                        jObject.Add("Data", data);
+                        mainGateway.Send(("Security/DelZoneAction"), jObject.ToString());
+                    }
+                }
+                catch { }
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new DelCoercePhoneNumberAllResponseData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/AddZoneAction(鍒犻櫎鑳佽揩鐘舵�佷笅鐨勭數璇濆彿鐮侊級_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁 ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public DelCoercePhoneNumberAllResponseData delCoercePhoneNumberAllResponseData;
+        /// <summary>
+        /// 鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class DelCoercePhoneNumberAllResponseData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+            /// </summary>
+            public DelCoercePhoneNumberResponseData delCoercePhoneNumberResponseData;
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+        /// </summary>
+        public DelCoercePhoneNumberResponseData delCoercePhoneNumberResponseData;
+        /// <summary>
+        /// 鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class DelCoercePhoneNumberResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 绫诲瀷
+            /// </summary>
+            public int ActionType;
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<PushTargetActionResponseObj> Actions = new List<PushTargetActionResponseObj>();
+
+        }
+        /// <summary>
+        /// 鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑鏁版嵁
+        /// </summary>
+        public DelCoercePhoneNumberData delCoercePhoneNumberData;
+        /// <summary>
+        /// 鍒犻櫎鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class DelCoercePhoneNumberData
+        {
+            /// <summary>
+            /// 鍔ㄤ綔绫诲瀷
+            /// </summary>
+            //public int ActionType = 253;
+
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<PushTargetActionObj> Actions = new List<PushTargetActionObj>();
+
+            /// <summary>
+            /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��
+            /// </summary>
+            public string LoginToken;
+
+        }
+        #endregion
+
+        #region 32鏌ョ湅鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯讳汉;
+        /// <summary>
+        /// 鏌ョ湅鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮�
+        /// </summary>
+        public static async System.Threading.Tasks.Task<CheckCoercePhoneNumberAllResponseData> CheckCoercePhoneNumberAsync(int actionType = 253)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                CheckCoercePhoneNumberAllResponseData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new CheckCoercePhoneNumberAllResponseData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new CheckCoercePhoneNumberAllResponseData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new CheckCoercePhoneNumberAllResponseData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/CatZoneAction_Respon")
+                    {
+                        var checkCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CheckCoercePhoneNumberResponseData>(jobject["Data"].ToString());
+                        if (checkCoercePhoneNumberResponseData != null)
+                        {
+                            d = new CheckCoercePhoneNumberAllResponseData { checkCoercePhoneNumberResponseData = checkCoercePhoneNumberResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new CheckCoercePhoneNumberAllResponseData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/CatZoneAction(鏌ョ湅鑳佽揩鐘舵�佷笅鐨勭數璇濆彿鐮侊級_Actions鍚姩_{System.DateTime.Now.ToString()}");
+                try
+                {
+                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4032 } };
+                    var actionsList = new JArray { };
+                    var data = new JObject
+                    {
+                        { "ActionType", actionType }
+                };
+                    jObject.Add("Data", data);
+                    mainGateway.Send(("Security/CatZoneAction"), jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new CheckCoercePhoneNumberAllResponseData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/CatZoneAction(鏌ョ湅鑳佽揩鐘舵�佷笅鐨勭數璇濆彿鐮侊級_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏌ョ湅鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁 ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public CheckCoercePhoneNumberAllResponseData checkCoercePhoneNumberAllResponseData;
+        /// <summary>
+        /// 鏌ョ湅鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class CheckCoercePhoneNumberAllResponseData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鏌ョ湅鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+            /// </summary>
+            public CheckCoercePhoneNumberResponseData checkCoercePhoneNumberResponseData;
+        }
+
+        /// <summary>
+        /// 鏌ョ湅鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+        /// </summary>
+        public CheckCoercePhoneNumberResponseData checkCoercePhoneNumberResponseData;
+        /// <summary>
+        /// 鏌ョ湅鑳佽揩鐘舵�佷笅琚�氱煡鐨勮仈绯诲彿鐮佺殑杩斿洖鏁版嵁
+        /// </summary>
+        [System.Serializable]
+        public class CheckCoercePhoneNumberResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氶粯璁�</para>
+            /// <para>1锛氬け璐ワ紝ActionType涓嶅瓨鍦�</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 绫诲瀷
+            /// </summary>
+            public int ActionType;
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<PushTargetActionResponseObj> Actions = new List<PushTargetActionResponseObj>();
+
+        }
+
+        #endregion
+
+        #region 33鑳佽揩瀵嗙爜鎾ら槻鏃剁煭淇℃帹閫�;
+        /// <summary>
+        /// 鑳佽揩瀵嗙爜鎾ら槻鏃剁煭淇℃帹閫� 
+        /// <para>褰撲娇鐢ㄨ儊杩瘑鐮佹挙闃叉椂锛岀綉鍏冲皢鍙戦�佽淇℃伅鍒颁簯绔�傦紙浠呭悜浜戠鍙戦�侊級</para>
+        /// </summary> 
+        public CoercedPWDWithdrawReportData coercedPWDWithdrawReportData;
+        /// <summary>
+        /// 鑳佽揩瀵嗙爜鎾ら槻鏃剁煭淇℃帹閫�
+        /// <para>褰撶敤鎴烽�氳繃澶栭儴鏂瑰紡锛堥潪app鎴栦簯绔搷浣滐紝濡傞�昏緫瑙﹀彂鎵ц鎾ら槻甯冮槻锛屾寜閿搷浣滃竷闃叉挙闃诧級杩涜甯冮槻鎾ら槻鎴愬姛</para>
+        /// </summary> 
+        [System.Serializable]
+        public class CoercedPWDWithdrawReportData
+        {
+            /// <summary>
+            /// 253锛氳儊杩瘑鐮佹挙闃茶Е鍙戞帹閫佺煭淇�
+            /// </summary>
+            public int ActionType;
+
+            /// <summary>
+            /// 鎶ヨ鐩爣鍒楄〃
+            /// </summary>
+            public List<PushTargetActionResponseObj> Actions = new List<PushTargetActionResponseObj>();
+
+        }
+        #endregion
+
+        #region 34绂佺敤鎴栧惎鐢ㄩ槻鍖鸿瑙﹀彂鏃朵俊鎭帹閫�.
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣
+        /// <para>ZoneType:闃插尯ID銆�</para>
+        /// <para>1锛�24灏忔椂闃插尯銆�</para>
+        ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+        ///<para>3锛氬叾浠栭槻鍖�</para>       
+        /// <para>isDisablePushMessage:鏄惁绂佺敤闃插尯琚Е鍙戞椂淇℃伅鎺ㄩ��</para>
+        ///<para>0锛氫笉绂佺敤</para> 
+        ///<para>1锛氱鐢�</para>          
+        /// </summary>
+        public static async System.Threading.Tasks.Task<DisablePushMessageResposeAllData> DisablePushMessageAsync(int zoneType, int isDisablePushMessage)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                DisablePushMessageResposeAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new DisablePushMessageResposeAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new DisablePushMessageResposeAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new DisablePushMessageResposeAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/DisablePushMessage_Respon")
+                    {
+                        var disablePushMessageResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DisablePushMessageResponseData>(jobject["Data"].ToString());
+                        if (disablePushMessageResponseData != null)
+                        {
+                            d = new DisablePushMessageResposeAllData { disablePushMessageResponseData = disablePushMessageResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new DisablePushMessageResposeAllData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/DisablePushMessage_Actions鍚姩_{System.DateTime.Now.ToString()}");
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4034 }
+                                };
+                    var data = new JObject
+                    {
+                        { "ZoneType", zoneType },
+                     { "IsDisablePushMessage", isDisablePushMessage }
+                };
+                    jObject.Add("Data", data);
+                    mainGateway.Send(("Security/DisablePushMessage"), jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new DisablePushMessageResposeAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/DisablePushMessage_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public DisablePushMessageResposeAllData disablePushMessageResposeAllData;
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class DisablePushMessageResposeAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+            /// </summary>
+            public DisablePushMessageResponseData disablePushMessageResponseData;
+        }
+
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        public DisablePushMessageResponseData disablePushMessageResponseData;
+        /// <summary>
+        /// 鏌ョ湅闃插尯鎶ヨ鐩爣鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class DisablePushMessageResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氭甯�</para>
+            /// <para>1锛氶槻鍖轰笉瀛樺湪</para>
+            /// </summary>
+            public int Result = 999;
+
+            /// <summary>
+            /// 闃插尯ID
+            /// <para>1锛�24灏忔椂闃插尯銆�</para>
+            ///<para>2锛�24灏忔椂闈欓煶闃插尯銆�</para>
+            ///<para>鍏跺畠闃插尯銆�</para> 
+            /// </summary>
+            public int ZoneType;
+            /// <summary>
+            /// 鏄惁绂佺敤闃插尯琚Е鍙戞椂淇℃伅鎺ㄩ��
+            ///<para>0锛氫笉绂佺敤</para> 
+            ///<para>1锛氱鐢�</para>            
+            /// </summary>
+            public int IsDisablePushMessage;
+
+        }
+        #endregion
+
+        #region 35 閫�鍑虹鐞嗗憳鐧婚檰(app閫氳繃璇ユ寚浠ゅ皢閫�鍑虹鐞嗗憳鐧婚檰锛屽師鏉ョ殑鈥淟oginToken鈥濆瓧娈靛皢澶辨晥銆�)
+        /// <summary>
+        /// 閫�鍑虹鐞嗗憳鐧婚檰(app閫氳繃璇ユ寚浠ゅ皢閫�鍑虹鐞嗗憳鐧婚檰锛屽師鏉ョ殑鈥淟oginToken鈥濆瓧娈靛皢澶辨晥銆�)
+        ///<para>loginToken: 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇��</para>
+        /// </summary>
+        public static async System.Threading.Tasks.Task<AdminLogOutResposeAllData> AdminLogOutAsync(string loginToken)
+        {
+            return await System.Threading.Tasks.Task.Run(async () =>
+            {
+                AdminLogOutResposeAllData d = null;
+                var mainGateway = ZbGateway.MainGateWay;
+                if (mainGateway == null)
+                {
+                    d = new AdminLogOutResposeAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" };
+                    return d;
+                }
+                Action<string, string> action = (topic, message) =>
+                {
+                    var gatewayID = topic.Split('/')[0];
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    if (topic == gatewayID + "/" + "Error_Respon")
+                    {
+                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+
+                        if (temp == null)
+                        {
+                            d = new AdminLogOutResposeAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" };
+                        }
+                        else
+                        {
+                            d = new AdminLogOutResposeAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
+                        }
+                    }
+
+                    if (topic == gatewayID + "/" + "Security/AdminLogOut_Respon")
+                    {
+                        var adminLogOutResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AdminLogOutResponseData>(jobject["Data"].ToString());
+                        if (adminLogOutResponseData != null)
+                        {
+                            d = new AdminLogOutResposeAllData { adminLogOutResponseData = adminLogOutResponseData };
+                            System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{topic}");
+                        }
+                        else
+                        {
+                            d = new AdminLogOutResposeAllData { errorMessageBase = "缃戝叧鍥炲鏁版嵁鏄┖" };
+                        }
+                    }
+                };
+                mainGateway.Actions += action;
+                System.Console.WriteLine($"Security/AdminLogOut_Actions鍚姩_{System.DateTime.Now.ToString()}");
+                try
+                {
+                    var jObject = new Newtonsoft.Json.Linq.JObject() {
+                                    { "Cluster_ID", 0 },
+                                    { "Command", 4035 }
+                                };
+                    var data = new JObject
+                    {
+                        { "LoginToken", loginToken }
+                    };
+                    jObject.Add("Data", data);
+                    mainGateway.Send(("Security/AdminLogOut"), jObject.ToString());
+                }
+                catch { }
+
+                var dateTime = DateTime.Now;
+                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
+                {
+                    await System.Threading.Tasks.Task.Delay(10);
+                    if (d != null)
+                    {
+                        break;
+                    }
+                }
+                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                {
+                    d = new AdminLogOutResposeAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
+                }
+
+                mainGateway.Actions -= action;
+                System.Console.WriteLine($"Security/AdminLogOut_Actions 閫�鍑篲{System.DateTime.Now.ToString()}");
+                return d;
+            });
+        }
+
+        /// <summary>
+        /// 閫�鍑虹鐞嗗憳鐧婚檰鐨勮繑鍥炴暟鎹� ,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        public DisablePushMessageResposeAllData adminLogOutResposeAllData;
+        /// <summary>
+        /// 閫�鍑虹鐞嗗憳鐧婚檰鐨勮繑鍥炴暟鎹�,缃戝叧鍙嶉淇℃伅
+        /// </summary>
+        [System.Serializable]
+        public class AdminLogOutResposeAllData : CommonDevice.ErrorResponCommon
+        {
+            /// <summary>
+            /// 閫�鍑虹鐞嗗憳鐧婚檰鐨勮繑鍥炴暟鎹�
+            /// </summary>
+            public AdminLogOutResponseData adminLogOutResponseData;
+        }
+
+        /// <summary>
+        /// 閫�鍑虹鐞嗗憳鐧婚檰鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        public AdminLogOutResponseData adminLogOutResponseData;
+        /// <summary>
+        /// 閫�鍑虹鐞嗗憳鐧婚檰鐨勮繑鍥炴暟鎹�
+        /// </summary>
+        [System.Serializable]
+        public class AdminLogOutResponseData
+        {
+            /// <summary>
+            /// 杩斿洖缁撴灉
+            /// <para>0锛氭垚鍔�</para>
+            /// <para>1锛氶敊璇紝涓嶅瓨鍦ㄨ鈥淟oginToken鈥濄��</para>
+            /// </summary>
+            public int Result = -1;
+        }
+        #endregion
+    }
+}

--
Gitblit v1.8.0