コード例 #1
0
ファイル: CorrectorSupply.java プロジェクト: openxal/openxal
 /** handle the connection event */
 public void connectionMade(final Channel channel) {
   try {
     if (channel == _lowerChannel) {
       _lowerMonitor = channel.addMonitorValue(this, Monitor.VALUE);
     } else if (channel == _upperChannel) {
       _upperMonitor = channel.addMonitorValue(this, Monitor.VALUE);
     }
     Channel.flushIO();
   } catch (ConnectionException exception) {
   } catch (MonitorException excepiton) {
   }
 }
コード例 #2
0
ファイル: CorrectorSupply.java プロジェクト: openxal/openxal
    /** set a new channel whose limits we wish to monitor */
    public void setChannel(final Channel channel) {
      synchronized (this) {
        if (_lowerChannel != null) {
          _lowerChannel.removeConnectionListener(this);
          if (_lowerMonitor != null) {
            _lowerMonitor.clear();
            _lowerMonitor = null;
          }
        }

        final String lowerLimitPV = channel.channelName() + ".LOPR";
        _lowerChannel = ChannelFactory.defaultFactory().getChannel(lowerLimitPV);
        _lowerChannel.addConnectionListener(this);
        _lowerChannel.requestConnection();

        if (_upperChannel != null) {
          _upperChannel.removeConnectionListener(this);
          if (_upperMonitor != null) {
            _upperMonitor.clear();
            _upperMonitor = null;
          }
        }

        final String upperLimitPV = channel.channelName() + ".HOPR";
        _upperChannel = ChannelFactory.defaultFactory().getChannel(upperLimitPV);
        _upperChannel.addConnectionListener(this);
        _upperChannel.requestConnection();
      }
    }
コード例 #3
0
ファイル: BpmAgent.java プロジェクト: kritha/MyOpenXal
  /** 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);
  }
コード例 #4
0
ファイル: BpmAgent.java プロジェクト: kritha/MyOpenXal
  /** Get the horizontal TBT array * */
  public double[] getXAvgTBTArray() {
    double[] value;
    int size = 0;
    try {
      size = xavgch.elementCount();
    } catch (ConnectionException e) {
    }

    value = new double[size];

    try {
      value = xavgch.getArrDbl();
    } catch (ConnectionException e) {
      System.err.println("Unable to connect to: " + xavgch.channelName());
    } catch (GetException e) {
      System.err.println("Unable to get process variables.");
    }

    return value;
  }
コード例 #5
0
ファイル: BpmAgent.java プロジェクト: kritha/MyOpenXal
 /** 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();
 }