Table of Contents

Struct Signals

Namespace
Pamoja.Can
Assembly
Pamoja.Can.dll

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

byte

NotAvailable

The byte a J1939 sender writes for a signal it is not reporting.

public const byte NotAvailable = 255

Field Value

byte

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

data ReadOnlySpan<byte>

The frame's payload.

Returns

Signals

The payload, ready for its signals to be read out.

Exceptions

ArgumentException

data is 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

at int

The offset of the signal's first byte, 0 to 6.

value ushort

The 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

at int

The byte offset, 0 to 7.

value byte

The raw value, already scaled as the group defines.

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

at int

The offset of the signal's first byte.

Returns

ushort?

The raw value, or null if 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

at int

The byte offset.

Returns

byte?

The raw value, or null if the offset is past the payload.