separate types for commands
Some checks failed
Rust / build (pull_request) Failing after 16s

This commit is contained in:
Vinzenz Schroeter 2025-06-16 16:41:46 +02:00
parent 13a34e83d7
commit 178ab1eb74
12 changed files with 2967 additions and 562 deletions

View file

@ -0,0 +1,15 @@
namespace ServicePoint;
public static class ConnectionExtensions
{
public static void Send(this IConnection connection, Packet packet) => connection.SendPacket(packet);
public static void Send(this IConnection connection, Command command) => connection.SendCommand(command);
public static void Send(this IConnection connection, IClearCommand command) => connection.SendPacket(command.AsPacket());
public static void Send(this IConnection connection, IFadeOutCommand command) => connection.SendPacket(command.AsPacket());
public static void Send(this IConnection connection, IBitmapCommand command) => connection.SendPacket(command.AsPacket());
public static void Send(this IConnection connection, IBitVecCommand command) => connection.SendPacket(command.AsPacket());
public static void Send(this IConnection connection, IBrightnessGridCommand command) => connection.SendPacket(command.AsPacket());
public static void Send(this IConnection connection, IHardResetCommand command) => connection.SendPacket(command.AsPacket());
public static void Send(this IConnection connection, ICharGridCommand command) => connection.SendPacket(command.AsPacket());
public static void Send(this IConnection connection, IGlobalBrightnessCommand command) => connection.SendPacket(command.AsPacket());
}

View file

@ -0,0 +1,14 @@
namespace ServicePoint;
public sealed class FakeConnection() : IConnection
{
public void SendCommand(Command command)
{
SendPacket(command.AsPacket());
}
public void SendPacket(Packet packet)
{
_ = packet.AsBytes();
}
}

View file

@ -23,7 +23,17 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>
<!-- generate C# bindings -->
<PropertyGroup>
<InvariantGlobalization>true</InvariantGlobalization>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<DirectPInvoke Include="servicepoint_binding_uniffi" />
<NativeLibrary Include="libservicepoint_binding_uniffi.so" />
</ItemGroup>
<!-- generate library to link against -->
<Target Name="BuildBindings" Condition="'$(Configuration)'=='Release'" BeforeTargets="PrepareForBuild">
<Exec Command="cargo build--manifest-path ../servicepoint-binding-uniffi/Cargo.toml --release"/>
</Target>
@ -33,14 +43,18 @@
<!-- include native binary in output -->
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<Content Include="../target/debug/libservicepoint_binding_uniffi.so" CopyToOutputDirectory="Always">
<Content Include="../servicepoint-binding-uniffi/target/debug/libservicepoint_binding_uniffi.so" CopyToOutputDirectory="Always">
<Link>libservicepoint_binding_uniffi.so</Link>
</Content>
<!-- Specify the path to search for libraries for AOT -->
<LinkerArg Include="-L../servicepoint-binding-uniffi/target/debug/libservicepoint_binding_uniffi.so" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Release'">
<Content Include="../target/release/libservicepoint_binding_uniffi.so" CopyToOutputDirectory="Always">
<Content Include="../servicepoint-binding-uniffi/target/release/libservicepoint_binding_uniffi.so" CopyToOutputDirectory="Always">
<Link>libservicepoint_binding_uniffi.so</Link>
</Content>
<!-- Specify the path to search for libraries for AOT -->
<LinkerArg Include="-L../servicepoint-binding-uniffi/target/release/libservicepoint_binding_uniffi.so" />
</ItemGroup>
<ItemGroup>

File diff suppressed because it is too large Load diff