/** * Sendet Daten an das Objekt * * @param senderObject Sender-Objekt * @param data Daten * @param dataTime Zeit des Datensatzes */ public void sendData(final KExDaVSender senderObject, final Data data, final long dataTime) { final SystemObject systemObject = getWrappedObject(); if (systemObject == null) return; try { final InnerSender sender = _senders.get(senderObject); if (sender == null) throw new IllegalStateException("Sender wurde noch nicht angemeldet"); sender.sendData(systemObject, data, dataTime); } catch (SendSubscriptionNotConfirmed sendSubscriptionNotConfirmed) { _manager.addMessage( Message.newMajor("Kann derzeit nicht senden", sendSubscriptionNotConfirmed)); } }
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)); } }
private synchronized void setWrappedObject(final SystemObject wrappedObject) { if (_wrappedObject == wrappedObject) return; _wrappedObject = wrappedObject; if (wrappedObject != null) { for (final InnerReceiver receiver : _receivers.values()) { if (checkType(wrappedObject.getType(), receiver.getDataDescription().getAttributeGroup())) { registerReceiver(receiver, wrappedObject); } } for (final InnerSender sender : _senders.values()) { if (checkType(wrappedObject.getType(), sender.getDataDescription().getAttributeGroup())) { registerSender(sender, wrappedObject); } } for (final ExistenceListener listener : _existenceListeners) { listener.objectCreated(this); } } else { for (final ExistenceListener listener : _existenceListeners) { listener.objectInvalidated(this); } } }
/** * Meldet einen Sender ab * * @param senderObject Sender-Objekt */ public void unsubscribeSender(final KExDaVSender senderObject) { final InnerSender sender = _senders.remove(senderObject); final SystemObject systemObject = getWrappedObject(); if (systemObject == null) return; _connection.unsubscribeSender(sender, systemObject, sender.getDataDescription()); }