黄学彪
2020-05-11 2e7e5f9af5b32cfe1fc3c6ba40bf7eb984bbd0a4
ZigbeeApp/Shared/Phone/ZigBee/Device/Safeguard.cs
@@ -23,7 +23,7 @@
        /// </summary>
        public int Time;
         /// <summary>
        /// <summary>
        /// 等待从网关接收数据的时间
        /// </summary>
        /// <value>The wait receive data time.</value>
@@ -35,7 +35,8 @@
                if (mainGateway == null)
                {
                    return 3000;
                }else if (mainGateway.IsVirtual)
                }
                else if (mainGateway.IsVirtual)
                {
                    return 6000;
                }
@@ -47,31 +48,8 @@
        }
        /// <summary>
        /// 网关信息错误反馈
        /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
        /// </summary>
        ErrorResponData errResponData;
        /// <summary>
        /// 网关信息错误反馈
        /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
        /// </summary>
        [System.Serializable]
        public class ErrorResponData
        {
            /// <summary>
            /// Error参数含义
            ///<para>1:网关无法解析命令数据。</para>
            ///<para>2:协调器正在升级或备份/恢复数据
            ///<para>3:操作设备/组/场景不存在</para>
            ///<para>4:其他错误</para>
            ///<para>5:数据传输错误(在某次客户端向网关发送数据的过程中,网关在合理时间范围内接收客户端数据不完整导致该错误发生。如客户端向网关一次发送100个字节的数据,但网关等待接收了一秒只接收了80个字节。发生该错误,网关将主动关闭客户端连接)</para>
            /// </summary>
            public int Error;
        }
        /// <summary>
        /// 网关信息错误反馈内容
         /// </summary>
        /// </summary>
        static string ErrorMess(int err)
        {
            string message = "";
@@ -126,8 +104,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -135,28 +112,27 @@
                        }
                        else
                        {
                            d = new AdminLoginResponAllData { errorResponData = temp , errorMessageBase = ErrorMess(temp.Error) };
                            d = new AdminLoginResponAllData { 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.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new AdminLoginResponAllData { };
                        if (temp == null)
                        {
                            d .errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                            if (temp.Error == 1)
                            {
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。" ;
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
                            }
                            else if (temp.Error == 2)
                            {
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。" ;
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
@@ -164,7 +140,6 @@
                    if (topic == gatewayID + "/" + "Security/AdminLogin_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (tempData == null)
                        {
@@ -182,10 +157,10 @@
                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 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 },
@@ -195,12 +170,12 @@
                    jObject.Add("Data", data);
                    mainGateway.Send("Security/AdminLogin", jObject.ToString());
                }
                catch{}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
                    await System.Threading.Tasks.Task.Delay(10);
                    if (d!= null)
                    if (d != null)
                    {
                        break;
                    }
@@ -224,17 +199,8 @@
        /// 管理员密码登陆返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class AdminLoginResponAllData
        public class AdminLoginResponAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 返回结果Result
            /// <para>0:登陆成功</para>
@@ -277,12 +243,11 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
                             d = new ChangeAdminPasswordResponseAllData { errorMessageBase = "网关错误回复,且数据是空" };
                            d = new ChangeAdminPasswordResponseAllData { errorMessageBase = "网关错误回复,且数据是空" };
                        }
                        else
                        {
@@ -292,14 +257,13 @@
                    if (topic == gatewayID + "/" + "Security/ChangeAdminPassword_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.changeAdminPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ChangeAdminPasswordResponseData>(jobject["Data"].ToString());
                            if (security.changeAdminPasswordResponseData != null)
                            var changeAdminPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ChangeAdminPasswordResponseData>(jobject["Data"].ToString());
                            if (changeAdminPasswordResponseData != null)
                            {
                                d = new ChangeAdminPasswordResponseAllData { changeAdminPasswordResponseData = security.changeAdminPasswordResponseData };
                                d = new ChangeAdminPasswordResponseAllData { changeAdminPasswordResponseData = changeAdminPasswordResponseData };
                                System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            }
                        }
@@ -324,7 +288,8 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/ChangeAdminPassword_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4023}
@@ -338,7 +303,7 @@
                    mainGateway.Send("Security/ChangeAdminPassword", jObject.ToString());
                }
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -367,17 +332,8 @@
        /// 修改管理员密码返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class ChangeAdminPasswordResponseAllData
        public class ChangeAdminPasswordResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 修改管理员密码返回的数据
            /// </summary>
@@ -435,8 +391,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -450,29 +405,29 @@
                    if (topic == gatewayID + "/" + "Security/CatDelayTime_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.catDelayTimeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatDelayTimeResponseData>(jobject["Data"].ToString());
                        if (security.catDelayTimeResponseData == null)
                        var catDelayTimeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatDelayTimeResponseData>(jobject["Data"].ToString());
                        if (catDelayTimeResponseData == null)
                        {
                            d = new CatDelayTimeResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new CatDelayTimeResponseAllData { catDelayTimeResponseData = security.catDelayTimeResponseData };
                            d = new CatDelayTimeResponseAllData { catDelayTimeResponseData = catDelayTimeResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                    }
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/CatDelayTime_Actions 启动" + System.DateTime.Now.ToString());
                 try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4019}
                                };
                    mainGateway.Send("Security/CatDelayTime", jObject.ToString());
                }
                catch{}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -501,24 +456,15 @@
        /// 查看延时时间返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class CatDelayTimeResponseAllData
        public class CatDelayTimeResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 查看延时时间返回的数据
            /// </summary>
            public CatDelayTimeResponseData catDelayTimeResponseData;
        }
        /// <summary>
        /// 查看延时时间返回的数据
        /// </summary>
@@ -548,7 +494,7 @@
        /// <para>goOutDelayTime:外出延时时间,单位秒范围:0-65535</para>
        /// <para>loginToken:登陆标识,最大32个字符。由app自动生成的唯一标识。如果登陆成功,网关将记录该标识,app需要管理员权限的指令都应该带有该标识,网关会根据该标识来判断是否为管理员操作,如果标识错误,将返回“Security/Error_Respon”主题数据。 。</para>
        /// </summary>
        public static async System.Threading.Tasks.Task<SetDelayTimeResponseAllData> SetDelayTimeAsync(int entranceDelayTime,int goOutDelayTime,string loginToken)
        public static async System.Threading.Tasks.Task<SetDelayTimeResponseAllData> SetDelayTimeAsync(int entranceDelayTime, int goOutDelayTime, string loginToken)
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
@@ -567,8 +513,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -583,15 +528,15 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new SetDelayTimeResponseAllData { };
                        if (temp == null)
                        {
                            d .errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                            d .errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                            if (temp.Error == 1)
                            {
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
@@ -601,41 +546,42 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/SetDelayTime_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.setDelayTimeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetDelayTimeResponseData>(jobject["Data"].ToString());
                        if (security.setDelayTimeResponseData == null)
                        var setDelayTimeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetDelayTimeResponseData>(jobject["Data"].ToString());
                        if (setDelayTimeResponseData == null)
                        {
                            d = new SetDelayTimeResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new SetDelayTimeResponseAllData { setDelayTimeResponseData = security.setDelayTimeResponseData };
                            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() {
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4020}
                                };
                var data = new JObject
                    var data = new JObject
                    {
                    { "EntranceDelayTime", entranceDelayTime},
                    { "GoOutDelayTime", goOutDelayTime},
                    { "LoginToken", loginToken}
                };
                jObject.Add("Data", data);
                mainGateway.Send("Security/SetDelayTime", jObject.ToString());
                }catch { }
                    jObject.Add("Data", data);
                    mainGateway.Send("Security/SetDelayTime", jObject.ToString());
                }
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -664,17 +610,8 @@
        /// 设置延时时间返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class SetDelayTimeResponseAllData
        public class SetDelayTimeResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 设置延时时间返回的数据
            /// </summary>
