Reble.ArduinoRouter 1.0.0

dotnet add package Reble.ArduinoRouter --version 1.0.0
                    
NuGet\Install-Package Reble.ArduinoRouter -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="Reble.ArduinoRouter" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reble.ArduinoRouter" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Reble.ArduinoRouter" />
                    
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 Reble.ArduinoRouter --version 1.0.0
                    
#r "nuget: Reble.ArduinoRouter, 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 Reble.ArduinoRouter@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=Reble.ArduinoRouter&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Reble.ArduinoRouter&version=1.0.0
                    
Install as a Cake Tool

Reble.ArduinoRouter

A .NET client library for Arduino Router which is a MessagePack RPC router for Arduino devices. The first device using this is the Arduino UNO Q

Installation

dotnet add package Reble.ArduinoRouter

Usage

Calling Methods

using Reble.ArduinoRouter;

var client = new ArduinoRouterClient();

// Call a method and get a typed response
var response = await client.CallAsync<int>("add", [5, 3]);
response.EnsureSuccess();
var result = response.DeserializePayload(); // 8

// Call without expecting a response payload
await client.CallAsync("set_led", [0, true]);

Providing Methods

Register your .NET application as a method provider:

using Reble.ArduinoRouter;

var client = new ArduinoRouterClient();

await foreach (var request in client.ProvideAsync<double>("multiply"))
{
    var factors = request.DeserializePayloadArray();
    var product = factors[0] * factors[1];

    //No need for Acknowledgement, the ProvideAsync method will handle it automatically
    // but if you want to add a response value, you can use the AcknowledgeAsync method
    await request.AcknowledgeAsync(product);
}

Error Handling

var response = await client.CallAsync<string>("some_method");

// Option 1: Check error explicitly
if (response.Error is { } error)
{
    Console.WriteLine($"Error: {error.Message} ({error.Type})");
}

// Option 2: Throw on error
response.EnsureSuccess(); // Throws ArduinoRouterResponseException if error

ASP.NET Core Integration

// Program.cs
builder.Services.AddScoped<IArduinoRouterClient, ArduinoRouterClient>();

// In endpoints
app.MapGet("/greet", async (IArduinoRouterClient client) =>
{
    var response = await client.CallAsync<string>("greet");
    //Throw on error will result in 500
    response.EnsureSuccess();
    return response.DeserializePayload();
});

Example

See Reble.ArduinoRouter.ApiExample for a running example on the Arduino UNO Q

Requirements

  • .NET 10.0 or later
  • Arduino Router running on the target device (communicates via Unix domain socket at /var/run/arduino-router.sock)

License

MIT

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.

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 120 1/22/2026