2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.souliss.internal.discovery;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.souliss.internal.handler.SoulissGatewayHandler;
18 import org.openhab.binding.souliss.internal.protocol.CommonCommands;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * @author Tonino Fazio - Initial contribution
24 * @author Luca Calcaterra - Refactor for OH3
27 public class SoulissDiscoverJob implements Runnable {
29 private final Logger logger = LoggerFactory.getLogger(SoulissDiscoverJob.class);
31 private final CommonCommands commonCommands = new CommonCommands();
33 private int resendCounter = 0;
35 private @Nullable SoulissGatewayHandler gwHandler;
37 public SoulissDiscoverJob(@Nullable SoulissGatewayHandler soulissGwHandler) {
38 this.gwHandler = soulissGwHandler;
43 var localGwHandler = this.gwHandler;
44 if (localGwHandler != null) {
45 commonCommands.sendDBStructFrame(localGwHandler.getGwConfig());
46 logger.debug("Sending request to gateway for souliss network - Counter={}", resendCounter);
48 logger.debug("Gateway null - Skipped");