Class MDNSAddonFinder

java.lang.Object
org.openhab.core.config.discovery.addon.BaseAddonFinder
org.openhab.core.config.discovery.addon.mdns.MDNSAddonFinder
All Implemented Interfaces:
EventListener, javax.jmdns.ServiceListener, AddonFinder

@NonNullByDefault public class MDNSAddonFinder extends BaseAddonFinder implements javax.jmdns.ServiceListener
This is a MDNSAddonFinder for finding suggested add-ons via mDNS. This finder requires a mdnsServiceType parameter to be present in the add-on info discovery method.
Author:
Andrew Fiddian-Green - Initial contribution, Mark Herwege - refactor to allow uninstall, Mark Herwege - change to discovery method schema
  • Field Details

  • Constructor Details

    • MDNSAddonFinder

      public MDNSAddonFinder(MDNSClient mdnsClient)
  • Method Details

    • addService

      public void addService(javax.jmdns.ServiceInfo service, boolean isResolved)
      Adds the given mDNS service to the set of discovered services.
      Parameters:
      service - the mDNS service to be added.
      isResolved - indicates if mDNS has fully resolved the service information.
    • deactivate

      public void deactivate()
    • setAddonCandidates

      public void setAddonCandidates(List<AddonInfo> candidates)
      Description copied from interface: AddonFinder
      The framework calls this method to provide a list of AddonInfo elements which contain potential candidates that this finder can iterate over in order to detect which ones to return via the getSuggestedAddons() method.
      Specified by:
      setAddonCandidates in interface AddonFinder
      Overrides:
      setAddonCandidates in class BaseAddonFinder
      Parameters:
      candidates - a list of AddonInfo candidates.
    • unsetAddonCandidates

      public void unsetAddonCandidates()
      Description copied from interface: AddonFinder
      This method should be called from the framework to allow a finder to stop searching for add-ons and do cleanup.
      Specified by:
      unsetAddonCandidates in interface AddonFinder
      Overrides:
      unsetAddonCandidates in class BaseAddonFinder
    • getSuggestedAddons

      public Set<AddonInfo> getSuggestedAddons()
      Description copied from interface: AddonFinder
      The framework calls this method to scan through the candidate list of AddonInfo and return a subset of those that it suggests to be installed.
      Specified by:
      getSuggestedAddons in interface AddonFinder
    • getServiceName

      public String getServiceName()
      Specified by:
      getServiceName in class BaseAddonFinder
    • serviceAdded

      public void serviceAdded(@Nullable javax.jmdns.ServiceEvent event)
      Specified by:
      serviceAdded in interface javax.jmdns.ServiceListener
    • serviceRemoved

      public void serviceRemoved(@Nullable javax.jmdns.ServiceEvent event)
      Specified by:
      serviceRemoved in interface javax.jmdns.ServiceListener
    • serviceResolved

      public void serviceResolved(@Nullable javax.jmdns.ServiceEvent event)
      Specified by:
      serviceResolved in interface javax.jmdns.ServiceListener