Пример #1
0
  /**
   * Wrap the corrector's channel corresponding to the specified handle.
   *
   * @param handle Description of the Parameter
   * @return Description of the Return Value
   */
  protected ChannelWrapper wrapChannel(final String handle) {
    Channel channel = _powerSupply.getChannel(handle);
    ChannelWrapper wrapper = new ChannelWrapper(channel);

    wrapper.addChannelEventListener(
        new ChannelEventListener() {
          /**
           * The PV's monitored value has changed.
           *
           * @param channel the channel whose value has changed
           * @param record The channel time record of the new value
           */
          public void valueChanged(Channel channel, ChannelTimeRecord record) {
            _latestField = record.doubleValue();
            EVENT_PROXY.fieldChanged(CorrectorSupply.this, record, _latestField);
          }

          /**
           * The channel's connection has changed. Either it has established a new connection or the
           * existing connection has dropped.
           *
           * @param channel The channel whose connection has changed.
           * @param connected The channel's new connection state
           */
          public void connectionChanged(Channel channel, boolean connected) {
            _latestField = Double.NaN;
            EVENT_PROXY.connectionChanged(CorrectorSupply.this, connected);
          }
        });

    wrapper.requestConnection();

    return wrapper;
  }
Пример #2
0
 /**
  * Set the field to the value specified.
  *
  * @param field the field in Tesla
  */
 public void requestFieldSetting(final double field) {
   try {
     _fieldWriteChannelWrapper.getChannel().putValCallback(field, PUT_HANDLER);
   } catch (Exception exception) {
     throw new RuntimeException("Field setting request exception.", exception);
   }
 }
Пример #3
0
 /**
  * Determine if this BPM's channels are all connected.
  *
  * @return true if this BPM is connected and false if not.
  */
 public boolean isConnected() {
   try {
     return _fieldWriteChannelWrapper.isConnected();
   } catch (NullPointerException exception) {
     return false;
   }
 }