Oakrey.ASRockService.Client 2.0.5

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

Oakrey.ASRockService.Client

Project overview

Oakrey.ASRockService.Client is a .NET library that provides a strongly-typed client for the ASRockService Windows service. It connects to the service over two channels: a SignalR hub (MessagePack protocol) for write/control operations, and a plain HTTP REST API for state reads. The primary entry point for consumers is the static AsRockFactory class.

Main features

Type Role
AsRockFactory Static factory � the only public way to create a connected client instance
IASRockClient Client contract: connect, read state (PSU, output, GPIO pins), write state, release
ASRockClient Internal implementation; manages SignalR and HTTP connections
HubClientConnection Builds the HubConnection with MessagePack protocol
HubConnectionExtensions Extension method ConnectAsync with connection-ID validation

Transport split

  • Write operations (SetPsu, SetOut, SetGpioOutState, SetGpioInput, ReleaseDevice) � SignalR hub invocation
  • Read operations (GetPsuState, GetOutState, GetPinState, IsPinInput) � HTTP GET to the REST API

Architecture

graph TD
    Consumer --> AsRockFactory
    AsRockFactory --> ASRockClient
    ASRockClient -->|SignalR MessagePack<br>port 4753 /devicehub| Service[ASRockService\nWindows Service]
    ASRockClient -->|HTTP GET<br>port 4753 /api/devicelist| Service

Requirements

  • .NET 10
  • ASRockService Windows service running and reachable on localhost:4753
  • NuGet dependencies: Microsoft.AspNetCore.SignalR.Client, Microsoft.AspNetCore.SignalR.Protocols.MessagePack, Oakrey.ASRockService.Common, Oakrey.Log

Installation

.NET CLI

dotnet add package Oakrey.ASRockService.Client

Package Manager Console

Install-Package Oakrey.ASRockService.Client

NuGet Package Manager

Search for Oakrey.ASRockService.Client in Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

Example usage

Connect and control

using Oakrey.ASRockService.Client;

// Connect � throws InvalidOperationException if the service is not reachable
await using IASRockClient client = await AsRockFactory.GetDevice(CancellationToken.None);

// Read state via HTTP
bool psuOn  = await client.GetPsuState(CancellationToken.None);
bool outOn  = await client.GetOutState(CancellationToken.None);
bool pinOn  = await client.GetPinState(71, CancellationToken.None);
bool isIn   = await client.IsPinInput(71, CancellationToken.None);

// Write via SignalR
await client.SetPsu(true, CancellationToken.None);
await client.SetOut(false, CancellationToken.None);
await client.SetGpioOutState(72, true, CancellationToken.None);
await client.SetGpioInput(73, CancellationToken.None);

// Release the device (stops the SignalR connection)
await client.ReleaseDevice(CancellationToken.None);

Cancellation and timeout

using CancellationTokenSource cts = new(TimeSpan.FromSeconds(5));
await using IASRockClient client = await AsRockFactory.GetDevice(cts.Token);
await client.SetPsu(true, cts.Token);

Development notes

  • ASRockClient has an internal constructor � instantiate only via AsRockFactory.GetDevice.
  • The host is hardcoded to localhost and the port to 4753. There is no public constructor or options class to override these; changing them requires modifying ASRockClient directly.
  • The HTTP client uses a 2000 ms timeout. Ensure the service is fully started before calling GetDevice.
  • IASRockClient is decorated with [Guid, ComVisible(true)] and can be consumed from COM clients.
  • Dispose on ASRockClient calls ReleaseDevice synchronously with a 2000 ms timeout; prefer calling ReleaseDevice explicitly before disposal in async code.

License

MIT � Copyright (c) Oakrey 2016-present

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
2.0.5 119 7/14/2026
2.0.4 121 5/22/2026
2.0.3 109 5/15/2026
2.0.2 106 5/14/2026
2.0.1 146 2/2/2026
2.0.0 263 7/8/2025
1.0.0 271 5/28/2025