Class: UREST::WaitProg

Inherits:
Riddl::Implementation
  • Object
show all
Defined in:
lib/urest.rb

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/urest.rb', line 182

def response
  opts = @a[0]
  fname = File.join(opts['dir'],@r[-2])
  if opts['progs'].include? fname + '.urp'
    if @h['CPEE_CALLBACK']
      EM.defer do
        UREST::start_program(opts,fname)
        sleep 2
        while UREST::robotprogram_running?(opts)
          sleep 0.25
        end
        Typhoeus.put(@h['CPEE_CALLBACK'])
      end
      @headers << Riddl::Header.new("CPEE-CALLBACK", 'true')
    else
      UREST::start_program(opts,fname)
    end
  else
    @status = 403
  end
  nil
end