Module: UdpServer

Defined in:
lib/server.rb

Instance Method Summary collapse

Instance Method Details

#post_initObject



9
10
11
# File 'lib/server.rb', line 9

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

#receive_data(data) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/server.rb', line 13

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

#unbindObject



30
31
32
# File 'lib/server.rb', line 30

def unbind
  Ccg.logger.info "UdpServer stopped"
end