![]() |
VOOZH | about |
dotnet add package Oakrey.Emu.Can --version 1.0.5
NuGet\Install-Package Oakrey.Emu.Can -Version 1.0.5
<PackageReference Include="Oakrey.Emu.Can" Version="1.0.5" />
<PackageVersion Include="Oakrey.Emu.Can" Version="1.0.5" />Directory.Packages.props
<PackageReference Include="Oakrey.Emu.Can" />Project file
paket add Oakrey.Emu.Can --version 1.0.5
#r "nuget: Oakrey.Emu.Can, 1.0.5"
#:package Oakrey.Emu.Can@1.0.5
#addin nuget:?package=Oakrey.Emu.Can&version=1.0.5Install as a Cake Addin
#tool nuget:?package=Oakrey.Emu.Can&version=1.0.5Install as a Cake Tool
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.
CancellationToken support throughout.ICanEmu allows easy mocking in unit tests.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
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)
Oakrey.Guru.Base (included as a project/package dependency)dotnet add package Oakrey.Emu.Can
Install-Package Oakrey.Emu.Can
Search for Oakrey.Emu.Can in Tools > NuGet Package Manager > Manage NuGet Packages for Solution and click Install.
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();
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();
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);
}
CanEmuAdapter.Create() which is the only public factory. The constructor is private.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().CancellationToken from your application layer to support timeouts and cooperative cancellation.| 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 |
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. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.