All Projects → crayzeewulf → Libserial

crayzeewulf / Libserial

Licence: bsd-3-clause
Serial Port Programming in C++

Projects that are alternatives of or similar to Libserial

etherport-client
Client-side virtual serial port for Etherport. Used to implement firmata-compatible boards and relays.
Stars: ✭ 20 (-90.05%)
Mutual labels:  serial-ports, serialport
serial.nim
A Nim library for accessing serial ports.
Stars: ✭ 59 (-70.65%)
Mutual labels:  serial-ports, serialport
RxSerialPort
基于Rxjava2.x的串口通信library
Stars: ✭ 11 (-94.53%)
Mutual labels:  serial-ports, serialport
Common
Yet another serial port debugger.
Stars: ✭ 245 (+21.89%)
Mutual labels:  serialport, serial-ports
Androidserialport
Android Serial Port , 基本的Android 串口通信库
Stars: ✭ 99 (-50.75%)
Mutual labels:  serialport, serial-ports
Cserialport
The latest modified version of Remon Spekreijse's serial port class
Stars: ✭ 64 (-68.16%)
Mutual labels:  serialport, serial-ports
Ninjaterm
A serial port terminal that's got your back.
Stars: ✭ 24 (-88.06%)
Mutual labels:  serialport, serial-ports
serialport
PHP Serial Port
Stars: ✭ 42 (-79.1%)
Mutual labels:  serial-ports, serialport
Cserialport
基于C++的轻量级开源跨平台串口类库Lightweight cross-platform serial port library based on C++
Stars: ✭ 296 (+47.26%)
Mutual labels:  serialport, serial-ports
serialPort
Android通用的串口通信库
Stars: ✭ 39 (-80.6%)
Mutual labels:  serial-ports, serialport
Node Serialport
Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
Stars: ✭ 5,015 (+2395.02%)
Mutual labels:  serialport, serial-ports
Androidserialport
Android串口通信示例
Stars: ✭ 497 (+147.26%)
Mutual labels:  serialport, serial-ports
Rubyserial
FFI Ruby library for RS-232 serial port communication
Stars: ✭ 142 (-29.35%)
Mutual labels:  serialport, serial-ports
Serialporthelper
Android串口通讯助手,使用C++实现。
Stars: ✭ 141 (-29.85%)
Mutual labels:  serialport
React Native Serialport
React Native - Usb Serial Port Communication For Android Platform
Stars: ✭ 72 (-64.18%)
Mutual labels:  serialport
Sers
Serial port access for the Go programming language.
Stars: ✭ 30 (-85.07%)
Mutual labels:  serial-ports
Usbdeviceswift
wrapper for IOKit.usb and IOKit.hid written on pure Swift that allows you convenient work with USB devices
Stars: ✭ 156 (-22.39%)
Mutual labels:  serial-ports
Wbuart32
A simple, basic, formally verified UART controller
Stars: ✭ 133 (-33.83%)
Mutual labels:  serialport
Uduino
Simple and easy connection between Arduino and Unity
Stars: ✭ 25 (-87.56%)
Mutual labels:  serial-ports
Node Escpos
🖨️ ESC/POS Printer driver for node
Stars: ✭ 752 (+274.13%)
Mutual labels:  serialport

Libserial

Thanks for checking out LibSerial! LibSerial provides a convenient, object oriented approach to accessing serial ports on Linux operating system.

After you get to know LibSerial a bit, if you find that you have ideas for improvement, please be sure to let us know!

If you simply want to use LibSerial and you already utilize a Debian Linux distribution, use apt to install the current release package:

sudo apt install libserial-dev

Note that the above command may install an older version of LibSerial (e.g. 0.6.0 on Ubuntu 18.04). In order to use the latest features and the example project mentioned below, please build the library from source code as described in here. We are working to release updated versions of the library from package repositories of major Linux distribution in the mean time and apologize for the inconvenience.

Example code to demonstrate how to use the library can be found in the examples directory. A self-contained example project demonstrating the use of CMake and GNU Autotools (make) can be found in examples/example_project directory.

Developers

If you are a developer and would like to make use of the latest code, you will need to have a few packages installed to build LibSerial: a recent g++ release (anything after gcc-3.2 should work), autotools, cmake, doxygen, sphinx, the python3 sip library, the boost unit test library, pkg-config, and Google Test (gtest). The following commands should install the required packages for Debian/Ubuntu users:

sudo apt update
sudo apt install g++ git autogen autoconf build-essential cmake graphviz \
                 libboost-dev libboost-test-dev libgtest-dev libtool \
                 python3-sip-dev doxygen python3-sphinx pkg-config \
                 python3-sphinx-rtd-theme

If you get the source code from github and would like to install the library, there are a few steps you will need to accomplish:

Building Using CMake

If you are using CMake, to build the library you can simply run the compile.sh script:

./compile.sh

To install the library:

cd build
sudo make install

You can specify an installation directory different from the default, (/usr/local/), by replacing the cmake .. command in the compile.sh script. For example, to install under /usr instead of the /usr/local directory, use the following:

cmake -DCMAKE_INSTALL_PREFIX=/usr ..

Building Using GNU Autotools

GNU Autotools is currently configured to built all unit tests, so first you will need to compile the GTest library object files and copy libgtest.a and libgtest_main.a into your /usr/lib/ directory which you can accomplish by running the gtest.sh convenience script:

./gtest.sh

To generate the configure script:

make -f Makefile.dist

To execute the configure script, first create a build directory, then run the script from the build directory as follows:

../configure

You can specify an installation directory different from the default, (/usr/local/), by adding --prefix=/installation/directory/path/ to the configure command. For example, to install into the top level include directory as the package manager would accomplish, you can simply run the following:

./configure --prefix=/usr/

Once you have executed the configure script, you can build the library with make and install with make install:

make
sudo make install

Example Code and Unit Tests

If you are interested in running the unit tests or example code, ensure serial port names are appropriate for your hardware configuration in the examples/ directory files and in the test/UnitTests.h file as such:

constexpr const char* const SERIAL_PORT_1 = "/dev/ttyUSB0" ;
constexpr const char* const SERIAL_PORT_2 = "/dev/ttyUSB1" ;

Example code and Unit test executables are easily built using the cmake compile script and can be run from the build directory:

./compile
./build/bin/UnitTests
./build/bin/SerialPortReadWriteExample

Unit test executables built using make can be run from the build directory in the following manner:

ctest -V .

Hardware and Software Considerations

If needed, you can grant user permissions to utilize the hardware ports in the following manner, (afterwards a reboot is required):

sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER

Socat

Socat is a useful tool to allow hardware ports to communicate on the same system via a software pipe. As an example, to allow hardware UART port /dev/ttyS0 to communicate via software with hardware UART port /dev/ttyS1:

socat -d -d pty,raw,echo=0,link=/dev/ttyS0 pty,raw,echo=0,link=/dev/ttyS1

Documentation

Complete documentation is available here.

Let us know that this repository was useful to you by clicking the "star" in the upper right corner of the LibSerial Github home page!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].