Skip to content

Commit 699402c

Browse files
authored
Feature/cdutz/go ads ng (Streamlining of PLC4X API in PLC4Go and PLC4J) (apache#576)
refactor(api): Refactored the API to use the Term "Tag" instead of "Field" and streamlined the PLC4J and PLC4Go APIs * chore(protocols): Added a pointer to a possibly interesting protocol specification. - renamed the property "len" to "strLen" to avoid problems in Go * feat(ads): ADS Auto-Discovery First working version that correctly sends out the requests to all valid IPs and then correctly processes the responses * feat(ads): ADS Auto-Discovery - Switched to using a pre-allocated buffer * feat(ads): ADS Auto-Discovery - Made the buffer allocation actually work nicely. * feat(protocols): Added a pointer to a possibly interesting protocol specification. - Got the parsing of data-type and symbol-table working - Tweaked the way the endianess is handles. * refactor(api) PLC4J API refactoring - PlcBrowseItem's getChildren is now a Map - PlcBrowseRequest now has a executeWithInterceptor method - PlcBrowseResponse now supports multiple queries and therefore has: - a getQueryNames() method - the getResponseCode method was replaced with a getResponseCode(queryName) method - the getValues() method was replaced with a getValues(queryName) method - PlcField: - Removed the getDefaultJavaType() as PlcValueType provides this - replaced String getPlcDataType() with PlcValueType getPlcValueType() - replaced int getNumberOfElements() with List<ArrayInfo> getArrayInfo() - A new type PlcQuery for being the base of Browse queries - PlcValueType now provides a default java type for each constant Protocols: - Extended the data-types of the following protocols to allow mapping to the PlcValueTypes of the API module: - canopen - genericcan Adjusted the rest of the codebase accordingly. * refactor(api) PLC4Go API refactoring - Continued porting the PLC4Go API to be on par with the updated PLC4J API - Started porting most of the existing code, but espeically the Browse parts still need quite some work. * refactor(api) PLC4Go API refactoring - Finished implementing the multi-level-array-info-parsing * refactor(api) PLC4Go API refactoring - Continued cleaning up the code after the changes. * refactor(api) PLC4Go API refactoring - Continued cleaning up the code after the changes. * refactor(api) PLC4Go API refactoring - Continued cleaning up the code after the changes. * refactor(api) PLC4Go API refactoring - Finished cleaning the compilation up next will be getting the tests back green * refactor(api) PLC4Go API refactoring - Finished fixing the go tests. * fix(test) Not all tests are executed when enabling the "jenkins-build" or the "with-all-tests" profiles. - Got the "all-tests" profile working again. * fix(test) Not all tests are executed when enabling the "jenkins-build" or the "with-all-tests" profiles. - Got the RandomPackagesTest working again - Currently commented out the "0-termination" in the ReadBufferByteBased - Got the libpcapNg detection working on aarch64 mac * fix(test) Fix RandomPackagesTest - Changed the ReadBufferByteBased to react on a system property "disable-string-0-termination" to make it work with the 0-terminating byte-buffer. * fix(test) Fix RandomPackagesTest - Changed the ReadBufferByteBased to react on a system property "disable-string-0-termination" to make it work with the 0-terminating byte-buffer. * fix(test) Fix error in WriteBufferByteBased, which output the padding bytes before the string - * fix(test) Fix error in WriteBufferByteBased, which output the padding bytes before the string - Removed the disabling of 0-termination in the RandomPackageTest - Added some comments on the reading and writing of strings (expected format) * refactor(api) PLC4J API refactoring - Updated the builders to use the new addField and addFieldAddress naming * refactor(api) PLC4J API refactoring - Applied Sebasitan's feedback * refactor(api) PLC4J API refactoring - Applied Sebasitan's feedback * refactor(api) PLC4J API refactoring - Applied Sebasitan's feedback * refactor(api) PLC4J API refactoring - Renamed Field -> Tag in PLC4J * refactor(api) PLC4J API refactoring - Renamed Field -> Tag in PLC4J * refactor(api) PLC4J API refactoring - Renamed Field -> Tag in PLC4C * refactor(api) PLC4Go API refactoring - Updated generated code for PLC4Go * refactor(api) PLC4J API refactoring - Removed getPlcValueType and getArrayInfo from the PlcBrowseItem as this information is in the Tag - Removed the PlcBrowseItemArrayInfo type, as this is replaced by ArrayInfo * refactor(api) PLC4Go API refactoring - Continued the refactoring with PLC4Go * refactor(api) PLC4Go API refactoring - Continued the refactoring with PLC4Go
1 parent 807419e commit 699402c

File tree

3,000 files changed

+22410
-27715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,000 files changed

+22410
-27715
lines changed

Jenkinsfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pipeline {
3838
// Test failures will be handled by the jenkins junit steps and mark the build as unstable.
3939
MVN_TEST_FAIL_IGNORE = '-Dmaven.test.failure.ignore=true'
4040

41+
ENABLE_ALL_TESTS = true
42+
4143
SONARCLOUD_PARAMS = "-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_plc4x -Dsonar.branch.name=develop"
4244
}
4345

code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageTemplateHelper.java

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.apache.commons.lang3.StringUtils;
2222
import org.apache.commons.lang3.math.NumberUtils;
23+
import org.apache.commons.text.CaseUtils;
2324
import org.apache.plc4x.plugins.codegenerator.language.mspec.model.definitions.DefaultArgument;
2425
import org.apache.plc4x.plugins.codegenerator.language.mspec.model.references.DefaultBooleanTypeReference;
2526
import org.apache.plc4x.plugins.codegenerator.language.mspec.model.references.DefaultFloatTypeReference;
@@ -59,9 +60,18 @@ public String fileName(String protocolName, String languageName, String language
5960
String.join("", languageFlavorName.split("\\-"));
6061
}
6162

63+
public String getSanitizedPackageName() {
64+
String sanitizedName = getProtocolName().replaceAll("-", "");
65+
sanitizedName = sanitizedName.replaceAll("\\.", "/");
66+
sanitizedName = sanitizedName.toLowerCase();
67+
return sanitizedName;
68+
}
69+
6270
// TODO: check if protocol name can be enforced to only contain valid chars
6371
public String getSanitizedProtocolName() {
64-
return getProtocolName().replaceAll("-", "");
72+
String sanitizedName = getProtocolName().replaceAll("-", "");
73+
sanitizedName = CaseUtils.toCamelCase(sanitizedName, false, '.');
74+
return sanitizedName;
6575
}
6676

6777
public String packageName(String languageFlavorName) {
@@ -712,6 +722,10 @@ private String toLiteralTermExpression(Field field, TypeReference fieldType, Ter
712722
return tracer + "\"" + ((StringLiteral) term).getValue() + "\"";
713723
} else if (term instanceof VariableLiteral) {
714724
tracer = tracer.dive("variable literal instanceOf");
725+
VariableLiteral variableLiteral = (VariableLiteral) term;
726+
if ("curPos".equals(((VariableLiteral) term).getName())) {
727+
return "(positionAware.GetPos() - startPos)";
728+
}
715729
return tracer + toVariableExpression(field, fieldType, (VariableLiteral) term, parserArguments, serializerArguments, serialize, suppressPointerAccess);
716730
} else {
717731
throw new RuntimeException("Unsupported Literal type " + term.getClass().getName());
@@ -1540,4 +1554,21 @@ public String capitalize(String str) {
15401554
String cleanedString = dummyTracer.removeTraces(str);
15411555
return extractedTrace + StringUtils.capitalize(cleanedString);
15421556
}
1557+
1558+
public String getEndiannessOptions(boolean read, boolean separatorPrefix) {
1559+
Optional<Term> byteOrder = thisType.getAttribute("byteOrder");
1560+
if (byteOrder.isPresent()) {
1561+
emitRequiredImport("encoding/binary");
1562+
1563+
String functionName = read ? "WithByteOrderForReadBufferByteBased" : "WithByteOrderForByteBasedBuffer";
1564+
String byteOrderValue = ((VariableLiteral) byteOrder.get()).getName();
1565+
if("BIG_ENDIAN".equals(byteOrderValue)) {
1566+
return (separatorPrefix ? ", " : "") + "utils." + functionName + "(binary.BigEndian)";
1567+
} else if ("LITTLE_ENDIAN".equals(byteOrderValue)) {
1568+
return (separatorPrefix ? ", " : "") + "utils." + functionName + "(binary.LittleEndian)";
1569+
}
1570+
}
1571+
return "";
1572+
}
1573+
15431574
}

code-generation/language-go/src/main/resources/templates/go/complex-type-template.go.ftlh

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ func (m *_${type.name}) GetLengthInBytes() uint16 {
747747
<#assign parserArgumentList><#if hasParserArguments><#list parserArguments as parserArgument>${parserArgument.name} ${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#sep>, </#sep></#list></#if></#assign>
748748
<#assign parserArgumentNameList><#if hasParserArguments><#list parserArguments as parserArgument>${parserArgument.name}<#sep>, </#sep></#list></#if></#assign>
749749
func ${type.name}Parse(theBytes []byte<#if hasParserArguments>, ${parserArgumentList}</#if>) (${type.name}, error) {
750-
return ${type.name}ParseWithBuffer(utils.NewReadBufferByteBased(theBytes, utils.WithByteOrderForReadBufferByteBased(binary.BigEndian))<#if hasParserArguments>, ${parserArgumentNameList}</#if>) <@emitImport import="encoding/binary" /> // TODO: get endianness from mspec
750+
return ${type.name}ParseWithBuffer(utils.NewReadBufferByteBased(theBytes${helper.getEndiannessOptions(true, true)})<#if hasParserArguments>, ${parserArgumentNameList}</#if>)
751751
}
752752

753753
func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArguments>, ${parserArgumentList}</#if>) (${type.name}, error) {
@@ -762,9 +762,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
762762
var startPos = positionAware.GetPos()
763763
_ = startPos
764764
</#if>
765-
<#if helper.requiresCurPos()>
766-
var curPos uint16
767-
</#if>
768765
<#assign reservedFieldIndex=0>
769766
<#list type.fields as field>
770767
<#switch field.typeName>
@@ -799,10 +796,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
799796
if pullErr := readBuffer.PullContext("${arrayField.name}", utils.WithRenderAsList(true)); pullErr != nil {
800797
return nil, errors.Wrap(pullErr, "Error pulling for ${arrayField.name}")<@emitImport import="github.com/pkg/errors" />
801798
}
802-
<#-- Only update curPos if the length expression uses it -->
803-
<#if arrayField.loopExpression.contains("curPos")>
804-
curPos = positionAware.GetPos() - startPos
805-
</#if>
806799
<#-- If this is a count array, we can directly initialize an array with the given size -->
807800
<#if field.isCountArrayField()>
808801
// Count array
@@ -897,10 +890,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
897890
<#else>
898891
${arrayField.name} = append(${arrayField.name}, _item.(${arrayElementType.asComplexTypeReference().orElseThrow().name}))
899892
</#if>
900-
<#-- After parsing, update the current position, but only if it's needed -->
901-
<#if arrayField.loopExpression.contains("curPos")>
902-
curPos = positionAware.GetPos() - startPos
903-
</#if>
904893
}
905894
}
906895
<#-- A terminated array keeps on reading data as long as the termination expression evaluates to false -->
@@ -943,11 +932,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
943932
<#else>
944933
${arrayField.name} = append(${arrayField.name}, _item.(${arrayElementType.asComplexTypeReference().orElseThrow().name}))
945934
</#if>
946-
947-
<#-- After parsing, update the current position, but only if it's needed -->
948-
<#if arrayField.loopExpression.contains("curPos")>
949-
curPos = positionAware.GetPos() - startPos
950-
</#if>
951935
}
952936
}
953937
</#if>
@@ -1066,10 +1050,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
10661050
return nil, errors.Wrap(pullErr, "Error pulling for ${manualArrayField.name}")<@emitImport import="github.com/pkg/errors" />
10671051
}
10681052
// Manual Array Field (${manualArrayField.name})
1069-
<#-- Only update curPos if the length expression uses it -->
1070-
<#if manualArrayField.loopExpression.contains("curPos")>
1071-
curPos = positionAware.GetPos() - startPos
1072-
</#if>
10731053
<#-- If this is a count array, we can directly initialize an array with the given size -->
10741054
<#if field.isCountArrayField()>
10751055
// Count array
@@ -1092,10 +1072,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
10921072
${manualArrayField.name}EndPos := positionAware.GetPos() + _${manualArrayField.name}Length
10931073
for ;positionAware.GetPos() < ${manualArrayField.name}EndPos; {
10941074
_${manualArrayField.name}List = append(_${manualArrayField.name}List, ((${helper.getLanguageTypeNameForField(field)}) (${helper.toParseExpression(manualArrayField, arrayElementType, manualArrayField.parseExpression, parserArguments)})))
1095-
<#-- After parsing, update the current position, but only if it's needed -->
1096-
<#if manualArrayField.loopExpression.contains("curPos")>
1097-
curPos = positionAware.GetPos() - startPos
1098-
</#if>
10991075
}
11001076
<#-- A terminated array keeps on reading data as long as the termination expression evaluates to false -->
11011077
<#elseif field.isTerminatedArrayField()>
@@ -1107,10 +1083,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
11071083
for ;!((bool) (${helper.toParseExpression(manualArrayField, helper.boolTypeReference, manualArrayField.loopExpression, parserArguments, true)})); {
11081084
_${manualArrayField.name}List = append(_${manualArrayField.name}List, ((${helper.getLanguageTypeNameForTypeReference(arrayElementType)}) (${helper.toParseExpression(manualArrayField, arrayElementType, manualArrayField.parseExpression, parserArguments)})))
11091085

1110-
<#-- After parsing, update the current position, but only if it's needed -->
1111-
<#if manualArrayField.loopExpression.contains("curPos")>
1112-
curPos = positionAware.GetPos() - startPos
1113-
</#if>
11141086
}
11151087
}
11161088
</#if>
@@ -1153,9 +1125,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
11531125
<#assign optionalField = field.asOptionalField().orElseThrow()>
11541126

