/NullModemEmulator

com0com virtual serial port wrapper for C#

Primary LanguageC#MIT LicenseMIT

Hsu.NullModemEmulator

continuous

Package Version

Version NuGet MyGet
Stable NuGet MyGet
Preview NuGet MyGet

Install com0com

com0com home page

Windows 10+ need update driver with sign

  • Window Update
  • Setting->Windows Update->Check for Update
  • Setting->Windows Update->Advanced Options->Optional Update
  • Vyacheslav Frolov - CNCPorts - 10/10/2015 12:00:00 AM - 3.0.0.0

Getting started

Install Nuget Package

  • Package Manager

    Install-Package Hsu.NullModemEmulator
  • .NET CLI

    dotnet add package Hsu.NullModemEmulator
  • PackageReference

    <PackageReference Include="Hsu.NullModemEmulator" Version="2022.206.16.0" />

Instance Object

NullModemEmulatorManager manager = new();

List Virtual Ports

var list = await manager.ListAsync();
foreach (var item in list)
{
    Console.WriteLine(item);
    Console.WriteLine(item.A);
    Console.WriteLine(item.B);
}

Add a Pair Virtual Port

var ret = await manager.AddPairAsync(
    new PortBuilder()
    .PortName("COM1")
    .EmulateBaudRate(true)
    ,
    new PortBuilder()
    .PortName("COM2")
    .EmulateBaudRate(true)
);

Change Virtual Port Paramters

var ret = await manager.ChangeAsync(
    1,
    PortBusOrder.A,
    new PortBuilder()
    .PortName("COM11")
    .EmulateBaudRate(false)
);

Remove a Pair Virtual Port

var ret = await manager.RemoveAsync(1);

Remove All Virtual Ports

var ret = await manager.RemoveAllAsync();

List Friendly Name

var list = await manager.ListFriendlyNameAsync();
foreach (var item in list)
{
    Console.WriteLine(item.Bus.FriendlyName);
    Console.WriteLine(item.A.FriendlyName);
    Console.WriteLine(item.B.FriendlyName);
}