IoT-Driver.Core 1.0.2

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

<p align="center"> <img src="https://github.com/ChrisPulman/IoT-DriverCore/blob/main/images/cp-iot-core.png" alt="CP.IoT.Core package logo" width="320" /> </p>

IoT-Driver.Core

Overview

IoT-Driver.Core (project and assembly CP.IoT.Core) is the protocol-neutral composition layer shared by the IoT-DriverCore PLC drivers. It gives applications stable logical names while each protocol adapter remains responsible for physical addresses, value conversion, batching, and transport failures.

Use it to define logical tags once, compose clients from different PLC families, persist definitions, plan contiguous transfers, or test application behavior without PLC hardware.

Install

dotnet add package IoT-Driver.Core

The public namespace is IoT.Driver.Core.

Core model

  • LogicalTag is an immutable definition containing a logical name, protocol address, data type, access mode, optional scan interval, group, description, and metadata.
  • LogicalTagKey<T> adds compile-time value typing to a logical name.
  • LogicalTagCatalog is a thread-safe in-memory catalogue with add, update, remove, list, and change notification operations.
  • ILogicalTagClient composes the read, write, observable, and async-observable contracts implemented by protocol adapters.
  • TagOperationResult<T> reports expected operation failures through Succeeded, Value, and Error.
  • LogicalTagSqliteStore persists tag and group definitions and can reconstruct a catalogue.
  • TagTransferPlanner groups compatible adjacent or overlapping addresses within protocol limits.
  • SimulatorLogicalTagClient, SimulatorMemoryImage, clocks, and scripts provide deterministic hardware-free execution.

Define and catalogue tags

using IoT.Driver.Core;

using var catalog = new LogicalTagCatalog();

var temperature = new LogicalTag(
    "Reactor.Temperature",
    "DB10.DBD0",
    "Single",
    new LogicalTagOptions
    {
        GroupName = "Reactor",
        Description = "Process temperature",
        AccessMode = LogicalTagAccessMode.Read,
        ScanInterval = TimeSpan.FromSeconds(1),
    });

catalog.Upsert(temperature);

var temperatureKey = new LogicalTagKey<float>(temperature);

The address string remains protocol-specific. Create it with the syntax expected by the selected driver; the core library deliberately does not reinterpret it.

Read and write through a driver

Protocol packages expose or compose an ILogicalTagClient. Typed extension methods preserve the logical key type:

using IoT.Driver.Core;

static async Task<float> ReadTemperatureAsync(
    ILogicalTagClient client,
    LogicalTagKey<float> key,
    CancellationToken cancellationToken)
{
    var result = await client.ReadAsync(key, cancellationToken);
    if (!result.Succeeded || result.Value is null)
    {
        throw new InvalidOperationException(result.Error);
    }

    return result.Value;
}

Inspect every result before using its value. Expected PLC, address, conversion, and transport failures are returned as unsuccessful results; argument and lifecycle errors may still throw.

Observe changes

ILogicalTagObserver supports both IObservable<LogicalTagValue> and cancellation-aware IAsyncEnumerable<LogicalTagValue>:

await foreach (var change in client.ObserveAsync(
    temperatureKey.Name,
    cancellationToken))
{
    Console.WriteLine($"{change.TagName}: {change.Value} at {change.TimestampUtc:O}");
}

Dispose observable subscriptions and cancel async enumeration when the owning component stops.

Persist definitions

var store = new LogicalTagSqliteStore("Data Source=logical-tags.db");
await store.UpsertTagAsync(temperature, cancellationToken);

using var restoredCatalog = await store.LoadCatalogAsync(cancellationToken);

LogicalTagCsv provides import and export when definitions must be reviewed or exchanged as text. Validate imported addresses against the target protocol before connecting to equipment.

Batch planning

TagTransferPlanner consumes addresses already parsed by a protocol adapter. It preserves caller result positions while coalescing compatible ranges subject to TagTransferCapabilities.

var planner = new TagTransferPlanner(
    new TagTransferCapabilities(maximumRangeLength: 120, maximumItemsPerRange: 32));

Adapters should use distinct transport partitions, memory areas, encodings, access directions, and routes so the planner never combines incompatible requests.

Simulation and testing

Use SimulatorLogicalTagClient with a SimulatorMemoryImage, typed SimulatorTagBinding instances, a transfer planner, and optionally a ManualSimulatorClock or SimulatorScript. This exercises the same logical read, write, batch, and observation contracts without opening a network or serial connection.

Prefer the simulator for unit and integration tests. Before production use, validate the final tag catalogue, write permissions, byte ordering, ranges, and failure handling on a safe test rig.

Lifetime and cancellation

  • Pass a meaningful CancellationToken to I/O, persistence, and async observation operations.
  • Dispose LogicalTagCatalog and every subscription owned by the application.
  • Treat tag definitions as immutable; use WithAddress, WithDataType, or WithOptions, then update the catalogue.
  • Keep protocol-specific address parsing and codecs in the protocol adapter rather than in application-domain models.

Agent skill

The package includes the detailed skills/cp-iot-core/SKILL.md guide for coding agents. The complete repository documentation is available at IoT-DriverCore.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (12)

Showing the top 5 NuGet packages that depend on IoT-Driver.Core:

Package Downloads
IoT-Driver.S7PlcRx.Reactive

Reactive Siemens S7 PLC driver for S7-200, S7-300, S7-400, S7-1200, and S7-1500 controllers.

IoT-Driver.OmronPlcRx

Reactive Omron PLC driver for FINS, Host Link, Toolbus, Ethernet, and serial communications.

IoT-Driver.MitsubishiRx

Reactive Mitsubishi MELSEC PLC driver using MC Protocol and SLMP over Ethernet and serial transports.

IoT-Driver.S7PlcRx

Reactive Siemens S7 PLC driver for S7-200, S7-300, S7-400, S7-1200, and S7-1500 controllers.

IoT-Driver.TwinCATRx

Reactive Beckhoff TwinCAT ADS PLC driver with core and Windows ADS integrations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 102 8/3/2026
1.0.1 148 8/1/2026
1.0.0 80 7/31/2026

Shared logical-tag read, write, observation, and batch-planning contracts for IoT-DriverCore drivers.