nmea_parser 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c0937781bc2cd458c0db8a31047ef178324a26e
4
- data.tar.gz: 1d8252da4c1d51e06e97f4b583bf2a56882519b4
3
+ metadata.gz: 628a106e7d8005139a7c2bfc63fc3346715580b3
4
+ data.tar.gz: 570de31b27695febccb16bb10bc8ab8c14408ba8
5
5
  SHA512:
6
- metadata.gz: b9745f9760e8f7372e6f3dbcf81c8f2c44fec2017fb46a972f29069371a688d87691c19979f259fdcc9c300119fcceca53df13bde5b4d2c0e2674a03a4279b0c
7
- data.tar.gz: bf1a7f4a7f872b2daab9455b772c509cf6fda326f3f446385ec526d3117d1a0a0c9d77a39eb0ffd9fdf7bff0ba828cb6bc5db70b2291687f64de9619fc5b9599
6
+ metadata.gz: dbabfc1ce0be0f985658a670db797ff0d5569bb326cb4da36ec1819f4e9f0cd000a80689035b68c32292f9d8ad422b03ea32edaf9be26509b3e5c5033630cdb4
7
+ data.tar.gz: de2cdc445c31b5afc18018ee781689d2dfa6d9c77a209ff33bfdb8bbeea0609b0bc53ecb33a0b44abd4ab9a3d307839f9e5880d7e87f5ee9da6d50ded91368fd
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/nmea_parser.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # file: nmea_parser.rb
4
4
 
5
5
  require 'time'
6
+ require 'date'
6
7
  require 'immutable_struct'
7
8
 
8
9
  class NMEAParser
@@ -22,16 +23,60 @@ class NMEAParser
22
23
  a = raw_line.split(',')
23
24
 
24
25
  case msgcode
26
+
25
27
  when /GGA/
28
+
26
29
  _, raw_time, raw_lat, ns, raw_lon, ew = a
27
30
  @time, @latitude, @longitude = Time.parse(raw_time),
28
31
  decimalize(raw_lat, ns), decimalize(raw_lon, ew)
32
+
33
+ # additional data captured
34
+ #
35
+ # Fix quality, Number of satellites being tracked, Horizontal dilution
36
+ # of position, Altitude (Meters, above mean sea level), Height of
37
+ # geoid, time in seconds since last DGPS update, DGPS station ID number
38
+
39
+ @quality, @num_sat, @hdop, @altitude, @alt_unit, @height_geoid,
40
+ @height_geoid_unit, @last_dgps, @dgps = a[6..-2] << a[-1][/^[^\*]+/]
41
+
42
+ when /RMC/
43
+
44
+ _, raw_time, _, raw_lat, ns, raw_lon, ew = a
45
+ @time, @latitude, @longitude = Time.parse(raw_time),
46
+ decimalize(raw_lat, ns), decimalize(raw_lon, ew)
47
+
48
+ # additional data captured
49
+ #
50
+ # Speed over the ground in knots, Track angle in degrees True,
51
+ # Date, Magnetic Variation,
52
+
53
+ @speed, @course = a[7..8]
54
+ @date, @variation = Date.parse(a[9]), a[10]
55
+ @var_direction = a[-1][/^[^\*]+/]
56
+
57
+ when /VTG/
58
+
59
+ # data captured
60
+
61
+ # True track made good (degrees), Magnetic track made good,
62
+ # Ground speed (knots), Ground speed (Kilometers per hour)
63
+
64
+ @track, @mag_track, @speed, @speed_kph = a.values_at(1,3,5,7)
65
+
29
66
  end
30
67
 
31
68
  end
32
69
 
33
70
  def to_h()
34
- {time: @time, latitude: @latitude, longitude: @longitude}
71
+ {
72
+ time: @time, latitude: @latitude, longitude: @longitude,
73
+ quality: @quality, num_sat: @num_sat, hdop: @hdop, altitude: @altitude,
74
+ alt_unit: @alt_unit, height_geoid: @height_geoid,
75
+ height_geoid_unit: @height_geoid_unit, last_dgps: @last_dgps,
76
+ dgps: @dgps, speed: @speed, course: @course, date: @date,
77
+ variation: @variation, var_direction: @var_direction, track: @track,
78
+ mag_track: @mag_track, speed: @speed, speed_kph: @speed_kph
79
+ }
35
80
  end
36
81
 
37
82
  def to_struct()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nmea_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file