You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/06/23 09:47:19 UTC

[plc4x] branch develop updated: - Implemented the "typeSwitch" field in the serializer which was still commented out (And did all the required adjustments this mace necessary)

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

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new f8a7ed9  - Implemented the "typeSwitch" field in the serializer which was still commented out (And did all the required adjustments this mace necessary)
f8a7ed9 is described below

commit f8a7ed98283eca7f92cbd5ad62d89a647a3eebf9
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Jun 23 11:47:12 2020 +0200

    - Implemented the "typeSwitch" field in the serializer which was still commented out (And did all the required adjustments this mace necessary)
---
 .../plc4x/language/c/CLanguageTemplateHelper.java  |  42 +-
 .../resources/templates/c/pojo-template-c.ftlh     | 170 +++---
 .../generated-sources/modbus/src/modbus_pdu.c      | 646 +++++++++++++++++++++
 .../plc4c/generated-sources/s7/src/cotp_packet.c   | 124 ++++
 .../generated-sources/s7/src/cotp_parameter.c      |  63 ++
 .../plc4c/generated-sources/s7/src/s7_address.c    |  48 ++
 .../plc4c/generated-sources/s7/src/s7_message.c    |  48 ++
 .../plc4c/generated-sources/s7/src/s7_parameter.c  | 115 ++++
 .../s7/src/s7_parameter_user_data_item.c           |  60 ++
 .../plc4c/generated-sources/s7/src/s7_payload.c    |  76 +++
 .../s7/src/s7_payload_user_data_item.c             |  43 +-
 .../s7/src/s7_var_payload_data_item.c              |  10 +-
 .../s7/src/s7_var_payload_status_item.c            |   5 +-
 .../s7/src/s7_var_request_parameter_item.c         |  21 +
 sandbox/plc4c/generated-sources/s7/src/szl_id.c    |  10 +-
 .../spi/include/plc4c/spi/evaluation_helper.h      |   2 +
 16 files changed, 1381 insertions(+), 102 deletions(-)

diff --git a/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java b/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
index fe623ac..5f7eb15 100644
--- a/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
+++ b/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
@@ -485,7 +485,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
                     ComplexTypeDefinition lengthType;
                     String lengthExpression;
                     if(variableLiteral.getName().equals("lengthInBytes")) {
-                        lengthType = baseType;
+                        lengthType = (baseType.getParentType() == null) ? baseType : (ComplexTypeDefinition) baseType.getParentType();
                         lengthExpression = "_message";
                     } else {
                         final Optional<TypeReference> typeReferenceForProperty = getTypeReferenceForProperty(baseType, variableLiteral.getName());
@@ -496,9 +496,10 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
                         lengthExpression = variableExpressionGenerator.apply(term);
                     }
                     return "plc4c_" + getCTypeName(lengthType.getName()) + "_length_in_bytes(" + lengthExpression + ")";
-                }
+                } else if (variableLiteral.getName().equals("lastItem")) {
+                    return "lastItem";
                 // If this literal references an Enum type, then we have to output it differently.
-                else if (getTypeDefinitions().get(variableLiteral.getName()) instanceof EnumTypeDefinition) {
+                } else if (getTypeDefinitions().get(variableLiteral.getName()) instanceof EnumTypeDefinition) {
                     return variableLiteral.getName() + "." + variableLiteral.getChild().getName();
                 } else {
                     return variableExpressionGenerator.apply(term);
@@ -572,10 +573,10 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
                 if(castType.getParentType() != null) {
                     // Change the name of the property to contain the sub-type-prefix.
                     sb.append("->").append(camelCaseToSnakeCase(castType.getName())).append("_");
-                    appendVariableExpressionRest(sb, vl.getChild());
+                    appendVariableExpressionRest(sb, baseType, vl.getChild());
                 } else {
                     sb.append("->");
-                    appendVariableExpressionRest(sb, vl.getChild());
+                    appendVariableExpressionRest(sb, (ComplexTypeDefinition) castType, vl.getChild());
                 }
             }
             return sb.toString();
@@ -602,7 +603,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
             }
             if(vl.getChild() != null) {
                 sb.append(".");
-                appendVariableExpressionRest(sb, vl.getChild());
+                appendVariableExpressionRest(sb, baseType, vl.getChild());
             }
             return sb.toString();
         }
@@ -658,7 +659,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
         StringBuilder sb = new StringBuilder(vl.getName());
         if(vl.getChild() != null) {
             sb.append(".");
-            appendVariableExpressionRest(sb, vl.getChild());
+            appendVariableExpressionRest(sb, baseType, vl.getChild());
         }
         return sb.toString();
     }
@@ -695,7 +696,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
                         sb.append(va.getName());
                         if(va.getChild() != null) {
                             sb.append(".");
-                            appendVariableExpressionRest(sb, va.getChild());
+                            appendVariableExpressionRest(sb, baseType, va.getChild());
                         }
                     } else if (isTypeArg) {
                         String part = va.getChild().getName();
@@ -758,7 +759,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
                             sb.append(va.getName());
                             if(va.getChild() != null) {
                                 sb.append(".");
-                                appendVariableExpressionRest(sb, va.getChild());
+                                appendVariableExpressionRest(sb, baseType, va.getChild());
                             }
                         } else if (isTypeArg) {
                             String part = va.getChild().getName();
@@ -811,7 +812,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
             StringBuilder sb = new StringBuilder(vl.getName());
             if(vl.getChild() != null) {
                 sb.append(".");
-                appendVariableExpressionRest(sb, vl.getChild());
+                appendVariableExpressionRest(sb, baseType, vl.getChild());
             }
             return sb.toString();
         } else if (isTypeArg) {
@@ -839,12 +840,15 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
             }
         } else {
             StringBuilder sb = new StringBuilder("_message->");
-            appendVariableExpressionRest(sb, vl);
+            if(baseType != getThisTypeDefinition()) {
+                sb.append(camelCaseToSnakeCase(baseType.getName())).append("_");
+            }
+            appendVariableExpressionRest(sb, baseType, vl);
             return sb.toString();
         }
     }
 
