C# bindings for the servicepoint library.
Find a file
Vinzenz Schroeter dcf8d12a8a
Some checks failed
Rust / build (push) Failing after 4m29s
remove redundant infos
2025-02-16 18:24:05 +01:00
.github/workflows build project in CI 2025-02-16 14:52:16 +01:00
ServicePoint fix example 2025-02-16 15:53:03 +01:00
servicepoint-binding-uniffi@1169d9f1d2 update submodule 2025-02-16 16:18:38 +01:00
ServicePoint.Example fix endless example runs in pipeline 2025-02-16 17:08:18 +01:00
ServicePoint.Tests move c# bindings into separate repository 2025-02-16 14:40:18 +01:00
uniffi-bindgen-cs remove redundant infos 2025-02-16 18:24:05 +01:00
.gitignore move c# bindings into separate repository 2025-02-16 14:40:18 +01:00
.gitmodules update submodule 2025-02-16 16:18:38 +01:00
Cargo.lock fix Cargo.lock 2025-02-16 16:59:16 +01:00
Cargo.toml move c# bindings into separate repository 2025-02-16 14:40:18 +01:00
CONTRIBUTING.md prepare move to forgejo 2025-02-08 14:52:45 +01:00
csharp.sln move c# bindings into separate repository 2025-02-16 14:40:18 +01:00
flake.lock move c# bindings into separate repository 2025-02-16 14:40:18 +01:00
flake.nix move c# bindings into separate repository 2025-02-16 14:40:18 +01:00
generate-binding.sh move c# bindings into separate repository 2025-02-16 14:40:18 +01:00
LICENSE Create LICENSE 2024-05-12 00:10:34 +02:00
README.md remove redundant infos 2025-02-16 18:24:05 +01:00
uniffi.toml move c# bindings into separate repository 2025-02-16 14:40:18 +01:00

ServicePoint

In CCCB, there is a big pixel matrix hanging on the wall. It is called "Service Point Display" or "Airport Display".

This crate contains C# bindings for the servicepoint library based on servicepoint-binding-uniffi.

F# is not tested. If there are usability or functionality problems, please open an issue.

Note on stability

This library is still in early development. You can absolutely use it, and it works, but expect minor breaking changes with every version bump.

Notes on differences to rust library

  • Performance will not be as good as the rust version:
    • most objects are reference counted.
    • objects with mutating methods will also have a MRSW lock
  • You will not get rust backtraces in release builds of the native code
  • Panic messages will work (PanicException)

Installation

Including this repository as a submodule and building from source is the recommended way of using the library.

git submodule add https://git.berlin.ccc.de/servicepoint/servicepoint-binding-csharp.git
git commit -m "add servicepoint-binding-csharp submodule"

After that, add a reference to the ServicePoint project in your .csproj and, if applicable, your .sln.

<ItemGroup>
    <ProjectReference Include="servicepoint-binding-csharp/ServicePoint/ServicePoint.csproj"/>
</ItemGroup>

That's it! You do not have to compile or copy the rust crate manually, as building ServicePoint.csproj also builds it.

Currently, the project file is hard-coded for Linux and will need tweaks for other platforms (e.g. .dylib instead of .so). Feel free to open an issue or a PR with whatever you OS expects.

Example

using System.Threading;
using ServicePoint;

var connection = new Connection("127.0.0.1:2342");
connection.Send(Command.Clear());

connection.Send(Command.Brightness(5));

var pixels = Bitmap.NewMaxSized();
for (ulong offset = 0; offset < ulong.MaxValue; offset++)
{
    pixels.Fill(false);

    for (ulong y = 0; y < pixels.Height(); y++)
        pixels.Set((y + offset) % pixels.Width(), y, true);

    connection.Send(Command.BitmapLinearWin(0, 0, pixels));
    Thread.Sleep(14);
}

A full example including project files is available as part of this crate.

Why is there no NuGet-Package?

NuGet packages are not a good way to distribute native binaries (relevant issue). Because of that, there is no NuGet package you can use directly.

Development

Run ./generate-binding.sh to regenerate the base library. The generated source file is checked in. The CI enforces that generated bindings do not change.

Everything else

Look at the main project README for further information.