Skip to content

jeffrafter/win32-serial

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
doc
 
 
 
 
ext
 
 
lib
 
 
 
 
 
 
GPL
 
 
 
 
 
 
 
 
== Win32Serial Extension Library (win32-serial)

Simple extension library to access Windows serial ports (COM ports) using the
Windows API. Originally written Apr. 10, 2006 by Travis Whitton 
< whitton@atlantic.net >

Gem conversion, organization and binary releases by Jeff Rafter. 

== Example

It is possible to use the library directly:

  require 'Win32Serial'
  port = 'COM1'
  s = Win32Serial.new
  s.open(port)
  s.config(9600, 8, Win32Serial::NOPARITY, Win32Serial::ONESTOPBIT)
  s.timeouts(0, 200, 0, 0, 0)
  bytes = s.write("AT+CGMI\r") || "< no bytes >"
  puts "#{bytes} bytes written to #{port}"
  puts "response " + (s.read(14) || " < no response >")
  s.close

A compatibility layer has been added which allows you to access the library
using a SerialPort class as well:

  require 'serialport'
  sp = SerialPort.new('COM1', 9600, 8, 1, SerialPort::NONE)
  sp.write("AT")
  sp.read(14)
  sp.close
  
In addition to write and read, getc is implemented for single byte reads. putc 
is also implemented for single byte writes.

== Installation

Assuming you have a development environment on the target Windows machine you
can simply install the Gem normally. Alternatively, binary gem releases are 
included in the bin folder and can be downloaded. These binary releases are
compiled using mingw and contain the Win32Serial.so, so no compilation on the
target Windows machine is necessary. These releases may not be compatible with
JRuby, Rubinius and other ruby implementations.

== License

Licensed under GPL. See GPL in the release.

== Copying

Original copying:

  Win32Serial extension library is copyrighted free software by Travis Whitton 
  &lt; whitton@atlantic.net &gt;. You can redistribute it under the terms 
  specified in the COPYING file of the Ruby distribution.

== Warranty 

Original warranty:

  THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED 
  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 
  MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

About

Ruby library for Windows API serial port communication based on http://grub.ath.cx/win32serial/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published