All Projects → openmuc → jrxtx

openmuc / jrxtx

Licence: LGPL-2.1 license
The Java serial communication library.

Programming Languages

c
50402 projects - #5 most used programming language
java
68154 projects - #9 most used programming language
C++
36643 projects - #6 most used programming language
shell
77523 projects
M4
1887 projects
Makefile
30231 projects

Projects that are alternatives of or similar to jrxtx

Gps.js
A NMEA parser and GPS utility library
Stars: ✭ 171 (+131.08%)
Mutual labels:  serial
Wmi Static Spoofer
Spoofing the Windows 10 HDD/diskdrive serialnumber from kernel without hooking
Stars: ✭ 199 (+168.92%)
Mutual labels:  serial
bluetooth-terminal
ES6 class for serial communication with your own Bluetooth Low Energy (Smart) devices
Stars: ✭ 43 (-41.89%)
Mutual labels:  serial
Arduino Cmdmessenger
CmdMessenger Communication library for Arduino & .NET
Stars: ✭ 175 (+136.49%)
Mutual labels:  serial
Pyserial
Python serial port access library
Stars: ✭ 2,464 (+3229.73%)
Mutual labels:  serial
Adalight Fastled
Adalight with FastLED support
Stars: ✭ 232 (+213.51%)
Mutual labels:  serial
Esp32 Serial Bridge
Wifi to 3x Serial bridge based on a ESP32
Stars: ✭ 169 (+128.38%)
Mutual labels:  serial
neato-serial
Python serial interface for Neato robot vacuum cleaners. Testing on XV Signature Pro, should work on others.
Stars: ✭ 39 (-47.3%)
Mutual labels:  serial
Go Serial
A cross-platform serial library for go-lang.
Stars: ✭ 194 (+162.16%)
Mutual labels:  serial
LibSerialPort.jl
Julia wrapper for the libserialport c library
Stars: ✭ 54 (-27.03%)
Mutual labels:  serial
Packetserial
An Arduino Library that facilitates packet-based serial communication using COBS or SLIP encoding.
Stars: ✭ 177 (+139.19%)
Mutual labels:  serial
Qtswissarmyknife
QSAK (Qt Swiss Army Knife) is a multi-functional, cross-platform debugging tool based on Qt.
Stars: ✭ 196 (+164.86%)
Mutual labels:  serial
Saxi
Tools & library for driving the AxiDraw pen plotter
Stars: ✭ 234 (+216.22%)
Mutual labels:  serial
Androidbluetoothlibrary
A Library for easy implementation of Serial Bluetooth Classic and Low Energy on Android. 💙
Stars: ✭ 171 (+131.08%)
Mutual labels:  serial
arduivis
a bi-directional communication paradigm for programming languages & microcontrollers
Stars: ✭ 48 (-35.14%)
Mutual labels:  serial
Johnny Five
JavaScript Robotics and IoT programming framework, developed at Bocoup.
Stars: ✭ 12,498 (+16789.19%)
Mutual labels:  serial
Ohsce
PHP HI-REL SOCKET TCP/UDP/ICMP/Serial .高可靠性PHP通信&控制框架SOCKET-TCP/UDP/ICMP/硬件Serial-RS232/RS422/RS485 AND MORE!
Stars: ✭ 206 (+178.38%)
Mutual labels:  serial
convey
Communication through a serial port or named pipe
Stars: ✭ 46 (-37.84%)
Mutual labels:  serial
Huhnitor
Intergalactic serial monitor for ESP8266 Deauther
Stars: ✭ 265 (+258.11%)
Mutual labels:  serial
Nodemcu Tool
🔧 Upload + Manage Lua files on NodeMCU
Stars: ✭ 248 (+235.14%)
Mutual labels:  serial

jRxTx - Java Serial Communication Library

jRxTx is a Java serial communication library licensed under the LGPLv2.1 or later + linking exception. It can be used to communicate using well known UART-based serial protocols such as RS-232, RS-422 and RS-485. The goal of jRxTx is to provide a lightweight, intuitive and well documented API.

