lib/dispatcher.rb in tg-can-controls-gateway-0.1.2 vs lib/dispatcher.rb in tg-can-controls-gateway-0.1.3
- old
+ new
@@ -24,62 +24,40 @@
# Do we know this station?
if my_station
@events.each do |event|
- ##
- #CcgLogger::LOGGER.info "#{Time.now.iso8601} | Dispatcher: rca dispatching: event_type: #{event.event_type}"
- ##
-
# If it is a RCA mappable event send it as RCA command...
if EVENTS[event.event_type]
if my_station['rci_uri']
my_args = { 'action' => EVENTS[event.event_type] }
- CcgLogger::LOGGER.info "#{Time.now.iso8601} | >> Dispatcher: sending command : rci_uri: #{my_station['rci_uri']}, target: #{my_station['target']}, args: #{my_args.inspect}"
+ Ccg.logger.info "Dispatcher: sending command : rci_uri: #{my_station['rci_uri']}, target: #{my_station['target']}, args: #{my_args.inspect}"
my_command = CanControlsGateway::RcaCommand.new my_station['rci_uri'],
my_station['target'],
my_args
- CcgLogger::LOGGER.info "#{Time.now.iso8601} #{my_command.send_command}"
+ Ccg.logger.info my_command.send_command
else
- CcgLogger::LOGGER.info "#{Time.now.iso8601} | Device '#{my_station['device']}' not properly initialized in gom? (sender: station #{station})"
+ Ccg.logger.info "Device '#{my_station['device']}' not properly initialized in gom? (sender: station #{station})"
end
else
- ##
- #CcgLogger::LOGGER.info "#{Time.now.iso8601} | event '#{event.event_type}' not mappable to RCA command..."
- ##
+ # ????
end
end
else
- #CcgLogger::LOGGER.info "#{Time.now.iso8601} | unknown station_id '#{@station_id.inspect}'"
+ # ????
end
rescue => e
"ERROR: #{e.backtrace.join "\n\t"}"
end
- #def dispatch_osc
- # @events.each do |event|
- # if event.event_type && @station_id
- # ##
- # #CcgLogger::LOGGER.info "#{Time.now.iso8601} | Dispatcher: osc dispatching: event_type: #{event.event_type} - vector: #{event.vector}"
- # ##
- # my_osc_package = CanControlsGateway::OscPackage.new event, @station_id
- # my_ret = my_osc_package.broadcast
- # nil
- # end
- # end
- #end
-
private
-
- def get_raw_events
- my_events = []
- my_event_nodes = REXML::XPath.each(@raw_data, "/trackingdata/event") { |event|
- my_events << CanControlsGateway::RawEvent.new(event)
- }
- my_events
- end
-
+ def get_raw_events
+ my_events = []
+ my_event_nodes = REXML::XPath.each(@raw_data, "/trackingdata/event") { |event|
+ my_events << CanControlsGateway::RawEvent.new(event)
+ }
+ my_events
+ end
end
-
-end
\ No newline at end of file
+end