Class: Artoo::Interfaces::Interface

Inherits:
Object
  • Object
show all
Includes:
Celluloid, Celluloid::Notifications
Defined in:
lib/artoo/interfaces/interface.rb

Overview

The Interface class is the base class used to implement behavior for a specific category of robot. Examples would be a Rover or Copter.

Derive a class from this class, in order to implement higher-order behavior for a new category of robot.

Direct Known Subclasses

Ping, Rover

Constant Summary collapse

COMMANDS =
[].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Interface

Create new interface

Parameters:

  • params (Hash) (defaults to: {})

Options Hash (params):

  • :robot (Object)
  • :device (Object)


25
26
27
28
29
# File 'lib/artoo/interfaces/interface.rb', line 25

def initialize(params={})
  @name = params[:name]
  @robot = params[:robot]
  @device = params[:device]
end

Instance Attribute Details

#deviceObject

Returns the value of attribute device.



13
14
15
# File 'lib/artoo/interfaces/interface.rb', line 13

def device
  @device
end

#nameObject

Returns the value of attribute name.



13
14
15
# File 'lib/artoo/interfaces/interface.rb', line 13

def name
  @name
end

#robotObject

Returns the value of attribute robot.



13
14
15
# File 'lib/artoo/interfaces/interface.rb', line 13

def robot
  @robot
end

Instance Method Details

#commandsCollection

Returns commands.

Returns:

  • (Collection)

    commands



32
33
34
# File 'lib/artoo/interfaces/interface.rb', line 32

def commands
  self.class.const_get('COMMANDS')
end

#interface_typeObject



15
16
17
# File 'lib/artoo/interfaces/interface.rb', line 15

def interface_type
  :raw
end