Skip to content

J1939TpOptions Class

Configuration for a IJ1939TpChannel: J1939-21 §5.10 timing parameters, transmit priority, and per-channel bounds. All values are captured at channel construction time and treated as immutable for its lifetime.

public sealed class J1939TpOptions

Inheritance Object → J1939TpOptions

Remarks

The J1939-21 §5.10.2.4 recommended values are hard-coded defaults; production callers can override any subset via With(Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<byte>, Nullable<byte>, Nullable<int>). Every timer defaults to its standard value: - T1 = 750 ms — TP.DT gap timeout at the receiver. - T2 = 1250 ms — TP.CM CTS gap timeout at the sender after a data block. - T3 = 1250 ms — TP.CM RTS→CTS / EOM-ack gap timeout at the sender. - T4 = 1050 ms — TP.CM hold timeout at the originator after CTS(0) (§5.10.2.4). - Tr = 200 ms — receiver-side response deadline after emitting a CTS. - Th = 50 ms — hold-off between two consecutive BAM DTs (50..200 ms).

Properties

J1939TpOptions.MaxPacketsPerCts Property

Maximum number of TP.DT packets per CTS this channel advertises when it is the receiver of a TP.CM session. Must be in [1, 255] (0 is illegal: a CTS with numPackets=0 is the "hold connection open" form, not a real grant). Defaults to 16, well below the 255 hard cap so a slow consumer can keep the block short.

public byte MaxPacketsPerCts { get; init; }

Property Value

Byte

J1939TpOptions.Priority Property

TX priority for TP.CM / TP.DT frames sent by this channel (0..7, 0 = highest). J1939-21 uses 7 by default for its transport traffic.

public byte Priority { get; init; }

Property Value

Byte

J1939TpOptions.ReceiveBufferCapacity Property

Bounded capacity of the internal receive buffer that holds fully reassembled PDUs waiting for the consumer. Drops the oldest PDU when full so the RX pipeline never stalls the actor. Defaults to 32.

public int ReceiveBufferCapacity { get; init; }

Property Value

Int32

J1939TpOptions.T1 Property

T1 — TP.DT gap timeout at the receiver (J1939-21 §5.10.2.4). Default 750 ms.

public System.TimeSpan T1 { get; init; }

Property Value

TimeSpan

J1939TpOptions.T2 Property

T2 — CTS gap timeout at the sender after a data block (§5.10.2.4). Default 1250 ms.

public System.TimeSpan T2 { get; init; }

Property Value

TimeSpan

J1939TpOptions.T3 Property

T3 — RTS→CTS / EndOfMsgAck gap timeout at the sender (§5.10.2.4). Default 1250 ms.

public System.TimeSpan T3 { get; init; }

Property Value

TimeSpan

J1939TpOptions.T4 Property

T4 — originator-side hold timeout after a CTS with numPackets=0 ("hold connection open"). Per J1939-21 §5.10.2.4, lack of a follow-up CTS within T4 closes the connection. Default 1050 ms.

public System.TimeSpan T4 { get; init; }

Property Value

TimeSpan

J1939TpOptions.Th Property

Th — minimum hold-off between two consecutive BAM TP.DT frames on the wire (§5.10.3 "50..200 ms"). Default 50 ms to stay at the lower recommended bound while still gating against a receiver that cannot keep up.

public System.TimeSpan Th { get; init; }

Property Value

TimeSpan

J1939TpOptions.Tr Property

Tr — receiver response deadline after emitting a CTS (§5.10.2.4). Default 200 ms.

public System.TimeSpan Tr { get; init; }

Property Value

TimeSpan

Methods

J1939TpOptions.With(Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<byte>, Nullable<byte>, 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.J1939Tp.J1939TpOptions With(System.Nullable<System.TimeSpan> t1=null, System.Nullable<System.TimeSpan> t2=null, System.Nullable<System.TimeSpan> t3=null, System.Nullable<System.TimeSpan> t4=null, System.Nullable<System.TimeSpan> tr=null, System.Nullable<System.TimeSpan> th=null, System.Nullable<byte> priority=null, System.Nullable<byte> maxPacketsPerCts=null, System.Nullable<int> receiveBufferCapacity=null);

Parameters

t1 Nullable<TimeSpan>

t2 Nullable<TimeSpan>

t3 Nullable<TimeSpan>

t4 Nullable<TimeSpan>

tr Nullable<TimeSpan>

th Nullable<TimeSpan>

priority Nullable<Byte>

maxPacketsPerCts Nullable<Byte>

receiveBufferCapacity Nullable<Int32>

Returns

J1939TpOptions

Exceptions

ArgumentOutOfRangeException
Thrown when maxPacketsPerCts is 0.