/** Creates new BpmAgent */ public BpmAgent(AcceleratorSeq aSequence, BPM newBpmNode) { bpmNode = newBpmNode; sequence = aSequence; xavgch = bpmNode.getChannel(BPM.X_TBT_HANDLE); yavgch = bpmNode.getChannel(BPM.Y_TBT_HANDLE); xavgch.requestConnection(); yavgch.requestConnection(); bpmNode.getChannel(BPM.X_AVG_HANDLE).requestConnection(); bpmNode.getChannel(BPM.Y_AVG_HANDLE).requestConnection(); // xavgch.setSyncRequest(true); // yavgch.setSyncRequest(true); // xavgch.connect(); // yavgch.connect(); // xavgch.pendIO(5); // yavgch.pendIO(5); // xavgch.setSyncRequest(false); // yavgch.setSyncRequest(false); }
/** Test whether the BPM's xAvg, yAvg and ampAvg channels can connect */ public static boolean nodeCanConnect(BPM bpm) { boolean canConnectx = true; boolean canConnecty = true; boolean canConnect = false; try { // canConnect = canConnect && bpm.getChannel(BPM.X_TBT_HANDLE).connect(); // canConnect = canConnect && bpm.getChannel(BPM.Y_TBT_HANDLE).connect(); canConnectx = bpm.getChannel(BPM.X_TBT_HANDLE).connectAndWait(); canConnectx = bpm.getChannel(BPM.Y_TBT_HANDLE).connectAndWait(); // canConnect = canConnect && bpm.getChannel(BPM.AMP_AVG_HANDLE).connect(); } catch (NoSuchChannelException excpt) { if (!canConnectx || !canConnecty) { canConnect = false; } } return canConnect; }
/** Test if the BPM node is okay */ public boolean isConnected() { return xavgch.isConnected() && yavgch.isConnected() && bpmNode.getChannel(BPM.X_AVG_HANDLE).isConnected() && bpmNode.getChannel(BPM.Y_AVG_HANDLE).isConnected(); }