From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 28 二月 2020 15:25:13 +0800 Subject: [PATCH] 2020.2.28 --- ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs | 67 ++------------------------------- 1 files changed, 5 insertions(+), 62 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs index 431fa5b..e852fa5 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs @@ -44,37 +44,17 @@ 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); @@ -127,43 +107,6 @@ 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 = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; @@ -219,7 +162,7 @@ /// 0锛氱粦瀹氭墍鏈夌洰鏍囨垚鍔� ///<para>1锛氱粦瀹氱洰鏍囧け璐ワ紝缁戝畾璁惧鐩爣鏈夋紡鎺�</para> /// </summary> - public int Result; + public int Result = -1; } /// <summary> -- Gitblit v1.8.0