lib/sgs/nmea.rb in sgslib-1.5.1 vs lib/sgs/nmea.rb in sgslib-1.6.0
- old
+ new
@@ -85,11 +85,11 @@
# ["GPRMC", "211321.000", "A", "5309.7743", "N", "00904.5576", "W", "0.17", "78.41", "200813", "", "", "A"]
def parse_gprmc
if @args.count < 12 or @args.count > 13
return nil
end
- gps = SGS::GPS.new
+ gps = GPS.new
gps.is_valid if @args[2] == "A"
hh = @args[1][0..1].to_i
mm = @args[1][2..3].to_i
ss = @args[1][4..-1].to_f
us = (ss % 1.0 * 1000000)
@@ -98,10 +98,11 @@
mn = @args[9][2..3].to_i
yy = @args[9][4..5].to_i + 2000
gps.time = Time.gm(yy, mn, dd, hh, mm, ss, us)
pos = {"latitude" => ll_nmea(@args[3,4]),
"longitude" => ll_nmea(@args[5,6])}
- gps.location = Location.parse pos
+ gps.location = Location.new
+ gps.location.parse_hash(pos)
gps.sog = @args[7].to_f
gps.cmg = Bearing.dtor @args[8].to_f
gps
end