5 require "./cgi-bin/settem"
6 require "./cgi-bin/activetem"
13 command = cgi['command']
14 command = CGI.unescapeHTML(command)
16 parameter = cgi['parameter']
17 parameter = CGI.unescapeHTML(parameter)
23 temset = SetTem.new(parameter)
24 result = temset.connect
26 when "StageSet", "MagnificationSet", "ImageShift" then
27 socket = TCPSocket.open($activehost,$activeport)
31 result = socket.gets.chomp
32 if result == "Accepted!" then
33 tiff2gif = "source Eos/env/Eos_env;tiff2mrc -i images/download.tif -o images/download.mrc;mrc2gif -i images/download.mrc -o images/download.gif"
36 result = "<img src = 'images/download.gif' height=200 width=400><br>"
44 socket = TCPSocket.open($activehost,$activeport)
45 socket.puts "Control:#{parameter}"
48 when "detailcatch" then
50 socket = TCPSocket.open($activehost,$activeport)
53 movex=CGI.unescapeHTML(movex)
55 movey=CGI.unescapeHTML(movey)
57 movez=CGI.unescapeHTML(movez)
59 tilta=CGI.unescapeHTML(tilta)
61 position={"Command"=>"Control","Parameter"=>"StargesetA","GonionXA"=>movex.to_i,"GonionYA"=>movey.to_i,"GonionZA"=>movez.to_i,"GonionAA"=>tilta.to_i}
63 =begin .to_json not use!
64 socket.puts "{'Command':'Control','Parameter':'StargesetA','GonionX':"+movex.to_s+",'GonionY':"+movey.to_s+",'GonionZ':"+movez.to_s+",'GonionA':"+tilta.to_s+"}"
65 puts "{'Command':'Control','Parameter':'StargesetA','GonionX':"+movex.to_s+",'GonionY':"+movey.to_s+",'GonionZ':"+movez.to_s+",'GonionA':"+tilta.to_s+"}"
68 positionj=position.to_json
72 result = "move x ="+movex.to_s+" move y ="+movey.to_s+" move z ="+movez.to_s+" tilt a ="+tilta.to_s+"<br>"
74 when "currentcondition" then
75 socket = TCPsocket.open($activehost,$activeport)
76 sosket.puts '{"Command":"Require"}'
81 filename = parameter.split(":")
82 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"
85 result = "<img src = 'images/#{filename[1]}.gif' height=400 width=400><br>"
87 when "Brightnessset" then
89 socket = TCPSocket.open($activehost,$activeport)
91 Bv=CGI.unescapeHTML(Bv)
93 brightinfo={"Command"=>"Control","Parameter"=>"Brightnessset","Brightvalue"=>Bv.to_i}
95 brightinfoj=brightinfo.to_json
96 socket.puts brightinfoj
101 when "Voltageset" then
103 socket = TCPSocket.open($activehost,$activeport)
104 Voltagevalue=cgi['catchvalue']
105 Voltagevalue=CGI.unescapeHTML(Voltagevalue)
107 voltageinfo={"Command"=>"Control","Parameter"=>"Voltageset","Voltagevalue"=>Voltagevalue.to_i}
109 voltageinfoj=voltageinfo.to_json
110 socket.puts voltageinfoj
113 result = "Volatege : "+Voltagevalue.to_s+"<br>"
120 #return ajax-engine::create HTML code
121 puts "Content-type: text/html\n\n"