Class: NMEAPlus::Message::AIS::VDMPayload::VDMMsg

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

Overview

The base class for the AIS payload, which uses its own encoding for its own subtypes

Instance Attribute Summary collapse

Attributes inherited from Payload

#fill_bits, #payload_bitstring

Instance Method Summary collapse

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

#message_typeObject (readonly)

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

Returns:

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



12
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb', line 12

payload_reader :message_type, 0, 6, :_u

#repeat_indicatorObject (readonly)

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

Returns:

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



13
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb', line 13

payload_reader :repeat_indicator, 6, 2, :_u

#source_mmsiObject (readonly)

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

Returns:

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



14
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb', line 14

payload_reader :source_mmsi, 8, 30, :_u

#source_mmsi_infoMMSIInfo (readonly)

Detailed information produced from the MMSI

Returns:

  • (MMSIInfo)

    MMSI information structure



19
20
21
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb', line 19

def source_mmsi_info
  MMSIInfo.new(source_mmsi)
end

Instance Method Details

#auxiliary_craft?Boolean

An MMSI is associated with an auxiliary craft when it is of the form 98XXXYYYY

Returns:

  • (Boolean)


93
94
95
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb', line 93

def auxiliary_craft?
  source_mmsi_info.category == :auxiliary_craft
end

#get_navigational_status_description(code) ⇒ String

Returns Navigational status description.

Parameters:

  • code (Integer)

    The navigational status id

Returns:

  • (String)

    Navigational status description



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb', line 99

def get_navigational_status_description(code)
  return nil if code.nil?
  case code
  when 0 then "Under way using engine"
  when 1 then "At anchor"
  when 2 then "Not under command"
  when 3 then "Restricted manoeuverability"
  when 4 then "Constrained by her draught"
  when 5 then "Moored"
  when 6 then "Aground"
  when 7 then "Engaged in Fishing"
  when 8 then "Under way sailing"
  when 9...13 then "Reserved for future use"
  when 14 then "AIS-SART active"
  else
    "Not defined"
  end
end

#get_ship_cargo_type_description(code) ⇒ String

The ship cargo type description lookup table

Parameters:

  • code (Integer)

    The cargo type id

Returns:

  • (String)

    Cargo type description



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb', line 26

def get_ship_cargo_type_description(code)
  case code
  when 0 then nil
  when 1...19 then "(future use)"
  when 20 then "WIG (any)"
  when 21 then "WIG Hazardous category A"
  when 22 then "WIG Hazardous category B"
  when 23 then "WIG Hazardous category C"
  when 24 then "WIG Hazardous category D"
  when 25...29 then "WIG (future use)"
  when 30 then "Fishing"
  when 31 then "Towing"
  when 32 then "Towing (large)"
  when 33 then "Dredging/underwater ops"
  when 34 then "Diving ops"
  when 35 then "Military ops"
  when 36 then "Sailing"
  when 37 then "Pleasure craft"
  when 38, 39 then "Reserved"
  when 40 then "High Speed Craft"
  when 41 then "HSC Hazardous category A"
  when 42 then "HSC Hazardous category B"
  when 43 then "HSC Hazardous category C"
  when 44 then "HSC Hazardous category D"
  when 45...48 then "HSC (reserved)"
  when 49 then "HSC (no additional information)"
  when 50 then "Pilot Vessel"
  when 51 then "Search and Rescue Vessel"
  when 52 then "Tug"
  when 53 then "Port Tender"
  when 54 then "Anti-pollution equipment"
  when 55 then "Law Enforcement"
  when 56, 57 then "Spare - Local Vessel"
  when 58 then "Medical Transport"
  when 59 then "Noncombatant ship according to RR Resolution No. 18"
  when 60 then "Passenger"
  when 61 then "Passenger, Hazardous category A"
  when 62 then "Passenger, Hazardous category B"
  when 63 then "Passenger, Hazardous category C"
  when 64 then "Passenger, Hazardous category D"
  when 65..68 then "Passenger, Reserved for future use"
  when 69 then "Passenger, No additional information"
  when 70 then "Cargo"
  when 71 then "Cargo, Hazardous category A"
  when 72 then "Cargo, Hazardous category B"
  when 73 then "Cargo, Hazardous category C"
  when 74 then "Cargo, Hazardous category D"
  when 75..78 then "Cargo, Reserved for future use"
  when 79 then "Cargo, No additional information"
  when 80 then "Tanker"
  when 81 then "Tanker, Hazardous category A"
  when 82 then "Tanker, Hazardous category B"
  when 83 then "Tanker, Hazardous category C"
  when 84 then "Tanker, Hazardous category D"
  when 85.88 then "Tanker, Reserved for future use"
  when 89 then "Tanker, No additional information"
  when 90 then "Other Type"
  when 91 then "Other Type, Hazardous category A"
  when 92 then "Other Type, Hazardous category B"
  when 93 then "Other Type, Hazardous category C"
  when 94 then "Other Type, Hazardous category D"
  when 95..98 then "Other Type, Reserved for future use"
  when 99 then "Other Type, no additional information"
  end
end