CanHub.Abstractions 1.0.1

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

CanHub.Abstractions

简体中文

NuGet .NET 10 License: MIT

CanHub.Abstractions contains the dependency-free contracts shared by every CanHub package. Reference it when a library needs to exchange CAN/CAN FD frames, describe device capabilities, or define adapter-facing interfaces without depending on DI, Core, or vendor runtimes.

Install

dotnet add package CanHub.Abstractions

Target framework: net10.0.

What Is Included

Area Main Types
Frame model CanFrame, CanFrameEvent, CanId, CanFrameFlags
Bus contracts ICanBus, ICanSubscription, CanTransmitOptions, CanTransmitSubmissionResult
Adapter contracts ICanAdapterProvider, CanAdapterManifest, CanCapability
Lease contracts IDeviceLease, IChannelLease, ExclusivityModel
Discovery CanChannelInfo, CanChannelScanResult, ScanOptions, ScanDiagnostic
Status and errors CanStatusEvent, CanStatusKind, CanStatusCode, CanStatusSeverity, CanException, CanErrorCategory
Recovery policy CanRecoveryOptions, CanRecoveryMode, CanRecoveryTrigger

Frame Model

CanFrame is a readonly struct with inline payload storage for classic CAN and CAN FD frames. It avoids heap allocation for normal frame creation and exposes payload data through span-based APIs.

using CanHub;

var classic = CanFrame.CreateData(
    CanId.Standard(0x123),
    new byte[] { 0x01, 0x02, 0x03 });

var fd = CanFrame.CreateFdData(
    CanId.Extended(0x18DAF110),
    stackalloc byte[] { 0x10, 0x14, 0x62, 0xF1, 0x90 },
    bitrateSwitch: true);

Span<byte> buffer = stackalloc byte[64];
fd.CopyPayloadTo(buffer);

byte[] payload = fd.ToPayloadArray();
string hex = fd.ToPayloadHexString();

Use CopyPayloadTo(Span<byte>) or TryCopyPayloadTo for allocation-conscious code. ToPayloadArray() and ToPayloadHexString() are convenience helpers for diagnostics and UI code where explicit allocation is acceptable.

Transmission Contract

ICanBus.SendAsync reports local submission. It does not promise that another node accepted the frame. Bus-level outcomes, receive frames, and faults are emitted as CanFrameEvent values, usually with the same CorrelationId when the adapter can map the event back to a submission.

Recovery Policy

Automatic bus recovery is opt-in. CanOpenOptions.Recovery defaults to CanRecoveryOptions.Disabled, so adapters report faults through StatusChanged without closing or reopening the channel unless the caller selects a policy. ResetOnFault means one immediate close/reopen using the original open context; ReopenWithBackoff uses the same close/reopen mechanism with delay and attempt limits.

Adapter Manifests

Each adapter exposes a CanAdapterManifest so tools can inspect platform support, endpoint schemes, scan support, capabilities, and exclusivity behavior without loading vendor-specific details.

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.
  • net10.0

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on CanHub.Abstractions:

Package Downloads
CanHub.Core

CanHub registry, DI registration, endpoint opening, lease conflict detection, and frame broadcast infrastructure.

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.

CanHub.Trace.VectorAsc

Hardware-independent Vector ASC trace reader and writer for CanHub CAN/CAN FD frames.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 148 6/1/2026
1.0.0-preview.8 80 5/25/2026
1.0.0-preview.7 71 5/23/2026
1.0.0-preview.6 76 5/21/2026
1.0.0-preview.5 64 5/21/2026
1.0.0-preview.4 92 5/21/2026
1.0.0-preview.3 71 5/20/2026
1.0.0-preview.2 72 5/19/2026
1.0.0-preview.1 75 5/15/2026

Core abstractions for CAN/CAN FD device interfaces.