Interface DiscoveryListener


@NonNullByDefault public interface DiscoveryListener
The DiscoveryListener interface for receiving discovery events.

A class that is interested in processing discovery events fired synchronously by a DiscoveryService has to implement this interface.

Author:
Michael Grammling - Initial contribution, Andre Fuechsel - Added removeOlderThings
See Also:
  • Method Details

    • thingDiscovered

      void thingDiscovered(DiscoveryService source, DiscoveryResult result)
      Invoked synchronously when a DiscoveryResult has been created by the according DiscoveryService.

      Hint: This method could even be invoked for DiscoveryResults, whose existence has already been informed about.

      Parameters:
      source - the discovery service which is the source of this event (not null)
      result - the discovery result (not null)
    • thingRemoved

      void thingRemoved(DiscoveryService source, ThingUID thingUID)
      Invoked synchronously when an already existing Thing has been marked to be deleted by the according DiscoveryService.

      Hint: This method could even be invoked for DiscoveryResults, whose removal has already been informed about.

      Parameters:
      source - the discovery service which is the source of this event (not null)
      thingUID - the Thing UID to be removed (not null)
    • removeOlderResults

      @Nullable Collection<ThingUID> removeOlderResults(DiscoveryService source, long timestamp, @Nullable Collection<ThingTypeUID> thingTypeUIDs, @Nullable ThingUID bridgeUID)
      Removes all results belonging to one of the given types that are older than the given timestamp.
      Parameters:
      source - the discovery service which is the source of this event (not null)
      timestamp - timestamp, all older results will be removed
      thingTypeUIDs - collection of ThingTypes, only results of these ThingTypes will be removed; if null then DiscoveryService.getSupportedThingTypes() will be used instead
      bridgeUID - if not null only results of that bridge are being removed
      Returns:
      collection of thing UIDs of all removed things