VOOZH about

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

⇱ NuGet Gallery | Oakrey.Emu.Can 1.0.5




👁 Image
Oakrey.Emu.Can 1.0.5

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

Oakrey.Emu.Can

Overview

Oakrey.Emu.Can is a .NET library for communicating with Oakrey Guru Emu USB hardware that operates as a CAN bus emulator. It provides a thin, async-first adapter layer over Oakrey.Guru.Base that lets a host application write indexed simulation input values into the hardware and verify the active emulation profile via CRC.

Typical use case is hardware-in-the-loop (HIL) testing where the Emu device injects controlled CAN signal values into a device under test.

Main Features

  • WriteInputValue - write a 16-bit value to a numbered simulation input channel on the connected Emu device.
  • GetSimCrc - retrieve a 32-bit CRC of the currently loaded emulation profile, useful for verifying that the expected profile is active.
  • Fully async API with CancellationToken support throughout.
  • USB connection identified by serial number and QUID string.
  • Thin interface ICanEmu allows easy mocking in unit tests.

Architecture

classDiagram
 direction LR
 class ICanEmu {
 +GetSimCrc(CancellationToken) Task~uint~
 +WriteInputValue(uint index, ushort value, CancellationToken) Task
 }
 class CanEmuAdapter {
 +Create(serial, quid, CancellationToken) Task~CanEmuAdapter~
 +GetSimCrc(CancellationToken) Task~uint~
 +WriteInputValue(uint, ushort, CancellationToken) Task
 }
 class SimCrcHandler {
 +Id: 0x0B01
 +Execute(...) Task~uint~
 }
 class WriteDriverValueHandler {
 +Id: 0x0B00
 +Execute(...) Task~uint~
 }
 ICanEmu <|.. CanEmuAdapter
 CanEmuAdapter --> SimCrcHandler
 CanEmuAdapter --> WriteDriverValueHandler

Project structure

Emu.Can/
 ICanEmu.cs # Public interface
 CanEmuAdapter.cs # Concrete adapter, factory method Create()
 Handlers/
 SimCrcHandler.cs # Protocol handler for GetSimCrc (cmd 0x0B01)
 WriteDriverValueHandler.cs # Protocol handler for WriteInputValue (cmd 0x0B00)

Requirements

  • .NET 10, Windows (net10.0-windows)
  • Oakrey.Guru.Base (included as a project/package dependency)
  • Oakrey Guru Emu USB hardware device

Installation

.NET CLI

dotnet add package Oakrey.Emu.Can

Package Manager Console

Install-Package Oakrey.Emu.Can

NuGet Package Manager

Search for Oakrey.Emu.Can in Tools > NuGet Package Manager > Manage NuGet Packages for Solution and click Install.

Example Usage

Connect and write a simulation input value

using Oakrey.Emu.Can;

string serial = "YOUR_DEVICE_SERIAL";
string quid = "YOUR_DEVICE_QUID";

CanEmuAdapter adapter = await CanEmuAdapter.Create(serial, quid, CancellationToken.None);

// Write value 1234 to simulation input channel 0
await adapter.WriteInputValue(index: 0, value: 1234, CancellationToken.None);

adapter.Dispose();

Verify the active emulation profile via CRC

CanEmuAdapter adapter = await CanEmuAdapter.Create(serial, quid, CancellationToken.None);

uint crc = await adapter.GetSimCrc(CancellationToken.None);
Console.WriteLine($"Profile CRC: 0x{crc:X8}");

adapter.Dispose();

Using the interface for testability

public class MySimService
{
 private readonly ICanEmu _emu;

 public MySimService(ICanEmu emu) => _emu = emu;

 public Task SetThrottle(ushort value, CancellationToken ct)
 => _emu.WriteInputValue(index: 5, value, ct);
}

Development Notes

  • The USB connection is established inside CanEmuAdapter.Create() which is the only public factory. The constructor is private.
  • Command IDs are fixed in the hardware protocol: WriteInputValue uses 0x0B00, GetSimCrc uses 0x0B01.
  • WriteInputValue returns error code 3 from firmware when the index or value is out of range; the handler translates this to ArgumentException.
  • DeviceBase (from Oakrey.Guru.Base) manages the USB transceiver lifecycle and exposes Dispose().
  • Pass CancellationToken from your application layer to support timeouts and cooperative cancellation.

Project Information

Field Value
Package ID Oakrey.Emu.Can
Version 1.0.1
Author Oakrey
License MIT
Target net10.0-windows
Repository https://dev.azure.com/oakrey/OpenPackages/_git/Drivers
Project URL https://www.oakrey.cz/opkg_drivers_guru

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
1.0.5 99 5/22/2026
1.0.4 91 5/15/2026
1.0.2 93 5/14/2026
1.0.1 153 2/2/2026
1.0.0 222 11/26/2025