J1939SpnDefinition Class¶
Describes one Suspect Parameter Number (SPN) from a J1939 parameter group: where the field sits in the PGN payload and how to scale the raw value to a physical one (SAE J1939-71 §5.1.3). Used by J1939SpnCatalog to decode SPNs by number instead of by hand-written offsets (FR-J1939-002 convenience layer).
Inheritance Object → J1939SpnDefinition
Implements IEquatable<J1939SpnDefinition>
Constructors¶
J1939SpnDefinition(int, string, uint, int, int, int, double, double, string, bool) Constructor¶
Describes one Suspect Parameter Number (SPN) from a J1939 parameter group: where the field sits in the PGN payload and how to scale the raw value to a physical one (SAE J1939-71 §5.1.3). Used by J1939SpnCatalog to decode SPNs by number instead of by hand-written offsets (FR-J1939-002 convenience layer).
public J1939SpnDefinition(int Spn, string Name, uint Pgn, int ByteOffset, int StartBit, int BitLength, double Resolution, double Offset, string Unit, bool IsSigned=false);
Parameters¶
Spn Int32
The SPN number (SAE J1939-71).
Name String
Human-readable parameter name.
Pgn UInt32
PGN that carries the SPN (informational; the same SPN can in principle appear in more than one PGN — decode works on any payload).
ByteOffset Int32
Zero-based byte index of the field's first byte in the payload.
StartBit Int32
Zero-based bit index within ByteOffset (0 = LSB).
BitLength Int32
Field size in bits (1..64).
Resolution Double
Physical units per raw increment (scale factor).
Offset Double
Physical value at raw 0.
Unit String
Physical unit string (e.g. "rpm", "km/h", "%").
IsSigned Boolean
Whether the raw field is two's-complement signed (a signed SAE J1939-71 SLOT). Defaults to false; most SPNs are unsigned and express a negative physical range through Offset instead.
Properties¶
J1939SpnDefinition.BitLength Property¶
Field size in bits (1..64).
Property Value¶
J1939SpnDefinition.ByteOffset Property¶
Zero-based byte index of the field's first byte in the payload.
Property Value¶
J1939SpnDefinition.IsSigned Property¶
Whether the raw field is two's-complement signed (a signed SAE J1939-71 SLOT). Defaults to false; most SPNs are unsigned and express a negative physical range through Offset instead.
Property Value¶
J1939SpnDefinition.Name Property¶
Human-readable parameter name.
Property Value¶
J1939SpnDefinition.Offset Property¶
Physical value at raw 0.
Property Value¶
J1939SpnDefinition.Pgn Property¶
PGN that carries the SPN (informational; the same SPN can in principle appear in more than one PGN — decode works on any payload).
Property Value¶
J1939SpnDefinition.Resolution Property¶
Physical units per raw increment (scale factor).
Property Value¶
J1939SpnDefinition.Spn Property¶
The SPN number (SAE J1939-71).
Property Value¶
J1939SpnDefinition.StartBit Property¶
Zero-based bit index within ByteOffset (0 = LSB).
Property Value¶
J1939SpnDefinition.Unit Property¶
Physical unit string (e.g. "rpm", "km/h", "%").
Property Value¶
Methods¶
J1939SpnDefinition.Extract(ReadOnlySpan<byte>) Method¶
Decodes this SPN from a received PGN payload: physical = raw × Resolution + Offset
for a measurement, or the SAE J1939-71 §5.1.1 indicator the field carries instead
("not available", "error", reserved, parameter-specific).
Parameters¶
payload ReadOnlySpan<Byte>