-    private void appendVariableExpressionRest(StringBuilder sb, VariableLiteral vl) {
+    private void appendVariableExpressionRest(StringBuilder sb, ComplexTypeDefinition baseType, VariableLiteral vl) {
         if(vl.isIndexed()) {
             sb.insert(0, "plc4c_utils_list_get(");
             sb.append(camelCaseToSnakeCase(vl.getName()));
@@ -855,7 +859,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
         // Suppress any "lengthInBytes" properties as these are handled differently in C
         if((vl.getChild() != null) && !vl.getChild().getName().equals("lengthInBytes")) {
             sb.append(".");
-            appendVariableExpressionRest(sb, vl.getChild());
+            appendVariableExpressionRest(sb, baseType, vl.getChild());
         }
     }
 
@@ -901,6 +905,18 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
         return serializerArguments;
     }
 
+    public List<Term> getSerializerTerms(Term[] terms) {
+        List<Term> serializerTerms = new LinkedList<>();
+        if(terms != null) {
+            for (Term term : terms) {
+                if (term.contains("lastItem")) {
+                    serializerTerms.add(term);
+                }
+            }
+        }
+        return serializerTerms;
+    }
+
     public String getLengthInBitsFunctionNameForComplexTypedField(Field field) {
         if(field instanceof TypedField) {
             TypedField typedField = (TypedField) field;
diff --git a/build-utils/language-c/src/main/resources/templates/c/pojo-template-c.ftlh b/build-utils/language-c/src/main/resources/templates/c/pojo-template-c.ftlh
index ba01fd7..0015d51 100644
--- a/build-utils/language-c/src/main/resources/templates/c/pojo-template-c.ftlh
+++ b/build-utils/language-c/src/main/resources/templates/c/pojo-template-c.ftlh
@@ -346,66 +346,69 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
         <#case "array">
             <#assign arrayField = field>
 
-<#if indentContent>  </#if>  // Array field (${arrayField.name})
-<#if indentContent>  </#if>  {
-<#if indentContent>  </#if>    uint8_t itemCount = plc4c_utils_list_size(_message-><@fieldName baseType=baseType field=arrayField/>);
-<#if indentContent>  </#if>    for(int curItem = 0; curItem < itemCount; curItem++) {
+<#if indentContent>    </#if>  // Array field (${arrayField.name})
+<#if indentContent>    </#if>  {
+<#if indentContent>    </#if>    uint8_t itemCount = plc4c_utils_list_size(_message-><@fieldName baseType=baseType field=arrayField/>);
+<#if indentContent>    </#if>    for(int curItem = 0; curItem < itemCount; curItem++) {
             <#-- When parsing simple types, there is nothing that could require the "lastItem" -->
-<#if !helper.isSimpleTypeReference(arrayField.type)><#if indentContent>  </#if>      bool lastItem = curItem == (itemCount - 1);</#if>
-<#if indentContent>  </#if>      ${helper.getLanguageTypeNameForTypeReference(arrayField.type)}* _value = (${helper.getLanguageTypeNameForTypeReference(arrayField.type)}*) plc4c_utils_list_get_value(_message-><@fieldName baseType=baseType field=arrayField/>, curItem);
+<#if !helper.isSimpleTypeReference(arrayField.type)><#if indentContent>    </#if>      bool lastItem = curItem == (itemCount - 1);</#if>
+<#if indentContent>    </#if>      ${helper.getLanguageTypeNameForTypeReference(arrayField.type)}* _value = (${helper.getLanguageTypeNameForTypeReference(arrayField.type)}*) plc4c_utils_list_get_value(_message-><@fieldName baseType=baseType field=arrayField/>, curItem);
             <#if helper.isSimpleTypeReference(arrayField.type)>
-<#if indentContent>  </#if>      ${helper.getWriteBufferWriteMethodCall(arrayField.type, "*_value")};
+<#if indentContent>    </#if>      ${helper.getWriteBufferWriteMethodCall(arrayField.type, "*_value")};
             <#else>
-<#if indentContent>  </#if>      plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_serialize(buf, (void*) &_value);
-<#if indentContent>  </#if>      if(_res != OK) {
-<#if indentContent>  </#if>        return _res;
-<#if indentContent>  </#if>      }
+<#if indentContent>    </#if>      plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_serialize(buf, (void*) &_value<#if helper.getSerializerTerms(field.params)?has_content>, <#list helper.getSerializerTerms(field.params) as serializerTerm>${helper.toSerializationExpression(baseType, field, serializerTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>);
+<#if indentContent>    </#if>      if(_res != OK) {
+<#if indentContent>    </#if>        return _res;
+<#if indentContent>    </#if>      }
             </#if>
-<#if indentContent>  </#if>    }
-<#if indentContent>  </#if>  }
+<#if indentContent>    </#if>    }
+<#if indentContent>    </#if>  }
             <#break>
         <#--case "checksum">
             <#assign checksumField = field>
             <#assign simpleTypeReference = checksumField.type>
 
-<#if indentContent>  </#if>  // Checksum Field (${checksumField.name})
-<#if indentContent>  </#if>  {
-<#if indentContent>  </#if>    // Create an array of all the bytes read in this message element so far.
-<#if indentContent>  </#if>    byte[] checksumRawData = plc4c_spi_read_get_bytes(buf, startPos, plc4c_spi_read_get_pos(buf));
-<#if indentContent>  </#if>    ${helper.getLanguageTypeNameForField(field)} _checksumRef = ${helper.getReadBufferReadMethodCall(checksumField.type)};
-<#if indentContent>  </#if>    ${helper.getLanguageTypeNameForField(field)} _checksum = (${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(baseType, checksumField, checksumField.checksumExpression, baseType.parserArguments)});
-<#if indentContent>  </#if>    if(_checksum != _checksumRef) {
-<#if indentContent>  </#if>      return PARSE_ERROR;
-<#if indentContent>  </#if>      // throw new ParseException(String.format("Checksum verification failed. Expected %04X but got %04X",_checksumRef & 0xFFFF, _checksum & 0xFFFF));
-<#if indentContent>  </#if>    }
-<#if indentContent>  </#if>  }
+<#if indentContent>    </#if>  // Checksum Field (${checksumField.name})
+<#if indentContent>    </#if>  {
+<#if indentContent>    </#if>    // Create an array of all the bytes read in this message element so far.
+<#if indentContent>    </#if>    byte[] checksumRawData = plc4c_spi_read_get_bytes(buf, startPos, plc4c_spi_read_get_pos(buf));
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForField(field)} _checksumRef = ${helper.getReadBufferReadMethodCall(checksumField.type)};
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForField(field)} _checksum = (${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(baseType, checksumField, checksumField.checksumExpression, baseType.parserArguments)});
+<#if indentContent>    </#if>    if(_checksum != _checksumRef) {
+<#if indentContent>    </#if>      return PARSE_ERROR;
+<#if indentContent>    </#if>      // throw new ParseException(String.format("Checksum verification failed. Expected %04X but got %04X",_checksumRef & 0xFFFF, _checksum & 0xFFFF));
+<#if indentContent>    </#if>    }
+<#if indentContent>    </#if>  }
             <#break-->
         <#case "const">
             <#assign constField = field>
             <#assign simpleTypeReference = constField.type>
 
-<#if indentContent>  </#if>  // Const Field (${constField.name})
-<#if indentContent>  </#if>  ${helper.getWriteBufferWriteMethodCall(constField.type, helper.getCTypeName(baseType.name)?upper_case + "_" + helper.camelCaseToSnakeCase(constField.name)?upper_case)};
+<#if indentContent>    </#if>  // Const Field (${constField.name})
+<#if indentContent>    </#if>  ${helper.getWriteBufferWriteMethodCall(constField.type, helper.getCTypeName(baseType.name)?upper_case + "_" + helper.camelCaseToSnakeCase(constField.name)?upper_case)};
             <#break>
         <#case "discriminator">
             <#assign discriminatorField = field>
             <#assign simpleTypeReference = discriminatorField.type>
 
-<#if indentContent>  </#if>  // Discriminator Field (${discriminatorField.name})
-<#if indentContent>  </#if>  ${helper.getWriteBufferWriteMethodCall(discriminatorField.type, "plc4c_" + helper.getCTypeName(baseType.name) + "_get_discriminator(_message->_type)." + discriminatorField.name)};
+<#if indentContent>    </#if>  // Discriminator Field (${discriminatorField.name})
+<#if indentContent>    </#if>  ${helper.getWriteBufferWriteMethodCall(discriminatorField.type, "plc4c_" + helper.getCTypeName(baseType.name) + "_get_discriminator(_message->_type)." + discriminatorField.name)};
             <#break>
         <#case "enum">
             <#assign enumField = field>
 
-<#if indentContent>  </#if>  // Enum field (${enumField.name})
-<#if indentContent>  </#if>  ${helper.getWriteBufferWriteMethodCall(helper.getEnumBaseTypeReference(enumField.type), "_message->" + helper.camelCaseToSnakeCase(enumField.name))};
+<#if indentContent>    </#if>  // Enum field (${enumField.name})
+<#if indentContent>    </#if>  {
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForTypeReference(helper.getEnumBaseTypeReference(enumField.type))} _value = _message-><@fieldName baseType=baseType field=enumField/>;
+<#if indentContent>    </#if>    ${helper.getWriteBufferWriteMethodCall(helper.getEnumBaseTypeReference(enumField.type), "_value")};
+<#if indentContent>    </#if>  }
             <#break>
         <#case "implicit">
             <#assign implicitField = field>
             <#assign simpleTypeReference = implicitField.type>
 
