]> git.basschouten.com Git - openhab-addons.git/blob
9883b5b9874dd238c50a2dc3c14faf0cfed068e2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.homematic.test.util;
14
15 import java.util.Collection;
16 import java.util.Queue;
17 import java.util.concurrent.ConcurrentLinkedQueue;
18
19 import org.eclipse.jdt.annotation.NonNull;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.openhab.core.config.discovery.DiscoveryListener;
22 import org.openhab.core.config.discovery.DiscoveryResult;
23 import org.openhab.core.config.discovery.DiscoveryService;
24 import org.openhab.core.thing.ThingTypeUID;
25 import org.openhab.core.thing.ThingUID;
26
27 /**
28  * This {@link DiscoveryListener} implementation simply records all discovered
29  * results, so that they can be checked after the discovery.
30  *
31  * @author Florian Stolte - Initial Contribution
32  *
33  */
34 public class SimpleDiscoveryListener implements DiscoveryListener {
35
36     public Queue<DiscoveryResult> discoveredResults = new ConcurrentLinkedQueue<>();
37
38     @Override
39     public void thingRemoved(DiscoveryService source, ThingUID thingUID) {
40     }
41
42     @Override
43     public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
44         discoveredResults.add(result);
45     }
46
47     @Override
48     public @Nullable Collection<@NonNull ThingUID> removeOlderResults(DiscoveryService source, long timestamp,
49             @Nullable Collection<@NonNull ThingTypeUID> thingTypeUIDs, @Nullable ThingUID bridgeUID) {
50         return null;
51     }
52 }