VOOZH about

URL: https://www.nuget.org/packages/Oakrey.Guru.Can/

⇱ NuGet Gallery | Oakrey.Guru.Can 4.0.5




👁 Image
Oakrey.Guru.Can 4.0.5

dotnet add package Oakrey.Guru.Can --version 4.0.5
 
 
NuGet\Install-Package Oakrey.Guru.Can -Version 4.0.5
 
 
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="Oakrey.Guru.Can" Version="4.0.5" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.Guru.Can" Version="4.0.5" />
 
Directory.Packages.props
<PackageReference Include="Oakrey.Guru.Can" />
 
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 Oakrey.Guru.Can --version 4.0.5
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Oakrey.Guru.Can, 4.0.5"
 
 
#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 Oakrey.Guru.Can@4.0.5
 
 
#: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=Oakrey.Guru.Can&version=4.0.5
 
Install as a Cake Addin
#tool nuget:?package=Oakrey.Guru.Can&version=4.0.5
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Oakrey.Guru.Can

CAN and CAN-FD adapter library for Oakrey Guru USB hardware. Provides dual-channel bus configuration, per-channel filtering, bridge mode, reactive Rx streams, and simulation support on top of Oakrey.Guru.Base.

Main features

  • Dual-channel CAN bus: Channel.CAN0 and Channel.CAN1 controlled independently
  • CAN-FD support: configurable arbitration and data-phase baud rates, bit-rate switching, FD payload via Config and CanTiming
  • Per-channel control: enable/disable, bus terminator, timing (SamplePoint, TQCount, SyncJumpWidth), reset, reload
  • Message filtering: per-channel standard (0-127) and extended (0-63) ID filters; IdFilter, RangeFilter, DualFilter; global filter policy via GlobalFilter
  • Bridge mode: route traffic between channels with BridgeMode (NONE / ALLOW / DENY); append specific IDs to a bridge list
  • Reactive Rx streams: IObservable<ReceivedMessage>, IObservable<ReceivedCanEvent>, IObservable<DriverStatusChanged>
  • Simulation: ISimGuru exposes WriteInputValue and GetSimCrc for hardware-in-the-loop scenarios
  • License key retrieval: IGuruLicense with per-slot and boot license access
  • Inherits from DeviceBase: firmware update, ping, bootloader reset, FwUpdateInProgress observable

Architecture

classDiagram
 class IDevice {
 +Connect(ct)
 +Ping(data, ct)
 +GetFwVersion(ct)
 +UpdateFirmware(path, ct)
 +RestartToBootloader(ct)
 +FwUpdateInProgress IObservable~bool~
 }
 class ICanGuru {
 +ReceivedMessage IObservable~ReceivedMessage~
 +ReceivedCanEvent IObservable~ReceivedCanEvent~
 +CanDrvStatusChanged IObservable~DriverStatusChanged~
 +Enable(channel, enable, ct)
 +ConfigSet(channel, config, ct)
 +FilterSet(channel, type, index, filter, ct)
 +GlobalFilterSet(channel, globalFilter, ct)
 +CanTimingSet(channel, canTiming, ct)
 +SetBridgeMode(mode, ct)
 +ClearBridgeMode(list, ct)
 +AppendBridgeMode(list, ids, ct)
 +Send(channel, message)
 }
 class ISimGuru {
 +WriteInputValue(index, value, ct)
 +GetSimCrc(ct)
 }
 class IGuruLicense {
 +GetLicenseKey(id, ct)
 +GetAllLicenseKeys(ct)
 +GetBootLicense(ct)
 }
 class CanGuruAdapter {
 +Create(serial, quid, ct)$ Task~CanGuruAdapter~
 }
 IDevice <|.. CanGuruAdapter
 ICanGuru <|.. CanGuruAdapter
 ISimGuru <|.. CanGuruAdapter
 IGuruLicense <|.. CanGuruAdapter

Key data types

Type Description
Config CAN/CAN-FD bus config: baud rates, FD enable, monitor-only
CanTiming Nominal and data-phase timing: sample point, TQ count, SJW
Message TX/RX message: identifier, FD flags, BRS, ESI, RTR, data
ReceivedMessage Received message with hardware timestamp
ReceivedCanEvent CAN event (e.g. bus error) with timestamp
DriverStatusChanged Driver state transition notification
BridgeMode Enum: NONE / ALLOW / DENY
BridgeList Identifies a bridge pair (CAN0-CAN1)
Channel Enum: CAN0 / CAN1
IdFilter / RangeFilter / DualFilter Concrete filter implementations

