From adb12dcdbb2ddaeac687c3aa9e57bb7ed459ab7e Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 24 六月 2020 15:26:46 +0800 Subject: [PATCH] 2020.06.24.01 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs | 37 +++++++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs index f3aa1f4..02d698c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs @@ -76,7 +76,7 @@ return reResult; } //缃戝叧ID - string gatewayID = HdlGatewayLogic.Current.GetGatewayId(device.Gateway); + string gatewayID = device.Gateway.GwId; //閿欒涓婚 string errorTopic = gatewayID + "/" + "Error_Respon"; //妫�娴嬪璞$殑涓婚 @@ -166,8 +166,10 @@ /// <param name="receiptCommand">鎸囧畾鎺ユ敹鍛戒护绗�</param> /// <param name="receiptDataLength">鎸囧畾鎺ユ敹鏁版嵁鐨勯暱搴�</param> /// <param name="waitTime">瓒呮椂鏃堕棿(绉�)</param> + /// <param name="listReceiptLength">闄勫姞妫�娴嬫暟鎹帴鏀堕暱搴�,褰撴帴鏀剁殑闀垮害鍦ㄨ繖鍒楄〃閲岄潰鏃�,浠h〃鎺ユ敹鎴愬姛(鏃ㄥ湪瀵瑰簲鏂版棫璁惧,閫忎紶鍥炲鐨勯暱搴﹀彲鑳戒笉鍚�)</param> /// <returns>缃戝叧杩斿洖鐨勬暟鎹�</returns> - public ReceiptGatewayResult SendJobjectDataToGateway2(CommonDevice device, string sendData, string receiptCommand, int receiptDataLength, int waitTime = 5) + public ReceiptGatewayResult SendJobjectDataToGateway2(CommonDevice device, string sendData, string receiptCommand, int receiptDataLength, + int waitTime = 5, List<int> listReceiptLength = null) { var reResult = new ReceiptGatewayResult(); var myGateway = device.Gateway; @@ -179,7 +181,7 @@ return reResult; } //缃戝叧ID - string gatewayID = HdlGatewayLogic.Current.GetGatewayId(device.Gateway); + string gatewayID = device.Gateway.GwId; //閿欒涓婚 string errorTopic = gatewayID + "/" + "Error_Respon"; //妫�娴嬪璞$殑涓婚 @@ -217,18 +219,29 @@ } var responseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString()); - //闀垮害涓�鑷� - if (responseData.PassData.Length == receiptDataLength) + //闀垮害涓嶄竴鑷� + if (responseData.PassData.Length != receiptDataLength) { - var command = responseData.PassData[4].ToString() - + responseData.PassData[5].ToString() - + responseData.PassData[2].ToString() - + responseData.PassData[3].ToString(); - //骞朵笖鏄繖涓懡浠� - if (command == receiptCommand) + if (listReceiptLength == null) { - reResult.ReceiptData = responseData.PassData; + //濡傛灉娌℃湁闄勫姞妫�娴嬮暱搴�,鍒欑洿鎺ヨ繑鍥� + return; } + if (listReceiptLength.Contains(responseData.PassData.Length) == false) + { + //濡傛灉闄勫姞鐨勬娴嬮暱搴﹂噷闈�,杩樹笉瀛樺湪鐨勮瘽,鐩存帴杩斿洖 + return; + } + } + + var command = responseData.PassData[4].ToString() + + responseData.PassData[5].ToString() + + responseData.PassData[2].ToString() + + responseData.PassData[3].ToString(); + //骞朵笖鏄繖涓懡浠� + if (command == receiptCommand) + { + reResult.ReceiptData = responseData.PassData; } } }; -- Gitblit v1.8.0