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.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/openc3/bridge/bridge.rb', line 30

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



51
52
53
54
55
# File 'lib/openc3/bridge/bridge.rb', line 51

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