Class: NMEAPlus::Message::NMEA::NMEAMessage

Inherits:
Base
  • Object
show all
Defined in:
lib/nmea_plus/message/nmea/base_nmea.rb

Overview

The base class for NMEA messages includes a few more NMEA-specific parsing functions

Direct Known Subclasses

AAM, ALM, APA, BOD, BWR, DBK, DCN, DPT, DTM, FSI, GBS, GGA, GLC, GLL, GNS, GRS, GSA, GST, GSV, GTD, GXA, HDM, HDT, HFB, HSC, ITS, LCD, MSK, MSS, MTW, MWV, OLN, OSD, PASHR, R00, RMA, RMB, RMC, ROT, RPM, RSA, RSD, RTE, SFI, STN, TDS, TFI, TPC, TPR, TPT, TRF, TTM, VBW, VDR, VHW, VLW, VPW, VTG, VWR, WCV, WNC, WPL, XDR, XTE, XTR, ZDA, ZFO, ZTG

Instance Attribute Summary collapse

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 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

#message_typeString

NMEA message types are 5 characters (or so), the last of which are the message type

Returns:

  • (String)

    The two-character “talker ID” of the message



22
23
24
# File 'lib/nmea_plus/message/nmea/base_nmea.rb', line 22

def message_type
  data_type[2..-1]
end

#talkerString

NMEA message types are 5 characters, the first 2 of which are the talker ID

Returns:

  • (String)

    The two-character “talker ID” of the message



15
16
17
# File 'lib/nmea_plus/message/nmea/base_nmea.rb', line 15

def talker
  data_type[0..1]
end

Instance Method Details

#_10_boolean(field) ⇒ bool

Convert a string true/false (encoded as 1=true, 0=false) to boolean

Parameters:

  • field (String)

    the value in the field to be checked

Returns:

  • (bool)

    The value in the field or nil



40
41
42
43
44
45
46
# File 'lib/nmea_plus/message/nmea/base_nmea.rb', line 40

def _10_boolean(field)
  case field
  when '1' then return true
  when '0' then return false
  end
  nil
end

#_av_boolean(field) ⇒ bool

Convert a string true/false (encoded as A=true, V=false) to boolean

Parameters:

  • field (String)

    the value in the field to be checked

Returns:

  • (bool)

    The value in the field or nil



29
30
31
32
33
34
35
# File 'lib/nmea_plus/message/nmea/base_nmea.rb', line 29

def _av_boolean(field)
  case field
  when 'A' then return true
  when 'V' then return false
  end
  nil
end