CSerialPort is a lightweight cross-platform serial port library based on C/C++, which can easy to read and write serial port on multiple operating system. Also support C#, Java, Python, Node.js etc.
- Cross-platform
- Easy to use
- Higher efficiency
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 )
- ...
- 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#, Java, Python, Node.js 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
- 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)
by itas109 on 2023-02-15
$ 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 $ ./bin/CSerialPortDemoNoGui
Version: https://github.com/itas109/CSerialPort - V4.3.0.230215
availableFriendlyPorts:
1 - /dev/ttyS0
Please Input The Index Of Port(1 - 2)
1
Port Name: /dev/ttyS0
Open /dev/ttyS0 Success
Count: 1, Length: 29, Str: https://blog.csdn.net/itas109, Hex: 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F 0x62 0x6C 0x6F 0x67 0x2E 0x63 0x73 0x64 0x6E 0x2E 0x6E 0x65 0x74 0x2F 0x69 0x74 0x61 0x73 0x31 0x30 0x39
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
- 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 .
Demo Path: CSerialPort/examples/CommQT
Demo Path: CSerialPort/examples/CommTui
Demo Path: CSerialPort/examples/CommNoGui
API Document Directory List Document Error Guide Document Frequently Asked Questions
- Email : itas109@qq.com
- QQ Group : 129518033
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
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
Only for windows branch : https://github.com/itas109/CSerialPort/tree/CSerialPort_win_3.0.3
Thanks for Remon Spekreijse's serial library
since V3.0.0.171216 use GNU Lesser General Public License v3.0