Module: RSMP::SiteProxy::Modules::Commands

Included in:
RSMP::SiteProxy
Defined in:
lib/rsmp/proxy/site/modules/commands.rb

Overview

Handles command requests and responses

Instance Method Summary collapse

Instance Method Details

#process_command_response(message) ⇒ Object



24
25
26
27
# File 'lib/rsmp/proxy/site/modules/commands.rb', line 24

def process_command_response(message)
  log "Received #{message.type}", message: message, level: :log
  acknowledge message
end

#send_command(component, command_list, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rsmp/proxy/site/modules/commands.rb', line 6

def send_command(component, command_list, options = {})
  validate_ready 'send command'
  m_id = options[:m_id] || RSMP::Message.make_m_id
  message = RSMP::CommandRequest.new({
                                       'cId' => component,
                                       'arg' => command_list,
                                       'mId' => m_id
                                     })
  apply_nts_message_attributes message
  send_and_optionally_collect message, options do |collect_options|
    CommandResponseCollector.new(
      self,
      command_list,
      collect_options.merge(task: @task, m_id: m_id)
    )
  end
end