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/30 13:43:08 UTC
[plc4x] branch develop updated: - cleaned up the code generation -
got rid of almost all compiler warning - fixed a bug in the code generation
using uint8 only fo rup to 4 bits (was initially using the same offset as
in java)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 686e6a9 - cleaned up the code generation - got rid of almost all compiler warning - fixed a bug in the code generation using uint8 only fo rup to 4 bits (was initially using the same offset as in java)
686e6a9 is described below
commit 686e6a9feefdb1a3c1e8907537bd5ec78f1518cd
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Jun 30 15:43:01 2020 +0200
- cleaned up the code generation
- got rid of almost all compiler warning
- fixed a bug in the code generation using uint8 only fo rup to 4 bits (was initially using the same offset as in java)
---
.../protocol/freemarker/FreemarkerException.java | 34 ++
.../plc4x/language/c/CLanguageTemplateHelper.java | 181 ++++---
.../main/resources/templates/c/enum-template.ftlh | 16 +-
.../resources/templates/c/pojo-template-c.ftlh | 48 +-
.../resources/templates/c/pojo-template-h.ftlh | 34 +-
.../modbus/includes/modbus_constants.h | 2 +-
.../generated-sources/modbus/includes/modbus_pdu.h | 72 +--
.../modbus/includes/modbus_tcp_adu.h | 2 +-
.../modbus/src/modbus_constants.c | 8 +-
.../generated-sources/modbus/src/modbus_pdu.c | 536 ++++++++++-----------
.../src/modbus_pdu_read_file_record_request_item.c | 16 +-
.../modbus_pdu_read_file_record_response_item.c | 12 +-
.../modbus_pdu_write_file_record_request_item.c | 20 +-
.../modbus_pdu_write_file_record_response_item.c | 20 +-
.../modbus/src/modbus_serial_adu.c | 16 +-
.../generated-sources/modbus/src/modbus_tcp_adu.c | 20 +-
.../generated-sources/s7/includes/cotp_packet.h | 12 +-
.../generated-sources/s7/includes/cotp_parameter.h | 10 +-
.../generated-sources/s7/includes/memory_area.h | 2 +-
.../generated-sources/s7/includes/s7_address.h | 2 +-
.../generated-sources/s7/includes/s7_message.h | 10 +-
.../generated-sources/s7/includes/s7_parameter.h | 12 +-
.../s7/includes/s7_parameter_user_data_item.h | 2 +-
.../generated-sources/s7/includes/s7_payload.h | 8 +-
.../s7/includes/s7_payload_user_data_item.h | 6 +-
.../s7/includes/s7_var_request_parameter_item.h | 2 +-
.../generated-sources/s7/includes/tpkt_packet.h | 2 +-
.../plc4c/generated-sources/s7/src/cotp_packet.c | 102 ++--
.../generated-sources/s7/src/cotp_parameter.c | 64 +--
.../plc4c/generated-sources/s7/src/s7_address.c | 28 +-
.../plc4c/generated-sources/s7/src/s7_message.c | 76 +--
.../plc4c/generated-sources/s7/src/s7_parameter.c | 94 ++--
.../s7/src/s7_parameter_user_data_item.c | 40 +-
.../plc4c/generated-sources/s7/src/s7_payload.c | 40 +-
.../s7/src/s7_payload_user_data_item.c | 38 +-
.../s7/src/s7_var_payload_data_item.c | 8 +-
.../s7/src/s7_var_request_parameter_item.c | 16 +-
.../generated-sources/s7/src/szl_data_tree_item.c | 16 +-
.../plc4c/generated-sources/s7/src/tpkt_packet.c | 16 +-
sandbox/plc4c/spi/src/write_buffer.c | 2 +-
40 files changed, 834 insertions(+), 811 deletions(-)
diff --git a/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerException.java b/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerException.java
new file mode 100644
index 0000000..567a46d
--- /dev/null
+++ b/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerException.java
@@ -0,0 +1,34 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.plc4x.plugins.codegenerator.protocol.freemarker;
+
+public class FreemarkerException extends RuntimeException {
+
+ public FreemarkerException() {
+ }
+
+ public FreemarkerException(String message) {
+ super(message);
+ }
+
+ public FreemarkerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java b/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
index aece801..1dff5e0 100644
--- a/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
+++ b/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
@@ -20,6 +20,7 @@ package org.apache.plc4x.language.c;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.plc4x.plugins.codegenerator.protocol.freemarker.BaseFreemarkerLanguageTemplateHelper;
+import org.apache.plc4x.plugins.codegenerator.protocol.freemarker.FreemarkerException;
import org.apache.plc4x.plugins.codegenerator.types.definitions.*;
import org.apache.plc4x.plugins.codegenerator.types.enums.EnumValue;
import org.apache.plc4x.plugins.codegenerator.types.fields.*;
@@ -51,7 +52,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
* @return c-style type name
*/
public String getCTypeName(String typeName) {
- return camelCaseToSnakeCase(getProtocolName()).toLowerCase() +
+ return "plc4c_" + camelCaseToSnakeCase(getProtocolName()).toLowerCase() +
"_" + camelCaseToSnakeCase(getFlavorName()).toLowerCase() +
"_" + camelCaseToSnakeCase(typeName).toLowerCase();
}
@@ -109,7 +110,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
@Override
public String getLanguageTypeNameForField(Field field) {
if(!(field instanceof TypedField)) {
- throw new RuntimeException("Field " + field + " is not a TypedField");
+ throw new FreemarkerException("Field " + field + " is not a TypedField");
}
// If this is an array with variable length, then we have to use our "plc4c_list" to store the data.
if ((field instanceof ArrayField) && (!isFixedValueExpression(((ArrayField) field).getLoopExpression()))) {
@@ -162,12 +163,9 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
final Optional<Argument> parserArgument = Arrays.stream(typeDefinition.getParserArguments()).filter(argument -> argument.getName().equals(propertyName)).findFirst();
// If the property name refers to a parser argument, as soon as it's a complex type,
// pointer access is required.
- if(parserArgument.isPresent()) {
- return parserArgument.get().getType() instanceof ComplexTypeReference;
- }
+ return parserArgument.filter(argument -> argument.getType() instanceof ComplexTypeReference).isPresent();
// In all other cases, the property might be a built-in constant, so we don't need pointer
// access for any of these.
- return false;
}
/**
@@ -218,21 +216,21 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
if (sizeInBits <= 64) {
return "double";
}
- return "unsupported";
+ throw new FreemarkerException("Unsupported float type with " + sizeInBits + " bits.");
case UFLOAT:
- throw new RuntimeException("Unsigned floats are not supported");
+ throw new FreemarkerException("Unsupported unsigned float type.");
case STRING:
- return "char *";
+ return "char*";
case TIME:
- return "unsupported";
+ throw new FreemarkerException("Unsupported time type.");
case DATE:
- return "unsupported";
+ throw new FreemarkerException("Unsupported date type.");
case DATETIME:
- return "unsupported";
+ throw new FreemarkerException("Unsupported date-time type.");
}
- return "unsupported";
+ throw new FreemarkerException("Unsupported simple type. " + simpleTypeReference.getBaseType());
} else {
- return "plc4c_" + getCTypeName(((ComplexTypeReference) typeReference).getName());
+ return getCTypeName(((ComplexTypeReference) typeReference).getName());
}
}
@@ -331,7 +329,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
}
String typeName = valueString.substring(0, valueString.indexOf('.'));
String constantName = valueString.substring(valueString.indexOf('.') + 1);
- return "plc4c_" + getCTypeName(typeName) + "_" + constantName;
+ return getCTypeName(typeName) + "_" + constantName;
} else {
return escapeValue(typeReference, valueString);
}
@@ -350,26 +348,24 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
@Override
public String getReadBufferReadMethodCall(SimpleTypeReference simpleTypeReference, String valueString) {
switch (simpleTypeReference.getBaseType()) {
- case BIT: {
+ case BIT:
return "plc4c_spi_read_bit(buf, (bool*) " + valueString + ")";
- }
- case UINT: {
- IntegerTypeReference integerTypeReference = (IntegerTypeReference) simpleTypeReference;
- if (integerTypeReference.getSizeInBits() <= 4) {
- return "plc4c_spi_read_unsigned_byte(buf, " + integerTypeReference.getSizeInBits() + ", (uint8_t*) " + valueString + ")";
+ case UINT:
+ IntegerTypeReference unsignedIntegerTypeReference = (IntegerTypeReference) simpleTypeReference;
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 8) {
+ return "plc4c_spi_read_unsigned_byte(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", (uint8_t*) " + valueString + ")";
}
- if (integerTypeReference.getSizeInBits() <= 8) {
- return "plc4c_spi_read_unsigned_short(buf, " + integerTypeReference.getSizeInBits() + ", (uint16_t*) " + valueString + ")";
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 16) {
+ return "plc4c_spi_read_unsigned_short(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", (uint16_t*) " + valueString + ")";
}
- if (integerTypeReference.getSizeInBits() <= 16) {
- return "plc4c_spi_read_unsigned_int(buf, " + integerTypeReference.getSizeInBits() + ", (uint32_t*) " + valueString + ")";
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 32) {
+ return "plc4c_spi_read_unsigned_int(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", (uint32_t*) " + valueString + ")";
}
- if (integerTypeReference.getSizeInBits() <= 32) {
- return "plc4c_spi_read_unsigned_long(buf, " + integerTypeReference.getSizeInBits() + ", (uint64_t*) " + valueString + ")";
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 64) {
+ return "plc4c_spi_read_unsigned_long(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", (uint64_t*) " + valueString + ")";
}
- return "plc4c_spi_read_unsigned_big_integer(buf, " + integerTypeReference.getSizeInBits() + ", " + valueString + ")";
- }
- case INT: {
+ throw new FreemarkerException("Unsupported unsigned integer type with " + unsignedIntegerTypeReference.getSizeInBits() + " bits");
+ case INT:
IntegerTypeReference integerTypeReference = (IntegerTypeReference) simpleTypeReference;
if (integerTypeReference.getSizeInBits() <= 8) {
return "plc4c_spi_read_byte(buf, " + integerTypeReference.getSizeInBits() + ", (int8_t*) " + valueString + ")";
@@ -383,48 +379,45 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
if (integerTypeReference.getSizeInBits() <= 64) {
return "plc4c_spi_read_long(buf, " + integerTypeReference.getSizeInBits() + ", (int64_t*) " + valueString + ")";
}
- return "plc4c_spi_read_big_integer(buf, " + integerTypeReference.getSizeInBits() + ", " + valueString + ")";
- }
- case FLOAT: {
+ throw new FreemarkerException("Unsupported signed integer type with " + integerTypeReference.getSizeInBits() + " bits");
+ case FLOAT:
FloatTypeReference floatTypeReference = (FloatTypeReference) simpleTypeReference;
if (floatTypeReference.getSizeInBits() <= 32) {
return "plc4c_spi_read_float(buf, " + floatTypeReference.getSizeInBits() + ", (float*) " + valueString + ")";
- } else {
+ } else if(floatTypeReference.getSizeInBits() <= 64) {
return "plc4c_spi_read_double(buf, " + floatTypeReference.getSizeInBits() + ", (double*) " + valueString + ")";
}
- }
- case STRING: {
+ throw new FreemarkerException("Unsupported float type with " + floatTypeReference.getSizeInBits() + " bits");
+ case STRING:
StringTypeReference stringTypeReference = (StringTypeReference) simpleTypeReference;
return "plc4c_spi_read_string(buf, " + stringTypeReference.getSizeInBits() + ", \"" +
stringTypeReference.getEncoding() + "\"" + ", (char**) " + valueString + ")";
- }
+ default:
+ throw new FreemarkerException("Unsupported type " + simpleTypeReference.getBaseType().name());
}
- return "Hurz";
}
@Override
public String getWriteBufferWriteMethodCall(SimpleTypeReference simpleTypeReference, String fieldName) {
switch (simpleTypeReference.getBaseType()) {
- case BIT: {
+ case BIT:
return "plc4c_spi_write_bit(buf, " + fieldName + ")";
- }
- case UINT: {
- IntegerTypeReference integerTypeReference = (IntegerTypeReference) simpleTypeReference;
- if (integerTypeReference.getSizeInBits() <= 4) {
- return "plc4c_spi_write_unsigned_byte(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
+ case UINT:
+ IntegerTypeReference unsignedIntegerTypeReference = (IntegerTypeReference) simpleTypeReference;
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 8) {
+ return "plc4c_spi_write_unsigned_byte(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", " + fieldName + ")";
}
- if (integerTypeReference.getSizeInBits() <= 8) {
- return "plc4c_spi_write_unsigned_short(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 16) {
+ return "plc4c_spi_write_unsigned_short(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", " + fieldName + ")";
}
- if (integerTypeReference.getSizeInBits() <= 16) {
- return "plc4c_spi_write_unsigned_int(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 32) {
+ return "plc4c_spi_write_unsigned_int(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", " + fieldName + ")";
}
- if (integerTypeReference.getSizeInBits() <= 32) {
- return "plc4c_spi_write_unsigned_long(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
+ if (unsignedIntegerTypeReference.getSizeInBits() <= 64) {
+ return "plc4c_spi_write_unsigned_long(buf, " + unsignedIntegerTypeReference.getSizeInBits() + ", " + fieldName + ")";
}
- return "plc4c_spi_write_unsigned_big_integer(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
- }
- case INT: {
+ throw new FreemarkerException("Unsupported unsigned integer type with " + unsignedIntegerTypeReference.getSizeInBits() + " bits");
+ case INT:
IntegerTypeReference integerTypeReference = (IntegerTypeReference) simpleTypeReference;
if (integerTypeReference.getSizeInBits() <= 8) {
return "plc4c_spi_write_byte(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
@@ -438,23 +431,22 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
if (integerTypeReference.getSizeInBits() <= 64) {
return "plc4c_spi_write_long(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
}
- return "plc4c_spi_write_big_integer(buf, " + integerTypeReference.getSizeInBits() + ", " + fieldName + ")";
- }
- case FLOAT: {
+ throw new FreemarkerException("Unsupported signed integer type with " + integerTypeReference.getSizeInBits() + " bits");
+ case FLOAT:
FloatTypeReference floatTypeReference = (FloatTypeReference) simpleTypeReference;
if (floatTypeReference.getSizeInBits() <= 32) {
return "plc4c_spi_write_float(buf, " + floatTypeReference.getSizeInBits() + ", " + fieldName + ")";
- } else {
+ } else if(floatTypeReference.getSizeInBits() <= 64) {
return "plc4c_spi_write_double(buf, " + floatTypeReference.getSizeInBits() + ", " + fieldName + ")";
}
- }
- case STRING: {
+ throw new FreemarkerException("Unsupported float type with " + floatTypeReference.getSizeInBits() + " bits");
+ case STRING:
StringTypeReference stringTypeReference = (StringTypeReference) simpleTypeReference;
return "plc4c_spi_write_string(buf, " + stringTypeReference.getSizeInBits() + ", \"" +
stringTypeReference.getEncoding() + "\", " + fieldName + ")";
- }
+ default:
+ throw new FreemarkerException("Unsupported type " + simpleTypeReference.getBaseType().name());
}
- throw new RuntimeException("Unsupported type");
}
@Override
@@ -465,25 +457,25 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
case BIT:
return "false";
case UINT:
- case INT: {
+ case INT:
return "0";
- }
case FLOAT:
case UFLOAT:
return "0.0";
case STRING:
return "\"\"";
case TIME:
- return "unsupported";
+ throw new FreemarkerException("Unsupported time type.");
case DATE:
- return "unsupported";
+ throw new FreemarkerException("Unsupported date type.");
case DATETIME:
- return "unsupported";
+ throw new FreemarkerException("Unsupported date-time type.");
+ default:
+ throw new FreemarkerException("Unsupported type.");
}
- return "unsupported";
} else {
ComplexTypeReference complexTypeReference = (ComplexTypeReference) typeReference;
- return "plc4c_" + getCTypeName(complexTypeReference.getName()) + "_null";
+ return getCTypeName(complexTypeReference.getName()) + "_null";
}
}
@@ -524,12 +516,12 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
} else {
final Optional<TypeReference> typeReferenceForProperty = getTypeReferenceForProperty(baseType, variableLiteral.getName());
if(!typeReferenceForProperty.isPresent()) {
- throw new RuntimeException("Unknown type for property " + variableLiteral.getName());
+ throw new FreemarkerException("Unknown type for property " + variableLiteral.getName());
}
lengthType = (ComplexTypeDefinition) getTypeDefinitionForTypeReference(typeReferenceForProperty.get());
lengthExpression = variableExpressionGenerator.apply(term);
}
- return "plc4c_" + getCTypeName(lengthType.getName()) + "_length_in_bytes(" + lengthExpression + ")";
+ return getCTypeName(lengthType.getName()) + "_length_in_bytes(" + lengthExpression + ")";
} else if (variableLiteral.getName().equals("lastItem")) {
return "lastItem";
// If this literal references an Enum type, then we have to output it differently.
@@ -539,7 +531,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
return variableExpressionGenerator.apply(term);
}
} else {
- throw new RuntimeException("Unsupported Literal type " + term.getClass().getName());
+ throw new FreemarkerException("Unsupported Literal type " + term.getClass().getName());
}
} else if (term instanceof UnaryTerm) {
UnaryTerm ut = (UnaryTerm) term;
@@ -552,19 +544,17 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
case "()":
return "(" + toExpression(baseType, field, a, variableExpressionGenerator) + ")";
default:
- throw new RuntimeException("Unsupported unary operation type " + ut.getOperation());
+ throw new FreemarkerException("Unsupported unary operation type " + ut.getOperation());
}
} else if (term instanceof BinaryTerm) {
BinaryTerm bt = (BinaryTerm) term;
Term a = bt.getA();
Term b = bt.getB();
String operation = bt.getOperation();
- switch (operation) {
- case "^":
- return "Math.pow((" + toExpression(baseType, field, a, variableExpressionGenerator) + "), (" + toExpression(baseType, field, b, variableExpressionGenerator) + "))";
- default:
- return "(" + toExpression(baseType, field, a, variableExpressionGenerator) + ") " + operation + " (" + toExpression(baseType, field, b, variableExpressionGenerator) + ")";
+ if ("^".equals(operation)) {
+ return "Math.pow((" + toExpression(baseType, field, a, variableExpressionGenerator) + "), (" + toExpression(baseType, field, b, variableExpressionGenerator) + "))";
}
+ return "(" + toExpression(baseType, field, a, variableExpressionGenerator) + ") " + operation + " (" + toExpression(baseType, field, b, variableExpressionGenerator) + ")";
} else if (term instanceof TernaryTerm) {
TernaryTerm tt = (TernaryTerm) term;
if ("if".equals(tt.getOperation())) {
@@ -573,10 +563,10 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
Term c = tt.getC();
return "((" + toExpression(baseType, field, a, variableExpressionGenerator) + ") ? " + toExpression(baseType, field, b, variableExpressionGenerator) + " : " + toExpression(baseType, field, c, variableExpressionGenerator) + ")";
} else {
- throw new RuntimeException("Unsupported ternary operation type " + tt.getOperation());
+ throw new FreemarkerException("Unsupported ternary operation type " + tt.getOperation());
}
} else {
- throw new RuntimeException("Unsupported Term type " + term.getClass().getName());
+ throw new FreemarkerException("Unsupported Term type " + term.getClass().getName());
}
}
@@ -585,7 +575,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
if("CAST".equals(vl.getName())) {
if((vl.getArgs() == null) || (vl.getArgs().size() != 2)) {
- throw new RuntimeException("A CAST expression expects exactly two arguments.");
+ throw new FreemarkerException("A CAST expression expects exactly two arguments.");
}
final VariableLiteral sourceTerm = (VariableLiteral) vl.getArgs().get(0);
final VariableLiteral typeTerm = (VariableLiteral) vl.getArgs().get(1);
@@ -595,7 +585,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
// type instead and add the name of the sub-type as prefix to the property we're tryging to
// access next.
StringBuilder sb = new StringBuilder();
- sb.append("((plc4c_");
+ sb.append("((");
if(castType.getParentType() != null) {
sb.append(getCTypeName(castType.getParentType().getName()));
} else {
@@ -650,7 +640,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
// If we couldn't find the type, we didn't find the property.
if(!propertyTypeOptional.isPresent()) {
- throw new RuntimeException("Could not find property with name '" + name + "' in type " + baseType.getName());
+ throw new FreemarkerException("Could not find property with name '" + name + "' in type " + baseType.getName());
}
final TypeReference propertyType = propertyTypeOptional.get();
@@ -658,7 +648,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
// If it's a simple field, there is no sub-type to access.
if(propertyType instanceof SimpleTypeReference) {
if(vl.getChild() != null) {
- throw new RuntimeException("Simple property '" + name + "' doesn't have child properties.");
+ throw new FreemarkerException("Simple property '" + name + "' doesn't have child properties.");
}
return name;
}
@@ -678,14 +668,13 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
discriminatorField -> discriminatorField.getName().equals(vl.getChild().getName())).findFirst();
// If child references a discriminator field of the type we found, we have to escape it.
if (discriminatorFieldOptional.isPresent()) {
- return "plc4c_" + getCTypeName(propertyTypeDefinition.getName()) + "_get_discriminator(" + name + "->_type)." + vl.getChild().getName();
+ return getCTypeName(propertyTypeDefinition.getName()) + "_get_discriminator(" + name + "->_type)." + vl.getChild().getName();
}
}
// Handling enum properties in C is a little more tricky as we have to use the enum value
// and pass this to a function that then returns the desired property value.
else if(propertyTypeDefinition instanceof EnumTypeDefinition) {
- return "plc4c_" +
- getCTypeName(propertyTypeDefinition.getName()) +
+ return getCTypeName(propertyTypeDefinition.getName()) +
"_get_" + camelCaseToSnakeCase(vl.getChild().getName()) +
"(" + vl.getName() + ")";
}
@@ -703,7 +692,7 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
if ("STATIC_CALL".equals(vl.getName())) {
StringBuilder sb = new StringBuilder();
if (!(vl.getArgs().get(0) instanceof StringLiteral)) {
- throw new RuntimeException("Expecting the first argument of a 'STATIC_CALL' to be a StringLiteral");
+ throw new FreemarkerException("Expecting the first argument of a 'STATIC_CALL' to be a StringLiteral");
}
String methodName = ((StringLiteral) vl.getArgs().get(0)).getValue();
methodName = methodName.substring(1, methodName.length() - 1);
@@ -743,11 +732,11 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
break;
case "encoding":
if(!(field instanceof TypedField)) {
- throw new RuntimeException("'encoding' only supported for typed fields.");
+ throw new FreemarkerException("'encoding' only supported for typed fields.");
}
TypedField typedField = (TypedField) field;
if(!(typedField.getType() instanceof StringTypeReference)) {
- throw new RuntimeException("Can only access 'encoding' for string types.");
+ throw new FreemarkerException("Can only access 'encoding' for string types.");
}
StringTypeReference stringTypeReference = (StringTypeReference) typedField.getType();
String encoding = stringTypeReference.getEncoding();
@@ -806,11 +795,11 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
break;
case "encoding":
if(!(field instanceof TypedField)) {
- throw new RuntimeException("'encoding' only supported for typed fields.");
+ throw new FreemarkerException("'encoding' only supported for typed fields.");
}
TypedField typedField = (TypedField) field;
if(!(typedField.getType() instanceof StringTypeReference)) {
- throw new RuntimeException("Can only access 'encoding' for string types.");
+ throw new FreemarkerException("Can only access 'encoding' for string types.");
}
StringTypeReference stringTypeReference = (StringTypeReference) typedField.getType();
String encoding = stringTypeReference.getEncoding();
@@ -858,11 +847,11 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
return "\"" + ((SimpleTypeReference) field).getSizeInBits() + "\"";
case "encoding":
if(!(field instanceof TypedField)) {
- throw new RuntimeException("'encoding' only supported for typed fields.");
+ throw new FreemarkerException("'encoding' only supported for typed fields.");
}
TypedField typedField = (TypedField) field;
if(!(typedField.getType() instanceof StringTypeReference)) {
- throw new RuntimeException("Can only access 'encoding' for string types.");
+ throw new FreemarkerException("Can only access 'encoding' for string types.");
}
StringTypeReference stringTypeReference = (StringTypeReference) typedField.getType();
String encoding = stringTypeReference.getEncoding();
@@ -957,12 +946,12 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
final TypeReference typeReference = typedField.getType();
if(typeReference instanceof ComplexTypeReference) {
ComplexTypeReference complexTypeReference = (ComplexTypeReference) typeReference;
- return "plc4c_" + getCTypeName(complexTypeReference.getName()) + "_length_in_bits";
+ return getCTypeName(complexTypeReference.getName()) + "_length_in_bits";
} else {
- throw new RuntimeException("lengthInBits functions only exist for complex types");
+ throw new FreemarkerException("lengthInBits functions only exist for complex types");
}
} else {
- throw new RuntimeException("lengthInBits functions only exist for TypedFields");
+ throw new FreemarkerException("lengthInBits functions only exist for TypedFields");
}
}
diff --git a/build-utils/language-c/src/main/resources/templates/c/enum-template.ftlh b/build-utils/language-c/src/main/resources/templates/c/enum-template.ftlh
index 0c91c40..1d9b019 100644
--- a/build-utils/language-c/src/main/resources/templates/c/enum-template.ftlh
+++ b/build-utils/language-c/src/main/resources/templates/c/enum-template.ftlh
@@ -36,8 +36,8 @@ ${helper.getIncludesDirectory()?replace(".", "/")}/${helper.camelCaseToSnakeCase
under the License.
*/
-#ifndef PLC4C_${helper.getCTypeName(type.name)?upper_case}_H_
-#define PLC4C_${helper.getCTypeName(type.name)?upper_case}_H_
+#ifndef ${helper.getCTypeName(type.name)?upper_case}_H_
+#define ${helper.getCTypeName(type.name)?upper_case}_H_
#ifdef __cplusplus
extern "C" {
#endif
@@ -55,16 +55,16 @@ extern "C" {
<#--
First output the enum itself together with it's constants
-->
-enum plc4c_${helper.getCTypeName(type.name)} {
+enum ${helper.getCTypeName(type.name)} {
<#list type.enumValues as enumValue>
- plc4c_${helper.getCTypeName(type.name)}_${enumValue.name} = ${enumValue.value}<#sep>,
+ ${helper.getCTypeName(type.name)}_${enumValue.name} = ${enumValue.value}<#sep>,
</#sep></#list>
};
-typedef enum plc4c_${helper.getCTypeName(type.name)} plc4c_${helper.getCTypeName(type.name)};
+typedef enum ${helper.getCTypeName(type.name)} ${helper.getCTypeName(type.name)};
// Create an empty NULL-struct
-static const plc4c_${helper.getCTypeName(type.name)} plc4c_${helper.getCTypeName(type.name)}_null;
+static const ${helper.getCTypeName(type.name)} ${helper.getCTypeName(type.name)}_null;
<#--
If this enum also defines constant values, output one function for each.
@@ -74,7 +74,7 @@ static const plc4c_${helper.getCTypeName(type.name)} plc4c_${helper.getCTypeName
<#if type.constantNames?has_content>
<#list type.constantNames as constantName>
-${helper.getLanguageTypeNameForTypeReference(type.getConstantType(constantName))} plc4c_${helper.getCTypeName(type.name)}_get_${helper.camelCaseToSnakeCase(constantName)}(plc4c_${helper.getCTypeName(type.name)} value) {
+${helper.getLanguageTypeNameForTypeReference(type.getConstantType(constantName))} ${helper.getCTypeName(type.name)}_get_${helper.camelCaseToSnakeCase(constantName)}(${helper.getCTypeName(type.name)} value) {
switch(value) {
<#list helper.getUniqueEnumValues(type.enumValues) as enumValue>
case ${helper.escapeValue(type.type, enumValue.value)}: { /* '${enumValue.value}' */
@@ -93,4 +93,4 @@ ${helper.getLanguageTypeNameForTypeReference(type.getConstantType(constantName))
#ifdef __cplusplus
}
#endif
-#endif // PLC4C_${helper.getCTypeName(type.name)?upper_case}_H_
+#endif // ${helper.getCTypeName(type.name)?upper_case}_H_
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 d2aae13..09290c3 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
@@ -72,7 +72,7 @@
// Array of discriminator values that match the enum type constants.
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
-const plc4c_${helper.getCTypeName(type.name)}_discriminator plc4c_${helper.getCTypeName(type.name)}_discriminators[] = {
+const ${helper.getCTypeName(type.name)}_discriminator ${helper.getCTypeName(type.name)}_discriminators[] = {
<#if helper.getDiscriminatorValues()?has_content>
<#list helper.getDiscriminatorValues() as name, typeValues>
{/* ${helper.getCTypeName(name)} */
@@ -83,19 +83,19 @@ const plc4c_${helper.getCTypeName(type.name)}_discriminator plc4c_${helper.getCT
};
// Function returning the discriminator values for a given type constant.
-plc4c_${helper.getCTypeName(type.name)}_discriminator plc4c_${helper.getCTypeName(type.name)}_get_discriminator(plc4c_${helper.getCTypeName(type.name)}_type type) {
- return plc4c_${helper.getCTypeName(type.name)}_discriminators[type];
+${helper.getCTypeName(type.name)}_discriminator ${helper.getCTypeName(type.name)}_get_discriminator(${helper.getCTypeName(type.name)}_type type) {
+ return ${helper.getCTypeName(type.name)}_discriminators[type];
}
</#if>
// Parse function.
-plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_buffer* buf, <#if type.parserArguments?has_content><#list type.parserArguments as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#if !helper.isSimpleTypeReference(parserArgument.type)>*</#if> ${parserArgument.name}<#sep>, </#list>, </#if>plc4c_${helper.getCTypeName(type.name)}** _message) {
+plc4c_return_code ${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_buffer* buf, <#if type.parserArguments?has_content><#list type.parserArguments as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#if !helper.isSimpleTypeReference(parserArgument.type)>*</#if> ${parserArgument.name}<#sep>, </#list>, </#if>${helper.getCTypeName(type.name)}** _message) {
uint16_t startPos = plc4c_spi_read_get_pos(buf);
uint16_t curPos;
plc4c_return_code _res = OK;
// Allocate enough memory to contain this data structure.
- (*_message) = malloc(sizeof(plc4c_${helper.getCTypeName(type.name)}));
+ (*_message) = malloc(sizeof(${helper.getCTypeName(type.name)}));
if(*_message == NULL) {
return NO_MEMORY;
}
@@ -132,7 +132,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
+<#if indentContent> </#if> _res = ${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
<#if indentContent> </#if> }
@@ -156,7 +156,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
+<#if indentContent> </#if> _res = ${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
<#if indentContent> </#if> }
@@ -182,7 +182,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* _value = NULL;
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
+<#if indentContent> </#if> _res = ${helper.getCTypeName(arrayField.type.name)}_parse(buf<#if field.params?has_content>, <#list field.params as parserTerm>${helper.toParseExpression(baseType, field, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &_value);
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
<#if indentContent> </#if> }
@@ -294,7 +294,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#if indentContent> </#if> *${optionalField.name} = ${helper.getNullValueForTypeReference(optionalField.type)};
<#if indentContent> </#if> _res = ${helper.getReadBufferReadMethodCall(optionalField.type, "&" + optionalField.name)};
<#else>
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(optionalField.type.name)}_parse(buf<#if optionalField.params?has_content>, <#list optionalField.params as parserTerm>${helper.toParseExpression(baseType, optionalField, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, &${optionalField.name});
+<#if indentContent> </#if> _res = ${helper.getCTypeName(optionalField.type.name)}_parse(buf<#if optionalField.params?has_content>, <#list optionalField.params as parserTerm>${helper.toParseExpression(baseType, optionalField, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, &${optionalField.name});
</#if>
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
@@ -326,7 +326,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#if indentContent> </#if> // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
<#if indentContent> </#if> {
<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)} _reserved = ${helper.getNullValueForTypeReference(reservedField.type)};
-<#if indentContent> </#if> _res = ${helper.getReadBufferReadMethodCall(reservedField.type, "_reserved")};
+<#if indentContent> </#if> _res = ${helper.getReadBufferReadMethodCall(reservedField.type, "&_reserved")};
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
<#if indentContent> </#if> }
@@ -346,7 +346,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#else>
<#-- Inizialize a local variable with the complex type (Intentionally keeping the java-style names so they can be used in expressions) -->
<#if indentContent> </#if> ${helper.getLanguageTypeNameForField(field)}* ${simpleField.name};
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(simpleField.type.name)}_parse(buf<#if simpleField.params?has_content>, <#list simpleField.params as parserTerm>${helper.toParseExpression(baseType, simpleField, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &${simpleField.name});
+<#if indentContent> </#if> _res = ${helper.getCTypeName(simpleField.type.name)}_parse(buf<#if simpleField.params?has_content>, <#list simpleField.params as parserTerm>${helper.toParseExpression(baseType, simpleField, parserTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>, (void*) &${simpleField.name});
</#if>
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
@@ -359,7 +359,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
<#if indentContent> </#if> // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
<#list switchField.cases as case>
<#if indentContent> </#if> <#if case.discriminatorValues?has_content>if(<#list case.discriminatorValues as discriminatorValue><#if case.discriminatorValues?size > 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> (*_message)->_type = plc4c_${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(case.name)};
+<#if indentContent> </#if> (*_message)->_type = ${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(case.name)};
<#list case.fields as caseField>
<#if indentContent> </#if> <@fieldParser baseType=case field=caseField indentContent=true/>
<#sep >
@@ -383,7 +383,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_b
return OK;
}
-plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_write_buffer* buf, plc4c_${helper.getCTypeName(type.name)}* _message<#if helper.getSerializerArguments(type.parserArguments)?has_content>, <#list helper.getSerializerArguments(type.parserArguments) as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)} ${parserArgument.name}<#sep>, </#sep></#list></#if>) {
+plc4c_return_code ${helper.getCTypeName(type.name)}_serialize(plc4c_spi_write_buffer* buf, ${helper.getCTypeName(type.name)}* _message<#if helper.getSerializerArguments(type.parserArguments)?has_content>, <#list helper.getSerializerArguments(type.parserArguments) as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)} ${parserArgument.name}<#sep>, </#sep></#list></#if>) {
plc4c_return_code _res = OK;
<#macro fieldSerializer baseType field indentContent>
<#switch field.typeName>
@@ -400,7 +400,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
<#if helper.isSimpleTypeReference(arrayField.type)>
<#if indentContent> </#if> ${helper.getWriteBufferWriteMethodCall(arrayField.type, "*_value")};
<#else>
-<#if indentContent> </#if> plc4c_return_code _res = plc4c_${helper.getCTypeName(arrayField.type.name)}_serialize(buf, (void*) &_value<#if helper.getSerializerTerms(field.params)?has_content>, <#list helper.getSerializerTerms(field.params) as serializerTerm>${helper.toSerializationExpression(baseType, field, serializerTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>);
+<#if indentContent> </#if> _res = ${helper.getCTypeName(arrayField.type.name)}_serialize(buf, (void*) &_value<#if helper.getSerializerTerms(field.params)?has_content>, <#list helper.getSerializerTerms(field.params) as serializerTerm>${helper.toSerializationExpression(baseType, field, serializerTerm, baseType.parserArguments)}<#sep>, </#sep></#list></#if>);
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
<#if indentContent> </#if> }
@@ -436,7 +436,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
<#assign simpleTypeReference = discriminatorField.type>
<#if indentContent> </#if> // Discriminator Field (${discriminatorField.name})
-<#if indentContent> </#if> ${helper.getWriteBufferWriteMethodCall(discriminatorField.type, "plc4c_" + helper.getCTypeName(baseType.name) + "_get_discriminator(_message->_type)." + discriminatorField.name)};
+<#if indentContent> </#if> ${helper.getWriteBufferWriteMethodCall(discriminatorField.type, helper.getCTypeName(baseType.name) + "_get_discriminator(_message->_type)." + discriminatorField.name)};
<#break>
<#case "enum">
<#assign enumField = field>
@@ -469,7 +469,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
<#if helper.isSimpleTypeReference(manualField.type)>
<#if indentContent> </#if> _res = ${helper.getWriteBufferWriteMethodCall(manualField.type, "(${helper.getLanguageTypeNameForTypeReference(arrayField.type)}*) plc4c_utils_list_get_value(_message->" + helper.getFieldName(baseType, arrayField))};
<#else>
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(manualField.type.name)}_serialize(buf, (void*) &_value);
+<#if indentContent> </#if> _res = ${helper.getCTypeName(manualField.type.name)}_serialize(buf, (void*) &_value);
</#if>
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
@@ -481,9 +481,9 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
<#if indentContent> </#if> // Optional Field (${optionalField.name})
<#if indentContent> </#if> if(_message-><@fieldName baseType=baseType field=optionalField/> != NULL) {
<#if helper.isSimpleTypeReference(optionalField.type)>
-<#if indentContent> </#if> _res= ${helper.getWriteBufferWriteMethodCall(optionalField.type, "_message->" + helper.getFieldName(baseType, optionalField))};
+<#if indentContent> </#if> _res = ${helper.getWriteBufferWriteMethodCall(optionalField.type, "*_message->" + helper.getFieldName(baseType, optionalField))};
<#else>
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(optionalField.type.name)}_serialize(buf, _message-><@fieldName baseType=baseType field=optionalField/>);
+<#if indentContent> </#if> _res = ${helper.getCTypeName(optionalField.type.name)}_serialize(buf, _message-><@fieldName baseType=baseType field=optionalField/>);
</#if>
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
@@ -524,7 +524,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
<#if helper.isSimpleTypeReference(simpleField.type)>
<#if indentContent> </#if> _res = ${helper.getWriteBufferWriteMethodCall(simpleField.type, "_message->" + helper.getFieldName(baseType, simpleField))};
<#else>
-<#if indentContent> </#if> _res = plc4c_${helper.getCTypeName(simpleField.type.name)}_serialize(buf, _message-><@fieldName baseType=baseType field=simpleField/>);
+<#if indentContent> </#if> _res = ${helper.getCTypeName(simpleField.type.name)}_serialize(buf, _message-><@fieldName baseType=baseType field=simpleField/>);
</#if>
<#if indentContent> </#if> if(_res != OK) {
<#if indentContent> </#if> return _res;
@@ -536,7 +536,7 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
<#if indentContent> </#if> // Switch Field (Depending of the current type, serialize the sub-type elements)
<#if indentContent> </#if> switch(_message->_type) {
<#list switchField.cases as case>
-<#if indentContent> </#if> case plc4c_${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(case.name)}: {
+<#if indentContent> </#if> case ${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(case.name)}: {
<#list case.fields as caseField>
<@fieldSerializer baseType=case field=caseField indentContent=true/>
</#list>
@@ -555,11 +555,11 @@ plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_wr
return OK;
}
-uint8_t plc4c_${helper.getCTypeName(type.name)}_length_in_bytes(plc4c_${helper.getCTypeName(type.name)}* _message) {
- return plc4c_${helper.getCTypeName(type.name)}_length_in_bits(_message) / 8;
+uint8_t ${helper.getCTypeName(type.name)}_length_in_bytes(${helper.getCTypeName(type.name)}* _message) {
+ return ${helper.getCTypeName(type.name)}_length_in_bits(_message) / 8;
}
-uint8_t plc4c_${helper.getCTypeName(type.name)}_length_in_bits(plc4c_${helper.getCTypeName(type.name)}* _message) {
+uint8_t ${helper.getCTypeName(type.name)}_length_in_bits(${helper.getCTypeName(type.name)}* _message) {
<#macro fieldSize baseType field indentContent>
<#switch field.typeName>
<#case "array">
@@ -672,7 +672,7 @@ uint8_t plc4c_${helper.getCTypeName(type.name)}_length_in_bits(plc4c_${helper.ge
<#if indentContent> </#if> // Depending of the current type, add the length of sub-type elements ...
<#if indentContent> </#if> switch(_message->_type) {
<#list switchField.cases as case>
-<#if indentContent> </#if> case plc4c_${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(case.name)}: {
+<#if indentContent> </#if> case ${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(case.name)}: {
<#list case.fields as caseField>
<@fieldSize baseType=case field=caseField indentContent=true/>
<#sep >
diff --git a/build-utils/language-c/src/main/resources/templates/c/pojo-template-h.ftlh b/build-utils/language-c/src/main/resources/templates/c/pojo-template-h.ftlh
index 036ec1d..441830a 100644
--- a/build-utils/language-c/src/main/resources/templates/c/pojo-template-h.ftlh
+++ b/build-utils/language-c/src/main/resources/templates/c/pojo-template-h.ftlh
@@ -45,8 +45,8 @@
specific language governing permissions and limitations
under the License.
*/
-#ifndef PLC4C_${helper.getCTypeName(type.name)?upper_case}_H_
-#define PLC4C_${helper.getCTypeName(type.name)?upper_case}_H_
+#ifndef ${helper.getCTypeName(type.name)?upper_case}_H_
+#define ${helper.getCTypeName(type.name)?upper_case}_H_
#ifdef __cplusplus
extern "C" {
#endif
@@ -71,25 +71,25 @@ extern "C" {
<#if helper.isDiscriminatedParentTypeDefinition(type)>
// Structure used to contain the discriminator values for discriminated types using this as a parent
-struct plc4c_${helper.getCTypeName(type.name)}_discriminator {
+struct ${helper.getCTypeName(type.name)}_discriminator {
<#if helper.getDiscriminatorTypes()?has_content>
<#list helper.getDiscriminatorTypes()?keys as discriminatorName>
${helper.getLanguageTypeNameForTypeReference(helper.getDiscriminatorTypes()[discriminatorName])} ${discriminatorName};
</#list>
</#if>
};
-typedef struct plc4c_${helper.getCTypeName(type.name)}_discriminator plc4c_${helper.getCTypeName(type.name)}_discriminator;
+typedef struct ${helper.getCTypeName(type.name)}_discriminator ${helper.getCTypeName(type.name)}_discriminator;
// Enum assigning each sub-type an individual id.
-enum plc4c_${helper.getCTypeName(type.name)}_type {
+enum ${helper.getCTypeName(type.name)}_type {
<#list helper.getSubTypeDefinitions() as subtype>
- plc4c_${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(subtype.name)} = ${subtype?index}<#sep>,
+ ${helper.getCTypeName(type.name)}_type_${helper.getCTypeName(subtype.name)} = ${subtype?index}<#sep>,
</#list>
};
-typedef enum plc4c_${helper.getCTypeName(type.name)}_type plc4c_${helper.getCTypeName(type.name)}_type;
+typedef enum ${helper.getCTypeName(type.name)}_type ${helper.getCTypeName(type.name)}_type;
// Function to get the discriminator values for a given type.
-plc4c_${helper.getCTypeName(type.name)}_discriminator plc4c_${helper.getCTypeName(type.name)}_get_discriminator(plc4c_${helper.getCTypeName(type.name)}_type type);
+${helper.getCTypeName(type.name)}_discriminator ${helper.getCTypeName(type.name)}_get_discriminator(${helper.getCTypeName(type.name)}_type type);
</#if>
<#--
When using const fields, output the constant reference values
@@ -106,10 +106,10 @@ const ${helper.getLanguageTypeNameForField(constField)} ${helper.getCTypeName(pa
<#--
Create the general data-structure for this type
-->
-struct plc4c_${helper.getCTypeName(type.name)} {
+struct ${helper.getCTypeName(type.name)} {
<#if helper.isDiscriminatedParentTypeDefinition(type)>
/* This is an abstract type so this property saves the type of this typed union */
- plc4c_${helper.getCTypeName(type.name)}_type _type;
+ ${helper.getCTypeName(type.name)}_type _type;
</#if>
/* Properties */
<#list helper.getPropertyAndSwitchFields() as field>
@@ -138,28 +138,28 @@ struct plc4c_${helper.getCTypeName(type.name)} {
</#if>
</#list>
};
-typedef struct plc4c_${helper.getCTypeName(type.name)} plc4c_${helper.getCTypeName(type.name)};
+typedef struct ${helper.getCTypeName(type.name)} ${helper.getCTypeName(type.name)};
// Create an empty NULL-struct
-static const plc4c_${helper.getCTypeName(type.name)} plc4c_${helper.getCTypeName(type.name)}_null;
+static const ${helper.getCTypeName(type.name)} ${helper.getCTypeName(type.name)}_null;
<#--
Define the parse-method for elements of this tpye
-->
-plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_buffer* buf, <#if type.parserArguments?has_content><#list type.parserArguments as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#if !helper.isSimpleTypeReference(parserArgument.type)>*</#if> ${parserArgument.name}<#sep>, </#list>, </#if>plc4c_${helper.getCTypeName(type.name)}** message);
+plc4c_return_code ${helper.getCTypeName(type.name)}_parse(plc4c_spi_read_buffer* buf, <#if type.parserArguments?has_content><#list type.parserArguments as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#if !helper.isSimpleTypeReference(parserArgument.type)>*</#if> ${parserArgument.name}<#sep>, </#list>, </#if>${helper.getCTypeName(type.name)}** message);
<#--
Define the serialize-method for elements of this tpye
-->
-plc4c_return_code plc4c_${helper.getCTypeName(type.name)}_serialize(plc4c_spi_write_buffer* buf, plc4c_${helper.getCTypeName(type.name)}* message<#if helper.getSerializerArguments(type.parserArguments)?has_content>, <#list helper.getSerializerArguments(type.parserArguments) as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)} ${parserArgument.name}<#sep>, </#sep></#list></#if>);
+plc4c_return_code ${helper.getCTypeName(type.name)}_serialize(plc4c_spi_write_buffer* buf, ${helper.getCTypeName(type.name)}* message<#if helper.getSerializerArguments(type.parserArguments)?has_content>, <#list helper.getSerializerArguments(type.parserArguments) as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)} ${parserArgument.name}<#sep>, </#sep></#list></#if>);
-uint8_t plc4c_${helper.getCTypeName(type.name)}_length_in_bytes(plc4c_${helper.getCTypeName(type.name)}* message);
+uint8_t ${helper.getCTypeName(type.name)}_length_in_bytes(${helper.getCTypeName(type.name)}* message);
-uint8_t plc4c_${helper.getCTypeName(type.name)}_length_in_bits(plc4c_${helper.getCTypeName(type.name)}* message);
+uint8_t ${helper.getCTypeName(type.name)}_length_in_bits(${helper.getCTypeName(type.name)}* message);
#ifdef __cplusplus
}
#endif
-#endif // PLC4C_${helper.getCTypeName(type.name)?upper_case}_H_
+#endif // ${helper.getCTypeName(type.name)?upper_case}_H_
</#if>
</#outputformat>
\ No newline at end of file
diff --git a/sandbox/plc4c/generated-sources/modbus/includes/modbus_constants.h b/sandbox/plc4c/generated-sources/modbus/includes/modbus_constants.h
index 5c6e407..0148622 100644
--- a/sandbox/plc4c/generated-sources/modbus/includes/modbus_constants.h
+++ b/sandbox/plc4c/generated-sources/modbus/includes/modbus_constants.h
@@ -27,7 +27,7 @@ extern "C" {
#include <plc4c/utils/list.h>
// Constant values.
-const uint16_t MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT = 502;
+const uint16_t PLC4C_MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT = 502;
struct plc4c_modbus_read_write_modbus_constants {
/* Properties */
diff --git a/sandbox/plc4c/generated-sources/modbus/includes/modbus_pdu.h b/sandbox/plc4c/generated-sources/modbus/includes/modbus_pdu.h
index 12db8cf..434ac4e 100644
--- a/sandbox/plc4c/generated-sources/modbus/includes/modbus_pdu.h
+++ b/sandbox/plc4c/generated-sources/modbus/includes/modbus_pdu.h
@@ -41,42 +41,42 @@ typedef struct plc4c_modbus_read_write_modbus_pdu_discriminator plc4c_modbus_rea
// Enum assigning each sub-type an individual id.
enum plc4c_modbus_read_write_modbus_pdu_type {
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_error = 0,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_request = 1,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_response = 2,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_request = 3,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_response = 4,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_request = 5,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_response = 6,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_request = 7,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_response = 8,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_request = 9,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_response = 10,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_request = 11,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_response = 12,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_request = 13,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_response = 14,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request = 15,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response = 16,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request = 17,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response = 18,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_request = 19,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_response = 20,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_request = 21,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_response = 22,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_request = 23,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_response = 24,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_request = 25,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_response = 26,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_request = 27,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_response = 28,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_diagnostic_request = 29,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_request = 30,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_response = 31,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_request = 32,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_response = 33,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_request = 34,
- plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_response = 35};
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_error = 0,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_request = 1,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_response = 2,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_request = 3,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_response = 4,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_request = 5,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_response = 6,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_request = 7,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_response = 8,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_request = 9,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_response = 10,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_request = 11,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_response = 12,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_request = 13,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_response = 14,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request = 15,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response = 16,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request = 17,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response = 18,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_request = 19,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_response = 20,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_request = 21,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_response = 22,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_request = 23,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_response = 24,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_request = 25,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_response = 26,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_request = 27,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_response = 28,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_diagnostic_request = 29,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_request = 30,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_response = 31,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_request = 32,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_response = 33,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_request = 34,
+ plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_response = 35};
typedef enum plc4c_modbus_read_write_modbus_pdu_type plc4c_modbus_read_write_modbus_pdu_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/modbus/includes/modbus_tcp_adu.h b/sandbox/plc4c/generated-sources/modbus/includes/modbus_tcp_adu.h
index 04a3cc2..45bbba9 100644
--- a/sandbox/plc4c/generated-sources/modbus/includes/modbus_tcp_adu.h
+++ b/sandbox/plc4c/generated-sources/modbus/includes/modbus_tcp_adu.h
@@ -28,7 +28,7 @@ extern "C" {
#include "modbus_pdu.h"
// Constant values.
-const uint16_t MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER = 0x0000;
+const uint16_t PLC4C_MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER = 0x0000;
struct plc4c_modbus_read_write_modbus_tcp_adu {
/* Properties */
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_constants.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_constants.c
index 767cf1a..cf4b3d6 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_constants.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_constants.c
@@ -37,13 +37,13 @@ plc4c_return_code plc4c_modbus_read_write_modbus_constants_parse(plc4c_spi_read_
// Const Field (modbusTcpDefaultPort)
uint16_t modbusTcpDefaultPort = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &modbusTcpDefaultPort);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &modbusTcpDefaultPort);
if(_res != OK) {
return _res;
}
- if(modbusTcpDefaultPort != MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT) {
+ if(modbusTcpDefaultPort != PLC4C_MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT) {
return PARSE_ERROR;
- // throw new ParseException("Expected constant value " + MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT + " but got " + modbusTcpDefaultPort);
+ // throw new ParseException("Expected constant value " + PLC4C_MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT + " but got " + modbusTcpDefaultPort);
}
return OK;
@@ -53,7 +53,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_constants_serialize(plc4c_spi_w
plc4c_return_code _res = OK;
// Const Field (modbusTcpDefaultPort)
- plc4c_spi_write_unsigned_int(buf, 16, MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT);
+ plc4c_spi_write_unsigned_short(buf, 16, PLC4C_MODBUS_READ_WRITE_MODBUS_CONSTANTS_MODBUS_TCP_DEFAULT_PORT);
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 241835e..541e2b0 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu.c
@@ -27,77 +27,77 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_modbus_read_write_modbus_pdu_discriminator plc4c_modbus_read_write_modbus_pdu_discriminators[] = {
- {/* modbus_read_write_modbus_pdu_diagnostic_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_diagnostic_request */
.response = false, .function = 0x08, .error = false},
- {/* modbus_read_write_modbus_pdu_error */
+ {/* plc4c_modbus_read_write_modbus_pdu_error */
.response = -1, .function = -1, .error = true},
- {/* modbus_read_write_modbus_pdu_get_com_event_log_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_get_com_event_log_request */
.response = false, .function = 0x0C, .error = false},
- {/* modbus_read_write_modbus_pdu_get_com_event_log_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_get_com_event_log_response */
.response = true, .function = 0x0C, .error = false},
- {/* modbus_read_write_modbus_pdu_mask_write_holding_register_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_request */
.response = false, .function = 0x16, .error = false},
- {/* modbus_read_write_modbus_pdu_mask_write_holding_register_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_response */
.response = true, .function = 0x16, .error = false},
- {/* modbus_read_write_modbus_pdu_read_coils_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_coils_request */
.response = false, .function = 0x01, .error = false},
- {/* modbus_read_write_modbus_pdu_read_coils_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_coils_response */
.response = true, .function = 0x01, .error = false},
- {/* modbus_read_write_modbus_pdu_read_device_identification_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_device_identification_request */
.response = false, .function = 0x2B, .error = false},
- {/* modbus_read_write_modbus_pdu_read_device_identification_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_device_identification_response */
.response = true, .function = 0x2B, .error = false},
- {/* modbus_read_write_modbus_pdu_read_discrete_inputs_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_request */
.response = false, .function = 0x02, .error = false},
- {/* modbus_read_write_modbus_pdu_read_discrete_inputs_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_response */
.response = true, .function = 0x02, .error = false},
- {/* modbus_read_write_modbus_pdu_read_exception_status_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_exception_status_request */
.response = false, .function = 0x07, .error = false},
- {/* modbus_read_write_modbus_pdu_read_exception_status_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_exception_status_response */
.response = true, .function = 0x07, .error = false},
- {/* modbus_read_write_modbus_pdu_read_fifo_queue_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_request */
.response = false, .function = 0x18, .error = false},
- {/* modbus_read_write_modbus_pdu_read_fifo_queue_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_response */
.response = true, .function = 0x18, .error = false},
- {/* modbus_read_write_modbus_pdu_read_file_record_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_file_record_request */
.response = false, .function = 0x14, .error = false},
- {/* modbus_read_write_modbus_pdu_read_file_record_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_file_record_response */
.response = true, .function = 0x14, .error = false},
- {/* modbus_read_write_modbus_pdu_read_holding_registers_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_holding_registers_request */
.response = false, .function = 0x03, .error = false},
- {/* modbus_read_write_modbus_pdu_read_holding_registers_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_holding_registers_response */
.response = true, .function = 0x03, .error = false},
- {/* modbus_read_write_modbus_pdu_read_input_registers_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_input_registers_request */
.response = false, .function = 0x04, .error = false},
- {/* modbus_read_write_modbus_pdu_read_input_registers_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_input_registers_response */
.response = true, .function = 0x04, .error = false},
- {/* modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request */
.response = false, .function = 0x17, .error = false},
- {/* modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response */
.response = true, .function = 0x17, .error = false},
- {/* modbus_read_write_modbus_pdu_report_server_id_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_report_server_id_request */
.response = false, .function = 0x11, .error = false},
- {/* modbus_read_write_modbus_pdu_report_server_id_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_report_server_id_response */
.response = true, .function = 0x11, .error = false},
- {/* modbus_read_write_modbus_pdu_write_file_record_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_file_record_request */
.response = false, .function = 0x15, .error = false},
- {/* modbus_read_write_modbus_pdu_write_file_record_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_file_record_response */
.response = true, .function = 0x15, .error = false},
- {/* modbus_read_write_modbus_pdu_write_multiple_coils_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_request */
.response = false, .function = 0x0F, .error = false},
- {/* modbus_read_write_modbus_pdu_write_multiple_coils_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_response */
.response = true, .function = 0x0F, .error = false},
- {/* modbus_read_write_modbus_pdu_write_multiple_holding_registers_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request */
.response = false, .function = 0x10, .error = false},
- {/* modbus_read_write_modbus_pdu_write_multiple_holding_registers_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response */
.response = true, .function = 0x10, .error = false},
- {/* modbus_read_write_modbus_pdu_write_single_coil_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_single_coil_request */
.response = false, .function = 0x05, .error = false},
- {/* modbus_read_write_modbus_pdu_write_single_coil_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_single_coil_response */
.response = true, .function = 0x05, .error = false},
- {/* modbus_read_write_modbus_pdu_write_single_register_request */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_single_register_request */
.response = false, .function = 0x06, .error = false},
- {/* modbus_read_write_modbus_pdu_write_single_register_response */
+ {/* plc4c_modbus_read_write_modbus_pdu_write_single_register_response */
.response = true, .function = 0x06, .error = false}
};
@@ -127,18 +127,18 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Discriminator Field (function) (Used as input to a switch field)
unsigned int function = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 7, (uint16_t*) &function);
+ _res = plc4c_spi_read_unsigned_byte(buf, 7, (uint8_t*) &function);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(error == true) { /* ModbusPDUError */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_error;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_error;
// Simple Field (exceptionCode)
uint8_t exceptionCode = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &exceptionCode);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &exceptionCode);
if(_res != OK) {
return _res;
}
@@ -146,11 +146,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x02) && (response == false)) { /* ModbusPDUReadDiscreteInputsRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_request;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -160,7 +160,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -168,11 +168,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x02) && (response == true)) { /* ModbusPDUReadDiscreteInputsResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -202,11 +202,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x01) && (response == false)) { /* ModbusPDUReadCoilsRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_request;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -216,7 +216,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -224,11 +224,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x01) && (response == true)) { /* ModbusPDUReadCoilsResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -258,11 +258,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x05) && (response == false)) { /* ModbusPDUWriteSingleCoilRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_request;
// Simple Field (address)
uint16_t address = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &address);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &address);
if(_res != OK) {
return _res;
}
@@ -272,7 +272,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (value)
uint16_t value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &value);
if(_res != OK) {
return _res;
}
@@ -280,11 +280,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x05) && (response == true)) { /* ModbusPDUWriteSingleCoilResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_response;
// Simple Field (address)
uint16_t address = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &address);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &address);
if(_res != OK) {
return _res;
}
@@ -294,7 +294,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (value)
uint16_t value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &value);
if(_res != OK) {
return _res;
}
@@ -302,11 +302,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x0F) && (response == false)) { /* ModbusPDUWriteMultipleCoilsRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_request;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -316,7 +316,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -326,7 +326,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// 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 = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -356,11 +356,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x0F) && (response == true)) { /* ModbusPDUWriteMultipleCoilsResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_response;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -370,7 +370,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -378,11 +378,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x04) && (response == false)) { /* ModbusPDUReadInputRegistersRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_request;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -392,7 +392,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -400,11 +400,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x04) && (response == true)) { /* ModbusPDUReadInputRegistersResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -434,11 +434,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x03) && (response == false)) { /* ModbusPDUReadHoldingRegistersRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_request;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -448,7 +448,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -456,11 +456,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x03) && (response == true)) { /* ModbusPDUReadHoldingRegistersResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -490,11 +490,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x06) && (response == false)) { /* ModbusPDUWriteSingleRegisterRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_request;
// Simple Field (address)
uint16_t address = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &address);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &address);
if(_res != OK) {
return _res;
}
@@ -504,7 +504,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (value)
uint16_t value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &value);
if(_res != OK) {
return _res;
}
@@ -512,11 +512,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x06) && (response == true)) { /* ModbusPDUWriteSingleRegisterResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_response;
// Simple Field (address)
uint16_t address = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &address);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &address);
if(_res != OK) {
return _res;
}
@@ -526,7 +526,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (value)
uint16_t value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &value);
if(_res != OK) {
return _res;
}
@@ -534,11 +534,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x10) && (response == false)) { /* ModbusPDUWriteMultipleHoldingRegistersRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -548,7 +548,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -558,7 +558,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// 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 = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -588,11 +588,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x10) && (response == true)) { /* ModbusPDUWriteMultipleHoldingRegistersResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response;
// Simple Field (startingAddress)
uint16_t startingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &startingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &startingAddress);
if(_res != OK) {
return _res;
}
@@ -602,7 +602,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (quantity)
uint16_t quantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &quantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &quantity);
if(_res != OK) {
return _res;
}
@@ -610,11 +610,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x17) && (response == false)) { /* ModbusPDUReadWriteMultipleHoldingRegistersRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request;
// Simple Field (readStartingAddress)
uint16_t readStartingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &readStartingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &readStartingAddress);
if(_res != OK) {
return _res;
}
@@ -624,7 +624,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (readQuantity)
uint16_t readQuantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &readQuantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &readQuantity);
if(_res != OK) {
return _res;
}
@@ -634,7 +634,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (writeStartingAddress)
uint16_t writeStartingAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &writeStartingAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &writeStartingAddress);
if(_res != OK) {
return _res;
}
@@ -644,7 +644,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (writeQuantity)
uint16_t writeQuantity = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &writeQuantity);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &writeQuantity);
if(_res != OK) {
return _res;
}
@@ -654,7 +654,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// 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 = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -684,11 +684,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x17) && (response == true)) { /* ModbusPDUReadWriteMultipleHoldingRegistersResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -718,11 +718,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x16) && (response == false)) { /* ModbusPDUMaskWriteHoldingRegisterRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_request;
// Simple Field (referenceAddress)
uint16_t referenceAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &referenceAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &referenceAddress);
if(_res != OK) {
return _res;
}
@@ -732,7 +732,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (andMask)
uint16_t andMask = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &andMask);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &andMask);
if(_res != OK) {
return _res;
}
@@ -742,7 +742,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (orMask)
uint16_t orMask = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &orMask);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &orMask);
if(_res != OK) {
return _res;
}
@@ -750,11 +750,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x16) && (response == true)) { /* ModbusPDUMaskWriteHoldingRegisterResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_response;
// Simple Field (referenceAddress)
uint16_t referenceAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &referenceAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &referenceAddress);
if(_res != OK) {
return _res;
}
@@ -764,7 +764,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (andMask)
uint16_t andMask = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &andMask);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &andMask);
if(_res != OK) {
return _res;
}
@@ -774,7 +774,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (orMask)
uint16_t orMask = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &orMask);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &orMask);
if(_res != OK) {
return _res;
}
@@ -782,11 +782,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x18) && (response == false)) { /* ModbusPDUReadFifoQueueRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_request;
// Simple Field (fifoPointerAddress)
uint16_t fifoPointerAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &fifoPointerAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &fifoPointerAddress);
if(_res != OK) {
return _res;
}
@@ -794,11 +794,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x18) && (response == true)) { /* ModbusPDUReadFifoQueueResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -807,7 +807,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// 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 = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &fifoCount);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &fifoCount);
if(_res != OK) {
return _res;
}
@@ -826,7 +826,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
uint16_t _value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &_value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &_value);
if(_res != OK) {
return _res;
}
@@ -837,11 +837,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x14) && (response == false)) { /* ModbusPDUReadFileRecordRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_request;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -870,11 +870,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x14) && (response == true)) { /* ModbusPDUReadFileRecordResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -903,11 +903,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x15) && (response == false)) { /* ModbusPDUWriteFileRecordRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_request;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -936,11 +936,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x15) && (response == true)) { /* ModbusPDUWriteFileRecordResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -969,14 +969,14 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x07) && (response == false)) { /* ModbusPDUReadExceptionStatusRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_request;
} else
if((error == false) && (function == 0x07) && (response == true)) { /* ModbusPDUReadExceptionStatusResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_response;
// Simple Field (value)
uint8_t value = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &value);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &value);
if(_res != OK) {
return _res;
}
@@ -984,11 +984,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x08) && (response == false)) { /* ModbusPDUDiagnosticRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_diagnostic_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_diagnostic_request;
// Simple Field (status)
uint16_t status = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &status);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &status);
if(_res != OK) {
return _res;
}
@@ -998,7 +998,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (eventCount)
uint16_t eventCount = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &eventCount);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &eventCount);
if(_res != OK) {
return _res;
}
@@ -1006,14 +1006,14 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x0C) && (response == false)) { /* ModbusPDUGetComEventLogRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_request;
} else
if((error == false) && (function == 0x0C) && (response == true)) { /* ModbusPDUGetComEventLogResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -1022,7 +1022,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (status)
uint16_t status = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &status);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &status);
if(_res != OK) {
return _res;
}
@@ -1032,7 +1032,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (eventCount)
uint16_t eventCount = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &eventCount);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &eventCount);
if(_res != OK) {
return _res;
}
@@ -1042,7 +1042,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
// Simple Field (messageCount)
uint16_t messageCount = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &messageCount);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &messageCount);
if(_res != OK) {
return _res;
}
@@ -1073,14 +1073,14 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x11) && (response == false)) { /* ModbusPDUReportServerIdRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_request;
} else
if((error == false) && (function == 0x11) && (response == true)) { /* ModbusPDUReportServerIdResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_response;
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t byteCount = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &byteCount);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &byteCount);
if(_res != OK) {
return _res;
}
@@ -1110,10 +1110,10 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_parse(plc4c_spi_read_buffer
} else
if((error == false) && (function == 0x2B) && (response == false)) { /* ModbusPDUReadDeviceIdentificationRequest */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_request;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_request;
} else
if((error == false) && (function == 0x2B) && (response == true)) { /* ModbusPDUReadDeviceIdentificationResponse */
- (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_response;
+ (*_message)->_type = plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_response;
}
return OK;
@@ -1126,40 +1126,40 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
plc4c_spi_write_bit(buf, plc4c_modbus_read_write_modbus_pdu_get_discriminator(_message->_type).error);
// Discriminator Field (function)
- plc4c_spi_write_unsigned_short(buf, 7, plc4c_modbus_read_write_modbus_pdu_get_discriminator(_message->_type).function);
+ plc4c_spi_write_unsigned_byte(buf, 7, plc4c_modbus_read_write_modbus_pdu_get_discriminator(_message->_type).function);
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_error: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_error: {
// Simple Field (exceptionCode)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->modbus_pdu_error_exception_code);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->modbus_pdu_error_exception_code);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_request: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_discrete_inputs_request_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_discrete_inputs_request_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_discrete_inputs_request_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_discrete_inputs_request_quantity);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_discrete_inputs_response_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_discrete_inputs_response_value));
if(_res != OK) {
return _res;
}
@@ -1176,26 +1176,26 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_request: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_coils_request_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_coils_request_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_coils_request_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_coils_request_quantity);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_coils_response_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_coils_response_value));
if(_res != OK) {
return _res;
}
@@ -1212,54 +1212,54 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_request: {
// Simple Field (address)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_coil_request_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_coil_request_address);
if(_res != OK) {
return _res;
}
// Simple Field (value)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_coil_request_value);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_coil_request_value);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_response: {
// Simple Field (address)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_coil_response_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_coil_response_address);
if(_res != OK) {
return _res;
}
// Simple Field (value)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_coil_response_value);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_coil_response_value);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_request: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_coils_request_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_coils_request_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_coils_request_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_coils_request_quantity);
if(_res != OK) {
return _res;
}
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_write_multiple_coils_request_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_write_multiple_coils_request_value));
if(_res != OK) {
return _res;
}
@@ -1276,42 +1276,42 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_response: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_coils_response_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_coils_response_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_coils_response_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_coils_response_quantity);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_request: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_input_registers_request_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_input_registers_request_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_input_registers_request_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_input_registers_request_quantity);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_input_registers_response_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_input_registers_response_value));
if(_res != OK) {
return _res;
}
@@ -1328,26 +1328,26 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_request: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_holding_registers_request_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_holding_registers_request_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_holding_registers_request_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_holding_registers_request_quantity);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_holding_registers_response_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_holding_registers_response_value));
if(_res != OK) {
return _res;
}
@@ -1364,54 +1364,54 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_request: {
// Simple Field (address)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_register_request_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_register_request_address);
if(_res != OK) {
return _res;
}
// Simple Field (value)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_register_request_value);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_register_request_value);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_response: {
// Simple Field (address)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_register_response_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_register_response_address);
if(_res != OK) {
return _res;
}
// Simple Field (value)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_single_register_response_value);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_single_register_response_value);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_request_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_request_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_request_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_request_quantity);
if(_res != OK) {
return _res;
}
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_write_multiple_holding_registers_request_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_write_multiple_holding_registers_request_value));
if(_res != OK) {
return _res;
}
@@ -1428,50 +1428,50 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response: {
// Simple Field (startingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_response_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_response_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (quantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_response_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_write_multiple_holding_registers_response_quantity);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request: {
// Simple Field (readStartingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_read_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_read_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (readQuantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_read_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_read_quantity);
if(_res != OK) {
return _res;
}
// Simple Field (writeStartingAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_write_starting_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_write_starting_address);
if(_res != OK) {
return _res;
}
// Simple Field (writeQuantity)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_write_quantity);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_write_multiple_holding_registers_request_write_quantity);
if(_res != OK) {
return _res;
}
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_write_multiple_holding_registers_request_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_write_multiple_holding_registers_request_value));
if(_res != OK) {
return _res;
}
@@ -1488,10 +1488,10 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_write_multiple_holding_registers_response_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_write_multiple_holding_registers_response_value));
if(_res != OK) {
return _res;
}
@@ -1508,70 +1508,70 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_request: {
// Simple Field (referenceAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_mask_write_holding_register_request_reference_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_mask_write_holding_register_request_reference_address);
if(_res != OK) {
return _res;
}
// Simple Field (andMask)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_mask_write_holding_register_request_and_mask);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_mask_write_holding_register_request_and_mask);
if(_res != OK) {
return _res;
}
// Simple Field (orMask)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_mask_write_holding_register_request_or_mask);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_mask_write_holding_register_request_or_mask);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_response: {
// Simple Field (referenceAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_mask_write_holding_register_response_reference_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_mask_write_holding_register_response_reference_address);
if(_res != OK) {
return _res;
}
// Simple Field (andMask)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_mask_write_holding_register_response_and_mask);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_mask_write_holding_register_response_and_mask);
if(_res != OK) {
return _res;
}
// Simple Field (orMask)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_mask_write_holding_register_response_or_mask);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_mask_write_holding_register_response_or_mask);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_request: {
// Simple Field (fifoPointerAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_read_fifo_queue_request_fifo_pointer_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_read_fifo_queue_request_fifo_pointer_address);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_fifo_queue_response_fifo_value)) * (2))) + (2));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_fifo_queue_response_fifo_value)) * (2))) + (2));
if(_res != OK) {
return _res;
}
// Implicit Field (fifoCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_fifo_queue_response_fifo_value)) * (2))) / (2));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->modbus_pdu_read_fifo_queue_response_fifo_value)) * (2))) / (2));
if(_res != OK) {
return _res;
}
@@ -1582,16 +1582,16 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
for(int curItem = 0; curItem < itemCount; curItem++) {
uint16_t* _value = (uint16_t*) plc4c_utils_list_get_value(_message->modbus_pdu_read_fifo_queue_response_fifo_value, curItem);
- plc4c_spi_write_unsigned_int(buf, 16, *_value);
+ plc4c_spi_write_unsigned_short(buf, 16, *_value);
}
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_request: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_read_file_record_request_items));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_read_file_record_request_items));
if(_res != OK) {
return _res;
}
@@ -1602,7 +1602,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item* _value = (plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item*) plc4c_utils_list_get_value(_message->modbus_pdu_read_file_record_request_items, curItem);
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item_serialize(buf, (void*) &_value);
+ _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_request_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -1611,10 +1611,10 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_read_file_record_response_items));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_read_file_record_response_items));
if(_res != OK) {
return _res;
}
@@ -1625,7 +1625,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item* _value = (plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item*) plc4c_utils_list_get_value(_message->modbus_pdu_read_file_record_response_items, curItem);
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item_serialize(buf, (void*) &_value);
+ _res = plc4c_modbus_read_write_modbus_pdu_read_file_record_response_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -1634,10 +1634,10 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_request: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_write_file_record_request_items));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_write_file_record_request_items));
if(_res != OK) {
return _res;
}
@@ -1648,7 +1648,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item* _value = (plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item*) plc4c_utils_list_get_value(_message->modbus_pdu_write_file_record_request_items, curItem);
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item_serialize(buf, (void*) &_value);
+ _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_request_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -1657,10 +1657,10 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_write_file_record_response_items));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_array_size_in_bytes(_message->modbus_pdu_write_file_record_response_items));
if(_res != OK) {
return _res;
}
@@ -1671,7 +1671,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item* _value = (plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item*) plc4c_utils_list_get_value(_message->modbus_pdu_write_file_record_response_items, curItem);
- plc4c_return_code _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item_serialize(buf, (void*) &_value);
+ _res = plc4c_modbus_read_write_modbus_pdu_write_file_record_response_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -1680,62 +1680,62 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_response: {
// Simple Field (value)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->modbus_pdu_read_exception_status_response_value);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->modbus_pdu_read_exception_status_response_value);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_diagnostic_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_diagnostic_request: {
// Simple Field (status)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_diagnostic_request_status);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_diagnostic_request_status);
if(_res != OK) {
return _res;
}
// Simple Field (eventCount)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_diagnostic_request_event_count);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_diagnostic_request_event_count);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, (plc4c_spi_evaluation_helper_count(_message->modbus_pdu_get_com_event_log_response_events)) + (6));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, (plc4c_spi_evaluation_helper_count(_message->modbus_pdu_get_com_event_log_response_events)) + (6));
if(_res != OK) {
return _res;
}
// Simple Field (status)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_get_com_event_log_response_status);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_get_com_event_log_response_status);
if(_res != OK) {
return _res;
}
// Simple Field (eventCount)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_get_com_event_log_response_event_count);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_get_com_event_log_response_event_count);
if(_res != OK) {
return _res;
}
// Simple Field (messageCount)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->modbus_pdu_get_com_event_log_response_message_count);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->modbus_pdu_get_com_event_log_response_message_count);
if(_res != OK) {
return _res;
}
@@ -1752,14 +1752,14 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_response: {
// Implicit Field (byteCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_report_server_id_response_value));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->modbus_pdu_report_server_id_response_value));
if(_res != OK) {
return _res;
}
@@ -1776,11 +1776,11 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_serialize(plc4c_spi_write_b
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_response: {
break;
}
@@ -1804,14 +1804,14 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_error: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_error: {
// Simple field (exceptionCode)
lengthInBits += 8;
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_request: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -1822,7 +1822,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_discrete_inputs_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_discrete_inputs_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -1833,7 +1833,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_request: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -1844,7 +1844,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_coils_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_coils_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -1855,7 +1855,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_request: {
// Simple field (address)
lengthInBits += 16;
@@ -1866,7 +1866,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_coil_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_coil_response: {
// Simple field (address)
lengthInBits += 16;
@@ -1877,7 +1877,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_request: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -1896,7 +1896,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_coils_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_coils_response: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -1907,7 +1907,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_request: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -1918,7 +1918,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_input_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_input_registers_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -1929,7 +1929,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_request: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -1940,7 +1940,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_holding_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_holding_registers_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -1951,7 +1951,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_request: {
// Simple field (address)
lengthInBits += 16;
@@ -1962,7 +1962,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_single_register_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_single_register_response: {
// Simple field (address)
lengthInBits += 16;
@@ -1973,7 +1973,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_request: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -1992,7 +1992,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_multiple_holding_registers_response: {
// Simple field (startingAddress)
lengthInBits += 16;
@@ -2003,7 +2003,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_request: {
// Simple field (readStartingAddress)
lengthInBits += 16;
@@ -2030,7 +2030,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_write_multiple_holding_registers_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -2041,7 +2041,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_request: {
// Simple field (referenceAddress)
lengthInBits += 16;
@@ -2056,7 +2056,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_mask_write_holding_register_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_mask_write_holding_register_response: {
// Simple field (referenceAddress)
lengthInBits += 16;
@@ -2071,14 +2071,14 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_request: {
// Simple field (fifoPointerAddress)
lengthInBits += 16;
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_fifo_queue_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_fifo_queue_response: {
// Implicit Field (byteCount)
lengthInBits += 16;
@@ -2093,7 +2093,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_request: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -2110,7 +2110,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_file_record_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_file_record_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -2127,7 +2127,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_request: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -2144,7 +2144,7 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_write_file_record_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_write_file_record_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -2161,18 +2161,18 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_exception_status_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_exception_status_response: {
// Simple field (value)
lengthInBits += 8;
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_diagnostic_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_diagnostic_request: {
// Simple field (status)
lengthInBits += 16;
@@ -2183,11 +2183,11 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_get_com_event_log_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_get_com_event_log_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -2210,11 +2210,11 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_report_server_id_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_report_server_id_response: {
// Implicit Field (byteCount)
lengthInBits += 8;
@@ -2225,11 +2225,11 @@ uint8_t plc4c_modbus_read_write_modbus_pdu_length_in_bits(plc4c_modbus_read_writ
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_request: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_request: {
break;
}
- case plc4c_modbus_read_write_modbus_pdu_type_modbus_read_write_modbus_pdu_read_device_identification_response: {
+ case plc4c_modbus_read_write_modbus_pdu_type_plc4c_modbus_read_write_modbus_pdu_read_device_identification_response: {
break;
}
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_request_item.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_request_item.c
index 544a2b5..3964ee4 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_request_item.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_request_item.c
@@ -37,7 +37,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_request_it
// Simple Field (referenceType)
uint8_t referenceType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &referenceType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &referenceType);
if(_res != OK) {
return _res;
}
@@ -45,7 +45,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_request_it
// Simple Field (fileNumber)
uint16_t fileNumber = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &fileNumber);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &fileNumber);
if(_res != OK) {
return _res;
}
@@ -53,7 +53,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_request_it
// Simple Field (recordNumber)
uint16_t recordNumber = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &recordNumber);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &recordNumber);
if(_res != OK) {
return _res;
}
@@ -61,7 +61,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_request_it
// Simple Field (recordLength)
uint16_t recordLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &recordLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &recordLength);
if(_res != OK) {
return _res;
}
@@ -74,25 +74,25 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_request_it
plc4c_return_code _res = OK;
// Simple Field (referenceType)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->reference_type);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->reference_type);
if(_res != OK) {
return _res;
}
// Simple Field (fileNumber)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->file_number);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->file_number);
if(_res != OK) {
return _res;
}
// Simple Field (recordNumber)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->record_number);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->record_number);
if(_res != OK) {
return _res;
}
// Simple Field (recordLength)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->record_length);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->record_length);
if(_res != OK) {
return _res;
}
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_response_item.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_response_item.c
index 48443d3..1af70d6 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_response_item.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_response_item.c
@@ -37,14 +37,14 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_response_i
// Implicit Field (dataLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t dataLength = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &dataLength);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &dataLength);
if(_res != OK) {
return _res;
}
// Simple Field (referenceType)
uint8_t referenceType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &referenceType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &referenceType);
if(_res != OK) {
return _res;
}
@@ -61,7 +61,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_response_i
uint8_t dataEndPos = plc4c_spi_read_get_pos(buf) + _dataLength;
while(plc4c_spi_read_get_pos(buf) < dataEndPos) {
uint16_t _value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &_value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &_value);
if(_res != OK) {
return _res;
}
@@ -77,13 +77,13 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_response_i
plc4c_return_code _res = OK;
// Implicit Field (dataLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, (((plc4c_spi_evaluation_helper_count(_message->data)) * (2))) + (1));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, (((plc4c_spi_evaluation_helper_count(_message->data)) * (2))) + (1));
if(_res != OK) {
return _res;
}
// Simple Field (referenceType)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->reference_type);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->reference_type);
if(_res != OK) {
return _res;
}
@@ -94,7 +94,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_read_file_record_response_i
for(int curItem = 0; curItem < itemCount; curItem++) {
uint16_t* _value = (uint16_t*) plc4c_utils_list_get_value(_message->data, curItem);
- plc4c_spi_write_unsigned_int(buf, 16, *_value);
+ plc4c_spi_write_unsigned_short(buf, 16, *_value);
}
}
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_request_item.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_request_item.c
index dc2fe82..2d1a0e7 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_request_item.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_request_item.c
@@ -37,7 +37,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_request_i
// Simple Field (referenceType)
uint8_t referenceType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &referenceType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &referenceType);
if(_res != OK) {
return _res;
}
@@ -45,7 +45,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_request_i
// Simple Field (fileNumber)
uint16_t fileNumber = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &fileNumber);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &fileNumber);
if(_res != OK) {
return _res;
}
@@ -53,7 +53,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_request_i
// Simple Field (recordNumber)
uint16_t recordNumber = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &recordNumber);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &recordNumber);
if(_res != OK) {
return _res;
}
@@ -61,7 +61,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_request_i
// Implicit Field (recordLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t recordLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &recordLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &recordLength);
if(_res != OK) {
return _res;
}
@@ -77,7 +77,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_request_i
uint8_t recordDataEndPos = plc4c_spi_read_get_pos(buf) + _recordDataLength;
while(plc4c_spi_read_get_pos(buf) < recordDataEndPos) {
uint16_t _value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &_value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &_value);
if(_res != OK) {
return _res;
}
@@ -93,25 +93,25 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_request_i
plc4c_return_code _res = OK;
// Simple Field (referenceType)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->reference_type);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->reference_type);
if(_res != OK) {
return _res;
}
// Simple Field (fileNumber)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->file_number);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->file_number);
if(_res != OK) {
return _res;
}
// Simple Field (recordNumber)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->record_number);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->record_number);
if(_res != OK) {
return _res;
}
// Implicit Field (recordLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->record_data)) * (2))) / (2));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->record_data)) * (2))) / (2));
if(_res != OK) {
return _res;
}
@@ -122,7 +122,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_request_i
for(int curItem = 0; curItem < itemCount; curItem++) {
uint16_t* _value = (uint16_t*) plc4c_utils_list_get_value(_message->record_data, curItem);
- plc4c_spi_write_unsigned_int(buf, 16, *_value);
+ plc4c_spi_write_unsigned_short(buf, 16, *_value);
}
}
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_response_item.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_response_item.c
index c7f7241..f1e3999 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_response_item.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_response_item.c
@@ -37,7 +37,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_response_
// Simple Field (referenceType)
uint8_t referenceType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &referenceType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &referenceType);
if(_res != OK) {
return _res;
}
@@ -45,7 +45,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_response_
// Simple Field (fileNumber)
uint16_t fileNumber = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &fileNumber);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &fileNumber);
if(_res != OK) {
return _res;
}
@@ -53,7 +53,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_response_
// Simple Field (recordNumber)
uint16_t recordNumber = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &recordNumber);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &recordNumber);
if(_res != OK) {
return _res;
}
@@ -61,7 +61,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_response_
// Implicit Field (recordLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t recordLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &recordLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &recordLength);
if(_res != OK) {
return _res;
}
@@ -77,7 +77,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_response_
uint8_t recordDataEndPos = plc4c_spi_read_get_pos(buf) + _recordDataLength;
while(plc4c_spi_read_get_pos(buf) < recordDataEndPos) {
uint16_t _value = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &_value);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &_value);
if(_res != OK) {
return _res;
}
@@ -93,25 +93,25 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_response_
plc4c_return_code _res = OK;
// Simple Field (referenceType)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->reference_type);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->reference_type);
if(_res != OK) {
return _res;
}
// Simple Field (fileNumber)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->file_number);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->file_number);
if(_res != OK) {
return _res;
}
// Simple Field (recordNumber)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->record_number);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->record_number);
if(_res != OK) {
return _res;
}
// Implicit Field (recordLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->record_data)) * (2))) / (2));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (((plc4c_spi_evaluation_helper_count(_message->record_data)) * (2))) / (2));
if(_res != OK) {
return _res;
}
@@ -122,7 +122,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_pdu_write_file_record_response_
for(int curItem = 0; curItem < itemCount; curItem++) {
uint16_t* _value = (uint16_t*) plc4c_utils_list_get_value(_message->record_data, curItem);
- plc4c_spi_write_unsigned_int(buf, 16, *_value);
+ plc4c_spi_write_unsigned_short(buf, 16, *_value);
}
}
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_serial_adu.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_serial_adu.c
index cc0dc77..913f961 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_serial_adu.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_serial_adu.c
@@ -37,7 +37,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_serial_adu_parse(plc4c_spi_read
// Simple Field (transactionId)
uint16_t transactionId = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &transactionId);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &transactionId);
if(_res != OK) {
return _res;
}
@@ -46,7 +46,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_serial_adu_parse(plc4c_spi_read
// Reserved Field (Compartmentalized so the "reserved" variable can't leak)
{
uint16_t _reserved = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) _reserved);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &_reserved);
if(_res != OK) {
return _res;
}
@@ -57,7 +57,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_serial_adu_parse(plc4c_spi_read
// Simple Field (length)
uint16_t length = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &length);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &length);
if(_res != OK) {
return _res;
}
@@ -65,7 +65,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_serial_adu_parse(plc4c_spi_read
// Simple Field (address)
uint8_t address = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &address);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &address);
if(_res != OK) {
return _res;
}
@@ -86,25 +86,25 @@ plc4c_return_code plc4c_modbus_read_write_modbus_serial_adu_serialize(plc4c_spi_
plc4c_return_code _res = OK;
// Simple Field (transactionId)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->transaction_id);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->transaction_id);
if(_res != OK) {
return _res;
}
// Reserved Field
- _res = plc4c_spi_write_unsigned_int(buf, 16, 0x0000);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, 0x0000);
if(_res != OK) {
return _res;
}
// Simple Field (length)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->length);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->length);
if(_res != OK) {
return _res;
}
// Simple Field (address)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->address);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->address);
if(_res != OK) {
return _res;
}
diff --git a/sandbox/plc4c/generated-sources/modbus/src/modbus_tcp_adu.c b/sandbox/plc4c/generated-sources/modbus/src/modbus_tcp_adu.c
index 5a67bc2..9b9ef16 100644
--- a/sandbox/plc4c/generated-sources/modbus/src/modbus_tcp_adu.c
+++ b/sandbox/plc4c/generated-sources/modbus/src/modbus_tcp_adu.c
@@ -37,7 +37,7 @@ plc4c_return_code plc4c_modbus_read_write_modbus_tcp_adu_parse(plc4c_spi_read_bu
// Simple Field (transactionIdentifier)
uint16_t transactionIdentifier = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &transactionIdentifier);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &transactionIdentifier);
if(_res != OK) {
return _res;
}
@@ -45,25 +45,25 @@ plc4c_return_code plc4c_modbus_read_write_modbus_tcp_adu_parse(plc4c_spi_read_bu
// Const Field (protocolIdentifier)
uint16_t protocolIdentifier = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &protocolIdentifier);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &protocolIdentifier);
if(_res != OK) {
return _res;
}
- if(protocolIdentifier != MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER) {
+ if(protocolIdentifier != PLC4C_MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER) {
return PARSE_ERROR;
- // throw new ParseException("Expected constant value " + MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER + " but got " + protocolIdentifier);
+ // throw new ParseException("Expected constant value " + PLC4C_MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER + " but got " + protocolIdentifier);
}
// Implicit Field (length) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t length = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &length);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &length);
if(_res != OK) {
return _res;
}
// Simple Field (unitIdentifier)
uint8_t unitIdentifier = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &unitIdentifier);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &unitIdentifier);
if(_res != OK) {
return _res;
}
@@ -84,22 +84,22 @@ plc4c_return_code plc4c_modbus_read_write_modbus_tcp_adu_serialize(plc4c_spi_wri
plc4c_return_code _res = OK;
// Simple Field (transactionIdentifier)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->transaction_identifier);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->transaction_identifier);
if(_res != OK) {
return _res;
}
// Const Field (protocolIdentifier)
- plc4c_spi_write_unsigned_int(buf, 16, MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER);
+ plc4c_spi_write_unsigned_short(buf, 16, PLC4C_MODBUS_READ_WRITE_MODBUS_TCP_ADU_PROTOCOL_IDENTIFIER);
// Implicit Field (length) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (plc4c_modbus_read_write_modbus_pdu_length_in_bytes(_message->pdu)) + (1));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (plc4c_modbus_read_write_modbus_pdu_length_in_bytes(_message->pdu)) + (1));
if(_res != OK) {
return _res;
}
// Simple Field (unitIdentifier)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->unit_identifier);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->unit_identifier);
if(_res != OK) {
return _res;
}
diff --git a/sandbox/plc4c/generated-sources/s7/includes/cotp_packet.h b/sandbox/plc4c/generated-sources/s7/includes/cotp_packet.h
index a573bd4..733826c 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/cotp_packet.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/cotp_packet.h
@@ -38,12 +38,12 @@ typedef struct plc4c_s7_read_write_cotp_packet_discriminator plc4c_s7_read_write
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_cotp_packet_type {
- plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_data = 0,
- plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_request = 1,
- plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_response = 2,
- plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_request = 3,
- plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_response = 4,
- plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_tpdu_error = 5};
+ plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_data = 0,
+ plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_request = 1,
+ plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_response = 2,
+ plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_request = 3,
+ plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_response = 4,
+ plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_tpdu_error = 5};
typedef enum plc4c_s7_read_write_cotp_packet_type plc4c_s7_read_write_cotp_packet_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/s7/includes/cotp_parameter.h b/sandbox/plc4c/generated-sources/s7/includes/cotp_parameter.h
index d34f060..30e02c6 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/cotp_parameter.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/cotp_parameter.h
@@ -36,11 +36,11 @@ typedef struct plc4c_s7_read_write_cotp_parameter_discriminator plc4c_s7_read_wr
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_cotp_parameter_type {
- plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_tpdu_size = 0,
- plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_calling_tsap = 1,
- plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_called_tsap = 2,
- plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_checksum = 3,
- plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_disconnect_additional_information = 4};
+ plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_tpdu_size = 0,
+ plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_calling_tsap = 1,
+ plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_called_tsap = 2,
+ plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_checksum = 3,
+ plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_disconnect_additional_information = 4};
typedef enum plc4c_s7_read_write_cotp_parameter_type plc4c_s7_read_write_cotp_parameter_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/s7/includes/memory_area.h b/sandbox/plc4c/generated-sources/s7/includes/memory_area.h
index 883e000..56df5e1 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/memory_area.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/memory_area.h
@@ -42,7 +42,7 @@ typedef enum plc4c_s7_read_write_memory_area plc4c_s7_read_write_memory_area;
static const plc4c_s7_read_write_memory_area plc4c_s7_read_write_memory_area_null;
-char * plc4c_s7_read_write_memory_area_get_short_name(plc4c_s7_read_write_memory_area value) {
+char* plc4c_s7_read_write_memory_area_get_short_name(plc4c_s7_read_write_memory_area value) {
switch(value) {
case 28: { /* '0x1C' */
return "C";
diff --git a/sandbox/plc4c/generated-sources/s7/includes/s7_address.h b/sandbox/plc4c/generated-sources/s7/includes/s7_address.h
index a8c1379..2c9e74e 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/s7_address.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/s7_address.h
@@ -37,7 +37,7 @@ typedef struct plc4c_s7_read_write_s7_address_discriminator plc4c_s7_read_write_
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_s7_address_type {
- plc4c_s7_read_write_s7_address_type_s7_read_write_s7_address_any = 0};
+ plc4c_s7_read_write_s7_address_type_plc4c_s7_read_write_s7_address_any = 0};
typedef enum plc4c_s7_read_write_s7_address_type plc4c_s7_read_write_s7_address_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/s7/includes/s7_message.h b/sandbox/plc4c/generated-sources/s7/includes/s7_message.h
index 2efe20b..dc27a7b 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/s7_message.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/s7_message.h
@@ -37,17 +37,17 @@ typedef struct plc4c_s7_read_write_s7_message_discriminator plc4c_s7_read_write_
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_s7_message_type {
- plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_request = 0,
- plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response = 1,
- plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response_data = 2,
- plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_user_data = 3};
+ plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_request = 0,
+ plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response = 1,
+ plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response_data = 2,
+ plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_user_data = 3};
typedef enum plc4c_s7_read_write_s7_message_type plc4c_s7_read_write_s7_message_type;
// Function to get the discriminator values for a given type.
plc4c_s7_read_write_s7_message_discriminator plc4c_s7_read_write_s7_message_get_discriminator(plc4c_s7_read_write_s7_message_type type);
// Constant values.
-const uint8_t S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID = 0x32;
+const uint8_t PLC4C_S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID = 0x32;
struct plc4c_s7_read_write_s7_message {
/* This is an abstract type so this property saves the type of this typed union */
diff --git a/sandbox/plc4c/generated-sources/s7/includes/s7_parameter.h b/sandbox/plc4c/generated-sources/s7/includes/s7_parameter.h
index c5166f2..4dcc3bc 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/s7_parameter.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/s7_parameter.h
@@ -38,12 +38,12 @@ typedef struct plc4c_s7_read_write_s7_parameter_discriminator plc4c_s7_read_writ
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_s7_parameter_type {
- plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_setup_communication = 0,
- plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_request = 1,
- plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_response = 2,
- plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_request = 3,
- plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_response = 4,
- plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_user_data = 5};
+ plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_setup_communication = 0,
+ plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_request = 1,
+ plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_response = 2,
+ plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_request = 3,
+ plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_response = 4,
+ plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_user_data = 5};
typedef enum plc4c_s7_read_write_s7_parameter_type plc4c_s7_read_write_s7_parameter_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/s7/includes/s7_parameter_user_data_item.h b/sandbox/plc4c/generated-sources/s7/includes/s7_parameter_user_data_item.h
index a92d913..c2c294c 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/s7_parameter_user_data_item.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/s7_parameter_user_data_item.h
@@ -35,7 +35,7 @@ typedef struct plc4c_s7_read_write_s7_parameter_user_data_item_discriminator plc
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_s7_parameter_user_data_item_type {
- plc4c_s7_read_write_s7_parameter_user_data_item_type_s7_read_write_s7_parameter_user_data_item_cpu_functions = 0};
+ plc4c_s7_read_write_s7_parameter_user_data_item_type_plc4c_s7_read_write_s7_parameter_user_data_item_cpu_functions = 0};
typedef enum plc4c_s7_read_write_s7_parameter_user_data_item_type plc4c_s7_read_write_s7_parameter_user_data_item_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/s7/includes/s7_payload.h b/sandbox/plc4c/generated-sources/s7/includes/s7_payload.h
index c445b97..89efc53 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/s7_payload.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/s7_payload.h
@@ -40,10 +40,10 @@ typedef struct plc4c_s7_read_write_s7_payload_discriminator plc4c_s7_read_write_
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_s7_payload_type {
- plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_read_var_response = 0,
- plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_request = 1,
- plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_response = 2,
- plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_user_data = 3};
+ plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_read_var_response = 0,
+ plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_request = 1,
+ plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_response = 2,
+ plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_user_data = 3};
typedef enum plc4c_s7_read_write_s7_payload_type plc4c_s7_read_write_s7_payload_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/s7/includes/s7_payload_user_data_item.h b/sandbox/plc4c/generated-sources/s7/includes/s7_payload_user_data_item.h
index beb4db3..fc227b1 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/s7_payload_user_data_item.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/s7_payload_user_data_item.h
@@ -39,15 +39,15 @@ typedef struct plc4c_s7_read_write_s7_payload_user_data_item_discriminator plc4c
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_s7_payload_user_data_item_type {
- plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request = 0,
- plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response = 1};
+ plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request = 0,
+ plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response = 1};
typedef enum plc4c_s7_read_write_s7_payload_user_data_item_type plc4c_s7_read_write_s7_payload_user_data_item_type;
// Function to get the discriminator values for a given type.
plc4c_s7_read_write_s7_payload_user_data_item_discriminator plc4c_s7_read_write_s7_payload_user_data_item_get_discriminator(plc4c_s7_read_write_s7_payload_user_data_item_type type);
// Constant values.
-const uint16_t S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH = 28;
+const uint16_t PLC4C_S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH = 28;
struct plc4c_s7_read_write_s7_payload_user_data_item {
/* This is an abstract type so this property saves the type of this typed union */
diff --git a/sandbox/plc4c/generated-sources/s7/includes/s7_var_request_parameter_item.h b/sandbox/plc4c/generated-sources/s7/includes/s7_var_request_parameter_item.h
index 6caa56d..3fa6743 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/s7_var_request_parameter_item.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/s7_var_request_parameter_item.h
@@ -36,7 +36,7 @@ typedef struct plc4c_s7_read_write_s7_var_request_parameter_item_discriminator p
// Enum assigning each sub-type an individual id.
enum plc4c_s7_read_write_s7_var_request_parameter_item_type {
- plc4c_s7_read_write_s7_var_request_parameter_item_type_s7_read_write_s7_var_request_parameter_item_address = 0};
+ plc4c_s7_read_write_s7_var_request_parameter_item_type_plc4c_s7_read_write_s7_var_request_parameter_item_address = 0};
typedef enum plc4c_s7_read_write_s7_var_request_parameter_item_type plc4c_s7_read_write_s7_var_request_parameter_item_type;
// Function to get the discriminator values for a given type.
diff --git a/sandbox/plc4c/generated-sources/s7/includes/tpkt_packet.h b/sandbox/plc4c/generated-sources/s7/includes/tpkt_packet.h
index f9f408a..0a4854c 100644
--- a/sandbox/plc4c/generated-sources/s7/includes/tpkt_packet.h
+++ b/sandbox/plc4c/generated-sources/s7/includes/tpkt_packet.h
@@ -28,7 +28,7 @@ extern "C" {
#include "cotp_packet.h"
// Constant values.
-const uint8_t S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID = 0x03;
+const uint8_t PLC4C_S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID = 0x03;
struct plc4c_s7_read_write_tpkt_packet {
/* Properties */
diff --git a/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c b/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
index d462a70..cdea9df 100644
--- a/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
+++ b/sandbox/plc4c/generated-sources/s7/src/cotp_packet.c
@@ -27,17 +27,17 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_cotp_packet_discriminator plc4c_s7_read_write_cotp_packet_discriminators[] = {
- {/* s7_read_write_cotp_packet_connection_request */
+ {/* plc4c_s7_read_write_cotp_packet_connection_request */
.tpduCode = 0xE0},
- {/* s7_read_write_cotp_packet_connection_response */
+ {/* plc4c_s7_read_write_cotp_packet_connection_response */
.tpduCode = 0xD0},
- {/* s7_read_write_cotp_packet_data */
+ {/* plc4c_s7_read_write_cotp_packet_data */
.tpduCode = 0xF0},
- {/* s7_read_write_cotp_packet_disconnect_request */
+ {/* plc4c_s7_read_write_cotp_packet_disconnect_request */
.tpduCode = 0x80},
- {/* s7_read_write_cotp_packet_disconnect_response */
+ {/* plc4c_s7_read_write_cotp_packet_disconnect_response */
.tpduCode = 0xC0},
- {/* s7_read_write_cotp_packet_tpdu_error */
+ {/* plc4c_s7_read_write_cotp_packet_tpdu_error */
.tpduCode = 0x70}
};
@@ -60,21 +60,21 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Implicit Field (headerLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t headerLength = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &headerLength);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &headerLength);
if(_res != OK) {
return _res;
}
// Discriminator Field (tpduCode) (Used as input to a switch field)
uint8_t tpduCode = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &tpduCode);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &tpduCode);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(tpduCode == 0xF0) { /* COTPPacketData */
- (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_data;
+ (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_data;
// Simple Field (eot)
bool eot = false;
@@ -88,7 +88,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Simple Field (tpduRef)
unsigned int tpduRef = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 7, (uint16_t*) &tpduRef);
+ _res = plc4c_spi_read_unsigned_byte(buf, 7, (uint8_t*) &tpduRef);
if(_res != OK) {
return _res;
}
@@ -96,11 +96,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
} else
if(tpduCode == 0xE0) { /* COTPPacketConnectionRequest */
- (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_request;
+ (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_request;
// Simple Field (destinationReference)
uint16_t destinationReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &destinationReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &destinationReference);
if(_res != OK) {
return _res;
}
@@ -110,7 +110,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Simple Field (sourceReference)
uint16_t sourceReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &sourceReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &sourceReference);
if(_res != OK) {
return _res;
}
@@ -128,11 +128,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
} else
if(tpduCode == 0xD0) { /* COTPPacketConnectionResponse */
- (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_response;
+ (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_response;
// Simple Field (destinationReference)
uint16_t destinationReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &destinationReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &destinationReference);
if(_res != OK) {
return _res;
}
@@ -142,7 +142,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Simple Field (sourceReference)
uint16_t sourceReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &sourceReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &sourceReference);
if(_res != OK) {
return _res;
}
@@ -160,11 +160,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
} else
if(tpduCode == 0x80) { /* COTPPacketDisconnectRequest */
- (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_request;
+ (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_request;
// Simple Field (destinationReference)
uint16_t destinationReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &destinationReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &destinationReference);
if(_res != OK) {
return _res;
}
@@ -174,7 +174,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Simple Field (sourceReference)
uint16_t sourceReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &sourceReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &sourceReference);
if(_res != OK) {
return _res;
}
@@ -192,11 +192,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
} else
if(tpduCode == 0xC0) { /* COTPPacketDisconnectResponse */
- (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_response;
+ (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_response;
// Simple Field (destinationReference)
uint16_t destinationReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &destinationReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &destinationReference);
if(_res != OK) {
return _res;
}
@@ -206,7 +206,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Simple Field (sourceReference)
uint16_t sourceReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &sourceReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &sourceReference);
if(_res != OK) {
return _res;
}
@@ -214,11 +214,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
} else
if(tpduCode == 0x70) { /* COTPPacketTpduError */
- (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_tpdu_error;
+ (*_message)->_type = plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_tpdu_error;
// Simple Field (destinationReference)
uint16_t destinationReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &destinationReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &destinationReference);
if(_res != OK) {
return _res;
}
@@ -228,7 +228,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_parse(plc4c_spi_read_buffer* b
// Simple Field (rejectCause)
uint8_t rejectCause = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &rejectCause);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &rejectCause);
if(_res != OK) {
return _res;
}
@@ -280,17 +280,17 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_serialize(plc4c_spi_write_buff
plc4c_return_code _res = OK;
// Implicit Field (headerLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, (plc4c_s7_read_write_cotp_packet_length_in_bytes(_message)) - ((((((((_message->payload) != (NULL))) ? plc4c_s7_read_write_s7_message_length_in_bytes(_message->payload) : 0))) + (1))));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, (plc4c_s7_read_write_cotp_packet_length_in_bytes(_message)) - ((((((((_message->payload) != (NULL))) ? plc4c_s7_read_write_s7_message_length_in_bytes(_message->payload) : 0))) + (1))));
if(_res != OK) {
return _res;
}
// Discriminator Field (tpduCode)
- plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_cotp_packet_get_discriminator(_message->_type).tpduCode);
+ plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_cotp_packet_get_discriminator(_message->_type).tpduCode);
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_data: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_data: {
// Simple Field (eot)
_res = plc4c_spi_write_bit(buf, _message->cotp_packet_data_eot);
@@ -299,23 +299,23 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_serialize(plc4c_spi_write_buff
}
// Simple Field (tpduRef)
- _res = plc4c_spi_write_unsigned_short(buf, 7, _message->cotp_packet_data_tpdu_ref);
+ _res = plc4c_spi_write_unsigned_byte(buf, 7, _message->cotp_packet_data_tpdu_ref);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_request: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_request: {
// Simple Field (destinationReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_connection_request_destination_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_connection_request_destination_reference);
if(_res != OK) {
return _res;
}
// Simple Field (sourceReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_connection_request_source_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_connection_request_source_reference);
if(_res != OK) {
return _res;
}
@@ -328,16 +328,16 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_serialize(plc4c_spi_write_buff
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_response: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_response: {
// Simple Field (destinationReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_connection_response_destination_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_connection_response_destination_reference);
if(_res != OK) {
return _res;
}
// Simple Field (sourceReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_connection_response_source_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_connection_response_source_reference);
if(_res != OK) {
return _res;
}
@@ -350,16 +350,16 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_serialize(plc4c_spi_write_buff
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_request: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_request: {
// Simple Field (destinationReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_disconnect_request_destination_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_disconnect_request_destination_reference);
if(_res != OK) {
return _res;
}
// Simple Field (sourceReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_disconnect_request_source_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_disconnect_request_source_reference);
if(_res != OK) {
return _res;
}
@@ -372,32 +372,32 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_serialize(plc4c_spi_write_buff
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_response: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_response: {
// Simple Field (destinationReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_disconnect_response_destination_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_disconnect_response_destination_reference);
if(_res != OK) {
return _res;
}
// Simple Field (sourceReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_disconnect_response_source_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_disconnect_response_source_reference);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_tpdu_error: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_tpdu_error: {
// Simple Field (destinationReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_packet_tpdu_error_destination_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_packet_tpdu_error_destination_reference);
if(_res != OK) {
return _res;
}
// Simple Field (rejectCause)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->cotp_packet_tpdu_error_reject_cause);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->cotp_packet_tpdu_error_reject_cause);
if(_res != OK) {
return _res;
}
@@ -412,7 +412,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_packet_serialize(plc4c_spi_write_buff
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_cotp_parameter* _value = (plc4c_s7_read_write_cotp_parameter*) plc4c_utils_list_get_value(_message->parameters, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_cotp_parameter_serialize(buf, (void*) &_value);
+ _res = plc4c_s7_read_write_cotp_parameter_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -445,7 +445,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_data: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_data: {
// Simple field (eot)
lengthInBits += 1;
@@ -456,7 +456,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_request: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_request: {
// Simple field (destinationReference)
lengthInBits += 16;
@@ -471,7 +471,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_connection_response: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_connection_response: {
// Simple field (destinationReference)
lengthInBits += 16;
@@ -486,7 +486,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_request: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_request: {
// Simple field (destinationReference)
lengthInBits += 16;
@@ -501,7 +501,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_disconnect_response: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_disconnect_response: {
// Simple field (destinationReference)
lengthInBits += 16;
@@ -512,7 +512,7 @@ uint8_t plc4c_s7_read_write_cotp_packet_length_in_bits(plc4c_s7_read_write_cotp_
break;
}
- case plc4c_s7_read_write_cotp_packet_type_s7_read_write_cotp_packet_tpdu_error: {
+ case plc4c_s7_read_write_cotp_packet_type_plc4c_s7_read_write_cotp_packet_tpdu_error: {
// Simple field (destinationReference)
lengthInBits += 16;
diff --git a/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c b/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
index f06b98d..a13853a 100644
--- a/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
+++ b/sandbox/plc4c/generated-sources/s7/src/cotp_parameter.c
@@ -27,15 +27,15 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_cotp_parameter_discriminator plc4c_s7_read_write_cotp_parameter_discriminators[] = {
- {/* s7_read_write_cotp_parameter_called_tsap */
+ {/* plc4c_s7_read_write_cotp_parameter_called_tsap */
.parameterType = 0xC2},
- {/* s7_read_write_cotp_parameter_calling_tsap */
+ {/* plc4c_s7_read_write_cotp_parameter_calling_tsap */
.parameterType = 0xC1},
- {/* s7_read_write_cotp_parameter_checksum */
+ {/* plc4c_s7_read_write_cotp_parameter_checksum */
.parameterType = 0xC3},
- {/* s7_read_write_cotp_parameter_disconnect_additional_information */
+ {/* plc4c_s7_read_write_cotp_parameter_disconnect_additional_information */
.parameterType = 0xE0},
- {/* s7_read_write_cotp_parameter_tpdu_size */
+ {/* plc4c_s7_read_write_cotp_parameter_tpdu_size */
.parameterType = 0xC0}
};
@@ -58,21 +58,21 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_parse(plc4c_spi_read_buffer
// Discriminator Field (parameterType) (Used as input to a switch field)
uint8_t parameterType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) ¶meterType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) ¶meterType);
if(_res != OK) {
return _res;
}
// Implicit Field (parameterLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t parameterLength = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) ¶meterLength);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) ¶meterLength);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(parameterType == 0xC0) { /* COTPParameterTpduSize */
- (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_tpdu_size;
+ (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_tpdu_size;
// Enum field (tpduSize)
plc4c_s7_read_write_cotp_tpdu_size tpduSize = plc4c_s7_read_write_cotp_tpdu_size_null;
@@ -84,11 +84,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_parse(plc4c_spi_read_buffer
} else
if(parameterType == 0xC1) { /* COTPParameterCallingTsap */
- (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_calling_tsap;
+ (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_calling_tsap;
// Simple Field (tsapId)
uint16_t tsapId = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &tsapId);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &tsapId);
if(_res != OK) {
return _res;
}
@@ -96,11 +96,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_parse(plc4c_spi_read_buffer
} else
if(parameterType == 0xC2) { /* COTPParameterCalledTsap */
- (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_called_tsap;
+ (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_called_tsap;
// Simple Field (tsapId)
uint16_t tsapId = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &tsapId);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &tsapId);
if(_res != OK) {
return _res;
}
@@ -108,11 +108,11 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_parse(plc4c_spi_read_buffer
} else
if(parameterType == 0xC3) { /* COTPParameterChecksum */
- (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_checksum;
+ (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_checksum;
// Simple Field (crc)
uint8_t crc = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &crc);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &crc);
if(_res != OK) {
return _res;
}
@@ -120,7 +120,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_parse(plc4c_spi_read_buffer
} else
if(parameterType == 0xE0) { /* COTPParameterDisconnectAdditionalInformation */
- (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_disconnect_additional_information;
+ (*_message)->_type = plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_disconnect_additional_information;
// Array field (data)
plc4c_list* data = malloc(sizeof(plc4c_list));
@@ -134,7 +134,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_parse(plc4c_spi_read_buffer
uint8_t _value = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &_value);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &_value);
if(_res != OK) {
return _res;
}
@@ -152,17 +152,17 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_serialize(plc4c_spi_write_b
plc4c_return_code _res = OK;
// Discriminator Field (parameterType)
- plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_cotp_parameter_get_discriminator(_message->_type).parameterType);
+ plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_cotp_parameter_get_discriminator(_message->_type).parameterType);
// Implicit Field (parameterLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, (plc4c_s7_read_write_cotp_parameter_length_in_bytes(_message)) - (2));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, (plc4c_s7_read_write_cotp_parameter_length_in_bytes(_message)) - (2));
if(_res != OK) {
return _res;
}
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_tpdu_size: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_tpdu_size: {
// Enum field (tpduSize)
_res = plc4c_spi_write_byte(buf, 8, _message->cotp_parameter_tpdu_size_tpdu_size);
@@ -172,37 +172,37 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_serialize(plc4c_spi_write_b
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_calling_tsap: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_calling_tsap: {
// Simple Field (tsapId)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_parameter_calling_tsap_tsap_id);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_parameter_calling_tsap_tsap_id);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_called_tsap: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_called_tsap: {
// Simple Field (tsapId)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->cotp_parameter_called_tsap_tsap_id);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->cotp_parameter_called_tsap_tsap_id);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_checksum: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_checksum: {
// Simple Field (crc)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->cotp_parameter_checksum_crc);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->cotp_parameter_checksum_crc);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_disconnect_additional_information: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_disconnect_additional_information: {
// Array field (data)
{
@@ -210,7 +210,7 @@ plc4c_return_code plc4c_s7_read_write_cotp_parameter_serialize(plc4c_spi_write_b
for(int curItem = 0; curItem < itemCount; curItem++) {
uint8_t* _value = (uint8_t*) plc4c_utils_list_get_value(_message->cotp_parameter_disconnect_additional_information_data, curItem);
- plc4c_spi_write_unsigned_short(buf, 8, *_value);
+ plc4c_spi_write_unsigned_byte(buf, 8, *_value);
}
}
@@ -236,35 +236,35 @@ uint8_t plc4c_s7_read_write_cotp_parameter_length_in_bits(plc4c_s7_read_write_co
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_tpdu_size: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_tpdu_size: {
// Enum Field (tpduSize)
lengthInBits += 8;
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_calling_tsap: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_calling_tsap: {
// Simple field (tsapId)
lengthInBits += 16;
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_called_tsap: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_called_tsap: {
// Simple field (tsapId)
lengthInBits += 16;
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_checksum: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_checksum: {
// Simple field (crc)
lengthInBits += 8;
break;
}
- case plc4c_s7_read_write_cotp_parameter_type_s7_read_write_cotp_parameter_disconnect_additional_information: {
+ case plc4c_s7_read_write_cotp_parameter_type_plc4c_s7_read_write_cotp_parameter_disconnect_additional_information: {
// Array field
lengthInBits += 8 * plc4c_utils_list_size(_message->cotp_parameter_disconnect_additional_information_data);
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_address.c b/sandbox/plc4c/generated-sources/s7/src/s7_address.c
index 652ea36..d3531b8 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_address.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_address.c
@@ -27,7 +27,7 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_s7_address_discriminator plc4c_s7_read_write_s7_address_discriminators[] = {
- {/* s7_read_write_s7_address_any */
+ {/* plc4c_s7_read_write_s7_address_any */
.addressType = 0x10}
};
@@ -50,14 +50,14 @@ plc4c_return_code plc4c_s7_read_write_s7_address_parse(plc4c_spi_read_buffer* bu
// Discriminator Field (addressType) (Used as input to a switch field)
uint8_t addressType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &addressType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &addressType);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(addressType == 0x10) { /* S7AddressAny */
- (*_message)->_type = plc4c_s7_read_write_s7_address_type_s7_read_write_s7_address_any;
+ (*_message)->_type = plc4c_s7_read_write_s7_address_type_plc4c_s7_read_write_s7_address_any;
// Enum field (transportSize)
plc4c_s7_read_write_transport_size transportSize = plc4c_s7_read_write_transport_size_null;
@@ -71,7 +71,7 @@ plc4c_return_code plc4c_s7_read_write_s7_address_parse(plc4c_spi_read_buffer* bu
// Simple Field (numberOfElements)
uint16_t numberOfElements = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &numberOfElements);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &numberOfElements);
if(_res != OK) {
return _res;
}
@@ -81,7 +81,7 @@ plc4c_return_code plc4c_s7_read_write_s7_address_parse(plc4c_spi_read_buffer* bu
// Simple Field (dbNumber)
uint16_t dbNumber = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &dbNumber);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &dbNumber);
if(_res != OK) {
return _res;
}
@@ -102,7 +102,7 @@ plc4c_return_code plc4c_s7_read_write_s7_address_parse(plc4c_spi_read_buffer* bu
// Reserved Field (Compartmentalized so the "reserved" variable can't leak)
{
unsigned int _reserved = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 5, (uint16_t*) _reserved);
+ _res = plc4c_spi_read_unsigned_byte(buf, 5, (uint8_t*) &_reserved);
if(_res != OK) {
return _res;
}
@@ -115,7 +115,7 @@ plc4c_return_code plc4c_s7_read_write_s7_address_parse(plc4c_spi_read_buffer* bu
// Simple Field (byteAddress)
uint16_t byteAddress = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &byteAddress);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &byteAddress);
if(_res != OK) {
return _res;
}
@@ -140,11 +140,11 @@ plc4c_return_code plc4c_s7_read_write_s7_address_serialize(plc4c_spi_write_buffe
plc4c_return_code _res = OK;
// Discriminator Field (addressType)
- plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_address_get_discriminator(_message->_type).addressType);
+ plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_s7_address_get_discriminator(_message->_type).addressType);
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_s7_address_type_s7_read_write_s7_address_any: {
+ case plc4c_s7_read_write_s7_address_type_plc4c_s7_read_write_s7_address_any: {
// Enum field (transportSize)
_res = plc4c_spi_write_byte(buf, 8, _message->s7_address_any_transport_size);
@@ -153,13 +153,13 @@ plc4c_return_code plc4c_s7_read_write_s7_address_serialize(plc4c_spi_write_buffe
}
// Simple Field (numberOfElements)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->s7_address_any_number_of_elements);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->s7_address_any_number_of_elements);
if(_res != OK) {
return _res;
}
// Simple Field (dbNumber)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->s7_address_any_db_number);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->s7_address_any_db_number);
if(_res != OK) {
return _res;
}
@@ -171,13 +171,13 @@ plc4c_return_code plc4c_s7_read_write_s7_address_serialize(plc4c_spi_write_buffe
}
// Reserved Field
- _res = plc4c_spi_write_unsigned_short(buf, 5, 0x00);
+ _res = plc4c_spi_write_unsigned_byte(buf, 5, 0x00);
if(_res != OK) {
return _res;
}
// Simple Field (byteAddress)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->s7_address_any_byte_address);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->s7_address_any_byte_address);
if(_res != OK) {
return _res;
}
@@ -207,7 +207,7 @@ uint8_t plc4c_s7_read_write_s7_address_length_in_bits(plc4c_s7_read_write_s7_add
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_s7_address_type_s7_read_write_s7_address_any: {
+ case plc4c_s7_read_write_s7_address_type_plc4c_s7_read_write_s7_address_any: {
// Enum Field (transportSize)
lengthInBits += 8;
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_message.c b/sandbox/plc4c/generated-sources/s7/src/s7_message.c
index 34797d6..e8b72a9 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_message.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_message.c
@@ -27,13 +27,13 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_s7_message_discriminator plc4c_s7_read_write_s7_message_discriminators[] = {
- {/* s7_read_write_s7_message_request */
+ {/* plc4c_s7_read_write_s7_message_request */
.messageType = 0x01},
- {/* s7_read_write_s7_message_response */
+ {/* plc4c_s7_read_write_s7_message_response */
.messageType = 0x02},
- {/* s7_read_write_s7_message_response_data */
+ {/* plc4c_s7_read_write_s7_message_response_data */
.messageType = 0x03},
- {/* s7_read_write_s7_message_user_data */
+ {/* plc4c_s7_read_write_s7_message_user_data */
.messageType = 0x07}
};
@@ -56,18 +56,18 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
// Const Field (protocolId)
uint8_t protocolId = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &protocolId);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &protocolId);
if(_res != OK) {
return _res;
}
- if(protocolId != S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID) {
+ if(protocolId != PLC4C_S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID) {
return PARSE_ERROR;
- // throw new ParseException("Expected constant value " + S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID + " but got " + protocolId);
+ // throw new ParseException("Expected constant value " + PLC4C_S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID + " but got " + protocolId);
}
// Discriminator Field (messageType) (Used as input to a switch field)
uint8_t messageType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &messageType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &messageType);
if(_res != OK) {
return _res;
}
@@ -75,7 +75,7 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
// Reserved Field (Compartmentalized so the "reserved" variable can't leak)
{
uint16_t _reserved = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) _reserved);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &_reserved);
if(_res != OK) {
return _res;
}
@@ -86,7 +86,7 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
// Simple Field (tpduReference)
uint16_t tpduReference = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &tpduReference);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &tpduReference);
if(_res != OK) {
return _res;
}
@@ -94,28 +94,28 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
// Implicit Field (parameterLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t parameterLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) ¶meterLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) ¶meterLength);
if(_res != OK) {
return _res;
}
// Implicit Field (payloadLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t payloadLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &payloadLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &payloadLength);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(messageType == 0x01) { /* S7MessageRequest */
- (*_message)->_type = plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_request;
+ (*_message)->_type = plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_request;
} else
if(messageType == 0x02) { /* S7MessageResponse */
- (*_message)->_type = plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response;
+ (*_message)->_type = plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response;
// Simple Field (errorClass)
uint8_t errorClass = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &errorClass);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &errorClass);
if(_res != OK) {
return _res;
}
@@ -125,7 +125,7 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
// Simple Field (errorCode)
uint8_t errorCode = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &errorCode);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &errorCode);
if(_res != OK) {
return _res;
}
@@ -133,11 +133,11 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
} else
if(messageType == 0x03) { /* S7MessageResponseData */
- (*_message)->_type = plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response_data;
+ (*_message)->_type = plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response_data;
// Simple Field (errorClass)
uint8_t errorClass = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &errorClass);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &errorClass);
if(_res != OK) {
return _res;
}
@@ -147,7 +147,7 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
// Simple Field (errorCode)
uint8_t errorCode = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &errorCode);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &errorCode);
if(_res != OK) {
return _res;
}
@@ -155,7 +155,7 @@ plc4c_return_code plc4c_s7_read_write_s7_message_parse(plc4c_spi_read_buffer* bu
} else
if(messageType == 0x07) { /* S7MessageUserData */
- (*_message)->_type = plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_user_data;
+ (*_message)->_type = plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_user_data;
}
// Optional Field (parameter) (Can be skipped, if a given expression evaluates to false)
@@ -193,74 +193,74 @@ plc4c_return_code plc4c_s7_read_write_s7_message_serialize(plc4c_spi_write_buffe
plc4c_return_code _res = OK;
// Const Field (protocolId)
- plc4c_spi_write_unsigned_short(buf, 8, S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID);
+ plc4c_spi_write_unsigned_byte(buf, 8, PLC4C_S7_READ_WRITE_S7_MESSAGE_PROTOCOL_ID);
// Discriminator Field (messageType)
- plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_message_get_discriminator(_message->_type).messageType);
+ plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_s7_message_get_discriminator(_message->_type).messageType);
// Reserved Field
- _res = plc4c_spi_write_unsigned_int(buf, 16, 0x0000);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, 0x0000);
if(_res != OK) {
return _res;
}
// Simple Field (tpduReference)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->tpdu_reference);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->tpdu_reference);
if(_res != OK) {
return _res;
}
// Implicit Field (parameterLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (((_message->parameter) != (NULL)) ? plc4c_s7_read_write_s7_parameter_length_in_bytes(_message->parameter) : 0));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (((_message->parameter) != (NULL)) ? plc4c_s7_read_write_s7_parameter_length_in_bytes(_message->parameter) : 0));
if(_res != OK) {
return _res;
}
// Implicit Field (payloadLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (((_message->payload) != (NULL)) ? plc4c_s7_read_write_s7_payload_length_in_bytes(_message->payload) : 0));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (((_message->payload) != (NULL)) ? plc4c_s7_read_write_s7_payload_length_in_bytes(_message->payload) : 0));
if(_res != OK) {
return _res;
}
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_request: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_request: {
break;
}
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response: {
// Simple Field (errorClass)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_message_response_error_class);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_message_response_error_class);
if(_res != OK) {
return _res;
}
// Simple Field (errorCode)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_message_response_error_code);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_message_response_error_code);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response_data: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response_data: {
// Simple Field (errorClass)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_message_response_data_error_class);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_message_response_data_error_class);
if(_res != OK) {
return _res;
}
// Simple Field (errorCode)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_message_response_data_error_code);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_message_response_data_error_code);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_user_data: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_user_data: {
break;
}
@@ -312,11 +312,11 @@ uint8_t plc4c_s7_read_write_s7_message_length_in_bits(plc4c_s7_read_write_s7_mes
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_request: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_request: {
break;
}
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response: {
// Simple field (errorClass)
lengthInBits += 8;
@@ -327,7 +327,7 @@ uint8_t plc4c_s7_read_write_s7_message_length_in_bits(plc4c_s7_read_write_s7_mes
break;
}
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_response_data: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_response_data: {
// Simple field (errorClass)
lengthInBits += 8;
@@ -338,7 +338,7 @@ uint8_t plc4c_s7_read_write_s7_message_length_in_bits(plc4c_s7_read_write_s7_mes
break;
}
- case plc4c_s7_read_write_s7_message_type_s7_read_write_s7_message_user_data: {
+ case plc4c_s7_read_write_s7_message_type_plc4c_s7_read_write_s7_message_user_data: {
break;
}
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c b/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
index 059dea8..9c550b1 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_parameter.c
@@ -27,17 +27,17 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_s7_parameter_discriminator plc4c_s7_read_write_s7_parameter_discriminators[] = {
- {/* s7_read_write_s7_parameter_read_var_request */
+ {/* plc4c_s7_read_write_s7_parameter_read_var_request */
.parameterType = 0x04, .messageType = 0x01},
- {/* s7_read_write_s7_parameter_read_var_response */
+ {/* plc4c_s7_read_write_s7_parameter_read_var_response */
.parameterType = 0x04, .messageType = 0x03},
- {/* s7_read_write_s7_parameter_setup_communication */
+ {/* plc4c_s7_read_write_s7_parameter_setup_communication */
.parameterType = 0xF0, .messageType = -1},
- {/* s7_read_write_s7_parameter_user_data */
+ {/* plc4c_s7_read_write_s7_parameter_user_data */
.parameterType = 0x00, .messageType = 0x07},
- {/* s7_read_write_s7_parameter_write_var_request */
+ {/* plc4c_s7_read_write_s7_parameter_write_var_request */
.parameterType = 0x05, .messageType = 0x01},
- {/* s7_read_write_s7_parameter_write_var_response */
+ {/* plc4c_s7_read_write_s7_parameter_write_var_response */
.parameterType = 0x05, .messageType = 0x03}
};
@@ -60,19 +60,19 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
// Discriminator Field (parameterType) (Used as input to a switch field)
uint8_t parameterType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) ¶meterType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) ¶meterType);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(parameterType == 0xF0) { /* S7ParameterSetupCommunication */
- (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_setup_communication;
+ (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_setup_communication;
// Reserved Field (Compartmentalized so the "reserved" variable can't leak)
{
uint8_t _reserved = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) _reserved);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &_reserved);
if(_res != OK) {
return _res;
}
@@ -85,7 +85,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
// Simple Field (maxAmqCaller)
uint16_t maxAmqCaller = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &maxAmqCaller);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &maxAmqCaller);
if(_res != OK) {
return _res;
}
@@ -95,7 +95,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
// Simple Field (maxAmqCallee)
uint16_t maxAmqCallee = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &maxAmqCallee);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &maxAmqCallee);
if(_res != OK) {
return _res;
}
@@ -105,7 +105,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
// Simple Field (pduLength)
uint16_t pduLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &pduLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &pduLength);
if(_res != OK) {
return _res;
}
@@ -113,11 +113,11 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
} else
if((parameterType == 0x04) && (messageType == 0x01)) { /* S7ParameterReadVarRequest */
- (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_request;
+ (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_request;
// Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t numItems = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &numItems);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &numItems);
if(_res != OK) {
return _res;
}
@@ -146,11 +146,11 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
} else
if((parameterType == 0x04) && (messageType == 0x03)) { /* S7ParameterReadVarResponse */
- (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_response;
+ (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_response;
// Simple Field (numItems)
uint8_t numItems = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &numItems);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &numItems);
if(_res != OK) {
return _res;
}
@@ -158,11 +158,11 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
} else
if((parameterType == 0x05) && (messageType == 0x01)) { /* S7ParameterWriteVarRequest */
- (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_request;
+ (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_request;
// Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t numItems = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &numItems);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &numItems);
if(_res != OK) {
return _res;
}
@@ -191,11 +191,11 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
} else
if((parameterType == 0x05) && (messageType == 0x03)) { /* S7ParameterWriteVarResponse */
- (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_response;
+ (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_response;
// Simple Field (numItems)
uint8_t numItems = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &numItems);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &numItems);
if(_res != OK) {
return _res;
}
@@ -203,11 +203,11 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_parse(plc4c_spi_read_buffer*
} else
if((parameterType == 0x00) && (messageType == 0x07)) { /* S7ParameterUserData */
- (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_user_data;
+ (*_message)->_type = plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_user_data;
// Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t numItems = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &numItems);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &numItems);
if(_res != OK) {
return _res;
}
@@ -243,42 +243,42 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_serialize(plc4c_spi_write_buf
plc4c_return_code _res = OK;
// Discriminator Field (parameterType)
- plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_parameter_get_discriminator(_message->_type).parameterType);
+ plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_s7_parameter_get_discriminator(_message->_type).parameterType);
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_setup_communication: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_setup_communication: {
// Reserved Field
- _res = plc4c_spi_write_unsigned_short(buf, 8, 0x00);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, 0x00);
if(_res != OK) {
return _res;
}
// Simple Field (maxAmqCaller)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->s7_parameter_setup_communication_max_amq_caller);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->s7_parameter_setup_communication_max_amq_caller);
if(_res != OK) {
return _res;
}
// Simple Field (maxAmqCallee)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->s7_parameter_setup_communication_max_amq_callee);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->s7_parameter_setup_communication_max_amq_callee);
if(_res != OK) {
return _res;
}
// Simple Field (pduLength)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->s7_parameter_setup_communication_pdu_length);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->s7_parameter_setup_communication_pdu_length);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_request: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_request: {
// Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_read_var_request_items));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_read_var_request_items));
if(_res != OK) {
return _res;
}
@@ -289,7 +289,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_serialize(plc4c_spi_write_buf
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_s7_var_request_parameter_item* _value = (plc4c_s7_read_write_s7_var_request_parameter_item*) plc4c_utils_list_get_value(_message->s7_parameter_read_var_request_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_serialize(buf, (void*) &_value);
+ _res = plc4c_s7_read_write_s7_var_request_parameter_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -298,20 +298,20 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_serialize(plc4c_spi_write_buf
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_response: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_response: {
// Simple Field (numItems)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_parameter_read_var_response_num_items);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_parameter_read_var_response_num_items);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_request: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_request: {
// Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_write_var_request_items));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_write_var_request_items));
if(_res != OK) {
return _res;
}
@@ -322,7 +322,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_serialize(plc4c_spi_write_buf
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_s7_var_request_parameter_item* _value = (plc4c_s7_read_write_s7_var_request_parameter_item*) plc4c_utils_list_get_value(_message->s7_parameter_write_var_request_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_request_parameter_item_serialize(buf, (void*) &_value);
+ _res = plc4c_s7_read_write_s7_var_request_parameter_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -331,20 +331,20 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_serialize(plc4c_spi_write_buf
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_response: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_response: {
// Simple Field (numItems)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_parameter_write_var_response_num_items);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_parameter_write_var_response_num_items);
if(_res != OK) {
return _res;
}
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_user_data: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_user_data: {
// Implicit Field (numItems) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_user_data_items));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_spi_evaluation_helper_count(_message->s7_parameter_user_data_items));
if(_res != OK) {
return _res;
}
@@ -355,7 +355,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_serialize(plc4c_spi_write_buf
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_s7_parameter_user_data_item* _value = (plc4c_s7_read_write_s7_parameter_user_data_item*) plc4c_utils_list_get_value(_message->s7_parameter_user_data_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_s7_parameter_user_data_item_serialize(buf, (void*) &_value);
+ _res = plc4c_s7_read_write_s7_parameter_user_data_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -381,7 +381,7 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_setup_communication: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_setup_communication: {
// Reserved Field (reserved)
lengthInBits += 8;
@@ -400,7 +400,7 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_request: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_request: {
// Implicit Field (numItems)
lengthInBits += 8;
@@ -417,14 +417,14 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_read_var_response: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_read_var_response: {
// Simple field (numItems)
lengthInBits += 8;
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_request: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_request: {
// Implicit Field (numItems)
lengthInBits += 8;
@@ -441,14 +441,14 @@ uint8_t plc4c_s7_read_write_s7_parameter_length_in_bits(plc4c_s7_read_write_s7_p
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_write_var_response: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_write_var_response: {
// Simple field (numItems)
lengthInBits += 8;
break;
}
- case plc4c_s7_read_write_s7_parameter_type_s7_read_write_s7_parameter_user_data: {
+ case plc4c_s7_read_write_s7_parameter_type_plc4c_s7_read_write_s7_parameter_user_data: {
// Implicit Field (numItems)
lengthInBits += 8;
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 0577ef6..6ccf826 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
@@ -27,7 +27,7 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_s7_parameter_user_data_item_discriminator plc4c_s7_read_write_s7_parameter_user_data_item_discriminators[] = {
- {/* s7_read_write_s7_parameter_user_data_item_cpu_functions */
+ {/* plc4c_s7_read_write_s7_parameter_user_data_item_cpu_functions */
.itemType = 0x12}
};
@@ -50,18 +50,18 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
// Discriminator Field (itemType) (Used as input to a switch field)
uint8_t itemType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &itemType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &itemType);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(itemType == 0x12) { /* S7ParameterUserDataItemCPUFunctions */
- (*_message)->_type = plc4c_s7_read_write_s7_parameter_user_data_item_type_s7_read_write_s7_parameter_user_data_item_cpu_functions;
+ (*_message)->_type = plc4c_s7_read_write_s7_parameter_user_data_item_type_plc4c_s7_read_write_s7_parameter_user_data_item_cpu_functions;
// Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t itemLength = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &itemLength);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &itemLength);
if(_res != OK) {
return _res;
}
@@ -70,7 +70,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
// Simple Field (method)
uint8_t method = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &method);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &method);
if(_res != OK) {
return _res;
}
@@ -100,7 +100,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
// Simple Field (cpuSubfunction)
uint8_t cpuSubfunction = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &cpuSubfunction);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &cpuSubfunction);
if(_res != OK) {
return _res;
}
@@ -110,7 +110,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
// Simple Field (sequenceNumber)
uint8_t sequenceNumber = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &sequenceNumber);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &sequenceNumber);
if(_res != OK) {
return _res;
}
@@ -126,7 +126,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
return NO_MEMORY;
}
*dataUnitReferenceNumber = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &dataUnitReferenceNumber);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &dataUnitReferenceNumber);
if(_res != OK) {
return _res;
}
@@ -143,7 +143,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
return NO_MEMORY;
}
*lastDataUnit = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &lastDataUnit);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &lastDataUnit);
if(_res != OK) {
return _res;
}
@@ -160,7 +160,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_parse(plc4c_sp
return NO_MEMORY;
}
*errorCode = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &errorCode);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &errorCode);
if(_res != OK) {
return _res;
}
@@ -176,20 +176,20 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_serialize(plc4
plc4c_return_code _res = OK;
// Discriminator Field (itemType)
- plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_parameter_user_data_item_get_discriminator(_message->_type).itemType);
+ plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_s7_parameter_user_data_item_get_discriminator(_message->_type).itemType);
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_s7_parameter_user_data_item_type_s7_read_write_s7_parameter_user_data_item_cpu_functions: {
+ case plc4c_s7_read_write_s7_parameter_user_data_item_type_plc4c_s7_read_write_s7_parameter_user_data_item_cpu_functions: {
// Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, (plc4c_s7_read_write_s7_parameter_user_data_item_length_in_bytes(_message)) - (2));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, (plc4c_s7_read_write_s7_parameter_user_data_item_length_in_bytes(_message)) - (2));
if(_res != OK) {
return _res;
}
// Simple Field (method)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_method);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_method);
if(_res != OK) {
return _res;
}
@@ -207,20 +207,20 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_serialize(plc4
}
// Simple Field (cpuSubfunction)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_cpu_subfunction);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_cpu_subfunction);
if(_res != OK) {
return _res;
}
// Simple Field (sequenceNumber)
- _res = plc4c_spi_write_unsigned_short(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_sequence_number);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_sequence_number);
if(_res != OK) {
return _res;
}
// Optional Field (dataUnitReferenceNumber)
if(_message->s7_parameter_user_data_item_cpu_functions_data_unit_reference_number != NULL) {
- _res= plc4c_spi_write_unsigned_short(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_data_unit_reference_number);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, *_message->s7_parameter_user_data_item_cpu_functions_data_unit_reference_number);
if(_res != OK) {
return _res;
}
@@ -228,7 +228,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_serialize(plc4
// Optional Field (lastDataUnit)
if(_message->s7_parameter_user_data_item_cpu_functions_last_data_unit != NULL) {
- _res= plc4c_spi_write_unsigned_short(buf, 8, _message->s7_parameter_user_data_item_cpu_functions_last_data_unit);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, *_message->s7_parameter_user_data_item_cpu_functions_last_data_unit);
if(_res != OK) {
return _res;
}
@@ -236,7 +236,7 @@ plc4c_return_code plc4c_s7_read_write_s7_parameter_user_data_item_serialize(plc4
// Optional Field (errorCode)
if(_message->s7_parameter_user_data_item_cpu_functions_error_code != NULL) {
- _res= plc4c_spi_write_unsigned_int(buf, 16, _message->s7_parameter_user_data_item_cpu_functions_error_code);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, *_message->s7_parameter_user_data_item_cpu_functions_error_code);
if(_res != OK) {
return _res;
}
@@ -261,7 +261,7 @@ uint8_t plc4c_s7_read_write_s7_parameter_user_data_item_length_in_bits(plc4c_s7_
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_s7_parameter_user_data_item_type_s7_read_write_s7_parameter_user_data_item_cpu_functions: {
+ case plc4c_s7_read_write_s7_parameter_user_data_item_type_plc4c_s7_read_write_s7_parameter_user_data_item_cpu_functions: {
// Implicit Field (itemLength)
lengthInBits += 8;
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_payload.c b/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
index 80abe8d..c8909b7 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_payload.c
@@ -27,13 +27,13 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_s7_payload_discriminator plc4c_s7_read_write_s7_payload_discriminators[] = {
- {/* s7_read_write_s7_payload_read_var_response */
+ {/* plc4c_s7_read_write_s7_payload_read_var_response */
.parameterParameterType = 0x04, .messageType = 0x03},
- {/* s7_read_write_s7_payload_user_data */
+ {/* plc4c_s7_read_write_s7_payload_user_data */
.parameterParameterType = 0x00, .messageType = 0x07},
- {/* s7_read_write_s7_payload_write_var_request */
+ {/* plc4c_s7_read_write_s7_payload_write_var_request */
.parameterParameterType = 0x05, .messageType = 0x01},
- {/* s7_read_write_s7_payload_write_var_response */
+ {/* plc4c_s7_read_write_s7_payload_write_var_response */
.parameterParameterType = 0x05, .messageType = 0x03}
};
@@ -56,7 +56,7 @@ 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 */
- (*_message)->_type = plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_read_var_response;
+ (*_message)->_type = plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_read_var_response;
// Array field (items)
plc4c_list* items = malloc(sizeof(plc4c_list));
@@ -80,7 +80,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_parse(plc4c_spi_read_buffer* bu
} else
if((plc4c_s7_read_write_s7_parameter_get_discriminator(parameter->_type).parameterType == 0x05) && (messageType == 0x01)) { /* S7PayloadWriteVarRequest */
- (*_message)->_type = plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_request;
+ (*_message)->_type = plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_request;
// Array field (items)
plc4c_list* items = malloc(sizeof(plc4c_list));
@@ -104,7 +104,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_parse(plc4c_spi_read_buffer* bu
} else
if((plc4c_s7_read_write_s7_parameter_get_discriminator(parameter->_type).parameterType == 0x05) && (messageType == 0x03)) { /* S7PayloadWriteVarResponse */
- (*_message)->_type = plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_response;
+ (*_message)->_type = plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_response;
// Array field (items)
plc4c_list* items = malloc(sizeof(plc4c_list));
@@ -128,7 +128,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_parse(plc4c_spi_read_buffer* bu
} else
if((plc4c_s7_read_write_s7_parameter_get_discriminator(parameter->_type).parameterType == 0x00) && (messageType == 0x07)) { /* S7PayloadUserData */
- (*_message)->_type = plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_user_data;
+ (*_message)->_type = plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_user_data;
// Array field (items)
plc4c_list* items = malloc(sizeof(plc4c_list));
@@ -160,7 +160,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_read_var_response: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_read_var_response: {
// Array field (items)
{
@@ -168,7 +168,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_s7_var_payload_data_item* _value = (plc4c_s7_read_write_s7_var_payload_data_item*) plc4c_utils_list_get_value(_message->s7_payload_read_var_response_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_serialize(buf, (void*) &_value, lastItem);
+ _res = plc4c_s7_read_write_s7_var_payload_data_item_serialize(buf, (void*) &_value, lastItem);
if(_res != OK) {
return _res;
}
@@ -177,7 +177,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
break;
}
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_request: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_request: {
// Array field (items)
{
@@ -185,7 +185,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_s7_var_payload_data_item* _value = (plc4c_s7_read_write_s7_var_payload_data_item*) plc4c_utils_list_get_value(_message->s7_payload_write_var_request_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_data_item_serialize(buf, (void*) &_value, lastItem);
+ _res = plc4c_s7_read_write_s7_var_payload_data_item_serialize(buf, (void*) &_value, lastItem);
if(_res != OK) {
return _res;
}
@@ -194,7 +194,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
break;
}
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_response: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_response: {
// Array field (items)
{
@@ -202,7 +202,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_s7_var_payload_status_item* _value = (plc4c_s7_read_write_s7_var_payload_status_item*) plc4c_utils_list_get_value(_message->s7_payload_write_var_response_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_s7_var_payload_status_item_serialize(buf, (void*) &_value);
+ _res = plc4c_s7_read_write_s7_var_payload_status_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -211,7 +211,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
break;
}
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_user_data: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_user_data: {
// Array field (items)
{
@@ -219,7 +219,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_serialize(plc4c_spi_write_buffe
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_s7_payload_user_data_item* _value = (plc4c_s7_read_write_s7_payload_user_data_item*) plc4c_utils_list_get_value(_message->s7_payload_user_data_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_s7_payload_user_data_item_serialize(buf, (void*) &_value);
+ _res = plc4c_s7_read_write_s7_payload_user_data_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -242,7 +242,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_read_var_response: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_read_var_response: {
// Array field
if(_message->s7_payload_read_var_response_items != NULL) {
@@ -255,7 +255,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
break;
}
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_request: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_request: {
// Array field
if(_message->s7_payload_write_var_request_items != NULL) {
@@ -268,7 +268,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
break;
}
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_write_var_response: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_write_var_response: {
// Array field
if(_message->s7_payload_write_var_response_items != NULL) {
@@ -281,7 +281,7 @@ uint8_t plc4c_s7_read_write_s7_payload_length_in_bits(plc4c_s7_read_write_s7_pay
break;
}
- case plc4c_s7_read_write_s7_payload_type_s7_read_write_s7_payload_user_data: {
+ case plc4c_s7_read_write_s7_payload_type_plc4c_s7_read_write_s7_payload_user_data: {
// Array field
if(_message->s7_payload_user_data_items != NULL) {
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 408aab0..ae45b28 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
@@ -27,9 +27,9 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_s7_payload_user_data_item_discriminator plc4c_s7_read_write_s7_payload_user_data_item_discriminators[] = {
- {/* s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request */
+ {/* plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request */
.cpuFunctionType = 0x04},
- {/* s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response */
+ {/* plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response */
.cpuFunctionType = 0x08}
};
@@ -68,7 +68,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_parse(plc4c_spi_
// Implicit Field (dataLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t dataLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &dataLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &dataLength);
if(_res != OK) {
return _res;
}
@@ -83,7 +83,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_parse(plc4c_spi_
// Simple Field (szlIndex)
uint16_t szlIndex = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &szlIndex);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &szlIndex);
if(_res != OK) {
return _res;
}
@@ -91,27 +91,27 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_parse(plc4c_spi_
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(cpuFunctionType == 0x04) { /* S7PayloadUserDataItemCpuFunctionReadSzlRequest */
- (*_message)->_type = plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request;
+ (*_message)->_type = plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request;
} else
if(cpuFunctionType == 0x08) { /* S7PayloadUserDataItemCpuFunctionReadSzlResponse */
- (*_message)->_type = plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response;
+ (*_message)->_type = plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response;
// Const Field (szlItemLength)
uint16_t szlItemLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &szlItemLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &szlItemLength);
if(_res != OK) {
return _res;
}
- if(szlItemLength != S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH) {
+ if(szlItemLength != PLC4C_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);
+ // throw new ParseException("Expected constant value " + PLC4C_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 = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &szlItemCount);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &szlItemCount);
if(_res != OK) {
return _res;
}
@@ -159,7 +159,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_serialize(plc4c_
}
// Implicit Field (dataLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (plc4c_s7_read_write_s7_payload_user_data_item_length_in_bytes(_message)) - (4));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (plc4c_s7_read_write_s7_payload_user_data_item_length_in_bytes(_message)) - (4));
if(_res != OK) {
return _res;
}
@@ -171,24 +171,24 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_serialize(plc4c_
}
// Simple Field (szlIndex)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->szl_index);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->szl_index);
if(_res != OK) {
return _res;
}
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request: {
+ case plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request: {
break;
}
- case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response: {
+ case plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response: {
// Const Field (szlItemLength)
- plc4c_spi_write_unsigned_int(buf, 16, S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH);
+ plc4c_spi_write_unsigned_short(buf, 16, PLC4C_S7_READ_WRITE_S7_PAYLOAD_USER_DATA_ITEM_CPU_FUNCTION_READ_SZL_RESPONSE_SZL_ITEM_LENGTH);
// Implicit Field (szlItemCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, plc4c_spi_evaluation_helper_count(_message->s7_payload_user_data_item_cpu_function_read_szl_response_items));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, plc4c_spi_evaluation_helper_count(_message->s7_payload_user_data_item_cpu_function_read_szl_response_items));
if(_res != OK) {
return _res;
}
@@ -199,7 +199,7 @@ plc4c_return_code plc4c_s7_read_write_s7_payload_user_data_item_serialize(plc4c_
for(int curItem = 0; curItem < itemCount; curItem++) {
bool lastItem = curItem == (itemCount - 1);
plc4c_s7_read_write_szl_data_tree_item* _value = (plc4c_s7_read_write_szl_data_tree_item*) plc4c_utils_list_get_value(_message->s7_payload_user_data_item_cpu_function_read_szl_response_items, curItem);
- plc4c_return_code _res = plc4c_s7_read_write_szl_data_tree_item_serialize(buf, (void*) &_value);
+ _res = plc4c_s7_read_write_szl_data_tree_item_serialize(buf, (void*) &_value);
if(_res != OK) {
return _res;
}
@@ -237,11 +237,11 @@ uint8_t plc4c_s7_read_write_s7_payload_user_data_item_length_in_bits(plc4c_s7_re
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request: {
+ case plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_request: {
break;
}
- case plc4c_s7_read_write_s7_payload_user_data_item_type_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response: {
+ case plc4c_s7_read_write_s7_payload_user_data_item_type_plc4c_s7_read_write_s7_payload_user_data_item_cpu_function_read_szl_response: {
// Const Field (szlItemLength)
lengthInBits += 16;
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 8ffde19..c7f6102 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
@@ -53,7 +53,7 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_parse(plc4c_spi_r
// Simple Field (dataLength)
uint16_t dataLength = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &dataLength);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &dataLength);
if(_res != OK) {
return _res;
}
@@ -86,7 +86,7 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_parse(plc4c_spi_r
if(_needsPadding) {
// Just read the padding data and ignore it
uint8_t _paddingValue = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &_paddingValue);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &_paddingValue);
if(_res != OK) {
return _res;
}
@@ -112,7 +112,7 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_serialize(plc4c_s
}
// Simple Field (dataLength)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->data_length);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->data_length);
if(_res != OK) {
return _res;
}
@@ -132,7 +132,7 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_serialize(plc4c_s
bool _needsPadding = (bool) ((!(lastItem)) && (((((plc4c_spi_evaluation_helper_count(_message->data)) % (2))) == (1))));
if(_needsPadding) {
// Just output the default padding data
- _res = plc4c_spi_write_unsigned_short(buf, 8, 0);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, 0);
if(_res != OK) {
return _res;
}
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 69418de..d86aea2 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
@@ -27,7 +27,7 @@
// (The order is identical to the enum constants so we can use the
// enum constant to directly access a given types discriminator values)
const plc4c_s7_read_write_s7_var_request_parameter_item_discriminator plc4c_s7_read_write_s7_var_request_parameter_item_discriminators[] = {
- {/* s7_read_write_s7_var_request_parameter_item_address */
+ {/* plc4c_s7_read_write_s7_var_request_parameter_item_address */
.itemType = 0x12}
};
@@ -50,18 +50,18 @@ plc4c_return_code plc4c_s7_read_write_s7_var_request_parameter_item_parse(plc4c_
// Discriminator Field (itemType) (Used as input to a switch field)
uint8_t itemType = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &itemType);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &itemType);
if(_res != OK) {
return _res;
}
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
if(itemType == 0x12) { /* S7VarRequestParameterItemAddress */
- (*_message)->_type = plc4c_s7_read_write_s7_var_request_parameter_item_type_s7_read_write_s7_var_request_parameter_item_address;
+ (*_message)->_type = plc4c_s7_read_write_s7_var_request_parameter_item_type_plc4c_s7_read_write_s7_var_request_parameter_item_address;
// Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint8_t itemLength = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &itemLength);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &itemLength);
if(_res != OK) {
return _res;
}
@@ -85,14 +85,14 @@ plc4c_return_code plc4c_s7_read_write_s7_var_request_parameter_item_serialize(pl
plc4c_return_code _res = OK;
// Discriminator Field (itemType)
- plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_var_request_parameter_item_get_discriminator(_message->_type).itemType);
+ plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_s7_var_request_parameter_item_get_discriminator(_message->_type).itemType);
// Switch Field (Depending of the current type, serialize the sub-type elements)
switch(_message->_type) {
- case plc4c_s7_read_write_s7_var_request_parameter_item_type_s7_read_write_s7_var_request_parameter_item_address: {
+ case plc4c_s7_read_write_s7_var_request_parameter_item_type_plc4c_s7_read_write_s7_var_request_parameter_item_address: {
// Implicit Field (itemLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_short(buf, 8, plc4c_s7_read_write_s7_address_length_in_bytes(_message->s7_var_request_parameter_item_address_address));
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, plc4c_s7_read_write_s7_address_length_in_bytes(_message->s7_var_request_parameter_item_address_address));
if(_res != OK) {
return _res;
}
@@ -122,7 +122,7 @@ uint8_t plc4c_s7_read_write_s7_var_request_parameter_item_length_in_bits(plc4c_s
// Depending of the current type, add the length of sub-type elements ...
switch(_message->_type) {
- case plc4c_s7_read_write_s7_var_request_parameter_item_type_s7_read_write_s7_var_request_parameter_item_address: {
+ case plc4c_s7_read_write_s7_var_request_parameter_item_type_plc4c_s7_read_write_s7_var_request_parameter_item_address: {
// Implicit Field (itemLength)
lengthInBits += 8;
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 4c8c549..c9ab19d 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
@@ -37,7 +37,7 @@ plc4c_return_code plc4c_s7_read_write_szl_data_tree_item_parse(plc4c_spi_read_bu
// Simple Field (itemIndex)
uint16_t itemIndex = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &itemIndex);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &itemIndex);
if(_res != OK) {
return _res;
}
@@ -66,7 +66,7 @@ plc4c_return_code plc4c_s7_read_write_szl_data_tree_item_parse(plc4c_spi_read_bu
// Simple Field (moduleTypeId)
uint16_t moduleTypeId = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &moduleTypeId);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &moduleTypeId);
if(_res != OK) {
return _res;
}
@@ -74,7 +74,7 @@ plc4c_return_code plc4c_s7_read_write_szl_data_tree_item_parse(plc4c_spi_read_bu
// Simple Field (ausbg)
uint16_t ausbg = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &ausbg);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &ausbg);
if(_res != OK) {
return _res;
}
@@ -82,7 +82,7 @@ plc4c_return_code plc4c_s7_read_write_szl_data_tree_item_parse(plc4c_spi_read_bu
// Simple Field (ausbe)
uint16_t ausbe = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &ausbe);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &ausbe);
if(_res != OK) {
return _res;
}
@@ -95,7 +95,7 @@ plc4c_return_code plc4c_s7_read_write_szl_data_tree_item_serialize(plc4c_spi_wri
plc4c_return_code _res = OK;
// Simple Field (itemIndex)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->item_index);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->item_index);
if(_res != OK) {
return _res;
}
@@ -111,19 +111,19 @@ plc4c_return_code plc4c_s7_read_write_szl_data_tree_item_serialize(plc4c_spi_wri
}
// Simple Field (moduleTypeId)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->module_type_id);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->module_type_id);
if(_res != OK) {
return _res;
}
// Simple Field (ausbg)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->ausbg);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->ausbg);
if(_res != OK) {
return _res;
}
// Simple Field (ausbe)
- _res = plc4c_spi_write_unsigned_int(buf, 16, _message->ausbe);
+ _res = plc4c_spi_write_unsigned_short(buf, 16, _message->ausbe);
if(_res != OK) {
return _res;
}
diff --git a/sandbox/plc4c/generated-sources/s7/src/tpkt_packet.c b/sandbox/plc4c/generated-sources/s7/src/tpkt_packet.c
index 2fdffbd..8733595 100644
--- a/sandbox/plc4c/generated-sources/s7/src/tpkt_packet.c
+++ b/sandbox/plc4c/generated-sources/s7/src/tpkt_packet.c
@@ -37,19 +37,19 @@ plc4c_return_code plc4c_s7_read_write_tpkt_packet_parse(plc4c_spi_read_buffer* b
// Const Field (protocolId)
uint8_t protocolId = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) &protocolId);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &protocolId);
if(_res != OK) {
return _res;
}
- if(protocolId != S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID) {
+ if(protocolId != PLC4C_S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID) {
return PARSE_ERROR;
- // throw new ParseException("Expected constant value " + S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID + " but got " + protocolId);
+ // throw new ParseException("Expected constant value " + PLC4C_S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID + " but got " + protocolId);
}
// Reserved Field (Compartmentalized so the "reserved" variable can't leak)
{
uint8_t _reserved = 0;
- _res = plc4c_spi_read_unsigned_short(buf, 8, (uint16_t*) _reserved);
+ _res = plc4c_spi_read_unsigned_byte(buf, 8, (uint8_t*) &_reserved);
if(_res != OK) {
return _res;
}
@@ -60,7 +60,7 @@ plc4c_return_code plc4c_s7_read_write_tpkt_packet_parse(plc4c_spi_read_buffer* b
// Implicit Field (len) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
uint16_t len = 0;
- _res = plc4c_spi_read_unsigned_int(buf, 16, (uint32_t*) &len);
+ _res = plc4c_spi_read_unsigned_short(buf, 16, (uint16_t*) &len);
if(_res != OK) {
return _res;
}
@@ -80,16 +80,16 @@ plc4c_return_code plc4c_s7_read_write_tpkt_packet_serialize(plc4c_spi_write_buff
plc4c_return_code _res = OK;
// Const Field (protocolId)
- plc4c_spi_write_unsigned_short(buf, 8, S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID);
+ plc4c_spi_write_unsigned_byte(buf, 8, PLC4C_S7_READ_WRITE_TPKT_PACKET_PROTOCOL_ID);
// Reserved Field
- _res = plc4c_spi_write_unsigned_short(buf, 8, 0x00);
+ _res = plc4c_spi_write_unsigned_byte(buf, 8, 0x00);
if(_res != OK) {
return _res;
}
// Implicit Field (len) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
- _res = plc4c_spi_write_unsigned_int(buf, 16, (plc4c_s7_read_write_cotp_packet_length_in_bytes(_message->payload)) + (4));
+ _res = plc4c_spi_write_unsigned_short(buf, 16, (plc4c_s7_read_write_cotp_packet_length_in_bytes(_message->payload)) + (4));
if(_res != OK) {
return _res;
}
diff --git a/sandbox/plc4c/spi/src/write_buffer.c b/sandbox/plc4c/spi/src/write_buffer.c
index 7fbbe4f..0abb80f 100644
--- a/sandbox/plc4c/spi/src/write_buffer.c
+++ b/sandbox/plc4c/spi/src/write_buffer.c
@@ -98,5 +98,5 @@ plc4c_return_code plc4c_spi_write_double(plc4c_spi_write_buffer* buf, uint8_t nu
* } */
plc4c_return_code plc4c_spi_write_string(plc4c_spi_write_buffer* buf, uint8_t num_bits, char* encoding, char* value) {
-
+ return OK;
}