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.
Simple Device Discovery Protocol (SDDP) is a simple multicast discovery protocol implemented by many "smart home" devices to allow a controlling agent to easily discover and connect to devices on a local subnet.
SDDP was created by Control4, and is quite similar to UPnP's standard Simple Service Discovery Protocol (SSDP), and it serves a virtually identical purpose. SDDP is not a standard protocol and it is not publicly documented.
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, schedulerFields inherited from interface org.openhab.core.config.discovery.DiscoveryService
CONFIG_PROPERTY_BACKGROUND_DISCOVERY -
Constructor Summary
ConstructorsConstructorDescriptionSddpDiscoveryService(@Nullable Map<String, Object> configProperties, NetworkAddressService networkAddressService, TranslationProvider i18nProvider, LocaleProvider localeProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSddpDeviceParticipant(SddpDeviceParticipant participant) protected voidaddSddpDiscoveryParticipant(SddpDiscoveryParticipant participant) voidclose()createSddpDevice(String data) Optionally create anSddpDeviceobject from UDP packet data if the data is good.protected voidCalled on component deactivation, if the implementation of this class is an OSGi declarative service and does not override the method.Returns the list ofThingtypes which are supported by theDiscoveryService.protected voidCalled when the configuration for the discovery service is changed.voidonChanged(List<CidrAddress> added, List<CidrAddress> removed) If the network interfaces change then cancel and recreate all pending tasks.voidremoveSddpDeviceParticipant(SddpDeviceParticipant participant) voidremoveSddpDiscoveryParticipant(SddpDiscoveryParticipant participant) protected voidCan be overridden to start background discovery logic.protected voidSchedule to send one single SDDP SEARCH request, and listen for responses.protected voidCan 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, thingRemovedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
closein interfaceAutoCloseable
-
createSddpDevice
Optionally create anSddpDeviceobject from UDP packet data if the data is good. -
deactivate
protected void deactivate()Description copied from class:AbstractDiscoveryServiceCalled 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:
deactivatein classAbstractDiscoveryService
-
getSupportedThingTypes
Description copied from class:AbstractDiscoveryServiceReturns the list ofThingtypes which are supported by theDiscoveryService.- Specified by:
getSupportedThingTypesin interfaceDiscoveryService- Overrides:
getSupportedThingTypesin classAbstractDiscoveryService- Returns:
- the list of Thing types which are supported by the discovery service (not null, could be empty)
-
modified
Description copied from class:AbstractDiscoveryServiceCalled 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:
modifiedin classAbstractDiscoveryService- Parameters:
configProperties- configuration properties
-
onChanged
If the network interfaces change then cancel and recreate all pending tasks.- Specified by:
onChangedin 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:AbstractDiscoveryServiceCan 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:
startBackgroundDiscoveryin classAbstractDiscoveryService
-
startScan
protected void startScan()Schedule to send one single SDDP SEARCH request, and listen for responses.- Specified by:
startScanin classAbstractDiscoveryService
-
stopBackgroundDiscovery
protected void stopBackgroundDiscovery()Description copied from class:AbstractDiscoveryServiceCan 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:
stopBackgroundDiscoveryin classAbstractDiscoveryService
-