Skip to content

pbosetti/ruby_mm_gps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MmGPS

Gem Version

Ruby interface to MarvelMind Indoor GPS System.

Installation

Add this line to your application's Gemfile:

gem 'mm_gps'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mm_gps

Usage

Simple usage example:

require 'mm_gps'

PORT = "/dev/cu.usbmodem1411"
BAUD = 115200 # SerialPort class does not support non-standard 500 kbps

beacon = MmGPS::Beacon.new(PORT, baud: BAUD)
beacon.trap # installs signal handler for CTRL-C

 # Standard each loop. Type CTRL-C for interrupting it
File.open("dump.hex", 'w') do |f|
  beacon.each do |packet, raw|
    p packet
    puts MmGPS::hexify(raw)
    f.print(raw)
  end
end

 # Use the enumerator:
beacon.reopen      # Needed, since CTRL-C in previous example also closes the Serialport connection
enum = beacon.each # gets the Enumerator
p enum.take 10     # Next 10 packets from enum

puts "Exiting"

Contributing

Bug reports and pull requests are welcome on GitHub .

License

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