Skip to content

About

SerialPortCommunicator is a lightweight and efficient library designed for seamless communication over serial ports. It simplifies sending and receiving messages with support for asynchronous operations, configurable timeouts, and custom message handling. Ideal for building reliable, non-blocking serial port applications.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

Why It Was Created?

Why It Was Created? Before this library, sending a command and handling the response with separate handlers often caused confusion. Managing multiple commands at the same time made things even more chaotic and hard to control.

This library was created to solve these problems. It makes serial communication simpler and easier for developers to manage.

Example

using var _communicator = new SerialPortCommunicatorClient(
            new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One),
            new SerialPortCommunicatorOptions
            {
                Reader = (_) => _.ReadLine(),
                Writer = (_, text) => _.WriteLine(text),
                RequestTimeoutMs = 5000,
            });

var result = await _communicator.RequestAsync("test-command");

Console.WriteLine(result);

You can also check out example project.

Library Workflow Diagram

Image

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

SerialPortCommunicator is a lightweight and efficient library designed for seamless communication over serial ports. It simplifies sending and receiving messages with support for asynchronous operations, configurable timeouts, and custom message handling. Ideal for building reliable, non-blocking serial port applications.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages