Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Author:: Max Lapshin (mailto:max@maxidoors.ru) Copyright:: Copyright (c) 2007 Max Lapshin, Getalime License:: Distributes under the same terms as Ruby
To use NMEA parser, you should somehow get data stream from Yor gps device. For example, You can use ruby-serialport (which seems to be dead, but working). The example on Mac with installed USB-Serial driver:
require 'serialport'
require 'nmea'
@sp = SerialPort.open("/dev/tty.usbserial", 4800, 8, 1, SerialPort::NONE)
@handler = NMEAHandler.new
while(@sentence = @sp.gets) do
NMEA.scan(@sentence, @handler)
end
NMEAHandler is a user class, that implements following interface:
class NMEAHandler
def rmc(time, latitude, longitude, speed, course, magnetic_variation)
# read further about types of latitude and longitude
end
def gsv(flag, satellites)
end
def gsa(mode_state, mode, satellites, pdop, hdop, vdop)
end
def gga(time, latitude, longitude, gps_quality, active_satellite_count, gsa_hdop, altitude, geoidal_height, dgps_data_age, dgps_station_id)
end
end
As you can see, the following NMEA sentences are supported currently: $GPRMC, $GPGSV, $GPGSA, $GPGGA. If you need more, please contact me and provide me with several examples. I will add support for them. NMEA::scan will not try to call unexistent method on your handler, thus you can implement only those methods in your handler, you need to.
GSV handler has parameter flag. This flag can take one of the following values: :start
, :continue
and :finish
. GSV messages appears in packs of several sentences, but NMEA::scan is stateless,
thus your NMEAHandler should keep accumulate these messages.
It is important to mention, that NMEA::scan assumes, that You have classes GPS::Latitude and GPS::Longitude, which initializer, takes two arguments: degrees and minutes. You can use this example:
module GPS
AngleValue = Struct.new :degrees, :minutes
class AngleValue
def to_s
"%d %.4f%s" % [degrees.abs, minutes, symbol]
end
end
class Latitude < AngleValue
def symbol
degrees >= 0 ? "N" : "S"
end
end
class Longitude < AngleValue
def symbol
degrees >= 0 ? "E" : "W"
end
end
end
Supported devices.
Ruby NMEA has full support of Globalsat BU-353 device (http://www.usglobalsat.com/item.asp?itemid=60&catid=17).
NMEA syntax is assumed to be as in document nmea.html, taken from http://www.werple.net.au/~gnb/gps/nmea.html
FAQs
Unknown package
We found that nmea demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.