Class: CanControlsGateway::OscToRcaDispatcher
- Inherits:
-
Object
- Object
- CanControlsGateway::OscToRcaDispatcher
- Defined in:
- lib/osc_to_rca_dispatcher.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#osc_message ⇒ Object
readonly
Returns the value of attribute osc_message.
-
#osc_packet ⇒ Object
readonly
Returns the value of attribute osc_packet.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #dispatch_rca ⇒ Object
-
#initialize(data) ⇒ OscToRcaDispatcher
constructor
A new instance of OscToRcaDispatcher.
Constructor Details
#initialize(data) ⇒ OscToRcaDispatcher
Returns a new instance of OscToRcaDispatcher.
10 11 12 13 14 15 |
# File 'lib/osc_to_rca_dispatcher.rb', line 10 def initialize data @raw_data = data @osc_packet = OSC::Packet.decode @raw_data rescue @osc_packet = nil @osc_message = @osc_packet[0][1] rescue @osc_message = nil @event = extract_event @osc_message end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
8 9 10 |
# File 'lib/osc_to_rca_dispatcher.rb', line 8 def event @event end |
#osc_message ⇒ Object (readonly)
Returns the value of attribute osc_message.
8 9 10 |
# File 'lib/osc_to_rca_dispatcher.rb', line 8 def @osc_message end |
#osc_packet ⇒ Object (readonly)
Returns the value of attribute osc_packet.
8 9 10 |
# File 'lib/osc_to_rca_dispatcher.rb', line 8 def osc_packet @osc_packet end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
8 9 10 |
# File 'lib/osc_to_rca_dispatcher.rb', line 8 def raw_data @raw_data end |
Instance Method Details
#dispatch_rca ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/osc_to_rca_dispatcher.rb', line 17 def dispatch_rca return true if @event.nil? my_args = { 'action' => @event } Ccg.logger.info "OscToRcaDispatcher: sending command : rci_uri: #{STATION['rci_uri']}, target: #{STATION['target']}, args: #{my_args.inspect}" my_command = CanControlsGateway::RcaCommand.new STATION['rci_uri'], STATION['target'], my_args Ccg.logger.info my_command.send_command end |