class Orchestrator::Service::Manager

Attributes

connection[R]
processor[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Orchestrator::Core::ModuleManager::new
# File lib/orchestrator/service/manager.rb, line 4
def initialize(*args)
    super(*args)

    # Do we want to start here?
    # Should be ok.
    @thread.next_tick method(:start)
end

Public Instance Methods

notify_connected() click to toggle source
NOTE

Same as Device::Manager:——-

TODO

Need to have a guess about when a device may be off line

# File lib/orchestrator/service/manager.rb, line 34
def notify_connected
    if @instance.respond_to? :connected, true
        begin
            @instance.__send__(:connected)
        rescue => e
            @logger.print_error(e, 'error in module connected callback')
        end
    end

    update_connected_status(true)
end
notify_received(data, resolve, command = nil) click to toggle source
# File lib/orchestrator/service/manager.rb, line 46
def notify_received(data, resolve, command = nil)
    begin
        blk = command.nil? ? nil : command[:on_receive]
        if blk.respond_to? :call
            blk.call(data, resolve, command)
        elsif @instance.respond_to? :received, true
            @instance.__send__(:received, data, resolve, command)
        else
            @logger.warn('no received function provided')
            :abort
        end
    rescue => e
        @logger.print_error(e, 'error in received callback')
    end
end
start() click to toggle source
Calls superclass method Orchestrator::Core::ModuleManager#start
# File lib/orchestrator/service/manager.rb, line 14
def start
    @processor = Orchestrator::Device::Processor.new(self)

    super # Calls on load (allows setting of tls certs)

    @connection = TransportHttp.new(self, @processor)
    @processor.transport = @connection
end
stop() click to toggle source
Calls superclass method Orchestrator::Core::ModuleManager#stop
# File lib/orchestrator/service/manager.rb, line 23
def stop
    super
    @processor.terminate
    @processor = nil
    @connection.terminate
    @connection = nil
end