class SpheroPwn::Commands::SetPermanentFlags
Sets the robot's configuration flags that persist across power cycles.
Constants
- FLAGS
@return {Hash<Symbol, Number>} numbers for the symbolic values
Public Class Methods
new(new_flags)
click to toggle source
@param {Hash<Symbol, Boolean>} maps developer-friendly flag names to
whether the corresponding bits will be set in the flags field
Calls superclass method
SpheroPwn::Command::new
# File lib/sphero_pwn/commands/set_permanent_flags.rb, line 5 def initialize(new_flags) flags_number = 0 new_flags.each do |name, value| mask = SpheroPwn::Commands::SetPermanentFlags::FLAGS[name] if mask.nil? raise ArgumentError, "Unknown flag #{name.inspect}" end flags_number |= mask if value end super 0x02, 0x35, [flags_number].pack('N').unpack('C*') end
Public Instance Methods
response_class()
click to toggle source
@see {SpheroPwn::Command#response_class}
# File lib/sphero_pwn/commands/set_permanent_flags.rb, line 19 def response_class SpheroPwn::Commands::SetPermanentFlags::Response end