mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
UPNP don't notify embedded child devices by default (#4735)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
+10
@@ -79,4 +79,14 @@ public interface UpnpDiscoveryParticipant {
|
||||
default long getRemovalGracePeriodSeconds(RemoteDevice device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The discovery always notifies participants about discovered root devices. And if the participant also
|
||||
* wants to be notified about embedded child devices then it shall override this method.
|
||||
*
|
||||
* @return true if the participant wants to be also notified about embedded child devices.
|
||||
*/
|
||||
default boolean notifyChildDevices() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -113,6 +113,9 @@ public class UpnpDiscoveryService extends AbstractDiscoveryService
|
||||
|
||||
Collection<RemoteDevice> devices = upnpService.getRegistry().getRemoteDevices();
|
||||
for (RemoteDevice device : devices) {
|
||||
if (!device.isRoot() && !participant.notifyChildDevices()) {
|
||||
continue;
|
||||
}
|
||||
DiscoveryResult result = participant.createResult(device);
|
||||
if (result != null) {
|
||||
final DiscoveryResult resultNew = getLocalizedDiscoveryResult(result,
|
||||
@@ -171,6 +174,9 @@ public class UpnpDiscoveryService extends AbstractDiscoveryService
|
||||
@Override
|
||||
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
|
||||
for (UpnpDiscoveryParticipant participant : participants) {
|
||||
if (!device.isRoot() && !participant.notifyChildDevices()) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
DiscoveryResult result = participant.createResult(device);
|
||||
if (result != null) {
|
||||
@@ -200,6 +206,9 @@ public class UpnpDiscoveryService extends AbstractDiscoveryService
|
||||
@Override
|
||||
public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
|
||||
for (UpnpDiscoveryParticipant participant : participants) {
|
||||
if (!device.isRoot() && !participant.notifyChildDevices()) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
ThingUID thingUID = participant.getThingUID(device);
|
||||
if (thingUID != null) {
|
||||
|
||||
Reference in New Issue
Block a user