Table of Contents

Interface IProgrammingControl

Namespace
CommandStation
Assembly
CommandStation.Abstractions.dll

Reading and writing decoder configuration variables (CVs) in direct mode on the programming track. CV addresses are 0-based (0 = CV1).

public interface IProgrammingControl

Methods

ReadCvAsync(ushort)

Task ReadCvAsync(ushort cvAddress)

Parameters

cvAddress ushort

Returns

Task

ReadCvAsync(ushort, TimeSpan)

Reads a CV on the programming track, retrying while the decoder does not acknowledge, and returns the value. A missing acknowledgement that never clears (for example an absent or unreadable decoder) is reported as a timeout rather than a distinct error. Do not call the fire-and-forget CV methods concurrently with this one on the same station.

Task<byte> ReadCvAsync(ushort cvAddress, TimeSpan timeout)

Parameters

cvAddress ushort
timeout TimeSpan

Returns

Task<byte>

Exceptions

CvOperationTimeoutException

No result arrived within timeout.

CvShortCircuitException

The command station reported a short circuit.

ArgumentOutOfRangeException

timeout is not a positive, in-range duration.

WriteCvAsync(ushort, byte)

Task WriteCvAsync(ushort cvAddress, byte value)

Parameters

cvAddress ushort
value byte

Returns

Task

WriteCvAsync(ushort, byte, TimeSpan)

Writes a CV on the programming track, retrying while the decoder does not acknowledge, and completes once the command station acknowledges the write (LAN_X_CV_RESULT). A missing acknowledgement that never clears is reported as a timeout. Do not call the fire-and-forget CV methods concurrently with this one on the same station.

Task WriteCvAsync(ushort cvAddress, byte value, TimeSpan timeout)

Parameters

cvAddress ushort
value byte
timeout TimeSpan

Returns

Task

Exceptions

CvOperationTimeoutException

The write was not acknowledged within timeout.

CvShortCircuitException

The command station reported a short circuit.

ArgumentOutOfRangeException

timeout is not a positive, in-range duration.

Events

CvProgrammingFailed

event EventHandler<CvProgrammingError>? CvProgrammingFailed

Event Type

EventHandler<CvProgrammingError>

CvReadCompleted

event EventHandler<CvValue>? CvReadCompleted

Event Type

EventHandler<CvValue>