Sha256: 5ff7b22dc3213ffc0534a1063ca027172666a2e8fecc24ef31cc84a6c0aa6e64

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

require 'rubygems'
require 'eventmachine'
require 'socket'

require 'osc_to_rca_dispatcher'

module UdpServer
  
  def post_init
    Ccg.logger.info "... server started"
  end

  def receive_data(data)
    return unless(CcgRunner.instance.valve == :open)

    # RCA
    rca_dispatching = proc {
      begin 
        my_dispatcher = CanControlsGateway::OscToRcaDispatcher.new data
        my_dispatcher.dispatch_rca
      rescue Exception => e
        puts " ## #{e}\n -> #{e.backtrace.join "\n    "}"
      end
    }
    rca_callback = proc { |result|
    }
    EventMachine::defer rca_dispatching, rca_callback
  end
  
  def unbind
    Ccg.logger.info "UdpServer stopped"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tg-can-controls-gateway-0.1.3 lib/server.rb