This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/plc4rs
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/feature/plc4rs by this push:
     new 4caf999a81 Add tsfile protocoll, enable constants in code generation
4caf999a81 is described below

commit 4caf999a814b576e9743def6633f654ff826f2ce
Author: julian <[email protected]>
AuthorDate: Mon Jun 6 15:05:57 2022 +0200

    Add tsfile protocoll, enable constants in code generation
---
 .../language/rust/RustLanguageTemplateHelper.java  |  24 +-
 .../templates/rust/complex-type-template.rs.ftlh   |   4 +
 plc4rust/tsfile/pom.xml                            | 201 ++++++++
 protocols/pom.xml                                  |   1 +
 protocols/tsfile/pom.xml                           |  43 ++
 .../plc4x/protocol/tsfile/TsFileProtocol.java      |  42 ++
 ...e.plc4x.plugins.codegenerator.protocol.Protocol |  19 +
 .../main/resources/protocols/tsfile/tsfile.mspec   |  54 +++
 .../plc4x/protocol/tsfile/ModbusProtocolTest.java  |  38 ++
 .../tsfile/src/test/resources/logback-test.xml     |  36 ++
 .../modbus/ascii/ParserSerializerTestsuite.xml     |  84 ++++
 .../modbus/rtu/ParserSerializerTestsuite.xml       |  84 ++++
 .../protocols/modbus/tcp/DriverTestsuite.xml       | 535 +++++++++++++++++++++
 .../modbus/tcp/ParserSerializerTestsuite.xml       | 258 ++++++++++
 .../modbus/tcp/manual-test-capture.pcapng          | Bin 0 -> 305032 bytes
 15 files changed, 1416 insertions(+), 7 deletions(-)

diff --git 
a/code-generation/language-rust/src/main/java/org/apache/plc4x/language/rust/RustLanguageTemplateHelper.java
 
b/code-generation/language-rust/src/main/java/org/apache/plc4x/language/rust/RustLanguageTemplateHelper.java
index b0fa81f165..3274980fc6 100644
--- 
a/code-generation/language-rust/src/main/java/org/apache/plc4x/language/rust/RustLanguageTemplateHelper.java
+++ 
b/code-generation/language-rust/src/main/java/org/apache/plc4x/language/rust/RustLanguageTemplateHelper.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.commons.text.WordUtils;
 import 
org.apache.plc4x.plugins.codegenerator.language.mspec.model.definitions.DefaultComplexTypeDefinition;
 import 
org.apache.plc4x.plugins.codegenerator.language.mspec.model.definitions.DefaultEnumTypeDefinition;
+import 
org.apache.plc4x.plugins.codegenerator.language.mspec.model.fields.DefaultConstField;
 import 
org.apache.plc4x.plugins.codegenerator.language.mspec.model.fields.DefaultDiscriminatorField;
 import 
org.apache.plc4x.plugins.codegenerator.language.mspec.model.fields.DefaultImplicitField;
 import 
org.apache.plc4x.plugins.codegenerator.language.mspec.model.fields.DefaultSwitchField;
@@ -369,6 +370,10 @@ public class RustLanguageTemplateHelper extends 
BaseFreemarkerLanguageTemplateHe
         TypeReference typeReference = field.getType();
         SimpleTypeReference simpleTypeReference;
         String fieldName = field.getName();
+        if (field instanceof DefaultConstField) {
+            TypeReference type = field.getType();
+            return this.generateSerializerCode(((SimpleTypeReference) 
typeReference), ((DefaultConstField) 
field).getReferenceValue().stringRepresentation());
+        }
         if (typeReference instanceof SimpleTypeReference) {
             simpleTypeReference = (SimpleTypeReference) typeReference;
         } else if (typeReference instanceof DefaultEnumTypeReference) {
@@ -403,29 +408,34 @@ public class RustLanguageTemplateHelper extends 
BaseFreemarkerLanguageTemplateHe
         }
         SimpleTypeReference.SimpleBaseType baseType;
         baseType = simpleTypeReference.getBaseType();
-        String argument = fieldName;
+        String argument = "self." + fieldName;
         if (field instanceof DefaultImplicitField) {
             argument = argument + "()";
         }
+        return this.generateSerializerCode(simpleTypeReference, argument);
+    }
+
+    private String generateSerializerCode(SimpleTypeReference 
simpleTypeReference, String argument) {
+        SimpleTypeReference.SimpleBaseType baseType = 
simpleTypeReference.getBaseType();
         switch (baseType) {
             case BIT:
-                return String.format("writer.write_bit(self.%s)?", argument);
+                return String.format("writer.write_bit(%s)?", argument);
             case UINT:
                 IntegerTypeReference unsignedIntegerTypeReference = 
(IntegerTypeReference) simpleTypeReference;
                 if (unsignedIntegerTypeReference.getSizeInBits() < 8) {
-                    return "writer.write_u_n(self." + 
unsignedIntegerTypeReference.getSizeInBits() + ", self." + argument + " as 
u64)? as u8";
+                    return "writer.write_u_n(" + 
unsignedIntegerTypeReference.getSizeInBits() + ", self." + argument + " as 
u64)? as u8";
                 }
                 if (unsignedIntegerTypeReference.getSizeInBits() == 8) {
-                    return "writer.write_u8(self." + argument + ")?";
+                    return "writer.write_u8(" + argument + ")?";
                 }
                 if (unsignedIntegerTypeReference.getSizeInBits() < 16) {
-                    return "writer.write_u_n(self." + 
unsignedIntegerTypeReference.getSizeInBits() + ", self." + argument + " as 
u64)? as u16";
+                    return "writer.write_u_n(" + 
unsignedIntegerTypeReference.getSizeInBits() + ", self." + argument + " as 
u64)? as u16";
                 }
                 if (unsignedIntegerTypeReference.getSizeInBits() == 16) {
-                    return "writer.write_u16(self." + argument + ")?";
+                    return "writer.write_u16(" + argument + ")?";
                 }
         }