@@ -714,7 +651,7 @@
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
                CatUserPasswordResponseAllData d =null;
                CatUserPasswordResponseAllData d = null;
                var mainGateway = ZbGateway.MainGateWay;
                if (mainGateway == null)
                {
@@ -729,8 +666,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -744,17 +680,16 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new CatUserPasswordResponseAllData { };
                        if (temp == null)
                        {
                            d .errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                             if (temp.Error == 1)
                            if (temp.Error == 1)
                            {
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
                            }
@@ -763,41 +698,42 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/CatUserPassword_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.catUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatUserPasswordResponseData>(jobject["Data"].ToString());
                        if (security.catUserPasswordResponseData == null)
                        var catUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatUserPasswordResponseData>(jobject["Data"].ToString());
                        if (catUserPasswordResponseData == null)
                        {
                            d = new CatUserPasswordResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new CatUserPasswordResponseAllData { catUserPasswordResponseData = security.catUserPasswordResponseData };
                            d = new CatUserPasswordResponseAllData { catUserPasswordResponseData = catUserPasswordResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                    }
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/CatUserPassword_Actions 启动" + System.DateTime.Now.ToString());
                try{
                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 {
                 }
                    mainGateway.Send("Security/CatUserPassword", jObject.ToString());
                }
                catch
                {
                }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -826,17 +762,8 @@
        /// 查看用户密码和胁迫密码返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class CatUserPasswordResponseAllData
        public class CatUserPasswordResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 查看用户密码和胁迫密码返回的数据
            /// </summary>
@@ -912,8 +839,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -928,11 +854,11 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new SetUserPasswordResponseAllData { };
                        if (temp == null)
                        {
                            d .errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
@@ -945,20 +871,19 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/SetUserPassword_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.setUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetUserPasswordResponseData>(jobject["Data"].ToString());
                            if (security.setUserPasswordResponseData != null)
                            var setUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetUserPasswordResponseData>(jobject["Data"].ToString());
                            if (setUserPasswordResponseData != null)
                            {
                                d = new SetUserPasswordResponseAllData { setUserPasswordResponseData = security.setUserPasswordResponseData };
                                d = new SetUserPasswordResponseAllData { setUserPasswordResponseData = setUserPasswordResponseData };
                                System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            }
@@ -975,7 +900,8 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/SetUserPassword_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4025}
@@ -990,8 +916,9 @@
                    jObject.Add("Data", data);
                    mainGateway.Send("Security/SetUserPassword", jObject.ToString());
                }
                catch{
                }
                catch
                {
                }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -1039,8 +966,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -1055,7 +981,7 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new SetUserPasswordResponseAllData { };
                        if (temp == null)
                        {
@@ -1077,14 +1003,13 @@
                    if (topic == gatewayID + "/" + "Security/AddPassWordTips_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.setUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetUserPasswordResponseData>(jobject["Data"].ToString());
                            if (security.setUserPasswordResponseData != null)
                            var setUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetUserPasswordResponseData>(jobject["Data"].ToString());
                            if (setUserPasswordResponseData != null)
                            {
                                d = new SetUserPasswordResponseAllData { setUserPasswordResponseData = security.setUserPasswordResponseData };
                                d = new SetUserPasswordResponseAllData { setUserPasswordResponseData = setUserPasswordResponseData };
                            }
                        }
                        else
@@ -1143,17 +1068,8 @@
        /// 新增或重设用户密码返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class SetUserPasswordResponseAllData
        public class SetUserPasswordResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 修改管理员密码返回的数据
            /// </summary>
@@ -1198,7 +1114,7 @@
        /// 为0时,自动分配新的用户id。为5时,则修改胁迫密码。取值范围0-5。</para>
        /// <para>loginToken:登陆标识,最大32个字符。由app自动生成的唯一标识。与管理员登陆指令的“LoginToken”一致,否则将返回“Security/Error_Respon”错误。</para>
        /// </summary> 
        public static async System.Threading.Tasks.Task<DelUserPasswordResponseAllData> DelUserPasswordAsync(int userId,string loginToken)
        public static async System.Threading.Tasks.Task<DelUserPasswordResponseAllData> DelUserPasswordAsync(int userId, string loginToken)
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
@@ -1217,8 +1133,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -1231,16 +1146,15 @@
                    }
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new DelUserPasswordResponseAllData { };
                        if (temp == null)
                        {
                            d .errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                        {
                            if (temp.Error == 1)
                            {
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
@@ -1255,11 +1169,10 @@
                    }
                    if (topic == gatewayID + "/" + "Security/DelUserPassword_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.delUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelUserPasswordResponseData>(jobject["Data"].ToString());
                        if (security.delUserPasswordResponseData != null)
                        var delUserPasswordResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelUserPasswordResponseData>(jobject["Data"].ToString());
                        if (delUserPasswordResponseData != null)
                        {
                            d = new DelUserPasswordResponseAllData { delUserPasswordResponseData = security.delUserPasswordResponseData };
                            d = new DelUserPasswordResponseAllData { delUserPasswordResponseData = delUserPasswordResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
@@ -1273,7 +1186,8 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/DelUserPassword_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4026}
@@ -1286,7 +1200,7 @@
                    jObject.Add("Data", data);
                    mainGateway.Send("Security/DelUserPassword", jObject.ToString());
                }
                catch{}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -1315,17 +1229,8 @@
        /// 删除用户密码返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class DelUserPasswordResponseAllData
        public class DelUserPasswordResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 删除用户密码返回的数据
            /// </summary>
@@ -1381,7 +1286,7 @@
        //            if (topic == gatewayID + "/" + "Error_Respon")
        //            {
        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID };
        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
        //                if (temp == null)
        //                {
@@ -1607,67 +1512,67 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        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.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new AddDeviceToZoneResponseAllData { };
                        if (temp == null)
                        {
                             d.errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                            if (temp.Error == 1)
                            {
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。" ;
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
                            }
                            else if (temp.Error == 2)
                            {
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。" ;
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            d.errorResponData = temp ;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/AddEqToZone_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.addDeviceToZoneResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddDeviceToZoneResponseData>(jobject["Data"].ToString());
                            if(security.addDeviceToZoneResponseData!=null){
                                d = new AddDeviceToZoneResponseAllData { addDeviceToPartResponseData = security.addDeviceToZoneResponseData };
                              }
                             System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            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{
                try
                {
                    if (addDeviceToZoneData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4003 } };
@@ -1692,7 +1597,8 @@
                        mainGateway.Send(("Security/AddEqToZone_Actions 启动"), jObject.ToString());
                    }
                }
                catch {
                catch
                {
                }
                var dateTime = DateTime.Now;
@@ -1724,17 +1630,8 @@
        /// 设备加入防区的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class AddDeviceToZoneResponseAllData
        public class AddDeviceToZoneResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 设备加入防区的返回数据
            /// </summary>
@@ -1891,8 +1788,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -1907,7 +1803,7 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new AddNewModeResponseAllData { };
                        if (temp == null)
@@ -1932,17 +1828,16 @@
                    if (topic == gatewayID + "/" + "Security/AddNewMode_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.addNewModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddNewModeResponseData>(jobject["Data"].ToString());
                            if (security.addNewModeResponseData != null)
                            var addNewModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddNewModeResponseData>(jobject["Data"].ToString());
                            if (addNewModeResponseData != null)
                            {
                                d = new AddNewModeResponseAllData { addNewModeResponseData = security.addNewModeResponseData };
                                d = new AddNewModeResponseAllData { addNewModeResponseData = addNewModeResponseData };
                                System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                             }
                            }
                        }
                        else
                        {
@@ -1952,7 +1847,8 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/AddNewMode_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    if (addNewModeData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4004 } };
@@ -1967,7 +1863,7 @@
                        mainGateway.Send(("Security/AddNewMode"), jObject.ToString());
                    }
                }
                catch {}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -1977,9 +1873,9 @@
                        break;
                    }
                }
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime )
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new AddNewModeResponseAllData { errorMessageBase = " 回复超时,请重新操作" };
                    d = new AddNewModeResponseAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                mainGateway.Actions -= action;
@@ -1997,17 +1893,8 @@
        /// 新建或修改布防模式返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class AddNewModeResponseAllData
        public class AddNewModeResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            ///新建或修改布防模式返回的数据
            /// </summary>
@@ -2040,14 +1927,14 @@
            /// <summary>
            /// 布防模式名称 ,最大32个字符。
            /// </summary>
            public string ModeName;
            public string ModeName;
            /// <summary>
            /// 允许失能。
            ///<para>0:不允许失能。</para>
            ///<para>1:允许失能</para>
            /// </summary>
            public int AllowDisable;
            public int AllowDisable;
        }
        /// <summary>
@@ -2071,7 +1958,7 @@
            /// 布防模式名称 ,最大32个字符。
            ///<para>不需要修改可忽略该字段。</para>
            /// </summary>
            public string ModeName;
            public string ModeName;
            /// <summary>
            /// 允许失能。
