org.fourthline.cling.UpnpService Java Examples

The following examples show how to use org.fourthline.cling.UpnpService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SendingSubscribe.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
public SendingSubscribe(UpnpService upnpService,
                        RemoteGENASubscription subscription,
                        List<NetworkAddress> activeStreamServers) {
    super(
        upnpService,
        new OutgoingSubscribeRequestMessage(
            subscription,
            subscription.getEventCallbackURLs(
                activeStreamServers,
                upnpService.getConfiguration().getNamespace()
            ),
            upnpService.getConfiguration().getEventSubscriptionHeaders(subscription.getService())
        )
    );

    this.subscription = subscription;
}
 
Example #2
Source File: SendingEvent.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
public SendingEvent(UpnpService upnpService, LocalGENASubscription subscription) {
    super(upnpService, null); // Special case, we actually need to send several messages to each callback URL

    // TODO: Ugly design! It is critical (concurrency) that we prepare the event messages here, in the constructor thread!

    subscriptionId = subscription.getSubscriptionId();

    requestMessages = new OutgoingEventRequestMessage[subscription.getCallbackURLs().size()];
    int i = 0;
    for (URL url : subscription.getCallbackURLs()) {
        requestMessages[i] = new OutgoingEventRequestMessage(subscription, url);
        getUpnpService().getConfiguration().getGenaEventProcessor().writeBody(requestMessages[i]);
        i++;
    }

    currentSequence = subscription.getCurrentSequence();

    // Always increment sequence now, as (its value) has already been set on the headers and the
    // next event will use the incremented value
    subscription.incrementSequence();
}
 
Example #3
Source File: SendingSubscribe.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
public SendingSubscribe(UpnpService upnpService,
                        RemoteGENASubscription subscription,
                        List<NetworkAddress> activeStreamServers) {
    super(
        upnpService,
        new OutgoingSubscribeRequestMessage(
            subscription,
            subscription.getEventCallbackURLs(
                activeStreamServers,
                upnpService.getConfiguration().getNamespace()
            ),
            upnpService.getConfiguration().getEventSubscriptionHeaders(subscription.getService())
        )
    );

    this.subscription = subscription;
}
 
Example #4
Source File: SendingEvent.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
public SendingEvent(UpnpService upnpService, LocalGENASubscription subscription) {
    super(upnpService, null); // Special case, we actually need to send several messages to each callback URL

    // TODO: Ugly design! It is critical (concurrency) that we prepare the event messages here, in the constructor thread!

    subscriptionId = subscription.getSubscriptionId();

    requestMessages = new OutgoingEventRequestMessage[subscription.getCallbackURLs().size()];
    int i = 0;
    for (URL url : subscription.getCallbackURLs()) {
        requestMessages[i] = new OutgoingEventRequestMessage(subscription, url);
        getUpnpService().getConfiguration().getGenaEventProcessor().writeBody(requestMessages[i]);
        i++;
    }

    currentSequence = subscription.getCurrentSequence();

    // Always increment sequence now, as (its value) has already been set on the headers and the
    // next event will use the incremented value
    subscription.incrementSequence();
}
 
Example #5
Source File: UpnpPortMappingServicesRegistrar.java    From bt with Apache License 2.0 5 votes vote down vote up
private void bindShutdownHook(UpnpService service) {
    lifecycleBinder.addBinding(SHUTDOWN,
            LifecycleBinding.bind(service::shutdown)
                    .description("Disables port mapping on application shutdown.")
                    .async()
                    .build());
}
 
Example #6
Source File: SendingSearch.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param mxSeconds The time in seconds a host should wait before responding.
 */
public SendingSearch(UpnpService upnpService, UpnpHeader searchTarget, int mxSeconds) {
    super(upnpService);

    if (!UpnpHeader.Type.ST.isValidHeaderType(searchTarget.getClass())) {
        throw new IllegalArgumentException(
                "Given search target instance is not a valid header class for type ST: " + searchTarget.getClass()
        );
    }
    this.searchTarget = searchTarget;
    this.mxSeconds = mxSeconds;
}
 
Example #7
Source File: RegistryImpl.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Starts background maintenance immediately.
 */
@Inject
public RegistryImpl(UpnpService upnpService) {
    log.fine("Creating Registry: " + getClass().getName());

    this.upnpService = upnpService;

    log.fine("Starting registry background maintenance...");
    registryMaintainer = createRegistryMaintainer();
    if (registryMaintainer != null) {
        getConfiguration().getRegistryMaintainerExecutor().execute(registryMaintainer);
    }
}
 
Example #8
Source File: SendingRenewal.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public SendingRenewal(UpnpService upnpService, RemoteGENASubscription subscription) {
    super(
        upnpService,
        new OutgoingRenewalRequestMessage(
            subscription,
            upnpService.getConfiguration().getEventSubscriptionHeaders(subscription.getService())
        )
    );
    this.subscription = subscription;
}
 
