Skip to content

UdsClientOptions Class

Configuration for an IUdsClient. All values are captured at construction and treated as immutable for the client's lifetime.

public sealed class UdsClientOptions

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).

public static readonly TimeSpan DefaultP2;

Field Value

TimeSpan

UdsClientOptions.DefaultP2Star Field

Default P2StarClientMax (5 seconds).

public static readonly TimeSpan DefaultP2Star;

Field Value

TimeSpan

UdsClientOptions.DefaultTesterPresentPeriod Field

Default TesterPresentPeriod (2 seconds; below the ISO 14229 S3 default of 5 seconds).

public static readonly TimeSpan DefaultTesterPresentPeriod;

Field Value

TimeSpan

Properties

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.

public bool KeepAliveSuppressPositiveResponse { get; init; }

Property Value

Boolean

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.

public int MaxResponsePendingCount { get; init; }

Property Value

Int32

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).

public System.TimeSpan P2ClientMax { get; init; }

Property Value

TimeSpan

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.

public System.TimeSpan P2StarClientMax { get; init; }

Property Value

TimeSpan

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).

public System.TimeSpan TesterPresentPeriod { get; init; }

Property Value

TimeSpan

Methods

UdsClientOptions.With(Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<int>, Nullable<TimeSpan>, Nullable<bool>) 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.

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);

Parameters

p2ClientMax Nullable<TimeSpan>

p2StarClientMax Nullable<TimeSpan>

maxResponsePendingCount Nullable<Int32>

testerPresentPeriod Nullable<TimeSpan>

keepAliveSuppressPositiveResponse Nullable<Boolean>

Returns

UdsClientOptions