Skip to content

PdoMapping Class

A PDO mapping under construction: the ordered list of PdoMappingEntry values a PDO carries. Handed to ConfigureTpdo / ConfigureRpdo, which copy the entries into the node's mapping record; the node keeps no reference to this object, so mutating it afterwards has no effect on the configured PDO.

public sealed class PdoMapping

Inheritance Object → PdoMapping

Constructors

PdoMapping() Constructor

Constructs an empty mapping.

public PdoMapping();

PdoMapping(IEnumerable<PdoMappingEntry>) Constructor

Constructs a mapping from a copy of entries.

public PdoMapping(System.Collections.Generic.IEnumerable<CanKit.Pro.CANopen.Pdo.PdoMappingEntry> entries);

Parameters

entries IEnumerable<PdoMappingEntry>

Fields

PdoMapping.MaxEntries Field

Largest number of one-bit entries a PDO can hold.

public const int MaxEntries = 64;

Field Value

Int32

Properties

PdoMapping.Entries Property

Read-only view of the mapping entries. The view tracks later Add(PdoMappingEntry) / Clear() calls and allocates nothing per access.

public System.Collections.Generic.IReadOnlyList<CanKit.Pro.CANopen.Pdo.PdoMappingEntry> Entries { get; }

Property Value

IReadOnlyList<PdoMappingEntry>

PdoMapping.TotalBits Property

Sum of the mapped bit lengths, excluding final byte padding.

public int TotalBits { get; }

Property Value

Int32

PdoMapping.TotalBytes Property

Total assembled payload size in bytes across every mapping entry.

public int TotalBytes { get; }

Property Value

Int32

Methods

PdoMapping.Add(PdoMappingEntry) Method

Appends a new entry to the mapping.

public CanKit.Pro.CANopen.Pdo.PdoMapping Add(CanKit.Pro.CANopen.Pdo.PdoMappingEntry entry);

Parameters

entry PdoMappingEntry

Returns

PdoMapping

Exceptions

ArgumentOutOfRangeException
entry has a width the PdoMappingEntry constructor refuses — default(PdoMappingEntry), or an entry built past the constructor; the mapping is unchanged.

InvalidOperationException
The mapping would exceed 8 bytes or MaxEntries entries; the mapping is unchanged.

PdoMapping.Add(ushort, byte, byte) Method

Convenience overload of Add(PdoMappingEntry).

public CanKit.Pro.CANopen.Pdo.PdoMapping Add(ushort index, byte subindex, byte bitLength);

Parameters

index UInt16

subindex Byte

bitLength Byte

Returns

PdoMapping

PdoMapping.Clear() Method

Removes every mapped entry.

public void Clear();