-        throw new RuntimeException("Not implemented yet: " + typeReference);
+        throw new RuntimeException("Not implemented yet!");
     }
 
     public String getReadFunctionCall(TypeReference typeReference) {
diff --git 
a/code-generation/language-rust/src/main/resources/templates/rust/complex-type-template.rs.ftlh
 
b/code-generation/language-rust/src/main/resources/templates/rust/complex-type-template.rs.ftlh
index d4fd32c6ae..bfc84e4833 100644
--- 
a/code-generation/language-rust/src/main/resources/templates/rust/complex-type-template.rs.ftlh
+++ 
b/code-generation/language-rust/src/main/resources/templates/rust/complex-type-template.rs.ftlh
@@ -239,6 +239,10 @@ impl Message for ${type.name} {
         </#if>
     <#else>
         let ${field.name} = ${helper.getReadFunctionCall(field.type)};
+    <#if field.isConstField()>
+        // assert value of constant
+        assert!(${field.getReferenceValue().stringRepresentation()}, 
${field.name});
+    </#if>
     </#if>
     </#list>
         Ok(Self::M {
diff --git a/plc4rust/tsfile/pom.xml b/plc4rust/tsfile/pom.xml
new file mode 100644
index 0000000000..a7fc8ea744
--- /dev/null
+++ b/plc4rust/tsfile/pom.xml
@@ -0,0 +1,201 @@
+<?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</groupId>
+    <artifactId>plc4rust</artifactId>
+    <version>0.10.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>plc4rust-driver-tsfile</artifactId>
+  <name>PLC4RS: Driver: TsFile</name>
+  <description>Implementation of a PLC4X driver for the TsFile 
format.</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.plc4x.plugins</groupId>
+        <artifactId>plc4x-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>generate-driver</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>generate-driver</goal>
+            </goals>
+            <configuration>
+              <protocolName>tsfile</protocolName>
+              <languageName>rust</languageName>
+              <outputFlavor>read-write</outputFlavor>
+            </configuration>
+          </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>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+            
<Bundle-Activator>org.apache.plc4x.java.osgi.DriverActivator</Bundle-Activator>
+            
<Export-Service>org.apache.plc4x.java.api.PlcDriver,org.apache.plc4x.java.modbus.tcp.ModbusTcpDriver</Export-Service>
+            <Import-Package>
+              com.fasterxml.jackson.annotation;resolution:=optional,
+              *
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <configuration>
+          <usedDependencies combine.children="append">
+            
<usedDependency>org.apache.plc4x:plc4j-transport-serial</usedDependency>
+            
<usedDependency>org.apache.plc4x:plc4j-transport-raw-socket</usedDependency>
+            
<usedDependency>org.apache.plc4x:plc4x-code-generation-language-java</usedDependency>
+            
<usedDependency>org.apache.plc4x:plc4x-protocols-modbus</usedDependency>
+          </usedDependencies>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-api</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-spi</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-transport-tcp</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-transport-serial</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-transport-raw-socket</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-utils-raw-sockets</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-buffer</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.pcap4j</groupId>
+      <artifactId>pcap4j-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-utils-test-utils</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4x-code-generation-language-rust</artifactId>
+      <version>0.10.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-tsfile</artifactId>
+      <version>0.10.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-tsfile</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+      <classifier>tests</classifier>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/protocols/pom.xml b/protocols/pom.xml
index 62e70031b2..3931d478c1 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -51,6 +51,7 @@
     <module>s7</module>
     <module>simulated</module>
     <module>socketcan</module>
+    <module>tsfile</module>
   </modules>
 
   <build>
diff --git a/protocols/tsfile/pom.xml b/protocols/tsfile/pom.xml
new file mode 100644
index 0000000000..02e50b4600
--- /dev/null
+++ b/protocols/tsfile/pom.xml
@@ -0,0 +1,43 @@
+<?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</groupId>
+    <artifactId>plc4x-protocols</artifactId>
+    <version>0.10.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>plc4x-protocols-tsfile</artifactId>
+
+  <name>Protocols: TsFile</name>
+  <description>Base protocol specifications for the TsFile format</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4x-code-generation-protocol-base-mspec</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file
diff --git 
a/protocols/tsfile/src/main/java/org/apache/plc4x/protocol/tsfile/TsFileProtocol.java
 
b/protocols/tsfile/src/main/java/org/apache/plc4x/protocol/tsfile/TsFileProtocol.java
new file mode 100644
index 0000000000..0bfbbf40cd
--- /dev/null
+++ 
b/protocols/tsfile/src/main/java/org/apache/plc4x/protocol/tsfile/TsFileProtocol.java
@@ -0,0 +1,42 @@
+/*
+ * 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.protocol.tsfile;
+
+import 
org.apache.plc4x.plugins.codegenerator.language.mspec.parser.MessageFormatParser;
+import 
org.apache.plc4x.plugins.codegenerator.language.mspec.protocol.ProtocolHelpers;
+import 
org.apache.plc4x.plugins.codegenerator.language.mspec.protocol.ValidatableTypeContext;
+import org.apache.plc4x.plugins.codegenerator.protocol.Protocol;
+import org.apache.plc4x.plugins.codegenerator.protocol.TypeContext;
+import 
org.apache.plc4x.plugins.codegenerator.types.exceptions.GenerationException;
+
+public class TsFileProtocol implements Protocol, ProtocolHelpers {
+
+    @Override
+    public String getName() {
+        return "tsfile";
+    }
+
+    @Override
+    public TypeContext getTypeContext() throws GenerationException {
+        ValidatableTypeContext typeContext = new 
MessageFormatParser().parse(getMspecStream());
+        typeContext.validate();
+        return typeContext;
+    }
+
+}
diff --git 
a/protocols/tsfile/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
 
b/protocols/tsfile/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
new file mode 100644
index 0000000000..127c617092
--- /dev/null
+++ 
b/protocols/tsfile/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
@@ -0,0 +1,19 @@
+#
+# 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.protocol.tsfile.TsFileProtocol
diff --git a/protocols/tsfile/src/main/resources/protocols/tsfile/tsfile.mspec 
b/protocols/tsfile/src/main/resources/protocols/tsfile/tsfile.mspec
new file mode 100644
index 0000000000..04c9446bb8
--- /dev/null
+++ b/protocols/tsfile/src/main/resources/protocols/tsfile/tsfile.mspec
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+// Remark: The different fields are encoded in Big-endian.
+
+[enum ChunkHeaderMarker
+    ['0x05' ChunkHeader  ]
+]
+
+[enum TSDataType
+    ['0x05' INT32  ]
+]
+
+[enum CompressionType
+    ['0x00' UNCOMPRESSED]
+]
+
+[enum TSEncoding
+    ['0x00' PLAIN]
+]
+
+[type IoTDBString
+    [implicit uint 8 length 'COUNT(content)']
+    [array byte content count   'length']
+]
+
+[type ChunkGroupHeader
+    [const uint 8 marker 0x00]
+    [simple IoTDBString deviceId]
+]
+
+[type ChunkHeader(ChunkHeaderMarker marker)
+    [simple     IoTDBString     measurementId]
+    [simple     uint 8    dataSize]
+    [simple     TSDataType    dataType]
+    [simple     CompressionType    compression]
+    [simple     TSEncoding    encoding]
+]
\ No newline at end of file
diff --git 
a/protocols/tsfile/src/test/java/org/apache/plc4x/protocol/tsfile/ModbusProtocolTest.java
 
b/protocols/tsfile/src/test/java/org/apache/plc4x/protocol/tsfile/ModbusProtocolTest.java
new file mode 100644
index 0000000000..645e1bbbf0
--- /dev/null
+++ 
b/protocols/tsfile/src/test/java/org/apache/plc4x/protocol/tsfile/ModbusProtocolTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.protocol.tsfile;
+
+import org.apache.plc4x.plugins.codegenerator.protocol.TypeContext;
+import org.apache.plc4x.protocol.tsfile.TsFileProtocol;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
+class TsFileProtocolTest {
+
+//    @Test
+//    void getTypeContext() throws Exception {
+//        TypeContext typeContext = new TsFileProtocol().getTypeContext();
+//        assertNotNull(typeContext);
+//        assertNotNull(typeContext.getUnresolvedTypeReferences());
+//        assertSame(0, typeContext.getUnresolvedTypeReferences().size());
+//    }
+
+}
diff --git a/protocols/tsfile/src/test/resources/logback-test.xml 
b/protocols/tsfile/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..8c9990deaa
--- /dev/null
+++ b/protocols/tsfile/src/test/resources/logback-test.xml
@@ -0,0 +1,36 @@
+<?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.
+  -->
+<configuration xmlns="http://ch.qos.logback/xml/ns/logback";
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+               xsi:schemaLocation="
+                  http://ch.qos.logback/xml/ns/logback
+                  
https://raw.githubusercontent.com/enricopulatzo/logback-XSD/master/src/main/xsd/logback.xsd";>
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - 
%msg%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>
\ No newline at end of file
diff --git 
a/protocols/tsfile/src/test/resources/protocols/modbus/ascii/ParserSerializerTestsuite.xml
 
b/protocols/tsfile/src/test/resources/protocols/modbus/ascii/ParserSerializerTestsuite.xml
new file mode 100644
index 0000000000..7e305c236b
--- /dev/null
+++ 
b/protocols/tsfile/src/test/resources/protocols/modbus/ascii/ParserSerializerTestsuite.xml
@@ -0,0 +1,84 @@
+<?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/parser-serializer-testsuite.xsd";
+                byteOrder="BIG_ENDIAN">
+
+  <name>Modbus-ASCII</name>
+
+  <protocolName>modbus</protocolName>
+  <outputFlavor>read-write</outputFlavor>
+
+  <testcase>
+    <name>Read Holding Registers Request</name>
+    <raw>01030000000AF2</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_ASCII</driverType>
+      <response>false</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusAsciiADU>
+          <address dataType="uint" bitLength="8">1</address>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+              <ModbusPDUReadHoldingRegistersRequest>
+                <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                <quantity dataType="uint" bitLength="16">10</quantity>
+              </ModbusPDUReadHoldingRegistersRequest>
+            </ModbusPDU>
+          </pdu>
+          <crc dataType="uint" bitLength="8">242</crc>
+        </ModbusAsciiADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Read Holding Registers Response</name>
+    <raw>0103140000000000000000000000000000000000000000E8</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_ASCII</driverType>
+      <response>true</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusAsciiADU>
+          <address dataType="uint" bitLength="8">1</address>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+              <ModbusPDUReadHoldingRegistersResponse>
+                <byteCount dataType="uint" bitLength="8">20</byteCount>
+                <value dataType="byte" 
bitLength="160">0x0000000000000000000000000000000000000000</value>
+              </ModbusPDUReadHoldingRegistersResponse>
+            </ModbusPDU>
+          </pdu>
+          <crc dataType="uint" bitLength="8">232</crc>
+        </ModbusAsciiADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+</test:testsuite>
diff --git 
a/protocols/tsfile/src/test/resources/protocols/modbus/rtu/ParserSerializerTestsuite.xml
 
b/protocols/tsfile/src/test/resources/protocols/modbus/rtu/ParserSerializerTestsuite.xml
new file mode 100644
index 0000000000..e4aa7c8ee4
--- /dev/null
+++ 
b/protocols/tsfile/src/test/resources/protocols/modbus/rtu/ParserSerializerTestsuite.xml
@@ -0,0 +1,84 @@
+<?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/parser-serializer-testsuite.xsd";
+                byteOrder="BIG_ENDIAN">
+
+  <name>Modbus-ADU</name>
+
+  <protocolName>modbus</protocolName>
+  <outputFlavor>read-write</outputFlavor>
+
+  <testcase>
+    <name>Read Holding Registers Request</name>
+    <raw>01030000000ac5cd</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_RTU</driverType>
+      <response>false</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusRtuADU>
+          <address dataType="uint" bitLength="8">1</address>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+              <ModbusPDUReadHoldingRegistersRequest>
+                <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                <quantity dataType="uint" bitLength="16">10</quantity>
+              </ModbusPDUReadHoldingRegistersRequest>
+            </ModbusPDU>
+          </pdu>
+          <crc dataType="uint" bitLength="16">50637</crc>
+        </ModbusRtuADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Read Holding Registers Response</name>
+    <raw>0103140000000000000000000000000000000000000000a367</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_RTU</driverType>
+      <response>true</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusRtuADU>
+          <address dataType="uint" bitLength="8">1</address>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+              <ModbusPDUReadHoldingRegistersResponse>
+                <byteCount dataType="uint" bitLength="8">20</byteCount>
+                <value dataType="byte" 
bitLength="160">0x0000000000000000000000000000000000000000</value>
+              </ModbusPDUReadHoldingRegistersResponse>
+            </ModbusPDU>
+          </pdu>
+          <crc dataType="uint" bitLength="16">41831</crc>
+        </ModbusRtuADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+</test:testsuite>
diff --git 
a/protocols/tsfile/src/test/resources/protocols/modbus/tcp/DriverTestsuite.xml 
b/protocols/tsfile/src/test/resources/protocols/modbus/tcp/DriverTestsuite.xml
new file mode 100644
index 0000000000..309e271d63
--- /dev/null
+++ 
b/protocols/tsfile/src/test/resources/protocols/modbus/tcp/DriverTestsuite.xml
@@ -0,0 +1,535 @@
+<?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:driver-testsuite 
xmlns:test="https://plc4x.apache.org/schemas/driver-testsuite.xsd";
+                       byteOrder="BIG_ENDIAN">
+
+  <!-- https://base64.guru/converter/encode/hex -->
+
+  <name>Modbus</name>
+
+  <protocolName>modbus</protocolName>
+  <outputFlavor>read-write</outputFlavor>
+
+  <driver-name>modbus-tcp</driver-name>
+
+  <testcase>
+    <name>Single element read request</name>
+    <steps>
+      <api-request name="Receive Read Request from application">
+        <TestReadRequest>
+          <fields>
+            <field 
className="org.apache.plc4x.test.driver.internal.api.TestField">
+              <name>hurz</name>
+              <address>holding-register:1:REAL</address>
+            </field>
+          </fields>
+        </TestReadRequest>
+      </api-request>
+      <outgoing-plc-message name="Send Modbus Input-Register Read Request">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>false</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">6</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersRequest>
+                  <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                  <quantity dataType="uint" bitLength="16">2</quantity>
+                </ModbusPDUReadHoldingRegistersRequest>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </outgoing-plc-message>
+      <incoming-plc-message name="Receive Modbus Input-Register Read Response">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>true</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">7</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersResponse>
+                  <byteCount dataType="uint" bitLength="8">4</byteCount>
+                  <value dataType="byte" bitLength="32">0x40490fdb</value>
+                </ModbusPDUReadHoldingRegistersResponse>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </incoming-plc-message>
+      <api-response name="Report Read Response to application">
+        <PlcReadResponse>
+          <PlcReadRequest>
+            <fields>
+              <hurz>
+                <ModbusFieldHoldingRegister>
+                  <address dataType="uint" bitLength="16">0</address>
+                  <numberOfElements dataType="uint" 
bitLength="16">1</numberOfElements>
+                  <dataType dataType="string" bitLength="32" 
encoding="UTF-8">REAL</dataType>
+                </ModbusFieldHoldingRegister>
+              </hurz>
+            </fields>
+          </PlcReadRequest>
+          <values>
+            <hurz>
+              <ResponseItem>
+                <result dataType="string" bitLength="16" 
encoding="UTF-8">OK</result>
+                <PlcREAL dataType="float" 
bitLength="32">3.1415927410125732</PlcREAL>
+              </ResponseItem>
+            </hurz>
+          </values>
+        </PlcReadResponse>
+      </api-response>
+    </steps>
+  </testcase>
+
+  <testcase>
+    <name>Array element read request</name>
+    <steps>
+      <api-request name="Receive Read Request from application">
+        <TestReadRequest>
+          <fields>
+            <field 
className="org.apache.plc4x.test.driver.internal.api.TestField">
+              <name>hurz</name>
+              <address>holding-register:1:REAL[2]</address>
+            </field>
+          </fields>
+        </TestReadRequest>
+      </api-request>
+      <outgoing-plc-message name="Send Modbus Input-Register Read Request">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>false</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">6</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersRequest>
+                  <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                  <quantity dataType="uint" bitLength="16">4</quantity>
+                </ModbusPDUReadHoldingRegistersRequest>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </outgoing-plc-message>
+      <incoming-plc-message name="Receive Modbus Input-Register Read Response">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>true</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">11</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersResponse>
+                  <byteCount dataType="uint" bitLength="8">8</byteCount>
+                  <value dataType="byte" 
bitLength="64">0x40490fdb40490fdb</value>
+                </ModbusPDUReadHoldingRegistersResponse>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </incoming-plc-message>
+      <api-response name="Report Read Response to application">
+        <PlcReadResponse>
+          <PlcReadRequest>
+            <fields>
+              <hurz>
+                <ModbusFieldHoldingRegister>
+                  <address dataType="uint" bitLength="16">0</address>
+                  <numberOfElements dataType="uint" 
bitLength="16">2</numberOfElements>
+                  <dataType dataType="string" bitLength="32" 
encoding="UTF-8">REAL</dataType>
+                </ModbusFieldHoldingRegister>
+              </hurz>
+            </fields>
+          </PlcReadRequest>
+          <values>
+            <hurz>
+              <ResponseItem>
+                <result dataType="string" bitLength="16" 
encoding="UTF-8">OK</result>
+                <PlcList>
+                  <PlcREAL dataType="float" 
bitLength="32">3.1415927410125732</PlcREAL>
+                  <PlcREAL dataType="float" 
bitLength="32">3.1415927410125732</PlcREAL>
+                </PlcList>
+              </ResponseItem>
+            </hurz>
+          </values>
+        </PlcReadResponse>
+      </api-response>
+    </steps>
+  </testcase>
+
+  <testcase>
+    <name>Multi element read request</name>
+    <steps>
+      <api-request name="Receive Read Request from application">
+        <TestReadRequest>
+          <fields>
+            <field 
className="org.apache.plc4x.test.driver.internal.api.TestField">
+              <name>hurz1</name>
+              <address>holding-register:1:REAL</address>
+            </field>
+            <field 
className="org.apache.plc4x.test.driver.internal.api.TestField">
+              <name>hurz2</name>
+              <address>holding-register:3:REAL</address>
+            </field>
+          </fields>
+        </TestReadRequest>
+      </api-request>
+      <outgoing-plc-message name="Send First Item Modbus Input-Register Read 
Request">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>false</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">6</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersRequest>
+                  <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                  <quantity dataType="uint" bitLength="16">2</quantity>
+                </ModbusPDUReadHoldingRegistersRequest>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </outgoing-plc-message>
+      <incoming-plc-message name="Receive First Item Modbus Input-Register 
Read Response">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>true</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">7</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersResponse>
+                  <byteCount dataType="uint" bitLength="8">4</byteCount>
+                  <value dataType="byte" bitLength="32">0x40490fdb</value>
+                </ModbusPDUReadHoldingRegistersResponse>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </incoming-plc-message>
+      <outgoing-plc-message name="Send Second Item Modbus Input-Register Read 
Request">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>false</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">2</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">6</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersRequest>
+                  <startingAddress dataType="uint" 
bitLength="16">2</startingAddress>
+                  <quantity dataType="uint" bitLength="16">2</quantity>
+                </ModbusPDUReadHoldingRegistersRequest>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </outgoing-plc-message>
+      <incoming-plc-message name="Receive Second Item Modbus Input-Register 
Read Response">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>true</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">2</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">7</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">3</functionFlag>
+                <ModbusPDUReadHoldingRegistersResponse>
+                  <byteCount dataType="uint" bitLength="8">4</byteCount>
+                  <value dataType="byte" bitLength="32">0x40490fdb</value>
+                </ModbusPDUReadHoldingRegistersResponse>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </incoming-plc-message>
+      <api-response name="Report Read Response to application">
+        <PlcReadResponse>
+          <PlcReadRequest>
+            <fields>
+              <hurz1>
+                <ModbusFieldHoldingRegister>
+                  <address dataType="uint" bitLength="16">0</address>
+                  <numberOfElements dataType="uint" 
bitLength="16">1</numberOfElements>
+                  <dataType dataType="string" bitLength="32" 
encoding="UTF-8">REAL</dataType>
+                </ModbusFieldHoldingRegister>
+              </hurz1>
+              <hurz2>
+                <ModbusFieldHoldingRegister>
+                  <address dataType="uint" bitLength="16">2</address>
+                  <numberOfElements dataType="uint" 
bitLength="16">1</numberOfElements>
+                  <dataType dataType="string" bitLength="32" 
encoding="UTF-8">REAL</dataType>
+                </ModbusFieldHoldingRegister>
+              </hurz2>
+            </fields>
+          </PlcReadRequest>
+          <values>
+            <hurz1>
+              <ResponseItem>
+                <result dataType="string" bitLength="16" 
encoding="UTF-8">OK</result>
+                <PlcREAL dataType="float" 
bitLength="32">3.1415927410125732</PlcREAL>
+              </ResponseItem>
+            </hurz1>
+            <hurz2>
+              <ResponseItem>
+                <result dataType="string" bitLength="16" 
encoding="UTF-8">OK</result>
+                <PlcREAL dataType="float" 
bitLength="32">3.1415927410125732</PlcREAL>
+              </ResponseItem>
+            </hurz2>
+          </values>
+        </PlcReadResponse>
+      </api-response>
+    </steps>
+  </testcase>
+
+  <testcase>
+    <name>Single element write request</name>
+    <steps>
+      <api-request name="Receive Write Request from application">
+        <TestWriteRequest>
+          <fields>
+            <field 
className="org.apache.plc4x.test.driver.internal.api.TestValueField">
+              <name>hurz</name>
+              <address>holding-register:1:REAL</address>
+              <value>3.1415927</value>
+            </field>
+          </fields>
+        </TestWriteRequest>
+      </api-request>
+      <outgoing-plc-message name="Send Modbus Input-Register Write Request">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>false</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">11</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">16</functionFlag>
+                <ModbusPDUWriteMultipleHoldingRegistersRequest>
+                  <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                  <quantity dataType="uint" bitLength="16">2</quantity>
+                  <byteCount dataType="uint" bitLength="8">4</byteCount>
+                  <value dataType="byte" bitLength="32">0x40490fdb</value>
+                </ModbusPDUWriteMultipleHoldingRegistersRequest>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </outgoing-plc-message>
+      <incoming-plc-message name="Receive Modbus Input-Register Write 
Response">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>true</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">6</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">16</functionFlag>
+                <ModbusPDUWriteMultipleHoldingRegistersResponse>
+                  <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                  <quantity dataType="uint" bitLength="16">2</quantity>
+                </ModbusPDUWriteMultipleHoldingRegistersResponse>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </incoming-plc-message>
+      <api-response name="Report Write Response to application">
+        <PlcWriteResponse>
+          <PlcWriteRequest>
+            <fields>
+              <hurz>
+                <ModbusFieldHoldingRegister>
+                  <address dataType="uint" bitLength="16">0</address>
+                  <numberOfElements dataType="uint" 
bitLength="16">1</numberOfElements>
+                  <dataType dataType="string" bitLength="32" 
encoding="UTF-8">REAL</dataType>
+                </ModbusFieldHoldingRegister>
+                <value dataType="string" bitLength="72" 
encoding="UTF-8">3.1415927</value>
+              </hurz>
+            </fields>
+          </PlcWriteRequest>
+          <fields>
+            <hurz dataType="string" bitLength="16" encoding="UTF-8">OK</hurz>
+          </fields>
+        </PlcWriteResponse>
+      </api-response>
+    </steps>
+  </testcase>
+
+  <testcase>
+    <name>Array element write request</name>
+    <steps>
+      <api-request name="Receive Write Request from application">
+        <TestWriteRequest>
+          <fields>
+            <field 
className="org.apache.plc4x.test.driver.internal.api.TestValueField">
+              <name>hurz</name>
+              <address>holding-register:1:REAL[2]</address>
+              <value>3.1415927</value>
+              <value>3.1415927</value>
+            </field>
+          </fields>
+        </TestWriteRequest>
+      </api-request>
+      <outgoing-plc-message name="Send Modbus Input-Register Write Request">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>false</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">15</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">16</functionFlag>
+                <ModbusPDUWriteMultipleHoldingRegistersRequest>
+                  <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                  <quantity dataType="uint" bitLength="16">4</quantity>
+                  <byteCount dataType="uint" bitLength="8">8</byteCount>
+                  <value dataType="byte" 
bitLength="64">0x40490fdb40490fdb</value>
+                </ModbusPDUWriteMultipleHoldingRegistersRequest>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </outgoing-plc-message>
+      <incoming-plc-message name="Receive Modbus Input-Register Write 
Response">
+        <parser-arguments>
+          <driverType>MODBUS_TCP</driverType>
+          <response>true</response>
+        </parser-arguments>
+        <ModbusADU>
+          <ModbusTcpADU>
+            <transactionIdentifier dataType="uint" 
bitLength="16">1</transactionIdentifier>
+            <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+            <length dataType="uint" bitLength="16">6</length>
+            <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+            <pdu>
+              <ModbusPDU>
+                <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+                <functionFlag dataType="uint" bitLength="7">16</functionFlag>
+                <ModbusPDUWriteMultipleHoldingRegistersResponse>
+                  <startingAddress dataType="uint" 
bitLength="16">0</startingAddress>
+                  <quantity dataType="uint" bitLength="16">4</quantity>
+                </ModbusPDUWriteMultipleHoldingRegistersResponse>
+              </ModbusPDU>
+            </pdu>
+          </ModbusTcpADU>
+        </ModbusADU>
+      </incoming-plc-message>
+      <api-response name="Report Write Response to application">
+        <PlcWriteResponse>
+          <PlcWriteRequest>
+            <fields>
+              <hurz>
+                <ModbusFieldHoldingRegister>
+                  <address dataType="uint" bitLength="16">0</address>
+                  <numberOfElements dataType="uint" 
bitLength="16">2</numberOfElements>
+                  <dataType dataType="string" bitLength="32" 
encoding="UTF-8">REAL</dataType>
+                </ModbusFieldHoldingRegister>
+                <value dataType="string" bitLength="72" 
encoding="UTF-8">3.1415927</value>
+                <value dataType="string" bitLength="72" 
encoding="UTF-8">3.1415927</value>
+              </hurz>
+            </fields>
+          </PlcWriteRequest>
+          <fields>
+            <hurz dataType="string" bitLength="16" encoding="UTF-8">OK</hurz>
+          </fields>
+        </PlcWriteResponse>
+      </api-response>
+    </steps>
+  </testcase>
+
+</test:driver-testsuite>
diff --git 
a/protocols/tsfile/src/test/resources/protocols/modbus/tcp/ParserSerializerTestsuite.xml
 
b/protocols/tsfile/src/test/resources/protocols/modbus/tcp/ParserSerializerTestsuite.xml
new file mode 100644
index 0000000000..9463e1cc67
--- /dev/null
+++ 
b/protocols/tsfile/src/test/resources/protocols/modbus/tcp/ParserSerializerTestsuite.xml
@@ -0,0 +1,258 @@
+<?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/parser-serializer-testsuite.xsd";
+                byteOrder="BIG_ENDIAN">
+
+  <name>Modbus</name>
+
+  <protocolName>modbus</protocolName>
+  <outputFlavor>read-write</outputFlavor>
+
+  <testcase>
+    <name>Read Input Registers Request</name>
+    <raw>000000000006ff0408d20002</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_TCP</driverType>
+      <response>false</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusTcpADU>
+          <transactionIdentifier dataType="uint" 
bitLength="16">0</transactionIdentifier>
+          <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+          <length dataType="uint" bitLength="16">6</length>
+          <unitIdentifier dataType="uint" bitLength="8">255</unitIdentifier>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">4</functionFlag>
+              <ModbusPDUReadInputRegistersRequest>
+                <startingAddress dataType="uint" 
bitLength="16">2258</startingAddress>
+                <quantity dataType="uint" bitLength="16">2</quantity>
+              </ModbusPDUReadInputRegistersRequest>
+            </ModbusPDU>
+          </pdu>
+        </ModbusTcpADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Read Input Registers Response</name>
+    <raw>
+      
7cfe000000c9ff04c600000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000004000000000000000000000000000001db000001d600004a380000000000000000000000000000000000000000000000000000000000006461696d006e0000000000000000000000000000303100300000000000000000000000000000000000000000000000000000000000000000000000000000
+    </raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_TCP</driverType>
+      <response>true</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusTcpADU>
+          <transactionIdentifier dataType="uint" 
bitLength="16">31998</transactionIdentifier>
+          <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+          <length dataType="uint" bitLength="16">201</length>
+          <unitIdentifier dataType="uint" bitLength="8">255</unitIdentifier>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">4</functionFlag>
+              <ModbusPDUReadInputRegistersResponse>
+                <byteCount dataType="uint" bitLength="8">198</byteCount>
+                <value dataType="byte" 
bitLength="1584">0x00000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000004000000000000000000000000000001db000001d600004a380000000000000000000000000000000000000000000000000000000000006461696d006e0000000000000000000000000000303100300000000000000000000000000000000000000000000000000000000000000000000000000000</value>
+              </ModbusPDUReadInputRegistersResponse>
+            </ModbusPDU>
+          </pdu>
+        </ModbusTcpADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Read Extended Registers Request Split File Record</name>
+    <raw>000a0000001101140e060003270e000206000400000008</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_TCP</driverType>
+      <response>false</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusTcpADU>
+          <transactionIdentifier dataType="uint" 
bitLength="16">10</transactionIdentifier>
+          <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+          <length dataType="uint" bitLength="16">17</length>
+          <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">20</functionFlag>
+              <ModbusPDUReadFileRecordRequest>
+                <byteCount dataType="uint" bitLength="8">14</byteCount>
+                <items isList="true">
+                  <ModbusPDUReadFileRecordRequestItem>
+                    <referenceType dataType="uint" 
bitLength="8">6</referenceType>
+                    <fileNumber dataType="uint" bitLength="16">3</fileNumber>
+                    <recordNumber dataType="uint" 
bitLength="16">9998</recordNumber>
+                    <recordLength dataType="uint" 
bitLength="16">2</recordLength>
+                  </ModbusPDUReadFileRecordRequestItem>
+                  <ModbusPDUReadFileRecordRequestItem>
+                    <referenceType dataType="uint" 
bitLength="8">6</referenceType>
+                    <fileNumber dataType="uint" bitLength="16">4</fileNumber>
+                    <recordNumber dataType="uint" 
bitLength="16">0</recordNumber>
+                    <recordLength dataType="uint" 
bitLength="16">8</recordLength>
+                  </ModbusPDUReadFileRecordRequestItem>
+                </items>
+              </ModbusPDUReadFileRecordRequest>
+            </ModbusPDU>
+          </pdu>
+        </ModbusTcpADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Read Extended Registers Response Split File Record</name>
+    
<raw>000a0000001b011418050600000000110600000000000000000000000000000000</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_TCP</driverType>
+      <response>true</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusTcpADU>
+          <transactionIdentifier dataType="uint" 
bitLength="16">10</transactionIdentifier>
+          <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+          <length dataType="uint" bitLength="16">27</length>
+          <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">20</functionFlag>
+              <ModbusPDUReadFileRecordResponse>
+                <byteCount dataType="uint" bitLength="8">24</byteCount>
+                <items isList="true">
+                  <ModbusPDUReadFileRecordResponseItem>
+                    <dataLength dataType="uint" bitLength="8">5</dataLength>
+                    <referenceType dataType="uint" 
bitLength="8">6</referenceType>
+                    <data dataType="byte" bitLength="32">0x00000000</data>
+                  </ModbusPDUReadFileRecordResponseItem>
+                  <ModbusPDUReadFileRecordResponseItem>
+                    <dataLength dataType="uint" bitLength="8">17</dataLength>
+                    <referenceType dataType="uint" 
bitLength="8">6</referenceType>
+                    <data dataType="byte" 
bitLength="128">0x00000000000000000000000000000000</data>
+                  </ModbusPDUReadFileRecordResponseItem>
+                </items>
+              </ModbusPDUReadFileRecordResponse>
+            </ModbusPDU>
+          </pdu>
+        </ModbusTcpADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Write Extended Registers Request File Record</name>
+
+    <raw>000a0000000c011509060002000000010008</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_TCP</driverType>
+      <response>false</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusTcpADU>
+          <transactionIdentifier dataType="uint" 
bitLength="16">10</transactionIdentifier>
+          <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+          <length dataType="uint" bitLength="16">12</length>
+          <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">21</functionFlag>
+              <ModbusPDUWriteFileRecordRequest>
+                <byteCount dataType="uint" bitLength="8">9</byteCount>
+                <items isList="true">
+                  <ModbusPDUWriteFileRecordRequestItem>
+                    <referenceType dataType="uint" 
bitLength="8">6</referenceType>
+                    <fileNumber dataType="uint" bitLength="16">2</fileNumber>
+                    <recordNumber dataType="uint" 
bitLength="16">0</recordNumber>
+                    <recordLength dataType="uint" 
bitLength="16">1</recordLength>
+                    <recordData dataType="byte" 
bitLength="16">0x0008</recordData>
+                  </ModbusPDUWriteFileRecordRequestItem>
+                </items>
+              </ModbusPDUWriteFileRecordRequest>
+            </ModbusPDU>
+          </pdu>
+        </ModbusTcpADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Write Extended Registers Request Split File Record</name>
+    <raw>000a00000015011512060001270F00010000060002000000010000</raw>
+    <root-type>ModbusADU</root-type>
+    <parser-arguments>
+      <driverType>MODBUS_TCP</driverType>
+      <response>false</response>
+    </parser-arguments>
+    <xml>
+      <ModbusADU>
+        <ModbusTcpADU>
+          <transactionIdentifier dataType="uint" 
bitLength="16">10</transactionIdentifier>
+          <protocolIdentifier dataType="uint" 
bitLength="16">0</protocolIdentifier>
+          <length dataType="uint" bitLength="16">21</length>
+          <unitIdentifier dataType="uint" bitLength="8">1</unitIdentifier>
+          <pdu>
+            <ModbusPDU>
+              <errorFlag dataType="bit" bitLength="1">false</errorFlag>
+              <functionFlag dataType="uint" bitLength="7">21</functionFlag>
+              <ModbusPDUWriteFileRecordRequest>
+                <byteCount dataType="uint" bitLength="8">18</byteCount>
+                <items isList="true">
+                  <ModbusPDUWriteFileRecordRequestItem>
+                    <referenceType dataType="uint" 
bitLength="8">6</referenceType>
+                    <fileNumber dataType="uint" bitLength="16">1</fileNumber>
+                    <recordNumber dataType="uint" 
bitLength="16">9999</recordNumber>
+                    <recordLength dataType="uint" 
bitLength="16">1</recordLength>
+                    <recordData dataType="byte" 
bitLength="16">0x0000</recordData>
+                  </ModbusPDUWriteFileRecordRequestItem>
+                  <ModbusPDUWriteFileRecordRequestItem>
+                    <referenceType dataType="uint" 
bitLength="8">6</referenceType>
+                    <fileNumber dataType="uint" bitLength="16">2</fileNumber>
+                    <recordNumber dataType="uint" 
bitLength="16">0</recordNumber>
+                    <recordLength dataType="uint" 
bitLength="16">1</recordLength>
+                    <recordData dataType="byte" 
bitLength="16">0x0000</recordData>
+                  </ModbusPDUWriteFileRecordRequestItem>
+                </items>
+              </ModbusPDUWriteFileRecordRequest>
+            </ModbusPDU>
+          </pdu>
+        </ModbusTcpADU>
+      </ModbusADU>
+    </xml>
+  </testcase>
+
+</test:testsuite>
diff --git 
a/protocols/tsfile/src/test/resources/protocols/modbus/tcp/manual-test-capture.pcapng
 
b/protocols/tsfile/src/test/resources/protocols/modbus/tcp/manual-test-capture.pcapng
new file mode 100644
index 0000000000..6d0a10e055
Binary files /dev/null and 
b/protocols/tsfile/src/test/resources/protocols/modbus/tcp/manual-test-capture.pcapng
 differ

Reply via email to