| | |
| | | /// <param name="receiptCommand">指定接收命令符</param>
|
| | | /// <param name="receiptDataLength">指定接收数据的长度</param>
|
| | | /// <param name="waitTime">超时时间(秒)</param>
|
| | | /// <param name="listReceiptLength">附加检测数据接收长度,当接收的长度在这列表里面时,代表接收成功(旨在对应新旧设备,透传回复的长度可能不同)</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;
|
| | |
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | | }
|
| | | };
|