예제 #1
0
    @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);
          }
        }
      }
    }