class SpheroPwn::Commands::GetPermanentFlags::Response

The robot's configuration flags that persist across power cycles.

Attributes

flags[R]

@return {Hash<Symbol, Boolean>} maps developer-friendly flag names to

whether the corresponding bits were set in the flags field

Public Class Methods

new(code_byte, sequence_byte, data_bytes) click to toggle source

@see {SpheroPwn::Response#initialize}

Calls superclass method SpheroPwn::Response::new
# File lib/sphero_pwn/commands/get_permanent_flags.rb, line 33
def initialize(code_byte, sequence_byte, data_bytes)
  super

  @flags = {}
  if code == :ok
    flags_number = data_bytes[0, 4].pack('C*').unpack('N').first
    SpheroPwn::Commands::GetPermanentFlags::FLAGS.each do |mask, name|
      @flags[name] = (flags_number & mask) != 0
    end
  end
end