public InnerSender( final KExDaVSender senderObject, final DataDescription dataDescription, final SenderRole senderRole) { _senderObject = senderObject; _dataDescription = dataDescription; _senderRole = senderRole; _hasPendingSourceSubscription = (senderRole == SenderRole.source()); _senders.put(senderObject, this); }
private void registerSender(final InnerSender innerSender, final SystemObject systemObject) { try { if (innerSender.getSenderRole() != SenderRole.source()) { // Quellen werden verzögert beim ersten Datensatz angemeldet _connection.subscribeSender( innerSender, systemObject, innerSender.getDataDescription(), innerSender.getSenderRole()); } } catch (OneSubscriptionPerSendData oneSubscriptionPerSendData) { _manager.addMessage( Message.newMajor("Kann nicht als Sender anmelden", oneSubscriptionPerSendData)); } }
public void dataRequest( final SystemObject object, final DataDescription dataDescription, final byte state) { if (state == _state) return; _state = state; _senderObject.update(state); if (_state == ClientSenderInterface.START_SENDING && _lastData != null && _senderRole != SenderRole.source()) { try { _connection.sendData(_lastData); _lastData = null; } catch (SendSubscriptionNotConfirmed sendSubscriptionNotConfirmed) { _manager.addMessage( Message.newMajor("Kann derzeit nicht senden", sendSubscriptionNotConfirmed)); } } }
public void sendData(final SystemObject systemObject, Data data, final long dataTime) throws SendSubscriptionNotConfirmed { final ResultData resultData; if (data != null) { if (!(data instanceof KExDaVAttributeGroupData)) { data = new KExDaVAttributeGroupData(data, _manager); } resultData = ((KExDaVAttributeGroupData) data) .toResultData(systemObject, _dataDescription, dataTime); } else { resultData = new ResultData(systemObject, _dataDescription, dataTime, null); } try { if (_hasPendingSourceSubscription) { try { _connection.subscribeSource(this, resultData); _hasPendingSourceSubscription = false; } catch (OneSubscriptionPerSendData ignored) { _connection.sendData(resultData); } } else if (_state == ClientSenderInterface.START_SENDING || (_state == ClientSenderInterface.STOP_SENDING && _senderRole == SenderRole.source())) { _connection.sendData(resultData); } else { _lastData = resultData; } } catch (DataNotSubscribedException ignored) { _lastData = resultData; } if (_state == ClientSenderInterface.STOP_SENDING_NO_RIGHTS) { _manager.addMessage(Message.newMajor("Keine Rechte zum Senden von Daten: " + this)); } else if (_state == ClientSenderInterface.STOP_SENDING_NOT_A_VALID_SUBSCRIPTION) { _manager.addMessage(Message.newMajor("Ungültige Anmeldung des Empfängers: " + this)); } }