Class: Argus::NavData

Inherits:
Object
  • Object
show all
Defined in:
lib/argus/nav_data.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ NavData

Returns a new instance of NavData


5
6
7
8
# File 'lib/argus/nav_data.rb', line 5

def initialize(data)
  @data = data
  parse_nav_data(@data)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options


3
4
5
# File 'lib/argus/nav_data.rb', line 3

def options
  @options
end

#sequence_numberObject

Returns the value of attribute sequence_number


3
4
5
# File 'lib/argus/nav_data.rb', line 3

def sequence_number
  @sequence_number
end

#state_maskObject

Returns the value of attribute state_mask


3
4
5
# File 'lib/argus/nav_data.rb', line 3

def state_mask
  @state_mask
end

#vision_flagObject

Returns the value of attribute vision_flag


3
4
5
# File 'lib/argus/nav_data.rb', line 3

def vision_flag
  @vision_flag
end

Class Method Details

.bit_mask_readers(*names) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/argus/nav_data.rb', line 14

def self.bit_mask_readers(*names)
  names.each.with_index do |name, bit_number|
    if name.is_a?(Array)
      name, off_value, on_value = name
    else
      off_value = false
      on_value = true
    end
    define_method(name) { @state_mask[bit_number] == 0 ? off_value : on_value }
  end
end

Instance Method Details

#rawObject


10
11
12
# File 'lib/argus/nav_data.rb', line 10

def raw
  @data
end