SharpMeter.Emulator 0.1.0

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

SharpMeter

A modern, high-performance .NET library for smart meter communication supporting both ANSI C12.18/C12.19 PSEM and DLMS/COSEM (IEC 62056) protocols.

Features

  • Dual protocol: ANSI PSEM and DLMS/COSEM in a single library
  • Fully async with CancellationToken support
  • Zero-allocation hot paths with Span<T>, ArrayPool<T>, System.IO.Pipelines
  • Pluggable ITransport interface (serial, TCP, loopback, custom)
  • Table deserialization: fluent builder, attribute mapping, or JSON schema
  • Built-in PSEM meter emulator with configurable tables and security
  • Result<T> discriminated union — no exceptions for control flow
  • IAsyncEnumerable for streaming large table reads
  • Source-generated ILogger<T> integration
  • Multi-target: net9.0 and net10.0

Packages

Package Description
SharpMeter.Core Protocol types, CRC-16, Result<T>, enums, table definitions and deserializer
SharpMeter.Transport ITransport interface, serial, TCP, and loopback transports
SharpMeter.Client PSEM client — session, table, and procedure services
SharpMeter.Dlms DLMS/COSEM — HDLC framing, OBIS codes, A-XDR codec, GET/SET/ACTION
SharpMeter.Emulator Full PSEM meter emulator with in-memory table store

Quick Start

using SharpMeter.Client;
using SharpMeter.Core.Tables;
using SharpMeter.Transport;

await using var transport = new SerialTransport(
    new TransportOptions { PortName = "COM3" },
    NullLogger<SerialTransport>.Instance);

await using var client = new PsemClient(transport, NullLogger<PsemClient>.Instance);
await client.ConnectAsync();

// Read and deserialize a table
var table = await client.ReadTableAsync(1);
var registry = new TableRegistry();
var parsed = registry.Deserialize(1, table.Value.Data);
Console.WriteLine(parsed.Value.GetValue("MANUFACTURER"));

await client.DisconnectAsync();

Documentation

Full docs at jacobwi.github.io/SharpMeter

License

MIT — See GitHub for source and documentation.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 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

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
0.1.0 33 4/8/2026