Skip to content

J1939Message Struct

One application-layer SAE J1939 message: a parameter-group payload paired with the per-frame routing fields (Priority, PGN, source and destination address) an application needs to send or interpret it.

public readonly struct J1939Message : System.IEquatable<CanKit.Pro.J1939.J1939Message>

Implements IEquatable<J1939Message>

Remarks

Payload is the plain user PGN payload (the same bytes that would appear as SPN-bearing data on the bus). The node auto-routes it: payloads ≤ 8 bytes go on the wire as one direct 29-bit CAN frame (SRS FR-J1939-006 single-frame path); payloads > 8 bytes are transported through the SAE J1939-21 §5.10 transport protocol via the shared CanKit.Pro.J1939Tp channel — TP.BAM for a global destination, TP.CM for a specific destination.

DestinationAddress is significant only when the PGN's PF byte is a PDU1 (peer-to-peer) value (< 240). For PDU2 (broadcast-only) PGNs the destination is always GlobalAddress (0xFF) regardless of what is passed here.

Constructors

J1939Message(uint, ReadOnlyMemory<byte>, byte, byte, byte) Constructor

Constructs a message. payload is copied by the sender; callers may safely mutate or reuse the source buffer afterwards.

public J1939Message(uint pgn, System.ReadOnlyMemory<byte> payload, byte priority=6, byte sourceAddress=254, byte destinationAddress=byte.MaxValue);

Parameters

pgn UInt32

Parameter Group Number (18-bit).

payload ReadOnlyMemory<Byte>

The message payload (0..1785 bytes).

priority Byte

SAE J1939-21 priority (0..7, 0 = highest); defaults to 6, the conventional non-safety priority.

sourceAddress Byte

Node's own source address. For inbound messages, this is the remote sender's SA; for outbound sends, the node fills this in from its own claimed address, so any value passed here is ignored.

destinationAddress Byte

Destination address for PDU1 PGNs; ignored for PDU2 PGNs (always 0xFF on the wire). Defaults to GlobalAddress (0xFF).

Properties

J1939Message.DestinationAddress Property

Destination address for PDU1 PGNs, or 0xFF for PDU2/broadcast.

public byte DestinationAddress { get; }

Property Value

Byte

J1939Message.Payload Property

User payload bytes (no framing overhead).

public System.ReadOnlyMemory<byte> Payload { get; }

Property Value

ReadOnlyMemory<Byte>

J1939Message.Pgn Property

The Parameter Group Number (18-bit value; SAE J1939-21).

public uint Pgn { get; }

Property Value

UInt32

J1939Message.Priority Property

SAE J1939 priority (0..7, 0 = highest).

public byte Priority { get; }

Property Value

Byte

Remarks

Only the single-frame (payload ≤ 8 bytes) send path encodes this value into the 29-bit CAN ID directly. Multi-frame (> 8 bytes) sends go through the shared J1939-TP channel which uses its own Priority (default 7) for TP.CM / TP.DT frames — a per-send priority is not part of the current IJ1939TpChannel API surface (Copilot 3600424623). To control the wire priority of multi-frame traffic, set TransportOptions when opening the node.

J1939Message.SourceAddress Property

Source address (the sender's claimed address).

public byte SourceAddress { get; }

Property Value

Byte

J1939Message.WasMultiFrame Property

True when the wire transport was TP (Payload length > 8).

public bool WasMultiFrame { get; }

Property Value

Boolean