Skip to content

IsoTpChannelOptions Class

Configuration for an IIsoTpChannel.

public sealed class IsoTpChannelOptions

Inheritance Object → IsoTpChannelOptions

Remarks

All values are set at channel creation time and treated as immutable for the channel's lifetime. Timeouts follow ISO 15765-2 §6.5 naming and their defaults are intentionally conservative (1 second each) so tests and virtual-loopback sessions never sit for the standard's much larger recommended values (e.g. 1000 ms N_As) when the transport itself is only microseconds slow. Production callers are expected to override the timing values that matter for their bus.

The ISO 15765-2 clause numbers cited here and in the channel and codec sources have not been reconciled to one edition of the standard or checked against its text; read them as pointers. This and the other open norm questions -- no N_Ar, where N_Cr starts, no TX_DL or BRS, STmin rounding, STmin before the first Consecutive Frame -- are listed in the package README (#353).

Fields

IsoTpChannelOptions.DefaultTimeout Field

Default value for NAs, NBs, NCr.

public static readonly TimeSpan DefaultTimeout;

Field Value

TimeSpan

Properties

IsoTpChannelOptions.LocalBlockSize Property

Block size (BS) advertised on Flow-Control frames sent by this channel while receiving multi-frame PDUs. 0 means "no additional FCs needed, send all remaining CFs".

public byte LocalBlockSize { get; init; }

Property Value

Byte

IsoTpChannelOptions.LocalStMin Property

STmin advertised on Flow-Control frames sent by this channel while receiving multi-frame PDUs. Encoded per ISO 15765-2 (0..127 ms in 1-ms steps, 100..900 µs in 100-µs steps) by EncodeStMin(TimeSpan), which can round a value down -- 190 µs is advertised as 100 µs; see there. Defaults to TimeSpan.Zero (no minimum separation requested). Must be non-negative — a negative value fails channel open via EncodeStMin(TimeSpan).

public System.TimeSpan LocalStMin { get; init; }

Property Value

TimeSpan

IsoTpChannelOptions.MaxReceivePduLength Property

Largest PDU this channel reassembles. A First Frame announcing more is answered with FC(OVFLW) and nothing is allocated for it (ISO 15765-2 §9.6.5.2: the receiver "does not have enough buffer"), so six bytes from any bus participant cannot make the process reserve the ~2 GB a CAN-FD escape First Frame may announce (#26). Defaults to 65 535 bytes; classic CAN transfers are bounded by the codec at 4095 regardless. Outbound SendAsync(ReadOnlyMemory<byte>, CancellationToken) is not bounded by this.

public int MaxReceivePduLength { get; init; }

Property Value

Int32

IsoTpChannelOptions.NAs Property

N_As — maximum time between the sender handing an SF/FF/CF to the driver and the driver confirming it was sent (ISO 15765-2 §6.5, corresponds to the FR-TP-010 acceptance criterion). Modelled here as the TX-confirmation timeout the channel uses when calling SendConfirmedAsync(CanFrame, Nullable<TimeSpan>, CancellationToken). It bounds the wait for the echo on an echo-capable bus and the wait for the driver to accept the frame on any other, so a stalled frame send always ends within it instead of blocking later sends on the channel. It is also the confirmation timeout of the Flow Control this channel sends while receiving. An unconfirmed Flow Control is reported through BackgroundExceptionOccurred and does not abort the reception: there is no N_Ar (an open ISO 15765-2 question, #353). Defaults to DefaultTimeout.

public System.TimeSpan NAs { get; init; }

Property Value

TimeSpan

IsoTpChannelOptions.NBs Property

N_Bs — maximum time between the sender's FF/last-CF-of-a-block and the peer's Flow Control (ISO 15765-2 §6.5). Expiring aborts the outgoing PDU with a timeout error (FR-TP-010). Defaults to DefaultTimeout.

public System.TimeSpan NBs { get; init; }

Property Value

TimeSpan

IsoTpChannelOptions.NCr Property

N_Cr — maximum time between two Consecutive Frames on the receive side (ISO 15765-2 §6.5). After a Flow Control it runs from the moment the channel queues that Flow Control for sending, not from its confirmation (an open ISO 15765-2 question, #353). Expiring aborts the incoming reassembly and faults a pending ReceiveAsync(CancellationToken) with IsoTpTimeoutException (FR-TP-010). Defaults to DefaultTimeout.

public System.TimeSpan NCr { get; init; }

Property Value

TimeSpan

IsoTpChannelOptions.PaddingByte Property

Byte used to pad SF/CF/FC frames when UsePadding is true, and to round a CAN-FD frame longer than 8 bytes up to its next valid data length when it is false (see UsePadding). Defaults to DefaultPaddingByte (0xCC).

public byte PaddingByte { get; init; }

Property Value

Byte

IsoTpChannelOptions.ReceiveBufferCapacity Property

Bounded capacity of the internal receive buffer that holds fully reassembled PDUs waiting for the consumer. When full, the oldest PDU is dropped so the RX loop never stalls. Defaults to 64.

public int ReceiveBufferCapacity { get; init; }

Property Value

Int32

Remarks

The drop is silent: no BackgroundExceptionOccurred is raised and nothing counts it, and a reassembly-abort fault queued for a receiver is dropped the same way. A channel nobody reads from therefore loses PDUs without a trace once this many have accumulated; a consumer that cannot keep up sizes the buffer or drains it.

IsoTpChannelOptions.UseCanFd Property

true to build ISO-TP frames as CAN-FD (up to 64-byte per frame); false for classic CAN (8-byte per frame). Must match the underlying ICanBus mode; if the bus is classic-CAN, true here will produce frames the driver rejects. The sender then fills frames up to 64 bytes; a smaller TX_DL cannot be configured, and the channel never sets a frame's bit-rate-switch (BRS) flag (an open ISO 15765-2 question, #353).

public bool UseCanFd { get; init; }

Property Value

Boolean

IsoTpChannelOptions.UsePadding Property

true to pad each frame to the next valid CAN/CAN-FD DLC step with PaddingByte; false to send the exact minimum payload. Many ISO 15765-2 stacks expect padding on classic CAN. On CAN-FD the data length of a frame can only be 0 to 8, 12, 16, 20, 24, 32, 48 or 64 bytes, so a frame that falls between two steps is always padded up to the next one (ISO 15765-2 requires that rounding), whatever this property says; it only decides whether frames of 8 bytes or fewer are padded as well.

public bool UsePadding { get; init; }

Property Value

Boolean

IsoTpChannelOptions.WftMax Property

WFTmax — maximum number of consecutive Wait FCs the sender is willing to accept before aborting (ISO 15765-2 §6.3, FR-TP-011). Defaults to 10.

public int WftMax { get; init; }

Property Value

Int32

Methods

IsoTpChannelOptions.With(Nullable<bool>, Nullable<bool>, Nullable<byte>, Nullable<byte>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<int>, Nullable<int>, Nullable<int>) Method

Convenience clone that returns a new instance with the provided overrides. Useful for tests that want to tweak one field of a shared default template.

public CanKit.Pro.IsoTp.IsoTpChannelOptions With(System.Nullable<bool> useCanFd=null, System.Nullable<bool> usePadding=null, System.Nullable<byte> paddingByte=null, System.Nullable<byte> localBlockSize=null, System.Nullable<System.TimeSpan> localStMin=null, System.Nullable<System.TimeSpan> nAs=null, System.Nullable<System.TimeSpan> nBs=null, System.Nullable<System.TimeSpan> nCr=null, System.Nullable<int> wftMax=null, System.Nullable<int> receiveBufferCapacity=null, System.Nullable<int> maxReceivePduLength=null);

Parameters

useCanFd Nullable<Boolean>

usePadding Nullable<Boolean>

paddingByte Nullable<Byte>

localBlockSize Nullable<Byte>

localStMin Nullable<TimeSpan>

nAs Nullable<TimeSpan>

nBs Nullable<TimeSpan>

nCr Nullable<TimeSpan>

wftMax Nullable<Int32>

receiveBufferCapacity Nullable<Int32>

maxReceivePduLength Nullable<Int32>

Returns

IsoTpChannelOptions