@@ -2111,8 +1998,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2121,13 +2007,12 @@
                        else
                        {
                            d = new ZoneJoinModeResponseAllData { 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.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new ZoneJoinModeResponseAllData { };
                        if (temp == null)
@@ -2152,15 +2037,14 @@
                    if (topic == gatewayID + "/" + "Security/ZoneJoinMode_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        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)
                        {
                            security.zoneJoinModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZoneJoinModeResponseData>(jobject["Data"].ToString());
                            if (security.zoneJoinModeResponseData != null)
                            var zoneJoinModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZoneJoinModeResponseData>(jobject["Data"].ToString());
                            if (zoneJoinModeResponseData != null)
                            {
                                d = new ZoneJoinModeResponseAllData { zoneJoinModeResponseData = security.zoneJoinModeResponseData };
                                d = new ZoneJoinModeResponseAllData { zoneJoinModeResponseData = zoneJoinModeResponseData };
                                System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                            }
                        }
@@ -2177,7 +2061,8 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/ZoneJoinMode_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    if (zoneJoinModeData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4005 } };
@@ -2199,8 +2084,8 @@
                        mainGateway.Send(("Security/ZoneJoinMode"), jObject.ToString());
                    }
                }
                catch{}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -2230,17 +2115,8 @@
        /// 防区加入布防模式返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class ZoneJoinModeResponseAllData
        public class ZoneJoinModeResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            ///防区加入布防模式返回的数据
            /// </summary>
@@ -2288,7 +2164,7 @@
            ///<para>2:失败,防区已在模式中存在</para>
            ///<para>3:失败,防区为24小时(静音)防区类型。</para>
            /// </summary>
            public int Status=999;
            public int Status = 999;
            /// <summary>
            /// 防区ID
            /// </summary>
@@ -2357,8 +2233,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2372,8 +2247,7 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new RemoveZoneFromModeResponseAllData { };
                        if (temp == null)
@@ -2398,16 +2272,15 @@
                    if (topic == gatewayID + "/" + "Security/RemoveZoneFromMode_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        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)
                        {
                            security.removeZoneFromModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveZoneFromModeResponseData>(jobject["Data"].ToString());
                            if (security.removeZoneFromModeResponseData != null)
                            var removeZoneFromModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveZoneFromModeResponseData>(jobject["Data"].ToString());
                            if (removeZoneFromModeResponseData != null)
                            {
                                d = new RemoveZoneFromModeResponseAllData { removeZoneFromModeResponseData = security.removeZoneFromModeResponseData };
                                d = new RemoveZoneFromModeResponseAllData { removeZoneFromModeResponseData = removeZoneFromModeResponseData };
                                System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                            }
                        }
@@ -2423,7 +2296,8 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/RemoveZoneFromMode_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    if (removeZoneFromModeData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4006 } };
@@ -2476,17 +2350,8 @@
        /// 从布防模式中移除防区返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class RemoveZoneFromModeResponseAllData
        public class RemoveZoneFromModeResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            ///从布防模式中移除防区返回的数据
            /// </summary>
@@ -2589,8 +2454,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2604,8 +2468,7 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new AddModeActonResponAllData { };
                        if (temp == null)
@@ -2631,23 +2494,22 @@
                    if (topic == gatewayID + "/" + "Security/AddModeActon_Respon")
                    {
                        dateTime = DateTime.Now;
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        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)
                        {
                            security.addModeActonResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddModeActonResponData>(jobject["Data"].ToString());
                            if (security.addModeActonResponData != null)
                            var addModeActonResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddModeActonResponData>(jobject["Data"].ToString());
                            if (addModeActonResponData != null)
                            {
                                d = new AddModeActonResponAllData { addModeActonResponData = security.addModeActonResponData };
                                d = new AddModeActonResponAllData { addModeActonResponData = addModeActonResponData };
                                System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            }
                        }
                        else
                        {
                            d = new AddModeActonResponAllData {};
                            d = new AddModeActonResponAllData { };
                            var r = new AddModeActonResponData();
                            r.Result = result;
                            r.ModeId = modeId;
@@ -2658,53 +2520,54 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/AddModeActon_Actions 启动" + System.DateTime.Now.ToString());
                try{
                if (addModeActonData != null)
                try
                {
                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4007 } };
                    var acList = new JArray { };
                    foreach (var act in addModeActonData.Actions)
                    if (addModeActonData != null)
                    {
                        if (act.Type == 0)
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4007 } };
                        var acList = new JArray { };
                        foreach (var act in addModeActonData.Actions)
                        {
                            var taskList = new JArray { };
                            foreach (var taskInfo in act.TaskList)
                            if (act.Type == 0)
                            {
                                var tInfo = new JObject{
                                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);
                            }
                                    taskList.Add(tInfo);
                                }
                            var a = new JObject {
                                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 {
                                acList.Add(a);
                            }
                            else if (act.Type == 1)
                            {
                                var b = new JObject {
                         { "Type",act.Type},
                         { "ScenesId", act.ScenesId}
                         };
                            acList.Add(b);
                                acList.Add(b);
                            }
                        }
                    }
                    var data = new JObject {
                        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());
                }
                        jObject.Add("Data", data);
                        mainGateway.Send(("Security/AddModeActon"), jObject.ToString());
                    }
                }
                catch { }
@@ -2727,17 +2590,8 @@
        /// 安防模式触发动作添加的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class AddModeActonResponAllData
        public class AddModeActonResponAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 安防模式触发动作添加的数据
            /// </summary>
@@ -2758,7 +2612,7 @@
            /// 0:默认
            ///<para>1:失败,模式不存在。</para>
            /// </summary>
            public int Result=999;
            public int Result = 999;
            /// <summary>
            /// 要修改的布防模式ID。
@@ -2791,7 +2645,7 @@
            ///<para>0:成功</para>
            ///<para>1:失败,设备或场景不存在</para>
            /// </summary>
            public int Status=999;
            public int Status = 999;
            /// <summary>
            /// 动作类型
@@ -2848,7 +2702,7 @@
            ///<para>2:布防失败指示动作</para>
            ///<para>3:撤防成功指示动作</para>
            ///<para>4:撤防失败指示动作</para>
              /// </summary>
            /// </summary>
            public int ActionType;
            /// <summary>
@@ -2972,8 +2826,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2987,10 +2840,9 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new RemoveActionFromModeAllData {};
                        d = new RemoveActionFromModeAllData { };
                        if (temp == null)
                        {
                            d.errorMessageBase = "网关错误回复,且数据是空";
@@ -3006,32 +2858,32 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/RemoveActonFromMode_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.removeActonFromModeResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveActionFromModeResponData>(jobject["Data"].ToString());
                            if (security.removeActonFromModeResponData != null)
                            var removeActonFromModeResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveActionFromModeResponData>(jobject["Data"].ToString());
                            if (removeActonFromModeResponData != null)
                            {
                                d = new RemoveActionFromModeAllData { removeActonFromModeResponData = security.removeActonFromModeResponData };
                                 System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                                d = new RemoveActionFromModeAllData { removeActonFromModeResponData = removeActonFromModeResponData };
                                System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            }
                        }
                        else
                        {
                            d = new RemoveActionFromModeAllData { errorMessageBase = "网关返回的数据为空" };
                            d = new RemoveActionFromModeAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                    }
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/RemoveActonFromMode_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    if (removeActonFromModeData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4008 } };
@@ -3066,7 +2918,8 @@
                        mainGateway.Send(("Security/RemoveActonFromMode"), jObject.ToString());
                    }
                }
                catch{
                catch
                {
                }
@@ -3098,17 +2951,8 @@
        /// 将动作从布防模式中移除的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class RemoveActionFromModeAllData
        public class RemoveActionFromModeAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 将动作从布防模式中移除的回复数据
            /// </summary>
@@ -3158,7 +3002,7 @@
            ///<para>0:成功</para>
            ///<para>1:失败,设备或场景不存在</para>
            /// </summary>
            public int Status=999;
            public int Status = 999;
            /// <summary>
            /// 动作类型
@@ -3205,7 +3049,7 @@
            ///<para>2:布防失败指示动作</para>
            ///<para>3:撤防成功指示动作</para>
            ///<para>4:撤防失败指示动作</para>
              /// </summary>
            /// </summary>
            public int ActionType;
            /// <summary>
@@ -3270,8 +3114,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -3285,29 +3128,30 @@
                    if (topic == gatewayID + "/" + "Security/GetModeList_Repon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.getModeListData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetModeListData>(jobject["Data"].ToString());
                        if (security.getModeListData == null)
                        var getModeListData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetModeListData>(jobject["Data"].ToString());
                        if (getModeListData == null)
                        {
                            d = new GetModeListAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new GetModeListAllData { getModeListData = security.getModeListData };
                            d = new GetModeListAllData { getModeListData = getModeListData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                    }
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/GetModeList_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4009 }
                                };
                    mainGateway.Send("Security/GetModeList", jObject.ToString());
                }catch{ }
                }
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
@@ -3337,17 +3181,8 @@
        /// 获取布防模式列表返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class GetModeListAllData
        public class GetModeListAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 获取布防模式列表返回的数据
            /// </summary>
