Struct Signals
The eight data bytes of a J1939 frame, addressed by the signals inside them.
public struct Signals
- Inherited Members
Remarks
A parameter group places each signal at a fixed byte offset, little-endian. A payload starts with every signal marked not available, so a controller writes only the signals it actually reports.
Fields
BroadcastAddress
The destination address every node on the bus reads.
public const byte BroadcastAddress = 255
Field Value
NotAvailable
The byte a J1939 sender writes for a signal it is not reporting.
public const byte NotAvailable = 255
Field Value
Methods
From(ReadOnlySpan<byte>)
Reads the eight data bytes of a frame that arrived off the bus.
public static Signals From(ReadOnlySpan<byte> data)
Parameters
dataReadOnlySpan<byte>The frame's payload.
Returns
- Signals
The payload, ready for its signals to be read out.
Exceptions
- ArgumentException
datais not exactly eight bytes.
New()
Builds a payload with every signal marked not available.
public static Signals New()
Returns
- Signals
Eight bytes a controller writes only its own signals into.
SetU16(int, ushort)
Writes a two-byte little-endian signal at the offset its group defines.
public void SetU16(int at, ushort value)
Parameters
atintThe offset of the signal's first byte, 0 to 6.
valueushortThe raw value, already scaled as the group defines.
SetU8(int, byte)
Writes a one-byte signal at the offset its parameter group defines.
public void SetU8(int at, byte value)
Parameters
ToArray()
The eight data bytes, ready to put in a frame.
public readonly byte[] ToArray()
Returns
- byte[]
The payload in wire order.
U16(int)
Reads a two-byte little-endian signal at the offset its group defines.
public readonly ushort? U16(int at)
Parameters
atintThe offset of the signal's first byte.
Returns
- ushort?
The raw value, or
nullif the signal would run past the payload.
U8(int)
Reads a one-byte signal at the offset its parameter group defines.
public readonly byte? U8(int at)
Parameters
atintThe byte offset.
Returns
- byte?
The raw value, or
nullif the offset is past the payload.