Skip to content

Commit

Permalink
Ensure initialization completed (#41)
Browse files Browse the repository at this point in the history
* Added update mode

* Fix reconnect issue #34

* Space between data in one area increased to 128

* Version update

* Startup delay to ensure binding initialization completed
  • Loading branch information
docbender authored Mar 8, 2022
1 parent 9604f33 commit 83ce93a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit 83ce93a

Please sign in to comment.