Oakrey.Vector.Base 4.0.4

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

Oakrey.Vector.Base

Foundation package for building Vector hardware clients. Provides VectorClientBase and VectorChannelBase abstract types with IObservable message streams (Rx.NET) for CAN and LIN channel implementations built on top of Oakrey.Vector.Wrapper.

Main features

  • Client abstraction - VectorClientBase<TVectorChannel, TArgs> discovers all compatible hardware channels for a given serial number and bus type at construction time. Exposes a merged IObservable<TArgs> stream that aggregates messages from every channel.
  • Channel abstraction - VectorChannelBase<TArgs> owns the port lifecycle (open, activate, flush, deactivate, close) and publishes received frames via a Subject<TArgs> exposed as IObservable<TArgs>.
  • Rx.NET streams - every channel and client exposes ReceivedData as a cold-merged observable. Consumers subscribe using standard Rx operators and dispose the subscription to stop receiving.
  • Enable / Disable lifecycle - channels support explicit Enable() / Disable() calls so hardware resources are acquired only when needed.
  • Correct disposal - both client and channel implement IDisposable; disposing the client disables all channels, closes the VectorHandle, and disposes all Rx subscriptions.
  • Typed message generics - TArgs is constrained to ReceivedMessage (from Oakrey.Vector.Wrapper), allowing CAN and LIN implementations to carry their own strongly-typed payloads without casting.

Architecture

classDiagram
    direction TB

    class IVectorClientBase~TArgs~ {
        <<interface>>
        +IObservable~TArgs~ ReceivedData
        +uint SerialNumber
        +EnableChannel(byte)
        +DisableChannel(byte)
    }

    class IVectorChannelBase~TArgs~ {
        <<interface>>
        +IObservable~TArgs~ ReceivedData
        +byte ChannelNumber
        +uint SerialNumber
        +Enable()
        +Disable()
        +Dispose()
    }

    class VectorClientBase~TVectorChannel_TArgs~ {
        <<abstract>>
        #BusType BusType
        #VectorHandle driver
        #Dictionary channels
        +AvailableDevices(BusType) List
        #FindChannel(byte) TVectorChannel
        #GetCompatibleChannels(uint) IEnumerable
    }

    class VectorChannelBase~TArgs~ {
        <<abstract>>
        #BusType BusType
        #uint RxQueueSize
        #OpenPort()
        #StartReading()
        #StopReading()
        #PrepareEnable(ActivateAction)
        #OnNewMessage(TArgs)
    }

    IVectorClientBase~TArgs~ <|.. VectorClientBase~TVectorChannel_TArgs~
    IVectorChannelBase~TArgs~ <|.. VectorChannelBase~TArgs~
    VectorClientBase~TVectorChannel_TArgs~ o-- VectorChannelBase~TArgs~

Concrete implementations (e.g. VectorCanChannel, VectorLinChannel) live in the VectorCan and VectorLin projects that reference this package.

Requirements

  • .NET 10 or higher
  • Vector hardware driver installed on the host machine (XL Driver Library)
  • Oakrey.Vector.Wrapper (pulled automatically as a project/package dependency)
  • System.Reactive 6.1.0 or higher

Build instructions

dotnet build VectorBase/VectorBase.csproj

To produce a NuGet package:

dotnet pack VectorBase/VectorBase.csproj -c Release

Installation

.NET CLI

dotnet add package Oakrey.Vector.Base

Package Manager Console

Install-Package Oakrey.Vector.Base

NuGet Package Manager

Search for Oakrey.Vector.Base in the Visual Studio NuGet Package Manager UI.

Example usage

// Assuming a concrete VectorCanClient : VectorClientBase<VectorCanChannel, CanMessage>
using VectorCanClient client = new VectorCanClient(serialNumber: 12345, appName: "MyApp");

// Subscribe to all incoming CAN messages from any channel
using IDisposable subscription = client.ReceivedData
    .Subscribe(msg => Console.WriteLine($"CAN id=0x{msg.Id:X} data={BitConverter.ToString(msg.Data)}"));

// Enable a specific channel before traffic can flow
client.EnableChannel(channelNumber: 1);

Console.ReadLine();

client.DisableChannel(channelNumber: 1);
// subscription.Dispose() stops receiving; client.Dispose() shuts down hardware

Per-channel subscription is also possible:

IVectorChannelBase<CanMessage> ch = /* obtained from client internals or DI */;
ch.ReceivedData
  .Where(m => m.Id == 0x123)
  .Subscribe(m => HandleFrame(m));

Development notes

  • Implement VectorChannelBase<TArgs> by overriding OpenPort(), StartReading(), and BusType. Call OnNewMessage(args) inside the read loop to push frames into the observable stream.
  • PrepareEnable(ActivateAction) handles channel activation and queue flushing; call it from Enable().
  • StopReading() cancels the CancellationTokenSource used by the read loop; override if additional cleanup is needed.
  • VectorClientBase uses Activator.CreateInstance to instantiate channel types via their constructor signature (ChannelConfiguration, VectorHandle, string). Concrete channel types must expose this constructor.
  • AvailableDevices(BusType) is a static helper that can be called before constructing a client to enumerate connected hardware.

License

MIT - Copyright (c) Oakrey 2016-present. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Oakrey.Vector.Base:

Package Downloads
Oakrey.Vector.Can

CAN and CAN FD client for Vector hardware (XL Driver Library). Provides VectorCanClient and VectorCanChannel with IObservable message streams (Rx.NET), per-channel Init/InitFd/SendData lifecycle, and FD capability detection. Built on Oakrey.Vector.Base and Oakrey.Vector.Wrapper.

Oakrey.Vector.Lin

LIN master and slave client for Vector hardware (XL Driver Library). Provides VectorLinClient and VectorLinChannel with IObservable message streams (Rx.NET), slave answer table management, LIN scheduler, master request sending, and per-channel LinConfig. Built on Oakrey.Vector.Base and Oakrey.Vector.Wrapper.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.4 116 5/22/2026
4.0.3 115 5/14/2026
4.0.2 190 2/2/2026
4.0.1 146 1/6/2026
4.0.0 241 11/25/2025
3.0.0 300 11/14/2025
2.0.0 262 7/8/2025
1.1.0 241 6/18/2025
1.0.1 244 6/4/2025
1.0.0 318 4/17/2025