@@ -3389,14 +3224,14 @@
            /// 布防模式名称 ,最大32个字符
            /// </summary>
            public string ModeName;
            /// <summary>
            /// 允许失能。
            ///<para>0:不允许失能。</para>
            ///<para>1:允许失能</para>
            /// </summary>
            public string AllowDisable;
            /// <summary>
            /// 模式当前布撤防状态
            ///<para>0:撤防</para>
@@ -3417,7 +3252,7 @@
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
                GetModeInfoByIdResponAllData d =null;
                GetModeInfoByIdResponAllData d = null;
                var mainGateway = ZbGateway.MainGateWay;
                if (mainGateway == null)
                {
@@ -3432,8 +3267,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -3446,7 +3280,6 @@
                    }
                    if (topic == gatewayID + "/" + "Security/GetModeInfoById_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
@@ -3456,7 +3289,7 @@
                                d = new GetModeInfoByIdResponAllData { getModeInfoByIdResponData = getModeInfoByIdResponData };
                            }
                            System.Console.WriteLine("已收到通知返回");
                         }
                        }
                        else
                        {
                            d = new GetModeInfoByIdResponAllData { };
@@ -3469,7 +3302,8 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/GetModeInfoById_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4010 }
@@ -3478,8 +3312,8 @@
                    jObject.Add("Data", data);
                    mainGateway.Send("Security/GetModeInfoById", jObject.ToString());
                }
                catch {}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -3491,7 +3325,7 @@
                }
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new GetModeInfoByIdResponAllData { errorMessageBase = " 回复超时,请重新操作" };
                    d = new GetModeInfoByIdResponAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                mainGateway.Actions -= action;
                System.Console.WriteLine("Security/GetModeInfoById_Actions 退出" + System.DateTime.Now.ToString());
@@ -3508,17 +3342,8 @@
        /// 通过布防模式ID查看模式信息的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class GetModeInfoByIdResponAllData
        public class GetModeInfoByIdResponAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 通过布防模式ID查看模式信息返回的数据
            /// </summary>
@@ -3539,7 +3364,7 @@
            /// 0:默认
            ///<para>1:失败,布防模式不存在</para>
            /// </summary>
            public int Result=999;
            public int Result = 999;
            /// <summary>
            /// 布防模式ID
@@ -3550,7 +3375,7 @@
            /// 布防模式名称 ,最大32个字符
            ///<para> (Result=0时值有效)</para>
            /// </summary>
            public string ModeName;
            public string ModeName;
            /// <summary>
            /// 允许失能。
@@ -3558,7 +3383,7 @@
            ///<para>1:允许失能</para>
            ///<para> (Result=0时值有效)</para>
            /// </summary>
            public int AllowDisable = 100;
            public int AllowDisable = 100;
            /// <summary>
            /// 模式当前布撤防状态
@@ -3603,8 +3428,8 @@
            ///<para> (Result=0时值有效)</para>
            /// </summary>
            public List<ActionsInfo> WithdrawFailActions = new List<ActionsInfo>();
         }
        }
        /// <summary>
        /// 加入成功的防区列表的数据
@@ -3688,8 +3513,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -3703,7 +3527,6 @@
                    if (topic == gatewayID + "/" + "Security/GetModeUsing_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
@@ -3716,7 +3539,7 @@
                        }
                        else
                        {
                            d = new GetModeUsingResponseAllData {};
                            d = new GetModeUsingResponseAllData { };
                            var r = new GetModeUsingResponseData();
                            r.Result = result;
                            d.getModeUsingResponseData = r;
@@ -3726,15 +3549,16 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/GetModeUsing_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4011}
                                };
                    mainGateway.Send("Security/GetModeUsing", jObject.ToString());
                }
                catch {}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -3746,7 +3570,7 @@
                }
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new GetModeUsingResponseAllData { errorMessageBase = " 回复超时,请重新操作" };
                    d = new GetModeUsingResponseAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                mainGateway.Actions -= action;
                System.Console.WriteLine("Security/GetModeUsing_Actions 退出" + System.DateTime.Now.ToString());
@@ -3763,17 +3587,8 @@
        /// 查看当前正在使用的布防模式返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class GetModeUsingResponseAllData
        public class GetModeUsingResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 查看当前正在使用的布防模式返回的数据
            /// </summary>
@@ -3796,7 +3611,7 @@
            /// 0:默认
            /// <para>1:系统当前没有进行布防</para> 
            /// </summary>
            public int Result=999;
            public int Result = 999;
            /// <summary>
            /// 启用的布防模式id
@@ -3813,7 +3628,7 @@
            /// <para>3:失能一次,第一次被激活不警告不触发动作。</para>
            /// </summary>
            public int Setting;
        }
        #endregion
