Class: Arcenciel::Manager

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/arcenciel/manager.rb

Constant Summary

Constants included from Logging

Logging::DEFAULT_LOGGER

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

#log_error, #log_info, #log_warn, #logger

Constructor Details

#initialize(controllers) ⇒ Manager

Returns a new instance of Manager.



17
18
19
20
21
22
23
24
25
26
# File 'lib/arcenciel/manager.rb', line 17

def initialize(controllers)
  @controllers = controllers

  @hub = Hub.new
  @mutex = Mutex.new
  @shutdown = false

  @id_map = {}
  @port_map = {}
end

Instance Attribute Details

#controllersObject (readonly)

Returns the value of attribute controllers.



10
11
12
# File 'lib/arcenciel/manager.rb', line 10

def controllers
  @controllers
end

Class Method Details

.run!(controllers) ⇒ Object



13
14
15
# File 'lib/arcenciel/manager.rb', line 13

def self.run!(controllers)
  new(controllers).run!
end

Instance Method Details

#run!Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/arcenciel/manager.rb', line 28

def run!
  trap_signals

  add_listeners
  list_devices
  begin_notify

  start_hub
  run_loop
ensure
  clear_devices
end

#shutdown!Object



41
42
43
# File 'lib/arcenciel/manager.rb', line 41

def shutdown!
  @shutdown = true
end

#shutdown?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/arcenciel/manager.rb', line 45

def shutdown?
  !!@shutdown
end