SerialPortRx 3.0.3

dotnet add package SerialPortRx --version 3.0.3                
NuGet\Install-Package SerialPortRx -Version 3.0.3                
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="SerialPortRx" Version="3.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SerialPortRx --version 3.0.3                
#r "nuget: SerialPortRx, 3.0.3"                
#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.
// Install SerialPortRx as a Cake Addin
#addin nuget:?package=SerialPortRx&version=3.0.3

// Install SerialPortRx as a Cake Tool
#tool nuget:?package=SerialPortRx&version=3.0.3                

SerialPortRx

A Reactive Serial Port Library This serial port is configured to provide a stream of data Read and accept a stream of Write requests

SerialPortRx CI-Build Nuget Nuget

An Example of the usage of SerialPortRx

using System;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveMarbles.Extensions;

namespace CP.IO.Ports.Test;

internal static class Program
{
    private static void Main(string[] args)
    {
        const string comPortName = "COM1";

        // configure the data to write, this can be a string, a byte array, or a char array
        const string dataToWrite = "DataToWrite";
        var dis = new CompositeDisposable();

        // Setup the start of message and end of message
        var startChar = 0x21.AsObservable();
        var endChar = 0x0a.AsObservable();

        // Create a disposable for each COM port to allow automatic disposal upon loss of COM port
        var comdis = new CompositeDisposable();

        // Subscribe to com ports available
        SerialPortRx.PortNames().Do(x =>
        {
            if (comdis?.Count == 0 && x.Contains(comPortName))
            {
                // Create a port
                var port = new SerialPortRx(comPortName, 9600);
                port.DisposeWith(comdis);

                // Subscribe to Exceptions from port
                port.ErrorReceived.Subscribe(Console.WriteLine).DisposeWith(comdis);
                port.IsOpenObservable.Subscribe(x => Console.WriteLine($"Port {comPortName} is {(x ? "Open" : "Closed")}")).DisposeWith(comdis);

                // Subscribe to the Data Received
                port.DataReceived.BufferUntil(startChar, endChar, 100).Subscribe(data => Console.WriteLine(data)).DisposeWith(comdis);

                // Subscribe to the Is Open @500ms intervals and write to com port
                port.WhileIsOpen(TimeSpan.FromMilliseconds(500)).Subscribe(_ => port.Write(dataToWrite)).DisposeWith(comdis);

                // Open the Com Port after subscriptions created
                port.Open();
            }
            else
            {
                comdis?.Dispose();
                Console.WriteLine($"Port {comPortName} Disposed");
                comdis = [];
            }
        }).ForEach().Subscribe(name =>
        {
            // Show available ports
            Console.WriteLine(name);
        }).DisposeWith(dis);
        Console.ReadLine();

        // Cleanup ports
        comdis.Dispose();
        dis.Dispose();
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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.  net6.0-windows10.0.19041 is compatible.  net7.0 is compatible.  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.  net7.0-windows10.0.19041 is compatible.  net8.0 is compatible.  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.  net8.0-windows10.0.19041 is compatible. 
.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 (2)

Showing the top 2 NuGet packages that depend on SerialPortRx:

Package Downloads
ModbusRx

An Reactive version of NModbus4

MQTTnet.Rx.SerialPort

Reactive extensions for MQTTnet Broker

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.3 1,420 11/24/2023
3.0.2 91 11/11/2023
2.3.4 859 2/18/2023
2.3.2 347 1/10/2023
2.3.1 286 1/10/2023
2.2.6 6,658 7/22/2022
2.1.4 437 7/21/2022
2.1.3 427 7/21/2022
2.1.2 434 7/20/2022
2.1.1 677 12/13/2021
1.4.4 728 5/1/2021
1.4.3 863 2/24/2020
1.4.2 625 1/19/2020
1.4.1 587 12/29/2019
1.4.0 609 12/29/2019
1.3.1 993 1/8/2019
1.3.0 861 10/17/2018
1.2.0 822 9/19/2018
1.1.0 937 8/15/2018
1.0.1 1,050 6/27/2018
1.0.0 1,033 5/28/2018
0.0.0.5 1,038 2/15/2018
0.0.0.4 1,197 9/29/2016
0.0.0.3 974 9/27/2016
0.0.0.2 942 9/26/2016
0.0.0.1 914 9/25/2016

Compatability with Net 6/ 7/ 8 and netstandard2.0