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

Ensure initialization completed #41

Merged
merged 6 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -14,6 +14,7 @@

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
Expand Down Expand Up @@ -49,7 +50,6 @@
*/
@NonNullByDefault
public class SimaticBridgeHandler extends BaseBridgeHandler {

private final Logger logger = LoggerFactory.getLogger(SimaticBridgeHandler.class);

private @Nullable SimaticBridgeConfiguration config;
Expand All @@ -60,6 +60,8 @@ public class SimaticBridgeHandler extends BaseBridgeHandler {
private @Nullable ChannelUID chVersion, chPduSize, chAreasCount, chAreas, chTagCount, chRequests, chBytes;

private int channelCount = 0;
/** Initial scheduler delay */
private static final long INIT_SECONDS = 5;

/**
* Constructor
Expand Down Expand Up @@ -192,11 +194,11 @@ public void initialize() {
updateStatus(ThingStatus.UNKNOWN);

// background initialization
scheduler.execute(() -> {
scheduler.schedule(() -> {
if (!connection.open()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
}
});
}, INIT_SECONDS, TimeUnit.SECONDS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@NonNullByDefault
public class SimaticBindingConstants {

public static final String VERSION = "3.2.0";
public static final String VERSION = "3.2.1";

private static final String BINDING_ID = "simatic";

Expand Down