-<#if indentContent>  </#if>  // Implicit Field (${implicitField.name}) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
-<#if indentContent>  </#if>  ${helper.getWriteBufferWriteMethodCall(implicitField.type, helper.toSerializationExpression(baseType, implicitField, implicitField.serializeExpression, baseType.parserArguments))};
+<#if indentContent>    </#if>  // Implicit Field (${implicitField.name}) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+<#if indentContent>    </#if>  ${helper.getWriteBufferWriteMethodCall(implicitField.type, helper.toSerializationExpression(baseType, implicitField, implicitField.serializeExpression, baseType.parserArguments))};
             <#break>
         <#case "manualArray">
             <#assign manualArrayField = field>
@@ -415,88 +418,90 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
         <#case "manual">
             <#assign manualField = field>
 
-<#if indentContent>  </#if>  // Manual Field (${manualField.name})
-<#if indentContent>  </#if>  {
-<#if indentContent>  </#if>    ${helper.getLanguageTypeNameForTypeReference(manualField.type)}* _value = (${helper.getLanguageTypeNameForTypeReference(arrayField.type)}*) plc4c_utils_list_get_value(_message-><@fieldName baseType=baseType field=arrayField/>, curItem);
+<#if indentContent>    </#if>  // Manual Field (${manualField.name})
+<#if indentContent>    </#if>  {
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForTypeReference(manualField.type)}* _value = (${helper.getLanguageTypeNameForTypeReference(arrayField.type)}*) plc4c_utils_list_get_value(_message-><@fieldName baseType=baseType field=arrayField/>, curItem);
             <#if helper.isSimpleTypeReference(manualField.type)>
-<#if indentContent>  </#if>    ${helper.getWriteBufferWriteMethodCall(manualField.type, "*_value")};
+<#if indentContent>    </#if>    ${helper.getWriteBufferWriteMethodCall(manualField.type, "*_value")};
             <#else>
-<#if indentContent>  </#if>    plc4c_return_code _res = plc4c_${helper.getCTypeName(manualField.type.name)}_serialize(buf, (void*) &_value);
-<#if indentContent>  </#if>    if(_res != OK) {
-<#if indentContent>  </#if>      return _res;
-<#if indentContent>  </#if>    }
+<#if indentContent>    </#if>    plc4c_return_code _res = plc4c_${helper.getCTypeName(manualField.type.name)}_serialize(buf, (void*) &_value);
+<#if indentContent>    </#if>    if(_res != OK) {
+<#if indentContent>    </#if>      return _res;
+<#if indentContent>    </#if>    }
             </#if>
-<#if indentContent>  </#if>  }
+<#if indentContent>    </#if>  }
             <#break>
         <#case "optional">
             <#assign optionalField = field>
 
-<#if indentContent>  </#if>  // Optional Field (${optionalField.name})
-<#if indentContent>  </#if>  if(_message-><@fieldName baseType=baseType field=optionalField/> != NULL) {
+<#if indentContent>    </#if>  // Optional Field (${optionalField.name})
+<#if indentContent>    </#if>  if(_message-><@fieldName baseType=baseType field=optionalField/> != NULL) {
             <#if helper.isSimpleTypeReference(optionalField.type)>
-<#if indentContent>  </#if>    ${helper.getLanguageTypeNameForTypeReference(optionalField.type)} _value = _message-><@fieldName baseType=baseType field=optionalField/>;
-<#if indentContent>  </#if>    ${helper.getWriteBufferWriteMethodCall(optionalField.type, "_value")};
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForTypeReference(optionalField.type)}* _value = _message-><@fieldName baseType=baseType field=optionalField/>;
+<#if indentContent>    </#if>    ${helper.getWriteBufferWriteMethodCall(optionalField.type, "*_value")};
             <#else>
-<#if indentContent>  </#if>    ${helper.getLanguageTypeNameForTypeReference(optionalField.type)}* _value = _message-><@fieldName baseType=baseType field=optionalField/>;
-<#if indentContent>  </#if>    plc4c_return_code _res = plc4c_${helper.getCTypeName(optionalField.type.name)}_serialize(buf, _value);
-<#if indentContent>  </#if>    if(_res != OK) {
-<#if indentContent>  </#if>      return _res;
-<#if indentContent>  </#if>    }
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForTypeReference(optionalField.type)}* _value = _message-><@fieldName baseType=baseType field=optionalField/>;
+<#if indentContent>    </#if>    plc4c_return_code _res = plc4c_${helper.getCTypeName(optionalField.type.name)}_serialize(buf, _value);
+<#if indentContent>    </#if>    if(_res != OK) {
+<#if indentContent>    </#if>      return _res;
+<#if indentContent>    </#if>    }
             </#if>
-<#if indentContent>  </#if>  }
+<#if indentContent>    </#if>  }
             <#break>
         <#case "padding">
             <#assign paddingField = field>
             <#assign simpleTypeReference = paddingField.type>
 
-<#if indentContent>  </#if>  // Padding Field (padding)
-<#if indentContent>  </#if>  {
+<#if indentContent>    </#if>  // Padding Field (padding)
+<#if indentContent>    </#if>  {
     <#-- We're replacing the "lastItem" with 'false' here as the item itself can't know if it is the last -->
-<#if indentContent>  </#if>    bool _needsPadding = (bool) (${helper.toSerializationExpression(baseType, paddingField, paddingField.paddingCondition, baseType.parserArguments)});
-<#if indentContent>  </#if>    if(_needsPadding) {
-<#if indentContent>  </#if>      // Just output the default padding data
-<#if indentContent>  </#if>      ${helper.getWriteBufferWriteMethodCall(paddingField.type, helper.toParseExpression(baseType, paddingField, paddingField.paddingValue, baseType.parserArguments))};
-<#if indentContent>  </#if>    }
-<#if indentContent>  </#if>  }
+<#if indentContent>    </#if>    bool _needsPadding = (bool) (${helper.toSerializationExpression(baseType, paddingField, paddingField.paddingCondition, baseType.parserArguments)});
+<#if indentContent>    </#if>    if(_needsPadding) {
+<#if indentContent>    </#if>      // Just output the default padding data
+<#if indentContent>    </#if>      ${helper.getWriteBufferWriteMethodCall(paddingField.type, helper.toParseExpression(baseType, paddingField, paddingField.paddingValue, baseType.parserArguments))};
+<#if indentContent>    </#if>    }
+<#if indentContent>    </#if>  }
             <#break>
         <#case "reserved">
             <#assign reservedField = field>
             <#assign simpleTypeReference = reservedField.type>
 
