Method: NMEAPlus::Message::AIS::VDMPayload::MMSIInfo#mid

Defined in:
lib/nmea_plus/message/ais/vdm_payload/mmsi_info.rb,
lib/nmea_plus/message/ais/vdm_payload/mmsi_info.rb
more...

#midInteger (readonly)

The MMSI Maritime Identification Digits (MID), indicating country codes as specified by the ITU. www.itu.int/online/mms/glad/cga_mids.sh

Returns:

  • (Integer)

    the MID

[View source]

77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/nmea_plus/message/ais/vdm_payload/mmsi_info.rb', line 77

def mid
  range = case category
          when :individual_ship then 0..2
          when :coast_station, :harbor_station, :pilot_station, :ais_repeater_station then 2..4
          when :sar_aircraft, :sar_aircraft_fixed, :sar_aircraft_helicopter then 3..5
          when :aton_physical, :aton_virtual, :aton then 2..4
          when :auxiliary_craft then 2..4
          when :handheld then 1..3
          when :sar_transmitter, :man_overboard, :epirb then 3..5
          end
  return nil if range.nil?
  id.to_s.rjust(9, '0')[range].to_i
end