Search tips

apple banana
Find rows that contain at least one of the two words.

+apple +juice
Find rows that contain both words.

+apple macintosh
Find rows that contain the word 'apple', but rank rows higher if they also contain 'macintosh'.

+apple -macintosh
Find rows that contain the word 'apple' but not 'macintosh'.

+apple ~macintosh
Find rows that contain the word 'apple', but if the row also contains the word 'macintosh', rate it lower than if row does not. This is "softer" than a search for '+apple -macintosh', for which the presence of 'macintosh' causes the row not to be returned at all.

+apple +(>turnover >strudel)
Find rows that contain the words 'apple' and 'turnover', or 'apple' and 'strudel' (in any order), but rank 'apple turnover' higher than 'apple strudel'.

Find rows that contain words such as 'apple', 'apples', 'applesauce', or 'applet'.

"some words"
Find rows that contain the exact phrase 'some words' (for example, rows that contain 'some words of wisdom' but not "some noise words").

By continuing to use this site you agree to the use of cookies. For more information and to find out how to change this click here. Accept Cookies
Please enable cookies in your browser for this website.
Advanced search

Handling of TestWaitForDiagResponse Function (CANoe only)

Last updated: 2018-12-05

Return values:

Return value  Explanation
1 a response (positive or negative) has been received (P2 or P2* timeouts of ECU have not occurred)
0 the timeout specified in the TestWaitForTimeout has occurred
-92 Errors in the transport layer have occurred:
this is also the error code for P2 or P2* timeouts!
<0 errors in the diagnostic or transport layer have occurred.

You have to differentiate between this function’s timeout and P2 or P2* timeouts of the ECU. These are both independent timeouts. In case that a P2 or P2* timeout has occurred, the TestWaitForDiagResponse function will return -92 (even when the timeout specified in the function call has not occurred yet), in case of the occurrence of the specified timeout, the function will return 0. CANoe will consider the reception of „Response Pending“ responses from the ECU before returning a TP level error.

Hints for the calculation of the timeout parameter of the TestWaitForDiagResponse function:

It should be equal or larger than the P2 timing of the ECU, better at least the P2* timing. If it is too small, you can get timeouts even when the ECUs is conformant to its specification. Setting this value too high results in longer test execution time, but it matters only when responses are not sent by the ECU (frequently). You have to adjust this value to your situation.

Example code:

Diagrequest Door.SerialNumber_Read req;
byte buffer[4];
long ret,ret2,ret3;
ret = testWaitForDiagRequestSent(req, 2000); // Wait until the request has been completely sent 
if(ret == 1) // Request sent
  write("Request has been successfully sent");
  ret2=TestWaitForDiagResponse(req, 5000); // Wait for a response, here for 5000ms. Note: This is no P2 timeout!
  if(ret2==1)  // Response received
    if(ret3==-1) // It is a positive response
      buffer,elCount(buffer)); // Retrieve the serial number from the response
      write("Serial Number: 0x%02X%02X%02X%02X",
    else // It is a negative response
        write("Negative Response, NRC: 0x%02X",(byte)ret3);
   if(ret2==0)  // Timeout. No response received
     write("Timeout specified in TestWaitForDiagResponse expired");
   if(ret2<0)  // Error e.g. transport protocol level
     write("TP level error %d, probably P2 or P2* timeout", ret2);
     write("Error %d in the diagnostic or transport layer", ret2);
      write("Timeout expired while trying to send request");
      write("Internal error %d occured while trying to send request", ret);

Article Options
Views: 8392