Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
run: dotnet restore src/Z21.sln

- name: Build (Release)
run: dotnet build src/Z21.sln --no-restore --configuration Release
run: dotnet build src/Z21.sln --no-restore --configuration Release -p:PublicRelease=true

- name: Test
run: dotnet test src/Z21.sln --no-build --configuration Release --verbosity normal

- name: Pack
run: dotnet pack src/Z21.sln --no-build --configuration Release --output ./nupkgs
run: dotnet pack src/Z21.sln --no-build --configuration Release -p:PublicRelease=true --output ./nupkgs

- name: Upload packages artifact
uses: actions/upload-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
<PackageId>CommandStation.Abstractions</PackageId>
Expand All @@ -15,6 +14,11 @@
<PackageTags>ModelRailway;CommandStation;DCC;Abstractions</PackageTags>
<RepositoryUrl>https://github.com/jaak0b/Z21</RepositoryUrl>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions src/CommandStation.Abstractions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CommandStation.Abstractions

The protocol- and transport-neutral contracts shared by the model-railway command-station
libraries. It has no dependency on any particular command station or wire format, so you
can code against the interfaces and swap implementations underneath.

It defines the domain API (`ICommandStation` plus capability interfaces like `ILocoControl`,
`IAccessoryControl`, `ITrackPowerControl` and `ISystemInfoProvider`), the transport and
framing abstractions (`ITransport`, `IFrameReader`), and the shared domain model
(`LocoInfoData`, `SystemState`, `DccSpeedMode`, and friends).

You normally don't install this directly — it comes in as a dependency of an
implementation such as [Z21](https://www.nuget.org/packages/Z21). Reach for it when you
want to write code (or your own command station) against the neutral abstractions.

See the [project page](https://github.com/jaak0b/Z21). Licensed under GPL-3.0.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<LangVersion>12</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<RootNamespace>CommandStation.Transport.Udp</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
<PackageId>CommandStation.Transport.Udp</PackageId>
Expand All @@ -16,8 +15,13 @@
<PackageTags>ModelRailway;CommandStation;UDP;Transport</PackageTags>
<RepositoryUrl>https://github.com/jaak0b/Z21</RepositoryUrl>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CommandStation.Abstractions\CommandStation.Abstractions.csproj" />
</ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/CommandStation.Transport.Udp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CommandStation.Transport.Udp

A UDP implementation of `ITransport` from
[CommandStation.Abstractions](https://www.nuget.org/packages/CommandStation.Abstractions).
It's the raw byte pipe the command-station libraries send and receive frames over.

Most people never use this directly — the [Z21](https://www.nuget.org/packages/Z21) DI
packages wire it up for you. Pull it in on its own only if you're composing the transport
by hand or building another command station on top of the shared abstractions.

See the [project page](https://github.com/jaak0b/Z21). Licensed under GPL-3.0.
19 changes: 19 additions & 0 deletions src/Z21.Autofac/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Z21.Autofac

Autofac wiring for the [Z21](https://www.nuget.org/packages/Z21) client. If you use
Autofac instead of Microsoft.Extensions.DependencyInjection, this package gives you the
same one-line setup: register the command station, the UDP transport and all protocol
handlers, then resolve `IZ21CommandStation`.

```csharp
var builder = new ContainerBuilder();
builder.AddZ21(t => t.RemoteEndPoint = new IPEndPoint(IPAddress.Parse("192.168.0.111"), 21105));

var container = builder.Build();
var station = container.Resolve<IZ21CommandStation>();

await station.ConnectAsync();
await station.TrackPowerOnAsync();
```

See the [project page](https://github.com/jaak0b/Z21) for the full API. Licensed under GPL-3.0.
3 changes: 2 additions & 1 deletion src/Z21.Autofac/Z21.Autofac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<TargetFrameworks>net8.0;net8.0-windows</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Jakob Eichberger</Authors>
<RepositoryUrl>https://github.com/jaak0b/Z21</RepositoryUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>

Expand All @@ -24,6 +24,7 @@

<ItemGroup>
<None Include="LICENSE" Pack="true" PackagePath="" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions src/Z21.Client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Z21

A small, event-driven .NET client for the ROCO/Fleischmann **Z21** digital command
station. It speaks the Z21 LAN protocol (V1.13) over UDP, so you can drive locomotives,
throw turnouts, switch track power, read CVs and query system state — and get typed
events back whenever something changes on the layout.

```csharp
station.LocoInfoReceived += (_, loco) =>
Console.WriteLine($"loco {loco.LocoAddress} now at speed {loco.LocoSpeed}");

await station.ConnectAsync();
await station.TrackPowerOnAsync();
await station.DriveAsync(3, DccSpeedMode.Steps128, DrivingDirection.Forward, 40);
```

You get an `IZ21CommandStation` from the DI container. To wire it up, add one of the
companion packages: **Z21.DependencyInjection** (Microsoft.Extensions.DependencyInjection)
or **Z21.Autofac** (Autofac). Both expose a single `AddZ21(...)` call.

The full command/response support matrix and protocol notes live on the
[project page](https://github.com/jaak0b/Z21). Licensed under GPL-3.0.
3 changes: 2 additions & 1 deletion src/Z21.Client/Z21.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
<Title>Z21</Title>
Expand All @@ -17,12 +16,14 @@
<TargetFrameworks>net8.0;net8.0-windows</TargetFrameworks>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RootNamespace>Z21</RootNamespace>
<PackageId>Z21</PackageId>
</PropertyGroup>

<ItemGroup>
<None Include="LICENSE" Pack="true" PackagePath="" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 20 additions & 0 deletions src/Z21.DependencyInjection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Z21.DependencyInjection

Microsoft.Extensions.DependencyInjection wiring for the [Z21](https://www.nuget.org/packages/Z21)
client. One call registers the command station, the UDP transport and every protocol
handler, so you can resolve `IZ21CommandStation` and start talking to your Z21.

```csharp
var services = new ServiceCollection();
services.AddZ21(t => t.RemoteEndPoint = new IPEndPoint(IPAddress.Parse("192.168.0.111"), 21105));

await using var provider = services.BuildServiceProvider();
var station = provider.GetRequiredService<IZ21CommandStation>();

await station.ConnectAsync();
await station.DriveAsync(3, DccSpeedMode.Steps128, DrivingDirection.Forward, 40);
```

`AddZ21` also takes an optional second configurator for protocol options such as the
broadcast flags to subscribe to. See the [project page](https://github.com/jaak0b/Z21)
for details. Licensed under GPL-3.0.
3 changes: 2 additions & 1 deletion src/Z21.DependencyInjection/Z21.DependencyInjection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<TargetFrameworks>net8.0;net8.0-windows</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
<Authors>Jakob Eichberger</Authors>
<RepositoryUrl>https://github.com/jaak0b/Z21</RepositoryUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>

Expand All @@ -20,6 +20,7 @@

<ItemGroup>
<None Include="LICENSE" Pack="true" PackagePath="" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading