| | |
| | | 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()); |
| | | var tempResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AddedDeviceBindResponseData>(jobject["Data"].ToString()); |
| | | if (tempResult == null) |
| | | { |
| | |
| | | } |
| | | 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 = 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 = " 回复超时,请重新操作" }; |