Tellurian.Trains.Communications.Interfaces
1.8.0
Prefix Reserved
dotnet add package Tellurian.Trains.Communications.Interfaces --version 1.8.0
NuGet\Install-Package Tellurian.Trains.Communications.Interfaces -Version 1.8.0
<PackageReference Include="Tellurian.Trains.Communications.Interfaces" Version="1.8.0" />
<PackageVersion Include="Tellurian.Trains.Communications.Interfaces" Version="1.8.0" />
<PackageReference Include="Tellurian.Trains.Communications.Interfaces" />
paket add Tellurian.Trains.Communications.Interfaces --version 1.8.0
#r "nuget: Tellurian.Trains.Communications.Interfaces, 1.8.0"
#:package Tellurian.Trains.Communications.Interfaces@1.8.0
#addin nuget:?package=Tellurian.Trains.Communications.Interfaces&version=1.8.0
#tool nuget:?package=Tellurian.Trains.Communications.Interfaces&version=1.8.0
Tellurian.Trains.Communications.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
ILoco
Control locomotives and query their state:
public interface ILoco
{
Task<bool> DriveAsync(Address address, Drive drive, CancellationToken cancellationToken = default);
Task<bool> EmergencyStopAsync(Address address, CancellationToken cancellationToken = default);
Task<bool> SetFunctionAsync(Address address, Function locoFunction, CancellationToken cancellationToken = default);
Task<LocoInfo?> GetLocoInfoAsync(Address address, 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 |
|---|---|
Address |
DCC address (short 1-127, long 128-9999) |
Drive |
Speed and direction combined |
Speed |
Speed value with step mode (14/27/28/126 steps) |
Direction |
Forward or Backward |
Function |
Function number (F0-F28) with on/off state |
LocoInfo |
Current locomotive state (speed, direction, function states) as reported by the command station |
Usage Example
using Tellurian.Trains.Communications.Interfaces.Locos;
// Create address and drive command
var address = Address.From(3);
var drive = new Drive
{
Speed = Speed.Set126(64),
Direction = Direction.Forward
};
// Use any ILoco implementation
await loco.DriveAsync(address, drive);
// Control functions
await loco.SetFunctionAsync(address, Function.On(Functions.F0)); // Lights on
// Query current state from the command station
var info = await loco.GetLocoInfoAsync(address);
if (info is not null)
{
Console.WriteLine($"Speed: {info.Speed.CurrentStep}, Direction: {info.Direction}");
Console.WriteLine($"Lights: {info.FunctionStates[0]}");
}
Notifications
Subscribe to state changes via IObservable<Notification>:
LocoNotification- Locomotive state updatesAccessoryNotification- Accessory/turnout state changesOccupancyNotification- Track section occupancy (occupied/free)TransponderNotification- Transponder/RailCom locomotive presence detection (entering/leaving)RailComLocomotiveNotification- RailCom/LISSY locomotive identification with direction and classificationShortCircuitNotification- Track short circuit detectedMessageNotification- 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 | Versions 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. |
-
net10.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Tellurian.Trains.Communications.Interfaces:
| Package | Downloads |
|---|---|
|
Tellurian.Trains.Protocols.LocoNet
Package Description |
|
|
Tellurian.Trains.Protocols.XpressNet
Package Description |
|
|
Tellurian.Trains.Adapters.Z21
A .NET adapter for the Roco/Fleischmann Z21 digital command station. |
|
|
Tellurian.Trains.Adapters.LocoNet
A .NET adapter for LocoNet-based command stations via serial port |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.8.0 | 190 | 4/17/2026 |
| 1.7.15 | 161 | 4/16/2026 |
| 1.7.14 | 152 | 4/16/2026 |
| 1.7.13 | 157 | 4/16/2026 |
| 1.7.12 | 154 | 4/16/2026 |
| 1.7.11 | 163 | 4/15/2026 |
| 1.7.10 | 153 | 4/15/2026 |
| 1.7.9 | 158 | 4/15/2026 |
| 1.7.8 | 155 | 4/15/2026 |
| 1.7.7 | 151 | 4/15/2026 |
| 1.7.6 | 151 | 4/15/2026 |
| 1.7.5 | 153 | 4/15/2026 |
| 1.7.4 | 159 | 4/15/2026 |
| 1.7.3 | 282 | 3/28/2026 |
| 1.7.2 | 162 | 3/28/2026 |
| 1.7.1 | 169 | 3/27/2026 |
| 1.7.0 | 179 | 3/16/2026 |
| 1.6.1 | 180 | 2/22/2026 |
| 1.6.0 | 161 | 2/19/2026 |
| 1.5.0 | 166 | 2/11/2026 |