@@ -3828,7 +3643,7 @@
            {
                EnableModeResponAllData d = null;
                var mainGateway = ZbGateway.MainGateWay;
                 if (mainGateway == null)
                if (mainGateway == null)
                {
                    d = new EnableModeResponAllData { errorMessageBase = "当前没有主网关" };
                    return d;
@@ -3841,8 +3656,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -3855,17 +3669,16 @@
                    }
                    if (topic == gatewayID + "/" + "Security/EnableMode_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        var modeId = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["ModeId"].ToString());
                        security.enableModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<EnableModeResponseData>(jobject["Data"].ToString());
                        if (security.enableModeResponseData == null)
                        var enableModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<EnableModeResponseData>(jobject["Data"].ToString());
                        if (enableModeResponseData == null)
                        {
                            d = new EnableModeResponAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new EnableModeResponAllData { enableModeResponseData = security.enableModeResponseData };
                            d = new EnableModeResponAllData { enableModeResponseData = enableModeResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                    }
@@ -3873,7 +3686,8 @@
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/EnableMode_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    if (enableModeData != null)
                    {
                        var jObject = new Newtonsoft.Json.Linq.JObject() {
@@ -3892,7 +3706,7 @@
                        mainGateway.Send("Security/EnableMode", jObject.ToString());
                    }
                }
                catch{}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
@@ -3922,17 +3736,8 @@
        /// 布防返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class EnableModeResponAllData
        public class EnableModeResponAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 布防返回的数据
            /// </summary>
@@ -3957,7 +3762,7 @@
            ///<para>4:布防失败,有其他布防模式正在启用(只能使用一种布防模式,需将正在启用的布防模式撤防才能布防新模式)。</para>
            ///<para>5:失败,模式属性不允许失能(如果新建布防模式时,AllowDisable设置为0,则布防Setting值不能为2或3,否则将报告该错误)</para>
            /// </summary>
            public int Result=999;
            public int Result = 999;
            /// <summary>
            /// 启用的布防模式id
@@ -3974,7 +3779,7 @@
            /// <para>3:失能一次,第一次被激活不警告不触发动作。</para>
            /// </summary>
            public int Setting;
            /// <summary>
            ///当前正在启用的布防模式ID(当Result = 4时存在。)
            /// </summary>
@@ -4037,7 +3842,7 @@
            ///<para>1:检查</para>
            /// </summary>
            public int CheckIASStatus;
            /// <summary>
            ///用户密码,最大32个字符
            /// </summary>
@@ -4069,8 +3874,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -4084,15 +3888,14 @@
                    if (topic == gatewayID + "/" + "Security/WithdrawMode_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.withdrawModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<WithdrawModeResponseData>(jobject["Data"].ToString());
                        if (security.withdrawModeResponseData == null)
                        var withdrawModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<WithdrawModeResponseData>(jobject["Data"].ToString());
                        if (withdrawModeResponseData == null)
                        {
                            d = new WithdrawModeResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new WithdrawModeResponseAllData { withdrawModeResponseData = security.withdrawModeResponseData };
                            d = new WithdrawModeResponseAllData { withdrawModeResponseData = withdrawModeResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                    }
@@ -4100,7 +3903,8 @@
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/WithdrawMode_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4013}
@@ -4113,8 +3917,8 @@
                    mainGateway.Send("Security/WithdrawMode", jObject.ToString());
                }
                catch {}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -4143,23 +3947,14 @@
        /// 撤防返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class WithdrawModeResponseAllData
        public class WithdrawModeResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 撤防返回的数据
            /// </summary>
            public WithdrawModeResponseData withdrawModeResponseData;
        }
        }
        /// <summary>
        /// 撤防返回的数据
@@ -4177,7 +3972,7 @@
            ///<para>2:撤防失败,密码错误。</para>
            ///<para>3:撤防失败,模式不可撤防。(新建模式时,模式属性设为不可撤防则布防后将不能撤防)</para>
            /// </summary>
            public int Result=999;
            public int Result = 999;
            /// <summary>
            /// 被撤防的模式
@@ -4207,7 +4002,7 @@
            {
                RemoveModeResponseAllData d = null;
                var mainGateway = ZbGateway.MainGateWay;
                 if (mainGateway == null)
                if (mainGateway == null)
                {
                    d = new RemoveModeResponseAllData { errorMessageBase = "当前没有主网关" };
                    return d;
@@ -4220,8 +4015,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -4235,8 +4029,7 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new RemoveModeResponseAllData { };
                        if (temp == null)
                        {
@@ -4253,29 +4046,29 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/RemoveMode_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.removeModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveModeResponseData>(jobject["Data"].ToString());
                        if (security.removeModeResponseData == null)
                        var removeModeResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveModeResponseData>(jobject["Data"].ToString());
                        if (removeModeResponseData == null)
                        {
                            d = new RemoveModeResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new RemoveModeResponseAllData { removeModeResponseData = security.removeModeResponseData };
                             System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            d = new RemoveModeResponseAllData { removeModeResponseData = removeModeResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                    }
                };
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/RemoveMode_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4014}
@@ -4288,8 +4081,8 @@
                    mainGateway.Send("Security/RemoveMode", jObject.ToString());
                }
                catch {}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -4318,17 +4111,8 @@
        /// 删除布防模式返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class RemoveModeResponseAllData
        public class RemoveModeResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 删除布防模式返回的数据
            /// </summary>
@@ -4352,7 +4136,7 @@
            ///<para>1:失败,不存在该布防模式。</para>
            ///<para>2:删除失败,不允许删除。(当ModeId为1或2时,离家布防和在家布防模式不允许删除)</para>
            /// </summary>
            public int Result=999;
            public int Result = 999;
            /// <summary>
            /// 模式id
@@ -4365,152 +4149,6 @@
            /// <summary>
            /// 登陆标识,最大32个字符。由app自动生成的唯一标识。与管理员登陆指令的“LoginToken”一致,否则将返回“Security/Error_Respon”错误。
            /// </summary>
            public string LoginToken;

        }
        #endregion
        //#region 删除防区.
        /////<summary >
        ///// 删除防区.(仅用于主网关接口).
        ///// </summary>
        //public static async System.Threading.Tasks.Task<RemoveZoneResponseAllData> RemoveZoneAsync(int zoneId)
        //{
        //    return await System.Threading.Tasks.Task.Run(async () =>
        //    {
        //        var d = new RemoveZoneResponseAllData { };
        //        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.getGatewayBaseInfo.gwID };
        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
        //                if (temp == null)
        //                {
        //                    d.errorMessageBase = "网关错误回复,且数据是空";
        //                }
        //                else
        //                {
        //                    d.errorResponData = temp;
        //                    d.errorMessageBase = ErrorMess(temp.Error);
        //                }
        //            }
        //            if (topic == gatewayID + "/" + "Security/RemoveZone_Respon")
        //            {
        //                var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = ZbGateway.MainGateWay.CurrentGateWayId };
        //                var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
        //                if (result == 0)
        //                {
        //                    security.removeZoneResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveZoneResponseData>(jobject["Data"].ToString());
        //                    if (security.removeZoneResponseData != null)
        //                    {
        //                        d.removeZoneResponseData = security.removeZoneResponseData;
        //                        System.Console.WriteLine($"收到通知后的主题_{topic}");
        //                    }
        //                }
        //                else
        //                {
        //                    var r = new RemoveZoneResponseData();
        //                    r.Result = result;
        //                    d.removeZoneResponseData = r;
        //                    System.Console.WriteLine($"收到通知后的主题_{topic}");
        //                }
        //            }
        //        };
        //        ZbGateway.MainGateWay.Actions += action;
        //        System.Console.WriteLine("Security/RemoveZone_Actions 启动" + System.DateTime.Now.ToString());
        //        var jObject = new Newtonsoft.Json.Linq.JObject() {
        //                            { "Cluster_ID", 0 },
        //                            { "Command", 4015}
        //                        };
        //        var data = new JObject
        //        {
        //            { "ZoneId", zoneId}
        //         };
        //        jObject.Add("Data", data);
        //        ZbGateway.MainGateWay?.Send("Security/RemoveZone", jObject.ToString());
        //        var dateTime = DateTime.Now;
        //        while ((DateTime.Now - dateTime).TotalMilliseconds < 1000)
        //        {
        //            await System.Threading.Tasks.Task.Delay(10);
        //            if (d.removeZoneResponseData != null)
        //            {
        //                break;
        //            }
        //        }
        //        if ((DateTime.Now - dateTime).TotalMilliseconds > 10000)
        //        {
        //            d.errorMessageBase = " 回复超时,请重新操作";
        //        }
        //        ZbGateway.MainGateWay.Actions -= action;
        //        System.Console.WriteLine("Security/RemoveZone_Actions 退出" + System.DateTime.Now.ToString());
        //        return d;
        //    });
        //}
        ///// <summary>
        ///// 删除防区,网关反馈信息
        ///// </summary>
        //public RemoveZoneResponseAllData removeZoneResponseAllData;
        ///// <summary>
        ///// 删除防区,网关反馈信息
        ///// </summary>
        //[System.Serializable]
        //public class RemoveZoneResponseAllData
        //{
        //    /// <summary>
        //    /// 错误信息
        //    /// </summary>
        //    public string errorMessageBase;
        //    /// <summary>
        //    /// 网关信息错误反馈
        //    /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
        //    /// </summary>
        //    public ErrorResponData errorResponData;
        //    /// <summary>
        //    /// 删除防区返回的数据
        //    /// </summary>
        //    public RemoveZoneResponseData removeZoneResponseData;
        //}
        ///// <summary>
        ///// 删除防区返回的数据
        ///// </summary>
        //public RemoveZoneResponseData removeZoneResponseData;
        ///// <summary>
        ///// 删除防区返回的数据
        ///// </summary>
        //[System.Serializable]
        //public class RemoveZoneResponseData
        //{
        //    /// <summary>
        //    /// 0:删除成功。
        //    ///<para>1:失败,防区不存在。</para>
        //    /// </summary>
        //    public int Result = 999;
        //    /// <summary>
        //    /// 防区id
        //    /// </summary>
        //    public int ZoneId;
        //    /// <summary>
        //    /// 防区名称,当Result=0时存在。
        //    /// </summary>
        //    public string ZoneName;
        //}
        //#endregion
        #region *14将设备从防区中移除.
        /// <summary>
@@ -4536,8 +4174,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -4551,8 +4188,7 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new RemoveDeviceToZoneAllData { };
                        if (temp == null)
@@ -4570,20 +4206,19 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/RemoveEqToZone_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.removeDeviceToZoneResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveDeviceToZoneResponseData>(jobject["Data"].ToString());
                            if (security.removeDeviceToZoneResponseData != null)
                            var removeDeviceToZoneResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveDeviceToZoneResponseData>(jobject["Data"].ToString());
                            if (removeDeviceToZoneResponseData != null)
                            {
                                d = new RemoveDeviceToZoneAllData { removeDeviceToZoneResponseData = security.removeDeviceToZoneResponseData };
                                d = new RemoveDeviceToZoneAllData { removeDeviceToZoneResponseData = removeDeviceToZoneResponseData };
                                System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            }
                        }
@@ -4600,7 +4235,8 @@
                mainGateway.Actions += action;
                System.Console.WriteLine($"Security/RemoveEqToZone_Actions启动_{System.DateTime.Now.ToString()}");
                try{
                try
                {
                    if (removeEqToZoneData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4016 } };
@@ -4623,7 +4259,7 @@
                        mainGateway.Send(("Security/RemoveEqToZone_Actions 启动"), jObject.ToString());
                    }
                }
                catch{}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
@@ -4634,9 +4270,9 @@
                        break;
                    }
                }
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime )
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new RemoveDeviceToZoneAllData { errorMessageBase = " 回复超时,请重新操作" };
                    d = new RemoveDeviceToZoneAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                mainGateway.Actions -= action;
@@ -4653,17 +4289,8 @@
        /// 将设备从防区中移除的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class RemoveDeviceToZoneAllData
        public class RemoveDeviceToZoneAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 将设备从防区中移除的返回数据
            /// </summary>
@@ -4686,7 +4313,7 @@
            /// <para>1:添加失败。(局部布防列表id不存在)</para>
            /// </summary>
            public int Result = 999;
            /// <summary>
            /// 安防设备列表(Result=0时存在)
            /// </summary>
@@ -4776,7 +4403,7 @@
        //            if (topic == gatewayID + "/" + "Error_Respon")
        //            {
        //                var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID };
        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
        //                var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
        //                if (temp == null)
        //                {
