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/07/27 13:18:44 UTC
[plc4x] 02/02: feat(plc4j/cbus): added simple cbus implementation to plc-simulator
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
commit 067ad4f656f94b884db91dde46ece0180febf432
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Jul 27 15:18:35 2022 +0200
feat(plc4j/cbus): added simple cbus implementation to plc-simulator
---
.../org/apache/plc4x/java/cbus/CBusDriver.java | 1 -
sandbox/plc-simulator/pom.xml | 10 +++
.../org/apache/plc4x/simulator/PlcSimulator.java | 82 ++++++++++++++------
.../apache/plc4x/simulator/PlcSimulatorConfig.java | 9 +++
...latorExcepiton.java => SimulatorException.java} | 8 +-
.../plc4x/simulator/server/ServerModule.java | 10 ++-
.../CBusServerModule.java} | 48 +++++++-----
.../server/cbus/protocol/CBusServerAdapter.java | 89 ++++++++++++++++++++++
.../plc4x/simulator/server/s7/S7ServerModule.java | 20 +++--
.../server/s7/protocol/S7Step7ServerAdapter.java | 2 -
.../org.apache.plc4x.simulator.server.ServerModule | 3 +-
11 files changed, 221 insertions(+), 61 deletions(-)
diff --git a/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java
index 08736b3a1..e1c2a3556 100644
--- a/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java
+++ b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java
@@ -83,7 +83,6 @@ public class CBusDriver extends GeneratedDriverBase<CBusCommand> {
public static class ByteLengthEstimator implements ToIntFunction<ByteBuf> {
@Override
public int applyAsInt(ByteBuf byteBuf) {
- System.err.println("Alarm" + byteBuf);
// TODO: we might need to try multiple times because the ln might not be here in time
for (int i = 0; i < byteBuf.readableBytes(); i++) {
boolean hasOneMore = i + 1 < byteBuf.readableBytes();
diff --git a/sandbox/plc-simulator/pom.xml b/sandbox/plc-simulator/pom.xml
index abe62a615..fc0c21d0f 100644
--- a/sandbox/plc-simulator/pom.xml
+++ b/sandbox/plc-simulator/pom.xml
@@ -63,6 +63,11 @@
<artifactId>plc4j-driver-s7</artifactId>
<version>0.10.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-driver-c-bus</artifactId>
+ <version>0.10.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
@@ -74,6 +79,11 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ </dependency>
+
<!-- Explicitly override the scope to compile to include these -->
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java
index bbf64648b..43dc0ae27 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulator.java
@@ -18,6 +18,7 @@
*/
package org.apache.plc4x.simulator;
+import org.apache.commons.cli.*;
import org.apache.plc4x.simulator.model.Context;
import org.apache.plc4x.simulator.server.ServerModule;
import org.apache.plc4x.simulator.simulation.SimulationModule;
@@ -37,27 +38,28 @@ public class PlcSimulator {
private final Map<String, ServerModule> serverModules;
private final SimulationModule simulationModule;
- private PlcSimulator(String simulationName) {
- this(simulationName, Thread.currentThread().getContextClassLoader());
+ private PlcSimulator(String simulationName, PlcSimulatorConfig config) {
+ this(simulationName, config, Thread.currentThread().getContextClassLoader());
}
- private PlcSimulator(String simulationName, ClassLoader classLoader) {
+ private PlcSimulator(String simulationName, PlcSimulatorConfig config, ClassLoader classLoader) {
Context context = null;
// Initialize all the simulation modules.
LOGGER.info("Initializing Simulation Modules:");
SimulationModule foundSimulationModule = null;
ServiceLoader<SimulationModule> simulationModuleLoader = ServiceLoader.load(SimulationModule.class, classLoader);
for (SimulationModule curSimulationModule : simulationModuleLoader) {
- if(curSimulationModule.getName().equals(simulationName)) {
- LOGGER.info(String.format("Initializing simulation module: %s ...", simulationName));
- foundSimulationModule = curSimulationModule;
- context = curSimulationModule.getContext();
- LOGGER.info("Initialized");
+ if (!curSimulationModule.getName().equals(simulationName)) {
+ continue;
}
+ LOGGER.info("Initializing simulation module: {} ...", simulationName);
+ foundSimulationModule = curSimulationModule;
+ context = curSimulationModule.getContext();
+ LOGGER.info("Initialized");
}
// If we couldn't find the simulation module provided, report an error and exit.
- if(foundSimulationModule == null) {
- LOGGER.info(String.format("Couldn't find simulation module %s", simulationName));
+ if (foundSimulationModule == null) {
+ LOGGER.info("Couldn't find simulation module {}", simulationName);
System.exit(1);
}
simulationModule = foundSimulationModule;
@@ -68,10 +70,11 @@ public class PlcSimulator {
serverModules = new TreeMap<>();
ServiceLoader<ServerModule> serverModuleLoader = ServiceLoader.load(ServerModule.class, classLoader);
for (ServerModule serverModule : serverModuleLoader) {
- LOGGER.info(String.format("Initializing server module: %s ...", serverModule.getName()));
+ LOGGER.info("Initializing server module: {} ...", serverModule.getName());
serverModules.put(serverModule.getName(), serverModule);
// Inject the contexts.
serverModule.setContext(context);
+ serverModule.setConfig(config);
LOGGER.info("Initialized");
}
LOGGER.info("Finished Initializing Server Modules\n");
@@ -83,13 +86,17 @@ public class PlcSimulator {
running = false;
}
- private void run() throws Exception {
+ private void run() {
// Start all server modules.
LOGGER.info("Starting Server Modules:");
for (ServerModule serverModule : serverModules.values()) {
- LOGGER.info(String.format("Starting server module: %s ...", serverModule.getName()));
- serverModule.start();
- LOGGER.info("Started");
+ LOGGER.info("Starting server module: {}...", serverModule.getName());
+ try {
+ serverModule.start();
+ LOGGER.info("Started");
+ } catch (Exception e) {
+ LOGGER.warn("Error starting server module: {}...", serverModule.getName(), e);
+ }
}
LOGGER.info("Finished Starting Server Modules\n");
@@ -98,30 +105,57 @@ public class PlcSimulator {
while (running) {
try {
simulationModule.loop();
- } catch(Exception e) {
- LOGGER.error("Caught error while executing loop() method of " + simulationModule.getName() +
- " simulation.", e);
+ } catch (Exception e) {
+ LOGGER.error("Caught error while executing loop() method of {} simulation.", simulationModule.getName(), e);
}
// Sleep 100 ms to not run the simulation too eagerly.
- TimeUnit.MILLISECONDS.sleep(100);
+ try {
+ TimeUnit.MILLISECONDS.sleep(100);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new RuntimeException(e);
+ }
}
} finally {
LOGGER.info("Simulations ended");
// Start all server modules.
for (ServerModule serverModule : serverModules.values()) {
- LOGGER.info(String.format("Stopping server module %s ...", serverModule.getName()));
- serverModule.stop();
- LOGGER.info("Stopped");
+ LOGGER.info("Stopping server module {} ...", serverModule.getName());
+ try {
+ serverModule.stop();
+ LOGGER.info("Stopped");
+ } catch (Exception e) {
+ LOGGER.warn("Error stopping server module {} ...", serverModule.getName());
+ }
+
}
}
}
- public static void main(String[] args) throws Exception {
- final PlcSimulator simulator = new PlcSimulator("Water Tank");
+ public static void main(String... args) throws Exception {
+ final PlcSimulator simulator = new PlcSimulator("Water Tank", plcSimulatorConfigFromArgs(args));
// Make sure we stop everything correctly.
Runtime.getRuntime().addShutdownHook(new Thread(simulator::stop));
// Start the simulator.
simulator.run();
}
+ public static PlcSimulatorConfig plcSimulatorConfigFromArgs(String... args) throws Exception {
+ PlcSimulatorConfig config = new PlcSimulatorConfig();
+
+ // Build options
+ Options options = new Options();
+
+ options.addOption("host", true, "display current time");
+
+ // Parse args
+ CommandLineParser parser = new DefaultParser();
+ CommandLine cmd = parser.parse(options, args);
+
+ // Map options
+ config.host = cmd.getOptionValue("--host", "localhost");
+
+ return config;
+ }
+
}
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java
new file mode 100644
index 000000000..ae1b2f7ee
--- /dev/null
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/PlcSimulatorConfig.java
@@ -0,0 +1,9 @@
+package org.apache.plc4x.simulator;
+
+public class PlcSimulatorConfig {
+ String host;
+
+ public String getHost() {
+ return host;
+ }
+}
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/exceptions/SimulatorExcepiton.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/exceptions/SimulatorException.java
similarity index 81%
rename from sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/exceptions/SimulatorExcepiton.java
rename to sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/exceptions/SimulatorException.java
index 6afccbe21..7c2fe63f0 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/exceptions/SimulatorExcepiton.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/exceptions/SimulatorException.java
@@ -18,17 +18,17 @@
*/
package org.apache.plc4x.simulator.exceptions;
-public class SimulatorExcepiton extends Exception {
+public class SimulatorException extends Exception {
- public SimulatorExcepiton(String message) {
+ public SimulatorException(String message) {
super(message);
}
- public SimulatorExcepiton(String message, Throwable cause) {
+ public SimulatorException(String message, Throwable cause) {
super(message, cause);
}
- public SimulatorExcepiton(Throwable cause) {
+ public SimulatorException(Throwable cause) {
super(cause);
}
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/ServerModule.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/ServerModule.java
index a086a8830..eed2e42b0 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/ServerModule.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/ServerModule.java
@@ -18,7 +18,8 @@
*/
package org.apache.plc4x.simulator.server;
-import org.apache.plc4x.simulator.exceptions.SimulatorExcepiton;
+import org.apache.plc4x.simulator.PlcSimulatorConfig;
+import org.apache.plc4x.simulator.exceptions.SimulatorException;
import org.apache.plc4x.simulator.model.Context;
public interface ServerModule {
@@ -28,10 +29,11 @@ public interface ServerModule {
*/
String getName();
- void setContext(Context contexts);
+ void setConfig(PlcSimulatorConfig config);
- void start() throws SimulatorExcepiton;
+ void setContext(Context contexts);
- void stop() throws SimulatorExcepiton;
+ void start() throws SimulatorException;
+ void stop() throws SimulatorException;
}
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/S7ServerModule.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
similarity index 64%
copy from sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/S7ServerModule.java
copy to sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
index 189fa3f3a..605d129cb 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/S7ServerModule.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.simulator.server.s7;
+package org.apache.plc4x.simulator.server.cbus;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelInitializer;
@@ -26,26 +26,34 @@ import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
-import org.apache.plc4x.java.s7.readwrite.S7Driver;
-import org.apache.plc4x.java.s7.readwrite.TPKTPacket;
+import org.apache.plc4x.java.cbus.CBusDriver;
+import org.apache.plc4x.java.cbus.readwrite.CBusConstants;
+import org.apache.plc4x.java.cbus.readwrite.CBusMessage;
+import org.apache.plc4x.java.cbus.readwrite.CBusOptions;
+import org.apache.plc4x.java.cbus.readwrite.RequestContext;
import org.apache.plc4x.java.spi.connection.GeneratedProtocolMessageCodec;
import org.apache.plc4x.java.spi.generation.ByteOrder;
-import org.apache.plc4x.simulator.exceptions.SimulatorExcepiton;
+import org.apache.plc4x.simulator.PlcSimulatorConfig;
+import org.apache.plc4x.simulator.exceptions.SimulatorException;
import org.apache.plc4x.simulator.model.Context;
import org.apache.plc4x.simulator.server.ServerModule;
-import org.apache.plc4x.simulator.server.s7.protocol.S7Step7ServerAdapter;
+import org.apache.plc4x.simulator.server.cbus.protocol.CBusServerAdapter;
-public class S7ServerModule implements ServerModule {
-
- private static final int ISO_ON_TCP_PORT = 102;
+public class CBusServerModule implements ServerModule {
private EventLoopGroup loopGroup;
private EventLoopGroup workerGroup;
private Context context;
+ private PlcSimulatorConfig config;
@Override
public String getName() {
- return "S7-STEP7";
+ return "C-BUS";
+ }
+
+ @Override
+ public void setConfig(PlcSimulatorConfig config) {
+ this.config = config;
}
@Override
@@ -53,9 +61,10 @@ public class S7ServerModule implements ServerModule {
this.context = context;
}
+
@Override
- public void start() throws SimulatorExcepiton {
- if(loopGroup != null) {
+ public void start() throws SimulatorException {
+ if (loopGroup != null) {
return;
}
@@ -70,25 +79,26 @@ public class S7ServerModule implements ServerModule {
@Override
public void initChannel(SocketChannel channel) {
ChannelPipeline pipeline = channel.pipeline();
- pipeline.addLast(new GeneratedProtocolMessageCodec<>(TPKTPacket.class,
- TPKTPacket::staticParse, ByteOrder.BIG_ENDIAN, null,
- new S7Driver.ByteLengthEstimator(),
- new S7Driver.CorruptPackageCleaner()));
- pipeline.addLast(new S7Step7ServerAdapter(context));
+ pipeline.addLast(new GeneratedProtocolMessageCodec<>(CBusMessage.class,
+ CBusMessage::staticParse, ByteOrder.BIG_ENDIAN,
+ new Object[]{false, new RequestContext(false, false, false), new CBusOptions(false, false, false, false, false, false, false, false, false)},
+ new CBusDriver.ByteLengthEstimator(),
+ new CBusDriver.CorruptPackageCleaner()));
+ pipeline.addLast(new CBusServerAdapter(context));
}
}).option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true);
- bootstrap.bind(ISO_ON_TCP_PORT).sync();
+ bootstrap.bind(config.getHost(), CBusConstants.CBUSTCPDEFAULTPORT).sync();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- throw new SimulatorExcepiton(e);
+ throw new SimulatorException(e);
}
}
@Override
public void stop() {
- if(workerGroup == null) {
+ if (workerGroup == null) {
return;
}
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
new file mode 100644
index 000000000..87c73d19f
--- /dev/null
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.plc4x.simulator.server.cbus.protocol;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import org.apache.plc4x.java.cbus.readwrite.*;
+import org.apache.plc4x.simulator.model.Context;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CBusServerAdapter.class);
+
+ private Context context;
+
+ private static final RequestContext requestContext = new RequestContext(false, false, false);
+ private static final CBusOptions cBusOptions = new CBusOptions(false, false, false, false, false, false, false, false, false);
+
+ public CBusServerAdapter(Context context) {
+ this.context = context;
+ }
+
+ @Override
+ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+ if (!(msg instanceof CBusMessage)) {
+ return;
+ }
+ CBusMessage packet = (CBusMessage) msg;
+ if (packet instanceof CBusMessageToClient) {
+ LOGGER.info("Message to client not supported\n{}", packet);
+ return;
+ }
+ CBusMessageToServer cBusMessageToServer = (CBusMessageToServer) packet;
+ Request request = cBusMessageToServer.getRequest();
+ if (request instanceof RequestEmpty || request instanceof RequestNull) {
+ LOGGER.debug("Ignoring\n{}", request);
+ return;
+ }
+ if (request instanceof RequestDirectCommandAccess) {
+ RequestDirectCommandAccess requestDirectCommandAccess = (RequestDirectCommandAccess) request;
+ // TODO: handle this
+ return;
+ }
+ if (request instanceof RequestCommand) {
+ RequestCommand requestCommand = (RequestCommand) request;
+ // TODO: handle this
+ Alpha alpha = requestCommand.getAlpha();
+ if (alpha != null) {
+ Confirmation confirmation = new Confirmation(alpha, null, ConfirmationType.CONFIRMATION_SUCCESSFUL);
+ ReplyOrConfirmationConfirmation replyOrConfirmationConfirmation = new ReplyOrConfirmationConfirmation(alpha.getCharacter(), confirmation, null, cBusOptions, requestContext);
+ CBusMessage response = new CBusMessageToClient(replyOrConfirmationConfirmation, requestContext, cBusOptions);
+ ctx.writeAndFlush(response);
+ }
+ return;
+ }
+ if (request instanceof RequestObsolete) {
+ RequestObsolete requestObsolete = (RequestObsolete) request;
+ // TODO: handle this
+ return;
+ }
+ if (request instanceof RequestReset) {
+ // TODO: handle this
+ return;
+ }
+ if (request instanceof RequestSmartConnectShortcut) {
+ // TODO: handle this
+ return;
+ }
+ }
+
+}
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/S7ServerModule.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/S7ServerModule.java
index 189fa3f3a..c57646521 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/S7ServerModule.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/S7ServerModule.java
@@ -26,11 +26,12 @@ import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
+import org.apache.plc4x.simulator.PlcSimulatorConfig;
import org.apache.plc4x.java.s7.readwrite.S7Driver;
import org.apache.plc4x.java.s7.readwrite.TPKTPacket;
import org.apache.plc4x.java.spi.connection.GeneratedProtocolMessageCodec;
import org.apache.plc4x.java.spi.generation.ByteOrder;
-import org.apache.plc4x.simulator.exceptions.SimulatorExcepiton;
+import org.apache.plc4x.simulator.exceptions.SimulatorException;
import org.apache.plc4x.simulator.model.Context;
import org.apache.plc4x.simulator.server.ServerModule;
import org.apache.plc4x.simulator.server.s7.protocol.S7Step7ServerAdapter;
@@ -42,20 +43,27 @@ public class S7ServerModule implements ServerModule {
private EventLoopGroup loopGroup;
private EventLoopGroup workerGroup;
private Context context;
+ private PlcSimulatorConfig config;
@Override
public String getName() {
return "S7-STEP7";
}
+ @Override
+ public void setConfig(PlcSimulatorConfig config) {
+ this.config = config;
+ }
+
@Override
public void setContext(Context context) {
this.context = context;
}
+
@Override
- public void start() throws SimulatorExcepiton {
- if(loopGroup != null) {
+ public void start() throws SimulatorException {
+ if (loopGroup != null) {
return;
}
@@ -79,16 +87,16 @@ public class S7ServerModule implements ServerModule {
}).option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true);
- bootstrap.bind(ISO_ON_TCP_PORT).sync();
+ bootstrap.bind(config.getHost(),ISO_ON_TCP_PORT).sync();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- throw new SimulatorExcepiton(e);
+ throw new SimulatorException(e);
}
}
@Override
public void stop() {
- if(workerGroup == null) {
+ if (workerGroup == null) {
return;
}
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7ServerAdapter.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7ServerAdapter.java
index a2deb26d2..3665a0d3b 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7ServerAdapter.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7ServerAdapter.java
@@ -20,12 +20,10 @@ package org.apache.plc4x.simulator.server.s7.protocol;
import io.netty.channel.*;
import org.apache.plc4x.java.s7.readwrite.*;
-import org.apache.plc4x.java.s7.readwrite.types.*;
import org.apache.plc4x.simulator.model.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
diff --git a/sandbox/plc-simulator/src/main/resources/META-INF/services/org.apache.plc4x.simulator.server.ServerModule b/sandbox/plc-simulator/src/main/resources/META-INF/services/org.apache.plc4x.simulator.server.ServerModule
index 4276d39ea..0e2c7422e 100644
--- a/sandbox/plc-simulator/src/main/resources/META-INF/services/org.apache.plc4x.simulator.server.ServerModule
+++ b/sandbox/plc-simulator/src/main/resources/META-INF/services/org.apache.plc4x.simulator.server.ServerModule
@@ -16,4 +16,5 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.plc4x.simulator.server.s7.S7ServerModule
\ No newline at end of file
+org.apache.plc4x.simulator.server.s7.S7ServerModule
+org.apache.plc4x.simulator.server.cbus.CBusServerModule
\ No newline at end of file