-<#if indentContent>  </#if>  // Reserved Field
-<#if indentContent>  </#if>  ${helper.getWriteBufferWriteMethodCall(reservedField.type, reservedField.referenceValue)};
+<#if indentContent>    </#if>  // Reserved Field
+<#if indentContent>    </#if>  ${helper.getWriteBufferWriteMethodCall(reservedField.type, reservedField.referenceValue)};
             <#break>
         <#case "simple">
             <#assign simpleField = field>
 
-<#if indentContent>  </#if>  // Simple Field (${simpleField.name})
-<#if indentContent>  </#if>  {
+<#if indentContent>    </#if>  // Simple Field (${simpleField.name})
+<#if indentContent>    </#if>  {
             <#if helper.isSimpleTypeReference(simpleField.type)>
-<#if indentContent>  </#if>    ${helper.getLanguageTypeNameForTypeReference(simpleField.type)} _value = _message-><@fieldName baseType=baseType field=simpleField/>;
-<#if indentContent>  </#if>    ${helper.getWriteBufferWriteMethodCall(simpleField.type, "_value")};
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForTypeReference(simpleField.type)} _value = _message-><@fieldName baseType=baseType field=simpleField/>;
+<#if indentContent>    </#if>    ${helper.getWriteBufferWriteMethodCall(simpleField.type, "_value")};
             <#else>
-<#if indentContent>  </#if>    ${helper.getLanguageTypeNameForTypeReference(simpleField.type)}* _value = _message-><@fieldName baseType=baseType field=simpleField/>;
-<#if indentContent>  </#if>    plc4c_return_code _res = plc4c_${helper.getCTypeName(simpleField.type.name)}_serialize(buf, _value);
-<#if indentContent>  </#if>    if(_res != OK) {
-<#if indentContent>  </#if>      return _res;
-<#if indentContent>  </#if>    }
+<#if indentContent>    </#if>    ${helper.getLanguageTypeNameForTypeReference(simpleField.type)}* _value = _message-><@fieldName baseType=baseType field=simpleField/>;
+<#if indentContent>    </#if>    plc4c_return_code _res = plc4c_${helper.getCTypeName(simpleField.type.name)}_serialize(buf, _value);
+<#if indentContent>    </#if>    if(_res != OK) {
+<#if indentContent>    </#if>      return _res;
+<#if indentContent>    </#if>    }
             </#if>
-<#if indentContent>  </#if>  }
+<#if indentContent>    </#if>  }
             <#break>
-        <#--case "switch">
+        <#case "switch">
             <#assign switchField = field>
 
-<#if indentContent>  </#if>  // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
-            <#list switchField.cases as case>
-<#if indentContent>  </#if>  <#if case.discriminatorValues?has_content>if(<#list case.discriminatorValues as discriminatorValue><#if case.discriminatorValues?size &gt; 1>(</#if>${helper.toVariableParseExpression(baseType, switchField, switchField.discriminatorExpressions[discriminatorValue?index], type.parserArguments)} == ${discriminatorValue}<#if case.discriminatorValues?size &gt; 1>)</#if><#sep> && </#sep></#list>) </#if>{ /* ${case.name} */
-                <#list case.fields as caseField>
-<#if indentContent>  </#if>                    <@fieldParser baseType=case field=caseField indentContent=true/>
-                        <#sep >
-
-                </#list>
-<#if indentContent>  </#if>  }<#sep> else </#sep>
+<#if indentContent>    </#if>  // Switch Field (Depending of the current type, serialize the sub-type elements)
+<#if indentContent>    </#if>  switch(_message->_type) {
+        <#list switchField.cases as case>
+<#if indentContent>    </#if>    case plc4c_${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(case.name)}: {
+            <#list case.fields as caseField>
+                <@fieldSerializer baseType=case field=caseField indentContent=true/>
             </#list>
-            <#break-->
+
+<#if indentContent>    </#if>      break;
+<#if indentContent>    </#if>    }
+        </#list>
+<#if indentContent>    </#if>  }
+            <#break>
     </#switch>
 </#macro>
 <#list type.fields as field>
