CanHub.Abstractions
1.0.1
dotnet add package CanHub.Abstractions --version 1.0.1
NuGet\Install-Package CanHub.Abstractions -Version 1.0.1
<PackageReference Include="CanHub.Abstractions" Version="1.0.1" />
<PackageVersion Include="CanHub.Abstractions" Version="1.0.1" />
<PackageReference Include="CanHub.Abstractions" />
paket add CanHub.Abstractions --version 1.0.1
#r "nuget: CanHub.Abstractions, 1.0.1"
#:package CanHub.Abstractions@1.0.1
#addin nuget:?package=CanHub.Abstractions&version=1.0.1
#tool nuget:?package=CanHub.Abstractions&version=1.0.1
CanHub.Abstractions
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 | 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 (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.