Requirements

  • .NET 10 (Windows only)
  • Oakrey.Guru.Base (transitive)
  • Oakrey Guru CAN USB hardware adapter

Installation

.NET CLI

dotnet add package Oakrey.Guru.Can

Package Manager Console

Install-Package Oakrey.Guru.Can

NuGet Package Manager

Search for Oakrey.Guru.Can in Visual Studio under Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

Example usage

Create and connect

// serial: device serial number, quid: USB device qualifier GUID
CanGuruAdapter adapter = await CanGuruAdapter.Create(serial, quid, cancellationToken);

Configure and enable a channel

Config config = new()
{
 ArbitrationBaudRate = 500_000,
 FdDataPhaseBaudRate = 2_000_000,
 FdEnable = true,
 MonitorOnly = false,
};

await adapter.ConfigSet(Channel.CAN0, config, cancellationToken);
await adapter.TerminatorEnable(Channel.CAN0, true, cancellationToken);
await adapter.Enable(Channel.CAN0, true, cancellationToken);

Custom timing

CanTiming timing = new(
 nominal: new Timing(samplePoint: 750, tQCount: 16, syncJumpWidth: 1),
 data: new Timing(samplePoint: 750, tQCount: 8, syncJumpWidth: 1));

await adapter.CanTimingSet(Channel.CAN0, timing, cancellationToken);

Send a message

Message message = new()
{
 Identifier = 0x1A0,
 FDEnabled = true,
 BitRateSwitchEnabled = true,
 Data = [0x01, 0x02, 0x03, 0x04],
};

adapter.Send(Channel.CAN0, message);

Receive messages reactively

using IDisposable subscription = adapter.ReceivedMessage
 .Subscribe(msg => Console.WriteLine($"ID: {msg.Message.Identifier:X} Data: {BitConverter.ToString(msg.Message.Data)}"));

Set a message filter

// Allow only IDs 0x100 to 0x1FF on CAN0 standard filters, slot 0
await adapter.FilterSet(Channel.CAN0, FilterType.Standard, 0, new RangeFilter(0x100, 0x1FF), cancellationToken);
await adapter.Reload(Channel.CAN0, cancellationToken);

Bridge mode

// Forward all traffic from CAN0 to CAN1
await adapter.SetBridgeMode(BridgeMode.ALLOW, cancellationToken);

// Forward only specific IDs
await adapter.AppendBridgeMode(BridgeList.CAN0_CAN1, [0x1A0, 0x1B0], cancellationToken);

Firmware update

adapter.FwUpdateInProgress.Subscribe(active =>
 Console.WriteLine(active ? "Firmware update in progress..." : "Firmware update complete."));

await adapter.UpdateFirmware(@"C:\firmware\can_guru_v4.hex", cancellationToken);

Development notes

  • CanGuruAdapter is sealed; use the ICanGuru / ISimGuru / IGuruLicense interfaces in consuming code.
  • Filter changes require Reload to take effect; Reset clears all channel state.
  • ReceivedMessage, ReceivedCanEvent, and CanDrvStatusChanged are hot observables backed by Subject; subscribe before enabling the channel to avoid missing early events.
  • All async methods accept a CancellationToken and propagate it through the handler pipeline.
  • Send is fire-and-forget (synchronous enqueue); use the Rx subscription to observe results.

Project information

Field Value
Author Oakrey
License MIT
Target framework net10.0-windows
NuGet package Oakrey.Guru.Can
Repository https://dev.azure.com/oakrey/OpenPackages/_git/Drivers

License

MIT. See the LICENSE file for details.

Package Manager Console

Run the following command in your Package Manager Console:

Install-Package Oakrey.Guru.Can

Requirements

  • .NET 8 or higher

Project Information

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the package.

License

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-windows7.0 net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.5 103 5/22/2026
4.0.4 98 5/15/2026
4.0.2 100 5/14/2026
4.0.1 150 2/2/2026
4.0.0 127 1/7/2026
3.0.0 297 11/14/2025
2.1.0 246 6/18/2025
2.0.0 236 6/4/2025
1.0.0 306 4/17/2025