mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
fix upnp support to handle embededd devices (#4712)
Signed-off-by: Laurent ARNAL <laurent@clae.net>
This commit is contained in:
+4
@@ -149,6 +149,10 @@ public class UpnpDiscoveryService extends AbstractDiscoveryService
|
||||
protected void startScan() {
|
||||
for (RemoteDevice device : upnpService.getRegistry().getRemoteDevices()) {
|
||||
remoteDeviceAdded(upnpService.getRegistry(), device);
|
||||
|
||||
for (RemoteDevice childDevice : device.getEmbeddedDevices()) {
|
||||
remoteDeviceAdded(upnpService.getRegistry(), childDevice);
|
||||
}
|
||||
}
|
||||
upnpService.getRegistry().addListener(this);
|
||||
upnpService.getControlPoint().search();
|
||||
|
||||
+10
-2
@@ -216,7 +216,7 @@ public class UpnpIOServiceImpl implements UpnpIOService, RegistryListener {
|
||||
}
|
||||
|
||||
private Device getDevice(UpnpIOParticipant participant) {
|
||||
return upnpService.getRegistry().getDevice(new UDN(participant.getUDN()), true);
|
||||
return upnpService.getRegistry().getDevice(new UDN(participant.getUDN()), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -354,7 +354,7 @@ public class UpnpIOServiceImpl implements UpnpIOService, RegistryListener {
|
||||
|
||||
@Override
|
||||
public boolean isRegistered(UpnpIOParticipant participant) {
|
||||
return upnpService.getRegistry().getDevice(new UDN(participant.getUDN()), true) != null;
|
||||
return upnpService.getRegistry().getDevice(new UDN(participant.getUDN()), false) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -508,6 +508,10 @@ public class UpnpIOServiceImpl implements UpnpIOService, RegistryListener {
|
||||
@Override
|
||||
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
|
||||
informParticipants(device, true);
|
||||
|
||||
for (RemoteDevice childDevice : device.getEmbeddedDevices()) {
|
||||
informParticipants(childDevice, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -517,6 +521,10 @@ public class UpnpIOServiceImpl implements UpnpIOService, RegistryListener {
|
||||
@Override
|
||||
public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
|
||||
informParticipants(device, false);
|
||||
|
||||
for (RemoteDevice childDevice : device.getEmbeddedDevices()) {
|
||||
informParticipants(childDevice, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user