@Override protected void ended( GENASubscription subscription, CancelReason reason, UpnpResponse response) { final Service service = subscription.getService(); if (service != null) { final ServiceId serviceId = service.getServiceId(); final Device device = service.getDevice(); if (device != null) { final Device deviceRoot = device.getRoot(); if (deviceRoot != null) { final DeviceIdentity deviceRootIdentity = deviceRoot.getIdentity(); if (deviceRootIdentity != null) { final UDN deviceRootUdn = deviceRootIdentity.getUdn(); logger.debug( "A GENA subscription '{}' for device '{}' was ended", serviceId, deviceRootUdn); } } } if (upnpService != null) { final ControlPoint cp = upnpService.getControlPoint(); if (cp != null) { final UpnpSubscriptionCallback callback = new UpnpSubscriptionCallback(service, subscription.getActualDurationSeconds()); cp.execute(callback); } } } }
@SuppressWarnings("unchecked") @Override protected void eventReceived(GENASubscription sub) { Map<String, StateVariableValue> values = sub.getCurrentValues(); Device device = sub.getService().getDevice(); logger.trace( "Receiving a GENA subscription '{}' response for device '{}'", sub.getService().getServiceId().getId(), device.getRoot().getIdentity().getUdn()); for (UpnpIOParticipant participant : participants.keySet()) { if (participants.get(participant).equals(device.getRoot())) { for (String stateVariable : values.keySet()) { StateVariableValue value = values.get(stateVariable); if (value.getValue() != null) { try { participant.onValueReceived( stateVariable, value.getValue().toString(), sub.getService().getServiceId().getId()); } catch (Exception e) { logger.error("Participant threw an exception onValueReceived", e); } } } break; } } }
@Override protected void eventsMissed(GENASubscription subscription, int numberOfMissedEvents) { logger.debug( "A GENA subscription '{}' for device '{}' missed events", subscription.getService().getServiceId(), subscription.getService().getDevice().getRoot().getIdentity().getUdn()); }
@Override protected void established(GENASubscription subscription) { logger.trace( "A GENA subscription '{}' for device '{}' is established", subscription.getService().getServiceId().getId(), subscription.getService().getDevice().getRoot().getIdentity().getUdn()); }
@Override protected void failed( GENASubscription subscription, UpnpResponse response, Exception e, String defaultMsg) { logger.debug( "A GENA subscription '{}' for device '{}' failed", subscription.getService().getServiceId(), subscription.getService().getDevice().getRoot().getIdentity().getUdn()); }