@@ -629,6 +634,7 @@ uint8_t plc4c_${helper.getCTypeName(type.name)}_length_in_bits(plc4c_${helper.ge
                     <#sep >
 
                 </#list>
+
 <#if indentContent>    </#if>      break;
 <#if indentContent>    </#if>    }
             </#list>
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
index 85a04bb..ac91e89 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
@@ -842,6 +842,616 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
   // Discriminator Field (function)
   plc4c_spi_write_unsigned_short(buf, 7, plc4c_modbus_read_write_modbus_pdu_get_discriminator(_message->_type).function);
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_error: {
+
+      // Simple Field (exceptionCode)
+      {
+        uint8_t _value = _message->modbus_pdu_error_exception_code;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_request: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_read_discrete_inputs_request_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_read_discrete_inputs_request_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_discrete_inputs_response_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_discrete_inputs_response_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_discrete_inputs_response_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_request: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_read_coils_request_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_read_coils_request_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_coils_response_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_coils_response_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_coils_response_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_request: {
+
+      // Simple Field (address)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_coil_request_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (value)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_coil_request_value;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_response: {
+
+      // Simple Field (address)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_coil_response_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (value)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_coil_response_value;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_request: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_coils_request_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_coils_request_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_write_multiple_coils_request_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_write_multiple_coils_request_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_write_multiple_coils_request_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_response: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_coils_response_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_coils_response_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_request: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_read_input_registers_request_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_read_input_registers_request_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_input_registers_response_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_input_registers_response_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_input_registers_response_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_request: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_read_holding_registers_request_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_read_holding_registers_request_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_holding_registers_response_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_holding_registers_response_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_holding_registers_response_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_request: {
+
+      // Simple Field (address)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_register_request_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (value)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_register_request_value;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_response: {
+
+      // Simple Field (address)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_register_response_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (value)
+      {
+        uint16_t _value = _message->modbus_pdu_write_single_register_response_value;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_holding_registers_request_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_holding_registers_request_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_write_multiple_holding_registers_request_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_write_multiple_holding_registers_request_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_write_multiple_holding_registers_request_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response: {
+
+      // Simple Field (startingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_holding_registers_response_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (quantity)
+      {
+        uint16_t _value = _message->modbus_pdu_write_multiple_holding_registers_response_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request: {
+
+      // Simple Field (readStartingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_read_write_multiple_holding_registers_request_read_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (readQuantity)
+      {
+        uint16_t _value = _message->modbus_pdu_read_write_multiple_holding_registers_request_read_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (writeStartingAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_read_write_multiple_holding_registers_request_write_starting_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (writeQuantity)
+      {
+        uint16_t _value = _message->modbus_pdu_read_write_multiple_holding_registers_request_write_quantity;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_write_multiple_holding_registers_request_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_write_multiple_holding_registers_request_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_write_multiple_holding_registers_request_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_write_multiple_holding_registers_response_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_write_multiple_holding_registers_response_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_write_multiple_holding_registers_response_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_request: {
+
+      // Simple Field (referenceAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_mask_write_holding_register_request_reference_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (andMask)
+      {
+        uint16_t _value = _message->modbus_pdu_mask_write_holding_register_request_and_mask;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (orMask)
+      {
+        uint16_t _value = _message->modbus_pdu_mask_write_holding_register_request_or_mask;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_response: {
+
+      // Simple Field (referenceAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_mask_write_holding_register_response_reference_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (andMask)
+      {
+        uint16_t _value = _message->modbus_pdu_mask_write_holding_register_response_and_mask;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (orMask)
+      {
+        uint16_t _value = _message->modbus_pdu_mask_write_holding_register_response_or_mask;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_request: {
+
+      // Simple Field (fifoPointerAddress)
+      {
+        uint16_t _value = _message->modbus_pdu_read_fifo_queue_request_fifo_pointer_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_int(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_fifo_queue_response_fifo_value)) * (2))) + (2));
+
+      // Implicit Field (fifoCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_int(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_fifo_queue_response_fifo_value)) * (2))) / (2));
+
+      // Array field (fifoValue)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_fifo_queue_response_fifo_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          uint16_t* _value = (uint16_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_fifo_queue_response_fifo_value, curItem);
+          plc4c_spi_write_unsigned_int(buf, 16, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_request: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_read_file_record_request_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_file_record_request_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item* _value = (plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item*) plc4c_utils_list_get_value(_message->modbus_pdu_read_file_record_request_items, curItem);
+          plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_read_file_record_response_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_read_file_record_response_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item* _value = (plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item*) plc4c_utils_list_get_value(_message->modbus_pdu_read_file_record_response_items, curItem);
+          plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_request: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_write_file_record_request_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_write_file_record_request_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item* _value = (plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item*) plc4c_utils_list_get_value(_message->modbus_pdu_write_file_record_request_items, curItem);
+          plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_write_file_record_response_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_write_file_record_response_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item* _value = (plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item*) plc4c_utils_list_get_value(_message->modbus_pdu_write_file_record_response_items, curItem);
+          plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_request: {
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_response: {
+
+      // Simple Field (value)
+      {
+        uint8_t _value = _message->modbus_pdu_read_exception_status_response_value;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_diagnostic_request: {
+
+      // Simple Field (status)
+      {
+        uint16_t _value = _message->modbus_pdu_diagnostic_request_status;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (eventCount)
+      {
+        uint16_t _value = _message->modbus_pdu_diagnostic_request_event_count;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_request: {
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, (plc4c_spi_evaluation_helper_count(_message->modbus_pdu_get_com_event_log_response_events)) + (6));
+
+      // Simple Field (status)
+      {
+        uint16_t _value = _message->modbus_pdu_get_com_event_log_response_status;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (eventCount)
+      {
+        uint16_t _value = _message->modbus_pdu_get_com_event_log_response_event_count;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (messageCount)
+      {
+        uint16_t _value = _message->modbus_pdu_get_com_event_log_response_message_count;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Array field (events)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_get_com_event_log_response_events);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_get_com_event_log_response_events, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_request: {
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_response: {
+
+      // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_report_server_id_response_value));
+
+      // Array field (value)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->modbus_pdu_report_server_id_response_value);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          int8_t* _value = (int8_t*) plc4c_utils_list_get_value(_message->modbus_pdu_report_server_id_response_value, curItem);
+          plc4c_spi_write_byte(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_request: {
+
+      break;
+    }
+    case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_response: {
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -864,6 +1474,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (exceptionCode)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_request: {
@@ -874,6 +1485,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (quantity)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_response: {
@@ -884,6 +1496,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_read_discrete_inputs_response_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_request: {
@@ -894,6 +1507,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (quantity)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_response: {
@@ -904,6 +1518,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_read_coils_response_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_request: {
@@ -914,6 +1529,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (value)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_response: {
@@ -924,6 +1540,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (value)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_request: {
@@ -942,6 +1559,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_write_multiple_coils_request_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_response: {
@@ -952,6 +1570,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (quantity)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_request: {
@@ -962,6 +1581,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (quantity)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_response: {
@@ -972,6 +1592,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_read_input_registers_response_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_request: {
@@ -982,6 +1603,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (quantity)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_response: {
@@ -992,6 +1614,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_read_holding_registers_response_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_request: {
@@ -1002,6 +1625,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (value)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_response: {
@@ -1012,6 +1636,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (value)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request: {
@@ -1030,6 +1655,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_write_multiple_holding_registers_request_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response: {
@@ -1040,6 +1666,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (quantity)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request: {
@@ -1066,6 +1693,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_read_write_multiple_holding_registers_request_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response: {
@@ -1076,6 +1704,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_read_write_multiple_holding_registers_response_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_request: {
@@ -1090,6 +1719,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (orMask)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_response: {
@@ -1104,12 +1734,14 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (orMask)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_request: {
 
       // Simple field (fifoPointerAddress)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_response: {
@@ -1124,6 +1756,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 16 * plc4c_utils_list_size(_message->modbus_pdu_read_fifo_queue_response_fifo_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_request: {
@@ -1140,6 +1773,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_response: {
@@ -1156,6 +1790,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_request: {
@@ -1172,6 +1807,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_response: {
@@ -1188,15 +1824,18 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_request: {
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_response: {
 
       // Simple field (value)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_diagnostic_request: {
@@ -1207,9 +1846,11 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Simple field (eventCount)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_request: {
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_response: {
@@ -1232,9 +1873,11 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_get_com_event_log_response_events);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_request: {
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_response: {
@@ -1245,12 +1888,15 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->modbus_pdu_report_server_id_response_value);
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_request: {
+
       break;
     }
     case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_response: {
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c b/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
index d9b4793..1ce5a53 100644
--- a/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
+++ b/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
@@ -215,6 +215,124 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_serialize(plc4c_spi_write_buff
   // Discriminator Field (tpduCode)
   plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_cotp_packet_get_discriminator(_message->_type).tpduCode);
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_data: {
+
+      // Simple Field (eot)
+      {
+        bool _value = _message->cotp_packet_data_eot;
+        plc4c_spi_write_bit(buf, _value);
+      }
+
+      // Simple Field (tpduRef)
+      {
+        unsigned int _value = _message->cotp_packet_data_tpdu_ref;
+        plc4c_spi_write_unsigned_short(buf, 7, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_request: {
+
+      // Simple Field (destinationReference)
+      {
+        uint16_t _value = _message->cotp_packet_connection_request_destination_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (sourceReference)
+      {
+        uint16_t _value = _message->cotp_packet_connection_request_source_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Enum field (protocolClass)
+      {
+        int8_t _value = _message->cotp_packet_connection_request_protocol_class;
+        plc4c_spi_write_byte(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_response: {
+
+      // Simple Field (destinationReference)
+      {
+        uint16_t _value = _message->cotp_packet_connection_response_destination_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (sourceReference)
+      {
+        uint16_t _value = _message->cotp_packet_connection_response_source_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Enum field (protocolClass)
+      {
+        int8_t _value = _message->cotp_packet_connection_response_protocol_class;
+        plc4c_spi_write_byte(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_request: {
+
+      // Simple Field (destinationReference)
+      {
+        uint16_t _value = _message->cotp_packet_disconnect_request_destination_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (sourceReference)
+      {
+        uint16_t _value = _message->cotp_packet_disconnect_request_source_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Enum field (protocolClass)
+      {
+        int8_t _value = _message->cotp_packet_disconnect_request_protocol_class;
+        plc4c_spi_write_byte(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_response: {
+
+      // Simple Field (destinationReference)
+      {
+        uint16_t _value = _message->cotp_packet_disconnect_response_destination_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (sourceReference)
+      {
+        uint16_t _value = _message->cotp_packet_disconnect_response_source_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_tpdu_error: {
+
+      // Simple Field (destinationReference)
+      {
+        uint16_t _value = _message->cotp_packet_tpdu_error_destination_reference;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (rejectCause)
+      {
+        uint8_t _value = _message->cotp_packet_tpdu_error_reject_cause;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+  }
+
   // Array field (parameters)
   {
     uint8_t itemCount = plc4c_utils_list_size(_message->parameters);
@@ -263,6 +381,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
 
       // Simple field (tpduRef)
       lengthInBits += 7;
+
       break;
     }
     case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_request: {
@@ -277,6 +396,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
 
       // Enum Field (protocolClass)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_response: {
@@ -291,6 +411,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
 
       // Enum Field (protocolClass)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_request: {
@@ -305,6 +426,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
 
       // Enum Field (protocolClass)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_response: {
@@ -315,6 +437,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
 
       // Simple field (sourceReference)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_tpdu_error: {
@@ -325,6 +448,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
 
       // Simple field (rejectCause)
       lengthInBits += 8;
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c b/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
index a487f9a..e1cb8dc 100644
--- a/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
+++ b/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
@@ -127,6 +127,64 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_serialize(plc4c_spi_write_b
   // Implicit Field (parameterLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
   plc4c_spi_write_unsigned_short(buf, 8, (plc4c_s7_read_write_cotp_parameter_length_in_bytes(_message)) - (2));
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_tpdu_size: {
+
+      // Enum field (tpduSize)
+      {
+        int8_t _value = _message->cotp_parameter_tpdu_size_tpdu_size;
+        plc4c_spi_write_byte(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_calling_tsap: {
+
+      // Simple Field (tsapId)
+      {
+        uint16_t _value = _message->cotp_parameter_calling_tsap_tsap_id;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_called_tsap: {
+
+      // Simple Field (tsapId)
+      {
+        uint16_t _value = _message->cotp_parameter_called_tsap_tsap_id;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_checksum: {
+
+      // Simple Field (crc)
+      {
+        uint8_t _value = _message->cotp_parameter_checksum_crc;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_disconnect_additional_information: {
+
+      // Array field (data)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->cotp_parameter_disconnect_additional_information_data);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+
+          uint8_t* _value = (uint8_t*) plc4c_utils_list_get_value(_message->cotp_parameter_disconnect_additional_information_data, curItem);
+          plc4c_spi_write_unsigned_short(buf, 8, *_value);
+        }
+      }
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -149,30 +207,35 @@ uint8_t plc4c_s7_read_write_cotp_parameter_length_in_bits(plc4c_s7_read_write_co
 
       // Enum Field (tpduSize)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_calling_tsap: {
 
       // Simple field (tsapId)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_called_tsap: {
 
       // Simple field (tsapId)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_checksum: {
 
       // Simple field (crc)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_disconnect_additional_information: {
 
       // Array field
       lengthInBits += 8 * plc4c_utils_list_size(_message->cotp_parameter_disconnect_additional_information_data);
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_address.c b/sandbox/plc4c/generated-sources/s7/src/s7_address.c
index 444d846..8b8af7a 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_address.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_address.c
@@ -108,6 +108,53 @@ plc4c_return_code plc4c_s7_read_write_s7_address_serialize(plc4c_spi_write_buffe
   // Discriminator Field (addressType)
   plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_address_get_discriminator(_message->_type).addressType);
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_s7_address_type_s7_read_write_s7_address_any: {
+
+      // Enum field (transportSize)
+      {
+        int8_t _value = _message->s7_address_any_transport_size;
+        plc4c_spi_write_byte(buf, 8, _value);
+      }
+
+      // Simple Field (numberOfElements)
+      {
+        uint16_t _value = _message->s7_address_any_number_of_elements;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (dbNumber)
+      {
+        uint16_t _value = _message->s7_address_any_db_number;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Enum field (area)
+      {
+        int8_t _value = _message->s7_address_any_area;
+        plc4c_spi_write_byte(buf, 8, _value);
+      }
+
+      // Reserved Field
+      plc4c_spi_write_unsigned_short(buf, 5, 0x00);
+
+      // Simple Field (byteAddress)
+      {
+        uint16_t _value = _message->s7_address_any_byte_address;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (bitAddress)
+      {
+        unsigned int _value = _message->s7_address_any_bit_address;
+        plc4c_spi_write_unsigned_byte(buf, 3, _value);
+      }
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -151,6 +198,7 @@ uint8_t plc4c_s7_read_write_s7_address_length_in_bits(plc4c_s7_read_write_s7_add
 
       // Simple field (bitAddress)
       lengthInBits += 3;
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_message.c b/sandbox/plc4c/generated-sources/s7/src/s7_message.c
index 80db2b8..84780dc 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_message.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_message.c
@@ -171,6 +171,50 @@ plc4c_return_code plc4c_s7_read_write_s7_message_serialize(plc4c_spi_write_buffe
   // Implicit Field (payloadLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
   plc4c_spi_write_unsigned_int(buf, 16, (((_message->payload) != (NULL)) ? plc4c_s7_read_write_s7_payload_length_in_bytes(_message->payload) : 0));
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_request: {
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response: {
+
+      // Simple Field (errorClass)
+      {
+        uint8_t _value = _message->s7_message_response_error_class;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      // Simple Field (errorCode)
+      {
+        uint8_t _value = _message->s7_message_response_error_code;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response_data: {
+
+      // Simple Field (errorClass)
+      {
+        uint8_t _value = _message->s7_message_response_data_error_class;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      // Simple Field (errorCode)
+      {
+        uint8_t _value = _message->s7_message_response_data_error_code;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_user_data: {
+
+      break;
+    }
+  }
+
   // Optional Field (parameter)
   if(_message->parameter != NULL) {
     plc4c_s7_read_write_s7_parameter* _value = _message->parameter;
@@ -220,6 +264,7 @@ uint8_t plc4c_s7_read_write_s7_message_length_in_bits(plc4c_s7_read_write_s7_mes
   // Depending of the current type, add the length of sub-type elements ...
   switch(_message->_type) {
     case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_request: {
+
       break;
     }
     case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response: {
@@ -230,6 +275,7 @@ uint8_t plc4c_s7_read_write_s7_message_length_in_bits(plc4c_s7_read_write_s7_mes
 
       // Simple field (errorCode)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response_data: {
@@ -240,9 +286,11 @@ uint8_t plc4c_s7_read_write_s7_message_length_in_bits(plc4c_s7_read_write_s7_mes
 
       // Simple field (errorCode)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_user_data: {
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c b/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
index 4b133bc..9a107fb 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
@@ -203,6 +203,115 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_serialize(plc4c_spi_write_buf
   // Discriminator Field (parameterType)
   plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_parameter_get_discriminator(_message->_type).parameterType);
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_setup_communication: {
+
+      // Reserved Field
+      plc4c_spi_write_unsigned_short(buf, 8, 0x00);
+
+      // Simple Field (maxAmqCaller)
+      {
+        uint16_t _value = _message->s7_parameter_setup_communication_max_amq_caller;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (maxAmqCallee)
+      {
+        uint16_t _value = _message->s7_parameter_setup_communication_max_amq_callee;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      // Simple Field (pduLength)
+      {
+        uint16_t _value = _message->s7_parameter_setup_communication_pdu_length;
+        plc4c_spi_write_unsigned_int(buf, 16, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_request: {
+
+      // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_read_var_request_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_parameter_read_var_request_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_s7_var_request_parameter_item* _value = (plc4c_s7_read_write_s7_var_request_parameter_item*) plc4c_utils_list_get_value(_message->s7_parameter_read_var_request_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_response: {
+
+      // Simple Field (numItems)
+      {
+        uint8_t _value = _message->s7_parameter_read_var_response_num_items;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_request: {
+
+      // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_write_var_request_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_parameter_write_var_request_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_s7_var_request_parameter_item* _value = (plc4c_s7_read_write_s7_var_request_parameter_item*) plc4c_utils_list_get_value(_message->s7_parameter_write_var_request_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_response: {
+
+      // Simple Field (numItems)
+      {
+        uint8_t _value = _message->s7_parameter_write_var_response_num_items;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_user_data: {
+
+      // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_user_data_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_parameter_user_data_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_s7_parameter_user_data_item* _value = (plc4c_s7_read_write_s7_parameter_user_data_item*) plc4c_utils_list_get_value(_message->s7_parameter_user_data_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_s7_parameter_user_data_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -234,6 +343,7 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
 
       // Simple field (pduLength)
       lengthInBits += 16;
+
       break;
     }
     case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_request: {
@@ -250,12 +360,14 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_response: {
 
       // Simple field (numItems)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_request: {
@@ -272,12 +384,14 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_response: {
 
       // Simple field (numItems)
       lengthInBits += 8;
+
       break;
     }
     case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_user_data: {
@@ -294,6 +408,7 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
           curElement = curElement->next;
         }
       }
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_parameter_user_data_item.c b/sandbox/plc4c/generated-sources/s7/src/s7_parameter_user_data_item.c
index d0720df..2f47eb4 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_parameter_user_data_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_parameter_user_data_item.c
@@ -136,6 +136,65 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_serialize(plc4
   // Discriminator Field (itemType)
   plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_parameter_user_data_item_get_discriminator(_message->_type).itemType);
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_s7_parameter_user_data_item_type_s7_read_write_s7_parameter_user_data_item_cpu_functions: {
+
+      // Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, (plc4c_s7_read_write_s7_parameter_user_data_item_length_in_bytes(_message)) - (2));
+
+      // Simple Field (method)
+      {
+        uint8_t _value = _message->s7_parameter_user_data_item_cpu_functions_method;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      // Simple Field (cpuFunctionType)
+      {
+        unsigned int _value = _message->s7_parameter_user_data_item_cpu_functions_cpu_function_type;
+        plc4c_spi_write_unsigned_byte(buf, 4, _value);
+      }
+
+      // Simple Field (cpuFunctionGroup)
+      {
+        unsigned int _value = _message->s7_parameter_user_data_item_cpu_functions_cpu_function_group;
+        plc4c_spi_write_unsigned_byte(buf, 4, _value);
+      }
+
+      // Simple Field (cpuSubfunction)
+      {
+        uint8_t _value = _message->s7_parameter_user_data_item_cpu_functions_cpu_subfunction;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      // Simple Field (sequenceNumber)
+      {
+        uint8_t _value = _message->s7_parameter_user_data_item_cpu_functions_sequence_number;
+        plc4c_spi_write_unsigned_short(buf, 8, _value);
+      }
+
+      // Optional Field (dataUnitReferenceNumber)
+      if(_message->s7_parameter_user_data_item_cpu_functions_data_unit_reference_number != NULL) {
+        uint8_t* _value = _message->s7_parameter_user_data_item_cpu_functions_data_unit_reference_number;
+        plc4c_spi_write_unsigned_short(buf, 8, *_value);
+      }
+
+      // Optional Field (lastDataUnit)
+      if(_message->s7_parameter_user_data_item_cpu_functions_last_data_unit != NULL) {
+        uint8_t* _value = _message->s7_parameter_user_data_item_cpu_functions_last_data_unit;
+        plc4c_spi_write_unsigned_short(buf, 8, *_value);
+      }
+
+      // Optional Field (errorCode)
+      if(_message->s7_parameter_user_data_item_cpu_functions_error_code != NULL) {
+        uint16_t* _value = _message->s7_parameter_user_data_item_cpu_functions_error_code;
+        plc4c_spi_write_unsigned_int(buf, 16, *_value);
+      }
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -193,6 +252,7 @@ uint8_t plc4c_s7_read_write_s7_parameter_user_data_item_length_in_bits(plc4c_s7_
       if(_message->s7_parameter_user_data_item_cpu_functions_error_code != NULL) {
         lengthInBits += 16;
       }
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_payload.c b/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
index 8338afa..dbafb86 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
@@ -156,6 +156,78 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_parse(plc4c_spi_read_buffer* bu
 
 plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffer* buf, plc4c_s7_read_write_s7_payload* _message) {
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_read_var_response: {
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_payload_read_var_response_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_s7_var_payload_data_item* _value = (plc4c_s7_read_write_s7_var_payload_data_item*) plc4c_utils_list_get_value(_message->s7_payload_read_var_response_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_serialize(buf, (void*) &_value, lastItem);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_request: {
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_payload_write_var_request_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_s7_var_payload_data_item* _value = (plc4c_s7_read_write_s7_var_payload_data_item*) plc4c_utils_list_get_value(_message->s7_payload_write_var_request_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_serialize(buf, (void*) &_value, lastItem);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_response: {
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_payload_write_var_response_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_s7_var_payload_status_item* _value = (plc4c_s7_read_write_s7_var_payload_status_item*) plc4c_utils_list_get_value(_message->s7_payload_write_var_response_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_status_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_user_data: {
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_payload_user_data_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_s7_payload_user_data_item* _value = (plc4c_s7_read_write_s7_payload_user_data_item*) plc4c_utils_list_get_value(_message->s7_payload_user_data_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_s7_payload_user_data_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -178,6 +250,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_request: {
@@ -190,6 +263,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_response: {
@@ -202,6 +276,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
           curElement = curElement->next;
         }
       }
+
       break;
     }
     case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_user_data: {
@@ -214,6 +289,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
           curElement = curElement->next;
         }
       }
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_payload_user_data_item.c b/sandbox/plc4c/generated-sources/s7/src/s7_payload_user_data_item.c
index 18b2d91..50dba2c 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_payload_user_data_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_payload_user_data_item.c
@@ -121,10 +121,16 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_parse(plc4c_spi_
 plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_serialize(plc4c_spi_write_buffer* buf, plc4c_s7_read_write_s7_payload_user_data_item* _message) {
 
   // Enum field (returnCode)
-  plc4c_spi_write_byte(buf, 8, _message->return_code);
+  {
+    int8_t _value = _message->return_code;
+    plc4c_spi_write_byte(buf, 8, _value);
+  }
 
   // Enum field (transportSize)
-  plc4c_spi_write_byte(buf, 8, _message->transport_size);
+  {
+    int8_t _value = _message->transport_size;
+    plc4c_spi_write_byte(buf, 8, _value);
+  }
 
   // Implicit Field (dataLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
   plc4c_spi_write_unsigned_int(buf, 16, (plc4c_s7_read_write_s7_payload_user_data_item_length_in_bytes(_message)) - (4));
@@ -144,6 +150,37 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_serialize(plc4c_
     plc4c_spi_write_unsigned_int(buf, 16, _value);
   }
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request: {
+
+      break;
+    }
+    case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response: {
+
+      // Const Field (szlItemLength)
+      plc4c_spi_write_unsigned_int(buf, 16, S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH);
+
+      // Implicit Field (szlItemCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_int(buf, 16, plc4c_spi_evaluation_helper_count(_message->s7_payload_user_data_item_cpu_function_read_szl_response_items));
+
+      // Array field (items)
+      {
+        uint8_t itemCount = plc4c_utils_list_size(_message->s7_payload_user_data_item_cpu_function_read_szl_response_items);
+        for(int curItem = 0; curItem < itemCount; curItem++) {
+          bool lastItem = curItem == (itemCount - 1);
+          plc4c_s7_read_write_szl_data_tree_item* _value = (plc4c_s7_read_write_szl_data_tree_item*) plc4c_utils_list_get_value(_message->s7_payload_user_data_item_cpu_function_read_szl_response_items, curItem);
+          plc4c_return_code _res = plc4c_s7_read_write_szl_data_tree_item_serialize(buf, (void*) &_value);
+          if(_res != OK) {
+            return _res;
+          }
+        }
+      }
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -172,6 +209,7 @@ uint8_t plc4c_s7_read_write_s7_payload_user_data_item_length_in_bits(plc4c_s7_re
   // Depending of the current type, add the length of sub-type elements ...
   switch(_message->_type) {
     case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request: {
+
       break;
     }
     case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response: {
@@ -192,6 +230,7 @@ uint8_t plc4c_s7_read_write_s7_payload_user_data_item_length_in_bits(plc4c_s7_re
           curElement = curElement->next;
         }
       }
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c b/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c
index 0ed0d33..22e0e71 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c
@@ -78,10 +78,16 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_parse(plc4c_spi_r
 plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_serialize(plc4c_spi_write_buffer* buf, plc4c_s7_read_write_s7_var_payload_data_item* _message, bool lastItem) {
 
   // Enum field (returnCode)
-  plc4c_spi_write_byte(buf, 8, _message->return_code);
+  {
+    int8_t _value = _message->return_code;
+    plc4c_spi_write_byte(buf, 8, _value);
+  }
 
   // Enum field (transportSize)
-  plc4c_spi_write_byte(buf, 8, _message->transport_size);
+  {
+    int8_t _value = _message->transport_size;
+    plc4c_spi_write_byte(buf, 8, _value);
+  }
 
   // Simple Field (dataLength)
   {
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_status_item.c b/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_status_item.c
index 8ae8117..663db6b 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_status_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_status_item.c
@@ -44,7 +44,10 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_status_item_parse(plc4c_spi
 plc4c_return_code plc4c_s7_read_write_s7_var_payload_status_item_serialize(plc4c_spi_write_buffer* buf, plc4c_s7_read_write_s7_var_payload_status_item* _message) {
 
   // Enum field (returnCode)
-  plc4c_spi_write_byte(buf, 8, _message->return_code);
+  {
+    int8_t _value = _message->return_code;
+    plc4c_spi_write_byte(buf, 8, _value);
+  }
 
   return OK;
 }
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_var_request_parameter_item.c b/sandbox/plc4c/generated-sources/s7/src/s7_var_request_parameter_item.c
index 365164d..8493dc9 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_var_request_parameter_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_var_request_parameter_item.c
@@ -77,6 +77,26 @@ plc4c_return_code plc4c_s7_read_write_s7_var_request_parameter_item_serialize(pl
   // Discriminator Field (itemType)
   plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_var_request_parameter_item_get_discriminator(_message->_type).itemType);
 
+  // Switch Field (Depending of the current type, serialize the sub-type elements)
+  switch(_message->_type) {
+    case plc4c_s7_read_write_s7_var_request_parameter_item_type_s7_read_write_s7_var_request_parameter_item_address: {
+
+      // Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+      plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_address_length_in_bytes(_message->s7_var_request_parameter_item_address_address));
+
+      // Simple Field (address)
+      {
+        plc4c_s7_read_write_s7_address* _value = _message->s7_var_request_parameter_item_address_address;
+        plc4c_return_code _res = plc4c_s7_read_write_s7_address_serialize(buf, _value);
+        if(_res != OK) {
+          return _res;
+        }
+      }
+
+      break;
+    }
+  }
+
   return OK;
 }
 
@@ -100,6 +120,7 @@ uint8_t plc4c_s7_read_write_s7_var_request_parameter_item_length_in_bits(plc4c_s
 
       // Simple field (address)
       lengthInBits += plc4c_s7_read_write_s7_address_length_in_bits(_message->s7_var_request_parameter_item_address_address);
+
       break;
     }
   }
diff --git a/sandbox/plc4c/generated-sources/s7/src/szl_id.c b/sandbox/plc4c/generated-sources/s7/src/szl_id.c
index be098c4..12b6aca 100644
--- a/sandbox/plc4c/generated-sources/s7/src/szl_id.c
+++ b/sandbox/plc4c/generated-sources/s7/src/szl_id.c
@@ -52,7 +52,10 @@ plc4c_return_code plc4c_s7_read_write_szl_id_parse(plc4c_spi_read_buffer* buf, p
 plc4c_return_code plc4c_s7_read_write_szl_id_serialize(plc4c_spi_write_buffer* buf, plc4c_s7_read_write_szl_id* _message) {
 
   // Enum field (typeClass)
-  plc4c_spi_write_byte(buf, 4, _message->type_class);
+  {
+    int _value = _message->type_class;
+    plc4c_spi_write_byte(buf, 4, _value);
+  }
 
   // Simple Field (sublistExtract)
   {
@@ -61,7 +64,10 @@ plc4c_return_code plc4c_s7_read_write_szl_id_serialize(plc4c_spi_write_buffer* b
   }
 
   // Enum field (sublistList)
-  plc4c_spi_write_byte(buf, 8, _message->sublist_list);
+  {
+    int8_t _value = _message->sublist_list;
+    plc4c_spi_write_byte(buf, 8, _value);
+  }
 
   return OK;
 }
diff --git a/sandbox/plc4c/spi/include/plc4c/spi/evaluation_helper.h b/sandbox/plc4c/spi/include/plc4c/spi/evaluation_helper.h
index 76b75fb..c07be76 100644
--- a/sandbox/plc4c/spi/include/plc4c/spi/evaluation_helper.h
+++ b/sandbox/plc4c/spi/include/plc4c/spi/evaluation_helper.h
@@ -29,4 +29,6 @@ double plc4c_spi_evaluation_helper_ceil(double a);
 
 uint8_t plc4c_spi_evaluation_helper_count(plc4c_list* a);
 
+uint8_t plc4c_spi_evaluation_helper_array_size_in_bytes(plc4c_list* a);
+
 #endif  // PLC4C_SPI_EVALUATION_HELPER_H_