You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/01/20 22:25:32 UTC
[plc4x] branch develop updated: - Renamed and rearranged the output
fields. - Cleaned up some obsolete packages in the sandbox.
This is an automated email from the ASF dual-hosted git repository.
cdutz 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 5d72fe4 - Renamed and rearranged the output fields. - Cleaned up some obsolete packages in the sandbox.
5d72fe4 is described below
commit 5d72fe44f0470f1c3bec604c7fff331875fd5b97
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Jan 20 23:25:26 2020 +0100
- Renamed and rearranged the output fields.
- Cleaned up some obsolete packages in the sandbox.
---
.../annotations/defaults/LongDefaultValue.java | 33 ++
pom.xml | 5 +
sandbox/pom.xml | 7 -
sandbox/test-java-knxnetip-driver-passive/pom.xml | 108 ----
.../passive/knxnetip/PassiveKnxNetIpDriver.java | 76 ---
.../knxnetip/connection/KnxNetIpFieldHandler.java | 36 --
.../connection/PassiveKnxNetIpPlcConnection.java | 116 -----
.../java/passive/knxnetip/model/KnxNetIpField.java | 47 --
.../knxnetip/protocol/HelloWorldProtocol.java | 72 ---
.../knxnetip/protocol/KnxNetIpProtocolMessage.java | 59 ---
.../services/org.apache.plc4x.java.api.PlcDriver | 19 -
.../org/apache/plc4x/java/knxnetip/IOTest.java | 76 ---
.../apache/plc4x/java/knxnetip/KNXNetIpTest.java | 30 --
.../apache/plc4x/java/knxnetip/ManualKnxNetIp.java | 27 -
.../test/resources/testsuite/KNXNetIPTestsuite.xml | 544 ---------------------
sandbox/test-java-knxnetip-driver/pom.xml | 10 +-
.../plc4x/java/knxnetip/ets5/Ets5Parser.java | 0
.../java/knxnetip/ets5/model/AddressType.java | 0
.../plc4x/java/knxnetip/ets5/model/Ets5Model.java | 0
.../plc4x/java/knxnetip/ets5/model/Function.java | 0
.../java/knxnetip/ets5/model/GroupAddress.java | 0
sandbox/test-java-knxnetip-shared/pom.xml | 51 --
sandbox/test-java-s7-driver-passive/pom.xml | 101 ----
.../apache/plc4x/java/s7/utils/StaticHelper.java | 136 ------
.../plc4x/javapassive/s7/PassiveS7PlcDriver.java | 90 ----
.../s7/connection/PassiveS7PlcConnection.java | 99 ----
.../s7/protocol/HelloWorldProtocol.java | 48 --
.../javapassive/s7/protocol/PassiveS7Protocol.java | 62 ---
.../services/org.apache.plc4x.java.api.PlcDriver | 19 -
.../src/test/java/BenchmarkGeneratedPassiveS7.java | 45 --
30 files changed, 42 insertions(+), 1874 deletions(-)
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/configuration/annotations/defaults/LongDefaultValue.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/configuration/annotations/defaults/LongDefaultValue.java
new file mode 100644
index 0000000..7769d2c
--- /dev/null
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/configuration/annotations/defaults/LongDefaultValue.java
@@ -0,0 +1,33 @@
+/*
+ * 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
+ *
+ * http://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.java.spi.configuration.annotations.defaults;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LongDefaultValue {
+
+ long value();
+
+}
diff --git a/pom.xml b/pom.xml
index 3095022..decd464 100644
--- a/pom.xml
+++ b/pom.xml
@@ -289,6 +289,11 @@
<version>${commons-codec.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.19</version>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
diff --git a/sandbox/pom.xml b/sandbox/pom.xml
index 20b0e85..2fe754a 100644
--- a/sandbox/pom.xml
+++ b/sandbox/pom.xml
@@ -40,17 +40,10 @@
<module>test-java-amsads-driver</module>
<module>test-java-bacnetip-driver</module>
-
<module>test-java-df1-driver</module>
-
<module>test-java-knxnetip-driver</module>
- <!--module>test-java-knxnetip-driver-passive</module-->
- <module>test-java-knxnetip-shared</module>
-
<module>test-java-modbus-driver</module>
-
<module>test-java-s7-driver</module>
- <!--module>test-java-s7-driver-passive</module-->
<module>test-streampipes-plc4x-adapters</module>
<module>test-streampipes-plc4x-processors</module>
diff --git a/sandbox/test-java-knxnetip-driver-passive/pom.xml b/sandbox/test-java-knxnetip-driver-passive/pom.xml
deleted file mode 100644
index 843511d..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
-
- http://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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.plc4x.sandbox</groupId>
- <artifactId>plc4x-sandbox</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>test-java-knxnetip-driver-passive</artifactId>
-
- <name>Sandbox: Test Generated KNXNet/IP Driver (Passive)</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.plc4x.plugins</groupId>
- <artifactId>plc4x-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>test</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>generate-driver</goal>
- </goals>
- <configuration>
- <protocolName>knxnetip</protocolName>
- <languageName>java</languageName>
- <outputFlavor>passive</outputFlavor>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-api</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-transport-raw-socket</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-raw-sockets</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-test-utils</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-build-utils-language-java</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <!-- Scope is 'provided' as this way it's not shipped with the driver -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-protocols-knxnetip</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <!-- Scope is 'provided' as this way it's not shipped with the driver -->
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/PassiveKnxNetIpDriver.java b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/PassiveKnxNetIpDriver.java
deleted file mode 100644
index 7e85822..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/PassiveKnxNetIpDriver.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-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
-
- http://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.java.passive.knxnetip;
-
-import org.apache.plc4x.java.api.PlcConnection;
-import org.apache.plc4x.java.api.authentication.PlcAuthentication;
-import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
-import org.apache.plc4x.java.passive.knxnetip.connection.PassiveKnxNetIpPlcConnection;
-import org.apache.plc4x.java.passive.knxnetip.protocol.HelloWorldProtocol;
-import org.apache.plc4x.java.api.PlcDriver;
-import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketIpAddress;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static org.apache.plc4x.java.utils.rawsockets.netty.RawSocketAddress.ALL_PROTOCOLS;
-
-public class PassiveKnxNetIpDriver implements PlcDriver {
-
- public static final int KNXNET_IP_PORT = 3671;
-
- private static final Pattern PASSIVE_KNXNET_IP_URI_PATTERN =
- Pattern.compile("^knxnet-ip-passive://(?<networkDevice>.*)(?<params>\\?.*)?");
-
- @Override
- public String getProtocolCode() {
- return "knxnet-ip-passive";
- }
-
- @Override
- public String getProtocolName() {
- return "KNXNet/IP (Passive)";
- }
-
- @Override
- public PlcConnection connect(String url) throws PlcConnectionException {
- Matcher matcher = PASSIVE_KNXNET_IP_URI_PATTERN.matcher(url);
- if (!matcher.matches()) {
- throw new PlcConnectionException(
- "Connection url doesn't match the format 'knxnet-ip-passive://{host|ip}'");
- }
- String networkDevice = matcher.group("networkDevice");
-
- String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null;
-
- try {
- RawSocketIpAddress rawSocketAddress = new RawSocketIpAddress(
- networkDevice, ALL_PROTOCOLS, null, KNXNET_IP_PORT);
- return new PassiveKnxNetIpPlcConnection(rawSocketAddress, params, new HelloWorldProtocol());
- } catch (Exception e) {
- throw new PlcConnectionException("Error connecting to host", e);
- }
- }
-
- @Override
- public PlcConnection connect(String url, PlcAuthentication authentication) throws PlcConnectionException {
- throw new PlcConnectionException("KNXNet/IP connections don't support authentication.");
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/connection/KnxNetIpFieldHandler.java b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/connection/KnxNetIpFieldHandler.java
deleted file mode 100644
index 891bb89..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/connection/KnxNetIpFieldHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-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
-
- http://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.java.passive.knxnetip.connection;
-
-import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
-import org.apache.plc4x.java.api.model.PlcField;
-import org.apache.plc4x.java.spi.connection.DefaultPlcFieldHandler;
-import org.apache.plc4x.java.passive.knxnetip.model.KnxNetIpField;
-
-public class KnxNetIpFieldHandler extends DefaultPlcFieldHandler {
-
- @Override
- public PlcField createField(String fieldQuery) throws PlcInvalidFieldException {
- if (KnxNetIpField.matches(fieldQuery)) {
- return KnxNetIpField.of(fieldQuery);
- }
- throw new PlcInvalidFieldException(fieldQuery);
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/connection/PassiveKnxNetIpPlcConnection.java b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/connection/PassiveKnxNetIpPlcConnection.java
deleted file mode 100644
index 0e0ecd8..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/connection/PassiveKnxNetIpPlcConnection.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-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
-
- http://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.java.passive.knxnetip.connection;
-
-import io.netty.channel.*;
-import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
-import org.apache.plc4x.java.api.messages.PlcReadRequest;
-import org.apache.plc4x.java.api.messages.PlcReadResponse;
-import org.apache.plc4x.java.api.model.PlcField;
-import org.apache.plc4x.java.transport.rawsocket.RawSocketChannelFactory;
-import org.apache.plc4x.java.spi.connection.ChannelFactory;
-import org.apache.plc4x.java.spi.connection.NettyPlcConnection;
-import org.apache.plc4x.java.spi.events.ConnectedEvent;
-import org.apache.plc4x.java.passive.knxnetip.model.KnxNetIpField;
-import org.apache.plc4x.java.passive.knxnetip.protocol.KnxNetIpProtocolMessage;
-import org.apache.plc4x.java.spi.messages.*;
-import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketAddress;
-import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketIpAddress;
-import org.apache.plc4x.java.utils.rawsockets.netty.UdpIpPacketHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.CompletableFuture;
-
-public class PassiveKnxNetIpPlcConnection extends NettyPlcConnection implements PlcReader {
-
- private static final Logger logger = LoggerFactory.getLogger(PassiveKnxNetIpPlcConnection.class);
-
- private final ChannelHandler handler;
-
- public PassiveKnxNetIpPlcConnection(RawSocketIpAddress address, String params, ChannelHandler handler) {
- this(new RawSocketChannelFactory(address.getDeviceName(), null,
- address.getPort(), RawSocketAddress.ALL_PROTOCOLS, new UdpIpPacketHandler()), params, handler);
- }
-
- public PassiveKnxNetIpPlcConnection(ChannelFactory channelFactory, String params, ChannelHandler handler) {
- super(channelFactory, true);
- this.handler = handler;
- }
-
- @Override
- protected void sendChannelCreatedEvent() {
- // As this type of protocol doesn't require any form of connection, we just send the connected event.
- channel.pipeline().fireUserEventTriggered(new ConnectedEvent());
- }
-
- @Override
- public PlcField prepareField(String fieldQuery) throws PlcInvalidFieldException {
- return KnxNetIpField.of(fieldQuery);
- }
-
- @Override
- protected ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
- return new ChannelInitializer<Channel>() {
- @Override
- protected void initChannel(Channel channel) {
- // Build the protocol stack for communicating with the s7 protocol.
- ChannelPipeline pipeline = channel.pipeline();
- pipeline.addLast(new ChannelInboundHandlerAdapter() {
- @Override
- public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
- if (evt instanceof ConnectedEvent) {
- sessionSetupCompleteFuture.complete(null);
- } else {
- super.userEventTriggered(ctx, evt);
- }
- }
- });
- pipeline.addLast(new KnxNetIpProtocolMessage());
- pipeline.addLast(handler);
- }
- };
- }
-
- @Override
- public boolean canRead() {
- return true;
- }
-
- @Override
- public PlcReadRequest.Builder readRequestBuilder() {
- return new DefaultPlcReadRequest.Builder(this, new KnxNetIpFieldHandler());
- }
-
- @Override
- public CompletableFuture<PlcReadResponse> read(PlcReadRequest readRequest) {
- InternalPlcReadRequest internalReadRequest = checkInternal(readRequest, InternalPlcReadRequest.class);
- CompletableFuture<InternalPlcReadResponse> future = new CompletableFuture<>();
- PlcRequestContainer<InternalPlcReadRequest, InternalPlcReadResponse> container =
- new PlcRequestContainer<>(internalReadRequest, future);
- channel.writeAndFlush(container).addListener(f -> {
- if (!f.isSuccess()) {
- future.completeExceptionally(f.cause());
- }
- });
- return future
- .thenApply(PlcReadResponse.class::cast);
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/model/KnxNetIpField.java b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/model/KnxNetIpField.java
deleted file mode 100644
index b7e45a5..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/model/KnxNetIpField.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-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
-
- http://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.java.passive.knxnetip.model;
-
-import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
-import org.apache.plc4x.java.api.model.PlcField;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class KnxNetIpField implements PlcField {
-
- private static final Pattern ADDRESS_PATTERN =
- Pattern.compile("^N(?<fileNumber>\\d{1,7}):(?<elementNumber>\\d{1,7})(/(?<bitNumber>\\d{1,7}))?:(?<dataType>[a-zA-Z_]+)(\\[(?<size>\\d+)])?");
-
- public KnxNetIpField() {
- }
-
- public static boolean matches(String fieldString) {
- return ADDRESS_PATTERN.matcher(fieldString).matches();
- }
-
- public static KnxNetIpField of(String fieldString) {
- Matcher matcher = ADDRESS_PATTERN.matcher(fieldString);
- if(matcher.matches()) {
- return new KnxNetIpField();
- }
- throw new PlcInvalidFieldException("Unable to parse address: " + fieldString);
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/HelloWorldProtocol.java b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/HelloWorldProtocol.java
deleted file mode 100644
index 1930dd1..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/HelloWorldProtocol.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-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
-
- http://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.java.passive.knxnetip.protocol;
-
-import io.netty.channel.ChannelHandlerContext;
-import org.apache.plc4x.java.spi.PlcMessageToMessageCodec;
-import org.apache.plc4x.java.spi.messages.PlcRequestContainer;
-import org.apache.plc4x.java.knxnetip.passive.KNXNetIPMessage;
-
-import java.util.List;
-
-public class HelloWorldProtocol extends PlcMessageToMessageCodec<KNXNetIPMessage, PlcRequestContainer> {
-
- private int packetCount = 0;
- private long startTime = -1;
-
- @Override
- protected void encode(ChannelHandlerContext channelHandlerContext, PlcRequestContainer plcRequestContainer, List<Object> list) throws Exception {
- System.out.println(plcRequestContainer);
- }
-
- @Override
- protected void decode(ChannelHandlerContext channelHandlerContext, KNXNetIPMessage packet, List<Object> list) throws Exception {
- if(startTime == -1) {
- startTime = System.currentTimeMillis();
- }
- packetCount++;
- if(packetCount % 10000 == 0) {
- long curTime = System.currentTimeMillis();
- System.out.println("Read " + packetCount + " packets in " + (curTime - startTime) + "ms");
- }
-/* if(packet instanceof BVLCOriginalUnicastNPDU) {
- final NPDU npdu = ((BVLCOriginalUnicastNPDU) packet).getNpdu();
- final APDU apdu = npdu.getApdu();
- if(apdu instanceof APDUSimpleAck) {
- APDUSimpleAck ack = (APDUSimpleAck) apdu;
- System.out.println("Simple-ACK(" + ack.getOriginalInvokeId() + ")");
- } else if(apdu instanceof APDUConfirmedRequest) {
- APDUConfirmedRequest request = (APDUConfirmedRequest) apdu;
- final BACnetConfirmedServiceRequest serviceRequest = request.getServiceRequest();
- if(serviceRequest instanceof BACnetConfirmedServiceRequestConfirmedCOVNotification) {
- BACnetConfirmedServiceRequestConfirmedCOVNotification covNotification = (BACnetConfirmedServiceRequestConfirmedCOVNotification) serviceRequest;
- final BACnetTagWithContent[] notifications = covNotification.getNotifications();
- System.out.println("Simple-ACK(" + request.getInvokeId() + "): Confirmed COV Notification [" + notifications.length + "]");
- } else {
- System.out.println("Simple-ACK(" + request.getInvokeId() + "): Other");
- }
- } else {
- System.out.println("Other");
- }
- } else {
- System.out.println("Other");
- }*/
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/KnxNetIpProtocolMessage.java b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/KnxNetIpProtocolMessage.java
deleted file mode 100644
index b0ae72b..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/KnxNetIpProtocolMessage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-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
-
- http://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.java.passive.knxnetip.protocol;
-
-import io.netty.buffer.ByteBuf;
-import org.apache.plc4x.java.knxnetip.passive.KNXNetIPMessage;
-import org.apache.plc4x.java.knxnetip.passive.io.KNXNetIPMessageIO;
-import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
-import org.apache.plc4x.java.spi.generation.MessageIO;
-import org.apache.plc4x.java.spi.generation.ParseException;
-import org.apache.plc4x.java.spi.generation.ReadBuffer;
-import org.apache.plc4x.java.spi.generation.WriteBuffer;
-
-public class KnxNetIpProtocolMessage extends GeneratedDriverByteToMessageCodec<KNXNetIPMessage> {
-
- public KnxNetIpProtocolMessage() {
- super(new MessageIO<KNXNetIPMessage, KNXNetIPMessage>() {
- @Override
- public KNXNetIPMessage parse(ReadBuffer io) throws ParseException {
- return KNXNetIPMessageIO.parse(io);
- }
-
- @Override
- public void serialize(WriteBuffer io, KNXNetIPMessage value) throws ParseException {
- // Ignore.
- }
- }, KNXNetIPMessage.class);
- }
-
- @Override
- protected int getPacketSize(ByteBuf byteBuf) {
- if(byteBuf.readableBytes() >= 6) {
- return byteBuf.getUnsignedShort(byteBuf.readerIndex() + 4);
- }
- return -1;
- }
-
- @Override
- protected void removeRestOfCorruptPackage(ByteBuf byteBuf) {
- // Not really any marker byte to look for.
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver b/sandbox/test-java-knxnetip-driver-passive/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
deleted file mode 100644
index 087e7e6..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# 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
-#
-# http://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.
-#
-org.apache.plc4x.java.passive.knxnetip.PassiveKnxNetIpDriver
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java b/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
deleted file mode 100644
index 231a929..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- 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
-
- http://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.java.knxnetip;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-import org.apache.commons.codec.binary.Hex;
-import org.apache.plc4x.java.knxnetip.passive.KNXNetIPMessage;
-import org.apache.plc4x.java.knxnetip.passive.io.KNXNetIPMessageIO;
-import org.apache.plc4x.java.spi.generation.ReadBuffer;
-import org.junit.jupiter.api.Test;
-
-public class IOTest {
-
- @Test
- public void testXml() throws Exception {
- byte[] rData = Hex.decodeHex("06100420001c046b00002b0703010504024502bc360a1e0ce100810d");
- ObjectMapper mapper = new XmlMapper().enableDefaultTyping();
- ReadBuffer rBuf = new ReadBuffer(rData);
- KNXNetIPMessage packet = new KNXNetIPMessageIO().parse(rBuf);
- String xml = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(packet);
- System.out.println(xml);
- KNXNetIPMessage pack2 = mapper.readValue(xml, KNXNetIPMessage.class);
- System.out.println(pack2);
- }
-
- @Test
- public void testJson() throws Exception {
- byte[] rData = Hex.decodeHex("0610020500180801c0a82a46c4090801c0a82a46c40a0203");
- ObjectMapper mapper = new ObjectMapper().enableDefaultTyping();
- ReadBuffer rBuf = new ReadBuffer(rData);
- KNXNetIPMessage packet = new KNXNetIPMessageIO().parse(rBuf);
- String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(packet);
- System.out.println(json);
- KNXNetIPMessage pack2 = mapper.readValue(json, KNXNetIPMessage.class);
- System.out.println(pack2);
- }
-
- @Test
- public void testParser() throws Exception {
- byte[] rData = Hex.decodeHex("0610020500180801c0a82a46c4090801c0a82a46c40a0203");
- long start = System.currentTimeMillis();
- int numRunsParse = 20000;
-
- KNXNetIPMessageIO knxNetIPMessageIO = new KNXNetIPMessageIO();
-
- // Benchmark the parsing code
- KNXNetIPMessage packet = null;
- for(int i = 0; i < numRunsParse; i++) {
- ReadBuffer rBuf = new ReadBuffer(rData);
- packet = KNXNetIPMessageIO.parse(rBuf);
- }
- long endParsing = System.currentTimeMillis();
-
- System.out.println("Parsed " + numRunsParse + " packets in " + (endParsing - start) + "ms");
- System.out.println("That's " + ((float) (endParsing - start) / numRunsParse) + "ms per packet");
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTest.java b/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTest.java
deleted file mode 100644
index b968eeb..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- 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
-
- http://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.java.knxnetip;
-
-import org.apache.plc4x.protocol.test.ProtocolTestsuiteRunner;
-
-public class KNXNetIpTest extends ProtocolTestsuiteRunner {
-
- public KNXNetIpTest() {
- super("/testsuite/KNXNetIPTestsuite.xml");
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/ManualKnxNetIp.java b/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/ManualKnxNetIp.java
deleted file mode 100644
index bc8253b..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/ManualKnxNetIp.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-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
-
- http://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.java.knxnetip;
-
-public class ManualKnxNetIp {
-
- public static void main(String[] args) {
-
- }
-
-}
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/test/resources/testsuite/KNXNetIPTestsuite.xml b/sandbox/test-java-knxnetip-driver-passive/src/test/resources/testsuite/KNXNetIPTestsuite.xml
deleted file mode 100644
index 10fb85c..0000000
--- a/sandbox/test-java-knxnetip-driver-passive/src/test/resources/testsuite/KNXNetIPTestsuite.xml
+++ /dev/null
@@ -1,544 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
-
- http://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.
- -->
-<test:testsuite xmlns:test="https://plc4x.apache.org/schemas/testsuite.xsd">
-
- <name>KNXNet/IP</name>
-
- <testcase>
- <name>Search Request</name>
- <raw>06100201000e0801c0a82a46ef8e</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <SearchRequest className="org.apache.plc4x.java.knxnetip.readwrite.SearchRequest">
- <hpaiIDiscoveryEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>70</addr>
- </addr>
- </ipAddress>
- <ipPort>61326</ipPort>
- </hpaiIDiscoveryEndpoint>
- </SearchRequest>
- </xml>
- </testcase>
-
- <testcase>
- <name>Search Response</name>
- <raw>06100202004c0801c0a82a0b0e5736010200ffff000000082d409852e000170c000ab327553647697261204b4e582f49502d5363686e6974747374656c6c6500000000000802020103010401</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <SearchResponse className="org.apache.plc4x.java.knxnetip.readwrite.SearchResponse">
- <hpaiControlEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>11</addr>
- </addr>
- </ipAddress>
- <ipPort>3671</ipPort>
- </hpaiControlEndpoint>
- <dibDeviceInfo>
- <descriptionType>1</descriptionType>
- <knxMedium>2</knxMedium>
- <deviceStatus>
- <programMode>false</programMode>
- </deviceStatus>
- <knxAddress>
- <mainGroup>15</mainGroup>
- <middleGroup>15</middleGroup>
- <subGroup>255</subGroup>
- </knxAddress>
- <projectInstallationIdentifier>
- <projectNumber>0</projectNumber>
- <installationNumber>0</installationNumber>
- </projectInstallationIdentifier>
- <knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>0</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>8</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>45</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>64</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>152</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>82</knxNetIpDeviceSerialNumber>
- </knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceMulticastAddress>
- <addr>
- <addr>224</addr>
- <addr>0</addr>
- <addr>23</addr>
- <addr>12</addr>
- </addr>
- </knxNetIpDeviceMulticastAddress>
- <knxNetIpDeviceMacAddress>
- <addr>
- <addr>0</addr>
- <addr>10</addr>
- <addr>179</addr>
- <addr>39</addr>
- <addr>85</addr>
- <addr>54</addr>
- </addr>
- </knxNetIpDeviceMacAddress>
- <deviceFriendlyName>
- <deviceFriendlyName>71</deviceFriendlyName>
- <deviceFriendlyName>105</deviceFriendlyName>
- <deviceFriendlyName>114</deviceFriendlyName>
- <deviceFriendlyName>97</deviceFriendlyName>
- <deviceFriendlyName>32</deviceFriendlyName>
- <deviceFriendlyName>75</deviceFriendlyName>
- <deviceFriendlyName>78</deviceFriendlyName>
- <deviceFriendlyName>88</deviceFriendlyName>
- <deviceFriendlyName>47</deviceFriendlyName>
- <deviceFriendlyName>73</deviceFriendlyName>
- <deviceFriendlyName>80</deviceFriendlyName>
- <deviceFriendlyName>45</deviceFriendlyName>
- <deviceFriendlyName>83</deviceFriendlyName>
- <deviceFriendlyName>99</deviceFriendlyName>
- <deviceFriendlyName>104</deviceFriendlyName>
- <deviceFriendlyName>110</deviceFriendlyName>
- <deviceFriendlyName>105</deviceFriendlyName>
- <deviceFriendlyName>116</deviceFriendlyName>
- <deviceFriendlyName>116</deviceFriendlyName>
- <deviceFriendlyName>115</deviceFriendlyName>
- <deviceFriendlyName>116</deviceFriendlyName>
- <deviceFriendlyName>101</deviceFriendlyName>
- <deviceFriendlyName>108</deviceFriendlyName>
- <deviceFriendlyName>108</deviceFriendlyName>
- <deviceFriendlyName>101</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- </deviceFriendlyName>
- </dibDeviceInfo>
- <dibSuppSvcFamilies>
- <descriptionType>2</descriptionType>
- <serviceIds>
- <serviceIds className="org.apache.plc4x.java.knxnetip.readwrite.KnxNetIpCore">
- <version>1</version>
- </serviceIds>
- <serviceIds className="org.apache.plc4x.java.knxnetip.readwrite.KnxNetIpDeviceManagement">
- <version>1</version>
- </serviceIds>
- <serviceIds className="org.apache.plc4x.java.knxnetip.readwrite.KnxNetIpTunneling">
- <version>1</version>
- </serviceIds>
- </serviceIds>
- </dibSuppSvcFamilies>
- </SearchResponse>
- </xml>
- </testcase>
-
- <testcase>
- <name>Description Request</name>
- <raw>06100203000e0801000000000000</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <DescriptionRequest className="org.apache.plc4x.java.knxnetip.readwrite.DescriptionRequest">
- <hpaiControlEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>0</addr>
- <addr>0</addr>
- <addr>0</addr>
- <addr>0</addr>
- </addr>
- </ipAddress>
- <ipPort>0</ipPort>
- </hpaiControlEndpoint>
- </DescriptionRequest>
- </xml>
- </testcase>
-
- <testcase>
- <name>Description Response</name>
- <raw>06100204004436010200ffff000000082d409852e000170c000ab327553647697261204b4e582f49502d5363686e6974747374656c6c6500000000000802020103010401</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <DescriptionResponse className="org.apache.plc4x.java.knxnetip.readwrite.DescriptionResponse">
- <dibDeviceInfo>
- <descriptionType>1</descriptionType>
- <knxMedium>2</knxMedium>
- <deviceStatus>
- <programMode>false</programMode>
- </deviceStatus>
- <knxAddress>
- <mainGroup>15</mainGroup>
- <middleGroup>15</middleGroup>
- <subGroup>255</subGroup>
- </knxAddress>
- <projectInstallationIdentifier>
- <projectNumber>0</projectNumber>
- <installationNumber>0</installationNumber>
- </projectInstallationIdentifier>
- <knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>0</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>8</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>45</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>64</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>152</knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceSerialNumber>82</knxNetIpDeviceSerialNumber>
- </knxNetIpDeviceSerialNumber>
- <knxNetIpDeviceMulticastAddress>
- <addr>
- <addr>224</addr>
- <addr>0</addr>
- <addr>23</addr>
- <addr>12</addr>
- </addr>
- </knxNetIpDeviceMulticastAddress>
- <knxNetIpDeviceMacAddress>
- <addr>
- <addr>0</addr>
- <addr>10</addr>
- <addr>179</addr>
- <addr>39</addr>
- <addr>85</addr>
- <addr>54</addr>
- </addr>
- </knxNetIpDeviceMacAddress>
- <deviceFriendlyName>
- <deviceFriendlyName>71</deviceFriendlyName>
- <deviceFriendlyName>105</deviceFriendlyName>
- <deviceFriendlyName>114</deviceFriendlyName>
- <deviceFriendlyName>97</deviceFriendlyName>
- <deviceFriendlyName>32</deviceFriendlyName>
- <deviceFriendlyName>75</deviceFriendlyName>
- <deviceFriendlyName>78</deviceFriendlyName>
- <deviceFriendlyName>88</deviceFriendlyName>
- <deviceFriendlyName>47</deviceFriendlyName>
- <deviceFriendlyName>73</deviceFriendlyName>
- <deviceFriendlyName>80</deviceFriendlyName>
- <deviceFriendlyName>45</deviceFriendlyName>
- <deviceFriendlyName>83</deviceFriendlyName>
- <deviceFriendlyName>99</deviceFriendlyName>
- <deviceFriendlyName>104</deviceFriendlyName>
- <deviceFriendlyName>110</deviceFriendlyName>
- <deviceFriendlyName>105</deviceFriendlyName>
- <deviceFriendlyName>116</deviceFriendlyName>
- <deviceFriendlyName>116</deviceFriendlyName>
- <deviceFriendlyName>115</deviceFriendlyName>
- <deviceFriendlyName>116</deviceFriendlyName>
- <deviceFriendlyName>101</deviceFriendlyName>
- <deviceFriendlyName>108</deviceFriendlyName>
- <deviceFriendlyName>108</deviceFriendlyName>
- <deviceFriendlyName>101</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- <deviceFriendlyName>0</deviceFriendlyName>
- </deviceFriendlyName>
- </dibDeviceInfo>
- <dibSuppSvcFamilies>
- <descriptionType>2</descriptionType>
- <serviceIds>
- <serviceIds className="org.apache.plc4x.java.knxnetip.readwrite.KnxNetIpCore">
- <version>1</version>
- </serviceIds>
- <serviceIds className="org.apache.plc4x.java.knxnetip.readwrite.KnxNetIpDeviceManagement">
- <version>1</version>
- </serviceIds>
- <serviceIds className="org.apache.plc4x.java.knxnetip.readwrite.KnxNetIpTunneling">
- <version>1</version>
- </serviceIds>
- </serviceIds>
- </dibSuppSvcFamilies>
- </DescriptionResponse>
- </xml>
- </testcase>
-
- <testcase>
- <name>Connect Request</name>
- <raw>06100205001a0801c0a82a46f4310801c0a82a46f43204040200</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <ConnectionRequest className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionRequest">
- <hpaiDiscoveryEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>70</addr>
- </addr>
- </ipAddress>
- <ipPort>62513</ipPort>
- </hpaiDiscoveryEndpoint>
- <hpaiDataEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>70</addr>
- </addr>
- </ipAddress>
- <ipPort>62514</ipPort>
- </hpaiDataEndpoint>
- <connectionRequestInformation className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionRequestInformationTunnelConnection">
- <knxLayer>2</knxLayer>
- </connectionRequestInformation>
- </ConnectionRequest>
- </xml>
- </testcase>
-
- <testcase>
- <name>Connect Response</name>
- <raw>06100206001466000801c0a82a0b0e5704041101</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <ConnectionResponse className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionResponse">
- <communicationChannelId>102</communicationChannelId>
- <status>0</status>
- <hpaiDataEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>11</addr>
- </addr>
- </ipAddress>
- <ipPort>3671</ipPort>
- </hpaiDataEndpoint>
- <connectionResponseDataBlock className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionResponseDataBlockTunnelConnection">
- <knxAddress>
- <mainGroup>1</mainGroup>
- <middleGroup>1</middleGroup>
- <subGroup>1</subGroup>
- </knxAddress>
- </connectionResponseDataBlock>
- </ConnectionResponse>
- </xml>
- </testcase>
-
- <testcase>
- <name>Connection State Request</name>
- <raw>06100207001066000801c0a82a46f431</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <ConnectionStateRequest className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionStateRequest">
- <communicationChannelId>102</communicationChannelId>
- <hpaiControlEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>70</addr>
- </addr>
- </ipAddress>
- <ipPort>62513</ipPort>
- </hpaiControlEndpoint>
- </ConnectionStateRequest>
- </xml>
- </testcase>
-
- <testcase>
- <name>Connection State Response</name>
- <raw>0610020800086600</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <ConnectionStateResponse className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionStateResponse">
- <communicationChannelId>102</communicationChannelId>
- <status>0</status>
- </ConnectionStateResponse>
- </xml>
- </testcase>
-
- <testcase>
- <name>Device Configuration Request</name>
- <raw>06100310001104670000fc000001531001</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <DeviceConfigurationRequest className="org.apache.plc4x.java.knxnetip.readwrite.DeviceConfigurationRequest">
- <deviceConfigurationRequestDataBlock>
- <communicationChannelId>103</communicationChannelId>
- <sequenceCounter>0</sequenceCounter>
- </deviceConfigurationRequestDataBlock>
- <cemi className="org.apache.plc4x.java.knxnetip.readwrite.CEMIMPropReadReq">
- <interfaceObjectType>0</interfaceObjectType>
- <objectInstance>1</objectInstance>
- <propertyId>83</propertyId>
- <numberOfElements>1</numberOfElements>
- <startIndex>1</startIndex>
- </cemi>
- </DeviceConfigurationRequest>
- </xml>
- </testcase>
-
- <testcase>
- <name>Device Configuration Ack</name>
- <raw>06100311000a04670000</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <DeviceConfigurationAck className="org.apache.plc4x.java.knxnetip.readwrite.DeviceConfigurationAck">
- <deviceConfigurationAckDataBlock>
- <communicationChannelId>103</communicationChannelId>
- <sequenceCounter>0</sequenceCounter>
- <status>0</status>
- </deviceConfigurationAckDataBlock>
- </DeviceConfigurationAck>
- </xml>
- </testcase>
-
- <testcase>
- <name>Disconnect Request</name>
- <raw>06100209001067000801c0a82a46f431</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <DisconnectRequest className="org.apache.plc4x.java.knxnetip.readwrite.DisconnectRequest">
- <communicationChannelId>103</communicationChannelId>
- <hpaiControlEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>70</addr>
- </addr>
- </ipAddress>
- <ipPort>62513</ipPort>
- </hpaiControlEndpoint>
- </DisconnectRequest>
- </xml>
- </testcase>
-
- <testcase>
- <name>Disconnect Response</name>
- <raw>0610020a00086600</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <DisconnectResponse className="org.apache.plc4x.java.knxnetip.readwrite.DisconnectResponse">
- <communicationChannelId>102</communicationChannelId>
- <status>0</status>
- </DisconnectResponse>
- </xml>
- </testcase>
-
- <testcase>
- <name>Tunneling Request</name>
- <raw>06100420001c046b00002b0703010504024502bc360a1e0ce100810d</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <TunnelingRequest className="org.apache.plc4x.java.knxnetip.readwrite.TunnelingRequest">
- <tunnelingRequestDataBlock>
- <communicationChannelId>107</communicationChannelId>
- <sequenceCounter>0</sequenceCounter>
- </tunnelingRequestDataBlock>
- <cemi className="org.apache.plc4x.java.knxnetip.readwrite.CEMILBusmonInd">
- <additionalInformationLength>7</additionalInformationLength>
- <additionalInformation>
- <additionalInformation className="org.apache.plc4x.java.knxnetip.readwrite.CEMIAdditionalInformationBusmonitorInfo">
- <frameErrorFlag>false</frameErrorFlag>
- <bitErrorFlag>false</bitErrorFlag>
- <parityErrorFlag>false</parityErrorFlag>
- <unknownFlag>false</unknownFlag>
- <lostFlag>false</lostFlag>
- <sequenceNumber>5</sequenceNumber>
- </additionalInformation>
- <additionalInformation className="org.apache.plc4x.java.knxnetip.readwrite.CEMIAdditionalInformationRelativeTimestamp">
- <relativeTimestamp>
- <timestamp>17666</timestamp>
- </relativeTimestamp>
- </additionalInformation>
- </additionalInformation>
- <rawFrame>
- <rawFrame>188</rawFrame>
- <rawFrame>54</rawFrame>
- <rawFrame>10</rawFrame>
- <rawFrame>30</rawFrame>
- <rawFrame>12</rawFrame>
- <rawFrame>225</rawFrame>
- <rawFrame>0</rawFrame>
- <rawFrame>129</rawFrame>
- <rawFrame>13</rawFrame>
- </rawFrame>
- </cemi>
- </TunnelingRequest>
-
- </xml>
- </testcase>
-
- <testcase>
- <name>Tunneling Response</name>
- <raw>06100421000a046b0000</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <TunnelingResponse className="org.apache.plc4x.java.knxnetip.readwrite.TunnelingResponse">
- <tunnelingResponseDataBlock>
- <communicationChannelId>107</communicationChannelId>
- <sequenceCounter>0</sequenceCounter>
- <status>0</status>
- </tunnelingResponseDataBlock>
- </TunnelingResponse>
- </xml>
- </testcase>
-
- <testcase>
- <name>Default</name>
- <raw>0610020500180801c0a82a46c4090801c0a82a46c40a0203</raw>
- <root-type>KNXNetIPMessage</root-type>
- <xml>
- <ConnectionRequest className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionRequest">
- <hpaiDiscoveryEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>70</addr>
- </addr>
- </ipAddress>
- <ipPort>50185</ipPort>
- </hpaiDiscoveryEndpoint>
- <hpaiDataEndpoint>
- <hostProtocolCode>1</hostProtocolCode>
- <ipAddress>
- <addr>
- <addr>192</addr>
- <addr>168</addr>
- <addr>42</addr>
- <addr>70</addr>
- </addr>
- </ipAddress>
- <ipPort>50186</ipPort>
- </hpaiDataEndpoint>
- <connectionRequestInformation className="org.apache.plc4x.java.knxnetip.readwrite.ConnectionRequestInformationDeviceManagement"/>
- </ConnectionRequest>
- </xml>
- </testcase>
-
-</test:testsuite>
\ No newline at end of file
diff --git a/sandbox/test-java-knxnetip-driver/pom.xml b/sandbox/test-java-knxnetip-driver/pom.xml
index 0a50440..cf5e4eb 100644
--- a/sandbox/test-java-knxnetip-driver/pom.xml
+++ b/sandbox/test-java-knxnetip-driver/pom.xml
@@ -66,12 +66,6 @@
</dependency>
<dependency>
- <groupId>org.apache.plc4x.sandbox</groupId>
- <artifactId>test-java-knxnetip-shared</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-transport-udp</artifactId>
<version>0.7.0-SNAPSHOT</version>
@@ -96,6 +90,10 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
diff --git a/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java
similarity index 100%
rename from sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java
rename to sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java
diff --git a/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/AddressType.java b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/AddressType.java
similarity index 100%
rename from sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/AddressType.java
rename to sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/AddressType.java
diff --git a/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Ets5Model.java b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Ets5Model.java
similarity index 100%
rename from sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Ets5Model.java
rename to sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Ets5Model.java
diff --git a/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Function.java b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Function.java
similarity index 100%
rename from sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Function.java
rename to sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/Function.java
diff --git a/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/GroupAddress.java b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/GroupAddress.java
similarity index 100%
rename from sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/GroupAddress.java
rename to sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/ets5/model/GroupAddress.java
diff --git a/sandbox/test-java-knxnetip-shared/pom.xml b/sandbox/test-java-knxnetip-shared/pom.xml
deleted file mode 100644
index 09af46d..0000000
--- a/sandbox/test-java-knxnetip-shared/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
-
- http://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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.plc4x.sandbox</groupId>
- <artifactId>plc4x-sandbox</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>test-java-knxnetip-shared</artifactId>
-
- <name>Sandbox: Test Generated KNXNet/IP (Shared)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-spi</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.19</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/sandbox/test-java-s7-driver-passive/pom.xml b/sandbox/test-java-s7-driver-passive/pom.xml
deleted file mode 100644
index 5250676..0000000
--- a/sandbox/test-java-s7-driver-passive/pom.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
-
- http://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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.plc4x.sandbox</groupId>
- <artifactId>plc4x-sandbox</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>test-java-s7-driver-passive</artifactId>
-
- <name>Sandbox: Test Generated S7 Driver (Passive)</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.plc4x.plugins</groupId>
- <artifactId>plc4x-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>test</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>generate-driver</goal>
- </goals>
- <configuration>
- <protocolName>s7</protocolName>
- <languageName>java</languageName>
- <outputFlavor>passive</outputFlavor>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-api</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-spi</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-transport-raw-socket</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-build-utils-language-java</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <!-- Scope is 'provided' as this way it's not shipped with the driver -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-protocols-s7</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <!-- Scope is 'provided' as this way it's not shipped with the driver -->
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/java/s7/utils/StaticHelper.java b/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/java/s7/utils/StaticHelper.java
deleted file mode 100644
index 4c29fd8..0000000
--- a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/java/s7/utils/StaticHelper.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-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
-
- http://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.java.s7.utils;
-
-import org.apache.commons.lang3.NotImplementedException;
-import org.apache.plc4x.java.spi.generation.ParseException;
-import org.apache.plc4x.java.spi.generation.ReadBuffer;
-import org.apache.plc4x.java.spi.generation.WriteBuffer;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.temporal.ChronoUnit;
-
-public class StaticHelper {
-
- public static LocalTime parseTiaTime(ReadBuffer io) {
- try {
- int millisSinceMidnight = io.readInt(32);
- return LocalTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0).plus(
- millisSinceMidnight, ChronoUnit.MILLIS);
- } catch (ParseException e) {
- return null;
- }
- }
-
- public static void serializeTiaTime(WriteBuffer io, LocalTime value) {
-
- }
-
- public static LocalTime parseS5Time(ReadBuffer io) {
- try {
- int stuff = io.readInt(16);
- // TODO: Implement this correctly.
- throw new NotImplementedException("S5TIME not implemented");
- } catch (ParseException e) {
- return null;
- }
- }
-
- public static void serializeS5Time(WriteBuffer io, LocalTime value) {
-
- }
-
- public static LocalTime parseTiaLTime(ReadBuffer io) {
- throw new NotImplementedException("LTime not implemented");
- }
-
- public static void serializeTiaLTime(WriteBuffer io, LocalTime value) {
-
- }
-
- public static LocalTime parseTiaTimeOfDay(ReadBuffer io) {
- try {
- int millisSinceMidnight = io.readUnsignedInt(32);
- return LocalTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0).plus(
- millisSinceMidnight, ChronoUnit.MILLIS);
- } catch (ParseException e) {
- return null;
- }
- }
-
- public static void serializeTiaTimeOfDay(WriteBuffer io, LocalTime value) {
-
- }
-
- public static LocalDate parseTiaDate(ReadBuffer io) {
- try {
- int daysSince1990 = io.readUnsignedShort(16);
- return LocalDate.now().withYear(1990).withDayOfMonth(1).withMonth(1).plus(daysSince1990, ChronoUnit.DAYS);
- } catch (ParseException e) {
- return null;
- }
- }
-
- public static void serializeTiaDate(WriteBuffer io, LocalDate value) {
-
- }
-
- public static LocalDateTime parseTiaDateTime(ReadBuffer io) {
- try {
- int year = convertByteToBcd(io.readByte(8));
- int month = convertByteToBcd(io.readByte(8));
- int day = convertByteToBcd(io.readByte(8));
- int hour = convertByteToBcd(io.readByte(8));
- int minute = convertByteToBcd(io.readByte(8));
- int second = convertByteToBcd(io.readByte(8));
- //skip the last 2 bytes no information present
- io.readByte(8);
- io.readByte(8);
-
- //data-type ranges from 1990 up to 2089
- if (year >= 90) {
- year += 1900;
- } else {
- year += 2000;
- }
-
- return LocalDateTime.of(year, month, day, hour, minute, second);
- } catch (ParseException e) {
- return null;
- }
- }
-
- public static void serializeTiaDateTime(WriteBuffer io, LocalDateTime value) {
-
- }
-
- /**
- * converts incoming byte to an integer regarding used BCD format
- *
- * @param incomingByte
- * @return converted BCD number
- */
- private static int convertByteToBcd(byte incomingByte) {
- int dec = (incomingByte >> 4) * 10;
- return dec + (incomingByte & 0x0f);
- }
-
-}
diff --git a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/PassiveS7PlcDriver.java b/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/PassiveS7PlcDriver.java
deleted file mode 100644
index 581c996..0000000
--- a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/PassiveS7PlcDriver.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-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
-
- http://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.javapassive.s7;
-
-import org.apache.plc4x.java.PlcDriverManager;
-import org.apache.plc4x.java.api.PlcConnection;
-import org.apache.plc4x.java.api.authentication.PlcAuthentication;
-import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
-import org.apache.plc4x.java.api.messages.PlcReadRequest;
-import org.apache.plc4x.java.api.PlcDriver;
-import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketIpAddress;
-import org.apache.plc4x.javapassive.s7.connection.PassiveS7PlcConnection;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static org.apache.plc4x.java.utils.rawsockets.netty.RawSocketAddress.ALL_PROTOCOLS;
-
-/**
- * Implementation of the S7 protocol, based on:
- * - S7 Protocol
- * - ISO Transport Protocol (Class 0) (https://tools.ietf.org/html/rfc905)
- * - ISO on TCP (https://tools.ietf.org/html/rfc1006)
- * - TCP
- */
-public class PassiveS7PlcDriver implements PlcDriver {
-
- private static final int ISO_ON_TCP_PORT = 102;
-
- private static final Pattern S7_URI_PATTERN = Pattern.compile("^s7-passive://(?<networkDevice>.*)(?<params>\\?.*)?");
-
- @Override
- public String getProtocolCode() {
- return "s7-passive";
- }
-
- @Override
- public String getProtocolName() {
- return "Siemens S7 (Passive-Mode)";
- }
-
- @Override
- public PlcConnection connect(String url) throws PlcConnectionException {
- Matcher matcher = S7_URI_PATTERN.matcher(url);
- if (!matcher.matches()) {
- throw new PlcConnectionException(
- "Connection url doesn't match the format 's7-passive://{network-device}'");
- }
- String networkDevice = matcher.group("networkDevice");
-
- String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null;
-
- try {
- RawSocketIpAddress rawSocketAddress = new RawSocketIpAddress(
- networkDevice, ALL_PROTOCOLS, null, ISO_ON_TCP_PORT);
- return new PassiveS7PlcConnection(rawSocketAddress, params);
- } catch (Exception e) {
- throw new PlcConnectionException("Error connecting to host", e);
- }
- }
-
- @Override
- public PlcConnection connect(String url, PlcAuthentication authentication) throws PlcConnectionException {
- throw new PlcConnectionException("Basic S7 connections don't support authentication.");
- }
-
- public static void main(String[] args) throws Exception {
- try (PlcConnection connection = new PlcDriverManager().getConnection("s7-passive://en10")) {
- PlcReadRequest readRequest = connection.readRequestBuilder().addItem("hurz", "lalala").build();
- readRequest.execute().get();
- }
- }
-
-}
diff --git a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/connection/PassiveS7PlcConnection.java b/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/connection/PassiveS7PlcConnection.java
deleted file mode 100644
index 88e4209..0000000
--- a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/connection/PassiveS7PlcConnection.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-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
-
- http://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.javapassive.s7.connection;
-
-import io.netty.channel.*;
-import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
-import org.apache.plc4x.java.api.messages.PlcReadRequest;
-import org.apache.plc4x.java.api.messages.PlcReadResponse;
-import org.apache.plc4x.java.api.model.PlcField;
-import org.apache.plc4x.java.transport.rawsocket.RawSocketChannelFactory;
-import org.apache.plc4x.java.spi.connection.ChannelFactory;
-import org.apache.plc4x.java.spi.connection.DefaultPlcFieldHandler;
-import org.apache.plc4x.java.spi.connection.NettyPlcConnection;
-import org.apache.plc4x.java.spi.events.ConnectedEvent;
-import org.apache.plc4x.java.spi.messages.DefaultPlcReadRequest;
-import org.apache.plc4x.java.spi.messages.PlcReader;
-import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketIpAddress;
-import org.apache.plc4x.java.utils.rawsockets.netty.TcpIpPacketHandler;
-import org.apache.plc4x.javapassive.s7.protocol.HelloWorldProtocol;
-import org.apache.plc4x.javapassive.s7.protocol.PassiveS7Protocol;
-
-import java.util.concurrent.CompletableFuture;
-
-public class PassiveS7PlcConnection extends NettyPlcConnection implements PlcReader {
-
- public PassiveS7PlcConnection(RawSocketIpAddress address, String params) {
- this(new RawSocketChannelFactory(address.getDeviceName(), null,
- address.getPort(), -1, new TcpIpPacketHandler()), params);
- }
-
- public PassiveS7PlcConnection(ChannelFactory channelFactory, String param) {
- super(channelFactory, false);
- }
-
- @Override
- protected ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
- return new ChannelInitializer<Channel>() {
- @Override
- protected void initChannel(Channel channel) {
- // Build the protocol stack for communicating with the s7 protocol.
- ChannelPipeline pipeline = channel.pipeline();
- pipeline.addLast(new ChannelInboundHandlerAdapter() {
- @Override
- public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
- if (evt instanceof ConnectedEvent) {
- sessionSetupCompleteFuture.complete(null);
- } else {
- super.userEventTriggered(ctx, evt);
- }
- }
- });
- pipeline.addLast(new PassiveS7Protocol());
- pipeline.addLast(new HelloWorldProtocol());
- }
- };
- }
-
- @Override
- public boolean canRead() {
- return true;
- }
-
- @Override
- public PlcReadRequest.Builder readRequestBuilder() {
- return new DefaultPlcReadRequest.Builder(this, new DefaultPlcFieldHandler() {
- @Override
- public PlcField createField(String fieldQuery) throws PlcInvalidFieldException {
- return new PlcField() {
- @Override
- public Class<?> getDefaultJavaType() {
- return String.class;
- }
- };
- }
- });
- }
-
- @Override
- public CompletableFuture<PlcReadResponse> read(PlcReadRequest readRequest) {
- return new CompletableFuture<>();
- }
-
-}
diff --git a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/HelloWorldProtocol.java b/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/HelloWorldProtocol.java
deleted file mode 100644
index e0c6793..0000000
--- a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/HelloWorldProtocol.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-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
-
- http://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.javapassive.s7.protocol;
-
-import io.netty.channel.ChannelHandlerContext;
-import org.apache.plc4x.java.spi.PlcMessageToMessageCodec;
-import org.apache.plc4x.java.spi.messages.PlcRequestContainer;
-import org.apache.plc4x.java.s7.passive.S7Message;
-import org.apache.plc4x.java.s7.passive.TPKTPacket;
-
-import java.util.List;
-
-public class HelloWorldProtocol extends PlcMessageToMessageCodec<TPKTPacket, PlcRequestContainer> {
-
- @Override
- protected void encode(ChannelHandlerContext channelHandlerContext, PlcRequestContainer plcRequestContainer, List<Object> list) throws Exception {
- System.out.println(plcRequestContainer);
- }
-
- @Override
- protected void decode(ChannelHandlerContext channelHandlerContext, TPKTPacket tpktPacket, List<Object> list) throws Exception {
- StringBuilder sb = new StringBuilder();
- sb.append("[").append(tpktPacket.getPayload().getClass().getName());
- if(tpktPacket.getPayload().getPayload() != null) {
- S7Message s7Message = tpktPacket.getPayload().getPayload();
- sb.append(" \n [").append(s7Message.getClass()).append("]\n");
- }
- sb.append("]");
- System.out.println(sb.toString());
- }
-
-}
diff --git a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/PassiveS7Protocol.java b/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/PassiveS7Protocol.java
deleted file mode 100644
index 1c35c04..0000000
--- a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/PassiveS7Protocol.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-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
-
- http://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.javapassive.s7.protocol;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageCodec;
-import org.apache.plc4x.java.s7.passive.TPKTPacket;
-import org.apache.plc4x.java.s7.passive.io.TPKTPacketIO;
-import org.apache.plc4x.java.spi.generation.ReadBuffer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class PassiveS7Protocol extends ByteToMessageCodec<TPKTPacket> {
-
- private static final Logger logger = LoggerFactory.getLogger(PassiveS7Protocol.class);
-
- private TPKTPacketIO io;
-
- public PassiveS7Protocol() {
- io = new TPKTPacketIO();
- }
-
- @Override
- protected void encode(ChannelHandlerContext channelHandlerContext, TPKTPacket tpktPacket, ByteBuf byteBuf) throws Exception {
- System.out.println(tpktPacket);
- }
-
- @Override
- protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> out) throws Exception {
- byte[] bytes = new byte[byteBuf.readableBytes()];
- byteBuf.readBytes(bytes);
- ReadBuffer readBuffer = new ReadBuffer(bytes);
- while(readBuffer.getPos() < bytes.length) {
- try {
- TPKTPacket packet = TPKTPacketIO.parse(readBuffer);
- out.add(packet);
- } catch(Exception e) {
- logger.warn("Error decoding package: " + e.getMessage());
- }
- }
- }
-
-}
diff --git a/sandbox/test-java-s7-driver-passive/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver b/sandbox/test-java-s7-driver-passive/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
deleted file mode 100644
index df3c9a7..0000000
--- a/sandbox/test-java-s7-driver-passive/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# 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
-#
-# http://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.
-#
-org.apache.plc4x.javapassive.s7.PassiveS7PlcDriver
diff --git a/sandbox/test-java-s7-driver-passive/src/test/java/BenchmarkGeneratedPassiveS7.java b/sandbox/test-java-s7-driver-passive/src/test/java/BenchmarkGeneratedPassiveS7.java
deleted file mode 100644
index 58295b6..0000000
--- a/sandbox/test-java-s7-driver-passive/src/test/java/BenchmarkGeneratedPassiveS7.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- 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
-
- http://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.
- */
-
-import org.apache.commons.codec.binary.Hex;
-import org.apache.plc4x.java.s7.passive.TPKTPacket;
-import org.apache.plc4x.java.s7.passive.io.TPKTPacketIO;
-import org.apache.plc4x.java.spi.generation.ReadBuffer;
-
-public class BenchmarkGeneratedPassiveS7 {
-
- public static void main(String[] args) throws Exception {
- byte[] rData = Hex.decodeHex("0300006702f080320100000001005600000407120a10060001032b84000160120a10020001032b840001a0120a10010001032b840001a9120a10050001032b84000150120a10020001032b84000198120a10040001032b84000140120a10020001032b84000190");
- long start = System.currentTimeMillis();
- int numRunsParse = 2000000;
- TPKTPacketIO tpktPacketIO = new TPKTPacketIO();
-
- // Benchmark the parsing code
- TPKTPacket packet = null;
- for(int i = 0; i < numRunsParse; i++) {
- ReadBuffer rBuf = new ReadBuffer(rData);
- packet = TPKTPacketIO.parse(rBuf);
- }
- long endParsing = System.currentTimeMillis();
-
- System.out.println("Parsed " + numRunsParse + " packets in " + (endParsing - start) + "ms");
- System.out.println("That's " + ((float) (endParsing - start) / numRunsParse) + "ms per packet");
- }
-
-}