CanHub.Core 1.0.1

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

CanHub.Core

简体中文

NuGet .NET 10 License: MIT

CanHub.Core provides the coordination layer for CanHub applications: DI registration, adapter lookup, endpoint parsing, scanning fan-out, frame broadcasting, and configuration conflict helpers. It depends on CanHub.Abstractions, but not on vendor SDKs.

Install

dotnet add package CanHub.Core

Add at least one adapter package, such as CanHub.Adapter.Virtual, CanHub.Adapter.Vector, or CanHub.Adapter.Zlg, before opening endpoints.

Register Adapters With DI

Use DI when the host application already has a service container. Console applications that create their own provider may also need to reference Microsoft.Extensions.DependencyInjection.

using CanHub;
using CanHub.Adapter.Virtual;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddCanHub()
    .AddVirtualAdapter();

using var provider = services.BuildServiceProvider();
var registry = provider.GetRequiredService<CanHubRegistry>();

Adapters are registered explicitly. CanHub does not use reflection-based package auto-discovery.

For small tools and tests, a direct registry is also available:

using CanHub;
using CanHub.Adapter.Virtual;

var registry = CanHubRegistry.CreateDefault()
    .AddVirtualAdapter();

Open A Bus

var endpoint = CanEndpoint.Create("virtual", "demo", channelIndex: 0);

await using var bus = await registry.OpenAsync(
    endpoint,
    new CanOpenOptions { BusParameters = CanBusParameters.Classic500k },
    CancellationToken.None);

using var subscription = bus.Subscribe(new CanSubscriptionOptions());

Endpoint schemes are mapped to registered adapters. Unknown schemes fail before any vendor runtime is touched. Adapter packages may provide dedicated endpoint builders, such as ZlgEndpoint or VectorEndpoint, for fixed-device configuration.

Scan Devices

var scan = await registry.ScanAsync(new ScanOptions(), CancellationToken.None);

The registry asks every adapter that supports scanning and returns both discovered devices and diagnostics. Missing hardware or missing native drivers should be surfaced as diagnostics rather than crashing the host process. If a channel came from scanning, prefer registry.OpenAsync(channel, options, ct) or the scanned endpoint fields instead of rebuilding the endpoint manually.

Broadcast And Conflict Helpers

FrameBroadcastHub fans out frame events to subscriptions with bounded queues. Slow subscribers can be dropped according to subscription settings without blocking the adapter receive loop.

LeaseConflictDetector creates deterministic fingerprints for bus configuration so adapters can detect incompatible shared-channel requests.

License

This package is licensed under the MIT License.

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 (3)

Showing the top 3 NuGet packages that depend on CanHub.Core:

Package Downloads
CanHub.Adapter.Vector

Vector CAN adapter for CanHub — provides CAN/CAN FD access via Vector XL Driver API.

CanHub.Adapter.Virtual

In-process virtual CAN/CAN FD adapter for CanHub tests, samples, and protocol development.

CanHub.Adapter.Zlg

ZLG CAN adapter for CanHub — provides CAN/CAN FD access via zlgcan.dll.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 128 6/1/2026
1.0.0-preview.8 68 5/25/2026
1.0.0-preview.7 64 5/23/2026
1.0.0-preview.6 72 5/21/2026
1.0.0-preview.5 60 5/21/2026
1.0.0-preview.4 67 5/21/2026
1.0.0-preview.3 65 5/20/2026
1.0.0-preview.2 62 5/19/2026
1.0.0-preview.1 68 5/15/2026

DI registration, endpoint opening, lease coordination, and frame broadcast infrastructure.