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.
Property Value¶
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.
Parameters¶
payload ReadOnlySpan<Byte>
spn Int32
Returns¶
J1939SpnCatalog.Register(J1939SpnDefinition) Method¶
Registers (or replaces) a definition. Returns the catalog for chaining.
Parameters¶
definition J1939SpnDefinition
Returns¶
J1939SpnCatalog.TryGet(int, J1939SpnDefinition) Method¶
Looks up a definition by SPN number.
Parameters¶
spn Int32
definition J1939SpnDefinition