Skip to main content

on diagRequest

Valid for: CANoe DE Note: The following syntax forms require a defined target ECU by calling diagSetTarget(char ecuQualifier[]) beforehand. When using these forms, no semantic check can be performed at compile-time, so no warnings will be emitted for nonexistent diagRequests.
  • form 1
  • form 2
  • form 3
  • form 4

Function Syntax

on diagRequest

Description

In case Additional Diagnostic Descriptions are configured for the ECU, the first description with a matching definition for the PDU is searched in the interpretation order. Otherwise, the diagnostic description assigned to the simulation is used immediately. Then the first matching event procedure (top-down) is called.
  • on diagRequest <service> // form 1
    • Is called when a request is received in the ECU simulation that belongs to the indicated diagnostic service.
  • on diagRequest <class>::* // form 2
    • Is called when the service of the request received belongs to the specified class.
    • This procedure may therefore be called for several services!
  • on diagRequest <class>::<instance>::* // form 3
    • Is called when the service of the request received belongs to the specified class and instance.
    • This procedure may therefore be called for several services!
  • on diagRequest * // form 4
    • Is called when no other event procedure matches.
    • This procedure may therefore be called for several services!
  • on diagRequest ECU.<service> // form 5
    • Is called when a request is received in the ECU simulation that belongs to the indicated diagnostic service.
  • on diagRequest ECU.<class>::* // form 6
    • Is called when a request is received in the ECU simulation and belongs to the specified class.
    • This procedure may therefore be called for several services!
  • on diagRequest ECU.<class>::<instance>::* // form 7
    • Is called when a request is received in the ECU simulation and belongs to the specified class and instance.
    • This procedure may therefore be called for several services!
  • on diagRequest ECU.* // form 8
    • Is called when a request is received in the ECU simulation and no other event procedure matches.
    • This procedure may therefore be called for several services!
Note: Please note that, after every sending of a request, all responses are signaled only to the sender. Diagnostic requests that are sent from the Diagnostic Console are thus invisible for a CAPL program as are the received responses. Similarly, no responses to requests sent from a CAPL program are displayed in the Diagnostic Console. When the procedure is called in the analysis branch of the Measurement Setup, only a fraction of the diagnostic functions is available. Please refer to Diagnostics Event Handlers in Measurement Setup for details. The event must be forwarded with output(this) if processing shall continue in blocks of the Measurement Setup.
(1) While the CANdela process knows the concept of a “diagnostic instance”, ODX does not. Starting with CANoe 7.0 it is possible to use new unique service qualifiers, while CAPL programs for earlier CANoe versions might indicate the equivalent long qualifier path. It is not recommended to mix these forms of declaration!

Example

Example 1 Simulation Setup
Example 2 Measurement Setup
Example 3 Starting with CANoe DE product 9.0 SP3 The CAPL compiler supports diagnostic objects that are declared with an ECU qualifier or target (like a functional group). This allows the compiler to check if the diagnostic service used to initialize the object is defined in the diagnostic description of the ECU/target. If not, a compile error will be reported.
Example 4 Specifying a target in the declaration of a diagnostic object has the benefit that it is NOT necessary to call DiagSetTarget, and it is possible to communicate with several targets in parallel.
Example 5 Also, mixing diagnostic requests from a master description and any of its additional descriptions is possible without setting a target.