Interface IAddressCodec
Encodes and decodes locomotive and accessory addresses in the Z21 wire representation.
public interface IAddressCodec
Methods
CombineAccessoryAddress(byte, byte)
ushort CombineAccessoryAddress(byte lsb, byte msb)
Parameters
Returns
CombineCvAddress(byte, byte)
Combines the high and low wire bytes of a CV address back into a CV address (0 = CV1).
ushort CombineCvAddress(byte msb, byte lsb)
Parameters
Returns
CombineExtAccessoryAddress(byte, byte)
Maps the RCN-213 RawAddress wire bytes of an extended accessory decoder back to the user-facing address (RawAddress 4 = user address 1).
ushort CombineExtAccessoryAddress(byte lsb, byte msb)
Parameters
Returns
EncodeAccessoryPomAddress(ushort, bool, byte)
Encodes an accessory decoder address for POM commands into the two wire bytes
aaaaa / AAAACDDD. When wholeDecoder is true the CV refers to the
whole decoder (CDDD = 0000); otherwise C = 1 and DDD = .output
(byte db1, byte db2) EncodeAccessoryPomAddress(ushort decoderAddress, bool wholeDecoder, byte output)
Parameters
Returns
SplitAccessoryAddress(ushort)
(byte lsb, byte msb) SplitAccessoryAddress(ushort address)
Parameters
addressushort
Returns
Exceptions
- ArgumentOutOfRangeException
Thrown when
addressis smaller than 1.
SplitAddressBigEndian(ushort)
Splits an address into its big-endian wire bytes (most-significant byte first), as used by the LAN_GET/SET_LOCOMODE and LAN_GET/SET_TURNOUTMODE settings commands.
(byte msb, byte lsb) SplitAddressBigEndian(ushort address)
Parameters
addressushort
Returns
SplitCvAddress(ushort)
Splits a CV address (0 = CV1) into its high and low wire bytes (no offset applied).
(byte msb, byte lsb) SplitCvAddress(ushort cvAddress)
Parameters
cvAddressushort
Returns
SplitExtAccessoryAddress(ushort)
Maps a user-facing extended accessory address (1-based) to its RCN-213 RawAddress wire bytes (user address 1 = RawAddress 4).
(byte lsb, byte msb) SplitExtAccessoryAddress(ushort address)
Parameters
addressushort
Returns
Exceptions
- ArgumentOutOfRangeException
Thrown when
addressis smaller than 1.
SplitLocoAddress(ushort)
(byte lsb, byte msb) SplitLocoAddress(ushort address)
Parameters
addressushort
Returns
SplitPomCvAddress(ushort)
Splits a CV address (0 = CV1) for a POM (main-track) command into the two high MM option
bits (folded into the DB3 option byte) and the CVAdr_LSB wire byte. POM addresses
CVs through a 10-bit field, so only CV addresses 0..1023 (CV1..CV1024) are representable.
(byte cvHighBits, byte cvLsb) SplitPomCvAddress(ushort cvAddress)
Parameters
cvAddressushort
Returns
Exceptions
- ArgumentOutOfRangeException
Thrown when
cvAddressexceeds 1023.