Oakrey.Guru.Lin 6.0.0

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

Oakrey.Guru.Lin

LIN bus adapter library for Oakrey Guru USB hardware. Provides multi-channel LIN communication with master and slave roles, frame scheduling, slave answer table management, and reactive Rx streams on top of Oakrey.Guru.Base.

Main features

  • Up to 8 independent LIN channels (Channel.Ch0 � Ch7), each independently configured and enabled
  • Four operating modes per channel: Observe, SlaveAnswer, MasterUser, MasterAuto
  • Baud rate configuration up to 19200 baud with enhanced or classic checksum selection
  • Master frame scheduling: add MasterFrame with configurable inter-frame delay; send one-shot MasterRequest
  • Slave answer table: register, update, and remove per-ID SlaveAnswer entries
  • Bus voltage reading (ReadLinVoltage) and per-channel status byte (ReadStatus)
  • Reactive Rx streams: IObservable<ReceivedFrame>, IObservable<StatusChanged>, IObservable<ErrorEvent>
  • Inherits from DeviceBase: firmware update from Intel HEX, 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 ILinGuru {
        +Received IObservable~ReceivedFrame~
        +StatusChanged IObservable~StatusChanged~
        +Error IObservable~ErrorEvent~
        +WriteConfig(channel, config, ct)
        +WriteEnable(channel, enable, ct)
        +MasterEnable(channel, enable, ct)
        +AddMasterFrame(channel, frame, ct)
        +AddMasterRequest(channel, request, ct)
        +ClearMaster(channel, ct)
        +SendFrame(channel, frame, ct)
        +SendRequest(channel, request, ct)
        +UpdateSlaveAnswer(channel, answer, ct)
        +RemoveSlaveAnswer(channel, id, ct)
        +ClearSlaveAnswer(channel, ct)
        +ReadLinVoltage(ct)
        +ReadStatus(channel, ct)
        +Reset(channel, ct)
    }
    class LinGuruAdapter {
        +Create(serial, quid, ct)$ Task~LinGuruAdapter~
    }
    IDevice <|.. LinGuruAdapter
    ILinGuru <|.. LinGuruAdapter

Key data types

Type Description
Config Channel config: baud rate (max 19200) and Mode
Mode Enum: Observe / SlaveAnswer / MasterUser / MasterAuto
Channel Enum: Ch0 � Ch7
MasterFrame TX frame: ID, checksum type, data, inter-frame delay (ms)
MasterRequest One-shot TX request (no scheduled delay)
SlaveAnswer Slave response entry: ID, checksum type, data
ReceivedFrame Received frame with hardware timestamp
StatusChanged Channel status transition event
ErrorEvent LIN bus error event
LinGuruHalException Thrown on HAL-level violations (e.g. baud rate exceeded)

Requirements

  • .NET 11 (Windows only)
  • Oakrey.Guru.Base (transitive)
  • Oakrey Guru LIN USB hardware adapter

Installation

.NET CLI

dotnet add package Oakrey.Guru.Lin

Package Manager Console

Install-Package Oakrey.Guru.Lin

NuGet Package Manager

Search for Oakrey.Guru.Lin 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
LinGuruAdapter adapter = await LinGuruAdapter.Create(serial, quid, cancellationToken);

Configure and enable a channel

Config config = new(baudRate: 19200, mode: Mode.MasterAuto);

await adapter.WriteConfig(Channel.Ch0, config, cancellationToken);
await adapter.WriteEnable(Channel.Ch0, true, cancellationToken);
await adapter.MasterEnable(Channel.Ch0, true, cancellationToken);

Schedule a master frame

// ID 0x20, enhanced checksum, 4 bytes data, 10 ms inter-frame delay
MasterFrame frame = new(id: 0x20, enhancedCheckSum: true, data: [0x01, 0x02, 0x03, 0x04], delayMillis: 10);

await adapter.AddMasterFrame(Channel.Ch0, frame, cancellationToken);

Register a slave answer

SlaveAnswer answer = new(id: 0x30, enhancedCheckSum: true, data: [0xAA, 0xBB]);

await adapter.UpdateSlaveAnswer(Channel.Ch0, answer, cancellationToken);

Receive frames reactively

using IDisposable subscription = adapter.Received
    .Subscribe(rx => Console.WriteLine($"ID: {rx.Frame.Id:X2}  Data: {BitConverter.ToString(rx.Frame.Data)}"));

Read bus voltage

uint millivolts = await adapter.ReadLinVoltage(cancellationToken);
Console.WriteLine($"LIN bus voltage: {millivolts} mV");

Firmware update

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

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

Development notes

  • LinGuruAdapter is sealed; use the ILinGuru interface in consuming code.
  • Received, StatusChanged, and Error are hot observables; subscribe before enabling the channel to avoid missing early events.
  • All async methods accept a CancellationToken and propagate it through the handler pipeline.
  • MasterFrame delay is enforced by the hardware scheduler; MasterRequest is a single unconditional transmission.
  • ClearMaster removes all scheduled master frames; ClearSlaveAnswer clears the entire slave answer table for the channel.
  • Config constructor throws LinGuruHalException if baudRate exceeds 19200.

Project information

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

License

MIT. See the LICENSE file for details.

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 Compatible and additional computed target framework versions.
.NET net11.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
6.0.0 52 11/13/2026
5.0.1 152 9/18/2026
5.0.0 151 7/14/2026
4.0.5 149 5/22/2026
4.0.4 124 5/15/2026
4.0.3 126 5/14/2026
4.0.2 178 2/2/2026
4.0.1 156 1/9/2026
4.0.0 154 1/7/2026
3.0.0 348 11/14/2025
2.1.0 272 6/18/2025
2.0.0 256 6/4/2025
1.0.0 310 4/17/2025