Class: NMEAPlus::Message::NMEA::VTG

Inherits:
NMEAMessage show all
Defined in:
lib/nmea_plus/message/nmea/vtg.rb

Overview

VTG - Track made good and Ground speed

Instance Attribute Summary collapse

Attributes inherited from NMEAMessage

#message_type, #talker

Attributes inherited from Base

#checksum, #data_type, #fields, #interpreted_data_type, #message_number, #next_part, #original, #payload, #prefix, #total_messages

Instance Method Summary collapse

Methods inherited from NMEAMessage

_10_boolean, _av_boolean

Methods inherited from Base

_float, _hex_to_integer, #_highest_contiguous_index, _integer, _interval_hms, _string, _utc_date_time, _utctime_hms, #add_message_part, #all_checksums_ok?, #all_messages_received?, #calculated_checksum, #checksum_ok?, degrees_minutes_to_decimal, field_reader, #highest_contiguous_index, nsew_signed_float

Instance Attribute Details

#faa_modeString (readonly)

FAA Mode

Returns:

  • (String)


46
47
48
49
50
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 46

def faa_mode
  f = new_format? ? 9 : 100
  return nil if @fields[f].nil? || @fields[f].empty?
  @fields[f]
end

#speed_kmhFloat (readonly)

Speed in km/h

Returns:

  • (Float)


37
38
39
40
41
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 37

def speed_kmh
  f = new_format? ? 7 : 4
  return nil if @fields[f].nil? || @fields[f].empty?
  @fields[f].to_f
end

#speed_knotsFloat (readonly)

Speed in knots

Returns:

  • (Float)


28
29
30
31
32
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 28

def speed_knots
  f = new_format? ? 5 : 3
  return nil if @fields[f].nil? || @fields[f].empty?
  @fields[f].to_f
end

#track_degrees_magneticFloat (readonly)

Track in degrees, magnetic

Returns:

  • (Float)


19
20
21
22
23
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 19

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_trueObject (readonly)

Returns field 1 of the payload, formatted with the function #_float.

Returns:

  • field 1 of the payload, formatted with the function #_float



14
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 14

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”

Returns:

  • (bool)


10
11
12
# File 'lib/nmea_plus/message/nmea/vtg.rb', line 10

def new_format?
  'T' == @fields[2]
end