Tellurian.Trains.Interfaces 1.0.0

Prefix Reserved
dotnet add package Tellurian.Trains.Interfaces --version 1.0.0
                    
NuGet\Install-Package Tellurian.Trains.Interfaces -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tellurian.Trains.Interfaces" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tellurian.Trains.Interfaces" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Tellurian.Trains.Interfaces" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tellurian.Trains.Interfaces --version 1.0.0
                    
#r "nuget: Tellurian.Trains.Interfaces, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tellurian.Trains.Interfaces@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tellurian.Trains.Interfaces&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Tellurian.Trains.Interfaces&version=1.0.0
                    
Install as a Cake Tool

Tellurian.Trains.Interfaces

Protocol-agnostic interfaces and types for model train control applications. Program against these abstractions to decouple your application from specific protocols (XpressNet, LocoNet, etc.).

Interfaces

ILocoControl

Control locomotives with speed, direction, and functions:

public interface ILocoControl
{
    Task<bool> DriveAsync(LocoAddress address, LocoDrive drive, CancellationToken cancellationToken = default);
    Task<bool> EmergencyStopAsync(LocoAddress address, CancellationToken cancellationToken = default);
    Task<bool> SetFunctionAsync(LocoAddress address, LocoFunction locoFunction, CancellationToken cancellationToken = default);
}

ILocoDecoder

Read and write decoder configuration variables (CVs):

public interface ILocoDecoder
{
    Task<byte> ReadCVAsync(ushort number, CancellationToken cancellationToken = default);
    Task WriteCVAsync(ushort number, byte value, CancellationToken cancellationToken = default);
}

Core Types

Type Description
LocoAddress DCC address (short 1-127, long 128-9999)
LocoDrive Speed and direction combined
LocoSpeed Speed value with step mode (14/27/28/126 steps)
LocoDirection Forward, Backward, or Unchanged
LocoFunction Function number (F0-F28) with on/off state
CV Configuration variable (number 1-1024, value 0-255)

Usage Example

using Tellurian.Trains.Interfaces.Locos;

// Create address and drive command
var address = LocoAddress.From(3);
var drive = new LocoDrive
{
    Speed = new LocoSpeed(64, SpeedSteps.S128),
    Direction = LocoDirection.Forward
};

// Use any ILocoControl implementation
await locoControl.DriveAsync(address, drive);

// Control functions
await locoControl.SetFunctionAsync(address, new LocoFunction(0, true)); // Lights on

Notifications

Subscribe to state changes via IObservable<Notification>:

  • LocoNotification - Locomotive state updates
  • ShortCircuitNotification - Track short circuit detected
  • MessageNotification - General system messages

Design Principles

  • Protocol independence - No protocol-specific details in interfaces
  • Type safety - Strong typing for addresses, speeds, functions
  • Async-first - All operations support cancellation tokens
  • Immutability - Value types are readonly structs
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 204 11/29/2025