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
<PackageReference Include="Oakrey.Applications.Ohm.LIN" Version="2.0.2" />
<PackageVersion Include="Oakrey.Applications.Ohm.LIN" Version="2.0.2" />
<PackageReference Include="Oakrey.Applications.Ohm.LIN" />
paket add Oakrey.Applications.Ohm.LIN --version 2.0.2
#r "nuget: Oakrey.Applications.Ohm.LIN, 2.0.2"
#:package Oakrey.Applications.Ohm.LIN@2.0.2
#addin nuget:?package=Oakrey.Applications.Ohm.LIN&version=2.0.2
#tool nuget:?package=Oakrey.Applications.Ohm.LIN&version=2.0.2
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 levelIObservable<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:
IApplicationInfofor locating the configuration directoryIJsonServicefor configuration persistenceIFileServicefor configuration-file operationsIUsbNotifyingServicefor 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
GetDeviceproduceKeyNotFoundException. - 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.Errorwhere 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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Oakrey.Applications.Ohm.Abstractions (>= 2.0.0)
- Oakrey.HardwareManager.Client.LIN (>= 4.0.1)
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.