| | |
| | | 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<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | |
| | | } |
| | | else if (topic == gatewayID + "/" + "Bind/SetBind_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; |
| | | var tempBindList = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["BindList"].ToString()); |
| | | if (tempBindList == null) |
| | | var tempResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AddedDeviceBindResponseData>(jobject["Data"].ToString()); |
| | | if (tempResult == null) |
| | | { |
| | | result = new AddedDeviceBindResponseAllData { errorMessageBase = "网关返回的数据为空" }; |
| | | } |
| | | else |
| | | { |
| | | var dataBindRes = new AddedDeviceBindResponseData(); |
| | | for (int m = 0; tempBindList != null && m < tempBindList.Count; m++) |
| | | { |
| | | var tempBind = tempBindList[m]; |
| | | dataBindRes.BindList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindListResponseObj>(tempBind.ToString())); |
| | | } |
| | | if (dataBindRes != null) |
| | | { |
| | | result = new AddedDeviceBindResponseAllData { addedDeviceBindResponseData = dataBindRes }; |
| | | DebugPrintLog($"UI收到通知后的主题_{topic}"); |
| | | } |
| | | result = new AddedDeviceBindResponseAllData { addedDeviceBindResponseData = tempResult }; |
| | | DebugPrintLog($"UI收到通知后的主题_{topic}"); |
| | | } |
| | | } |
| | | //else if (topic == gatewayID + "/" + "Bind/BindResult") |
| | | //{ |
| | | // var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; |
| | | // var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<AddBindResultResponseData>(jobject["Data"].ToString()); |
| | | |
| | | // if (tempData != null) |
| | | // { |
| | | // result = new AddedDeviceBindResponseAllData { addBindResultResponseData = tempData }; |
| | | // } |
| | | // DebugPrintLog($"UI收到通知后的主题_{topic}"); |
| | | //} |
| | | }; |
| | | mainGateway.Actions += action; |
| | | DebugPrintLog("Bind/SetBind_Actions 启动" + "_" + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); |
| | |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | result = new AddedDeviceBindResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | //while ((DateTime.Now - dateTime).TotalMilliseconds < 20*1000) |
| | | //{ |
| | | //await System.Threading.Tasks.Task.Delay(100); |
| | | //if (result == null || result.addedDeviceBindResponseData == null) |
| | | //{ |
| | | // continue; |
| | | //} |
| | | //if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 1).Count) |
| | | //{ |
| | | // if (result.addBindResultResponseData != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | //} |
| | | //else if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 2).Count) |
| | | //{ |
| | | // if (result.addBindResultResponseData != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | //} |
| | | //else if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 3).Count) |
| | | //{ |
| | | // if (result.addBindResultResponseData != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // break; |
| | | //} |
| | | //} |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > 20 * 1000) |
| | | { |
| | | result = new AddedDeviceBindResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定设备信息,网关反馈信息 |
| | | /// </summary> |
| | | public AddedDeviceBindResponseAllData addedDeviceBindResponseAllData; |
| | | [System.Serializable] |
| | | public class AddedDeviceBindResponseAllData |
| | | public class AddedDeviceBindResponseAllData : ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 网关直接反馈绑定设备信息 |
| | | /// </summary> |
| | |
| | | public AddBindResultResponseData addBindResultResponseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定设备信息 |
| | | /// </summary> |
| | | public AddedDeviceBindResponseData addedDeviceBindResponseData; |
| | | [System.Serializable] |
| | | public class AddedDeviceBindResponseData |
| | | { |
| | |
| | | /// 0:绑定所有目标成功 |
| | | ///<para>1:绑定目标失败,绑定设备目标有漏掉</para> |
| | | /// </summary> |
| | | public int Result; |
| | | public int Result = -1; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 绑定设备的数据 |
| | | /// </summary> |
| | | public AddBindData addBindData; |
| | | [System.Serializable] |
| | | public class AddBindData |
| | | { |
| | |
| | | |
| | | // 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<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (temp == null) |
| | | // { |
| | |
| | | // //场景移除 |
| | | // if (topic == gatewayID + "/" + "Bind/RemoveBind_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | // var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelDeviceBindResponseData>(jobject["Data"].ToString()); |
| | | |
| | | // if (tempData == null) |
| | |
| | | // //设备移除 |
| | | // if (topic == gatewayID + "/" + "Bind/RemoveBindResult") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID }; |
| | | // var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveBindResultResponseData>(jobject["Data"].ToString()); |
| | | |
| | | // if (tempData != 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<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | |
| | | |
| | | if (topic == gatewayID + "/" + "Bind/RemoveBind_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<DelDeviceBindResponseData>(jobject["Data"].ToString()); |
| | | |
| | | if (tempData == null) |
| | |
| | | |
| | | if (topic == gatewayID + "/" + "Bind/RemoveBindResult") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID }; |
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveBindResultResponseData>(jobject["Data"].ToString()); |
| | | |
| | | if (tempData != null) |
| | |
| | | /// <summary> |
| | | ///解除绑定数据,网关反馈信息 |
| | | /// </summary> |
| | | public DelDeviceBindResponseAllData delDeviceBindResponseAllData; |
| | | /// <summary> |
| | | ///解除绑定数据,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class DelDeviceBindResponseAllData |
| | | public class DelDeviceBindResponseAllData : ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 解除绑定数据信息 |
| | | /// </summary> |
| | |
| | | public RemoveBindResultResponseData removeBindResultResponseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解除绑定数据 |
| | | /// </summary> |
| | | public DelDeviceBindResponseData delDeviceBindResponseData; |
| | | /// <summary> |
| | | /// 解除绑定数据 |
| | | /// </summary> |
| | |
| | | public string DeviceName; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解除绑定数据 |
| | | /// </summary> |
| | | public DelDeviceBindData delDeviceBindData; |
| | | /// <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<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | |
| | | |
| | | if (topic == gatewayID + "/" + "Bind/GetDeviceBind_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID }; |
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetDeviceBindResponseData>(jobject["Data"].ToString()); |
| | | //var tempBindList = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["BindList"].ToString()); |
| | | if (tempData == null) |
| | |
| | | /// <summary> |
| | | ///获取所有绑定数据,网关反馈信息 |
| | | /// </summary> |
| | | public GetDeviceBindResponseAllData getAllBindResponseAllData; |
| | | [System.Serializable] |
| | | public class GetDeviceBindResponseAllData |
| | | public class GetDeviceBindResponseAllData : ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 控制设备绑定的设备列表回复数据 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 获取所有绑定回复的数据 |
| | | /// </summary> |
| | | public GetDeviceBindResponseData getAllBindResponseData; |
| | | [System.Serializable] |
| | | public class GetDeviceBindResponseData |
| | | { |
| | |
| | | |
| | | 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<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | |
| | | |
| | | if (topic == gatewayID + "/" + "Bind/GetDeviceLocalBind_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = mainGateway.getGatewayBaseInfo.gwID }; |
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<GetDeviceLocalBindResponseData>(jobject["Data"].ToString());
|
| | | if (tempData == null) |
| | | { |
| | |
| | | /// <summary> |
| | | ///从节点设备本地记录读取绑定列表信息回复的数据,网关反馈信息 |
| | | /// </summary> |
| | | public GetDeviceLocalBindResponseAllData getDeviceLocalBindResponseAllData; |
| | | [System.Serializable] |
| | | public class GetDeviceLocalBindResponseAllData |
| | | public class GetDeviceLocalBindResponseAllData : ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 从节点设备本地记录读取绑定列表信息回复的数据 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 从节点设备本地记录读取绑定列表信息回复的数据 |
| | | /// </summary> |
| | | public GetDeviceLocalBindResponseData getDeviceLocalBindResponseData; |
| | | [System.Serializable] |
| | | public class GetDeviceLocalBindResponseData |
| | | { |
| | |
| | | |
| | | if (topic == gatewayID + "/" + "Error_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | |
| | | |
| | | if (topic == gatewayID + "/" + "Bind/ClearBindInfo_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClearBindInfoResponseData>(jobject["Data"].ToString()); |
| | | if (tempData == null) |
| | | { |
| | |
| | | /// <summary> |
| | | ///删除一个控制设备所有绑定数据,网关反馈信息 |
| | | /// </summary> |
| | | public ClearBindInfoResponseAllData clearBindInfoResponseAllData; |
| | | [System.Serializable] |
| | | public class ClearBindInfoResponseAllData |
| | | public class ClearBindInfoResponseAllData : ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 控制设备绑定的设备列表回复数据 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 删除一个控制设备所有绑定信息回复的数据 |
| | | /// </summary> |
| | | public ClearBindInfoResponseData clearBindInfoResponseData; |
| | | [System.Serializable] |
| | | public class ClearBindInfoResponseData |
| | | { |