Class: NMEAPlus::Message::NMEA::VTG
- Inherits:
-
NMEAMessage
- Object
- Base
- NMEAMessage
- NMEAPlus::Message::NMEA::VTG
- Defined in:
- lib/nmea_plus/message/nmea/vtg.rb
Instance Attribute Summary collapse
- #faa_mode ⇒ String readonly
- #speed_kmh ⇒ Float readonly
- #speed_knots ⇒ Float readonly
- #track_degrees_magnetic ⇒ Float readonly
-
#track_degrees_true ⇒ Object
readonly
Field 1 of the payload, formatted with the function Base#_float.
Attributes inherited from NMEAMessage
Attributes inherited from Base
#checksum, #data_type, #fields, #interpreted_data_type, #message_number, #next_part, #original, #payload, #prefix, #total_messages
Instance Method Summary collapse
-
#new_format? ⇒ bool
whether this is the new format.
Methods inherited from NMEAMessage
Methods inherited from Base
#_degrees_minutes_to_decimal, #_float, #_hex_to_integer, #_highest_contiguous_index, #_integer, #_interval_hms, #_nsew_signed_float, #_string, #_utc_date_time, #_utctime_hms, #add_message_part, #all_checksums_ok?, #all_messages_received?, #calculated_checksum, #checksum_ok?, field_reader, #highest_contiguous_index
Instance Attribute Details
#faa_mode ⇒ String (readonly)
41 42 43 44 45 |
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 41 def faa_mode f = new_format? ? 9 : 100 return nil if @fields[f].nil? || @fields[f].empty? @fields[f] end |
#speed_kmh ⇒ Float (readonly)
33 34 35 36 37 |
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 33 def speed_kmh f = new_format? ? 7 : 4 return nil if @fields[f].nil? || @fields[f].empty? @fields[f].to_f end |
#speed_knots ⇒ Float (readonly)
25 26 27 28 29 |
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 25 def speed_knots f = new_format? ? 5 : 3 return nil if @fields[f].nil? || @fields[f].empty? @fields[f].to_f end |
#track_degrees_magnetic ⇒ Float (readonly)
17 18 19 20 21 |
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 17 def track_degrees_magnetic f = new_format? ? 3 : 2 return nil if @fields[f].nil? || @fields[f].empty? @fields[f].to_f end |
#track_degrees_true ⇒ Object (readonly)
Returns field 1 of the payload, formatted with the function Base#_float.
13 |
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 13 field_reader :track_degrees_true, 1, :_float |
Instance Method Details
#new_format? ⇒ bool
whether this is the new format. docs say check field #2 for value “2”
9 10 11 |
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 9 def new_format? 'T' == @fields[2] end |