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/18 07:27:34 UTC
[plc4x] branch feature/c-code-generation-tagged-unions updated: -
Added some indentation to the generation of fields inside discriminated
types
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/c-code-generation-tagged-unions
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/c-code-generation-tagged-unions by this push:
new 81aba3b - Added some indentation to the generation of fields inside discriminated types
81aba3b is described below
commit 81aba3b739f491fe543848c6246103f1ffcae885
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Jun 18 09:27:28 2020 +0200
- Added some indentation to the generation of fields inside discriminated types
---
.../resources/templates/c/pojo-template-c.ftlh | 244 +++---
.../generated-sources/modbus/src/modbus_pdu.c | 874 +++++++++++----------
.../plc4c/generated-sources/s7/src/cotp_packet.c | 105 +--
.../generated-sources/s7/src/cotp_parameter.c | 60 +-
.../plc4c/generated-sources/s7/src/s7_address.c | 57 +-
.../plc4c/generated-sources/s7/src/s7_message.c | 28 +-
.../plc4c/generated-sources/s7/src/s7_parameter.c | 176 +++--
.../s7/src/s7_parameter_user_data_item.c | 99 +--
.../plc4c/generated-sources/s7/src/s7_payload.c | 148 ++--
.../s7/src/s7_payload_user_data_item.c | 55 +-
.../s7/src/s7_var_payload_data_item.c | 1 +
.../s7/src/s7_var_request_parameter_item.c | 20 +-
.../generated-sources/s7/src/szl_data_tree_item.c | 1 +
13 files changed, 1008 insertions(+), 860 deletions(-)
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 9f40667..0b7f6f2 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
@@ -102,138 +102,138 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
</#if>
<#macro fieldName baseType field><#if baseType != type>${helper.camelCaseToSnakeCase(baseType.name)}_</#if>${helper.camelCaseToSnakeCase(field.name)}</#macro>
-<#macro fieldParser baseType field>
+<#macro fieldParser baseType field indentContent>
<#switch field.typeName>
<#case "array">
<#assign arrayField = field>
- // Array field (${arrayField.name})
+<#if indentContent> </#if> // Array field (${arrayField.name})
<#-- Only update curPos if the length expression uses it -->
<#if arrayField.loopExpression.contains("curPos")>
- curPos = plc4c_spi_read_get_pos(buf) - startPos;
+<#if indentContent> </#if> curPos = plc4c_spi_read_get_pos(buf) - startPos;
</#if>
<#-- In all other cases do we have to work with a list, that is later converted to an array -->
- plc4c_list* ${arrayField.name} = malloc(sizeof(plc4c_list));
- if(${arrayField.name} == NULL) {
- return NO_MEMORY;
- }
- {
+<#if indentContent> </#if> plc4c_list* ${arrayField.name} = malloc(sizeof(plc4c_list));
+<#if indentContent> </#if> if(${arrayField.name} == NULL) {
+<#if indentContent> </#if> return NO_MEMORY;
+<#if indentContent> </#if> }
+<#if indentContent> </#if> {
<#if helper.isCountArrayField(field)>
- // Count array
- uint8_t itemCount = ${helper.toParseExpression(baseType, arrayField, arrayField.loopExpression, type.parserArguments)};
- for(int curItem = 0; curItem < itemCount; curItem++) {
- <#if !helper.isSimpleTypeReference(arrayField.type)>bool lastItem = curItem == (itemCount - 1);</#if>
+<#if indentContent> </#if> // Count array
+<#if indentContent> </#if> uint8_t itemCount = ${helper.toParseExpression(baseType, arrayField, arrayField.loopExpression, type.parserArguments)};
+<#if indentContent> </#if> for(int curItem = 0; curItem < itemCount; curItem++) {
+<#if indentContent> </#if> <#if !helper.isSimpleTypeReference(arrayField.type)>bool lastItem = curItem == (itemCount - 1);</#if>
<#-- Inizialize a local variable with the simple type (Intentionally keeping the java-style names so they can be used in expressions) -->
- <#if helper.isSimpleTypeReference(arrayField.type)>
- ${helper.getLanguageTypeNameForTypeReference(arrayField.type)} _value = ${helper.getReadBufferReadMethodCall(arrayField.type)};
- plc4c_utils_list_insert_head_value(${arrayField.name}, &_value);
+<#if indentContent> </#if> <#if helper.isSimpleTypeReference(arrayField.type)>
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForTypeReference(arrayField.type)} _value = ${helper.getReadBufferReadMethodCall(arrayField.type)};
+<#if indentContent> </#if> plc4c_utils_list_insert_head_value(${arrayField.name}, &_value);
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
- ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
- plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
- if(_res != OK) {
- return _res;
- }
- plc4c_utils_list_insert_head_value(${arrayField.name}, _value);
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
+<#if indentContent> </#if> plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
+<#if indentContent> </#if> if(_res != OK) {
+<#if indentContent> </#if> return _res;
+<#if indentContent> </#if> }
+<#if indentContent> </#if> plc4c_utils_list_insert_head_value(${arrayField.name}, _value);
</#if>
- }
+<#if indentContent> </#if> }
<#-- For a length array, we read data till the read position of the buffer reaches a given position -->
<#elseif helper.isLengthArrayField(field)>
- // Length array
- uint8_t _${arrayField.name}Length = ${helper.toParseExpression(baseType, arrayField, arrayField.loopExpression, type.parserArguments)};
- uint8_t ${arrayField.name}EndPos = plc4c_spi_read_get_pos(buf) + _${arrayField.name}Length;
- while(plc4c_spi_read_get_pos(buf) < ${arrayField.name}EndPos) {
+<#if indentContent> </#if> // Length array
+<#if indentContent> </#if> uint8_t _${arrayField.name}Length = ${helper.toParseExpression(baseType, arrayField, arrayField.loopExpression, type.parserArguments)};
+<#if indentContent> </#if> uint8_t ${arrayField.name}EndPos = plc4c_spi_read_get_pos(buf) + _${arrayField.name}Length;
+<#if indentContent> </#if> while(plc4c_spi_read_get_pos(buf) < ${arrayField.name}EndPos) {
<#-- Inizialize a local variable with the simple type (Intentionally keeping the java-style names so they can be used in expressions) -->
<#if helper.isSimpleTypeReference(arrayField.type)>
- ${helper.getLanguageTypeNameForTypeReference(arrayField.type)} _value = ${helper.getReadBufferReadMethodCall(arrayField.type)};
- plc4c_utils_list_insert_head_value(${arrayField.name}, &_value);
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForTypeReference(arrayField.type)} _value = ${helper.getReadBufferReadMethodCall(arrayField.type)};
+<#if indentContent> </#if> plc4c_utils_list_insert_head_value(${arrayField.name}, &_value);
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
- ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
- plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
- if(_res != OK) {
- return _res;
- }
- plc4c_utils_list_insert_head_value(${arrayField.name}, _value);
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
+<#if indentContent> </#if> plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
+<#if indentContent> </#if> if(_res != OK) {
+<#if indentContent> </#if> return _res;
+<#if indentContent> </#if> }
+<#if indentContent> </#if> plc4c_utils_list_insert_head_value(${arrayField.name}, _value);
</#if>
<#-- After parsing, update the current position, but only if it's needed -->
<#if arrayField.loopExpression.contains("curPos")>
- curPos = plc4c_spi_read_get_pos(buf) - startPos;
+<#if indentContent> </#if> curPos = plc4c_spi_read_get_pos(buf) - startPos;
</#if>
- }
+<#if indentContent> </#if> }
<#-- A terminated array keeps on reading data as long as the termination expression evaluates to false -->
<#elseif helper.isTerminatedArrayField(field)>
- // Terminated array
- while(!((boolean) (${helper.toParseExpression(baseType, arrayField, arrayField.loopExpression, type.parserArguments)}))) {
+<#if indentContent> </#if> // Terminated array
+<#if indentContent> </#if> while(!((boolean) (${helper.toParseExpression(baseType, arrayField, arrayField.loopExpression, type.parserArguments)}))) {
<#-- Inizialize a local variable with the simple type (Intentionally keeping the java-style names so they can be used in expressions) -->
<#if helper.isSimpleTypeReference(arrayField.type)>
- ${helper.getLanguageTypeNameForTypeReference(arrayField.type)} _value = ${helper.getReadBufferReadMethodCall(arrayField.type)};
- plc4c_utils_list_insert_head_value(${arrayField.name}, &_value);
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForTypeReference(arrayField.type)} _value = ${helper.getReadBufferReadMethodCall(arrayField.type)};
+<#if indentContent> </#if> plc4c_utils_list_insert_head_value(${arrayField.name}, &_value);
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
- ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
- plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
- if(_res != OK) {
- return _res;
- }
- plc4c_utils_list_insert_head_value(${arrayField.name}, _value);
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
+<#if indentContent> </#if> plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
+<#if indentContent> </#if> if(_res != OK) {
+<#if indentContent> </#if> return _res;
+<#if indentContent> </#if> }
+<#if indentContent> </#if> plc4c_utils_list_insert_head_value(${arrayField.name}, _value);
</#if>
<#-- After parsing, update the current position, but only if it's needed -->
<#if arrayField.loopExpression.contains("curPos")>
- curPos = plc4c_spi_read_get_pos(buf) - startPos;
+<#if indentContent> </#if> curPos = plc4c_spi_read_get_pos(buf) - startPos;
</#if>
- }
+<#if indentContent> </#if> }
</#if>
- }
- (*_message)-><@fieldName baseType=baseType field=arrayField/> = ${arrayField.name};
+<#if indentContent> </#if> }
+<#if indentContent> </#if> (*_message)-><@fieldName baseType=baseType field=arrayField/> = ${arrayField.name};
<#break>
<#case "checksum">
<#assign checksumField = field>
<#assign simpleTypeReference = checksumField.type>
- // Checksum Field (${checksumField.name})
- {
- // Create an array of all the bytes read in this message element so far.
- byte[] checksumRawData = plc4c_spi_read_get_bytes(buf, startPos, plc4c_spi_read_get_pos(buf));
- ${helper.getLanguageTypeNameForField(field)} _checksumRef = ${helper.getReadBufferReadMethodCall(checksumField.type)};
- ${helper.getLanguageTypeNameForField(field)} _checksum = (${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(baseType, checksumField, checksumField.checksumExpression, type.parserArguments)});
- if(_checksum != _checksumRef) {
- return PARSE_ERROR;
- // throw new ParseException(String.format("Checksum verification failed. Expected %04X but got %04X",_checksumRef & 0xFFFF, _checksum & 0xFFFF));
- }
- }
+<#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, type.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>
- // Const Field (${constField.name})
- ${helper.getLanguageTypeNameForField(field)} ${constField.name} = ${helper.getReadBufferReadMethodCall(constField.type)};
- if(${constField.name} != ${helper.getCTypeName(baseType.name)?upper_case}_${helper.camelCaseToSnakeCase(constField.name)?upper_case}) {
- return PARSE_ERROR;
- // throw new ParseException("Expected constant value " + ${helper.getCTypeName(baseType.name)?upper_case}_${helper.camelCaseToSnakeCase(constField.name)?upper_case} + " but got " + ${constField.name});
- }
+<#if indentContent> </#if> // Const Field (${constField.name})
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} ${constField.name} = ${helper.getReadBufferReadMethodCall(constField.type)};
+<#if indentContent> </#if> if(${constField.name} != ${helper.getCTypeName(baseType.name)?upper_case}_${helper.camelCaseToSnakeCase(constField.name)?upper_case}) {
+<#if indentContent> </#if> return PARSE_ERROR;
+<#if indentContent> </#if> // throw new ParseException("Expected constant value " + ${helper.getCTypeName(baseType.name)?upper_case}_${helper.camelCaseToSnakeCase(constField.name)?upper_case} + " but got " + ${constField.name});
+<#if indentContent> </#if> }
<#break>
<#case "discriminator">
<#assign discriminatorField = field>
<#assign simpleTypeReference = discriminatorField.type>
- // Discriminator Field (${discriminatorField.name}) (Used as input to a switch field)
- ${helper.getLanguageTypeNameForField(field)} ${discriminatorField.name} = ${helper.getReadBufferReadMethodCall(discriminatorField.type)};
+<#if indentContent> </#if> // Discriminator Field (${discriminatorField.name}) (Used as input to a switch field)
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} ${discriminatorField.name} = ${helper.getReadBufferReadMethodCall(discriminatorField.type)};
<#break>
<#case "enum">
<#assign enumField = field>
- // Enum field (${enumField.name})
- ${helper.getLanguageTypeNameForField(field)} ${enumField.name} = ${helper.getReadBufferReadMethodCall(helper.getEnumBaseTypeReference(enumField.type))};
- (*_message)-><@fieldName baseType=baseType field=enumField/> = ${enumField.name};
+<#if indentContent> </#if> // Enum field (${enumField.name})
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} ${enumField.name} = ${helper.getReadBufferReadMethodCall(helper.getEnumBaseTypeReference(enumField.type))};
+<#if indentContent> </#if> (*_message)-><@fieldName baseType=baseType field=enumField/> = ${enumField.name};
<#break>
<#case "implicit">
<#assign implicitField = field>
<#assign simpleTypeReference = implicitField.type>
- // Implicit Field (${implicitField.name}) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- ${helper.getLanguageTypeNameForField(field)} ${implicitField.name} = ${helper.getReadBufferReadMethodCall(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.getLanguageTypeNameForField(field)} ${implicitField.name} = ${helper.getReadBufferReadMethodCall(implicitField.type)};
<#break>
<#case "manualArray">
<#assign manualArrayField = field>
@@ -243,100 +243,100 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#case "manual">
<#assign manualField = field>
- // Manual Field (${manualField.name})<#-- check if complex -->
- ${helper.getLanguageTypeNameForField(field)} ${manualField.name} = (${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(baseType, manualField, manualField.parseExpression, type.parserArguments)});
- (*_message)-><@fieldName baseType=baseType field=manualField/> = ${manualField.name};
+<#if indentContent> </#if> // Manual Field (${manualField.name})<#-- check if complex -->
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} ${manualField.name} = (${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(baseType, manualField, manualField.parseExpression, type.parserArguments)});
+<#if indentContent> </#if> (*_message)-><@fieldName baseType=baseType field=manualField/> = ${manualField.name};
<#break>
<#case "optional">
<#assign optionalField = field>
- // Optional Field (${optionalField.name}) (Can be skipped, if a given expression evaluates to false)
+<#if indentContent> </#if> // Optional Field (${optionalField.name}) (Can be skipped, if a given expression evaluates to false)
<#if optionalField.conditionExpression.contains("curPos")>
- curPos = plc4c_spi_read_get_pos(buf) - startPos;
+<#if indentContent> </#if> curPos = plc4c_spi_read_get_pos(buf) - startPos;
</#if>
- ${helper.getLanguageTypeNameForField(field)}* ${optionalField.name} = NULL;
- if(${helper.toParseExpression(baseType, field, optionalField.conditionExpression, type.parserArguments)}) {
- ${optionalField.name} = malloc(sizeof(${helper.getLanguageTypeNameForField(field)}));
- if(${optionalField.name} == NULL) {
- return NO_MEMORY;
- }
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* ${optionalField.name} = NULL;
+<#if indentContent> </#if> if(${helper.toParseExpression(baseType, field, optionalField.conditionExpression, type.parserArguments)}) {
+<#if indentContent> </#if> ${optionalField.name} = malloc(sizeof(${helper.getLanguageTypeNameForField(field)}));
+<#if indentContent> </#if> if(${optionalField.name} == NULL) {
+<#if indentContent> </#if> return NO_MEMORY;
+<#if indentContent> </#if> }
<#if helper.isSimpleTypeReference(optionalField.type)>
- *${optionalField.name} = ${helper.getReadBufferReadMethodCall(optionalField.type)};
+<#if indentContent> </#if> *${optionalField.name} = ${helper.getReadBufferReadMethodCall(optionalField.type)};
<#else>
- plc4c_return_code _res = plc4c_${helper.getCTypeName(optionalField.type.name)}_parse(buf<#if optionalField.params?has_content>, <#list optionalField.params as parserTerm>${helper.toParseExpression(baseType, optionalField, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, &${optionalField.name});
- if(_res != OK) {
- return _res;
- }
+<#if indentContent> </#if> plc4c_return_code _res = plc4c_${helper.getCTypeName(optionalField.type.name)}_parse(buf<#if optionalField.params?has_content>, <#list optionalField.params as parserTerm>${helper.toParseExpression(baseType, optionalField, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, &${optionalField.name});
+<#if indentContent> </#if> if(_res != OK) {
+<#if indentContent> </#if> return _res;
+<#if indentContent> </#if> }
</#if>
- (*_message)-><@fieldName baseType=baseType field=optionalField/> = ${optionalField.name};
- }
+<#if indentContent> </#if> (*_message)-><@fieldName baseType=baseType field=optionalField/> = ${optionalField.name};
+<#if indentContent> </#if> }
<#break>
<#case "padding">
<#assign paddingField = field>
<#assign simpleTypeReference = paddingField.type>
- // Padding Field (padding)
- {
- bool _needsPadding = (bool) ((plc4c_spi_read_has_more(buf, ${helper.getNumBits(paddingField.type)})) && (${helper.toParseExpression(baseType, paddingField, paddingField.paddingCondition, type.parserArguments)}));
- if(_needsPadding) {
- // Just read the padding data and ignore it
- ${helper.getReadBufferReadMethodCall(paddingField.type)};
- }
- }
+<#if indentContent> </#if> // Padding Field (padding)
+<#if indentContent> </#if> {
+<#if indentContent> </#if> bool _needsPadding = (bool) ((plc4c_spi_read_has_more(buf, ${helper.getNumBits(paddingField.type)})) && (${helper.toParseExpression(baseType, paddingField, paddingField.paddingCondition, type.parserArguments)}));
+<#if indentContent> </#if> if(_needsPadding) {
+<#if indentContent> </#if> // Just read the padding data and ignore it
+<#if indentContent> </#if> ${helper.getReadBufferReadMethodCall(paddingField.type)};
+<#if indentContent> </#if> }
+<#if indentContent> </#if> }
<#break>
<#case "reserved">
<#assign reservedField = field>
<#assign simpleTypeReference = reservedField.type>
- // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
- {
- ${helper.getLanguageTypeNameForField(field)} _reserved = ${helper.getReadBufferReadMethodCall(reservedField.type)};
- if(_reserved != ${reservedField.referenceValue}) {
- printf("Expected constant value '%d' but got '%d' for reserved field.", ${reservedField.referenceValue}, _reserved);
- }
- }
+<#if indentContent> </#if> // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
+<#if indentContent> </#if> {
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} _reserved = ${helper.getReadBufferReadMethodCall(reservedField.type)};
+<#if indentContent> </#if> if(_reserved != ${reservedField.referenceValue}) {
+<#if indentContent> </#if> printf("Expected constant value '%d' but got '%d' for reserved field.", ${reservedField.referenceValue}, _reserved);
+<#if indentContent> </#if> }
+<#if indentContent> </#if> }
<#break>
<#case "simple">
<#assign simpleField = field>
- // Simple Field (${simpleField.name})
+<#if indentContent> </#if> // Simple Field (${simpleField.name})
<#-- Inizialize a local variable with the simple type (Intentionally keeping the java-style names so they can be used in expressions) -->
<#if helper.isSimpleTypeReference(simpleField.type)>
- ${helper.getLanguageTypeNameForField(field)} ${simpleField.name} = ${helper.getReadBufferReadMethodCall(simpleField.type)};
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} ${simpleField.name} = ${helper.getReadBufferReadMethodCall(simpleField.type)};
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
- ${helper.getLanguageTypeNameForField(field)}* ${simpleField.name};
- plc4c_return_code _res = plc4c_${helper.getCTypeName(simpleField.type.name)}_parse(buf<#if simpleField.params?has_content>, <#list simpleField.params as parserTerm>${helper.toParseExpression(baseType, simpleField, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &${simpleField.name});
- if(_res != OK) {
- return _res;
- }
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* ${simpleField.name};
+<#if indentContent> </#if> plc4c_return_code _res = plc4c_${helper.getCTypeName(simpleField.type.name)}_parse(buf<#if simpleField.params?has_content>, <#list simpleField.params as parserTerm>${helper.toParseExpression(baseType, simpleField, parserTerm, type.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &${simpleField.name});
+<#if indentContent> </#if> if(_res != OK) {
+<#if indentContent> </#if> return _res;
+<#if indentContent> </#if> }
</#if>
- (*_message)-><@fieldName baseType=baseType field=simpleField/> = ${simpleField.name};
+<#if indentContent> </#if> (*_message)-><@fieldName baseType=baseType field=simpleField/> = ${simpleField.name};
<#break>
<#case "switch">
<#assign switchField = field>
- // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
+<#if indentContent> </#if> // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
<#list switchField.cases as case>
- <#if case.discriminatorValues?has_content>if(<#list case.discriminatorValues as discriminatorValue><#if case.discriminatorValues?size > 1>(</#if>${helper.toVariableParseExpression(baseType, switchField, switchField.discriminatorExpressions[discriminatorValue?index], type.parserArguments)} == ${discriminatorValue}<#if case.discriminatorValues?size > 1>)</#if><#sep> && </#sep></#list>) </#if>{ /* ${case.name} */
+<#if indentContent> </#if> <#if case.discriminatorValues?has_content>if(<#list case.discriminatorValues as discriminatorValue><#if case.discriminatorValues?size > 1>(</#if>${helper.toVariableParseExpression(baseType, switchField, switchField.discriminatorExpressions[discriminatorValue?index], type.parserArguments)} == ${discriminatorValue}<#if case.discriminatorValues?size > 1>)</#if><#sep> && </#sep></#list>) </#if>{ /* ${case.name} */
<#list case.fields as caseField>
- <@fieldParser baseType=case field=caseField/>
+<#if indentContent> </#if> <@fieldParser baseType=case field=caseField indentContent=true/>
<#sep >
</#list>
- }<#sep> else </#sep>
+<#if indentContent> </#if> }<#sep> else </#sep>
</#list>
<#break>
<#case "virtual">
<#assign virtualField = field>
- // Virtual field (Just declare a local variable so we can access it in the parser)
- ${helper.getLanguageTypeNameForField(field)} ${virtualField.name} = (${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(baseType, virtualField, virtualField.valueExpression, type.parserArguments)});
+<#if indentContent> </#if> // Virtual field (Just declare a local variable so we can access it in the parser)
+<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} ${virtualField.name} = (${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(baseType, virtualField, virtualField.valueExpression, type.parserArguments)});
<#break>
</#switch>
</#macro>
<#list type.fields as field>
-<@fieldParser baseType=type field=field />
+<@fieldParser baseType=type field=field indentContent=false/>
</#list>
return OK;
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
index f275bea..81b3be3 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
@@ -125,586 +125,670 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(error == true) { /* ModbusPDUError */
+
+ // Simple Field (exceptionCode)
+ uint8_t exceptionCode = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->modbus_pdu_error_exception_code = exceptionCode;
- // Simple Field (exceptionCode)
- uint8_t exceptionCode = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->modbus_pdu_error_exception_code = exceptionCode;
} else
if((error == false) && (function == 0x02) && (response == false)) { /* ModbusPDUReadDiscreteInputsRequest */
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_discrete_inputs_request_starting_address = startingAddress;
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_discrete_inputs_request_starting_address = startingAddress;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_discrete_inputs_request_quantity = quantity;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_discrete_inputs_request_quantity = quantity;
} else
if((error == false) && (function == 0x02) && (response == true)) { /* ModbusPDUReadDiscreteInputsResponse */
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
-
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_read_discrete_inputs_response_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_read_discrete_inputs_response_value = value;
+
} else
if((error == false) && (function == 0x01) && (response == false)) { /* ModbusPDUReadCoilsRequest */
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_coils_request_starting_address = startingAddress;
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_coils_request_starting_address = startingAddress;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_coils_request_quantity = quantity;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_coils_request_quantity = quantity;
} else
if((error == false) && (function == 0x01) && (response == true)) { /* ModbusPDUReadCoilsResponse */
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
-
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_read_coils_response_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_read_coils_response_value = value;
+
} else
if((error == false) && (function == 0x05) && (response == false)) { /* ModbusPDUWriteSingleCoilRequest */
+
+ // Simple Field (address)
+ uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_coil_request_address = address;
- // Simple Field (address)
- uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_coil_request_address = address;
+
+ // Simple Field (value)
+ uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_coil_request_value = value;
- // Simple Field (value)
- uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_coil_request_value = value;
} else
if((error == false) && (function == 0x05) && (response == true)) { /* ModbusPDUWriteSingleCoilResponse */
+
+ // Simple Field (address)
+ uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_coil_response_address = address;
- // Simple Field (address)
- uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_coil_response_address = address;
+
+ // Simple Field (value)
+ uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_coil_response_value = value;
- // Simple Field (value)
- uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_coil_response_value = value;
} else
if((error == false) && (function == 0x0F) && (response == false)) { /* ModbusPDUWriteMultipleCoilsRequest */
-
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_coils_request_starting_address = startingAddress;
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_coils_request_starting_address = startingAddress;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_coils_request_quantity = quantity;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_coils_request_quantity = quantity;
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_write_multiple_coils_request_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_write_multiple_coils_request_value = value;
+
} else
if((error == false) && (function == 0x0F) && (response == true)) { /* ModbusPDUWriteMultipleCoilsResponse */
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_coils_response_starting_address = startingAddress;
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_coils_response_starting_address = startingAddress;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_coils_response_quantity = quantity;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_coils_response_quantity = quantity;
} else
if((error == false) && (function == 0x04) && (response == false)) { /* ModbusPDUReadInputRegistersRequest */
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_input_registers_request_starting_address = startingAddress;
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_input_registers_request_starting_address = startingAddress;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_input_registers_request_quantity = quantity;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_input_registers_request_quantity = quantity;
} else
if((error == false) && (function == 0x04) && (response == true)) { /* ModbusPDUReadInputRegistersResponse */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_read_input_registers_response_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_read_input_registers_response_value = value;
+
} else
if((error == false) && (function == 0x03) && (response == false)) { /* ModbusPDUReadHoldingRegistersRequest */
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_holding_registers_request_starting_address = startingAddress;
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_holding_registers_request_starting_address = startingAddress;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_holding_registers_request_quantity = quantity;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_holding_registers_request_quantity = quantity;
} else
if((error == false) && (function == 0x03) && (response == true)) { /* ModbusPDUReadHoldingRegistersResponse */
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
-
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_read_holding_registers_response_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_read_holding_registers_response_value = value;
+
} else
if((error == false) && (function == 0x06) && (response == false)) { /* ModbusPDUWriteSingleRegisterRequest */
+
+ // Simple Field (address)
+ uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_register_request_address = address;
- // Simple Field (address)
- uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_register_request_address = address;
+
+ // Simple Field (value)
+ uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_register_request_value = value;
- // Simple Field (value)
- uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_register_request_value = value;
} else
if((error == false) && (function == 0x06) && (response == true)) { /* ModbusPDUWriteSingleRegisterResponse */
+
+ // Simple Field (address)
+ uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_register_response_address = address;
- // Simple Field (address)
- uint16_t address = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_register_response_address = address;
+
+ // Simple Field (value)
+ uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_single_register_response_value = value;
- // Simple Field (value)
- uint16_t value = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_single_register_response_value = value;
} else
if((error == false) && (function == 0x10) && (response == false)) { /* ModbusPDUWriteMultipleHoldingRegistersRequest */
-
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_holding_registers_request_starting_address = startingAddress;
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_holding_registers_request_starting_address = startingAddress;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_holding_registers_request_quantity = quantity;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_holding_registers_request_quantity = quantity;
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_write_multiple_holding_registers_request_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_write_multiple_holding_registers_request_value = value;
+
} else
if((error == false) && (function == 0x10) && (response == true)) { /* ModbusPDUWriteMultipleHoldingRegistersResponse */
+
+ // Simple Field (startingAddress)
+ uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_holding_registers_response_starting_address = startingAddress;
- // Simple Field (startingAddress)
- uint16_t startingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_holding_registers_response_starting_address = startingAddress;
+
+ // Simple Field (quantity)
+ uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_write_multiple_holding_registers_response_quantity = quantity;
- // Simple Field (quantity)
- uint16_t quantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_write_multiple_holding_registers_response_quantity = quantity;
} else
if((error == false) && (function == 0x17) && (response == false)) { /* ModbusPDUReadWriteMultipleHoldingRegistersRequest */
+
+ // Simple Field (readStartingAddress)
+ uint16_t readStartingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_read_starting_address = readStartingAddress;
- // Simple Field (readStartingAddress)
- uint16_t readStartingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_read_starting_address = readStartingAddress;
+
+ // Simple Field (readQuantity)
+ uint16_t readQuantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_read_quantity = readQuantity;
- // Simple Field (readQuantity)
- uint16_t readQuantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_read_quantity = readQuantity;
+
+ // Simple Field (writeStartingAddress)
+ uint16_t writeStartingAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_write_starting_address = writeStartingAddress;
- // Simple Field (writeStartingAddress)
- uint16_t writeStartingAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_write_starting_address = writeStartingAddress;
+
+ // Simple Field (writeQuantity)
+ uint16_t writeQuantity = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_write_quantity = writeQuantity;
- // Simple Field (writeQuantity)
- uint16_t writeQuantity = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_write_quantity = writeQuantity;
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
-
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_read_write_multiple_holding_registers_request_value = value;
+
} else
if((error == false) && (function == 0x17) && (response == true)) { /* ModbusPDUReadWriteMultipleHoldingRegistersResponse */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_read_write_multiple_holding_registers_response_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_read_write_multiple_holding_registers_response_value = value;
+
} else
if((error == false) && (function == 0x16) && (response == false)) { /* ModbusPDUMaskWriteHoldingRegisterRequest */
+
+ // Simple Field (referenceAddress)
+ uint16_t referenceAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_mask_write_holding_register_request_reference_address = referenceAddress;
- // Simple Field (referenceAddress)
- uint16_t referenceAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_mask_write_holding_register_request_reference_address = referenceAddress;
+
+ // Simple Field (andMask)
+ uint16_t andMask = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_mask_write_holding_register_request_and_mask = andMask;
- // Simple Field (andMask)
- uint16_t andMask = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_mask_write_holding_register_request_and_mask = andMask;
+
+ // Simple Field (orMask)
+ uint16_t orMask = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_mask_write_holding_register_request_or_mask = orMask;
- // Simple Field (orMask)
- uint16_t orMask = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_mask_write_holding_register_request_or_mask = orMask;
} else
if((error == false) && (function == 0x16) && (response == true)) { /* ModbusPDUMaskWriteHoldingRegisterResponse */
+
+ // Simple Field (referenceAddress)
+ uint16_t referenceAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_mask_write_holding_register_response_reference_address = referenceAddress;
- // Simple Field (referenceAddress)
- uint16_t referenceAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_mask_write_holding_register_response_reference_address = referenceAddress;
+
+ // Simple Field (andMask)
+ uint16_t andMask = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_mask_write_holding_register_response_and_mask = andMask;
- // Simple Field (andMask)
- uint16_t andMask = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_mask_write_holding_register_response_and_mask = andMask;
+
+ // Simple Field (orMask)
+ uint16_t orMask = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_mask_write_holding_register_response_or_mask = orMask;
- // Simple Field (orMask)
- uint16_t orMask = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_mask_write_holding_register_response_or_mask = orMask;
} else
if((error == false) && (function == 0x18) && (response == false)) { /* ModbusPDUReadFifoQueueRequest */
+
+ // Simple Field (fifoPointerAddress)
+ uint16_t fifoPointerAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_read_fifo_queue_request_fifo_pointer_address = fifoPointerAddress;
- // Simple Field (fifoPointerAddress)
- uint16_t fifoPointerAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_read_fifo_queue_request_fifo_pointer_address = fifoPointerAddress;
} else
if((error == false) && (function == 0x18) && (response == true)) { /* ModbusPDUReadFifoQueueResponse */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint16_t byteCount = plc4c_spi_read_unsigned_int(buf, 16);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint16_t byteCount = plc4c_spi_read_unsigned_int(buf, 16);
- // Implicit Field (fifoCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint16_t fifoCount = plc4c_spi_read_unsigned_int(buf, 16);
+
+ // Implicit Field (fifoCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint16_t fifoCount = plc4c_spi_read_unsigned_int(buf, 16);
- // Array field (fifoValue)
- plc4c_list* fifoValue = malloc(sizeof(plc4c_list));
- if(fifoValue == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = fifoCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- uint16_t _value = plc4c_spi_read_unsigned_int(buf, 16);
- plc4c_utils_list_insert_head_value(fifoValue, &_value);
+
+ // Array field (fifoValue)
+ plc4c_list* fifoValue = malloc(sizeof(plc4c_list));
+ if(fifoValue == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_read_fifo_queue_response_fifo_value = fifoValue;
+ {
+ // Count array
+ uint8_t itemCount = fifoCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ uint16_t _value = plc4c_spi_read_unsigned_int(buf, 16);
+ plc4c_utils_list_insert_head_value(fifoValue, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_read_fifo_queue_response_fifo_value = fifoValue;
+
} else
if((error == false) && (function == 0x14) && (response == false)) { /* ModbusPDUReadFileRecordRequest */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Length array
- uint8_t _itemsLength = byteCount;
- uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
- while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Length array
+ uint8_t _itemsLength = byteCount;
+ uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
+ while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->modbus_pdu_read_file_record_request_items = items;
+ (*_message)->modbus_pdu_read_file_record_request_items = items;
+
} else
if((error == false) && (function == 0x14) && (response == true)) { /* ModbusPDUReadFileRecordResponse */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Length array
- uint8_t _itemsLength = byteCount;
- uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
- while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Length array
+ uint8_t _itemsLength = byteCount;
+ uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
+ while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->modbus_pdu_read_file_record_response_items = items;
+ (*_message)->modbus_pdu_read_file_record_response_items = items;
+
} else
if((error == false) && (function == 0x15) && (response == false)) { /* ModbusPDUWriteFileRecordRequest */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Length array
- uint8_t _itemsLength = byteCount;
- uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
- while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Length array
+ uint8_t _itemsLength = byteCount;
+ uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
+ while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->modbus_pdu_write_file_record_request_items = items;
+ (*_message)->modbus_pdu_write_file_record_request_items = items;
+
} else
if((error == false) && (function == 0x15) && (response == true)) { /* ModbusPDUWriteFileRecordResponse */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Length array
- uint8_t _itemsLength = byteCount;
- uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
- while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Length array
+ uint8_t _itemsLength = byteCount;
+ uint8_t itemsEndPos = plc4c_spi_read_get_pos(buf) + _itemsLength;
+ while(plc4c_spi_read_get_pos(buf) < itemsEndPos) {
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->modbus_pdu_write_file_record_response_items = items;
+ (*_message)->modbus_pdu_write_file_record_response_items = items;
+
} else
if((error == false) && (function == 0x07) && (response == false)) { /* ModbusPDUReadExceptionStatusRequest */
} else
if((error == false) && (function == 0x07) && (response == true)) { /* ModbusPDUReadExceptionStatusResponse */
+
+ // Simple Field (value)
+ uint8_t value = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->modbus_pdu_read_exception_status_response_value = value;
- // Simple Field (value)
- uint8_t value = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->modbus_pdu_read_exception_status_response_value = value;
} else
if((error == false) && (function == 0x08) && (response == false)) { /* ModbusPDUDiagnosticRequest */
+
+ // Simple Field (status)
+ uint16_t status = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_diagnostic_request_status = status;
- // Simple Field (status)
- uint16_t status = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_diagnostic_request_status = status;
+
+ // Simple Field (eventCount)
+ uint16_t eventCount = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_diagnostic_request_event_count = eventCount;
- // Simple Field (eventCount)
- uint16_t eventCount = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_diagnostic_request_event_count = eventCount;
} else
if((error == false) && (function == 0x0C) && (response == false)) { /* ModbusPDUGetComEventLogRequest */
} else
if((error == false) && (function == 0x0C) && (response == true)) { /* ModbusPDUGetComEventLogResponse */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Simple Field (status)
- uint16_t status = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_get_com_event_log_response_status = status;
+
+ // Simple Field (status)
+ uint16_t status = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_get_com_event_log_response_status = status;
- // Simple Field (eventCount)
- uint16_t eventCount = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_get_com_event_log_response_event_count = eventCount;
+
+ // Simple Field (eventCount)
+ uint16_t eventCount = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_get_com_event_log_response_event_count = eventCount;
- // Simple Field (messageCount)
- uint16_t messageCount = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->modbus_pdu_get_com_event_log_response_message_count = messageCount;
+
+ // Simple Field (messageCount)
+ uint16_t messageCount = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->modbus_pdu_get_com_event_log_response_message_count = messageCount;
- // Array field (events)
- plc4c_list* events = malloc(sizeof(plc4c_list));
- if(events == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = (byteCount) - (6);
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(events, &_value);
+
+ // Array field (events)
+ plc4c_list* events = malloc(sizeof(plc4c_list));
+ if(events == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_get_com_event_log_response_events = events;
+ {
+ // Count array
+ uint8_t itemCount = (byteCount) - (6);
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(events, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_get_com_event_log_response_events = events;
+
} else
if((error == false) && (function == 0x11) && (response == false)) { /* ModbusPDUReportServerIdRequest */
} else
if((error == false) && (function == 0x11) && (response == true)) { /* ModbusPDUReportServerIdResponse */
-
- // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t byteCount = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (value)
- plc4c_list* value = malloc(sizeof(plc4c_list));
- if(value == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = byteCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- int8_t _value = plc4c_spi_read_byte(buf, 8);
- plc4c_utils_list_insert_head_value(value, &_value);
+
+ // Array field (value)
+ plc4c_list* value = malloc(sizeof(plc4c_list));
+ if(value == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->modbus_pdu_report_server_id_response_value = value;
+ {
+ // Count array
+ uint8_t itemCount = byteCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ int8_t _value = plc4c_spi_read_byte(buf, 8);
+ plc4c_utils_list_insert_head_value(value, &_value);
+ }
+ }
+ (*_message)->modbus_pdu_report_server_id_response_value = value;
+
} else
if((error == false) && (function == 0x2B) && (response == false)) { /* ModbusPDUReadDeviceIdentificationRequest */
} else
diff --git a/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c b/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
index 075ff24..110facd 100644
--- a/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
+++ b/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
@@ -66,85 +66,100 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(tpduCode == 0xF0) { /* COTPPacketData */
+
+ // Simple Field (eot)
+ bool eot = plc4c_spi_read_bit(buf);
+ (*_message)->cotp_packet_data_eot = eot;
- // Simple Field (eot)
- bool eot = plc4c_spi_read_bit(buf);
- (*_message)->cotp_packet_data_eot = eot;
+
+ // Simple Field (tpduRef)
+ unsigned int tpduRef = plc4c_spi_read_unsigned_short(buf, 7);
+ (*_message)->cotp_packet_data_tpdu_ref = tpduRef;
- // Simple Field (tpduRef)
- unsigned int tpduRef = plc4c_spi_read_unsigned_short(buf, 7);
- (*_message)->cotp_packet_data_tpdu_ref = tpduRef;
} else
if(tpduCode == 0xE0) { /* COTPPacketConnectionRequest */
+
+ // Simple Field (destinationReference)
+ uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_connection_request_destination_reference = destinationReference;
- // Simple Field (destinationReference)
- uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_connection_request_destination_reference = destinationReference;
+
+ // Simple Field (sourceReference)
+ uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_connection_request_source_reference = sourceReference;
- // Simple Field (sourceReference)
- uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_connection_request_source_reference = sourceReference;
+
+ // Enum field (protocolClass)
+ plc4c_s7_read_write_cotp_protocol_class protocolClass = plc4c_spi_read_byte(buf, 8);
+ (*_message)->cotp_packet_connection_request_protocol_class = protocolClass;
- // Enum field (protocolClass)
- plc4c_s7_read_write_cotp_protocol_class protocolClass = plc4c_spi_read_byte(buf, 8);
- (*_message)->cotp_packet_connection_request_protocol_class = protocolClass;
} else
if(tpduCode == 0xD0) { /* COTPPacketConnectionResponse */
+
+ // Simple Field (destinationReference)
+ uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_connection_response_destination_reference = destinationReference;
- // Simple Field (destinationReference)
- uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_connection_response_destination_reference = destinationReference;
+
+ // Simple Field (sourceReference)
+ uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_connection_response_source_reference = sourceReference;
- // Simple Field (sourceReference)
- uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_connection_response_source_reference = sourceReference;
+
+ // Enum field (protocolClass)
+ plc4c_s7_read_write_cotp_protocol_class protocolClass = plc4c_spi_read_byte(buf, 8);
+ (*_message)->cotp_packet_connection_response_protocol_class = protocolClass;
- // Enum field (protocolClass)
- plc4c_s7_read_write_cotp_protocol_class protocolClass = plc4c_spi_read_byte(buf, 8);
- (*_message)->cotp_packet_connection_response_protocol_class = protocolClass;
} else
if(tpduCode == 0x80) { /* COTPPacketDisconnectRequest */
+
+ // Simple Field (destinationReference)
+ uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_disconnect_request_destination_reference = destinationReference;
- // Simple Field (destinationReference)
- uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_disconnect_request_destination_reference = destinationReference;
+
+ // Simple Field (sourceReference)
+ uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_disconnect_request_source_reference = sourceReference;
- // Simple Field (sourceReference)
- uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_disconnect_request_source_reference = sourceReference;
+
+ // Enum field (protocolClass)
+ plc4c_s7_read_write_cotp_protocol_class protocolClass = plc4c_spi_read_byte(buf, 8);
+ (*_message)->cotp_packet_disconnect_request_protocol_class = protocolClass;
- // Enum field (protocolClass)
- plc4c_s7_read_write_cotp_protocol_class protocolClass = plc4c_spi_read_byte(buf, 8);
- (*_message)->cotp_packet_disconnect_request_protocol_class = protocolClass;
} else
if(tpduCode == 0xC0) { /* COTPPacketDisconnectResponse */
+
+ // Simple Field (destinationReference)
+ uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_disconnect_response_destination_reference = destinationReference;
- // Simple Field (destinationReference)
- uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_disconnect_response_destination_reference = destinationReference;
+
+ // Simple Field (sourceReference)
+ uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_disconnect_response_source_reference = sourceReference;
- // Simple Field (sourceReference)
- uint16_t sourceReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_disconnect_response_source_reference = sourceReference;
} else
if(tpduCode == 0x70) { /* COTPPacketTpduError */
+
+ // Simple Field (destinationReference)
+ uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_packet_tpdu_error_destination_reference = destinationReference;
- // Simple Field (destinationReference)
- uint16_t destinationReference = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_packet_tpdu_error_destination_reference = destinationReference;
+
+ // Simple Field (rejectCause)
+ uint8_t rejectCause = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->cotp_packet_tpdu_error_reject_cause = rejectCause;
- // Simple Field (rejectCause)
- uint8_t rejectCause = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->cotp_packet_tpdu_error_reject_cause = rejectCause;
}
// Array field (parameters)
diff --git a/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c b/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
index 0d82f29..92b7411 100644
--- a/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
+++ b/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
@@ -63,46 +63,52 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_parse(plc4c_spi_read_buffer
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(parameterType == 0xC0) { /* COTPParameterTpduSize */
+
+ // Enum field (tpduSize)
+ plc4c_s7_read_write_cotp_tpdu_size tpduSize = plc4c_spi_read_byte(buf, 8);
+ (*_message)->cotp_parameter_tpdu_size_tpdu_size = tpduSize;
- // Enum field (tpduSize)
- plc4c_s7_read_write_cotp_tpdu_size tpduSize = plc4c_spi_read_byte(buf, 8);
- (*_message)->cotp_parameter_tpdu_size_tpdu_size = tpduSize;
} else
if(parameterType == 0xC1) { /* COTPParameterCallingTsap */
+
+ // Simple Field (tsapId)
+ uint16_t tsapId = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_parameter_calling_tsap_tsap_id = tsapId;
- // Simple Field (tsapId)
- uint16_t tsapId = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_parameter_calling_tsap_tsap_id = tsapId;
} else
if(parameterType == 0xC2) { /* COTPParameterCalledTsap */
+
+ // Simple Field (tsapId)
+ uint16_t tsapId = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->cotp_parameter_called_tsap_tsap_id = tsapId;
- // Simple Field (tsapId)
- uint16_t tsapId = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->cotp_parameter_called_tsap_tsap_id = tsapId;
} else
if(parameterType == 0xC3) { /* COTPParameterChecksum */
+
+ // Simple Field (crc)
+ uint8_t crc = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->cotp_parameter_checksum_crc = crc;
- // Simple Field (crc)
- uint8_t crc = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->cotp_parameter_checksum_crc = crc;
} else
if(parameterType == 0xE0) { /* COTPParameterDisconnectAdditionalInformation */
-
- // Array field (data)
- plc4c_list* data = malloc(sizeof(plc4c_list));
- if(data == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = rest;
- for(int curItem = 0; curItem < itemCount; curItem++) {
-
- uint8_t _value = plc4c_spi_read_unsigned_short(buf, 8);
- plc4c_utils_list_insert_head_value(data, &_value);
+
+ // Array field (data)
+ plc4c_list* data = malloc(sizeof(plc4c_list));
+ if(data == NULL) {
+ return NO_MEMORY;
}
- }
- (*_message)->cotp_parameter_disconnect_additional_information_data = data;
+ {
+ // Count array
+ uint8_t itemCount = rest;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+
+
+ uint8_t _value = plc4c_spi_read_unsigned_short(buf, 8);
+ plc4c_utils_list_insert_head_value(data, &_value);
+ }
+ }
+ (*_message)->cotp_parameter_disconnect_additional_information_data = data;
+
}
return OK;
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_address.c b/sandbox/plc4c/generated-sources/s7/src/s7_address.c
index e5c44a3..1d9659a 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_address.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_address.c
@@ -52,44 +52,51 @@ plc4c_return_code plc4c_s7_read_write_s7_address_parse(plc4c_spi_read_buffer* bu
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(addressType == 0x10) { /* S7AddressAny */
+
+ // Enum field (transportSize)
+ plc4c_s7_read_write_transport_size transportSize = plc4c_spi_read_byte(buf, 8);
+ (*_message)->s7_address_any_transport_size = transportSize;
- // Enum field (transportSize)
- plc4c_s7_read_write_transport_size transportSize = plc4c_spi_read_byte(buf, 8);
- (*_message)->s7_address_any_transport_size = transportSize;
+
+ // Simple Field (numberOfElements)
+ uint16_t numberOfElements = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->s7_address_any_number_of_elements = numberOfElements;
- // Simple Field (numberOfElements)
- uint16_t numberOfElements = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->s7_address_any_number_of_elements = numberOfElements;
+
+ // Simple Field (dbNumber)
+ uint16_t dbNumber = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->s7_address_any_db_number = dbNumber;
- // Simple Field (dbNumber)
- uint16_t dbNumber = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->s7_address_any_db_number = dbNumber;
+
+ // Enum field (area)
+ plc4c_s7_read_write_memory_area area = plc4c_spi_read_byte(buf, 8);
+ (*_message)->s7_address_any_area = area;
- // Enum field (area)
- plc4c_s7_read_write_memory_area area = plc4c_spi_read_byte(buf, 8);
- (*_message)->s7_address_any_area = area;
-
- // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
- {
- unsigned int _reserved = plc4c_spi_read_unsigned_short(buf, 5);
- if(_reserved != 0x00) {
- printf("Expected constant value '%d' but got '%d' for reserved field.", 0x00, _reserved);
+
+ // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
+ {
+ unsigned int _reserved = plc4c_spi_read_unsigned_short(buf, 5);
+ if(_reserved != 0x00) {
+ printf("Expected constant value '%d' but got '%d' for reserved field.", 0x00, _reserved);
+ }
}
- }
- // Simple Field (byteAddress)
- uint16_t byteAddress = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->s7_address_any_byte_address = byteAddress;
+
+ // Simple Field (byteAddress)
+ uint16_t byteAddress = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->s7_address_any_byte_address = byteAddress;
+
+
+ // Simple Field (bitAddress)
+ unsigned int bitAddress = plc4c_spi_read_unsigned_byte(buf, 3);
+ (*_message)->s7_address_any_bit_address = bitAddress;
- // Simple Field (bitAddress)
- unsigned int bitAddress = plc4c_spi_read_unsigned_byte(buf, 3);
- (*_message)->s7_address_any_bit_address = bitAddress;
}
return OK;
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_message.c b/sandbox/plc4c/generated-sources/s7/src/s7_message.c
index 328b4be..ec32324 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_message.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_message.c
@@ -86,26 +86,30 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
if(messageType == 0x01) { /* S7MessageRequest */
} else
if(messageType == 0x02) { /* S7MessageResponse */
+
+ // Simple Field (errorClass)
+ uint8_t errorClass = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_message_response_error_class = errorClass;
- // Simple Field (errorClass)
- uint8_t errorClass = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_message_response_error_class = errorClass;
+
+ // Simple Field (errorCode)
+ uint8_t errorCode = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_message_response_error_code = errorCode;
- // Simple Field (errorCode)
- uint8_t errorCode = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_message_response_error_code = errorCode;
} else
if(messageType == 0x03) { /* S7MessageResponseData */
+
+ // Simple Field (errorClass)
+ uint8_t errorClass = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_message_response_data_error_class = errorClass;
- // Simple Field (errorClass)
- uint8_t errorClass = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_message_response_data_error_class = errorClass;
+
+ // Simple Field (errorCode)
+ uint8_t errorCode = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_message_response_data_error_code = errorCode;
- // Simple Field (errorCode)
- uint8_t errorCode = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_message_response_data_error_code = errorCode;
} else
if(messageType == 0x07) { /* S7MessageUserData */
}
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c b/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
index 6357736..72c1b75 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
@@ -62,119 +62,131 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(parameterType == 0xF0) { /* S7ParameterSetupCommunication */
-
- // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
- {
- uint8_t _reserved = plc4c_spi_read_unsigned_short(buf, 8);
- if(_reserved != 0x00) {
- printf("Expected constant value '%d' but got '%d' for reserved field.", 0x00, _reserved);
+
+ // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
+ {
+ uint8_t _reserved = plc4c_spi_read_unsigned_short(buf, 8);
+ if(_reserved != 0x00) {
+ printf("Expected constant value '%d' but got '%d' for reserved field.", 0x00, _reserved);
+ }
}
- }
- // Simple Field (maxAmqCaller)
- uint16_t maxAmqCaller = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->s7_parameter_setup_communication_max_amq_caller = maxAmqCaller;
+
+ // Simple Field (maxAmqCaller)
+ uint16_t maxAmqCaller = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->s7_parameter_setup_communication_max_amq_caller = maxAmqCaller;
- // Simple Field (maxAmqCallee)
- uint16_t maxAmqCallee = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->s7_parameter_setup_communication_max_amq_callee = maxAmqCallee;
+
+ // Simple Field (maxAmqCallee)
+ uint16_t maxAmqCallee = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->s7_parameter_setup_communication_max_amq_callee = maxAmqCallee;
- // Simple Field (pduLength)
- uint16_t pduLength = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->s7_parameter_setup_communication_pdu_length = pduLength;
+
+ // Simple Field (pduLength)
+ uint16_t pduLength = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->s7_parameter_setup_communication_pdu_length = pduLength;
+
} else
if((parameterType == 0x04) && (messageType == 0x01)) { /* S7ParameterReadVarRequest */
-
- // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = numItems;
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = numItems;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_parameter_read_var_request_items = items;
+ (*_message)->s7_parameter_read_var_request_items = items;
+
} else
if((parameterType == 0x04) && (messageType == 0x03)) { /* S7ParameterReadVarResponse */
+
+ // Simple Field (numItems)
+ uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_parameter_read_var_response_num_items = numItems;
- // Simple Field (numItems)
- uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_parameter_read_var_response_num_items = numItems;
} else
if((parameterType == 0x05) && (messageType == 0x01)) { /* S7ParameterWriteVarRequest */
-
- // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = numItems;
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = numItems;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_parameter_write_var_request_items = items;
+ (*_message)->s7_parameter_write_var_request_items = items;
+
} else
if((parameterType == 0x05) && (messageType == 0x03)) { /* S7ParameterWriteVarResponse */
+
+ // Simple Field (numItems)
+ uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_parameter_write_var_response_num_items = numItems;
- // Simple Field (numItems)
- uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_parameter_write_var_response_num_items = numItems;
} else
if((parameterType == 0x00) && (messageType == 0x07)) { /* S7ParameterUserData */
-
- // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t numItems = plc4c_spi_read_unsigned_short(buf, 8);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = numItems;
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_s7_parameter_user_data_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = numItems;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_parameter_user_data_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_parameter_user_data_items = items;
+ (*_message)->s7_parameter_user_data_items = items;
+
}
return OK;
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 3eab327..360b806 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
@@ -52,70 +52,79 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(itemType == 0x12) { /* S7ParameterUserDataItemCPUFunctions */
+
+ // Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t itemLength = plc4c_spi_read_unsigned_short(buf, 8);
- // Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t itemLength = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Simple Field (method)
+ uint8_t method = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_method = method;
- // Simple Field (method)
- uint8_t method = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_parameter_user_data_item_cpu_functions_method = method;
+
+ // Simple Field (cpuFunctionType)
+ unsigned int cpuFunctionType = plc4c_spi_read_unsigned_byte(buf, 4);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_cpu_function_type = cpuFunctionType;
- // Simple Field (cpuFunctionType)
- unsigned int cpuFunctionType = plc4c_spi_read_unsigned_byte(buf, 4);
- (*_message)->s7_parameter_user_data_item_cpu_functions_cpu_function_type = cpuFunctionType;
+
+ // Simple Field (cpuFunctionGroup)
+ unsigned int cpuFunctionGroup = plc4c_spi_read_unsigned_byte(buf, 4);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_cpu_function_group = cpuFunctionGroup;
- // Simple Field (cpuFunctionGroup)
- unsigned int cpuFunctionGroup = plc4c_spi_read_unsigned_byte(buf, 4);
- (*_message)->s7_parameter_user_data_item_cpu_functions_cpu_function_group = cpuFunctionGroup;
+
+ // Simple Field (cpuSubfunction)
+ uint8_t cpuSubfunction = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_cpu_subfunction = cpuSubfunction;
- // Simple Field (cpuSubfunction)
- uint8_t cpuSubfunction = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_parameter_user_data_item_cpu_functions_cpu_subfunction = cpuSubfunction;
+
+ // Simple Field (sequenceNumber)
+ uint8_t sequenceNumber = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_sequence_number = sequenceNumber;
- // Simple Field (sequenceNumber)
- uint8_t sequenceNumber = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_parameter_user_data_item_cpu_functions_sequence_number = sequenceNumber;
-
- // Optional Field (dataUnitReferenceNumber) (Can be skipped, if a given expression evaluates to false)
- uint8_t* dataUnitReferenceNumber = NULL;
- if((cpuFunctionType) == (8)) {
- dataUnitReferenceNumber = malloc(sizeof(uint8_t));
- if(dataUnitReferenceNumber == NULL) {
- return NO_MEMORY;
+
+ // Optional Field (dataUnitReferenceNumber) (Can be skipped, if a given expression evaluates to false)
+ uint8_t* dataUnitReferenceNumber = NULL;
+ if((cpuFunctionType) == (8)) {
+ dataUnitReferenceNumber = malloc(sizeof(uint8_t));
+ if(dataUnitReferenceNumber == NULL) {
+ return NO_MEMORY;
+ }
+ *dataUnitReferenceNumber = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_data_unit_reference_number = dataUnitReferenceNumber;
}
- *dataUnitReferenceNumber = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_parameter_user_data_item_cpu_functions_data_unit_reference_number = dataUnitReferenceNumber;
- }
- // Optional Field (lastDataUnit) (Can be skipped, if a given expression evaluates to false)
- uint8_t* lastDataUnit = NULL;
- if((cpuFunctionType) == (8)) {
- lastDataUnit = malloc(sizeof(uint8_t));
- if(lastDataUnit == NULL) {
- return NO_MEMORY;
+
+ // Optional Field (lastDataUnit) (Can be skipped, if a given expression evaluates to false)
+ uint8_t* lastDataUnit = NULL;
+ if((cpuFunctionType) == (8)) {
+ lastDataUnit = malloc(sizeof(uint8_t));
+ if(lastDataUnit == NULL) {
+ return NO_MEMORY;
+ }
+ *lastDataUnit = plc4c_spi_read_unsigned_short(buf, 8);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_last_data_unit = lastDataUnit;
}
- *lastDataUnit = plc4c_spi_read_unsigned_short(buf, 8);
- (*_message)->s7_parameter_user_data_item_cpu_functions_last_data_unit = lastDataUnit;
- }
- // Optional Field (errorCode) (Can be skipped, if a given expression evaluates to false)
- uint16_t* errorCode = NULL;
- if((cpuFunctionType) == (8)) {
- errorCode = malloc(sizeof(uint16_t));
- if(errorCode == NULL) {
- return NO_MEMORY;
+
+ // Optional Field (errorCode) (Can be skipped, if a given expression evaluates to false)
+ uint16_t* errorCode = NULL;
+ if((cpuFunctionType) == (8)) {
+ errorCode = malloc(sizeof(uint16_t));
+ if(errorCode == NULL) {
+ return NO_MEMORY;
+ }
+ *errorCode = plc4c_spi_read_unsigned_int(buf, 16);
+ (*_message)->s7_parameter_user_data_item_cpu_functions_error_code = errorCode;
}
- *errorCode = plc4c_spi_read_unsigned_int(buf, 16);
- (*_message)->s7_parameter_user_data_item_cpu_functions_error_code = errorCode;
- }
+
}
return OK;
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_payload.c b/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
index 55b20cb..438f013 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
@@ -55,92 +55,96 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_parse(plc4c_spi_read_buffer* bu
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if((plc4c_s7_read_write_s7_parameter_get_discriminator(parameter->_type).parameterType == 0x04) && (messageType == 0x03)) { /* S7PayloadReadVarResponse */
-
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = ((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_read_var_response_num_items;
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_parse(buf, lastItem, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = ((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_read_var_response_num_items;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_parse(buf, lastItem, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_payload_read_var_response_items = items;
+ (*_message)->s7_payload_read_var_response_items = items;
+
} else
if((plc4c_s7_read_write_s7_parameter_get_discriminator(parameter->_type).parameterType == 0x05) && (messageType == 0x01)) { /* S7PayloadWriteVarRequest */
-
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = plc4c_spi_evaluation_helper_count(((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_write_var_request_items);
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_parse(buf, lastItem, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = plc4c_spi_evaluation_helper_count(((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_write_var_request_items);
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_parse(buf, lastItem, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_payload_write_var_request_items = items;
+ (*_message)->s7_payload_write_var_request_items = items;
+
} else
if((plc4c_s7_read_write_s7_parameter_get_discriminator(parameter->_type).parameterType == 0x05) && (messageType == 0x03)) { /* S7PayloadWriteVarResponse */
-
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = ((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_write_var_response_num_items;
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_status_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = ((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_write_var_response_num_items;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_status_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_payload_write_var_response_items = items;
+ (*_message)->s7_payload_write_var_response_items = items;
+
} else
if((plc4c_s7_read_write_s7_parameter_get_discriminator(parameter->_type).parameterType == 0x00) && (messageType == 0x07)) { /* S7PayloadUserData */
-
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = plc4c_spi_evaluation_helper_count(((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_user_data_items);
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_s7_payload_user_data_item_parse(buf, ((plc4c_s7_read_write_s7_parameter_user_data_item*) (plc4c_utils_list_get(((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_user_data_items, 0)))->s7_parameter_user_data_item_cpu_functions_cpu_function_type, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = plc4c_spi_evaluation_helper_count(((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_user_data_items);
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_payload_user_data_item_parse(buf, ((plc4c_s7_read_write_s7_parameter_user_data_item*) (plc4c_utils_list_get(((plc4c_s7_read_write_s7_parameter*) (parameter))->s7_parameter_user_data_items, 0)))->s7_parameter_user_data_item_cpu_functions_cpu_function_type, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_payload_user_data_items = items;
+ (*_message)->s7_payload_user_data_items = items;
+
}
return OK;
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 7a46d20..1644afc 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
@@ -77,38 +77,41 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_parse(plc4c_spi_
if(cpuFunctionType == 0x04) { /* S7PayloadUserDataItemCpuFunctionReadSzlRequest */
} else
if(cpuFunctionType == 0x08) { /* S7PayloadUserDataItemCpuFunctionReadSzlResponse */
-
- // Const Field (szlItemLength)
- uint16_t szlItemLength = plc4c_spi_read_unsigned_int(buf, 16);
- if(szlItemLength != S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH) {
- return PARSE_ERROR;
- // throw new ParseException("Expected constant value " + S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH + " but got " + szlItemLength);
- }
+
+ // Const Field (szlItemLength)
+ uint16_t szlItemLength = plc4c_spi_read_unsigned_int(buf, 16);
+ if(szlItemLength != S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH) {
+ return PARSE_ERROR;
+ // throw new ParseException("Expected constant value " + S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH + " but got " + szlItemLength);
+ }
- // Implicit Field (szlItemCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint16_t szlItemCount = plc4c_spi_read_unsigned_int(buf, 16);
+
+ // Implicit Field (szlItemCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint16_t szlItemCount = plc4c_spi_read_unsigned_int(buf, 16);
- // Array field (items)
- plc4c_list* items = malloc(sizeof(plc4c_list));
- if(items == NULL) {
- return NO_MEMORY;
- }
- {
- // Count array
- uint8_t itemCount = szlItemCount;
- for(int curItem = 0; curItem < itemCount; curItem++) {
- bool lastItem = curItem == (itemCount - 1);
- plc4c_list* _value = NULL;
- plc4c_return_code _res = plc4c_s7_read_write_szl_data_tree_item_parse(buf, (void*) &_value);
- if(_res != OK) {
- return _res;
+
+ // Array field (items)
+ plc4c_list* items = malloc(sizeof(plc4c_list));
+ if(items == NULL) {
+ return NO_MEMORY;
+ }
+ {
+ // Count array
+ uint8_t itemCount = szlItemCount;
+ for(int curItem = 0; curItem < itemCount; curItem++) {
+ bool lastItem = curItem == (itemCount - 1);
+ plc4c_list* _value = NULL;
+ plc4c_return_code _res = plc4c_s7_read_write_szl_data_tree_item_parse(buf, (void*) &_value);
+ if(_res != OK) {
+ return _res;
+ }
+ plc4c_utils_list_insert_head_value(items, _value);
}
- plc4c_utils_list_insert_head_value(items, _value);
}
- }
- (*_message)->s7_payload_user_data_item_cpu_function_read_szl_response_items = items;
+ (*_message)->s7_payload_user_data_item_cpu_function_read_szl_response_items = items;
+
}
return OK;
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 df1f3f7..46fe0ba 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
@@ -57,6 +57,7 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_parse(plc4c_spi_r
uint8_t itemCount = ((plc4c_s7_read_write_data_transport_size_get_size_in_bits(transportSize)) ? plc4c_spi_evaluation_helper_ceil((dataLength) / (8.0)) : dataLength);
for(int curItem = 0; curItem < itemCount; curItem++) {
+
int8_t _value = plc4c_spi_read_byte(buf, 8);
plc4c_utils_list_insert_head_value(data, &_value);
}
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 6da1d2a..a381720 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
@@ -52,18 +52,20 @@ plc4c_return_code plc4c_s7_read_write_s7_var_request_parameter_item_parse(plc4c_
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(itemType == 0x12) { /* S7VarRequestParameterItemAddress */
+
+ // Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ uint8_t itemLength = plc4c_spi_read_unsigned_short(buf, 8);
- // Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- uint8_t itemLength = plc4c_spi_read_unsigned_short(buf, 8);
+
+ // Simple Field (address)
+ plc4c_s7_read_write_s7_address* address;
+ plc4c_return_code _res = plc4c_s7_read_write_s7_address_parse(buf, (void*) &address);
+ if(_res != OK) {
+ return _res;
+ }
+ (*_message)->s7_var_request_parameter_item_address_address = address;
- // Simple Field (address)
- plc4c_s7_read_write_s7_address* address;
- plc4c_return_code _res = plc4c_s7_read_write_s7_address_parse(buf, (void*) &address);
- if(_res != OK) {
- return _res;
- }
- (*_message)->s7_var_request_parameter_item_address_address = address;
}
return OK;
diff --git a/sandbox/plc4c/generated-sources/s7/src/szl_data_tree_item.c b/sandbox/plc4c/generated-sources/s7/src/szl_data_tree_item.c
index 41b209f..423d163 100644
--- a/sandbox/plc4c/generated-sources/s7/src/szl_data_tree_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/szl_data_tree_item.c
@@ -49,6 +49,7 @@ plc4c_return_code plc4c_s7_read_write_szl_data_tree_item_parse(plc4c_spi_read_bu
uint8_t itemCount = 20;
for(int curItem = 0; curItem < itemCount; curItem++) {
+
int8_t _value = plc4c_spi_read_byte(buf, 8);
plc4c_utils_list_insert_head_value(mlfb, &_value);
}