puts "CameraSocket thread: #{Thread.current}"
- ws.onopen do
- puts "ws open"
- @buf["type"] = "connection"
- @buf["data"] = "open"
- @camera.on_flag
- ws.send(@buf.to_json)
- end
-
- ws.onmessage do |msg|
- rec_buf = JSON.parse(msg)
- if(rec_buf["type"]=="req")
- if(rec_buf["data"]=="img")
- @buf["type"] = "img"
- @camera.unlock_acq
- @buf["data"] = @camera.get_image
- @buf["count"] = @count
- ws.send(@buf.to_json)
- @count = @count + 1
- end
- end
- end
-
- ws.onclose do
- @camera.off_flag
- end
-
- end
- end
+ ws.onopen do
+ puts "ws open"
+ @buf["type"] = "connection"
+ @buf["data"] = "open"
+ ws.send(@buf.to_json)
++ @request = Request.new('acq', nil)
+ end
+
+ ws.onmessage do |msg|
+ rec_buf = JSON.parse(msg)
+ if(rec_buf["type"]=="req")
+ if(rec_buf["data"]=="img")
- request = Request.new('acq', nil)
- @camera_host.put_request(request)
++ @camera_host.put_request(@request)
+ @buf["type"] = "img"
- @buf["data"] = request.get_result
++ @buf["data"] = @request.get_result
+ @buf["count"] = @count
+ ws.send(@buf.to_json)
+ @count = @count + 1
++ @request = Request.new('acq', nil)
+ end
+ end
+ end
+
+ ws.onclose do
+ puts "ws close"
+ end
+
+ end
+ end
end
def execute
@vem = VEM.create(@em)
- puts "execute"
- puts "execute #{@command}"
++ #puts "execute #{@command}"
case @command
when "get"
@result = @vem.get_params
else
puts "else"
end
-- puts "request complete"
@complete = true
@cv.broadcast
end
def get_result
@mutex.synchronize do
@cv.wait(@mutex) while (@complete == false)
-- puts "resturn result"
- puts @result
return @result
end
end
@@params[:stage][:a] = @@tem.Stage.Position.A
@@params[:ill][:spotSizeIndex] = @@tem.Illumination.SpotsizeIndex
@@params[:proj][:magIndex] = @@tem.Projection.MagnificationIndex
- @@params[:proj][:defocus] = @@tem.Projection.Defocus
+ @@params[:proj][:defocus] = @@tem.Projection.Defocus*1000000000
+ @@params[:proj][:mag] = @@tem.Projection.Magnification
+ @@params[:proj][:imageBeamShift][:x] = @@tem.Projection.ImageBeamShift.x
+ @@params[:proj][:imageBeamShift][:y] = @@tem.Projection.ImageBeamShift.y
+ @@params[:proj][:focus] = @@tem.Projection.Focus
# @@params[:ccdCamera][:binning] = ccdCamerasAcqParams.Binning
# @@params[:ccdCamera][:expTime] = ccdCamerasAcqParams.ExposureTime
# @@params[:ccdCamera][:imageSize] = ccdCamerasAcqParams.ImageSize
:proj => {
:magIndex => 0,
:mag => 0,
-- :imageShift => {:x => 0, :y => 0},
++ :imageBeamShift => {:x => 0, :y => 0},
:focus => 0,
:defocus => 0,
:objStg => {:x => 0, :y => 0}
@@params[:stage][:a] = @@tem.Stage.Position.A
@@params[:ill][:spotSizeIndex] = @@tem.Illumination.SpotsizeIndex
@@params[:proj][:magIndex] = @@tem.Projection.MagnificationIndex
++<<<<<<< HEAD
+ @@params[:proj][:defocus] = @@tem.Projection.Defocus*1000000000
++=======
++ @@params[:proj][:mag] = @@tem.Projection.Magnification
++ @@params[:proj][:imageBeamShift][:x] = @@tem.Projection.ImageBeamShift.x
++ @@params[:proj][:imageBeamShift][:y] = @@tem.Projection.ImageBeamShift.y
++ @@params[:proj][:focus] = @@tem.Projection.Focus
++ @@params[:proj][:defocus] = @@tem.Projection.Defocus
++>>>>>>> c40fae8a2f64d018688751e591cc90330dfd6f6c
# @@params[:ccdCamera][:binning] = ccdCamerasAcqParams.Binning
# @@params[:ccdCamera][:expTime] = ccdCamerasAcqParams.ExposureTime
# @@params[:ccdCamera][:imageSize] = ccdCamerasAcqParams.ImageSize
return @@params[:proj].to_json
end
-- def set_image_beam_shift(x, y)
++ def set_image_beamshift(x, y)
puts "FEI setImageShift"
proj = @@tem.Projection
puts "FEI setBeamTilt"
end
- puts @@tem.Vacuum.Gauges.Item(4).Name
+ def get_vacuum_status
+ puts "FEI getVacuumStatus"
++ puts @@tem.Vacuum.Gauges.Item(5).Name
+ puts @@tem.Vacuum.Gauges.Item(1).Pressure
+ end
+
end