PCAN-UDS API:WaitForService()doesn't work
Posted: Wed 8. Jul 2020, 13:02
Hello everyone
I used the PCAN-UDS API:SvcReadDataByIdentifier() to read data from ECU and it send the request message to ECU successful,I can view the response message from ECU in the PCAN-View,this message is correct,But when I used the PCAN-UDS API :WaitForService() to get the response from ECU ,there is an error code(PUDS_ERROR_NO_MESSAGE),it not get the response.Why there is no message when I use this API:WaitForService()?
Any help would be appreciated.
There is my code:
I used the PCAN-UDS API:SvcReadDataByIdentifier() to read data from ECU and it send the request message to ECU successful,I can view the response message from ECU in the PCAN-View,this message is correct,But when I used the PCAN-UDS API :WaitForService() to get the response from ECU ,there is an error code(PUDS_ERROR_NO_MESSAGE),it not get the response.Why there is no message when I use this API:WaitForService()?
Any help would be appreciated.
There is my code:
Code: Select all
// Sends a Physical ReadDataByIdentifier Request
ushort[] buffer = { (ushort)UDSApi.TPUDSSvcParamDI.PUDS_SVC_PARAM_DI_Test };
result = UDSApi.SvcReadDataByIdentifier(mConnectedChannelHandle, ref request, buffer, (ushort)buffer.Length);------>Send request successful.
System.Windows.Forms.MessageBox.Show(String.Format("Send Error occured: {0}", (int)result));
//Get response from ECU
if (result == TPUDSStatus.PUDS_ERROR_OK)
result = UDSApi.WaitForService(mConnectedChannelHandle, out response, ref request, out requestConfirmation);------->No message response.
if (result == TPUDSStatus.PUDS_ERROR_OK)
{
System.Windows.Forms.MessageBox.Show(String.Format("Response was received."));
}
else
// An error occurred
System.Windows.Forms.MessageBox.Show(String.Format("Error occured: {0}", (int)result));