@@ -4948,8 +4575,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -4962,14 +4588,13 @@
                    }
                    if (topic == gatewayID + "/" + "Security/GetZoneDeviceListById_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.getZoneDeviceListByIdResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetZoneDeviceListByIdResponData>(jobject["Data"].ToString());
                            if (security.getZoneDeviceListByIdResponData != null)
                            var getZoneDeviceListByIdResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetZoneDeviceListByIdResponData>(jobject["Data"].ToString());
                            if (getZoneDeviceListByIdResponData != null)
                            {
                                d = new GetZoneDeviceListByIdResponAllData { getZoneDeviceListByIdResponData = security.getZoneDeviceListByIdResponData };
                                d = new GetZoneDeviceListByIdResponAllData { getZoneDeviceListByIdResponData = getZoneDeviceListByIdResponData };
                            }
                            System.Console.WriteLine($"UI已收到通知的主题_{topic}");
                        }
@@ -4995,7 +4620,7 @@
                    jObject.Add("Data", data);
                    mainGateway.Send("Security/GetZoneDeviceListById", jObject.ToString());
                }
                catch { }
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
@@ -5008,7 +4633,7 @@
                }
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new GetZoneDeviceListByIdResponAllData { errorMessageBase = " 回复超时,请重新操作" };
                    d = new GetZoneDeviceListByIdResponAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                mainGateway.Actions -= action;
                System.Console.WriteLine("Security/GetZoneDeviceListById_Actions 退出" + System.DateTime.Now.ToString());
@@ -5025,17 +4650,8 @@
        /// 通过布防模式ID查看模式信息的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class GetZoneDeviceListByIdResponAllData
        public class GetZoneDeviceListByIdResponAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 通过布防模式ID查看模式信息返回的数据
            /// </summary>
@@ -5116,7 +4732,7 @@
            ///<para>0:不旁路</para>
            ///<para>1:旁路</para>
            /// </summary>
            public int IsBypass=999;
            public int IsBypass = 999;
        }
        #endregion
@@ -5132,7 +4748,7 @@
        ///<para>4:撤防失败指示动作</para>
        ///<para>loginToken:登陆标识,最大32个字符。由app自动生成的唯一标识。与管理员登陆指令的“LoginToken”一致,否则将返回“Security/Error_Respon”错误。</para>
        ///</summary> 
        public static async System.Threading.Tasks.Task<ActionTestResponseAllData> ActionTestAsync(int modeId, int actionType,string loginToken)
        public static async System.Threading.Tasks.Task<ActionTestResponseAllData> ActionTestAsync(int modeId, int actionType, string loginToken)
        {
            return await System.Threading.Tasks.Task.Run(async () =>
            {
@@ -5151,8 +4767,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -5161,13 +4776,13 @@
                        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.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new ActionTestResponseAllData { };
                        if (temp == null)
                        {
@@ -5184,17 +4799,16 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/ActionTest_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.actionTestResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ActionTestResponseData>(jobject["Data"].ToString());
                        if (security.actionTestResponseData != null)
                        var actionTestResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ActionTestResponseData>(jobject["Data"].ToString());
                        if (actionTestResponseData != null)
                        {
                            d = new ActionTestResponseAllData { actionTestResponseData = security.actionTestResponseData };
                            d = new ActionTestResponseAllData { actionTestResponseData = actionTestResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
@@ -5208,7 +4822,8 @@
                mainGateway.Actions += action;
                System.Console.WriteLine("Security/ActionTest_Actions 启动" + System.DateTime.Now.ToString());
                try{
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4027}
@@ -5222,8 +4837,8 @@
                    jObject.Add("Data", data);
                    mainGateway.Send("Security/ActionTest", jObject.ToString());
                }
                catch {}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -5252,17 +4867,8 @@
        /// 执行安防模式动作返回的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class ActionTestResponseAllData
        public class ActionTestResponseAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 执行安防模式动作返回的数据
            /// </summary>
@@ -5401,7 +5007,7 @@
            /// 报警时最后被激活的防区
            /// </summary>
            public int ZoneId;
            /// <summary>
            /// 是否为强迫密码撤防触发静音防区
            ///<para>0:不是</para>
@@ -5429,8 +5035,8 @@
            /// <summary>
            /// 信息推送目标 
            /// </summary>
            public List<PushTargetInfo> PushTarget=new List<PushTargetInfo>();
            public List<PushTargetInfo> PushTarget = new List<PushTargetInfo>();
        }
        #endregion
@@ -5490,23 +5096,21 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        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 };
                         }
                        {
                            d = new EqByPassAllData { errorMessageBase = ErrorMess(temp.Error), errorResponData = temp };
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new EqByPassAllData { };
                        if (temp == null)
                        {
@@ -5523,21 +5127,20 @@
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                             d.errorResponData = temp;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/EqByPass_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
                        if (result == 0)
                        {
                            security.eqByPassResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<EqByPassResponseData>(jobject["Data"].ToString());
                            if (security.eqByPassResponseData != null)
                            var eqByPassResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<EqByPassResponseData>(jobject["Data"].ToString());
                            if (eqByPassResponseData != null)
                            {
                                d = new EqByPassAllData { eqByPassResponseData = security.eqByPassResponseData };
                                 System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                                d = new EqByPassAllData { eqByPassResponseData = eqByPassResponseData };
                                System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            }
                        }
                        else
@@ -5545,7 +5148,7 @@
                            var r = new EqByPassResponseData();
                            r.Result = result;
                            d = new EqByPassAllData { eqByPassResponseData = r };
                            System.Console.WriteLine("已收到通知返回");
                        }
                    }
@@ -5553,7 +5156,8 @@
                mainGateway.Actions += action;
                System.Console.WriteLine($"Security/EqByPass_Actions启动_{System.DateTime.Now.ToString()}");
                try{
                try
                {
                    if (eqByPassData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4029 } };
@@ -5570,8 +5174,8 @@
                        mainGateway.Send(("Security/EqByPass"), jObject.ToString());
                    }
                }
                catch{}
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -5583,7 +5187,7 @@
                }
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new EqByPassAllData { errorMessageBase = " 回复超时,请重新操作" };
                    d = new EqByPassAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                mainGateway.Actions -= action;
@@ -5600,17 +5204,8 @@
        /// 对防区安防设备进行旁路或撤销旁路的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class EqByPassAllData
        public class EqByPassAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 对防区安防设备进行旁路或撤销旁路的返回数据
            /// </summary>
@@ -5659,7 +5254,7 @@
            /// </summary>
            public int IsByPass;
        }
        }
        /// <summary>
        /// 对防区安防设备进行旁路或撤销旁路的数据
@@ -5693,7 +5288,7 @@
            /// 0:不旁路
            ///<para>1:旁路设备</para>
            /// </summary>
            public int IsByPass=999;
            public int IsByPass = 999;
            /// <summary>
            /// 登陆标识,最大32个字符。由app自动生成的唯一标识。与管理员登陆指令的“LoginToken”一致,否则将返回“Security/Error_Respon”错误。
            /// </summary>
            public string LoginToken;
        }
        #endregion
@@ -5710,9 +5305,9 @@
                var mainGateway = ZbGateway.MainGateWay;
                if (mainGateway == null)
                {
                {
                    d = new AddZoneActionAllData { errorMessageBase = "当前没有主网关" };
                     return d;
                    return d;
                }
                Action<string, string> action = (topic, message) =>
                {
@@ -5721,8 +5316,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -5736,41 +5330,41 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new AddZoneActionAllData { };
                        if (temp == null)
                        {
                             d.errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                            if (temp.Error == 1)
                            {
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。" ;
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
                            }
                            else if (temp.Error == 2)
                            {
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。" ;
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            d.errorResponData = temp ;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/AddZoneAction_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.addZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddZoneActionResponseData>(jobject["Data"].ToString());
                        if (security.addZoneActionResponseData != null)
                        var addZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddZoneActionResponseData>(jobject["Data"].ToString());
                        if (addZoneActionResponseData != null)
                        {
                            d = new AddZoneActionAllData { addZoneActionResponseData = security.addZoneActionResponseData };
                             System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }else{
                            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()}");
@@ -5822,7 +5416,8 @@
                        jObject.Add("Data", data);
                        mainGateway.Send(("Security/AddZoneAction"), jObject.ToString());
                    }
                }catch{}
                }
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
@@ -5835,7 +5430,7 @@
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new AddZoneActionAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                mainGateway.Actions -= action;
@@ -5852,17 +5447,8 @@
        /// 添加防区报警目标的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class AddZoneActionAllData
        public class AddZoneActionAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 添加防区报警目标的返回数据
            /// </summary>
@@ -5941,8 +5527,8 @@
            /// <summary>
            /// 设备或场景名称,Status = 0时存在
            /// </summary>
            public string ESName;
         }
            public string ESName;
        }
        /// <summary>
        /// 添加防区报警目标的数据
