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.
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 written into the identifier only for a PDU1 (peer-to-peer) PGN, whose PF byte is < 240. A PDU2 PGN's PS byte is its group extension, so a single frame of one goes out with no destination at all, whatever is passed here. A payload over 8 bytes is routed by DestinationAddress for either format: GlobalAddress (0xFF) sends a TP.BAM, any other value a TP.CM session to that address.
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: in the identifier of a PDU1 PGN; for a PDU2 PGN used only to route a payload over 8 bytes (a TP.CM session to that address instead of a TP.BAM). Defaults to GlobalAddress (0xFF).
Properties¶
J1939Message.DestinationAddress Property¶
Destination address. Inbound: the PDU1 destination, or a reassembled transfer's (0xFF for a TP.BAM); 0xFF for a PDU2 single frame. Outbound: see the remarks on the type.
Property Value¶
J1939Message.Payload Property¶
User payload bytes (no framing overhead).
Property Value¶
J1939Message.Pgn Property¶
The Parameter Group Number (18-bit value; SAE J1939-21).
Property Value¶
J1939Message.Priority Property¶
SAE J1939 priority (0..7, 0 = highest).
Property Value¶
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).
Property Value¶
J1939Message.WasMultiFrame Property¶
True when the wire transport was TP (Payload length > 8).
Property Value¶
Methods¶
J1939Message.Equals(object) Method¶
Indicates whether this instance and a specified object are equal.
Parameters¶
obj Object
The object to compare with the current instance.
Returns¶
Boolean
true if obj and this instance are the same type and represent the same value; otherwise, false.
J1939Message.GetHashCode() Method¶
Returns the hash code for this instance.
Returns¶
Int32
A 32-bit signed integer that is the hash code for this instance.