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 NMEA-specific parsing functions beyond the base NMEA class.

Direct Known Subclasses

AAM, ALM, APA, BOD, BWR, DBK, DCN, DPT, DRU, DTM, FSI, GBS, GDA, GGA, GLC, GLL, GNS, GRS, GSA, GST, GSV, GTD, HCC, HDM, HDT, HFB, HSC, HVD, IMA, ITS, LCD, MHU, MMB, MSK, MSS, MTA, MTW, MWH, MWS, MWV, OLN, OLW, OMP, ONZ, OSD, PASHR, R00, RMA, RMB, RMC, RNN, ROT, RPM, RSA, RSD, RTE, SBK, SCD, SCY, SDB, SFI, SGD, SGR, SIU, SLC, SNC, SNU, SPS, SSF, STC, STN, STR, SYS, TDS, TEC, TEP, TFI, TGA, TIF, TPC, TPR, TPT, TRF, TRP, TRS, TTM, VBW, VCD, VDR, VHW, VLW, VPE, VPW, VTA, VTG, VTI, VWE, VWR, VWT, WCV, WDC, WFM, WNC, WPL, XDR, XTE, XTR, YWP, YWS, ZCD, ZDA, ZFO, ZTG, ZZU

Instance Attribute Summary collapse

Attributes inherited from Base

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

Class Method Summary collapse

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

#message_typeString

The generic type of the NMEA message. NMEA message types are 5 characters (or so): the first 2 are the talker ID, and the remaining characters are the generic message type.

Returns:

  • (String)

    The generic part of the NMEA “data type” of the message



26
27
28
# File 'lib/nmea_plus/message/nmea/base_nmea.rb', line 26

def message_type
  data_type[2..-1]
end

#talkerString

The first two characters of the NMEA message type

Returns:

  • (String)

    The two-character “talker ID” of the message



17
18
19
# File 'lib/nmea_plus/message/nmea/base_nmea.rb', line 17

def talker
  data_type[0..1]
end

Class Method Details

._10_boolean(field) ⇒ bool

Convert a string true/false (encoded as 1=true, 0=false) to boolean. This function is meant to be passed as a formatter to Base.field_reader.

Parameters:

  • field (String)

    the value in the field to be checked

Returns:

  • (bool)

    The value in the field or nil



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

def self._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. This function is meant to be passed as a formatter to Base.field_reader.

Parameters:

  • field (String)

    the value in the field to be checked

Returns:

  • (bool)

    The value in the field or nil



34
35
36
37
38
39
40
# File 'lib/nmea_plus/message/nmea/base_nmea.rb', line 34

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