Example #9
Source File: SendingUnsubscribe.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public SendingUnsubscribe(UpnpService upnpService, RemoteGENASubscription subscription) {
    super(
        upnpService,
        new OutgoingUnsubscribeRequestMessage(
            subscription,
            upnpService.getConfiguration().getEventSubscriptionHeaders(subscription.getService())
        )
    );
    this.subscription = subscription;
}
 
Example #10
Source File: SendingUnsubscribe.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public SendingUnsubscribe(UpnpService upnpService, RemoteGENASubscription subscription) {
    super(
        upnpService,
        new OutgoingUnsubscribeRequestMessage(
            subscription,
            upnpService.getConfiguration().getEventSubscriptionHeaders(subscription.getService())
        )
    );
    this.subscription = subscription;
}
 
Example #11
Source File: SendingRenewal.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public SendingRenewal(UpnpService upnpService, RemoteGENASubscription subscription) {
    super(
        upnpService,
        new OutgoingRenewalRequestMessage(
            subscription,
            upnpService.getConfiguration().getEventSubscriptionHeaders(subscription.getService())
        )
    );
    this.subscription = subscription;
}
 
Example #12
Source File: RegistryImpl.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Starts background maintenance immediately.
 */
@Inject
public RegistryImpl(UpnpService upnpService) {
    log.fine("Creating Registry: " + getClass().getName());

    this.upnpService = upnpService;

    log.fine("Starting registry background maintenance...");
    registryMaintainer = createRegistryMaintainer();
    if (registryMaintainer != null) {
        getConfiguration().getRegistryMaintainerExecutor().execute(registryMaintainer);
    }
}
 
Example #13
Source File: ReceivingSearch.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public ReceivingSearch(UpnpService upnpService, IncomingDatagramMessage<UpnpRequest> inputMessage) {
    super(upnpService, new IncomingSearchRequest(inputMessage));
}
 
Example #14
Source File: ReceivingUnsubscribe.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public ReceivingUnsubscribe(UpnpService upnpService, StreamRequestMessage inputMessage) {
    super(upnpService, inputMessage);
}
 
Example #15
Source File: ReceivingAsync.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public UpnpService getUpnpService() {
    return upnpService;
}
 
Example #16
Source File: ReceivingAsync.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected ReceivingAsync(UpnpService upnpService, M inputMessage) {
    this.upnpService = upnpService;
    this.inputMessage = inputMessage;
}
 
Example #17
Source File: SendingAsync.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public UpnpService getUpnpService() {
    return upnpService;
}
 
Example #18
Source File: SendingAsync.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected SendingAsync(UpnpService upnpService) {
    this.upnpService = upnpService;
}
 
Example #19
Source File: SendingAction.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public SendingAction(UpnpService upnpService, ActionInvocation actionInvocation, URL controlURL) {
    super(upnpService, new OutgoingActionRequestMessage(actionInvocation, controlURL));
    this.actionInvocation = actionInvocation;
}
 
Example #20
Source File: ProtocolFactoryImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public UpnpService getUpnpService() {
    return upnpService;
}
 
Example #21
Source File: ProtocolFactoryImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Inject
public ProtocolFactoryImpl(UpnpService upnpService) {
    log.fine("Creating ProtocolFactory: " + getClass().getName());
    this.upnpService = upnpService;
}
 
Example #22
Source File: ReceivingSync.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected ReceivingSync(UpnpService upnpService, IN inputMessage) {
    super(upnpService, inputMessage);
    this.remoteClientInfo = new RemoteClientInfo(inputMessage);
}
 
Example #23
Source File: MockProtocolFactory.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public UpnpService getUpnpService() {
    return null;
}
 
Example #24
Source File: AndroidUpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public UpnpService get() {
    return upnpService;
}
 
Example #25
Source File: MockUpnpService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public MockProtocolFactory(UpnpService upnpService, boolean sendsAlive) {
    super(upnpService);
    this.sendsAlive = sendsAlive;
}
 
Example #26
Source File: MockUpnpService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected ProtocolFactory createProtocolFactory(UpnpService service, boolean sendsAlive) {
    return new MockProtocolFactory(service, sendsAlive);
}
 
Example #27
Source File: UPnPService.java    From subsonic with GNU General Public License v3.0 4 votes vote down vote up
public UpnpService getUpnpService() {
    return upnpService;
}
 
Example #28
Source File: ClingRouter.java    From subsonic with GNU General Public License v3.0 4 votes vote down vote up
public ClingRouter(Service connectionService, UpnpService upnpService) {
    this.connectionService = connectionService;
    this.upnpService = upnpService;
}
 
Example #29
Source File: UpnpPortMappingServicesRegistrar.java    From bt with Apache License 2.0 4 votes vote down vote up
/**
 * Creates corresponding UPNP serive for port mapping.
 *
 * @param portMapping desired port mapping;
 */
public void registerPortMapping(PortMapping portMapping) {
    final UpnpService service = new UpnpServiceImpl(upnpServiceConfiguration, new PortMappingListener(portMapping));
    service.getControlPoint().search();
    bindShutdownHook(service);
}
 
Example #30
Source File: ReceivingAction.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public ReceivingAction(UpnpService upnpService, StreamRequestMessage inputMessage) {
    super(upnpService, inputMessage);
}