Class: QLab::Communicator
- Inherits:
-
Object
- Object
- QLab::Communicator
- Defined in:
- lib/qlab-ruby/communicator.rb
Overview
An abstract class providing communication behavior for objects that need to interact with QLab.
Instance Method Summary collapse
Instance Method Details
#send_message(osc_address, *osc_arguments) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/qlab-ruby/communicator.rb', line 6 def osc_address, *osc_arguments osc_address = format_osc_address(osc_address) if osc_arguments.size > 0 = OSC::Message.new osc_address, *osc_arguments else = OSC::Message.new osc_address end responses = [] QLab.debug "[Action send_message] send #{ .encode }" connection.send() do |response| responses << QLab::Reply.new(response) end if responses.size == 1 q_reply = responses[0] QLab.debug "[Action send_message] got one response: #{q_reply.inspect}" if q_reply.has_data? QLab.debug "[Action send_message] single response has data: #{q_reply.data.inspect}" q_reply.data elsif q_reply.has_status? QLab.debug "[Action send_message] single response has status: #{q_reply.status.inspect}" q_reply.status else QLab.debug "[Action send_message] single response has no data or status: #{q_reply.inspect}" q_reply end else responses end end |