All Projects → hybridgroup → Rubyserial

hybridgroup / Rubyserial

Licence: other
FFI Ruby library for RS-232 serial port communication

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Rubyserial

Androidserialport
Android串口通信示例
Stars: ✭ 497 (+250%)
Mutual labels:  serialport, serial-ports
etherport-client
Client-side virtual serial port for Etherport. Used to implement firmata-compatible boards and relays.
Stars: ✭ 20 (-85.92%)
Mutual labels:  serial-ports, serialport
Libserial
Serial Port Programming in C++
Stars: ✭ 201 (+41.55%)
Mutual labels:  serialport, serial-ports
Common
Yet another serial port debugger.
Stars: ✭ 245 (+72.54%)
Mutual labels:  serialport, serial-ports
Ninjaterm
A serial port terminal that's got your back.
Stars: ✭ 24 (-83.1%)
Mutual labels:  serialport, serial-ports
Node Serialport
Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
Stars: ✭ 5,015 (+3431.69%)
Mutual labels:  serialport, serial-ports
RxSerialPort
基于Rxjava2.x的串口通信library
Stars: ✭ 11 (-92.25%)
Mutual labels:  serial-ports, serialport
serial.nim
A Nim library for accessing serial ports.
Stars: ✭ 59 (-58.45%)
Mutual labels:  serial-ports, serialport
Androidserialport
Android Serial Port , 基本的Android 串口通信库
Stars: ✭ 99 (-30.28%)
Mutual labels:  serialport, serial-ports
serialport
PHP Serial Port
Stars: ✭ 42 (-70.42%)
Mutual labels:  serial-ports, serialport
Cserialport
基于C++的轻量级开源跨平台串口类库Lightweight cross-platform serial port library based on C++
Stars: ✭ 296 (+108.45%)
Mutual labels:  serialport, serial-ports
serialPort
Android通用的串口通信库
Stars: ✭ 39 (-72.54%)
Mutual labels:  serial-ports, serialport
Cserialport
The latest modified version of Remon Spekreijse's serial port class
Stars: ✭ 64 (-54.93%)
Mutual labels:  serialport, serial-ports
Swiftygpio
A Swift library for hardware projects on Linux/ARM boards with support for GPIOs/SPI/I2C/PWM/UART/1Wire.
Stars: ✭ 1,188 (+736.62%)
Mutual labels:  serialport
Orsserialport
Serial port library for Objective-C and Swift macOS apps
Stars: ✭ 609 (+328.87%)
Mutual labels:  serial-ports
Akka Serial
Reactive serial communication library for Akka and Scala.
Stars: ✭ 123 (-13.38%)
Mutual labels:  serial-ports
React Native Serialport
React Native - Usb Serial Port Communication For Android Platform
Stars: ✭ 72 (-49.3%)
Mutual labels:  serialport
Scriptcommunicator serial Terminal
Scriptable cross-platform data terminal which supports: serial port, UDP, TCP, SPI, I2C and CAN.
Stars: ✭ 462 (+225.35%)
Mutual labels:  serialport
Gort
Command Line Interface (CLI) for RobotOps
Stars: ✭ 425 (+199.3%)
Mutual labels:  serial-ports
Serialtool
A cross platform Serial-Port/TCP/UDP debugging tool.
Stars: ✭ 384 (+170.42%)
Mutual labels:  serialport

rubyserial

RubySerial is a simple Ruby gem for reading from and writing to serial ports.

Unlike other Ruby serial port implementations, it supports all of the most popular Ruby implementations (MRI, JRuby, & Rubinius) on the most popular operating systems (OSX, Linux, & Windows). And it does not require any native compilation thanks to using RubyFFI https://github.com/ffi/ffi.

The interface to RubySerial should be (mostly) compatible with other Ruby serialport gems, so you should be able to drop in the new gem, change the require and use it as a replacement. If not, please let us know so we can address any issues.

Build Status Build status Test Coverage

Installation

$ gem install rubyserial

Usage

require 'rubyserial'
serialport = Serial.new '/dev/ttyACM0' # Defaults to 9600 baud, 8 data bits, and no parity
serialport = Serial.new '/dev/ttyACM0', 57600
serialport = Serial.new '/dev/ttyACM0', 19200, 8, :even

Methods

write(data : String) -> Int

Returns the number of bytes written. Emits a RubySerial::Error on error.

read(length : Int) -> String

Returns a string up to length long. It is not guaranteed to return the entire length specified, and will return an empty string if no data is available. Emits a RubySerial::Error on error.

getbyte -> Fixnum or nil

Returns an 8 bit byte or nil if no data is available. Emits a RubySerial::Error on error.

RubySerial::Error

A wrapper error type that returns the underlying system error code and inherits from IOError.

Running the tests

The test suite is written using rspec, just use the rspec command.

Test dependencies

To run the tests on OS X and Linux, you must also have the socat utility program installed.

Installing socat on OS X

brew install socat

Installing socat on Linux

sudo apt-get install socat

Test on Windows

To run the tests on Windows requires com0com which can be downloaded from here:

https://github.com/hybridgroup/rubyserial/raw/appveyor_deps/setup_com0com_W7_x64_signed.exe

License

Apache 2.0. See LICENSE for more details.

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