RS232DLL 2.0.1

There is a newer version of this package available.
See the version list below for details.
NuGet\Install-Package RS232DLL -Version 2.0.1
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.
dotnet add package RS232DLL --version 2.0.1
<PackageReference Include="RS232DLL" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RS232DLL --version 2.0.1
#r "nuget: RS232DLL, 2.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install RS232DLL as a Cake Addin
#addin nuget:?package=RS232DLL&version=2.0.1

// Install RS232DLL as a Cake Tool
#tool nuget:?package=RS232DLL&version=2.0.1

https://github.com/beingWH/RS232DLL

RS232DLL

Version 2.0

Quick to Start

COM1&Com2 is the pair of SerialPort.

  ISerialPort COM1 = RS232Helper.Create("COM1", "COM1 AccessoryData", (str, obj) =>
    {
        Console.Write($"{obj as string} : {str as string} \r\n ");
    });
  ISerialPort COM2 = RS232Helper.Create("COM2", "COM2 AccessoryData", (str, obj) =>
  {
      Console.Write($"{obj as string} : {str as string} \r\n ");
  });
  for (int i = 0; i < 10; i++)
  {
      COM1.WriteStr("This is COM1");
      Thread.Sleep(500);
      COM2.WriteStr("This is COM2");
      Thread.Sleep(500);
  }
  Console.Read();
  COM1.Dispose();
  COM2.Dispose();

SerialPort Group

pair of SerialPort:COM1&COM2,COM3&COM4

  List<SPInstanceBase> SPIs = new List<SPInstanceBase>()
  {
      new SPInstanceBase("COM1","COM1 AccessoryData",delegate(Hex hex,object obj){Console.WriteLine((obj as string)+":"+hex.hexstring); }),
      new SPInstanceBase("COM2","COM2 AccessoryData",delegate(Hex hex,object obj){Console.WriteLine((obj as string)+":"+hex.hexstring); }),
      new SPInstanceBase("COM3","COM3 AccessoryData",delegate(Hex hex,object obj){Console.WriteLine((obj as string)+":"+hex.hexstring); }),
      new SPInstanceBase("COM4","COM4 AccessoryData",delegate(Hex hex,object obj){Console.WriteLine((obj as string)+":"+hex.hexstring); }),

  };
  for (int i = 0; i < 10; i++)
  {
      SPIs[0].WriteHex("0x01 02 3 0x4".GetHexValue());
      Thread.Sleep(500);
      SPIs[1].WriteHex("0X05 06 7 0X8".GetHexValue());
      Thread.Sleep(500);
      SPIs[2].WriteHex("0x09 0A B 0xC".GetHexValue());
      Thread.Sleep(500);
      SPIs[3].WriteHex("0X0D 0E F 0x11".GetHexValue());
      Thread.Sleep(500);
  }
  Console.Read();

Customize your own Class

pair of SerialPort:COM1&COM2

 public class MySpInstance : SPInstanceBase
    {
    // override virtual methods
    }

u can use your serialport class,like this

    using (MySpInstance COM2 = new MySpInstance("COM2"))
    {
        using (MySpInstance COM1 = new MySpInstance("COM1", "COM1 accessoryData"))
        {
            COM1.BytesReaderInitialize((byts, obj) =>
            {
                Console.WriteLine($"{obj as string}:{byts.Count()}");
            });

            for (int i = 0; i < 10; i++)
            {
                COM2.WriteStr("This is COM2");
                Thread.Sleep(200);
            }
            Console.Read();
        }
    }
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
2.1.1 630 3/10/2020
2.0.1 355 11/21/2019
2.0.0 515 11/20/2019
1.1.0 551 9/30/2019
1.0.2 540 9/26/2019

Fix a lot of bugs.