| | |
| | | /// </summary> |
| | | public int Time; |
| | | |
| | | /// <summary> |
| | | /// <summary> |
| | | /// 等待从网关接收数据的时间 |
| | | /// </summary> |
| | | /// <value>The wait receive data time.</value> |
| | |
| | | if (mainGateway == null) |
| | | { |
| | | return 3000; |
| | | }else if (mainGateway.IsVirtual) |
| | | } |
| | | else if (mainGateway.IsVirtual) |
| | | { |
| | | return 6000; |
| | | } |
| | |
| | | } |
| | | |
| | | /// <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 = ""; |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | 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}"); |
| | | } |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 }, |
| | |
| | | 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; |
| | | } |
| | |
| | | /// 管理员密码登陆返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | |
| | | 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 |
| | | { |
| | |
| | | |
| | | 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}"); |
| | | } |
| | | } |
| | |
| | | }; |
| | | 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} |
| | |
| | | mainGateway.Send("Security/ChangeAdminPassword", jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | /// 修改管理员密码返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | /// 查看延时时间返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// <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 () => |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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 = "网关不是主网关,无法进行该操作。"; |
| | |
| | | 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) |
| | | { |
| | |
| | | /// 设置延时时间返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | { |
| | | return await System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | CatUserPasswordResponseAllData d =null; |
| | | CatUserPasswordResponseAllData d = null; |
| | | var mainGateway = ZbGateway.MainGateWay; |
| | | if (mainGateway == null) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 = "网关不是主网关,无法进行该操作。"; |
| | | } |
| | |
| | | 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) |
| | | { |
| | |
| | | /// 查看用户密码和胁迫密码返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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 |
| | | { |
| | |
| | | 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}"); |
| | | |
| | | } |
| | |
| | | }; |
| | | 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} |
| | |
| | | jObject.Add("Data", data); |
| | | mainGateway.Send("Security/SetUserPassword", jObject.ToString()); |
| | | } |
| | | catch{ |
| | | } |
| | | catch |
| | | { |
| | | } |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | /// 新增或重设用户密码返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// 为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 () => |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | 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 = "网关不是主网关,无法进行该操作。"; |
| | |
| | | } |
| | | 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}"); |
| | | |
| | | } |
| | |
| | | }; |
| | | 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} |
| | |
| | | jObject.Add("Data", data); |
| | | mainGateway.Send("Security/DelUserPassword", jObject.ToString()); |
| | | } |
| | | catch{} |
| | | catch { } |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | /// 删除用户密码返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | // 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) |
| | | // { |
| | |
| | | |
| | | 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 } }; |
| | |
| | | mainGateway.Send(("Security/AddEqToZone_Actions 启动"), jObject.ToString()); |
| | | } |
| | | } |
| | | catch { |
| | | catch |
| | | { |
| | | } |
| | | |
| | | var dateTime = DateTime.Now; |
| | |
| | | /// 设备加入防区的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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) |
| | |
| | | |
| | | 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 |
| | | { |
| | |
| | | }; |
| | | 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 } }; |
| | |
| | | mainGateway.Send(("Security/AddNewMode"), jObject.ToString()); |
| | | } |
| | | } |
| | | catch {} |
| | | catch { } |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime ) |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | d = new AddNewModeResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | d = new AddNewModeResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | |
| | | mainGateway.Actions -= action; |
| | |
| | | /// 新建或修改布防模式返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// <summary> |
| | | /// 布防模式名称 ,最大32个字符。 |
| | | /// </summary> |
| | | public string ModeName; |
| | | public string ModeName; |
| | | |
| | | /// <summary> |
| | | /// 允许失能。 |
| | | ///<para>0:不允许失能。</para> |
| | | ///<para>1:允许失能</para> |
| | | /// </summary> |
| | | public int AllowDisable; |
| | | public int AllowDisable; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 布防模式名称 ,最大32个字符。 |
| | | ///<para>不需要修改可忽略该字段。</para> |
| | | /// </summary> |
| | | public string ModeName; |
| | | public string ModeName; |
| | | |
| | | /// <summary> |
| | | /// 允许失能。 |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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) |
| | |
| | | |
| | | 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}"); |
| | | } |
| | | } |
| | |
| | | }; |
| | | 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 } }; |
| | |
| | | mainGateway.Send(("Security/ZoneJoinMode"), jObject.ToString()); |
| | | } |
| | | } |
| | | catch{} |
| | | |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | /// 防区加入布防模式返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | ///<para>2:失败,防区已在模式中存在</para> |
| | | ///<para>3:失败,防区为24小时(静音)防区类型。</para> |
| | | /// </summary> |
| | | public int Status=999; |
| | | public int Status = 999; |
| | | /// <summary> |
| | | /// 防区ID |
| | | /// </summary> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | |
| | | |
| | | 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}"); |
| | | } |
| | | } |
| | |
| | | }; |
| | | 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 } }; |
| | |
| | | /// 从布防模式中移除防区返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | |
| | | 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; |
| | |
| | | }; |
| | | 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 { } |
| | | |
| | |
| | | /// 安防模式触发动作添加的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// 0:默认 |
| | | ///<para>1:失败,模式不存在。</para> |
| | | /// </summary> |
| | | public int Result=999; |
| | | public int Result = 999; |
| | | |
| | | /// <summary> |
| | | /// 要修改的布防模式ID。 |
| | |
| | | ///<para>0:成功</para> |
| | | ///<para>1:失败,设备或场景不存在</para> |
| | | /// </summary> |
| | | public int Status=999; |
| | | public int Status = 999; |
| | | |
| | | /// <summary> |
| | | /// 动作类型 |
| | |
| | | ///<para>2:布防失败指示动作</para> |
| | | ///<para>3:撤防成功指示动作</para> |
| | | ///<para>4:撤防失败指示动作</para> |
| | | /// </summary> |
| | | /// </summary> |
| | | public int ActionType; |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 = "网关错误回复,且数据是空"; |
| | |
| | | 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 } }; |
| | |
| | | mainGateway.Send(("Security/RemoveActonFromMode"), jObject.ToString()); |
| | | } |
| | | } |
| | | catch{ |
| | | catch |
| | | { |
| | | |
| | | } |
| | | |
| | |
| | | /// 将动作从布防模式中移除的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | ///<para>0:成功</para> |
| | | ///<para>1:失败,设备或场景不存在</para> |
| | | /// </summary> |
| | | public int Status=999; |
| | | public int Status = 999; |
| | | |
| | | /// <summary> |
| | | /// 动作类型 |
| | |
| | | ///<para>2:布防失败指示动作</para> |
| | | ///<para>3:撤防成功指示动作</para> |
| | | ///<para>4:撤防失败指示动作</para> |
| | | /// </summary> |
| | | /// </summary> |
| | | public int ActionType; |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | |
| | | /// 获取布防模式列表返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// 布防模式名称 ,最大32个字符 |
| | | /// </summary> |
| | | public string ModeName; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 允许失能。 |
| | | ///<para>0:不允许失能。</para> |
| | | ///<para>1:允许失能</para> |
| | | /// </summary> |
| | | public string AllowDisable; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 模式当前布撤防状态 |
| | | ///<para>0:撤防</para> |
| | |
| | | { |
| | | return await System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | GetModeInfoByIdResponAllData d =null; |
| | | GetModeInfoByIdResponAllData d = null; |
| | | var mainGateway = ZbGateway.MainGateWay; |
| | | if (mainGateway == null) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | 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) |
| | | { |
| | |
| | | d = new GetModeInfoByIdResponAllData { getModeInfoByIdResponData = getModeInfoByIdResponData }; |
| | | } |
| | | System.Console.WriteLine("已收到通知返回"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | d = new GetModeInfoByIdResponAllData { }; |
| | |
| | | }; |
| | | 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 } |
| | |
| | | jObject.Add("Data", data); |
| | | mainGateway.Send("Security/GetModeInfoById", jObject.ToString()); |
| | | } |
| | | catch {} |
| | | |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | } |
| | | 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()); |
| | |
| | | /// 通过布防模式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> |
| | |
| | | /// 0:默认 |
| | | ///<para>1:失败,布防模式不存在</para> |
| | | /// </summary> |
| | | public int Result=999; |
| | | public int Result = 999; |
| | | |
| | | /// <summary> |
| | | /// 布防模式ID |
| | |
| | | /// 布防模式名称 ,最大32个字符 |
| | | ///<para> (Result=0时值有效)</para> |
| | | /// </summary> |
| | | public string ModeName; |
| | | public string ModeName; |
| | | |
| | | /// <summary> |
| | | /// 允许失能。 |
| | |
| | | ///<para>1:允许失能</para> |
| | | ///<para> (Result=0时值有效)</para> |
| | | /// </summary> |
| | | public int AllowDisable = 100; |
| | | public int AllowDisable = 100; |
| | | |
| | | /// <summary> |
| | | /// 模式当前布撤防状态 |
| | |
| | | ///<para> (Result=0时值有效)</para> |
| | | /// </summary> |
| | | public List<ActionsInfo> WithdrawFailActions = new List<ActionsInfo>(); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加入成功的防区列表的数据 |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | d = new GetModeUsingResponseAllData {}; |
| | | d = new GetModeUsingResponseAllData { }; |
| | | var r = new GetModeUsingResponseData(); |
| | | r.Result = result; |
| | | d.getModeUsingResponseData = r; |
| | |
| | | }; |
| | | 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) |
| | | { |
| | |
| | | } |
| | | 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()); |
| | |
| | | /// 查看当前正在使用的布防模式返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// 0:默认 |
| | | /// <para>1:系统当前没有进行布防</para> |
| | | /// </summary> |
| | | public int Result=999; |
| | | public int Result = 999; |
| | | |
| | | /// <summary> |
| | | /// 启用的布防模式id |
| | |
| | | /// <para>3:失能一次,第一次被激活不警告不触发动作。</para> |
| | | /// </summary> |
| | | public int Setting; |
| | | |
| | | |
| | | } |
| | | #endregion |
| | | |
| | |
| | | { |
| | | EnableModeResponAllData d = null; |
| | | var mainGateway = ZbGateway.MainGateWay; |
| | | if (mainGateway == null) |
| | | if (mainGateway == null) |
| | | { |
| | | d = new EnableModeResponAllData { errorMessageBase = "当前没有主网关" }; |
| | | return d; |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | 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}"); |
| | | } |
| | | } |
| | |
| | | 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() { |
| | |
| | | mainGateway.Send("Security/EnableMode", jObject.ToString()); |
| | | } |
| | | } |
| | | catch{} |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | |
| | | /// 布防返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | ///<para>4:布防失败,有其他布防模式正在启用(只能使用一种布防模式,需将正在启用的布防模式撤防才能布防新模式)。</para> |
| | | ///<para>5:失败,模式属性不允许失能(如果新建布防模式时,AllowDisable设置为0,则布防Setting值不能为2或3,否则将报告该错误)</para> |
| | | /// </summary> |
| | | public int Result=999; |
| | | public int Result = 999; |
| | | |
| | | /// <summary> |
| | | /// 启用的布防模式id |
| | |
| | | /// <para>3:失能一次,第一次被激活不警告不触发动作。</para> |
| | | /// </summary> |
| | | public int Setting; |
| | | |
| | | |
| | | /// <summary> |
| | | ///当前正在启用的布防模式ID(当Result = 4时存在。) |
| | | /// </summary> |
| | |
| | | ///<para>1:检查</para> |
| | | /// </summary> |
| | | public int CheckIASStatus; |
| | | |
| | | |
| | | /// <summary> |
| | | ///用户密码,最大32个字符 |
| | | /// </summary> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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}"); |
| | | } |
| | | } |
| | |
| | | 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} |
| | |
| | | mainGateway.Send("Security/WithdrawMode", jObject.ToString()); |
| | | |
| | | } |
| | | catch {} |
| | | |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | /// 撤防返回的数据,网关反馈信息 |
| | | /// </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> |
| | | /// 撤防返回的数据 |
| | |
| | | ///<para>2:撤防失败,密码错误。</para> |
| | | ///<para>3:撤防失败,模式不可撤防。(新建模式时,模式属性设为不可撤防则布防后将不能撤防)</para> |
| | | /// </summary> |
| | | public int Result=999; |
| | | public int Result = 999; |
| | | |
| | | /// <summary> |
| | | /// 被撤防的模式 |
| | |
| | | { |
| | | RemoveModeResponseAllData d = null; |
| | | var mainGateway = ZbGateway.MainGateWay; |
| | | if (mainGateway == null) |
| | | if (mainGateway == null) |
| | | { |
| | | d = new RemoveModeResponseAllData { errorMessageBase = "当前没有主网关" }; |
| | | return d; |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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} |
| | |
| | | mainGateway.Send("Security/RemoveMode", jObject.ToString()); |
| | | |
| | | } |
| | | catch {} |
| | | |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | /// 删除布防模式返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | ///<para>1:失败,不存在该布防模式。</para> |
| | | ///<para>2:删除失败,不允许删除。(当ModeId为1或2时,离家布防和在家布防模式不允许删除)</para> |
| | | /// </summary> |
| | | public int Result=999; |
| | | public int Result = 999; |
| | | |
| | | /// <summary> |
| | | /// 模式id |
| | |
| | | /// <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> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | |
| | | 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}"); |
| | | } |
| | | } |
| | |
| | | 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 } }; |
| | |
| | | mainGateway.Send(("Security/RemoveEqToZone_Actions 启动"), jObject.ToString()); |
| | | } |
| | | } |
| | | catch{} |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime ) |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | d = new RemoveDeviceToZoneAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | d = new RemoveDeviceToZoneAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | |
| | | mainGateway.Actions -= action; |
| | |
| | | /// 将设备从防区中移除的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// <para>1:添加失败。(局部布防列表id不存在)</para> |
| | | /// </summary> |
| | | public int Result = 999; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 安防设备列表(Result=0时存在) |
| | | /// </summary> |
| | |
| | | // 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) |
| | | // { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | 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}"); |
| | | } |
| | |
| | | jObject.Add("Data", data); |
| | | mainGateway.Send("Security/GetZoneDeviceListById", jObject.ToString()); |
| | | } |
| | | catch { } |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | |
| | | } |
| | | 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()); |
| | |
| | | /// 通过布防模式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> |
| | |
| | | ///<para>0:不旁路</para> |
| | | ///<para>1:旁路</para> |
| | | /// </summary> |
| | | public int IsBypass=999; |
| | | public int IsBypass = 999; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | ///<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 () => |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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) |
| | | { |
| | |
| | | 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}"); |
| | | |
| | | } |
| | |
| | | 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} |
| | |
| | | jObject.Add("Data", data); |
| | | mainGateway.Send("Security/ActionTest", jObject.ToString()); |
| | | } |
| | | catch {} |
| | | |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | /// 执行安防模式动作返回的数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// 报警时最后被激活的防区 |
| | | /// </summary> |
| | | public int ZoneId; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 是否为强迫密码撤防触发静音防区 |
| | | ///<para>0:不是</para> |
| | |
| | | /// <summary> |
| | | /// 信息推送目标 |
| | | /// </summary> |
| | | public List<PushTargetInfo> PushTarget=new List<PushTargetInfo>(); |
| | | |
| | | public List<PushTargetInfo> PushTarget = new List<PushTargetInfo>(); |
| | | |
| | | } |
| | | #endregion |
| | | |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | 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 |
| | |
| | | var r = new EqByPassResponseData(); |
| | | r.Result = result; |
| | | d = new EqByPassAllData { eqByPassResponseData = r }; |
| | | |
| | | |
| | | System.Console.WriteLine("已收到通知返回"); |
| | | } |
| | | } |
| | |
| | | mainGateway.Actions += action; |
| | | System.Console.WriteLine($"Security/EqByPass_Actions启动_{System.DateTime.Now.ToString()}"); |
| | | |
| | | try{ |
| | | try |
| | | { |
| | | if (eqByPassData != null) |
| | | { |
| | | var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4029 } }; |
| | |
| | | mainGateway.Send(("Security/EqByPass"), jObject.ToString()); |
| | | } |
| | | } |
| | | catch{} |
| | | |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | d = new EqByPassAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | d = new EqByPassAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | |
| | | mainGateway.Actions -= action; |
| | |
| | | /// 对防区安防设备进行旁路或撤销旁路的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// </summary> |
| | | public int IsByPass; |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 对防区安防设备进行旁路或撤销旁路的数据 |
| | |
| | | /// 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 |
| | |
| | | |
| | | var mainGateway = ZbGateway.MainGateWay; |
| | | if (mainGateway == null) |
| | | { |
| | | { |
| | | d = new AddZoneActionAllData { errorMessageBase = "当前没有主网关" }; |
| | | return d; |
| | | return d; |
| | | } |
| | | Action<string, string> action = (topic, message) => |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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()}"); |
| | |
| | | jObject.Add("Data", data); |
| | | mainGateway.Send(("Security/AddZoneAction"), jObject.ToString()); |
| | | } |
| | | }catch{} |
| | | } |
| | | catch { } |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | d = new AddZoneActionAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | |
| | | |
| | | } |
| | | |
| | | mainGateway.Actions -= action; |
| | |
| | | /// 添加防区报警目标的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// <summary> |
| | | /// 设备或场景名称,Status = 0时存在 |
| | | /// </summary> |
| | | public string ESName; |
| | | } |
| | | public string ESName; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加防区报警目标的数据 |
| | |
| | | /// <summary> |
| | | /// 场景ID 。当Type=1时存在 |
| | | /// </summary> |
| | | public int ScenesId; |
| | | } |
| | | public int ScenesId; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | jObject.Add("Data", data); |
| | | mainGateway.Send(("Security/DelZoneAction"), jObject.ToString()); |
| | | } |
| | | }catch{} |
| | | } |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | |
| | | /// 删除防区报警目标的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// 动作类型 |
| | | ///<para>0:节点设备动作</para> |
| | | ///<para>1:打开场景</para> |
| | | /// </summary> |
| | | /// </summary> |
| | | public string Type; |
| | | /// <summary> |
| | | /// 设备mac地址 , |
| | |
| | | /// 设备端口号 |
| | | ///<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> |
| | | /// 删除防区报警目标的数据 |
| | |
| | | /// 设备端口号 |
| | | ///<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查看防区报警目标; |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | }; |
| | | 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 { } |
| | | |
| | |
| | | /// 查看防区报警目标的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// 动作类型 |
| | | ///<para>0:节点设备动作</para> |
| | | ///<para>1:打开场景</para> |
| | | /// </summary> |
| | | /// </summary> |
| | | public int Type; |
| | | /// <summary> |
| | | /// 设备mac地址 , |
| | |
| | | /// 设备或场景名称(当Type=0 或Type=1时存在。) |
| | | /// </summary> |
| | | public string ESName; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | }; |
| | | 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; |
| | |
| | | /// <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;
|
| | |
| | | /// 设置胁迫状态下被通知的联系号码的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// <summary> |
| | | /// 返回结果 |
| | | /// <para>0:默认</para> |
| | | /// </summary> |
| | | /// </summary> |
| | | public int Result = 999; |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class PushTargetActionResponseObj |
| | | { |
| | | { |
| | | /// <summary> |
| | | /// 动作类型 |
| | | ///<para>2:信息推送</para> |
| | | /// </summary> |
| | | public string Type; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 信息推送目标,当Type=2时存在。 |
| | | /// </summary> |
| | |
| | | ///<para>2:信息推送</para> |
| | | /// </summary> |
| | | public int Type; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 信息推送目标,当Type=2时存在。 |
| | | /// </summary> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | }; |
| | | 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; |
| | |
| | | /// 删除胁迫状态下被通知的联系号码的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | /// </summary> |
| | | public List<PushTargetActionResponseObj> Actions = new List<PushTargetActionResponseObj>(); |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 删除胁迫状态下被通知的联系号码的数据 |
| | | /// </summary> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | }; |
| | | 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 { } |
| | | |
| | |
| | | /// 查看胁迫状态下被通知的联系号码的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | }; |
| | | 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 { } |
| | | |
| | |
| | | /// 查看防区报警目标的返回数据,网关反馈信息 |
| | | /// </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> |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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 |
| | |
| | | /// 退出管理员登陆的返回数据,网关反馈信息 |
| | | /// </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> |