Skip to content

J1939SpnCatalog Class

Registry of J1939SpnDefinitions keyed by SPN number: decode received PGN payloads to physical values by SPN number instead of hand-written offsets/scales (FR-J1939-002 convenience layer). Default ships a small set of ubiquitous SAE J1939-71 parameters (EEC1/EEC2/CCVS); applications register the SPNs of their own profiles on top. Thread-safe for concurrent reads; registration is expected at setup time but is safe to do concurrently with reads.

public sealed class J1939SpnCatalog : System.Collections.Generic.IEnumerable<CanKit.Pro.J1939.J1939SpnDefinition>, System.Collections.IEnumerable

Inheritance Object → J1939SpnCatalog

Implements IEnumerable<J1939SpnDefinition>, IEnumerable

Properties

J1939SpnCatalog.Default Property

Catalog pre-populated with the common SAE J1939-71 SPNs below.

public static CanKit.Pro.J1939.J1939SpnCatalog Default { get; }

Property Value

J1939SpnCatalog

Methods

J1939SpnCatalog.Extract(ReadOnlySpan<byte>, int) Method

Decodes SPN spn from payload using the registered definition — a measurement, or the SAE J1939-71 §5.1.1 indicator the field carries instead. Throws KeyNotFoundException for unknown SPNs and ArgumentOutOfRangeException when the field exceeds the payload.

public CanKit.Pro.J1939.J1939SpnValue Extract(System.ReadOnlySpan<byte> payload, int spn);

Parameters

payload ReadOnlySpan<Byte>

spn Int32

Returns

J1939SpnValue

J1939SpnCatalog.Register(J1939SpnDefinition) Method

Registers (or replaces) a definition. Returns the catalog for chaining.

public CanKit.Pro.J1939.J1939SpnCatalog Register(CanKit.Pro.J1939.J1939SpnDefinition definition);

Parameters

definition J1939SpnDefinition

Returns

J1939SpnCatalog

J1939SpnCatalog.TryGet(int, J1939SpnDefinition) Method

Looks up a definition by SPN number.

public bool TryGet(int spn, out CanKit.Pro.J1939.J1939SpnDefinition? definition);

Parameters

spn Int32

definition J1939SpnDefinition

Returns

Boolean