You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by ld...@apache.org on 2020/12/15 00:05:08 UTC
[plc4x] 30/30: Fix rat warnings, create scratch of documentation.
This is an automated email from the ASF dual-hosted git repository.
ldywicki pushed a commit to branch feature/socketcan-0.8-preparations
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 3aaf3acbe571253e01b2fd8ee9520ad09d5d6f05
Author: Łukasz Dywicki <lu...@code-house.org>
AuthorDate: Tue Dec 15 01:02:27 2020 +0100
Fix rat warnings, create scratch of documentation.
---
.../protocols/can}/CANOpenDriverSDOIT.xml | 215 +++++++++------------
.../protocols/can}/CANOpenPayloadTestSuite.xml | 0
.../protocols/can}/CANOpenWiresharkTestSuite.xml | 0
.../protocols/can}/SocketCAN20ATestSuite.xml | 0
.../protocols/can}/SocketCAN20BTestSuite.xml | 0
.../protocols/can}/SocketCANTestSuite.xml | 0
sandbox/test-java-can-driver/pom.xml | 101 ++++++----
.../apache/plc4x/java/can/CANOpenPlcDriver.java | 2 +-
.../org/apache/plc4x/java/can/CANPlcDriver.java | 108 -----------
.../api/conversation/canopen/CANConversation.java | 18 ++
.../canopen/CANOpenConversationBase.java | 18 ++
.../canopen/SDODownloadConversation.java | 18 ++
.../canopen/SDOUploadConversation.java | 18 ++
.../api/segmentation/PlcSegmentationException.java | 21 --
.../java/can/api/segmentation/Segmentation.java | 131 -------------
.../api/segmentation/accumulator/ByteStorage.java | 18 ++
.../java/can/canopen/CANOpenAbortException.java | 18 ++
.../plc4x/java/can/canopen/CANOpenFrame.java | 18 ++
.../java/can/canopen/CANOpenFrameBuilder.java | 18 ++
.../can/canopen/CANOpenFrameBuilderFactory.java | 18 ++
.../canopen/socketcan/CANOpenSocketCANFrame.java | 1 -
.../socketcan/CANOpenSocketCANFrameBuilder.java | 18 ++
.../socketcan/io/CANOpenSocketCANFrameIO.java | 1 -
.../java/can/context/CANOpenDriverContext.java | 18 ++
.../java/can/field/CANOpenSubscriptionField.java | 18 ++
.../plc4x/java/can/helper/CANOpenHelper.java | 18 ++
.../apache/plc4x/java/can/helper/HeaderParser.java | 18 ++
.../apache/plc4x/java/can/listener/Callback.java | 18 ++
.../plc4x/java/can/listener/CompositeCallback.java | 18 ++
.../java/can/protocol/CANOpenProtocolLogic.java | 13 +-
.../can/protocol/CANOpenSubscriptionHandle.java | 18 ++
.../protocol/segmentation/CANOpenSegmentation.java | 86 ---------
.../java/can/socketcan/SocketCANConversation.java | 18 ++
.../services/org.apache.plc4x.java.api.PlcDriver | 1 -
.../apache/plc4x/java/can/CANOpenDriverSDOIT.java | 20 +-
.../apache/plc4x/java/can/CANOpenPayloadTest.java | 3 +-
.../plc4x/java/can/CANOpenWiresharkTest.java | 3 +-
.../apache/plc4x/java/can/ManualParserTest.java | 18 ++
.../apache/plc4x/java/can/SocketCAN20ATest.java | 3 +-
.../org/apache/plc4x/java/can/SocketCANTest.java | 3 +-
.../plc4x/java/can/field/CANOpenPDOFieldTest.java | 18 ++
.../plc4x/java/can/field/CANOpenSDOFieldTest.java | 18 ++
src/site/asciidoc/users/protocols/can.adoc | 119 ++++++++++++
43 files changed, 684 insertions(+), 525 deletions(-)
diff --git a/sandbox/test-java-can-driver/src/test/resources/testsuite/CANOpenDriverSDOIT.xml b/protocols/can/src/test/resources/protocols/can/CANOpenDriverSDOIT.xml
similarity index 79%
rename from sandbox/test-java-can-driver/src/test/resources/testsuite/CANOpenDriverSDOIT.xml
rename to protocols/can/src/test/resources/protocols/can/CANOpenDriverSDOIT.xml
index bd6e34a..12ae9ab 100644
--- a/sandbox/test-java-can-driver/src/test/resources/testsuite/CANOpenDriverSDOIT.xml
+++ b/protocols/can/src/test/resources/protocols/can/CANOpenDriverSDOIT.xml
@@ -103,25 +103,24 @@
</CANOpenSocketCANFrame>
</incoming-plc-message>
<api-response name="Report Read Response to application">
- <PlcReadResponse className="org.apache.plc4x.java.spi.messages.PlcReadResponse">
- <request className="org.apache.plc4x.java.spi.messages.DefaultPlcReadRequest">
- <sdo1 className="org.apache.plc4x.java.can.field.CANOpenSDOField">
- <CANOpenSDOField>
- <nodeId>1</nodeId>
- <index>1000</index>
- <subIndex>22</subIndex>
- <canOpenDataType>UNSIGNED32</canOpenDataType>
- <answerNodeId>1</answerNodeId>
- </CANOpenSDOField>
+ <PlcReadResponse>
+ <PlcReadRequest>
+ <fields>
+ <sdo1>
+ <CANOpenSDOField>
+ <node>1</node>
+ <index>1000</index>
+ <subIndex>22</subIndex>
+ <dataType>UNSIGNED32</dataType>
+ </CANOpenSDOField>
+ </sdo1>
+ </fields>
+ </PlcReadRequest>
+ <values>
+ <sdo1 result="OK">
+ <PlcUDINT>1717859169</PlcUDINT>
</sdo1>
- </request>
- <sdo1>
- <code>OK</code>
- <value className="org.apache.plc4x.java.api.value.PlcUDINT">
- <object>java.lang.Long</object>
- <object>1717859169</object>
- </value>
- </sdo1>
+ </values>
</PlcReadResponse>
</api-response>
<delay>1000</delay>
@@ -181,23 +180,24 @@
</CANOpenSocketCANFrame>
</incoming-plc-message>
<api-response name="Report Read Response to application">
- <PlcReadResponse className="org.apache.plc4x.java.spi.messages.PlcReadResponse">
- <request className="org.apache.plc4x.java.spi.messages.DefaultPlcReadRequest">
- <sdo1 className="org.apache.plc4x.java.can.field.CANOpenSDOField">
- <nodeId>1</nodeId>
- <index>9186</index>
- <subIndex>1</subIndex>
- <canOpenDataType>UNSIGNED8</canOpenDataType>
- <answerNodeId>1</answerNodeId>
+ <PlcReadResponse>
+ <PlcReadRequest>
+ <fields>
+ <sdo1>
+ <CANOpenSDOField>
+ <node>1</node>
+ <index>9186</index>
+ <subIndex>1</subIndex>
+ <dataType>UNSIGNED8</dataType>
+ </CANOpenSDOField>
+ </sdo1>
+ </fields>
+ </PlcReadRequest>
+ <values>
+ <sdo1 result="OK">
+ <PlcUSINT>97</PlcUSINT>
</sdo1>
- </request>
- <sdo1>
- <code>OK</code>
- <value className="org.apache.plc4x.java.api.value.PlcUSINT">
- <object>java.lang.Short</object>
- <object>97</object>
- </value>
- </sdo1>
+ </values>
</PlcReadResponse>
</api-response>
<delay>1000</delay>
@@ -277,23 +277,24 @@
</CANOpenSocketCANFrame>
</incoming-plc-message>
<api-response name="Report Read Response to application">
- <PlcReadResponse className="org.apache.plc4x.java.spi.messages.PlcReadResponse">
- <request className="org.apache.plc4x.java.spi.messages.DefaultPlcReadRequest">
- <sdo1 className="org.apache.plc4x.java.can.field.CANOpenSDOField">
- <nodeId>1</nodeId>
- <index>1000</index>
- <subIndex>22</subIndex>
- <canOpenDataType>UNSIGNED32</canOpenDataType>
- <answerNodeId>2</answerNodeId>
+ <PlcReadResponse>
+ <PlcReadRequest>
+ <fields>
+ <sdo1>
+ <CANOpenSDOField>
+ <node>1</node>
+ <index>1000</index>
+ <subIndex>22</subIndex>
+ <dataType>UNSIGNED32</dataType>
+ </CANOpenSDOField>
+ </sdo1>
+ </fields>
+ </PlcReadRequest>
+ <values>
+ <sdo1 result="OK">
+ <PlcUDINT>1717859169</PlcUDINT>
</sdo1>
- </request>
- <sdo1>
- <code>OK</code>
- <value className="org.apache.plc4x.java.api.value.PlcUDINT">
- <object>java.lang.Long</object>
- <object>1717859169</object>
- </value>
- </sdo1>
+ </values>
</PlcReadResponse>
</api-response>
<delay>1000</delay>
@@ -435,62 +436,33 @@
</incoming-plc-message>
<api-response name="Report Read Response to application">
- <PlcReadResponse className="org.apache.plc4x.java.spi.messages.PlcReadResponse">
- <request className="org.apache.plc4x.java.spi.messages.DefaultPlcReadRequest">
- <sdo1 className="org.apache.plc4x.java.can.field.CANOpenSDOField">
- <nodeId>2</nodeId>
- <index>2000</index>
- <subIndex>44</subIndex>
- <canOpenDataType>RECORD</canOpenDataType>
- <answerNodeId>2</answerNodeId>
+ <PlcReadResponse>
+ <PlcReadRequest>
+ <fields>
+ <sdo1>
+ <CANOpenSDOField>
+ <node>2</node>
+ <index>2000</index>
+ <subIndex>44</subIndex>
+ <dataType>RECORD</dataType>
+ </CANOpenSDOField>
+ </sdo1>
+ </fields>
+ </PlcReadRequest>
+ <values>
+ <sdo1 result="OK">
+ <PlcList>
+ <PlcSINT>97</PlcSINT>
+ <PlcSINT>115</PlcSINT>
+ <PlcSINT>100</PlcSINT>
+ <PlcSINT>102</PlcSINT>
+ <PlcSINT>97</PlcSINT>
+ <PlcSINT>115</PlcSINT>
+ <PlcSINT>100</PlcSINT>
+ <PlcSINT>102</PlcSINT>
+ </PlcList>
</sdo1>
- </request>
- <sdo1>
- <code>OK</code>
- <value className="org.apache.plc4x.java.api.value.PlcList">
- <object>java.util.Collections..UnmodifiableRandomAccessList</object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>97</object>
- </object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>115</object>
- </object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>100</object>
- </object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>102</object>
- </object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>97</object>
- </object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>115</object>
- </object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>100</object>
- </object>
- <object>org.apache.plc4x.java.api.value.PlcSINT</object>
- <object>
- <object>java.lang.Byte</object>
- <object>102</object>
- </object>
- </value>
- </sdo1>
+ </values>
</PlcReadResponse>
</api-response>
<delay>1000</delay>
@@ -547,23 +519,24 @@
</CANOpenSocketCANFrame>
</incoming-plc-message>
<api-response name="Report Read Response to application">
- <PlcReadResponse className="org.apache.plc4x.java.spi.messages.PlcReadResponse">
- <request className="org.apache.plc4x.java.spi.messages.DefaultPlcReadRequest">
- <sdo1 className="org.apache.plc4x.java.can.field.CANOpenSDOField">
- <nodeId>1</nodeId>
- <index>1000</index>
- <subIndex>22</subIndex>
- <canOpenDataType>UNSIGNED32</canOpenDataType>
- <answerNodeId>1</answerNodeId>
+ <PlcReadResponse>
+ <PlcReadRequest>
+ <fields>
+ <sdo1>
+ <CANOpenSDOField>
+ <node>1</node>
+ <index>1000</index>
+ <subIndex>22</subIndex>
+ <dataType>UNSIGNED32</dataType>
+ </CANOpenSDOField>
+ </sdo1>
+ </fields>
+ </PlcReadRequest>
+ <values>
+ <sdo1 result="REMOTE_ERROR">
+ <PlcLINT>84082688</PlcLINT>
</sdo1>
- </request>
- <sdo1>
- <code>REMOTE_ERROR</code>
- <value className="org.apache.plc4x.java.api.value.PlcLINT">
- <object>java.lang.Long</object>
- <object>84082688</object>
- </value>
- </sdo1>
+ </values>
</PlcReadResponse>
</api-response>
<delay>1000</delay>
diff --git a/sandbox/test-java-can-driver/src/test/resources/testsuite/CANOpenPayloadTestSuite.xml b/protocols/can/src/test/resources/protocols/can/CANOpenPayloadTestSuite.xml
similarity index 100%
rename from sandbox/test-java-can-driver/src/test/resources/testsuite/CANOpenPayloadTestSuite.xml
rename to protocols/can/src/test/resources/protocols/can/CANOpenPayloadTestSuite.xml
diff --git a/sandbox/test-java-can-driver/src/test/resources/testsuite/CANOpenWiresharkTestSuite.xml b/protocols/can/src/test/resources/protocols/can/CANOpenWiresharkTestSuite.xml
similarity index 100%
rename from sandbox/test-java-can-driver/src/test/resources/testsuite/CANOpenWiresharkTestSuite.xml
rename to protocols/can/src/test/resources/protocols/can/CANOpenWiresharkTestSuite.xml
diff --git a/sandbox/test-java-can-driver/src/test/resources/testsuite/SocketCAN20ATestSuite.xml b/protocols/can/src/test/resources/protocols/can/SocketCAN20ATestSuite.xml
similarity index 100%
rename from sandbox/test-java-can-driver/src/test/resources/testsuite/SocketCAN20ATestSuite.xml
rename to protocols/can/src/test/resources/protocols/can/SocketCAN20ATestSuite.xml
diff --git a/sandbox/test-java-can-driver/src/test/resources/testsuite/SocketCAN20BTestSuite.xml b/protocols/can/src/test/resources/protocols/can/SocketCAN20BTestSuite.xml
similarity index 100%
rename from sandbox/test-java-can-driver/src/test/resources/testsuite/SocketCAN20BTestSuite.xml
rename to protocols/can/src/test/resources/protocols/can/SocketCAN20BTestSuite.xml
diff --git a/sandbox/test-java-can-driver/src/test/resources/testsuite/SocketCANTestSuite.xml b/protocols/can/src/test/resources/protocols/can/SocketCANTestSuite.xml
similarity index 100%
rename from sandbox/test-java-can-driver/src/test/resources/testsuite/SocketCANTestSuite.xml
rename to protocols/can/src/test/resources/protocols/can/SocketCANTestSuite.xml
diff --git a/sandbox/test-java-can-driver/pom.xml b/sandbox/test-java-can-driver/pom.xml
index 1209059..211278d 100644
--- a/sandbox/test-java-can-driver/pom.xml
+++ b/sandbox/test-java-can-driver/pom.xml
@@ -63,6 +63,38 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-feature-xml</id>
+ <phase>compile</phase>
+ <goals>
+ <!-- Generate the feature.xml -->
+ <goal>features-generate-descriptor</goal>
+ <!-- Check the feature.xml -->
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <enableGeneration>true</enableGeneration>
+ <aggregateFeatures>true</aggregateFeatures>
+ </configuration>
+ </execution>
+ <execution>
+ <id>build-kar</id>
+ <phase>package</phase>
+ <goals>
+ <!--
+ Build a kar archive (Jar containing the feature.xml
+ as well as the module content and it's dependencies.
+ -->
+ <goal>kar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@@ -79,6 +111,16 @@
</instructions>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies combine.children="append">
+ <usedDependency>org.apache.plc4x:plc4x-build-utils-language-java</usedDependency>
+ <usedDependency>org.apache.plc4x:plc4x-protocols-ads</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -90,8 +132,9 @@
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-configuration2</artifactId>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-spi</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
</dependency>
<dependency>
@@ -105,23 +148,13 @@
<artifactId>netty-buffer</artifactId>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- <version>6.0.0</version>
- <scope>provided</scope>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-build-utils-language-java</artifactId>
- <version>0.8.0-SNAPSHOT</version>
- <!-- Scope is 'provided' as this way it's not shipped with the driver -->
- <scope>provided</scope>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
</dependency>
<!-- Logging -->
@@ -130,24 +163,12 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>1.7.25</version>
- </dependency>
- <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-protocols-can</artifactId>
- <version>0.8.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>plc4j-utils-test-utils</artifactId>
<version>0.8.0-SNAPSHOT</version>
<scope>test</scope>
@@ -157,14 +178,28 @@
<artifactId>commons-codec</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</artifactId>
- <scope>test</scope>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4x-protocols-can</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <!-- Scope is 'provided' as this way it's not shipped with the driver -->
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4x-build-utils-language-java</artifactId>
+ <version>0.8.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-can</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <classifier>tests</classifier>
+ <type>test-jar</type>
+ <scope>test</scope>
</dependency>
</dependencies>
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/CANOpenPlcDriver.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/CANOpenPlcDriver.java
index afcaf54..fc6adf3 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/CANOpenPlcDriver.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/CANOpenPlcDriver.java
@@ -51,7 +51,7 @@ public class CANOpenPlcDriver extends GeneratedDriverBase<CANOpenFrame> {
@Override
public String getProtocolName() {
- return "CAN Open";
+ return "CAN open";
}
@Override
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/CANPlcDriver.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/CANPlcDriver.java
deleted file mode 100644
index bdf2858..0000000
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/CANPlcDriver.java
+++ /dev/null
@@ -1,108 +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.can;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufUtil;
-import org.apache.plc4x.java.api.value.PlcValueHandler;
-import org.apache.plc4x.java.can.configuration.CANConfiguration;
-import org.apache.plc4x.java.can.context.CANDriverContext;
-import org.apache.plc4x.java.can.field.CANFieldHandler;
-import org.apache.plc4x.java.can.protocol.CANProtocolLogic;
-import org.apache.plc4x.java.socketcan.readwrite.SocketCANFrame;
-import org.apache.plc4x.java.socketcan.readwrite.io.SocketCANFrameIO;
-import org.apache.plc4x.java.spi.configuration.Configuration;
-import org.apache.plc4x.java.spi.connection.GeneratedDriverBase;
-import org.apache.plc4x.java.spi.connection.ProtocolStackConfigurer;
-import org.apache.plc4x.java.spi.connection.SingleProtocolStackConfigurer;
-import tel.schich.javacan.CanFrame;
-
-import java.util.function.Consumer;
-import java.util.function.ToIntFunction;
-
-/**
- */
-public class CANPlcDriver extends GeneratedDriverBase<SocketCANFrame> {
-
- @Override
- public String getProtocolCode() {
- return "can";
- }
-
- @Override
- public String getProtocolName() {
- return "Controller Area Network";
- }
-
- @Override
- protected Class<? extends Configuration> getConfigurationType() {
- return CANConfiguration.class;
- }
-
- @Override
- protected String getDefaultTransport() {
- return "javacan";
- }
-
- @Override
- protected CANFieldHandler getFieldHandler() {
- return new CANFieldHandler();
- }
-
- @Override
- protected PlcValueHandler getValueHandler() {
- return null;
- }
-
- @Override
- protected ProtocolStackConfigurer<SocketCANFrame> getStackConfigurer() {
- return SingleProtocolStackConfigurer.builder(SocketCANFrame.class, SocketCANFrameIO.class)
- .withProtocol(CANProtocolLogic.class)
- .withDriverContext(CANDriverContext.class)
- .withPacketSizeEstimator(CANEstimator.class)
- //.withCorruptPacketRemover(CANCleaner.class)
- .build();
- }
-
- public static class CANEstimator implements ToIntFunction<ByteBuf> {
- @Override
- public int applyAsInt(ByteBuf byteBuf) {
- if (byteBuf.readableBytes() >= 5) {
-
- System.out.println(ByteBufUtil.prettyHexDump(byteBuf));
- byte len = byteBuf.getByte(4);
- System.out.println("Length " + (int) len);
-
- CanFrame frame = CanFrame.create(byteBuf.nioBuffer());
- System.out.println(frame);
-
- return len + 8 /* overhead */;
- }
- return -1; //discard
- }
- }
-
- public class CANCleaner implements Consumer<ByteBuf> {
- @Override
- public void accept(ByteBuf byteBuf) {
- System.out.println("Discard");
- byteBuf.readByte();
- }
- }
-}
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANConversation.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANConversation.java
index 5676ff8..edc2057 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANConversation.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANConversation.java
@@ -1,3 +1,21 @@
+/*
+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.can.api.conversation.canopen;
import org.apache.plc4x.java.can.canopen.CANOpenFrame;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANOpenConversationBase.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANOpenConversationBase.java
index bdfc38e..a6faa00 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANOpenConversationBase.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/CANOpenConversationBase.java
@@ -1,3 +1,21 @@
+/*
+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.can.api.conversation.canopen;
import io.vavr.control.Either;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDODownloadConversation.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDODownloadConversation.java
index f887b10..a0ecdc3 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDODownloadConversation.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDODownloadConversation.java
@@ -1,3 +1,21 @@
+/*
+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.can.api.conversation.canopen;
import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDOUploadConversation.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDOUploadConversation.java
index ab87926..229100f 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDOUploadConversation.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/conversation/canopen/SDOUploadConversation.java
@@ -1,3 +1,21 @@
+/*
+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.can.api.conversation.canopen;
import org.apache.plc4x.java.api.exceptions.PlcException;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/PlcSegmentationException.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/PlcSegmentationException.java
deleted file mode 100644
index 1023551..0000000
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/PlcSegmentationException.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.apache.plc4x.java.can.api.segmentation;
-
-import org.apache.plc4x.java.api.exceptions.PlcException;
-
-public class PlcSegmentationException extends PlcException {
- public PlcSegmentationException(String message) {
- super(message);
- }
-
- public PlcSegmentationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public PlcSegmentationException(Throwable cause) {
- super(cause);
- }
-
- public PlcSegmentationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
-}
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/Segmentation.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/Segmentation.java
deleted file mode 100644
index 84f915d..0000000
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/Segmentation.java
+++ /dev/null
@@ -1,131 +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.can.api.segmentation;
-
-import org.apache.plc4x.java.can.api.segmentation.accumulator.Storage;
-import org.apache.plc4x.java.spi.ConversationContext;
-import org.apache.plc4x.java.spi.transaction.RequestTransactionManager;
-
-import java.time.Duration;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.function.Supplier;
-
-/**
- * Utility type for handling segmented request-response operations.
- *
- * Segmented operation is one which spans over multiple frames and contains of:
- * - initialization
- * - 0... n steps
- * - finalization
- *
- * Depending on use case there might be 0 intermediate frames, leading to situation where requester sends segment request
- * and answer comes in one shot.
- */
-public abstract class Segmentation<C, T, R> {
-
- private final Duration timeout;
- private final Storage<T, R> storage;
- private final Class<C> frameType;
-
- private Supplier<T> request;
- private Predicate<T> responseValidator;
-
- private Predicate<T> finalStep;
- private Consumer<List<T>> callback;
- private Function<T, T> step;
- private Predicate<T> stepValidator;
- private List<T> answers = new ArrayList<>();
-
- public Segmentation(Class<C> frameType, Duration timeout, Storage<T, R> storage) {
- this.frameType = frameType;
- this.timeout = timeout;
- this.storage = storage;
- }
-
- public Segmentation<C, T, R> begin(Supplier<T> request, Predicate<T> requestAnswer) {
- this.request = request;
- this.responseValidator = requestAnswer;
- return this;
- }
-
- public Segmentation<C, T, R> step(Function<T, T> step, Predicate<T> stepAnswer) {
- this.step = step;
- this.stepValidator = stepAnswer;
- return this;
- }
-
- public Segmentation<C, T, R> end(Predicate<T> finalStep, Consumer<List<T>> callback) {
- this.finalStep = finalStep;
- this.callback = callback;
- return this;
- }
-
- public void execute(RequestTransactionManager tm, ConversationContext<C> context) throws PlcSegmentationException {
- Consumer<T> consumer = new Consumer<T>() {
- @Override
- public void accept(T payload) {
- storage.append(payload);
-
- if (finalStep.test(payload)) {
- callback.accept(answers);
- } else {
- try {
- T apply = step.apply(payload);
- send(tm, context, () -> apply, stepValidator, this);
- } catch (PlcSegmentationException e) {
- throw new RuntimeException(e);
- }
- }
- }
- };
- try {
- send(tm, context, request, responseValidator, consumer);
- } catch (RuntimeException e) {
- if (e.getCause() != null) {
- throw new PlcSegmentationException(e.getCause());
- }
- throw new PlcSegmentationException(e);
- }
- }
-
- private void send(RequestTransactionManager tm, ConversationContext<C> context, Supplier<T> generator, Predicate<T> predicate, Consumer<T> callback) throws PlcSegmentationException {
- C request = wrap(generator.get());
-
- RequestTransactionManager.RequestTransaction transaction = tm.startRequest();
- transaction.submit(() -> context.sendRequest(request)
- .expectResponse(frameType, timeout)
- .unwrap(this::unwrap)
- .check(predicate)
- .onError((payload, error) -> transaction.endRequest())
- .handle(payload -> {
- callback.accept(payload);
- transaction.endRequest();
- })
- );
- }
-
- protected abstract T unwrap(C frame);
-
- protected abstract C wrap(T payload) throws PlcSegmentationException;
-
-}
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/accumulator/ByteStorage.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/accumulator/ByteStorage.java
index ae0a6b4..d9c477f 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/accumulator/ByteStorage.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/api/segmentation/accumulator/ByteStorage.java
@@ -1,3 +1,21 @@
+/*
+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.can.api.segmentation.accumulator;
import org.apache.plc4x.java.canopen.readwrite.*;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenAbortException.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenAbortException.java
index 6ccdcf2..ecb9339 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenAbortException.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenAbortException.java
@@ -1,3 +1,21 @@
+/*
+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.can.canopen;
import org.apache.plc4x.java.api.exceptions.PlcProtocolException;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrame.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrame.java
index 2a32bda..a88cbd3 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrame.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrame.java
@@ -1,3 +1,21 @@
+/*
+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.can.canopen;
import org.apache.plc4x.java.canopen.readwrite.CANOpenPayload;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilder.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilder.java
index 17235b6..5112f18 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilder.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilder.java
@@ -1,3 +1,21 @@
+/*
+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.can.canopen;
import org.apache.plc4x.java.canopen.readwrite.CANOpenPayload;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilderFactory.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilderFactory.java
index 9704f6c..d58ece9 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilderFactory.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/CANOpenFrameBuilderFactory.java
@@ -1,3 +1,21 @@
+/*
+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.can.canopen;
public interface CANOpenFrameBuilderFactory {
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrame.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrame.java
index d51f042..e045232 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrame.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrame.java
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
*/
-
package org.apache.plc4x.java.can.canopen.socketcan;
import com.fasterxml.jackson.annotation.JsonCreator;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrameBuilder.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrameBuilder.java
index 87f7b2f..db6fe9e 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrameBuilder.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/CANOpenSocketCANFrameBuilder.java
@@ -1,3 +1,21 @@
+/*
+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.can.canopen.socketcan;
import org.apache.plc4x.java.can.canopen.CANOpenFrame;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/io/CANOpenSocketCANFrameIO.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/io/CANOpenSocketCANFrameIO.java
index 2175456..a4cafcd 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/io/CANOpenSocketCANFrameIO.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/canopen/socketcan/io/CANOpenSocketCANFrameIO.java
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
*/
-
package org.apache.plc4x.java.can.canopen.socketcan.io;
import org.apache.plc4x.java.can.canopen.CANOpenFrame;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/context/CANOpenDriverContext.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/context/CANOpenDriverContext.java
index 31c0028..be26f7c 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/context/CANOpenDriverContext.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/context/CANOpenDriverContext.java
@@ -1,3 +1,21 @@
+/*
+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.can.context;
import org.apache.plc4x.java.can.listener.CompositeCallback;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/field/CANOpenSubscriptionField.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/field/CANOpenSubscriptionField.java
index 78fafc0..976c49d 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/field/CANOpenSubscriptionField.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/field/CANOpenSubscriptionField.java
@@ -1,3 +1,21 @@
+/*
+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.can.field;
import org.apache.plc4x.java.canopen.readwrite.types.CANOpenService;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/CANOpenHelper.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/CANOpenHelper.java
index 85209b6..2aaa3db 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/CANOpenHelper.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/CANOpenHelper.java
@@ -1,3 +1,21 @@
+/*
+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.can.helper;
import org.apache.plc4x.java.api.value.PlcValue;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/HeaderParser.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/HeaderParser.java
index 9e549de..9f7f499 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/HeaderParser.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/helper/HeaderParser.java
@@ -1,3 +1,21 @@
+/*
+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.can.helper;
import org.apache.plc4x.java.socketcan.readwrite.SocketCANFrame;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/Callback.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/Callback.java
index 2e29d3b..c0038b4 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/Callback.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/Callback.java
@@ -1,3 +1,21 @@
+/*
+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.can.listener;
import org.apache.plc4x.java.can.canopen.CANOpenFrame;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/CompositeCallback.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/CompositeCallback.java
index 10fd72f..98d11fe 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/CompositeCallback.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/listener/CompositeCallback.java
@@ -1,3 +1,21 @@
+/*
+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.can.listener;
import org.apache.plc4x.java.can.canopen.CANOpenFrame;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenProtocolLogic.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenProtocolLogic.java
index 5aa6df3..2d2dbf9 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenProtocolLogic.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenProtocolLogic.java
@@ -18,7 +18,6 @@ under the License.
*/
package org.apache.plc4x.java.can.protocol;
-import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.api.messages.PlcReadRequest;
import org.apache.plc4x.java.api.messages.PlcReadResponse;
import org.apache.plc4x.java.api.messages.PlcSubscriptionEvent;
@@ -334,17 +333,7 @@ public class CANOpenProtocolLogic extends Plc4xProtocolBase<CANOpenFrame> implem
} else if (service == CANOpenService.HEARTBEAT && payload instanceof CANOpenHeartbeatPayload) {
publishEvent(service, nodeId, payload);
} else {
- String hex = "";
- if (logger.isInfoEnabled()) {
- try {
- final WriteBuffer buffer = new WriteBuffer(payload.getLengthInBytes(), true);
- CANOpenPayloadIO.staticSerialize(buffer, payload);
- hex = Hex.encodeHexString(buffer.getData());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- logger.info("Decoded CANOpen {} from {}, message {}, {}", service, nodeId, payload, hex);
+ logger.debug("Decoded CANOpen {} from {}, message {}", service, nodeId, payload);
}
}
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenSubscriptionHandle.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenSubscriptionHandle.java
index e318da3..fa79df1 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenSubscriptionHandle.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/CANOpenSubscriptionHandle.java
@@ -1,3 +1,21 @@
+/*
+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.can.protocol;
import org.apache.plc4x.java.can.field.CANOpenPDOField;
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/segmentation/CANOpenSegmentation.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/segmentation/CANOpenSegmentation.java
deleted file mode 100644
index 36f49c8..0000000
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/protocol/segmentation/CANOpenSegmentation.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.apache.plc4x.java.can.protocol.segmentation;
-
-import org.apache.plc4x.java.can.api.segmentation.Segmentation;
-import org.apache.plc4x.java.can.api.segmentation.accumulator.Storage;
-import org.apache.plc4x.java.canopen.readwrite.CANOpenPayload;
-import org.apache.plc4x.java.canopen.readwrite.io.CANOpenPayloadIO;
-import org.apache.plc4x.java.canopen.readwrite.types.CANOpenService;
-import org.apache.plc4x.java.socketcan.readwrite.SocketCANFrame;
-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.Duration;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.function.Supplier;
-
-/**
- * A basic utility to execute segmented operations.
- */
-public class CANOpenSegmentation<R> extends Segmentation<SocketCANFrame, CANOpenPayload, R> {
-
- private final CANOpenService service;
- private final int node;
-
- public CANOpenSegmentation(CANOpenService service, int node, Storage<CANOpenPayload, R> storage) {
- super(SocketCANFrame.class, Duration.ofSeconds(10L), storage);
-
- this.service = service;
- this.node = node;
- }
-
- public CANOpenSegmentation<R> begin(Supplier<CANOpenPayload> request, Predicate<CANOpenPayload> requestAnswer) {
- super.begin(request, requestAnswer);
- return this;
- }
-
- public CANOpenSegmentation<R> step(Function<CANOpenPayload, CANOpenPayload> step, Predicate<CANOpenPayload> stepAnswer) {
- super.step(step, stepAnswer);
- return this;
- }
-
- public CANOpenSegmentation<R> end(Predicate<CANOpenPayload> finalStep, Consumer<List<CANOpenPayload>> callback) {
- super.end(finalStep, callback);
- return this;
- }
-
- protected CANOpenPayload unwrap(SocketCANFrame frame) {
- return unsecure(() -> CANOpenPayloadIO.staticParse(new ReadBuffer(frame.getData()), serviceId(frame.getIdentifier())));
- }
-
- private <T> T unsecure(Callable<T> statement) {
- try {
- return statement.call();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- protected SocketCANFrame wrap(CANOpenPayload payload) {
- try {
- WriteBuffer io = new WriteBuffer(payload.getLengthInBytes(), true);
- payload.getMessageIO().serialize(io, payload);
- return new SocketCANFrame(service.getMin() + node, io.getData());
- } catch (ParseException e) {
- throw new RuntimeException("Could not construct segmented frame", e);
- }
- }
-
- private CANOpenService serviceId(int cobId) {
- // form 32 bit socketcan identifier
- CANOpenService service = CANOpenService.enumForValue((byte) (cobId >> 7));
- if (service == null) {
- for (CANOpenService val : CANOpenService.values()) {
- if (val.getMin() > cobId && val.getMax() < cobId) {
- return val;
- }
- }
- }
- return service;
- }
-
-}
diff --git a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/socketcan/SocketCANConversation.java b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/socketcan/SocketCANConversation.java
index 1ba85f4..774efdc 100644
--- a/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/socketcan/SocketCANConversation.java
+++ b/sandbox/test-java-can-driver/src/main/java/org/apache/plc4x/java/can/socketcan/SocketCANConversation.java
@@ -1,3 +1,21 @@
+/*
+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.can.socketcan;
import org.apache.plc4x.java.can.api.conversation.canopen.CANConversation;
diff --git a/sandbox/test-java-can-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver b/sandbox/test-java-can-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
index 3bbef56..9640d04 100644
--- a/sandbox/test-java-can-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
+++ b/sandbox/test-java-can-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
@@ -16,5 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.plc4x.java.can.CANPlcDriver
org.apache.plc4x.java.can.CANOpenPlcDriver
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenDriverSDOIT.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenDriverSDOIT.java
index 35db6d3..5caaf06 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenDriverSDOIT.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenDriverSDOIT.java
@@ -1,3 +1,21 @@
+/*
+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.can;
import org.apache.plc4x.test.driver.DriverTestsuiteRunner;
@@ -5,7 +23,7 @@ import org.apache.plc4x.test.driver.DriverTestsuiteRunner;
class CANOpenDriverSDOIT extends DriverTestsuiteRunner {
public CANOpenDriverSDOIT() {
- super("/testsuite/CANOpenDriverSDOIT.xml");
+ super("/protocols/can/CANOpenDriverSDOIT.xml");
}
}
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenPayloadTest.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenPayloadTest.java
index 8af4f2b..9a5a912 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenPayloadTest.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenPayloadTest.java
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
*/
-
package org.apache.plc4x.java.can;
import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
@@ -24,7 +23,7 @@ import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
public class CANOpenPayloadTest extends ParserSerializerTestsuiteRunner {
public CANOpenPayloadTest() {
- super("/testsuite/CANOpenPayloadTestSuite.xml");
+ super("/protocols/can/CANOpenPayloadTestSuite.xml");
}
}
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenWiresharkTest.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenWiresharkTest.java
index 3d1258a..a5376ff 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenWiresharkTest.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/CANOpenWiresharkTest.java
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
*/
-
package org.apache.plc4x.java.can;
import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
@@ -24,7 +23,7 @@ import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
public class CANOpenWiresharkTest extends ParserSerializerTestsuiteRunner {
public CANOpenWiresharkTest() {
- super("/testsuite/CANOpenWiresharkTestSuite.xml");
+ super("/protocols/can/CANOpenWiresharkTestSuite.xml");
}
}
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/ManualParserTest.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/ManualParserTest.java
index c055513..b2854ff 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/ManualParserTest.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/ManualParserTest.java
@@ -1,3 +1,21 @@
+/*
+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.can;
import org.apache.commons.codec.binary.Hex;
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCAN20ATest.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCAN20ATest.java
index 8d86d97..4666cef 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCAN20ATest.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCAN20ATest.java
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
*/
-
package org.apache.plc4x.java.can;
import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
@@ -24,7 +23,7 @@ import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
public class SocketCAN20ATest extends ParserSerializerTestsuiteRunner {
public SocketCAN20ATest() {
- super("/testsuite/SocketCAN20ATestSuite.xml");
+ super("/protocols/can/SocketCAN20ATestSuite.xml");
}
}
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCANTest.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCANTest.java
index 270b45a..52fe88c 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCANTest.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/SocketCANTest.java
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
*/
-
package org.apache.plc4x.java.can;
import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
@@ -24,7 +23,7 @@ import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
public class SocketCANTest extends ParserSerializerTestsuiteRunner {
public SocketCANTest() {
- super("/testsuite/SocketCANTestSuite.xml");
+ super("/protocols/can/SocketCANTestSuite.xml");
}
}
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenPDOFieldTest.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenPDOFieldTest.java
index 432f073..aa52f53 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenPDOFieldTest.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenPDOFieldTest.java
@@ -1,3 +1,21 @@
+/*
+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.can.field;
import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
diff --git a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenSDOFieldTest.java b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenSDOFieldTest.java
index 8065bdc..94a9ed8 100644
--- a/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenSDOFieldTest.java
+++ b/sandbox/test-java-can-driver/src/test/java/org/apache/plc4x/java/can/field/CANOpenSDOFieldTest.java
@@ -1,3 +1,21 @@
+/*
+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.can.field;
import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
diff --git a/src/site/asciidoc/users/protocols/can.adoc b/src/site/asciidoc/users/protocols/can.adoc
new file mode 100644
index 0000000..3e7c33f
--- /dev/null
+++ b/src/site/asciidoc/users/protocols/can.adoc
@@ -0,0 +1,119 @@
+//
+// 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.
+//
+:imagesdir: ../../images/users/protocols
+:icons: font
+
+== CAN
+=== Controller Area Network
+
+CAN is popular link layer standard which allows exchanging data between nodes and build multi-master applications.
+
+[cols="2,2a,5a"]
+|===
+|Name |Value |Description
+
+|Code
+2+|`canopen`
+
+|Name
+2+|CANopen (based on CAN 2.0A)
+
+|Maven Dependency
+2+|
+----
+<dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-driver-can</artifactId>
+ <version>{current-last-released-version}</version>
+</dependency>
+----
+
+|Default Transport:
+2+|`javacan`
+
+|Compatible Transports:
+2+| - `javacan`
+
+3+|Supported Operations
+
+| CANopen PDO
+| `read` / `write`
+| PDO messages are broadcasted to the bus and have to be mapped at application layer.
+
+| CANopen SDO
+| `read` / `write`
+| SDO are request/response conversations. Both read and write path is supported.
+
+|
+| `subscribe`
+| - Receiving PDO messages requires construction of valid subscription.
+- It is possible to subscribe to CANopen NMT messages.
+
+3+|Options
+
+|
+| `heartbeat`
+| Forces PLC4X to send CANopen heartbeat (NMT) messages to the bus.
+
+|
+| `nodeId`
+| CAN node identifier. Depending on used CAN version it might be 11 or 29 bit unsigned int.
+|===
+
+=== More details on
+
+CAN, despite (or due) to its popularity has ambiguous meaning.
+There are multiple articles and sources which attempts to give introduction, yet very few of them is consistent between each other.
+
+There are two dominant formats of frames - CAN 2.0A and 2.0B:
+
+- CAN 2.0A uses 11 bit identifier and up to 8 bytes of data.
+- CAN 2.0B uses 29 bit identifier and up to 64 bytes of data.
+
+To make things worse with introduction of CAN FD amount of combinations increased even more.
+Default transport used with this protocol is socketcan which is capable handling both.
+Currently, only 2.0A format (up to 8 bytes of data) is supported.
+
+Further reading:
+https://en.wikipedia.org/wiki/CAN_bus[https://en.wikipedia.org/wiki/CAN_bus]
+
+=== Address Format
+
+CANopen specification defines several groups of addresses dedicated to certain kind of operations.
+Critical services and message exchanges related with them have lower identifiers making them wining eventual bus access.
+
+
+[cols="1,1,2,4,1,1"]
+|===
+|Code | Short-Code |Name |Description |Size in bits | Supported PLC Types
+
+|===
+
+
+[cols="2,2,5a,2"]
+|===
+|Service |Name |Description |Supported PLC Types
+
+|C
+|COUNTERS
+|TODO: Document this
+|TODO: Document this
+
+|===
+
+
+