Class: NMEAPlus::Message::AIS::VDMPayload::VDMMsg24

Inherits:
VDMMsg
  • Object
show all
Defined in:
lib/nmea_plus/message/ais/vdm_payload/vdm_msg24.rb

Overview

AIS Type 24: Static Data Report

Instance Attribute Summary collapse

Attributes inherited from VDMMsg

#message_type, #repeat_indicator, #source_mmsi, #source_mmsi_info

Attributes inherited from Payload

#fill_bits, #payload_bitstring

Instance Method Summary collapse

Methods inherited from VDMMsg

#auxiliary_craft?, #get_navigational_status_description, #get_ship_cargo_type_description

Methods inherited from Payload

#_2b_data_string, #_6b_ascii, #_6b_boolean, #_6b_integer, #_6b_integer_scaled, #_6b_integer_scaled_shifted, #_6b_negated_boolean, #_6b_string, #_6b_string_nullterminated, #_6b_unsigned_integer, #_6b_unsigned_integer_scaled, #_6b_unsigned_integer_scaled_shifted, #_8b_data_string, #_access, #_bit_slices, #_get_date_mdhm, #_object_by_name, #initialize, payload_reader

Constructor Details

This class inherits a constructor from NMEAPlus::Message::AIS::VDMPayload::Payload

Instance Attribute Details

#part_numberObject (readonly)

Returns The field defined by the 2 bits starting at payload bit 38, formatted with the function Payload#_u(, , ).

Returns:

  • The field defined by the 2 bits starting at payload bit 38, formatted with the function Payload#_u(, , )



11
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg24.rb', line 11

payload_reader :part_number, 38, 2, :_u

#ship_cargo_type_descriptionString (readonly)

Returns Cargo type description.

Returns:

  • (String)

    Cargo type description



43
44
45
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg24.rb', line 43

def ship_cargo_type_description
  get_ship_cargo_type_description(ship_cargo_type)
end

Instance Method Details

#payload_bitstring=(val) ⇒ Object

Override default bitstring setting to dynamically calculate what fields belong in this message which can be either part A or part B dpeending on the #part_number field



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg24.rb', line 15

def payload_bitstring=(val)
  super

  case part_number
  when 0
    self.class.payload_reader :name, 40, 120, :_t
  when 1
    self.class.payload_reader :ship_cargo_type, 40, 8, :_e
    self.class.payload_reader :vendor_id, 48, 18, :_t
    self.class.payload_reader :model_code, 66, 4, :_u
    self.class.payload_reader :serial_number, 70, 20, :_u
    self.class.payload_reader :callsign, 90, 42, :_t

    # If the MMSI is that of an auxiliary craft, these 30 bits are read as the MMSI of the mother ship.
    # otherwise they are the vessel dimensions
    if auxiliary_craft?
      self.class.payload_reader :mothership_mmsi, 132, 30, :_u
    else
      self.class.payload_reader :ship_dimension_to_bow, 132, 9, :_u
      self.class.payload_reader :ship_dimension_to_stern, 141, 9, :_u
      self.class.payload_reader :ship_dimension_to_port, 150, 6, :_u
      self.class.payload_reader :ship_dimension_to_starboard, 156, 6, :_u
    end
  end
end