11551127
// Optional Field (${optionalField.name}) (Can be skipped, if a given expression evaluates to false)
1156-
<#if optionalField.conditionExpression.present && optionalField.conditionExpression.get().contains("curPos")>
1157-
curPos = positionAware.GetPos() - startPos
1158-
</#if>
11591128
var ${optionalField.name} <#if !optionalField.type.isComplexTypeReference()>*</#if>${helper.getLanguageTypeNameForField(field)} = nil
11601129
<#if optionalField.conditionExpression.present>
11611130
if ${helper.toBooleanParseExpression(optionalField, optionalField.conditionExpression.get(), parserArguments)} </#if>{
@@ -1223,9 +1192,6 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if hasParserArgume
12231192
<#assign assertField = field.asAssertField().orElseThrow()>
12241193

12251194
// Assert Field (${assertField.name}) (Can be skipped, if a given expression evaluates to false)
1226-
<#if assertField.conditionExpression.contains("curPos")>
1227-
curPos = positionAware.GetPos() - startPos
1228-
</#if>
12291195
<#if assertField.type.isSimpleTypeReference()>
12301196
${assertField.name}, _err := ${helper.getReadBufferReadMethodCall(assertField.name, assertField.type.asSimpleTypeReference().orElseThrow(), assertField)}
12311197
if _err != nil {
@@ -1571,7 +1537,7 @@ func (pm *_${type.name}) SerializeParent(writeBuffer utils.WriteBuffer, child ${
15711537
_ = m
15721538
<#else>
15731539
func (m *_${type.name}) Serialize() ([]byte, error) {
1574-
wb := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.BigEndian), utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes())))<@emitImport import="encoding/binary" /> // TODO: get endianness from mspec
1540+
wb := utils.NewWriteBufferByteBased(utils.WithInitialSizeForByteBasedBuffer(int(m.GetLengthInBytes()))${helper.getEndiannessOptions(false, true)})
15751541
if err := m.SerializeWithWriteBuffer(wb); err != nil {
15761542
return nil, err
15771543
}

