Interface DiscoveryServiceRegistry
DiscoveryServiceRegistry is a service interface which provides
 the following features.
 - Monitoring of DiscoveryServices
- Direct accessing monitored DiscoveryServices
- Forwarding all events received from the monitored DiscoveryServices.
- Author:
- Michael Grammling - Initial contribution, Ivaylo Ivanov - Added getMaxScanTimeout, Laurent Garnier - Added discovery with an optional input parameter
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleanAborts a started discovery on allDiscoveryServices for the given binding id.booleanabortScan(ThingTypeUID thingTypeUID) Aborts a started discovery on allDiscoveryServices for the given thing type.voidaddDiscoveryListener(DiscoveryListener listener) Adds aDiscoveryListenerto the listeners' registry.getDiscoveryServices(String bindingId) Returns the list of allDiscoveryServices, that discover thing types of the given binding id.intgetMaxScanTimeout(String bindingId) Returns the maximum discovery timeout from all discovery services registered for the specified binding idintgetMaxScanTimeout(ThingTypeUID thingTypeUID) Returns the maximum discovery timeout from all discovery services registered for the specified thingTypeUIDReturns a list of bindings, that support discovery.Returns a list of thing types, that support discovery.voidremoveDiscoveryListener(DiscoveryListener listener) Removes aDiscoveryListenerfrom the listeners' registry.booleanstartScan(String bindingId, @Nullable String input, @Nullable ScanListener listener) Forces the associatedDiscoveryServices to start a discovery for all thing types of the given binding id.booleanstartScan(ThingTypeUID thingTypeUID, @Nullable String input, @Nullable ScanListener listener) Forces the associatedDiscoveryServices to start a discovery.booleansupportsDiscovery(String bindingId) Returns true if the given binding id supports discovery for at least one thing type.booleansupportsDiscovery(ThingTypeUID thingTypeUID) Returns true if the given thing type UID supports discovery, false otherwise.
- 
Method Details- 
startScanboolean startScan(ThingTypeUID thingTypeUID, @Nullable String input, @Nullable ScanListener listener) Forces the associatedDiscoveryServices to start a discovery.Returns true, if at least oneDiscoveryServicecould be found and forced to start a discovery, otherwisefalse. If the discovery process has already been started before,trueis returned.- Parameters:
- thingTypeUID- the Thing type UID pointing to collection of discovery services to be forced to start a discovery
- input- an optional input parameter to be used during discovery scan, can be null.
- listener- a callback to inform about errors or termination, can be null. If more than one discovery service is started, the- ScanListener.onFinished()callback is called after all discovery services finished their scan. If one discovery service raises an error, the method- ScanListener.onErrorOccurred(Exception)is called directly. All other finished or error callbacks will be ignored and not forwarded to the listener.
- Returns:
- true if a t least one discovery service could be found and forced to start a discovery, otherwise false
 
- 
startScanForces the associatedDiscoveryServices to start a discovery for all thing types of the given binding id.Returns true, if at least oneDiscoveryServicecould be found and forced to start a discovery, otherwisefalse.- Parameters:
- bindingId- the binding id pointing to one or more discovery services to be forced to start a discovery
- input- an optional input parameter to be used during discovery scan, can be null.
- listener- a callback to inform about errors or termination, can be null. If more than one discovery service is started, the- ScanListener.onFinished()callback is called after all discovery services finished their scan. If one discovery service raises an error, the method- ScanListener.onErrorOccurred(Exception)is called directly. All other finished or error callbacks will be ignored and not forwarded to the listener.
- Returns:
- true if a t least one discovery service could be found and forced to start a discovery, otherwise false
 
- 
abortScanAborts a started discovery on allDiscoveryServices for the given thing type.Returns true, if at least oneDiscoveryServicecould be found and all found discoveries could be aborted, otherwisefalse. If the discovery process has not been started before,trueis returned.- Parameters:
- thingTypeUID- the Thing type UID whose discovery scans should be aborted
- Returns:
- true if at least one discovery service could be found and all discoveries could be aborted, otherwise false
 
- 
abortScanAborts a started discovery on allDiscoveryServices for the given binding id.Returns true, if at least oneDiscoveryServicecould be found and all found discoveries could be aborted, otherwisefalse. If the discovery process has not been started before,trueis returned.- Parameters:
- bindingId- the binding id whose discovery scans should be aborted
- Returns:
- true if at least one discovery service could be found and all discoveries could be aborted, otherwise false
 
- 
supportsDiscoveryReturns true if the given thing type UID supports discovery, false otherwise.- Parameters:
- thingTypeUID- thing type UID
- Returns:
- true if the given thing type UID supports discovery, false otherwise
 
- 
supportsDiscoveryReturns true if the given binding id supports discovery for at least one thing type.- Parameters:
- bindingId- bindingId
- Returns:
- true if the given binding id supports discovery, false otherwise
 
- 
addDiscoveryListenerAdds aDiscoveryListenerto the listeners' registry.When a DiscoveryResultis created by any of the monitoredDiscoveryServices, (e.g. by forcing the startup of the discovery process or while enabling the auto discovery mode), the specified listener is notified.This method returns silently if the specified listener has already been registered before. - Parameters:
- listener- the listener to be added
 
- 
removeDiscoveryListenerRemoves aDiscoveryListenerfrom the listeners' registry.When this method returns, the specified listener is no longer notified about DiscoveryResults created by any of the monitoredDiscoveryServices (e.g. by forcing the startup of the discovery process or while enabling the auto discovery mode).This method returns silently if the specified listener has not been registered before. - Parameters:
- listener- the listener to be removed
 
- 
getSupportedThingTypesList<ThingTypeUID> getSupportedThingTypes()Returns a list of thing types, that support discovery.- Returns:
- list of thing types, that support discovery
 
- 
getSupportedBindingsReturns a list of bindings, that support discovery.- Returns:
- list of bindings, that support discovery
 
- 
getDiscoveryServicesReturns the list of allDiscoveryServices, that discover thing types of the given binding id.- Returns:
- list of discovery services, that discover thing types of the given binding id
- Throws:
- IllegalStateException
 
- 
getMaxScanTimeoutReturns the maximum discovery timeout from all discovery services registered for the specified thingTypeUID- Parameters:
- thingTypeUID- thing type UID
- Returns:
- the maximum amount of seconds which the discovery can take
 
- 
getMaxScanTimeoutReturns the maximum discovery timeout from all discovery services registered for the specified binding id- Parameters:
- bindingId- id of the binding
- Returns:
- the maximum amount of seconds which the discovery can take
 
 
-