Oakrey.Applications.Ohm.LIN 2.0.2

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

Oakrey.Applications.Ohm.LIN

A robust .NET service layer for discovering, configuring, connecting, and observing Oakrey LIN hardware devices and channels.

The package builds on Oakrey.Applications.Ohm and adapts Oakrey.HardwareManager.Client.LIN to common channel, device, and service abstractions.

Features

  • Discovery and management of multiple LIN devices
  • Enabled-channel connection through ILinDeviceService.Connect
  • IObservable<LinReceivedFrameMessage> streams at channel, device, and service level
  • IObservable<DeviceStatus> lifecycle streams
  • Serialized channel connection and device refresh operations
  • Safe ownership and disposal of LIN clients and Rx subscriptions
  • Persistent channel aliases, enabled state, and trace selection
  • Debounced USB hot-plug discovery
  • Cancellation support for asynchronous operations

Installation

dotnet add package Oakrey.Applications.Ohm.LIN

The library targets .NET 10 for Windows and requires the Oakrey Hardware Manager service supported by Oakrey.HardwareManager.Client.LIN.

Main types

Type Purpose
ILinDeviceService / LinDeviceService Application-level entry point for discovery, configuration, and aggregate streams
ILinDevice / LinDevice A physical LIN adapter and its channels
ILinChannel / LinChannel One LIN channel and its received-frame stream
LinDeviceConfig Serializable device configuration
LinChannelConfig Serializable channel configuration
LinChannelCollection Observable LIN channel collection

LinChannel, LinDevice, and LinDeviceService derive from the lifecycle implementations in Oakrey.Applications.Ohm. LIN-specific classes only provide hardware-client creation and protocol-specific mappings.

Dependency injection

Register the service as a singleton so its clients and subscriptions are disposed at application shutdown:

services.AddSingleton<ILinDeviceService, LinDeviceService>();

The constructor dependencies are:

  • IApplicationInfo for locating the configuration directory
  • IJsonService for configuration persistence
  • IFileService for configuration-file operations
  • IUsbNotifyingService for automatic device discovery

Basic usage

await linDeviceService.RefreshAvailableDevices(cancellationToken);
await linDeviceService.LoadDevicesConfig(cancellationToken);
await linDeviceService.Connect(cancellationToken);

using IDisposable subscription = linDeviceService.Received.Subscribe(frame =>
{
    // Process the received LIN frame.
});

Resolve a known channel by device serial number and channel number:

ILinChannel channel = linDeviceService.GetDevice(serialNumber, channelNumber);
channel.Traced = true;

Disconnect explicitly when required. The DI container also disconnects and disposes the service during shutdown:

linDeviceService.SaveDevicesConfig();
linDeviceService.Disconnect();

Configuration

Configuration is stored in userDevicesLin.json beside IApplicationInfo.UserSettingsPath. It includes the device identity and each channel's number, alias, enabled state, and trace state.

Only enabled channels are connected. Configure them before calling Connect:

foreach (ILinChannel channel in linDeviceService.Devices.SelectMany(device => device.Channels))
{
    channel.Enabled = true;
}

await linDeviceService.Connect(cancellationToken);

If the application clean-config keyboard combination is held during service construction, the saved LIN configuration is removed.

Error and cancellation behavior

  • Invalid serial numbers or channel numbers passed to GetDevice produce KeyNotFoundException.
  • A channel configuration for a different channel is rejected with ArgumentException.
  • Cancellation is propagated as OperationCanceledException.
  • Connection, receive-stream, and discovery failures are logged and publish DeviceStatus.Error where applicable.
  • Calls that require a live service or channel reject use after disposal.

USB hot-plug behavior

USB notifications are debounced for two seconds. A newer notification cancels the pending refresh, preventing overlapping discovery runs during a burst of arrival/removal events. After a successful automatic refresh, the current configuration is saved.

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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 (1)

Showing the top 1 NuGet packages that depend on Oakrey.Applications.Ohm.LIN:

Package Downloads
Oakrey.Applications.DecodingServices.LIN

LDF-based LIN frame decoding service for .NET applications. Connects LIN device reception with loaded LDF definitions and exposes decoded frames, signal samples, unknown frames, message history, and reactive decoder statistics.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 41 9/4/2026
2.0.0 48 9/4/2026