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
- See Also:
-
Method Summary
Modifier 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.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 ScanListener listener) Forces the associatedDiscoveryServices to start a discovery for all thing types of the given binding id.booleanstartScan(ThingTypeUID thingTypeUID, @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
-
startScan
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 discoverylistener- a callback to inform about errors or termination, can be null. If more than one discovery service is started, theScanListener.onFinished()callback is called after all discovery services finished their scan. If one discovery service raises an error, the methodScanListener.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
-
startScan
Forces 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 discoverylistener- a callback to inform about errors or termination, can be null. If more than one discovery service is started, theScanListener.onFinished()callback is called after all discovery services finished their scan. If one discovery service raises an error, the methodScanListener.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
-
abortScan
Aborts 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
-
abortScan
Aborts 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
-
supportsDiscovery
Returns 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
-
supportsDiscovery
Returns 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
-
addDiscoveryListener
Adds 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
-
removeDiscoveryListener
Removes 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
-
getSupportedThingTypes
List<ThingTypeUID> getSupportedThingTypes()Returns a list of thing types, that support discovery.- Returns:
- list of thing types, that support discovery
-
getSupportedBindings
Returns a list of bindings, that support discovery.- Returns:
- list of bindings, that support discovery
-
getMaxScanTimeout
Returns 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
-
getMaxScanTimeout
Returns 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
-