jRxTx wraps the popular RXTX library for which development has been discontinued. jRxTx provides two kinds of APIs: 1) the original RXTX API and 2) a new improved API.

Original RXTX API

jRxTx can be used as a drop-in replacement for RXTX. The wrapped RXTX has some advantages compared to the last RXTX release (version 2.2pre2):

  • It includes several bug fixes that do NOT change its API though

  • The jar file is an OSGi Bundle

  • The jar file is published on maven central.

  • The Java build system is based on Gradle. This way it is easy to add the native libs to the jar.

Find the Javadoc of the most current release here: https://openmuc.github.io/jrxtx/javadoc/index.html.

New jRxTx API

In addition to the original RXTX API jRxTx provides a new API with the following advantages:

The InputStream implementation provided by the original RXTX violates the contract of the general java.io.InputStream interface. It has the following two problems:

  • A timeout does not throw an exception but instead returns -1. But according to the InputStream interface -1 should only be returned if the stream is closed (i.e. the end of stream is reached).

  • A thread blocking in InputStream.read() cannot be interrupted by closing the associated serial port. Trying to close the serial port while another thread is blocking in read() causes the close() function to block as well.

jRxTx provides an InputStream implementation that conforms to the java.io.InputStream interface and behaves very similarly to the stream provided by java.net.Socket used for IP communication.

The event listener available in RXTX was removed in jRxTx because it is not needed for data stream reading.

Java and Native Parts

jRxTx consists of a Java library and a native library written in C. The Java library calls the native library through JNI. The Java library (jrxtx-<version>.jar) is published on maven central. As published on maven central the Java jar file does not include the native library.

While the Java library is platform independent, the native part of jRxTx needs to be compiled separately for different processor architectures and operating systems. Because of the large variety of platforms jRxTx does not ship with any precompiled native libs.

The jRxTx java library is compatible with the original RXTX native library. Thus you can also use the old RXTX native library or the native library of other RXTX compatible projects such as NRJavaSerial.

You have two options to use the native library:

  1. You can install the native library so that the Java virtual machine can find it.

  2. You can rebuild the jrxtx jar file to include the native library of your choice.

The Java library first searches a native library inside the jar file. If no compatible lib can be found it tries to load the libary from the java.library.path (e.g. /usr/lib/jni).

Installation

Linux

The jRxTx native library is compatible to the RXTX native library. Therefore on Debian based distributions all you have to do is install the package ‘librxtx-java’:

$ sudo apt-get install librxtx-java

This will install the correct native library in /usr/lib/jni. Sometimes you might have to add a system property so that the JVM finds it: -Djava.library.path=/usr/lib/jni .

The serial ports /dev/tty* are only accessible to members belonging to groups dialout and tty. You therefore have to add your user to those groups. E.g. using:

sudo adduser <yourUserName> dialout

sudo adduser <yourUserName> tty

Afterwards you have to log out and log back in in order for the group changes to become active.

Windows

On Windows you need to copy the native library of RXTX for your specific system to the folder that is in the java.libary.path. To figure out the actual Java library path in your system, you can write a Java program that prints System.getProperty(‘java.library.path’).

You can get the native library either from the last official RXTX distribution rxtx-2.2pre2-bins.zip or you can compile it on your own from the source code.

Compile jRxTx

Linux

To compile the jRxTx Java library run the following command:

$ ./gradlew clean build

The resulting jar can be found in build/libs.

To rebuild the native library on Linux enter the folder native. Then run:

$ ./BUILD.sh

The compiled library (librxtxSerial.so) can be found in the .libs/ folder.

Once you have compiled the native library you install it so that the JVM can find and load it. Alternatively you can compile the jar with the native lib included:

$ ./gradlew clean buildWithNative

This will create the jar file and include any librxtxSerial.so/.dll file found in the native folder. A jar file created this way can load the native library from the jar.

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].