Class: NMEAPlus::AISMessageFactory

Inherits:
MessageFactory show all
Defined in:
lib/nmea_plus/ais_message_factory.rb

Overview

Defines a factory for AIS messages, which will all use Message::AIS::AISMessage as their base

Class Method Summary collapse

Methods inherited from MessageFactory

best_match_for_data_type, create, dynamically_get_message_object, message_class_exists?, message_class_name

Class Method Details

.alternate_data_type(data_type) ⇒ String

Match all AIS messages as their generic counterparts. AIVDM becomes VDM, etc.

Parameters:

  • data_type (String)

    The data_type of the AIS message (e.g. the AIVDM of “$AIVDM,12,3,,4,5*00”)

Returns:

  • (String)

    The data_type that we will attempt to use in decoding the message (e.g. VDM)



18
19
20
21
# File 'lib/nmea_plus/ais_message_factory.rb', line 18

def self.alternate_data_type(data_type)
  # match last 3 digits (get rid of talker)
  data_type[2..4]
end

.parent_moduleString

Returns The name of the parent module: AIS.

Returns:

  • (String)

    The name of the parent module: AIS



11
12
13
# File 'lib/nmea_plus/ais_message_factory.rb', line 11

def self.parent_module
  "AIS"
end