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 Summary
Fields inherited from class org.openhab.core.config.discovery.addon.BaseAddonFinder
addonCandidates
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addService
(javax.jmdns.ServiceInfo service, boolean isResolved) Adds the given mDNS service to the set of discovered services.void
The framework calls this method to scan through the candidate list ofAddonInfo
and return a subset of those that it suggests to be installed.void
serviceAdded
(@Nullable javax.jmdns.ServiceEvent event) void
serviceRemoved
(@Nullable javax.jmdns.ServiceEvent event) void
serviceResolved
(@Nullable javax.jmdns.ServiceEvent event) void
setAddonCandidates
(List<AddonInfo> candidates) The framework calls this method to provide a list ofAddonInfo
elements which contain potential candidates that this finder can iterate over in order to detect which ones to return via thegetSuggestedAddons()
method.void
This method should be called from the framework to allow a finder to stop searching for add-ons and do cleanup.Methods inherited from class org.openhab.core.config.discovery.addon.BaseAddonFinder
propertyMatches
-
Field Details
-
SERVICE_TYPE
- See Also:
-
SERVICE_NAME
- See Also:
-
MDNS_SERVICE_TYPE
- See Also:
-
-
Constructor Details
-
MDNSAddonFinder
-
-
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
Description copied from interface:AddonFinder
The framework calls this method to provide a list ofAddonInfo
elements which contain potential candidates that this finder can iterate over in order to detect which ones to return via thegetSuggestedAddons()
method.- Specified by:
setAddonCandidates
in interfaceAddonFinder
- Overrides:
setAddonCandidates
in classBaseAddonFinder
- 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 interfaceAddonFinder
- Overrides:
unsetAddonCandidates
in classBaseAddonFinder
-
getSuggestedAddons
Description copied from interface:AddonFinder
The framework calls this method to scan through the candidate list ofAddonInfo
and return a subset of those that it suggests to be installed.- Specified by:
getSuggestedAddons
in interfaceAddonFinder
-
getServiceName
- Specified by:
getServiceName
in classBaseAddonFinder
-
serviceAdded
public void serviceAdded(@Nullable javax.jmdns.ServiceEvent event) - Specified by:
serviceAdded
in interfacejavax.jmdns.ServiceListener
-
serviceRemoved
public void serviceRemoved(@Nullable javax.jmdns.ServiceEvent event) - Specified by:
serviceRemoved
in interfacejavax.jmdns.ServiceListener
-
serviceResolved
public void serviceResolved(@Nullable javax.jmdns.ServiceEvent event) - Specified by:
serviceResolved
in interfacejavax.jmdns.ServiceListener
-