+++ /dev/null
-#!/usr/local/bin/ruby
-
-require "cgi"
-require "socket"
-require "./cgi-bin/settem"
-require "./cgi-bin/activetem"
-require "rubygems"
-require "systemu"
-require "json"
-
-cgi = CGI.new
-
-command = cgi['command']
-command = CGI.unescapeHTML(command)
-
-parameter = cgi['parameter']
-parameter = CGI.unescapeHTML(parameter)
-
-
-case command
-
-when "Connect" then
- temset = SetTem.new(parameter)
- result = temset.connect
-
-when "StageSet", "MagnificationSet", "ImageShift" then
- socket = TCPSocket.open($activehost,$activeport)
- socket.puts parameter
-
-
- result = socket.gets.chomp
- if result == "Accepted!" then
- tiff2gif = "source Eos/env/Eos_env;tiff2mrc -i images/download.tif -o images/download.mrc;mrc2gif -i images/download.mrc -o images/download.gif"
- systemu tiff2gif
- end
- result = "<img src = 'images/download.gif' height=200 width=400><br>"
-
-
-#when something then
- #do_something
- #
- #
-when "Control" then
- socket = TCPSocket.open($activehost,$activeport)
- socket.puts "Control:#{parameter}"
- result = socket.gets
-
-when "detailcatch" then
-
- socket = TCPSocket.open($activehost,$activeport)
-
- movex=cgi['x']
- movex=CGI.unescapeHTML(movex)
- movey=cgi['y']
- movey=CGI.unescapeHTML(movey)
- movez=cgi['z']
- movez=CGI.unescapeHTML(movez)
- tilta=cgi['a']
- tilta=CGI.unescapeHTML(tilta)
-
- position={"Command"=>"Control","Parameter"=>"StargesetA","GonionXA"=>movex.to_i,"GonionYA"=>movey.to_i,"GonionZA"=>movez.to_i,"GonionAA"=>tilta.to_i}
-
-=begin .to_json not use!
- socket.puts "{'Command':'Control','Parameter':'StargesetA','GonionX':"+movex.to_s+",'GonionY':"+movey.to_s+",'GonionZ':"+movez.to_s+",'GonionA':"+tilta.to_s+"}"
- puts "{'Command':'Control','Parameter':'StargesetA','GonionX':"+movex.to_s+",'GonionY':"+movey.to_s+",'GonionZ':"+movez.to_s+",'GonionA':"+tilta.to_s+"}"
-=end
-
- positionj=position.to_json
- socket.puts positionj
- puts positionj
-
- result = "move x ="+movex.to_s+" move y ="+movey.to_s+" move z ="+movez.to_s+" tilt a ="+tilta.to_s+"<br>"
-
-when "currentcondition" then
- socket = TCPsocket.open($activehost,$activeport)
- sosket.puts '{"Command":"Require"}'
- result = socket.gets
-
-
-when "TakePhoto" then
- filename = parameter.split(":")
- tiff2gif = "source Eos/env/Eos_env;tiff2mrc -i images/#{filename[0]}.tif -o images/#{filename[0]}.mrc;mrc2gif -i images/#{filename[0]}.mrc -o images/#{filename[1]}.gif"
- systemu tiff2gif
-
- result = "<img src = 'images/#{filename[1]}.gif' height=400 width=400><br>"
-
-when "Brightnessset" then
-
- socket = TCPSocket.open($activehost,$activeport)
- Bv=cgi['catchvalue']
- Bv=CGI.unescapeHTML(Bv)
-
- brightinfo={"Command"=>"Control","Parameter"=>"Brightnessset","Brightvalue"=>Bv.to_i}
-
- brightinfoj=brightinfo.to_json
- socket.puts brightinfoj
- puts brightinfoj
- result = "Brightness: "+Bv.to_s
-
-when "Voltageset" then
-
- socket = TCPSocket.open($activehost,$activeport)
- Voltagevalue=cgi['catchvalue']
- Voltagevalue=CGI.unescapeHTML(Voltagevalue)
-
- voltageinfo={"Command"=>"Control","Parameter"=>"Voltageset","Voltagevalue"=>Voltagevalue.to_i}
-
- voltageinfoj=voltageinfo.to_json
- socket.puts voltageinfoj
- puts voltageinfoj
-
- result = "Volatege : "+Voltagevalue.to_s+"<br>"
-
-else
- #do_something_other
-end
-
-
-#return ajax-engine::create HTML code
-puts "Content-type: text/html\n\n"
-puts ""
-
-puts result