code-generation/language-go/src/main/resources/templates/go/data-io-template.go.ftlh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ import (
6969
<#-- TODO: the code below implies that parserArguments will be null if not present... not pretty -->
7070
<#if type.parserArguments.isPresent()><#assign parserArguments=type.parserArguments.orElseThrow()></#if>
7171
func ${type.name}Parse(theBytes []byte<#if parserArguments?has_content>, <#list parserArguments as parserArgument>${parserArgument.name} <#if parserArgument.type.isNonSimpleTypeReference() && !parserArgument.type.isEnumTypeReference()>I</#if>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#sep>, </#sep></#list></#if>) (api.PlcValue, error) {
72-
return ${type.name}ParseWithBuffer(utils.NewReadBufferByteBased(theBytes, utils.WithByteOrderForReadBufferByteBased(binary.BigEndian))<#if parserArguments?has_content>, <#list parserArguments as parserArgument>${parserArgument.name}<#sep>, </#sep></#list></#if>) // TODO: get endianness from mspec
72+
return ${type.name}ParseWithBuffer(utils.NewReadBufferByteBased(theBytes${helper.getEndiannessOptions(true, true)})<#if parserArguments?has_content>, <#list parserArguments as parserArgument>${parserArgument.name}<#sep>, </#sep></#list></#if>)
7373
}
7474

7575
func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if parserArguments?has_content>, <#list parserArguments as parserArgument>${parserArgument.name} <#if parserArgument.type.isNonSimpleTypeReference() && !parserArgument.type.isEnumTypeReference()>I</#if>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#sep>, </#sep></#list></#if>) (api.PlcValue, error) {
@@ -209,7 +209,7 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer<#if parserArguments
209209
}
210210

211211
func ${type.name}Serialize(value api.PlcValue<#if parserArguments?has_content>, <#list parserArguments as parserArgument>${parserArgument.name} <#if parserArgument.type.isNonSimpleTypeReference() && !parserArgument.type.isEnumTypeReference()>I</#if>${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}<#sep>, </#sep></#list></#if>) ([]byte, error) {
212-
wb := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.BigEndian))<@emitImport import="encoding/binary" /> // TODO: get endianness from mspec
212+
wb := utils.NewWriteBufferByteBased(${helper.getEndiannessOptions(false, false)})
213213
if err := ${type.name}SerializeWithWriteBuffer(wb, value<#if parserArguments?has_content>, <#list parserArguments as parserArgument>${parserArgument.name}<#sep>, </#sep></#list></#if>); err != nil {
214214
return nil, err
215215
}

code-generation/language-go/src/main/resources/templates/go/enum-template.go.ftlh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ ${helper.fileName(protocolName, languageName, outputFlavor)?replace(".", "/")}/m
4949
package model
5050

5151
import (
52-
"encoding/binary"
53-
5452
"github.com/apache/plc4x/plc4go/spi/utils"
5553
"github.com/pkg/errors"
5654
)
@@ -180,7 +178,7 @@ func (m ${type.name}) GetLengthInBytes() uint16 {
180178
<#assign simpleTypeReference = type.type.orElseThrow().asSimpleTypeReference().orElseThrow()>
181179
<#if simpleTypeReference.getSizeInBits() != -1>
182180
func ${type.name}Parse(theBytes []byte) (${type.name}, error) {
183-
return ${type.name}ParseWithBuffer(utils.NewReadBufferByteBased(theBytes, utils.WithByteOrderForReadBufferByteBased(binary.BigEndian))) // TODO: get endianness from mspec
181+
return ${type.name}ParseWithBuffer(utils.NewReadBufferByteBased(theBytes${helper.getEndiannessOptions(true, true)}))
184182
}
185183

186184
func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer) (${type.name}, error) {
@@ -197,7 +195,7 @@ func ${type.name}ParseWithBuffer(readBuffer utils.ReadBuffer) (${type.name}, err
197195
}
198196

199197
func (e ${type.name}) Serialize() ([]byte, error) {
200-
wb := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.BigEndian)) // TODO: get endianness from mspec
198+
wb := utils.NewWriteBufferByteBased(${helper.getEndiannessOptions(false, false)})
201199
if err := e.SerializeWithWriteBuffer(wb); err != nil {
202200
return nil, err
203201
}

code-generation/language-go/src/main/resources/templates/go/parser-factory-template.go.ftlh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ${helper.fileName(protocolName, languageName, outputFlavor)?replace(".", "/")}/P
4848
package ${outputFlavor?replace("-","")}
4949

5050
import (
51-
"github.com/apache/plc4x/plc4go/protocols/${helper.getSanitizedProtocolName()}/${outputFlavor?replace("-","")}/model"
51+
"github.com/apache/plc4x/plc4go/protocols/${helper.getSanitizedPackageName()}/${outputFlavor?replace("-","")}/model"
5252
"github.com/apache/plc4x/plc4go/spi/utils"
5353
"github.com/pkg/errors"
5454
)

code-generation/language-go/src/main/resources/templates/go/xml-parser-factory-template.go.ftlh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ${helper.fileName(protocolName, languageName, outputFlavor)?replace(".", "/")}/X
4848
package ${outputFlavor?replace("-","")}
4949

5050
import (
51-
"github.com/apache/plc4x/plc4go/protocols/${helper.getSanitizedProtocolName()}/${outputFlavor?replace("-","")}/model"
51+
"github.com/apache/plc4x/plc4go/protocols/${helper.getSanitizedPackageName()}/${outputFlavor?replace("-","")}/model"
5252
"github.com/apache/plc4x/plc4go/spi/utils"
5353
"github.com/pkg/errors"
5454
"strings"

code-generation/language-java/src/main/resources/templates/java/data-io-template.java.ftlh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ package ${helper.packageName(protocolName, languageName, outputFlavor)};
4848

4949
import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
5050

51-
import org.apache.plc4x.java.api.model.PlcField;
51+
import org.apache.plc4x.java.api.model.PlcTag;
5252
import org.apache.plc4x.java.api.value.*;
5353
import org.apache.plc4x.java.spi.generation.EvaluationHelper;
5454
import org.apache.plc4x.java.spi.generation.ParseException;

code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@ STRING_CHARACTER
343343
// Stuff we just want to ignore
344344
345345
LINE_COMMENT
346-
: '//' ~[\r\n]* -> skip
346+
: '//' ~[\r\n]* -> channel(HIDDEN)
347347
;
348348
349349
BLOCK_COMMENT
350-
: '/*' .*? '*/' -> skip
350+
: '/*' .*? '*/' -> channel(HIDDEN)
351351
;
352352
353353
WS
354-
: [ \t\r\n\u000C]+ -> skip
354+
: [ \t\r\n\u000C]+ -> channel(HIDDEN)
355355
;

plc4c/api/include/plc4c/read.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ extern "C" {
3131
void plc4c_read_request_destroy(plc4c_read_request *read_request);
3232

3333
/**
34-
* Function for adding a new item to a given request.
34+
* Function for adding a new tag, based on a given address to a given request.
3535
* @param read_request the read-request.
3636
* @param address address string
3737
* @return return code
3838
*/
39-
plc4c_return_code plc4c_read_request_add_item(plc4c_read_request *read_request,
40-
char *field_name,
39+
plc4c_return_code plc4c_read_request_add_tag_address(plc4c_read_request *read_request,
40+
char *tag_name,
4141
char *address);
4242

4343
/**

0 commit comments

Comments
 (0)