[Minor] Allow to disable connecting to PLC server
This commit is contained in:
parent
fe20b0066e
commit
ccf3841f77
|
@ -50,6 +50,7 @@ public class PlcGwClientHandler extends StrolchComponent implements GlobalPlcLis
|
||||||
private boolean verbose;
|
private boolean verbose;
|
||||||
|
|
||||||
private String plcId;
|
private String plcId;
|
||||||
|
private boolean gwConnectToServer;
|
||||||
private String gwUsername;
|
private String gwUsername;
|
||||||
private String gwPassword;
|
private String gwPassword;
|
||||||
private String gwServerUrl;
|
private String gwServerUrl;
|
||||||
|
@ -82,6 +83,7 @@ public class PlcGwClientHandler extends StrolchComponent implements GlobalPlcLis
|
||||||
|
|
||||||
this.verbose = configuration.getBoolean("verbose", false);
|
this.verbose = configuration.getBoolean("verbose", false);
|
||||||
this.plcId = getComponent(PlcHandler.class).getPlcId();
|
this.plcId = getComponent(PlcHandler.class).getPlcId();
|
||||||
|
this.gwConnectToServer = configuration.getBoolean("gwConnectToServer", true);
|
||||||
this.gwUsername = configuration.getString("gwUsername", null);
|
this.gwUsername = configuration.getString("gwUsername", null);
|
||||||
this.gwPassword = configuration.getString("gwPassword", null);
|
this.gwPassword = configuration.getString("gwPassword", null);
|
||||||
this.gwServerUrl = configuration.getString("gwServerUrl", null);
|
this.gwServerUrl = configuration.getString("gwServerUrl", null);
|
||||||
|
@ -102,10 +104,11 @@ public class PlcGwClientHandler extends StrolchComponent implements GlobalPlcLis
|
||||||
notifyPlcConnectionState(ConnectionState.Disconnected);
|
notifyPlcConnectionState(ConnectionState.Disconnected);
|
||||||
this.plcHandler.setGlobalListener(this);
|
this.plcHandler.setGlobalListener(this);
|
||||||
|
|
||||||
delayConnect(INITIAL_DELAY, TimeUnit.SECONDS);
|
if (this.gwConnectToServer) {
|
||||||
|
delayConnect(INITIAL_DELAY, TimeUnit.SECONDS);
|
||||||
this.run = true;
|
this.run = true;
|
||||||
this.messageSenderTask = getExecutorService("MessageSender").submit(this::sendMessages);
|
this.messageSenderTask = getExecutorService("MessageSender").submit(this::sendMessages);
|
||||||
|
}
|
||||||
|
|
||||||
super.start();
|
super.start();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue