Project

rs_232

0.0
No commit activity in last 3 years
No release in over 3 years
RS-232 cross-platform implementation as Ruby C native extension.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Build Status

Ruby Serial Port implementation as C Native Extension. [ RS-232 ]

Rubygem offering simple API in order to start using Serial Port communication in your project running on Linux, Mac OS X or Windows.

Installation

Add this line to your application's Gemfile:

gem 'rs_232'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rs_232

Usage

You may use this gem directly as a low-level transport layer in your communication module. As an alternative you may check another gem called (ruby-digital-transport)[https://github.com/rlishtaba/ruby-digital-transport] which is kind of transport abstraction porviding unified interface to SerialPort (using this gem), TCP and USB-HID.

   > include Rs232
   > port = new_serial_port('/dev/tty.ACM0', baud_rate: 9600)
   #=> #<Rs232::Impl @port='/dev/tty.ACM0'>
   > port.open?
   #=> false
   > port.connect # rasing IOError in case of port couldn't be opened.
   #=> #<Rs232::Impl @port='/dev/tty.ACM0'> 
   > port.pending_bytes
   #=> 15
   > port.read(15)
   #=> 'Hello, World!!!'
   > port.write("Hi")
   #=> 2
   > port.close
   #=> true
   > port.open?
   #=> false

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rlishtaba/ruby-rs-232. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.