diff --git a/ch.psi.fda.xscan/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoopStream.java b/ch.psi.fda.xscan/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoopStream.java index ea84b5c..20c9755 100644 --- a/ch.psi.fda.xscan/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoopStream.java +++ b/ch.psi.fda.xscan/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoopStream.java @@ -67,8 +67,6 @@ public class CrlogicLoopStream implements ActionLoop { */ private boolean dataGroup = false; -// private boolean keepTmpFiles = false; - private volatile boolean stopReadoutThread = false; private Thread readoutThread; @@ -111,7 +109,6 @@ public class CrlogicLoopStream implements ActionLoop { private final ChannelService cservice; - private String id; private String name; // name of the motor channel private String readback; // name of the encoder channel @@ -125,6 +122,7 @@ public class CrlogicLoopStream implements ActionLoop { private final EventBus eventbus; private List metadata; + public CrlogicLoopStream(ChannelService cservice, String prefix, String ioc, boolean zigZag){ eventbus = new EventBus(); this.cservice = cservice; @@ -141,7 +139,7 @@ public class CrlogicLoopStream implements ActionLoop { this.crlogicDataFilter = new CrlogicRangeDataFilter(); } - + public void setActuator(String id, String name, String readback, double start, double end, double stepSize, double integrationTime, double additionalBacklash){ this.id = id; this.name = name; @@ -153,9 +151,9 @@ public class CrlogicLoopStream implements ActionLoop { this.additionalBacklash = additionalBacklash; } + /** - * @param inreader - * @throws IOException + * Receive a ZMQ message */ public void receive() { @@ -165,15 +163,6 @@ public class CrlogicLoopStream implements ActionLoop { mainHeader = mapper.readValue(socket.recv(), MainHeader.class); } catch (IOException e) { throw new RuntimeException("Unable to decode main header", e); -// } catch(ZMQException e){ -// if(!stopReadoutThread){ -// // re-throw exception unless thread is stopped -// // Closing the socket at the end of a scan causes an ZMQException -// throw e; -// } -// else{ -// return; -// } } if(!socket.hasReceiveMore()){ @@ -223,8 +212,7 @@ public class CrlogicLoopStream implements ActionLoop { if(use){ eventbus.post(message); - } - + } } @@ -677,6 +665,7 @@ public class CrlogicLoopStream implements ActionLoop { } private int drainHangingSubmessages() { + logger.info("Drain hanging submessages"); int count = 0; while (socket.hasReceiveMore()) { // is there a way to avoid copying data to user space here? @@ -688,11 +677,8 @@ public class CrlogicLoopStream implements ActionLoop { @Override public void cleanup() { - - - System.out.println("cleanup"); + logger.info("Cleanup"); stopReadoutThread = true; -// readoutThread.interrupt(); close(); @@ -701,12 +687,12 @@ public class CrlogicLoopStream implements ActionLoop { cservice.destroyAnnotatedChannels(motortemplate); template = null; motortemplate = null; - } catch (Exception e) { - throw new RuntimeException("Unable to destroy CrlogicLoop", e); + throw new RuntimeException("Unable to destroy Channel Access channels", e); } } + @Override public List getPreActions() { return preActions; @@ -727,11 +713,6 @@ public class CrlogicLoopStream implements ActionLoop { this.dataGroup = dataGroup; } - public List getSensors() { - return sensors; - } - - public EventBus getEventBus(){ return eventbus; }