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()); } }
/** {@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; }
/** * Waits until DAL property is connected or timeout has elapsed * * @param timeout the timeout to wait * @return <code>true</code> if property was connected */ public boolean waitTillConnected(long timeout) { return EpicsUtil.waitTillConnected(_dalProperty, timeout); }