Oakrey.ASRockService.Common
2.0.2
dotnet add package Oakrey.ASRockService.Common --version 2.0.2
NuGet\Install-Package Oakrey.ASRockService.Common -Version 2.0.2
<PackageReference Include="Oakrey.ASRockService.Common" Version="2.0.2" />
<PackageVersion Include="Oakrey.ASRockService.Common" Version="2.0.2" />
<PackageReference Include="Oakrey.ASRockService.Common" />
paket add Oakrey.ASRockService.Common --version 2.0.2
#r "nuget: Oakrey.ASRockService.Common, 2.0.2"
#:package Oakrey.ASRockService.Common@2.0.2
#addin nuget:?package=Oakrey.ASRockService.Common&version=2.0.2
#tool nuget:?package=Oakrey.ASRockService.Common&version=2.0.2
Oakrey.ASRockService.Common
Project overview
Oakrey.ASRockService.Common is a .NET shared-contracts library for the ASRockService ecosystem.
It defines the service interface and data models used by both the ASRockService Windows service and any
client that communicates with it over SignalR. The package contains no implementation code � it is a
pure contracts assembly intended to be referenced by all layers.
Main features
IASRockService� service contract for controlling an ASRock motherboard:- Release the device
- Set PSU output state (on / off)
- Set the general output pin state
- Set a specific GPIO pin to output mode with a given state
- Set a specific GPIO pin to input mode
DeviceInfo� describes device-level configuration, including the autoload flag and a list ofPinInfoentriesPinInfo� describes a single GPIO pin: pin number, name, direction (input / output), and current state
Architecture
The package is one component of a three-part solution:
graph TD
A[ASRockService.Common<br>Contracts NuGet] --> B[ASRockService.Service<br>ASP.NET Core Windows Service<br>SignalR hub on port 4753]
A --> C[ASRockService.Tray<br>Windows Forms tray application<br>SignalR client]
B -- SignalR --> C
| Component | Type | Role |
|---|---|---|
ASRockService.Common |
.NET library (NuGet) | Shared contracts � IASRockService, DeviceInfo, PinInfo |
ASRockService.Service |
ASP.NET Core Windows service (net10.0-windows) |
Hosts the SignalR DeviceHub, drives the ASRock HAL, listens on http://*:4753 |
ASRockService.Tray |
Windows Forms library (net10.0-windows) |
System-tray UI and management client |
Requirements
- .NET 10
- The package itself has no platform restriction; the service and tray components require Windows
Installation
.NET CLI
dotnet add package Oakrey.ASRockService.Common
Package Manager Console
Install-Package Oakrey.ASRockService.Common
NuGet Package Manager
Search for Oakrey.ASRockService.Common in Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
Example usage
Implement IASRockService in a SignalR client to receive strongly-typed calls from the server:
using Oakrey.ASRockService.Common;
using Microsoft.AspNetCore.SignalR.Client;
HubConnection connection = new HubConnectionBuilder()
.WithUrl("http://localhost:4753/deviceHub")
.Build();
// Register a handler for a GPIO state notification pushed by the server
connection.On<int, bool>(nameof(IASRockService.SetGpioOutState), (pin, state) =>
{
Console.WriteLine($"Pin {pin} changed to {state}");
});
await connection.StartAsync();
// Invoke a method on the server
await connection.InvokeAsync(nameof(IASRockService.SetPsu), true, CancellationToken.None);
Use DeviceInfo and PinInfo to deserialize device configuration:
DeviceInfo config = new DeviceInfo(autoload: true)
{
PinConfigs =
[
new PinInfo(state: false, isInput: true, name: "GPIO71", pinNumber: 71),
new PinInfo(state: true, isInput: false, name: "GPIO72", pinNumber: 72),
]
};
Development notes
- Configuration is persisted as JSON in
%ProgramData%\ASRockDriver\config.asrconf. - The service registers itself as a Windows Service via
UseWindowsService()and logs to the Windows Event Log. - The hardware abstraction layer is provided by the
Oakrey.ASRockMotherboardpackage (not part of this contracts library). - The hardcoded device name in the service is
ASRock Motherboard IMB-1222-WV.
License
MIT � Copyright (c) Oakrey 2016-present
- Author: Oakrey
- Repository: https://dev.azure.com/oakrey/OpenPackages/_git/Drivers
- Project URL: http://www.oakrey.cz/opkg_drivers_asrock
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions 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. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Oakrey.ASRockService.Common:
| Package | Downloads |
|---|---|
|
Oakrey.ASRockService.Client
SignalR client library for ASRockService. Use AsRockFactory to connect to the ASRockService Windows service (port 4753, MessagePack protocol) and control ASRock motherboard GPIO pins, PSU, and output states. Exposes IASRockClient with read (HTTP) and write (SignalR hub) operations. Supports COM interop. |
GitHub repositories
This package is not used by any popular GitHub repositories.