Module: ADSB::Messages::Identification

Defined in:
lib/adsb/messages/identification.rb

Instance Method Summary collapse

Instance Method Details

#identificationObject

Get the reported identification.

Examples

message = ADSB::Message.new('8D4840D6202CC371C32CE0576098')
address = message.address


10
11
12
13
14
15
16
# File 'lib/adsb/messages/identification.rb', line 10

def identification
  characters = '#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######'
  data = self.data[8..-1]
  identification = String.new
  (0..48).step(6) { |x| identification += characters[data[x..x + 5].to_i(2)] }
  return identification.gsub(/(_|#)/, String.new)
end