UdsClientOptions Class¶
Configuration for an IUdsClient. All values are captured at construction and treated as immutable for the client's lifetime.
Inheritance Object → UdsClientOptions
Remarks¶
Timing terminology follows ISO 14229-1 §7.3: - P2ClientMax is the default response window a tester waits after transmitting a request before treating the ECU as unresponsive. The specification's default is 50 ms; MVP defaults to 1 s to survive slow simulated ECUs and Windows-CI jitter, real-world callers should override. - P2StarClientMax is the extended window used after the ECU replied with NRC 0x78 (requestCorrectlyReceived-ResponsePending). Restarted for every further 0x78 (SRS FR-UDS-009). Defaults to 5 s. - MaxResponsePendingCount bounds how many 0x78 NRCs the client is willing to accept before it gives up. Defaults to 100 (large enough that any healthy ECU will finish first, small enough that a stuck ECU eventually fails loudly).
Fields¶
UdsClientOptions.DefaultP2 Field¶
Default P2ClientMax (1 second).
Field Value¶
UdsClientOptions.DefaultP2Star Field¶
Default P2StarClientMax (5 seconds).
Field Value¶
UdsClientOptions.DefaultTesterPresentPeriod Field¶
Default TesterPresentPeriod (2 seconds; below the ISO 14229 S3 default of 5 seconds).
Field Value¶
UdsClientOptions.SessionTimingMargin Field¶
What the client adds to the P2Server_max and P2*Server_max a successful DiagnosticSessionControl declares to obtain its own P2 and P2* for that session (50 ms; #340). ISO 14229-2 has P2Client_max = P2Server_max + ΔP2 and P2*Client_max = P2*Server_max + ΔP2_response, ΔP2 being the network's latency for the request and the response, and leaves its value to the network. 50 ms covers a CAN frame's time on the wire many times over and leaves room for a USB adapter's round trip and the host's scheduling. It is added to both, which for P2* is more than the standard asks for, and the result only ever lengthens P2ClientMax / P2StarClientMax, never shortens them.
Field Value¶
Properties¶
UdsClientOptions.BusyRepeatRequestDelay Property¶
The pause before a request is repeated after NRC 0x21. Default zero: the request is repeated at once, with a fresh P2 budget. Set it where the server's documentation asks for a delay before the repeat; the client does not derive one (#354).
Property Value¶
Remarks¶
The zero default is not taken from ISO 14229-1. A review recalled, from memory, that the standard has the repeat delayed by a time given in the implementation documents; that has not been checked against the text, and the default stays zero until it is (#354). A non-zero default would change when every caller's repeat goes out.
UdsClientOptions.KeepAliveSuppressPositiveResponse Property¶
When true, TesterPresent frames sent by the keep-alive helper use the ISO 14229-1
§7.5 "suppressPositiveResponse" bit (sub-function 0x80) so the ECU stays silent.
Defaults to true to keep the bus quiet.
Property Value¶
UdsClientOptions.MaxBusyRepeatRequests Property¶
How many times a request is repeated after NRC 0x21 (busyRepeatRequest) before the negative response is surfaced. The NRC exists to ask for a repeat (ISO 14229-1 §A.1), so the default repeats; zero surfaces the first 0x21 as an UdsNegativeResponseException (#57). Default 3.
Property Value¶
UdsClientOptions.MaxResponsePendingCount Property¶
Upper bound on consecutive NRC 0x78 responses; when the ECU sends more, the client fails
with a UdsProtocolException instead of waiting indefinitely. Defaults to
100.
Property Value¶
Remarks¶
It bounds a response window as well: an NRC 0x78 heard inside the window a suppressed send -- or, with QuarantineLateResponses, an abandoned request -- left for its service moves the window out by P2*, and at most this many do; the next request for the service is then held up for a bounded time by a peer that answers 0x78 for ever (#354).
UdsClientOptions.P2ClientMax Property¶
P2_Client_max — maximum time the client waits between sending a request and observing the first response frame from the ECU (positive, negative, or 0x78 responsePending). Expiring raises UdsTimeoutException with P2 (SRS FR-UDS-008). A successful DiagnosticSessionControl whose response declares a longer P2Server_max lengthens it for that session (see SessionTimingMargin); it never shortens it.
Property Value¶
UdsClientOptions.P2StarClientMax Property¶
P2*_Client_max — maximum time the client waits after receiving NRC 0x78 before treating the ECU as unresponsive. Restarted for every further 0x78 (SRS FR-UDS-009); once the budget is exhausted UdsTimeoutException with P2Star is raised. A successful DiagnosticSessionControl whose response declares a longer P2*Server_max lengthens it for that session (see SessionTimingMargin); it never shortens it.
Property Value¶
UdsClientOptions.QuarantineLateResponses Property¶
When true, a request that times out (UdsTimeoutException) or is
cancelled after it may have reached the bus quarantines its service for the P2* budget in
force, counted from the abort: the next request for that service is not sent until the
window has passed, and whatever arrives meanwhile is discarded -- among it the aborted
request's late positive answer, which for a repeated request (a polled DID) echoes the
same bytes as the next request's own and could not be told from it, and its NRC 0x78,
which would otherwise restart P2* for the next request. A 0x78 for the service inside
the window moves the window's end out by P2* from the 0x78's arrival: the server has
said its answer is still coming. Requests for other services are not held up (#340).
Property Value¶
Remarks¶
Defaults to false. The cost is a delay of up to P2* -- 5 s by default -- before
the next request for a service whose previous request was abandoned. A late answer
that arrives after the window is over is taken for the next request's, as it is
without the quarantine.
UdsClientOptions.TesterPresentPeriod Property¶
Default period for StartTesterPresentKeepAlive(Nullable<TimeSpan>). Defaults to 2 s (below the ISO 14229 default S3 timeout of 5 s so a single missed frame does not drop the session).
Property Value¶
Methods¶
UdsClientOptions.With(Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<int>, Nullable<TimeSpan>, Nullable<bool>, Nullable<int>, Nullable<TimeSpan>) Method¶
Convenience clone that returns a new instance with the provided overrides. Useful for tests that only want to tweak one field of a shared default template. Settings it takes no parameter for -- QuarantineLateResponses -- are carried over unchanged.
public CanKit.Pro.Uds.UdsClientOptions With(System.Nullable<System.TimeSpan> p2ClientMax=null, System.Nullable<System.TimeSpan> p2StarClientMax=null, System.Nullable<int> maxResponsePendingCount=null, System.Nullable<System.TimeSpan> testerPresentPeriod=null, System.Nullable<bool> keepAliveSuppressPositiveResponse=null, System.Nullable<int> maxBusyRepeatRequests=null, System.Nullable<System.TimeSpan> busyRepeatRequestDelay=null);
Parameters¶
p2ClientMax Nullable<TimeSpan>
p2StarClientMax Nullable<TimeSpan>
maxResponsePendingCount Nullable<Int32>
testerPresentPeriod Nullable<TimeSpan>
keepAliveSuppressPositiveResponse Nullable<Boolean>
maxBusyRepeatRequests Nullable<Int32>
busyRepeatRequestDelay Nullable<TimeSpan>