@@ -6001,8 +5587,8 @@
            /// <summary>
            /// 场景ID 。当Type=1时存在
            /// </summary>
            public int ScenesId;
         }
            public int ScenesId;
        }
        #endregion
@@ -6028,8 +5614,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -6043,18 +5628,17 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new DelZoneActionResposeAllData { };
                        if (temp == null)
                        {
                             d.errorMessageBase = "网关错误回复,且数据是空";
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                            if (temp.Error == 1)
                            {
                                d .errorMessageBase = "网关不是主网关,无法进行该操作。" ;
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
                            }
                            else if (temp.Error == 2)
                            {
@@ -6068,11 +5652,10 @@
                    if (topic == gatewayID + "/" + "Security/DelZoneAction_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.delZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelZoneActionResponseData>(jobject["Data"].ToString());
                        if (security.delZoneActionResponseData != null)
                        var delZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelZoneActionResponseData>(jobject["Data"].ToString());
                        if (delZoneActionResponseData != null)
                        {
                            d = new DelZoneActionResposeAllData { delZoneActionResponseData = security.delZoneActionResponseData };
                            d = new DelZoneActionResposeAllData { delZoneActionResponseData = delZoneActionResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                        else
@@ -6119,7 +5702,8 @@
                        jObject.Add("Data", data);
                        mainGateway.Send(("Security/DelZoneAction"), jObject.ToString());
                    }
                }catch{}
                }
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
@@ -6149,17 +5733,8 @@
        /// 删除防区报警目标的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class DelZoneActionResposeAllData
        public class DelZoneActionResposeAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 删除防区报警目标的返回数据
            /// </summary>
@@ -6211,7 +5786,7 @@
            /// 动作类型
            ///<para>0:节点设备动作</para>
            ///<para>1:打开场景</para>
             /// </summary>
            /// </summary>
            public string Type;
            /// <summary>
            /// 设备mac地址 ,
@@ -6223,13 +5798,13 @@
            /// 设备端口号
            ///<para>设备端口号 和mac地址共同标识唯一的zigbee设备 数值范围0-255。 当Type=0时存在。</para>
            /// </summary>
            public int Epoint;
            public int Epoint;
            /// <summary>
            /// 场景ID 。当Type=1时存在
            /// </summary>
            public int ScenesId;
         }
            public int ScenesId;
        }
        /// <summary>
        /// 删除防区报警目标的数据
@@ -6277,13 +5852,13 @@
            /// 设备端口号
            ///<para>设备端口号 和mac地址共同标识唯一的zigbee设备 数值范围0-255。 当Type=0时存在。</para>
            /// </summary>
            public int Epoint;
            public int Epoint;
            /// <summary>
            /// 场景ID 。当Type=1时存在
            /// </summary>
            public int ScenesId;
         }
            public int ScenesId;
        }
        #endregion
        #region 29查看防区报警目标;
@@ -6311,8 +5886,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateWay.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -6326,11 +5900,10 @@
                    if (topic == gatewayID + "/" + "Security/CatZoneAction_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateWay.CurrentGateWayId };
                        security.catZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatZoneActionResponseData>(jobject["Data"].ToString());
                        if (security.catZoneActionResponseData != null)
                        var catZoneActionResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CatZoneActionResponseData>(jobject["Data"].ToString());
                        if (catZoneActionResponseData != null)
                        {
                            d = new CatZoneActionResposeAllData { catZoneActionResponseData = security.catZoneActionResponseData };
                            d = new CatZoneActionResposeAllData { catZoneActionResponseData = catZoneActionResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                        else
@@ -6341,17 +5914,18 @@
                };
                mainGateWay.Actions += action;
                System.Console.WriteLine($"Security/CatZoneAction_Actions启动_{System.DateTime.Now.ToString()}");
                try{
                var jObject = new Newtonsoft.Json.Linq.JObject() {
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4032 }
                                };
                var data = new JObject
                    var data = new JObject
                    {
                        { "ActionType", actionType }
                };
                jObject.Add("Data", data);
                mainGateWay.Send("Security/CatZoneAction", jObject.ToString());
                    jObject.Add("Data", data);
                    mainGateWay.Send("Security/CatZoneAction", jObject.ToString());
                }
                catch { }
@@ -6383,17 +5957,8 @@
        /// 查看防区报警目标的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class CatZoneActionResposeAllData
        public class CatZoneActionResposeAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 查看防区报警目标的返回数据
            /// </summary>
@@ -6449,7 +6014,7 @@
            /// 动作类型
            ///<para>0:节点设备动作</para>
            ///<para>1:打开场景</para>
             /// </summary>
            /// </summary>
            public int Type;
            /// <summary>
            /// 设备mac地址 ,
@@ -6478,7 +6043,7 @@
            /// 设备或场景名称(当Type=0 或Type=1时存在。)
            /// </summary>
            public string ESName;
          }
        }
        #endregion
