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
- #process_command_response(message) ⇒ Object
-
#send_command(command_list, component: nil, validate: true) ⇒ Object
Build and send a CommandRequest.
-
#send_command_and_collect(command_list, within:, component: nil, validate: true) ⇒ Object
Build, send a CommandRequest and collect the CommandResponse.
Instance Method Details
#process_command_response(message) ⇒ Object
37 38 39 40 |
# File 'lib/rsmp/proxy/site/modules/commands.rb', line 37 def process_command_response() log "Received #{.type}", message: , level: :log acknowledge end |
#send_command(command_list, component: nil, validate: true) ⇒ Object
Build and send a CommandRequest. Returns the CommandRequest message.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rsmp/proxy/site/modules/commands.rb', line 7 def send_command(command_list, component: nil, validate: true) validate_ready 'send command' component ||= main.c_id m_id = RSMP::Message.make_m_id = RSMP::CommandRequest.new({ 'cId' => component, 'arg' => command_list, 'mId' => m_id }) , validate: validate end |
#send_command_and_collect(command_list, within:, component: nil, validate: true) ⇒ Object
Build, send a CommandRequest and collect the CommandResponse. Returns the collector. Raises on NotAck or timeout if ok! is called on the result.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rsmp/proxy/site/modules/commands.rb', line 23 def send_command_and_collect(command_list, within:, component: nil, validate: true) validate_ready 'send command' component ||= main.c_id m_id = RSMP::Message.make_m_id = RSMP::CommandRequest.new({ 'cId' => component, 'arg' => command_list, 'mId' => m_id }) collector = CommandResponseCollector.new(self, command_list, timeout: within, initiator: ) (, collector, validate: validate)[:collector] end |