Class: OpenC3::Bridge

Inherits:
Object show all
Defined in:
lib/openc3/bridge/bridge.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename, existing_variables = {}) ⇒ Bridge

Returns a new instance of Bridge.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/openc3/bridge/bridge.rb', line 25

def initialize(filename, existing_variables = {})
  @config = BridgeConfig.new(filename, existing_variables)
  @threads = []

  # Start Interface Threads
  @config.interfaces.each do |interface_name, interface|
    @threads << BridgeInterfaceThread.new(interface)
    @threads[-1].start
  end

  # Start Router Threads
  @config.routers.each do |router_name, router|
    @threads << BridgeRouterThread.new(router)
    @threads[-1].start
  end

  at_exit() do
    shutdown()
  end
end

Instance Method Details

#shutdownObject



46
47
48
49
50
# File 'lib/openc3/bridge/bridge.rb', line 46

def shutdown
  @threads.each do |thread|
    thread.stop
  end
end