Class SddpDiscoveryService
java.lang.Object
org.openhab.core.config.discovery.AbstractDiscoveryService
org.openhab.core.config.discovery.sddp.SddpDiscoveryService
- All Implemented Interfaces:
AutoCloseable
,DiscoveryService
,NetworkAddressChangeListener
@NonNullByDefault
public class SddpDiscoveryService
extends AbstractDiscoveryService
implements AutoCloseable, NetworkAddressChangeListener
This is a
DiscoveryService
implementation, which can find SDDP devices in the network.
Support for bindings can be achieved by implementing and registering a SddpDiscoveryParticipant
.
Support for finders can be achieved by implementing and registering a SddpDeviceParticipant
.- Author:
- Andrew Fiddian-Green - Initial contribution
-
Field Summary
Fields inherited from class org.openhab.core.config.discovery.AbstractDiscoveryService
i18nProvider, localeProvider, scanListener, scheduler
Fields inherited from interface org.openhab.core.config.discovery.DiscoveryService
CONFIG_PROPERTY_BACKGROUND_DISCOVERY
-
Constructor Summary
ConstructorDescriptionSddpDiscoveryService
(@Nullable Map<String, Object> configProperties, NetworkAddressService networkAddressService, TranslationProvider i18nProvider, LocaleProvider localeProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSddpDeviceParticipant
(SddpDeviceParticipant participant) protected void
addSddpDiscoveryParticipant
(SddpDiscoveryParticipant participant) void
close()
createSddpDevice
(String data) Optionally create anSddpDevice
object from UDP packet data if the data is good.protected void
Called on component deactivation, if the implementation of this class is an OSGi declarative service and does not override the method.Returns the list ofThing
types which are supported by theDiscoveryService
.protected void
Called when the configuration for the discovery service is changed.void
onChanged
(List<CidrAddress> added, List<CidrAddress> removed) If the network interfaces change then cancel and recreate all pending tasks.void
removeSddpDeviceParticipant
(SddpDeviceParticipant participant) void
removeSddpDiscoveryParticipant
(SddpDiscoveryParticipant participant) protected void
Can be overridden to start background discovery logic.protected void
Schedule to send one single SDDP SEARCH request, and listen for responses.protected void
Can be overridden to stop background discovery logic.Methods inherited from class org.openhab.core.config.discovery.AbstractDiscoveryService
abortScan, activate, addDiscoveryListener, getLocalizedDiscoveryResult, getScanInputDescription, getScanInputLabel, getScanTimeout, getTimestampOfLastScan, isBackgroundDiscoveryEnabled, isScanInputSupported, removeDiscoveryListener, removeOlderResults, removeOlderResults, removeOlderResults, startScan, startScan, startScan, stopScan, thingDiscovered, thingRemoved
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.net.NetworkAddressChangeListener
onPrimaryAddressChanged
-
Constructor Details
-
SddpDiscoveryService
public SddpDiscoveryService(@Nullable Map<String, Object> configProperties, NetworkAddressService networkAddressService, TranslationProvider i18nProvider, LocaleProvider localeProvider)
-
-
Method Details
-
addSddpDeviceParticipant
-
addSddpDiscoveryParticipant
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
createSddpDevice
Optionally create anSddpDevice
object from UDP packet data if the data is good. -
deactivate
protected void deactivate()Description copied from class:AbstractDiscoveryService
Called on component deactivation, if the implementation of this class is an OSGi declarative service and does not override the method. The method implementation callsAbstractDiscoveryService.stopBackgroundDiscovery()
if background discovery is enabled at the time of component deactivation.- Overrides:
deactivate
in classAbstractDiscoveryService
-
getSupportedThingTypes
Description copied from class:AbstractDiscoveryService
Returns the list ofThing
types which are supported by theDiscoveryService
.- Specified by:
getSupportedThingTypes
in interfaceDiscoveryService
- Overrides:
getSupportedThingTypes
in classAbstractDiscoveryService
- Returns:
- the list of Thing types which are supported by the discovery service (not null, could be empty)
-
modified
Description copied from class:AbstractDiscoveryService
Called when the configuration for the discovery service is changed. If background discovery should be enabled and is currently disabled, the methodAbstractDiscoveryService.startBackgroundDiscovery()
is called. If background discovery should be disabled and is currently enabled, the methodAbstractDiscoveryService.stopBackgroundDiscovery()
is called. In all other cases, nothing happens.- Overrides:
modified
in classAbstractDiscoveryService
- Parameters:
configProperties
- configuration properties
-
onChanged
If the network interfaces change then cancel and recreate all pending tasks.- Specified by:
onChanged
in interfaceNetworkAddressChangeListener
- Parameters:
added
- Unmodifiable list of recently added network addressesremoved
- Unmodifiable list of recently removed network addresses
-
removeSddpDeviceParticipant
-
removeSddpDiscoveryParticipant
-
startBackgroundDiscovery
protected void startBackgroundDiscovery()Description copied from class:AbstractDiscoveryService
Can be overridden to start background discovery logic. This method is called if background discovery is enabled when the component is being activated (seeAbstractDiscoveryService.activate(java.util.Map<java.lang.String, java.lang.Object>)
.- Overrides:
startBackgroundDiscovery
in classAbstractDiscoveryService
-
startScan
protected void startScan()Schedule to send one single SDDP SEARCH request, and listen for responses.- Specified by:
startScan
in classAbstractDiscoveryService
-
stopBackgroundDiscovery
protected void stopBackgroundDiscovery()Description copied from class:AbstractDiscoveryService
Can be overridden to stop background discovery logic. This method is called if background discovery is enabled when the component is being deactivated (seeAbstractDiscoveryService.deactivate()
.- Overrides:
stopBackgroundDiscovery
in classAbstractDiscoveryService
-