Пример #1
0
  private void processConditionChange(DynamicValueCondition condition, Timestamp timestamp) {
    if (condition != null) {
      // ... characteristic "timestamp"
      doForwardCharacteristic(
          condition.getTimestamp(), timestamp, CharacteristicInfo.C_TIMESTAMP.getName());

      // ... characteristic "status"
      doForwardCharacteristic(
          EpicsUtil.extratStatus(condition), timestamp, CharacteristicInfo.C_STATUS.getName());

      // ... characteristic "severity"
      doForwardCharacteristic(
          EpicsUtil.toEPICSFlavorSeverity(condition),
          timestamp,
          CharacteristicInfo.C_SEVERITY.getName());
    }
  }
Пример #2
0
  /** {@inheritDoc} */
  protected void doInit() {
    // get or create a real DAL property
    DynamicValueProperty property = null;

    try {
      RemoteInfo ri = getProcessVariableAddress().toDalRemoteInfo();

      PropertyFactory factory =
          DALPropertyFactoriesProvider.getInstance()
              .getPropertyFactory(getProcessVariableAddress().getControlSystem());

      switch (getValueType()) {
        case OBJECT:
          property = factory.getProperty(ri);
          break;
        case STRING:
          /*
           * swende: 2010-03-06: this is a dirty quickfix which is related
           * to problems with SDS displays that specifiy
           * "pv[severity], String" as pv address / please remove if it
           * does not work as expected or when all current SDS files at
           * DESY have been propertly changed
           */
          String characteristic = getProcessVariableAddress().getCharacteristic();
          // If connection is made as pv[severity] or just pv, than ignore everything
          // and go to default. In all other cases (e.g. pv[graphMin}, string), create
          // a default property.
          if (characteristic != null
              && !CharacteristicInfo.C_SEVERITY.getName().equals(characteristic)) {
            property = factory.getProperty(ri);
            break;
          }
        default:
          property = factory.getProperty(ri, getValueType().getDalType(), null);
          break;
      }

      if (property != null) {
        setDalProperty(property);
      }
    } catch (Throwable e) {
      forwardError(e.getLocalizedMessage());
    }
  }
Пример #3
0
  /** {@inheritDoc} */
  @Override
  protected Object doGetCharacteristicSynchronously(String characteristicId, ValueType valueType)
      throws Exception {

    Object result = null;

    // ... try to read the value
    if (waitTillConnected(CONNECTION_TIMEOUT)) {
      if (characteristicId.equals(CharacteristicInfo.C_SEVERITY.getName())) {
        result = EpicsUtil.toEPICSFlavorSeverity(_dalProperty.getCondition());
      } else if (characteristicId.equals(CharacteristicInfo.C_STATUS.getName())) {
        result = EpicsUtil.extratStatus(_dalProperty.getCondition());
      } else if (characteristicId.equals(CharacteristicInfo.C_TIMESTAMP.getName())) {
        result = _dalProperty.getCondition().getTimestamp();
      } else {
        Object tmp = _dalProperty.getCharacteristic(characteristicId);
        result = valueType != null ? ConverterUtil.convert(tmp, valueType) : tmp;
      }
    }

    return result;
  }