Oakrey.ASRockMotherboard
2.0.4
dotnet add package Oakrey.ASRockMotherboard --version 2.0.4
NuGet\Install-Package Oakrey.ASRockMotherboard -Version 2.0.4
<PackageReference Include="Oakrey.ASRockMotherboard" Version="2.0.4" />
<PackageVersion Include="Oakrey.ASRockMotherboard" Version="2.0.4" />
<PackageReference Include="Oakrey.ASRockMotherboard" />
paket add Oakrey.ASRockMotherboard --version 2.0.4
#r "nuget: Oakrey.ASRockMotherboard, 2.0.4"
#:package Oakrey.ASRockMotherboard@2.0.4
#addin nuget:?package=Oakrey.ASRockMotherboard&version=2.0.4
#tool nuget:?package=Oakrey.ASRockMotherboard&version=2.0.4
Oakrey.ASRockMotherboard
Managed .NET wrapper for the ASRock IMB-1222 industrial motherboard native SDK (AsrCore.dll).
Targets Windows only. Provides a clean, interface-driven API for GPIO control and hardware telemetry
without exposing P/Invoke details to consumers.
Main features
- GPIO pin control for pins 71-77 and 80: read state, set input mode, set output high/low
- Read CPU core temperature and package temperature
- Read DC-in voltage
- Read board serial number
- Query native SDK version (
AsrCore.dll) - Motherboard compatibility check at construction time (manufacturer: ASRock, model: IMB-1222)
- Structured error model via
AsrExceptionand theErrorenum covering all SDK error codes
Architecture
classDiagram
class IAsrMotherboard {
+GetCoreCount() int
+GetCoreTemp() short
+GetPackageTemp() short
+GetDcInVoltage() double
+GetSerialNo() string
+GetDllVersion() Version
+GetGpioState(pin) bool
+IsGpioInput(pin) bool
+SetGpioInput(pin)
+SetGpioOutState(pin, value)
+Dispose()
}
class AsrMotherboard {
+Create() IAsrMotherboard
}
class ASRockNativeMethods {
<<static>>
P/Invoke to AsrCore.dll
}
class AsrException {
+Error Error
+ThrowIfError(bool)
+ThrowIfError(Error)
}
IAsrMotherboard <|.. AsrMotherboard
AsrMotherboard --> ASRockNativeMethods
AsrMotherboard --> AsrException
Key types:
| Type | Purpose |
|---|---|
IAsrMotherboard |
Public interface for all board operations |
AsrMotherboard |
Concrete implementation; use AsrMotherboard.Create() |
ASRockNativeMethods |
Internal P/Invoke declarations against AsrCore.dll |
AvailableGPIO |
Enum of supported GPIO pins (71-77, 80) |
AsrException |
Library-specific exception with structured Error code |
Error |
SDK error code enum (e.g. DllNotInitialized, InvalidParameter) |
Requirements
- Windows (x64)
- .NET 10
- ASRock IMB-1222 motherboard
AsrCore.dllpresent in the application output directory (included in the NuGet package)
Installation
.NET CLI
dotnet add package Oakrey.ASRockMotherboard
Package Manager Console
Install-Package Oakrey.ASRockMotherboard
AsrCore.dll is copied to the output directory automatically via the package's content files.
Usage
using Oakrey.ASRockMotherboard;
using IAsrMotherboard board = AsrMotherboard.Create();
// Telemetry
Console.WriteLine($"Core temp : {board.GetCoreTemp()} C");
Console.WriteLine($"Package temp : {board.GetPackageTemp()} C");
Console.WriteLine($"DC-in voltage: {board.GetDcInVoltage():F2} V");
Console.WriteLine($"Core count : {board.GetCoreCount()}");
Console.WriteLine($"Serial no. : {board.GetSerialNo()}");
Console.WriteLine($"SDK version : {board.GetDllVersionString()}");
// GPIO - read
bool state = board.GetGpioState(AvailableGPIO.GPIO71);
bool isInput = board.IsGpioInput(AvailableGPIO.GPIO71);
// GPIO - configure as output and drive high
board.SetGpioOutState(AvailableGPIO.GPIO72, true);
// GPIO - configure as input
board.SetGpioInput(AvailableGPIO.GPIO72);
AsrMotherboard.Create() throws AsrException if:
- the motherboard is not an ASRock IMB-1222
AsrCore.dllfails to initialize
All GPIO and telemetry methods also throw AsrException on SDK failure. Check AsrException.Error for
the specific Error code.
Development notes
AsrMotherboardconstructor sets all GPIO pins to input mode as a safe default.- P/Invoke uses
LibraryImport(source-generated marshalling) wherever possible, falling back toDllImportonly forGetSerialNumberdue to array marshalling. - The library uses
System.Management(WMI) to verify motherboard compatibility at startup. unsafeblocks are enabled in the project but are not required by the public API.
Project information
| Package ID | Oakrey.ASRockMotherboard |
| Author | Oakrey |
| License | MIT |
| Repository | https://dev.azure.com/oakrey/OpenPackages/_git/Drivers |
License
MIT. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Oakrey.Strings (>= 2.1.1)
- System.Management (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.