org.fourthline.cling.registry.Registry Java Examples

The following examples show how to use org.fourthline.cling.registry.Registry. 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: BrowserActivity.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void remoteDeviceDiscoveryFailed(Registry registry, final RemoteDevice device,
        final Exception ex) {
    runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(
                    BrowserActivity.this,
                    "Discovery failed of '"
                            + device.getDisplayString()
                            + "': "
                            + (ex != null ? ex.toString()
                                    : "Couldn't retrieve device/service descriptors"),
                    Toast.LENGTH_LONG).show();
        }
    });
    deviceRemoved(device);
}
 
Example #2
Source File: DevicesActivity.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
	Log.e("DeviceListRegistryListener",
			"remoteDeviceAdded:" + device.toString()
					+ device.getType().getType());

	if (device.getType().getNamespace().equals("schemas-upnp-org")
			&& device.getType().getType().equals("MediaServer")) {
		final DeviceItem display = new DeviceItem(device, device
				.getDetails().getFriendlyName(),
				device.getDisplayString(), "(REMOTE) "
						+ device.getType().getDisplayString());
		deviceAdded(display);
	}

	if (device.getType().getNamespace().equals("schemas-upnp-org")
			&& device.getType().getType().equals("MediaRenderer")) {
		final DeviceItem dmrDisplay = new DeviceItem(device, device
				.getDetails().getFriendlyName(),
				device.getDisplayString(), "(REMOTE) "
						+ device.getType().getDisplayString());
		dmrAdded(dmrDisplay);
	}
}
 
Example #3
Source File: ClingRegistryListener.java    From portmapper with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void deviceAdded(final Registry registry, @SuppressWarnings("rawtypes") final Device device) {
    @SuppressWarnings("unchecked")
    final Service<?, ?> connectionService = discoverConnectionService(device);
    if (connectionService == null) {
        return;
    }

    logger.debug("Found connection service {}", connectionService);
    final boolean success = foundServices.offer(connectionService);
    if (!success) {
        throw new IllegalStateException("Could not add new service");
    }
}
 
Example #4
Source File: AndroidUpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Starts the UPnP service.
 */
@Override
public void onCreate() {
    super.onCreate();

    upnpService = new UpnpServiceImpl(createConfiguration()) {

        @Override
        protected Router createRouter(ProtocolFactory protocolFactory, Registry registry) {
            return AndroidUpnpServiceImpl.this.createRouter(
                getConfiguration(),
                protocolFactory,
                AndroidUpnpServiceImpl.this
            );
        }

        @Override
        public synchronized void shutdown() {
            // First have to remove the receiver, so Android won't complain about it leaking
            // when the main UI thread exits.
            ((AndroidRouter)getRouter()).unregisterBroadcastReceiver();

            // Now we can concurrently run the Cling shutdown code, without occupying the
            // Android main UI thread. This will complete probably after the main UI thread
            // is done.
            super.shutdown(true);
        }
    };
}
 
Example #5
Source File: ControlPointImpl.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Inject
public ControlPointImpl(UpnpServiceConfiguration configuration, ProtocolFactory protocolFactory, Registry registry) {
    log.fine("Creating ControlPoint: " + getClass().getName());
    
    this.configuration = configuration;
    this.protocolFactory = protocolFactory;
    this.registry = registry;
}
 
Example #6
Source File: AndroidUpnpServiceImpl.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Starts the UPnP service.
 */
@Override
public void onCreate() {
    super.onCreate();

    upnpService = new UpnpServiceImpl(createConfiguration()) {

        @Override
        protected Router createRouter(ProtocolFactory protocolFactory, Registry registry) {
            return AndroidUpnpServiceImpl.this.createRouter(
                getConfiguration(),
                protocolFactory,
                AndroidUpnpServiceImpl.this
            );
        }

        @Override
        public synchronized void shutdown() {
            // First have to remove the receiver, so Android won't complain about it leaking
            // when the main UI thread exits.
            ((AndroidRouter)getRouter()).unregisterBroadcastReceiver();

            // Now we can concurrently run the Cling shutdown code, without occupying the
            // Android main UI thread. This will complete probably after the main UI thread
            // is done.
            super.shutdown(true);
        }
    };
}
 
Example #7
Source File: PortMappingListener.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
synchronized public void deviceRemoved(Registry registry, Device device) {
    for (Service service : device.findServices()) {
        Iterator<Map.Entry<Service, List<PortMapping>>> it = activePortMappings.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<Service, List<PortMapping>> activeEntry = it.next();
            if (!activeEntry.getKey().equals(service)) continue;

            if (activeEntry.getValue().size() > 0)
                handleFailureMessage("Device disappeared, couldn't delete port mappings: " + activeEntry.getValue().size());

            it.remove();
        }
    }
}
 
Example #8
Source File: ManagedUpnpService.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void beforeShutdown(Registry registry) {
    registryShutdownEvent.select(new AnnotationLiteral<Before>() {
    }).fire(
            new RegistryShutdown()
    );
}
 
Example #9
Source File: ControlPointImpl.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Inject
public ControlPointImpl(UpnpServiceConfiguration configuration, ProtocolFactory protocolFactory, Registry registry) {
    log.fine("Creating ControlPoint: " + getClass().getName());
    
    this.configuration = configuration;
    this.protocolFactory = protocolFactory;
    this.registry = registry;
}
 
