Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[amazonechocontrol] remove deprecated discovery interfaces #8095

Merged
merged 3 commits into from
Jul 11, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService;
import org.eclipse.smarthome.config.discovery.DiscoveryResult;
import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder;
import org.eclipse.smarthome.config.discovery.DiscoveryServiceCallback;
import org.eclipse.smarthome.config.discovery.ExtendedDiscoveryService;
import org.eclipse.smarthome.core.thing.ThingUID;
import org.openhab.binding.amazonechocontrol.internal.Connection;
import org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler;
Expand All @@ -51,20 +49,13 @@
* @author Lukas Knoeller - Initial contribution
*/
@NonNullByDefault
public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService implements ExtendedDiscoveryService {
public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
private AccountHandler accountHandler;
private final Logger logger = LoggerFactory.getLogger(SmartHomeDevicesDiscovery.class);

private @Nullable ScheduledFuture<?> startScanStateJob;
private @Nullable Long activateTimeStamp;

private @Nullable DiscoveryServiceCallback discoveryServiceCallback;

@Override
public void setDiscoveryServiceCallback(DiscoveryServiceCallback discoveryServiceCallback) {
this.discoveryServiceCallback = discoveryServiceCallback;
}

public SmartHomeDevicesDiscovery(AccountHandler accountHandler) {
super(SUPPORTED_SMART_HOME_THING_TYPES_UIDS, 10);
this.accountHandler = accountHandler;
Expand Down Expand Up @@ -143,11 +134,6 @@ public void activate(@Nullable Map<String, @Nullable Object> config) {
};

synchronized void setSmartHomeDevices(List<SmartHomeBaseDevice> deviceList) {
DiscoveryServiceCallback discoveryServiceCallback = this.discoveryServiceCallback;

if (discoveryServiceCallback == null) {
return;
}
int smartHomeDeviceDiscoveryMode = accountHandler.getSmartHomeDevicesDiscoveryMode();
if (smartHomeDeviceDiscoveryMode == 0) {
return;
Expand Down Expand Up @@ -227,14 +213,6 @@ synchronized void setSmartHomeDevices(List<SmartHomeBaseDevice> deviceList) {
}

if (thingUID != null) {
if (discoveryServiceCallback.getExistingDiscoveryResult(thingUID) != null) {
continue;
}

if (discoveryServiceCallback.getExistingThing(thingUID) != null) {
continue;
}

DiscoveryResult result = DiscoveryResultBuilder.create(thingUID).withLabel(deviceName)
.withProperties(props).withBridge(bridgeThingUID).build();

Expand Down