You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/11/03 15:15:29 UTC
[plc4x] branch develop updated: fix(plc-simulator): fix cBus using s7 port
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new ddf17ee0d fix(plc-simulator): fix cBus using s7 port
ddf17ee0d is described below
commit ddf17ee0db01d4b9d518bedf88e2dae537aa6838
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Nov 3 16:15:21 2022 +0100
fix(plc-simulator): fix cBus using s7 port
---
.../src/main/java/org/apache/plc4x/simulator/PlcSimulator.java | 6 ++++--
.../main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java | 5 +++++
.../org/apache/plc4x/simulator/server/cbus/CBusServerModule.java | 5 ++---
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java
index 770a8ae49..21d3bab47 100644
--- a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java
+++ b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java
@@ -147,8 +147,9 @@ public class PlcSimulator {
Options options = new Options();
options.addOption("public", false, "listen on all interfaces (overrides host option)");
- options.addOption("host", true, "display current time");
- options.addOption("s7port", true, "changes the s7 port");
+ options.addOption("host", true, "the host interface");
+ options.addOption("s7Port", true, "changes the s7 port");
+ options.addOption("cBusPort", true, "changes the port");
// Parse args
CommandLineParser parser = new DefaultParser();
@@ -161,6 +162,7 @@ public class PlcSimulator {
config.host = null;
}
config.s7Port = cmd.getOptionValue("s7port");
+ config.cBusPort = cmd.getOptionValue("cBusPort");
return config;
}
diff --git a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java
index 2879d571e..740d5f2da 100644
--- a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java
+++ b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java
@@ -22,6 +22,7 @@ public class PlcSimulatorConfig {
String host;
String s7Port;
+ String cBusPort;
public String getHost() {
return host;
@@ -30,4 +31,8 @@ public class PlcSimulatorConfig {
public String getS7Port() {
return s7Port;
}
+
+ public String getCBusPort() {
+ return cBusPort;
+ }
}
diff --git a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
index 78c837950..23b5d62bf 100644
--- a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
+++ b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
@@ -61,7 +61,6 @@ public class CBusServerModule implements ServerModule {
this.context = context;
}
-
@Override
public void start() throws SimulatorException {
if (loopGroup != null) {
@@ -90,8 +89,8 @@ public class CBusServerModule implements ServerModule {
.childOption(ChannelOption.SO_KEEPALIVE, true);
int port = CBusConstants.CBUSTCPDEFAULTPORT;
- if (config.getS7Port() != null) {
- port = Integer.parseInt(config.getS7Port());
+ if (config.getCBusPort() != null) {
+ port = Integer.parseInt(config.getCBusPort());
}
String host = config.getHost();
if (host != null) {