ProductPromotion
Logo

C++ Programming

made by https://0x3d.site

GitHub - itas109/CSerialPort: CSerialPort - lightweight cross-platform serial port library for C++/C/C#/Java/Python/Node.js/Electron
CSerialPort - lightweight cross-platform serial port library for C++/C/C#/Java/Python/Node.js/Electron  - GitHub - itas109/CSerialPort: CSerialPort - lightweight cross-platform serial port library ...
Visit Site

GitHub - itas109/CSerialPort: CSerialPort - lightweight cross-platform serial port library for C++/C/C#/Java/Python/Node.js/Electron

GitHub - itas109/CSerialPort: CSerialPort - lightweight cross-platform serial port library for C++/C/C#/Java/Python/Node.js/Electron

CSerialPort

中文

CSerialPort is a lightweight cross-platform serial port library based on C++, which can easy to read and write serial port on multiple operating system. Also support C, C#, Java, Python, Node.js, Electron etc.


Design Principles

  • Cross-platform
  • Easy to use
  • Higher efficiency

Platform

CSerialPort was tested on the following platforms

  • Windows ( x86, x86_64, arm64 )
  • Linux ( x86, x86_64, arm, arm64/aarch64, mips64el, riscv, s390x, ppc64le )
  • macOS ( x86_64 )
  • Raspberry Pi ( armv7l )
  • FreeBSD ( x86_64 )
  • ...

Todo List

Long-term Goal

  • 1.support windows and linux first
  • 2.add communicating protocol
  • 3.support hot swap - CSerialPortExtend
  • 4.higher efficiency notify module - replace with CSerialPortListener
  • 5.support other language - C, C#, Java, Python, Node.js, Electron etc. - more information bindings
  • 6.sync serial port communication
  • 7.new cross-platform gui serial port tool - CommMaster
  • 8.add introduction and tutorial of CSerialPort - CSerialPort Tutorial
  • 9.serial port monitor hook

Short-term Goal

  • 1.cross-platform OS identify class
  • 2.cross-platform thread class
  • 3.cross-platform lock class
  • 4.cross-platform higher efficiency timer class
  • 5.cross-platform thread pool class
  • 6.Performance test report(Throughput && delay && packet dropout rates)

Latest version

Version: 4.3.1.240204

by itas109 on 2024-02-04

Quick Start

$ git clone --depth=1 https://github.com/itas109/CSerialPort.git
$ cd CSerialPort
$ mkdir bin && cd bin
$ cmake ..
$ cmake --build .

run demo ( for example serial port lookback test on linux)

CSerialPort/bin $ ./CSerialPortDemoNoGui 
Version: https://github.com/itas109/CSerialPort - V4.3.1.240204

AvailableFriendlyPorts:
1 - /dev/ttyUSB0 QinHeng CH340 serial converter 1a86:7523
2 - /dev/pts/0 0 pty terminal

Please Input The Index Of Port(1 - 2)
1
Port Name: /dev/ttyUSB0
[CSERIALPORT_DEBUG] openPort - portName: /dev/ttyUSB0, baudRate: 9600, dataBit: 8, parity: 0, stopBit: 0, flowControl: 0, mode: async, readBufferSize:4096(4096), readIntervalTimeoutMS: 0, minByteReadNotify: 1
[CSERIALPORT_DEBUG] openPort - open /dev/ttyUSB0. code: 0, message: success
Open /dev/ttyUSB0 Success
Code: 0, Message: success
[CSERIALPORT_DEBUG] writeData - write. len: 5, hex(top100): 3132333435
[CSERIALPORT_DEBUG] writeData - write. len: 7, hex(top100): 69746173313039
[CSERIALPORT_DEBUG] commThreadMonitor - write buffer(usedLen 12). len: 12, hex(top100): 313233343569746173313039
[CSERIALPORT_DEBUG] commThreadMonitor - onReadEvent. portName: /dev/ttyUSB0, readLen: 12
[CSERIALPORT_DEBUG] readData - read. len: 12, hex(top100): 313233343569746173313039
/dev/ttyUSB0 - Count: 1, Length: 12, Str: 12345itas109, Hex: 0x31 0x32 0x33 0x34 0x35 0x69 0x74 0x61 0x73 0x31 0x30 0x39 

Install CSerialPort Using Vcpkg

You can download and install CSerialPort using the vcpkg dependency manager

$ git clone https://github.com/Microsoft/vcpkg.git
$ cd vcpkg
$ ./bootstrap-vcpkg.sh
$ ./vcpkg install cserialport

Cross Compile

  • arm on ubuntu 20.04
$ sudo apt-get install g++-arm-linux-gnueabi
$ cd CSerialPort
$ mkdir bin_arm && cd bin_arm
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain_arm.cmake
$ cmake --build .
  • aarch64 on ubuntu 20.04
$ sudo apt-get install g++-aarch64-linux-gnu
$ cd CSerialPort
$ mkdir bin_aarch64 && cd bin_aarch64
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain_aarch64.cmake
$ cmake --build .
  • mips64el on ubuntu 20.04
$ sudo apt-get install g++-mips64el-linux-gnuabi64
$ cd CSerialPort
$ mkdir bin_mips64el && cd bin_mips64el
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain_mips64el.cmake
$ cmake --build .
  • riscv64 on ubuntu 20.04
$ sudo apt-get install g++-riscv64-linux-gnu
$ cd CSerialPort
$ mkdir bin_riscv64 && cd bin_riscv64
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain_riscv64.cmake
$ cmake --build .

Screenshot

Gui

Demo Path: CSerialPort/examples/CommQT

image

Tui

Demo Path: CSerialPort/examples/CommTui

image

No Gui

Demo Path: CSerialPort/examples/CommNoGui

image

Documents

API Document Directory List Document Error Guide Document Frequently Asked Questions

Contacting

Links

CSerialPort-based Applications

1. CommMaster

  • support windows/linux/macos/raspberrypi and so on
  • support custom port name
  • support custom baudrate
  • support custom language
  • support custom theme

https://gitee.com/itas109/CommMaster

image

2. CommLite

CommLite is tui's serial port tool based CSerialPort

  • support x86, arm, mips cpu architecture
  • support windows dos, linux, macos,raspberrypi, freebsd operating system

https://github.com/itas109/CommLite

image

Donate

CSDN Blog


Other branches

Only for windows branch : https://github.com/itas109/CSerialPort/tree/CSerialPort_win_3.0.3

Thanks for Remon Spekreijse's serial library


License

since V3.0.0.171216 use GNU Lesser General Public License v3.0

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory