Automatic Dependent Surveillance Broadcast is a cooperative surveillance technology in which an aircraft determines its position via satellite navigation and periodically broadcasts it. This gem decodes automatic dependent surveillance broadcasts.
Add this line to your application's Gemfile:
gem 'ruby-adsb', require: 'adsb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby-adsb
Create a new message:
message = ADSB::Message.new('8D4840D6202CC371C32CE0576098')
Get the address of the sender:
address = message.address
Get the type of message:
type = message.type
The type of message is either :identification
, :position
, or :velocity
.
Get the reported identification:
identification = message.identification
Create a new compact position report from a message of even parity and a message of odd parity:
even = ADSB::Message.new('8D40621D58C382D690C8AC2863A7')
odd = ADSB::Message.new('8D40621D58C386435CC412692AD6')
report = ADSB::CPR::Report.new(even, odd)
Get the reported altitude:
altitude = report.altitude
Get the reported latitude:
latitude = report.latitude
Get the reported longitude:
longitude = report.longitude
Get the reported heading:
heading = message.heading
Get the reported velocity:
velocity = message.velocity
After checking out the repo, run bin/setup
to install dependencies. Then, run
rake test
to run the tests. You can also run bin/console
for an interactive
prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To
release a new version, update the version number in version.rb
, and then run
bundle exec rake release
, which will create a git tag for the version, push
git commits and tags, and push the .gem
file to
rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/lboekhorst/ruby-adsb.
The gem is available as open source under the terms of the MIT license.