Search in sources :

Example 1 with UpnpServiceImpl

use of org.fourthline.cling.UpnpServiceImpl in project SmartApplianceEnabler by camueller.

the class SempDiscovery method run.

public void run() {
    try {
        final ExecutorService executorService = Executors.newSingleThreadExecutor();
        final UpnpService upnpService = new UpnpServiceImpl(serviceConfiguration);
        Runtime.getRuntime().addShutdownHook(new Thread() {

            @Override
            public void run() {
                upnpService.shutdown();
            }
        });
        // Add the bound local device to the registry
        upnpService.getRegistry().addDevice(createDevice());
    } catch (Exception ex) {
        System.err.println("Exception occured: " + ex);
        ex.printStackTrace(System.err);
        System.exit(1);
    }
}
Also used : UpnpService(org.fourthline.cling.UpnpService) UpnpServiceImpl(org.fourthline.cling.UpnpServiceImpl) ExecutorService(java.util.concurrent.ExecutorService) IOException(java.io.IOException) ValidationException(org.fourthline.cling.model.ValidationException) LocalServiceBindingException(org.fourthline.cling.binding.LocalServiceBindingException)

Example 2 with UpnpServiceImpl

use of org.fourthline.cling.UpnpServiceImpl in project libresonic by Libresonic.

the class UPnPService method createService.

private synchronized void createService() throws Exception {
    upnpService = new UpnpServiceImpl(new ApacheUpnpServiceConfiguration());
    // Asynch search for other devices (most importantly UPnP-enabled routers for port-mapping)
    upnpService.getControlPoint().search();
    // Start DLNA media server?
    setMediaServerEnabled(settingsService.isDlnaEnabled());
    Runtime.getRuntime().addShutdownHook(new Thread() {

        @Override
        public void run() {
            System.err.println("Shutting down UPnP service...");
            upnpService.shutdown();
            System.err.println("Shutting down UPnP service - Done!");
        }
    });
}
Also used : UpnpServiceImpl(org.fourthline.cling.UpnpServiceImpl) ApacheUpnpServiceConfiguration(org.libresonic.player.service.upnp.ApacheUpnpServiceConfiguration)

Aggregations

UpnpServiceImpl (org.fourthline.cling.UpnpServiceImpl)2 IOException (java.io.IOException)1 ExecutorService (java.util.concurrent.ExecutorService)1 UpnpService (org.fourthline.cling.UpnpService)1 LocalServiceBindingException (org.fourthline.cling.binding.LocalServiceBindingException)1 ValidationException (org.fourthline.cling.model.ValidationException)1 ApacheUpnpServiceConfiguration (org.libresonic.player.service.upnp.ApacheUpnpServiceConfiguration)1