Example #10
Source File: PortMappingListener.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
synchronized public void deviceRemoved(Registry registry, Device device) {
    for (Service service : device.findServices()) {
        Iterator<Map.Entry<Service, List<PortMapping>>> it = activePortMappings.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<Service, List<PortMapping>> activeEntry = it.next();
            if (!activeEntry.getKey().equals(service)) continue;

            if (activeEntry.getValue().size() > 0)
                handleFailureMessage("Device disappeared, couldn't delete port mappings: " + activeEntry.getValue().size());

            it.remove();
        }
    }
}
 
Example #11
Source File: DevicesActivity.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
	final DeviceItem display = new DeviceItem(device,
			device.getDisplayString());
	deviceRemoved(display);

	if (device.getType().getNamespace().equals("schemas-upnp-org")
			&& device.getType().getType().equals("MediaRenderer")) {
		final DeviceItem dmrDisplay = new DeviceItem(device, device
				.getDetails().getFriendlyName(),
				device.getDisplayString(), "(REMOTE) "
						+ device.getType().getDisplayString());
		dmrRemoved(dmrDisplay);
	}
}
 
Example #12
Source File: DevicesActivity.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void localDeviceAdded(Registry registry, LocalDevice device) {
	Log.e("DeviceListRegistryListener",
			"localDeviceAdded:" + device.toString()
					+ device.getType().getType());

	final DeviceItem display = new DeviceItem(device, device
			.getDetails().getFriendlyName(), device.getDisplayString(),
			"(REMOTE) " + device.getType().getDisplayString());
	deviceAdded(display);
}
 
Example #13
Source File: DevicesActivity.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void localDeviceRemoved(Registry registry, LocalDevice device) {
	Log.e("DeviceListRegistryListener",
			"localDeviceRemoved:" + device.toString()
					+ device.getType().getType());

	final DeviceItem display = new DeviceItem(device,
			device.getDisplayString());
	deviceRemoved(display);
}
 
Example #14
Source File: ManagedUpnpService.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void beforeShutdown(Registry registry) {
    registryShutdownEvent.select(new AnnotationLiteral<Before>() {
    }).fire(
            new RegistryShutdown()
    );
}
 
Example #15
Source File: UpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected Registry createRegistry(ProtocolFactory protocolFactory) {
    return new RegistryImpl(this);
}
 
Example #16
Source File: UpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Registry getRegistry() {
    return registry;
}
 
Example #17
Source File: UpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected ControlPoint createControlPoint(ProtocolFactory protocolFactory, Registry registry) {
    return new ControlPointImpl(getConfiguration(), protocolFactory, registry);
}
 
Example #18
Source File: BrowserActivity.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void remoteDeviceDiscoveryStarted(Registry registry, RemoteDevice device) {
    deviceAdded(device);
}
 
Example #19
Source File: BrowserActivity.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void localDeviceAdded(Registry registry, LocalDevice device) {
    deviceAdded(device);
}
 
Example #20
Source File: BrowserActivity.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void localDeviceRemoved(Registry registry, LocalDevice device) {
    deviceRemoved(device);
}
 
Example #21
Source File: DevicesActivity.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void remoteDeviceDiscoveryStarted(Registry registry,
		RemoteDevice device) {
}
 
Example #22
Source File: DevicesActivity.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void remoteDeviceDiscoveryFailed(Registry registry,
		final RemoteDevice device, final Exception ex) {
}
 
Example #23
Source File: ClingRouter.java    From portmapper with GNU General Public License v3.0 4 votes vote down vote up
public ClingRouter(final RemoteService service, final Registry registry, final ControlPoint controlPoint) {
    super(getName(service));
    this.service = service;
    this.registry = registry;
    actionService = new ActionService(service, controlPoint);
}
 
Example #24
Source File: BrowserActivity.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
    deviceRemoved(device);
}
 
Example #25
Source File: AndroidUpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Registry getRegistry() {
    return upnpService.getRegistry();
}
 
Example #26
Source File: ManagedUpnpService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
    remoteDeviceDiscoveryEvent.select(Phase.BYEBYE).fire(
            new RemoteDeviceDiscovery(device)
    );
}
 
Example #27
Source File: ManagedUpnpService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void remoteDeviceUpdated(Registry registry, RemoteDevice device) {
    remoteDeviceDiscoveryEvent.select(Phase.UPDATED).fire(
            new RemoteDeviceDiscovery(device)
    );
}
 
Example #28
Source File: ControlPointImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Registry getRegistry() {
    return registry;
}
 
Example #29
Source File: ManagedUpnpService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void localDeviceAdded(Registry registry, LocalDevice device) {
    localDeviceDiscoveryEvent.select(Phase.COMPLETE).fire(
            new LocalDeviceDiscovery(device)
    );
}
 
Example #30
Source File: ManagedUpnpService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void localDeviceRemoved(Registry registry, LocalDevice device) {
    localDeviceDiscoveryEvent.select(Phase.BYEBYE).fire(
            new LocalDeviceDiscovery(device)
    );
}