use of org.libresonic.player.service.UPnPService in project libresonic by Libresonic.
the class ClingRouter method findConnectionService.
/**
* Returns the UPnP service used for port mapping.
*/
private static Service findConnectionService(UpnpService upnpService) {
class ConnectionServiceDiscoverer extends PortMappingListener {
ConnectionServiceDiscoverer() {
super(new PortMapping[0]);
}
@Override
public Service discoverConnectionService(Device device) {
return super.discoverConnectionService(device);
}
}
ConnectionServiceDiscoverer discoverer = new ConnectionServiceDiscoverer();
Collection<Device> devices = upnpService.getRegistry().getDevices();
for (Device device : devices) {
Service service = discoverer.discoverConnectionService(device);
if (service != null) {
return service;
}
}
return null;
}
Aggregations