@@ -6504,8 +6069,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -6519,36 +6083,34 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new SetCoercePhoneNumberAllResponseData { };
                        if (temp == null)
                        {
                             d.errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                            if (temp.Error == 1)
                            {
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。" ;
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
                            }
                            else if (temp.Error == 2)
                            {
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。" ;
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            d.errorResponData = temp ;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/AddZoneAction_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.setCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetCoercePhoneNumberResponseData>(jobject["Data"].ToString());
                        if (security.setCoercePhoneNumberResponseData != null)
                        var setCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetCoercePhoneNumberResponseData>(jobject["Data"].ToString());
                        if (setCoercePhoneNumberResponseData != null)
                        {
                            d = new SetCoercePhoneNumberAllResponseData { setCoercePhoneNumberResponseData = security.setCoercePhoneNumberResponseData };
                            d = new SetCoercePhoneNumberAllResponseData { setCoercePhoneNumberResponseData = setCoercePhoneNumberResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                        else
@@ -6559,39 +6121,40 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine($"Security/AddZoneAction(设置胁迫状态下的电话号码)_Actions启动_{System.DateTime.Now.ToString()}");
                try{
                if (setCoercePhoneNumberData != null)
                try
                {
                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4030 } };
                    var actionsList = new JArray { };
                    foreach (var act in setCoercePhoneNumberData.Actions)
                    {
                        if (act.Type == 2)
                    if (setCoercePhoneNumberData != null)
                    {
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4030 } };
                        var actionsList = new JArray { };
                        foreach (var act in setCoercePhoneNumberData.Actions)
                        {
                            var pushTargetList = new JArray { };
                            foreach (var pushInfo in act.PushTarget)
                            if (act.Type == 2)
                            {
                                var pInfo = new JObject{
                                var pushTargetList = new JArray { };
                                foreach (var pushInfo in act.PushTarget)
                                {
                                    var pInfo = new JObject{
                            { "PushNumber", pushInfo.PushNumber}
                            };
                                pushTargetList.Add(pInfo);
                            }
                            var c = new JObject {
                                    pushTargetList.Add(pInfo);
                                }
                                var c = new JObject {
                         { "Type",act.Type},
                         { "PushTarget", pushTargetList}
                         };
                            actionsList.Add(c);
                                actionsList.Add(c);
                            }
                        }
                    }
                    var data = new JObject
                        var data = new JObject
                    {
                        { "ActionType", 253},
                        { "Actions", actionsList},
                        { "LoginToken", setCoercePhoneNumberData.LoginToken}
                    };
                    jObject.Add("Data", data);
                    mainGateway.Send(("Security/AddZoneAction"), jObject.ToString());
                }
                        jObject.Add("Data", data);
                        mainGateway.Send(("Security/AddZoneAction"), jObject.ToString());
                    }
                }
                catch { }
                var dateTime = DateTime.Now;
@@ -6621,7 +6184,7 @@
        /// <param name="strPhone">地区码-联系方式</param>
        /// <param name="strNote">备注,最大63byte</param>
        /// <returns></returns>
        public static async System.Threading.Tasks.Task<SetCoercePhoneNumberResponseData> SetCoercePhoneNumberNoteAsync(string strPhone,string strNote)
        public static async System.Threading.Tasks.Task<SetCoercePhoneNumberResponseData> SetCoercePhoneNumberNoteAsync(string strPhone, string strNote)
        {
            SetCoercePhoneNumberResponseData d = null;
            var mainGateway = ZbGateway.MainGateWay;
@@ -6681,17 +6244,8 @@
        /// 设置胁迫状态下被通知的联系号码的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class SetCoercePhoneNumberAllResponseData
        public class SetCoercePhoneNumberAllResponseData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 设置胁迫状态下被通知的联系号码的返回数据
            /// </summary>
@@ -6711,7 +6265,7 @@
            /// <summary>
            /// 返回结果
            /// <para>0:默认</para>
             /// </summary>
            /// </summary>
            public int Result = 999;
            /// <summary>
@@ -6730,13 +6284,13 @@
        /// </summary>
        [System.Serializable]
        public class PushTargetActionResponseObj
        {
        {
            /// <summary>
            /// 动作类型 
            ///<para>2:信息推送</para>
            /// </summary>
            public string Type;
            /// <summary>
            /// 信息推送目标,当Type=2时存在。
            /// </summary>
@@ -6795,7 +6349,7 @@
            ///<para>2:信息推送</para>
            /// </summary>
            public int Type;
            /// <summary>
            /// 信息推送目标,当Type=2时存在。
            /// </summary>
@@ -6825,8 +6379,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -6840,36 +6393,34 @@
                    if (topic == gatewayID + "/" + "Security/Error_Respon")
                    {
                        var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        d = new DelCoercePhoneNumberAllResponseData { };
                        if (temp == null)
                        {
                            d.errorMessageBase = "网关错误回复,且数据是空" ;
                            d.errorMessageBase = "网关错误回复,且数据是空";
                        }
                        else
                        {
                            if (temp.Error == 1)
                            {
                                d .errorMessageBase = "网关不是主网关,无法进行该操作。" ;
                                d.errorMessageBase = "网关不是主网关,无法进行该操作。";
                            }
                            else if (temp.Error == 2)
                            {
                                d. errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。" ;
                                d.errorMessageBase = "该操作需要安防管理员权限,需先以管理员身份进行登陆。";
                            }
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                            d.errorResponData = temp ;
                            d.errorResponData = temp;
                        }
                    }
                    if (topic == gatewayID + "/" + "Security/DelZoneAction_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.delCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelCoercePhoneNumberResponseData>(jobject["Data"].ToString());
                        if (security.delCoercePhoneNumberResponseData != null)
                        var delCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelCoercePhoneNumberResponseData>(jobject["Data"].ToString());
                        if (delCoercePhoneNumberResponseData != null)
                        {
                            d = new DelCoercePhoneNumberAllResponseData { delCoercePhoneNumberResponseData = security.delCoercePhoneNumberResponseData };
                            d = new DelCoercePhoneNumberAllResponseData { delCoercePhoneNumberResponseData = delCoercePhoneNumberResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                        else
@@ -6880,39 +6431,40 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine($"Security/AddZoneAction(删除胁迫状态下的电话号码)_Actions启动_{System.DateTime.Now.ToString()}");
                try{
                if (delCoercePhoneNumberData != null)
                try
                {
                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4031 } };
                    var actionsList = new JArray { };
                    foreach (var act in delCoercePhoneNumberData.Actions)
                    if (delCoercePhoneNumberData != null)
                    {
                        if (act.Type == 2)
                        var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4031 } };
                        var actionsList = new JArray { };
                        foreach (var act in delCoercePhoneNumberData.Actions)
                        {
                            var pushTargetList = new JArray { };
                            foreach (var pushInfo in act.PushTarget)
                            if (act.Type == 2)
                            {
                                var pInfo = new JObject{
                                var pushTargetList = new JArray { };
                                foreach (var pushInfo in act.PushTarget)
                                {
                                    var pInfo = new JObject{
                            { "PushNumber", pushInfo.PushNumber}
                            };
                                pushTargetList.Add(pInfo);
                            }
                            var c = new JObject {
                                    pushTargetList.Add(pInfo);
                                }
                                var c = new JObject {
                         { "Type",act.Type},
                         { "PushTarget", pushTargetList}
                         };
                            actionsList.Add(c);
                                actionsList.Add(c);
                            }
                        }
                    }
                    var data = new JObject
                        var data = new JObject
                    {
                        { "ActionType", 253},
                        { "Actions", actionsList},
                        { "LoginToken", delCoercePhoneNumberData.LoginToken}
                    };
                    jObject.Add("Data", data);
                    mainGateway.Send(("Security/DelZoneAction"), jObject.ToString());
                }
                        jObject.Add("Data", data);
                        mainGateway.Send(("Security/DelZoneAction"), jObject.ToString());
                    }
                }
                catch { }
                var dateTime = DateTime.Now;
@@ -6944,17 +6496,8 @@
        /// 删除胁迫状态下被通知的联系号码的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class DelCoercePhoneNumberAllResponseData
        public class DelCoercePhoneNumberAllResponseData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 删除胁迫状态下被通知的联系号码的返回数据
            /// </summary>
@@ -6986,7 +6529,7 @@
            /// </summary>
            public List<PushTargetActionResponseObj> Actions = new List<PushTargetActionResponseObj>();
        }
        }
        /// <summary>
        /// 删除胁迫状态下被通知的联系号码的数据
        /// </summary>
@@ -7034,8 +6577,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -7049,11 +6591,10 @@
                    if (topic == gatewayID + "/" + "Security/CatZoneAction_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.checkCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CheckCoercePhoneNumberResponseData>(jobject["Data"].ToString());
                        if (security.checkCoercePhoneNumberResponseData != null)
                        var checkCoercePhoneNumberResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CheckCoercePhoneNumberResponseData>(jobject["Data"].ToString());
                        if (checkCoercePhoneNumberResponseData != null)
                        {
                            d = new CheckCoercePhoneNumberAllResponseData { checkCoercePhoneNumberResponseData = security.checkCoercePhoneNumberResponseData };
                            d = new CheckCoercePhoneNumberAllResponseData { checkCoercePhoneNumberResponseData = checkCoercePhoneNumberResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                        else
@@ -7064,15 +6605,16 @@
                };
                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
                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());
                    jObject.Add("Data", data);
                    mainGateway.Send(("Security/CatZoneAction"), jObject.ToString());
                }
                catch { }
@@ -7105,17 +6647,8 @@
        /// 查看胁迫状态下被通知的联系号码的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class CheckCoercePhoneNumberAllResponseData
        public class CheckCoercePhoneNumberAllResponseData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 查看胁迫状态下被通知的联系号码的返回数据
            /// </summary>
@@ -7207,8 +6740,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -7222,11 +6754,10 @@
                    if (topic == gatewayID + "/" + "Security/DisablePushMessage_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.disablePushMessageResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DisablePushMessageResponseData>(jobject["Data"].ToString());
                        if (security.disablePushMessageResponseData != null)
                        var disablePushMessageResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<DisablePushMessageResponseData>(jobject["Data"].ToString());
                        if (disablePushMessageResponseData != null)
                        {
                            d = new DisablePushMessageResposeAllData { disablePushMessageResponseData = security.disablePushMessageResponseData };
                            d = new DisablePushMessageResposeAllData { disablePushMessageResponseData = disablePushMessageResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                        else
@@ -7237,18 +6768,19 @@
                };
                mainGateway.Actions += action;
                System.Console.WriteLine($"Security/DisablePushMessage_Actions启动_{System.DateTime.Now.ToString()}");
                try{
                var jObject = new Newtonsoft.Json.Linq.JObject() {
                try
                {
                    var jObject = new Newtonsoft.Json.Linq.JObject() {
                                    { "Cluster_ID", 0 },
                                    { "Command", 4034 }
                                };
                var data = new JObject
                    var data = new JObject
                    {
                        { "ZoneType", zoneType },
                     { "IsDisablePushMessage", isDisablePushMessage }
                };
                jObject.Add("Data", data);
                mainGateway.Send(("Security/DisablePushMessage"), jObject.ToString());
                    jObject.Add("Data", data);
                    mainGateway.Send(("Security/DisablePushMessage"), jObject.ToString());
                }
                catch { }
@@ -7280,17 +6812,8 @@
        /// 查看防区报警目标的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class DisablePushMessageResposeAllData
        public class DisablePushMessageResposeAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 查看防区报警目标的返回数据
            /// </summary>
@@ -7354,8 +6877,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -7369,11 +6891,10 @@
                    if (topic == gatewayID + "/" + "Security/AdminLogOut_Respon")
                    {
                        var security = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.CurrentGateWayId };
                        security.adminLogOutResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AdminLogOutResponseData>(jobject["Data"].ToString());
                        if (security.adminLogOutResponseData != null)
                        var adminLogOutResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<AdminLogOutResponseData>(jobject["Data"].ToString());
                        if (adminLogOutResponseData != null)
                        {
                            d = new AdminLogOutResposeAllData {adminLogOutResponseData  = security.adminLogOutResponseData };
                            d = new AdminLogOutResposeAllData { adminLogOutResponseData = adminLogOutResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{topic}");
                        }
                        else
@@ -7427,17 +6948,8 @@
        /// 退出管理员登陆的返回数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class AdminLogOutResposeAllData
        public class AdminLogOutResposeAllData : CommonDevice.ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 退出管理员登陆的返回数据
            /// </summary>