Two questions concerning the TesterPresent message sent automatically in some sessions:
1. The message sent is "3E 80" i.e. with "suppress positive response message" flag set if I understood the documentation correctly. How to setup the UDA API so that "3E 00" is sent instead?
2. What is the correct way of checking on the TesterPresent server response? For example if I start a session and TesterPresent is sent automatically , then I unplug the ECU, is there a way of detecting that response to TesterPresent are not coming anymore ?
1. The automatic TesterPresent mechanism was only designed to keep alive non-default diagnostic session without interaction of the user. It is not possible to change the parameter of the service.
2. You want to check if an ECU is alive which is not the goal of the automatic TesterPresent (as it assumes the ECU is up, since the session was successfully changed).
If you consider that the automatic TesterPresent mechanism polutes the CAN bus with intempestive UDS messages, you should disable it and handle by yourselft a way to state if an ECU is alive:
for instance, you can do so with a thread that periodically transmits a TesterPresent request and use the WaitForService function to get the response.
Thanks for the quick answer. I was hoping to squeeze some functionalities out of TesterPresent without having to write them myself, however it seems it's not going to work.
I'll disable it according to other messages in this forum and implement my own solution.