This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feat/code-gen-1.9
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feat/code-gen-1.9 by this push:
new 04c02127da feat: Updated the mspec parser to allow using mspec
keywords as id expressions (names of fields)
04c02127da is described below
commit 04c02127daa4cb8218a8a39b46fe8af543b3dd88
Author: Christofer Dutz <[email protected]>
AuthorDate: Thu Aug 28 13:53:19 2025 +0200
feat: Updated the mspec parser to allow using mspec keywords as id
expressions (names of fields)
feat: Added support for "constants" types.
---
.../freemarker/FreemarkerLanguageOutput.java | 46 +++++-
.../plc4x/language/java/JavaLanguageOutput.java | 5 +
.../templates/java/constants-template.java.ftlh | 84 +++++++++++
.../plugins/codegenerator/language/mspec/MSpec.g4 | 166 +++++++++++++++------
.../DefaultConstantsTypeDefinition.java | 63 ++++++++
.../mspec/model/fields/DefaultStateField.java | 60 ++++++++
.../mspec/parser/MessageFormatListener.java | 160 ++++++++++++++------
.../discovery/readwrite/AdsDiscoveryConstants.java | 127 ----------------
.../java/ads/discovery/readwrite/Constants.java | 42 ++++++
.../plc4x/java/ads/readwrite/AdsConstants.java | 122 ---------------
.../apache/plc4x/java/ads/readwrite/Constants.java | 42 ++++++
.../AdsTcpTransportConfiguration.java | 4 +-
.../plc4x/java/ads/discovery/AdsPlcDiscoverer.java | 7 +-
.../plc4x/java/ads/protocol/AdsProtocolLogic.java | 5 +-
.../protocol/ads/ProbeAdsDiscoveryCommands.java | 4 +-
.../java/bacnetip/readwrite/BACnetVendorId.java | 8 +
.../java/bacnetip/readwrite/BacnetConstants.java | 125 ----------------
.../plc4x/java/bacnetip/readwrite/Constants.java | 42 ++++++
.../BacNetPcapReplayTransportConfiguration.java | 4 +-
.../BacNetRawSocketTransportConfiguration.java | 4 +-
.../BacNetUdpTransportConfiguration.java | 4 +-
.../plc4x/java/cbus/readwrite/CBusConstants.java | 124 ---------------
.../plc4x/java/cbus/readwrite/Constants.java | 42 ++++++
.../CBusTcpTransportConfiguration.java | 4 +-
.../apache/plc4x/java/eip/readwrite/Constants.java | 43 ++++++
.../plc4x/java/eip/readwrite/EipConstants.java | 142 ------------------
.../java/eip/base/discovery/EipPlcDiscoverer.java | 6 +-
.../java/iec608705104/readwrite/Constants.java | 42 ++++++
.../readwrite/IEC608705104Constants.java | 122 ---------------
.../Iec608705014TcpTransportConfiguration.java | 4 +-
.../java/knxnetip/readwrite/KnxManufacturer.java | 10 +-
.../plc4x/java/modbus/readwrite/Constants.java | 42 ++++++
.../java/modbus/readwrite/ModbusConstants.java | 125 ----------------
.../config/ModbusTcpTransportConfiguration.java | 4 +-
.../modbus/tcp/discovery/ModbusPlcDiscoverer.java | 2 +-
.../java/openprotocol/readwrite/Constants.java | 81 +---------
.../plc4x/java/plc4x/readwrite/Constants.java | 42 ++++++
.../plc4x/java/plc4x/readwrite/Plc4xConstants.java | 124 ---------------
.../config/Plc4xTcpTransportConfiguration.java | 4 +-
.../server/bacnet/BacnetServerModule.java | 4 +-
.../simulator/server/cbus/CBusServerModule.java | 4 +-
pom.xml | 2 +-
.../resources/protocols/ads/ads-discovery.mspec | 2 +-
.../ads/src/main/resources/protocols/ads/ads.mspec | 2 +-
.../protocols/bacnetip/bacnet-vendorids.mspec | 7 +
.../resources/protocols/bacnetip/bacnet-tags.mspec | 2 +
.../resources/protocols/bacnetip/bacnetip.mspec | 2 +-
.../src/main/resources/protocols/cbus/c-bus.mspec | 31 +++-
.../eip/src/main/resources/protocols/eip/eip.mspec | 2 +-
.../protocols/iec608705104/iec-60870-5-104.mspec | 2 +-
.../protocols/knxnetip/knx-master-data.mspec | 10 +-
.../main/resources/protocols/modbus/modbus.mspec | 2 +-
.../protocols/openprotocol/open-protocol.mspec | 2 +-
.../main/resources/protocols/plc4x/v0/plc4x.mspec | 2 +-
.../src/main/resources/protocols/umas/umas.mspec | 2 +-
55 files changed, 925 insertions(+), 1240 deletions(-)
diff --git
a/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java
b/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java
index 8e1390ba0f..2fcb68002c 100644
---
a/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java
+++
b/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java
@@ -21,6 +21,7 @@ package
org.apache.plc4x.plugins.codegenerator.protocol.freemarker;
import freemarker.cache.ClassTemplateLoader;
import freemarker.template.*;
import org.apache.plc4x.plugins.codegenerator.language.LanguageOutput;
+import
org.apache.plc4x.plugins.codegenerator.types.definitions.ConstantsTypeDefinition;
import
org.apache.plc4x.plugins.codegenerator.types.definitions.EnumTypeDefinition;
import
org.apache.plc4x.plugins.codegenerator.types.definitions.DataIoTypeDefinition;
import org.apache.plc4x.plugins.codegenerator.types.definitions.TypeDefinition;
@@ -31,10 +32,7 @@ import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
public abstract class FreemarkerLanguageOutput implements LanguageOutput {
@@ -53,13 +51,15 @@ public abstract class FreemarkerLanguageOutput implements
LanguageOutput {
freemarkerConfiguration.setTemplateLoader(classTemplateLoader);
// Initialize all templates
- List<Template> specTemplates;
+ List<Template> specTemplatesList;
+ List<Template> constantsTemplateList;
List<Template> complexTypesTemplateList;
List<Template> enumTypesTemplateList;
List<Template> dataIoTemplateList;
List<Template> miscTemplateList;
try {
- specTemplates = getSpecTemplates(freemarkerConfiguration);
+ specTemplatesList = getSpecTemplates(freemarkerConfiguration);
+ constantsTemplateList =
getConstantsTemplates(freemarkerConfiguration);
complexTypesTemplateList =
getComplexTypeTemplates(freemarkerConfiguration);
enumTypesTemplateList =
getEnumTypeTemplates(freemarkerConfiguration);
dataIoTemplateList = getDataIoTemplates(freemarkerConfiguration);
@@ -69,7 +69,7 @@ public abstract class FreemarkerLanguageOutput implements
LanguageOutput {
}
// Generate output that's global for the entire mspec
- if (!specTemplates.isEmpty()) {
+ if (!specTemplatesList.isEmpty()) {
Map<String, Object> typeContext = new HashMap<>();
typeContext.put("languageName", languageName);
typeContext.put("protocolName", protocolName);
@@ -78,7 +78,7 @@ public abstract class FreemarkerLanguageOutput implements
LanguageOutput {
typeContext.put("tracer", Tracer.start("global"));
typeContext.putAll(options);
- for (Template template : specTemplates) {
+ for (Template template : specTemplatesList) {
try {
renderTemplate(outputDir, template, typeContext);
} catch (IOException | TemplateException e) {
@@ -87,8 +87,36 @@ public abstract class FreemarkerLanguageOutput implements
LanguageOutput {
}
}
+ // Generate constants types
+ Optional<TypeDefinition> constantsTypeDefinition =
types.values().stream().filter(type -> type instanceof
ConstantsTypeDefinition).findFirst();
+ if (!constantsTemplateList.isEmpty() &&
constantsTypeDefinition.isPresent()) {
+ TypeDefinition typeDefinition = constantsTypeDefinition.get();
+ Map<String, Object> typeContext = new HashMap<>();
+ typeContext.put("languageName", languageName);
+ typeContext.put("protocolName", protocolName);
+ typeContext.put("outputFlavor", outputFlavor);
+ typeContext.put("typeName", typeDefinition.getName());
+ typeContext.put("type", typeDefinition);
+ typeContext.put("helper", getHelper(null, protocolName,
outputFlavor, types, options));
+ typeContext.put("tracer", Tracer.start("global"));
+ typeContext.putAll(options);
+
+ for (Template template : constantsTemplateList) {
+ try {
+ renderTemplate(outputDir, template, typeContext);
+ } catch (IOException | TemplateException e) {
+ throw new GenerationException("Error generating
constants.", e);
+ }
+ }
+ }
+
// Iterate over the types and have content generated for each one
for (Map.Entry<String, TypeDefinition> typeEntry : types.entrySet()) {
+ // "Constants" types are handled separately.
+ if (typeEntry.getValue() instanceof ConstantsTypeDefinition) {
+ continue;
+ }
+
// Prepare a new generation context
Map<String, Object> typeContext = new HashMap<>();
typeContext.put("languageName", languageName);
@@ -202,6 +230,8 @@ public abstract class FreemarkerLanguageOutput implements
LanguageOutput {
protected abstract List<Template> getSpecTemplates(Configuration
freemarkerConfiguration) throws IOException;
+ protected abstract List<Template> getConstantsTemplates(Configuration
freemarkerConfiguration) throws IOException;
+
protected abstract List<Template> getComplexTypeTemplates(Configuration
freemarkerConfiguration) throws IOException;
protected abstract List<Template> getEnumTypeTemplates(Configuration
freemarkerConfiguration) throws IOException;
diff --git
a/code-generation/language/java/src/main/java/org/apache/plc4x/language/java/JavaLanguageOutput.java
b/code-generation/language/java/src/main/java/org/apache/plc4x/language/java/JavaLanguageOutput.java
index a65f8b7765..aa3b2ddc5e 100644
---
a/code-generation/language/java/src/main/java/org/apache/plc4x/language/java/JavaLanguageOutput.java
+++
b/code-generation/language/java/src/main/java/org/apache/plc4x/language/java/JavaLanguageOutput.java
@@ -68,6 +68,11 @@ public class JavaLanguageOutput extends
FreemarkerLanguageOutput {
return Collections.emptyList();
}
+ @Override
+ protected List<Template> getConstantsTemplates(Configuration
freemarkerConfiguration) throws IOException {
+ return
List.of(freemarkerConfiguration.getTemplate("templates/java/constants-template.java.ftlh"));
+ }
+
@Override
protected List<Template> getComplexTypeTemplates(Configuration
freemarkerConfiguration) throws IOException {
return
List.of(freemarkerConfiguration.getTemplate("templates/java/complex-type-template.java.ftlh"));
diff --git
a/code-generation/language/java/src/main/resources/templates/java/constants-template.java.ftlh
b/code-generation/language/java/src/main/resources/templates/java/constants-template.java.ftlh
new file mode 100644
index 0000000000..66d0562191
--- /dev/null
+++
b/code-generation/language/java/src/main/resources/templates/java/constants-template.java.ftlh
@@ -0,0 +1,84 @@
+<#--
+ 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
+
+ https://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.
+-->
+<#-- Prevent freemarker from escaping stuff -->
+<#outputformat "undefined">
+<#-- Declare the name and type of variables passed in to the template -->
+<#-- @ftlvariable name="languageName" type="java.lang.String" -->
+<#-- @ftlvariable name="protocolName" type="java.lang.String" -->
+<#-- @ftlvariable name="outputFlavor" type="java.lang.String" -->
+<#-- @ftlvariable name="helper"
type="org.apache.plc4x.language.java.JavaLanguageTemplateHelper" -->
+<#-- @ftlvariable name="tracer"
type="org.apache.plc4x.plugins.codegenerator.protocol.freemarker.Tracer" -->
+<#-- @ftlvariable name="type"
type="org.apache.plc4x.plugins.codegenerator.types.definitions.ComplexTypeDefinition"
-->
+<#-- Declare the name and type of variables declared locally inside the
template -->
+${helper.packageName(protocolName, languageName, outputFlavor)?replace(".",
"/")}/${type.name}.java
+/*
+ * 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
+ *
+ * https://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 ${helper.packageName(protocolName, languageName, outputFlavor)};
+
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.spi.generation.*;
+import org.apache.plc4x.java.api.value.*;
+
+import java.time.*;
+import java.util.*;
+import java.math.BigInteger;
+${helper.getExternalTypeImports()}
+
+// Code generated by code-generation. DO NOT EDIT.
+
+<#-- TODO: the code below implies that parserArguments will be null if not
present... not pretty -->
+<#if type.parserArguments.isPresent()><#assign
parserArguments=type.allParserArguments.orElseThrow()></#if>
+public class ${type.name} {
+
+<#-- If the current type contains "const" fields, generate some java constants
for holing their values -->
+<#if type.constFields?has_content>
+
+ // Constant values.
+ <#list type.constFields as field>
+ public static final
${helper.getLanguageTypeNameForTypeReference(field.type)}
${field.name?upper_case} = ${helper.toParseExpression(field, field.type,
field.referenceValue, parserArguments)};
+ </#list>
+</#if>
+
+}
+</#outputformat>
\ No newline at end of file
diff --git
a/code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4
b/code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4
index 404925638d..16f1a0c3f1 100644
---
a/code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4
+++
b/code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4
@@ -19,7 +19,19 @@ grammar MSpec;
*/
file
- : complexTypeDefinition* EOF
+ : contantsDefinition? globalsDefinition? contextDefintion?
complexTypeDefinition* EOF
+ ;
+
+contantsDefinition
+ : LBRACKET CONSTANTS (LBRACKET constField RBRACKET)* RBRACKET
+ ;
+
+globalsDefinition
+ : LBRACKET GLOBALS fieldDefinition* RBRACKET
+ ;
+
+contextDefintion
+ : LBRACKET CONTEXT fieldDefinition* RBRACKET
;
complexTypeDefinition
@@ -27,10 +39,10 @@ complexTypeDefinition
;
complexType
- : 'type' name=idExpression (LRBRACKET params=argumentList RRBRACKET)?
attributes=attributeList (fieldDefinition|batchSetDefinition)*
- | 'discriminatedType' name=idExpression (LRBRACKET params=argumentList
RRBRACKET)? attributes=attributeList (fieldDefinition|batchSetDefinition)*
- | 'enum' (type=dataType)? name=idExpression (LRBRACKET params=argumentList
RRBRACKET)? attributes=attributeList enumValues=enumValueDefinition*
- | 'dataIo' name=idExpression (LRBRACKET params=argumentList RRBRACKET)?
(attributes=attributeList) dataIoTypeSwitch=dataIoDefinition
+ : TYPE name=idExpression (LRBRACKET params=argumentList RRBRACKET)?
attributes=attributeList (fieldDefinition|batchSetDefinition)*
+ | DISCRIMINATEDTYPE name=idExpression (LRBRACKET params=argumentList
RRBRACKET)? attributes=attributeList (fieldDefinition|batchSetDefinition)*
+ | ENUM (type=dataType)? name=idExpression (LRBRACKET params=argumentList
RRBRACKET)? attributes=attributeList enumValues=enumValueDefinition*
+ | DATAIO name=idExpression (LRBRACKET params=argumentList RRBRACKET)?
(attributes=attributeList) dataIoTypeSwitch=dataIoDefinition
;
fieldDefinition
@@ -38,11 +50,11 @@ fieldDefinition
;
batchSetDefinition
- : LBRACKET 'batchSet' attributes=attributeList fieldDefinition+ RBRACKET
+ : LBRACKET BATCHSET attributes=attributeList fieldDefinition+ RBRACKET
;
dataIoDefinition
-// TODO: remove typeSwitchField as it's a unnecessary indirection
+// TODO: possibly alow more fields than just one typeSwitch field.
: LBRACKET typeSwitchField (LBRACKET params=multipleExpressions RBRACKET)?
RBRACKET
;
@@ -59,89 +71,94 @@ field
| manualField
| optionalField
| paddingField
+ | peekField
| reservedField
| simpleField
+ | stateField
| typeSwitchField
| unknownField
- | virtualField
| validationField
- | peekField
+ | virtualField
;
abstractField
- : 'abstract' type=typeReference name=idExpression
+ : ABSTRACT type=typeReference name=idExpression
;
arrayField
- : 'array' type=typeReference name=idExpression loopType=ARRAY_LOOP_TYPE
loopExpression=expression
+ : ARRAY type=typeReference name=idExpression loopType=ARRAY_LOOP_TYPE
loopExpression=expression
;
assertField
- : 'assert' type=typeReference name=idExpression condition=expression
+ : ASSERT type=typeReference name=idExpression condition=expression
;
checksumField
- : 'checksum' type=dataType name=idExpression checksumExpression=expression
+ : CHECKSUM type=dataType name=idExpression checksumExpression=expression
;
constField
- : 'const' type=typeReference name=idExpression expected=valueLiteral
+ : CONST type=typeReference name=idExpression expected=valueLiteral
;
discriminatorField
- : 'discriminator' type=typeReference name=idExpression
+ : DISCRIMINATOR type=typeReference name=idExpression
;
enumField
- : 'enum' type=typeReference name=idExpression fieldName=idExpression
+ : ENUM type=typeReference name=idExpression fieldName=idExpression
;
implicitField
- : 'implicit' type=dataType name=idExpression serializeExpression=expression
+ : IMPLICIT type=dataType name=idExpression serializeExpression=expression
;
manualArrayField
- : 'manualArray' type=typeReference name=idExpression loopType=ARRAY_LOOP_TYPE
loopExpression=expression parseExpression=expression
serializeExpression=expression lengthExpression=expression
+ : MANUALARRAY type=typeReference name=idExpression loopType=ARRAY_LOOP_TYPE
loopExpression=expression parseExpression=expression
serializeExpression=expression lengthExpression=expression
;
manualField
- : 'manual' type=typeReference name=idExpression parseExpression=expression
serializeExpression=expression lengthExpression=expression
+ : MANUAL type=typeReference name=idExpression parseExpression=expression
serializeExpression=expression lengthExpression=expression
;
optionalField
- : 'optional' type=typeReference name=idExpression (condition=expression)?
+ : OPTIONAL type=typeReference name=idExpression (condition=expression)?
;
paddingField
- : 'padding' type=dataType name=idExpression paddingValue=expression
timesPadding=expression
+ : PADDING type=dataType name=idExpression paddingValue=expression
timesPadding=expression
+ ;
+
+peekField
+ : PEEK type=typeReference name=idExpression (offset=expression)?
;
reservedField
- : 'reserved' type=dataType expected=expression
+ : RESERVED type=dataType expected=expression
;
simpleField
- : 'simple' type=typeReference name=idExpression
+ : SIMPLE type=typeReference name=idExpression
;
-typeSwitchField
- : 'typeSwitch' discriminators=multipleVariableLiterals caseStatement*
+stateField
+ : STATE type=typeReference name=idExpression valueExpression=expression
;
-unknownField
- : 'unknown' type=dataType
+typeSwitchField
+ : TYPESWITCH discriminators=multipleVariableLiterals caseStatement*
;
-virtualField
- : 'virtual' type=typeReference name=idExpression valueExpression=expression
+unknownField
+ : UNKNOWN type=dataType
;
validationField
- : 'validation' validationExpression=expression (description=STRING_LITERAL)?
('shouldFail='shouldFail=BOOLEAN_LITERAL)?
+ : VALIDATION validationExpression=expression (description=STRING_LITERAL)?
(SHOULD_FAIL '=' shouldFail=BOOLEAN_LITERAL)?
;
-peekField
- : 'peek' type=typeReference name=idExpression (offset=expression)?
+virtualField
+ : VIRTUAL type=typeReference name=idExpression valueExpression=expression
;
enumValueDefinition
@@ -158,19 +175,19 @@ caseStatement
;
dataType
- : base='bit'
- | base='byte'
- | base='int' size=INTEGER_LITERAL
- | base='vint'
- | base='uint' size=INTEGER_LITERAL
- | base='vuint'
- | base='float' size=INTEGER_LITERAL
- | base='ufloat' size=INTEGER_LITERAL
- | base='string' size=INTEGER_LITERAL
- | base='vstring' (length=expression)?
- | base='time'
- | base='date'
- | base='dateTime'
+ : base=BIT
+ | base=BYTE
+ | base=INT size=INTEGER_LITERAL
+ | base=VINT
+ | base=UINT size=INTEGER_LITERAL
+ | base=VUINT
+ | base=FLOAT size=INTEGER_LITERAL
+ | base=UFLOAT size=INTEGER_LITERAL
+ | base=STRING size=INTEGER_LITERAL
+ | base=VSTRING (length=expression)?
+ | base=TIME
+ | base=DATE
+ | base=DATETIME
;
attribute
@@ -233,8 +250,16 @@ valueLiteral
idExpression
: id=IDENTIFIER_LITERAL
- // Explicitly allow the loop type keywords in id-expressions
+ // Explicitly allow keywords in id-expressions
| id=ARRAY_LOOP_TYPE
+ | id=CONSTANTS | id=GLOBALS | id=CONTEXT | id=TYPE | id=DISCRIMINATEDTYPE |
id=DATAIO
+ | id=ENUM | id=BATCHSET | id=ABSTRACT | id=ARRAY | id=ASSERT | id=CHECKSUM |
id=CONST
+ | id=DISCRIMINATOR | id=IMPLICIT | id=MANUALARRAY | id=MANUAL | id=OPTIONAL |
id=PADDING
+ | id=PEEK | id=RESERVED | id=SIMPLE | id=STATE | id=TYPESWITCH | id=UNKNOWN |
id=VALIDATION
+ | id=VIRTUAL
+ | id=BIT | id=BYTE | id=INT | id=VINT | id=UINT | id=VUINT
+ | id=FLOAT | id=UFLOAT | id=STRING | id=VSTRING | id=TIME | id=DATE |
id=DATETIME
+ | id=SHOULD_FAIL
;
binaryOperator
@@ -268,6 +293,55 @@ RCBRACKET : '}';
ASTERISK : '*';
+// Keywords used for higher level constructs
+CONSTANTS : 'constants';
+GLOBALS : 'globals';
+CONTEXT : 'context';
+TYPE : 'type';
+DISCRIMINATEDTYPE : 'discriminatedType';
+DATAIO : 'dataIo';
+ENUM : 'enum';
+BATCHSET : 'batchSet';
+
+// Keywords used for fields
+ABSTRACT : 'abstract';
+ARRAY : 'array';
+ASSERT : 'assert';
+CHECKSUM : 'checksum';
+CONST : 'const';
+DISCRIMINATOR : 'discriminator';
+IMPLICIT : 'implicit';
+MANUALARRAY : 'manualArray';
+MANUAL : 'manual';
+OPTIONAL : 'optional';
+PADDING : 'padding';
+PEEK : 'peek';
+RESERVED : 'reserved';
+SIMPLE : 'simple';
+STATE : 'state';
+TYPESWITCH : 'typeSwitch';
+UNKNOWN : 'unknown';
+VALIDATION : 'validation';
+VIRTUAL : 'virtual';
+
+// Keywords for types
+BIT : 'bit';
+BYTE : 'byte';
+INT : 'int';
+VINT : 'vint';
+UINT : 'uint';
+VUINT : 'vuint';
+FLOAT : 'float';
+UFLOAT : 'ufloat';
+STRING : 'string';
+VSTRING : 'vstring';
+TIME : 'time';
+DATE : 'date';
+DATETIME : 'dateTime';
+
+// Keywords used elsewhere
+SHOULD_FAIL : 'shouldFail';
+
ARRAY_LOOP_TYPE
: 'count'
| 'length'
diff --git
a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultConstantsTypeDefinition.java
b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultConstantsTypeDefinition.java
new file mode 100644
index 0000000000..2b90e4430b
--- /dev/null
+++
b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultConstantsTypeDefinition.java
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.language.mspec.model.definitions;
+
+import org.apache.plc4x.plugins.codegenerator.types.definitions.Argument;
+import
org.apache.plc4x.plugins.codegenerator.types.definitions.ConstantsTypeDefinition;
+import org.apache.plc4x.plugins.codegenerator.types.fields.ConstField;
+import org.apache.plc4x.plugins.codegenerator.types.fields.Field;
+import org.apache.plc4x.plugins.codegenerator.types.fields.PropertyField;
+import org.apache.plc4x.plugins.codegenerator.types.fields.VirtualField;
+import org.apache.plc4x.plugins.codegenerator.types.terms.Term;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class DefaultConstantsTypeDefinition extends DefaultTypeDefinition
implements ConstantsTypeDefinition {
+
+ private final List<Field> fields;
+
+ public DefaultConstantsTypeDefinition(String name, Map<String, Term>
attributes, List<Argument> parserArguments, List<Field> fields) {
+ super(name, attributes, parserArguments);
+ this.fields = fields;
+ }
+
+ @Override
+ public List<Field> getFields() {
+ return fields;
+ }
+
+ @Override
+ public List<ConstField> getConstFields() {
+ return fields.stream()
+ .filter(ConstField.class::isInstance)
+ .map(ConstField.class::cast)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public List<PropertyField> getPropertyFields() {
+ return fields.stream()
+ .filter(PropertyField.class::isInstance)
+ .filter(field -> !(field instanceof ConstField) && !(field
instanceof VirtualField))
+ .map(PropertyField.class::cast)
+ .collect(Collectors.toList());
+ }
+}
diff --git
a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultStateField.java
b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultStateField.java
new file mode 100644
index 0000000000..95b0f21096
--- /dev/null
+++
b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultStateField.java
@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
+ * https://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.language.mspec.model.fields;
+
+import org.apache.plc4x.plugins.codegenerator.types.fields.StateField;
+import org.apache.plc4x.plugins.codegenerator.types.terms.Term;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class DefaultStateField extends DefaultTypedNamedField implements
StateField {
+
+ private final Term valueExpression;
+
+ public DefaultStateField(Map<String, Term> attributes, String name, Term
valueExpression) {
+ super(attributes, name);
+ this.valueExpression = Objects.requireNonNull(valueExpression);
+ }
+
+ public Term getValueExpression() {
+ return valueExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "DefaultStateField{" +
+ "valueExpression=" + valueExpression +
+ "} " + super.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ if (!super.equals(o)) return false;
+ DefaultStateField that = (DefaultStateField) o;
+ return Objects.equals(valueExpression, that.valueExpression);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), valueExpression);
+ }
+}
diff --git
a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java
b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java
index 209bc7a656..495ea249a3 100644
---
a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java
+++
b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java
@@ -91,6 +91,56 @@ public class MessageFormatListener extends MSpecBaseListener
implements LazyType
enumContexts = new LinkedList<>();
}
+ @Override
+ public void enterContantsDefinition(MSpecParser.ContantsDefinitionContext
ctx) {
+ currentTypeName.push("Constants");
+ // Set a map of attributes that should be set for all fields.
+ Map<String, Term> curBatchSetAttributes = new HashMap<>();
+ // Make the new Map the top of the stack.
+ batchSetAttributes.push(curBatchSetAttributes);
+
+ List<Field> parserContext = new LinkedList<>();
+ parserContexts.push(parserContext);
+ super.enterContantsDefinition(ctx);
+ }
+
+ @Override
+ public void exitContantsDefinition(MSpecParser.ContantsDefinitionContext
ctx) {
+ String typeName = "Constants";
+
+ // If the type has subtypes, it's an abstract type.
+ final List<Field> fields = parserContexts.pop();
+ DefaultConstantsTypeDefinition type = new
DefaultConstantsTypeDefinition(
+ typeName, Collections.emptyMap(), Collections.emptyList(), fields);
+ // Link the fields and the complex types.
+ if (fields != null) {
+ fields.forEach(field -> ((DefaultField) field).setOwner(type));
+ }
+ dispatchType(typeName, type);
+
+ currentTypeName.pop();
+ }
+
+ @Override
+ public void enterGlobalsDefinition(MSpecParser.GlobalsDefinitionContext
ctx) {
+ super.enterGlobalsDefinition(ctx);
+ }
+
+ @Override
+ public void exitGlobalsDefinition(MSpecParser.GlobalsDefinitionContext
ctx) {
+ super.exitGlobalsDefinition(ctx);
+ }
+
+ @Override
+ public void enterContextDefintion(MSpecParser.ContextDefintionContext ctx)
{
+ super.enterContextDefintion(ctx);
+ }
+
+ @Override
+ public void exitContextDefintion(MSpecParser.ContextDefintionContext ctx) {
+ super.exitContextDefintion(ctx);
+ }
+
@Override
public void enterComplexType(MSpecParser.ComplexTypeContext ctx) {
currentTypeName.push(getIdString(ctx.name));
@@ -240,6 +290,24 @@ public class MessageFormatListener extends
MSpecBaseListener implements LazyType
}
}
+ @Override
+ public void enterAssertField(MSpecParser.AssertFieldContext ctx) {
+ String name = getIdString(ctx.name);
+ Term conditionExpression = getExpressionTerm(ctx.condition);
+ DefaultAssertField field = new DefaultAssertField(getAttributes(ctx),
name, conditionExpression);
+ getTypeReference(ctx.type).whenComplete((typeReference, throwable) -> {
+ if (throwable != null) {
+ // TODO: proper error collection in type context error bucket
+ LOGGER.debug("Error setting type for {}", field, throwable);
+ return;
+ }
+ field.setType(typeReference);
+ });
+ if (parserContexts.peek() != null) {
+ parserContexts.peek().add(field);
+ }
+ }
+
@Override
public void enterChecksumField(MSpecParser.ChecksumFieldContext ctx) {
SimpleTypeReference type = getSimpleTypeReference(ctx.type);
@@ -316,24 +384,6 @@ public class MessageFormatListener extends
MSpecBaseListener implements LazyType
}
}
- @Override
- public void enterAssertField(MSpecParser.AssertFieldContext ctx) {
- String name = getIdString(ctx.name);
- Term conditionExpression = getExpressionTerm(ctx.condition);
- DefaultAssertField field = new DefaultAssertField(getAttributes(ctx),
name, conditionExpression);
- getTypeReference(ctx.type).whenComplete((typeReference, throwable) -> {
- if (throwable != null) {
- // TODO: proper error collection in type context error bucket
- LOGGER.debug("Error setting type for {}", field, throwable);
- return;
- }
- field.setType(typeReference);
- });
- if (parserContexts.peek() != null) {
- parserContexts.peek().add(field);
- }
- }
-
@Override
public void enterManualArrayField(MSpecParser.ManualArrayFieldContext ctx)
{
String name = getIdString(ctx.name);
@@ -400,6 +450,18 @@ public class MessageFormatListener extends
MSpecBaseListener implements LazyType
}
}
+ @Override
+ public void enterPaddingField(MSpecParser.PaddingFieldContext ctx) {
+ SimpleTypeReference type = getSimpleTypeReference(ctx.type);
+ String name = getIdString(ctx.name);
+ Term paddingValue = getExpressionTerm(ctx.paddingValue);
+ Term timesPadding = getExpressionTerm(ctx.timesPadding);
+ Field field = new DefaultPaddingField(getAttributes(ctx), type, name,
paddingValue, timesPadding);
+ if (parserContexts.peek() != null) {
+ parserContexts.peek().add(field);
+ }
+ }
+
@Override
public void enterPeekField(MSpecParser.PeekFieldContext ctx) {
String name = getIdString(ctx.name);
@@ -422,31 +484,37 @@ public class MessageFormatListener extends
MSpecBaseListener implements LazyType
}
@Override
- public void enterPaddingField(MSpecParser.PaddingFieldContext ctx) {
+ public void enterReservedField(MSpecParser.ReservedFieldContext ctx) {
SimpleTypeReference type = getSimpleTypeReference(ctx.type);
- String name = getIdString(ctx.name);
- Term paddingValue = getExpressionTerm(ctx.paddingValue);
- Term timesPadding = getExpressionTerm(ctx.timesPadding);
- Field field = new DefaultPaddingField(getAttributes(ctx), type, name,
paddingValue, timesPadding);
+ String expected = getExprString(ctx.expected);
+ Field field = new DefaultReservedField(getAttributes(ctx), type,
expected);
if (parserContexts.peek() != null) {
parserContexts.peek().add(field);
}
}
@Override
- public void enterReservedField(MSpecParser.ReservedFieldContext ctx) {
- SimpleTypeReference type = getSimpleTypeReference(ctx.type);
- String expected = getExprString(ctx.expected);
- Field field = new DefaultReservedField(getAttributes(ctx), type,
expected);
+ public void enterSimpleField(MSpecParser.SimpleFieldContext ctx) {
+ String name = getIdString(ctx.name);
+ DefaultSimpleField field = new DefaultSimpleField(getAttributes(ctx),
name);
+ getTypeReference(ctx.type).whenComplete((typeReference, throwable) -> {
+ if (throwable != null) {
+ // TODO: proper error collection in type context error bucket
+ LOGGER.debug("Error setting type for {}", field, throwable);
+ return;
+ }
+ field.setType(typeReference);
+ });
if (parserContexts.peek() != null) {
parserContexts.peek().add(field);
}
}
@Override
- public void enterSimpleField(MSpecParser.SimpleFieldContext ctx) {
+ public void enterStateField(MSpecParser.StateFieldContext ctx) {
String name = getIdString(ctx.name);
- DefaultSimpleField field = new DefaultSimpleField(getAttributes(ctx),
name);
+ Term valueExpression = getExpressionTerm(ctx.valueExpression);
+ DefaultStateField field = new DefaultStateField(getAttributes(ctx),
name, valueExpression);
getTypeReference(ctx.type).whenComplete((typeReference, throwable) -> {
if (throwable != null) {
// TODO: proper error collection in type context error bucket
@@ -480,6 +548,23 @@ public class MessageFormatListener extends
MSpecBaseListener implements LazyType
}
}
+ @Override
+ public void enterValidationField(MSpecParser.ValidationFieldContext ctx) {
+ Term validationExpression =
getExpressionTerm(ctx.validationExpression);
+ boolean shouldFail = true;
+ if (ctx.shouldFail != null) {
+ shouldFail = "true".equalsIgnoreCase(ctx.shouldFail.getText());
+ }
+ String description = null;
+ if (ctx.description != null) {
+ description = ctx.description.getText();
+ }
+ Field field = new DefaultValidationField(getAttributes(ctx),
validationExpression, description, shouldFail);
+ if (parserContexts.peek() != null) {
+ parserContexts.peek().add(field);
+ }
+ }
+
@Override
public void enterVirtualField(MSpecParser.VirtualFieldContext ctx) {
String name = getIdString(ctx.name);
@@ -498,23 +583,6 @@ public class MessageFormatListener extends
MSpecBaseListener implements LazyType
}
}
- @Override
- public void enterValidationField(MSpecParser.ValidationFieldContext ctx) {
- Term validationExpression =
getExpressionTerm(ctx.validationExpression);
- boolean shouldFail = true;
- if (ctx.shouldFail != null) {
- shouldFail = "true".equalsIgnoreCase(ctx.shouldFail.getText());
- }
- String description = null;
- if (ctx.description != null) {
- description = ctx.description.getText();
- }
- Field field = new DefaultValidationField(getAttributes(ctx),
validationExpression, description, shouldFail);
- if (parserContexts.peek() != null) {
- parserContexts.peek().add(field);
- }
- }
-
@Override
public void enterCaseStatement(MSpecParser.CaseStatementContext ctx) {
List<Field> parserContext = new LinkedList<>();
diff --git
a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/discovery/readwrite/AdsDiscoveryConstants.java
b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/discovery/readwrite/AdsDiscoveryConstants.java
deleted file mode 100644
index 0db2e08b57..0000000000
---
a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/discovery/readwrite/AdsDiscoveryConstants.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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
- *
- * https://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.java.ads.discovery.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class AdsDiscoveryConstants implements Message {
-
- // Constant values.
- public static final Integer ADSDISCOVERYUDPDEFAULTPORT = 48899;
-
- public AdsDiscoveryConstants() {
- super();
- }
-
- public int getAdsDiscoveryUdpDefaultPort() {
- return ADSDISCOVERYUDPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("AdsDiscoveryConstants");
-
- // Const Field (adsDiscoveryUdpDefaultPort)
- writeConstField(
- "adsDiscoveryUdpDefaultPort",
- ADSDISCOVERYUDPDEFAULTPORT,
- writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("AdsDiscoveryConstants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- AdsDiscoveryConstants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (adsDiscoveryUdpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static AdsDiscoveryConstants staticParse(ReadBuffer readBuffer)
throws ParseException {
- readBuffer.pullContext("AdsDiscoveryConstants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int adsDiscoveryUdpDefaultPort =
- readConstField(
- "adsDiscoveryUdpDefaultPort",
- readUnsignedInt(readBuffer, 16),
- AdsDiscoveryConstants.ADSDISCOVERYUDPDEFAULTPORT);
-
- readBuffer.closeContext("AdsDiscoveryConstants");
- // Create the instance
- AdsDiscoveryConstants _adsDiscoveryConstants;
- _adsDiscoveryConstants = new AdsDiscoveryConstants();
- return _adsDiscoveryConstants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof AdsDiscoveryConstants)) {
- return false;
- }
- AdsDiscoveryConstants that = (AdsDiscoveryConstants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/discovery/readwrite/Constants.java
b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/discovery/readwrite/Constants.java
new file mode 100644
index 0000000000..c3b03243bc
--- /dev/null
+++
b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/discovery/readwrite/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://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.java.ads.discovery.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer ADSDISCOVERYUDPDEFAULTPORT = 48899;
+}
diff --git
a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/AdsConstants.java
b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/AdsConstants.java
deleted file mode 100644
index 664b244736..0000000000
---
a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/AdsConstants.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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
- *
- * https://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.java.ads.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class AdsConstants implements Message {
-
- // Constant values.
- public static final Integer ADSTCPDEFAULTPORT = 48898;
-
- public AdsConstants() {
- super();
- }
-
- public int getAdsTcpDefaultPort() {
- return ADSTCPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("AdsConstants");
-
- // Const Field (adsTcpDefaultPort)
- writeConstField("adsTcpDefaultPort", ADSTCPDEFAULTPORT,
writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("AdsConstants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- AdsConstants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (adsTcpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static AdsConstants staticParse(ReadBuffer readBuffer) throws
ParseException {
- readBuffer.pullContext("AdsConstants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int adsTcpDefaultPort =
- readConstField(
- "adsTcpDefaultPort", readUnsignedInt(readBuffer, 16),
AdsConstants.ADSTCPDEFAULTPORT);
-
- readBuffer.closeContext("AdsConstants");
- // Create the instance
- AdsConstants _adsConstants;
- _adsConstants = new AdsConstants();
- return _adsConstants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof AdsConstants)) {
- return false;
- }
- AdsConstants that = (AdsConstants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/Constants.java
b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/Constants.java
new file mode 100644
index 0000000000..298ab7a814
--- /dev/null
+++
b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://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.java.ads.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer ADSTCPDEFAULTPORT = 48898;
+}
diff --git
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/configuration/AdsTcpTransportConfiguration.java
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/configuration/AdsTcpTransportConfiguration.java
index d902487674..db0b5078c3 100644
---
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/configuration/AdsTcpTransportConfiguration.java
+++
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/configuration/AdsTcpTransportConfiguration.java
@@ -19,14 +19,14 @@
package org.apache.plc4x.java.ads.configuration;
-import org.apache.plc4x.java.ads.readwrite.AdsConstants;
+import org.apache.plc4x.java.ads.readwrite.Constants;
import org.apache.plc4x.java.transport.tcp.DefaultTcpTransportConfiguration;
public class AdsTcpTransportConfiguration extends
DefaultTcpTransportConfiguration {
@Override
public int getDefaultPort() {
- return AdsConstants.ADSTCPDEFAULTPORT;
+ return Constants.ADSTCPDEFAULTPORT;
}
}
diff --git
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java
index 43ad586bea..9313f4e8ae 100644
---
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java
+++
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java
@@ -19,7 +19,6 @@
package org.apache.plc4x.java.ads.discovery;
import org.apache.plc4x.java.ads.discovery.readwrite.*;
-import org.apache.plc4x.java.ads.readwrite.AdsConstants;
import org.apache.plc4x.java.api.messages.PlcDiscoveryItem;
import org.apache.plc4x.java.api.messages.PlcDiscoveryItemHandler;
import org.apache.plc4x.java.api.messages.PlcDiscoveryRequest;
@@ -63,7 +62,7 @@ public class AdsPlcDiscoverer implements PlcDiscoverer {
if ((interfaceAddress.getBroadcast() != null) &&
(interfaceAddress.getAddress() instanceof Inet4Address)) {
Inet4Address inet4Address = (Inet4Address)
interfaceAddress.getAddress();
// Open a listening socket on the AMS discovery
default port for taking in responses.
- DatagramSocket adsDiscoverySocket = new
DatagramSocket(AdsDiscoveryConstants.ADSDISCOVERYUDPDEFAULTPORT, inet4Address);
+ DatagramSocket adsDiscoverySocket = new
DatagramSocket(Constants.ADSDISCOVERYUDPDEFAULTPORT, inet4Address);
adsDiscoverySocket.setBroadcast(true);
openSockets.add(adsDiscoverySocket);
@@ -133,7 +132,7 @@ public class AdsPlcDiscoverer implements PlcDiscoverer {
// Add an entry to the results.
PlcDiscoveryItem
plcDiscoveryItem = new DefaultPlcDiscoveryItem(
"ads", "tcp",
-
plcAddress.getHostAddress() + ":" + AdsConstants.ADSTCPDEFAULTPORT,
+
plcAddress.getHostAddress() + ":" +
org.apache.plc4x.java.ads.readwrite.Constants.ADSTCPDEFAULTPORT,
options,
hostNameBlock.getHostName().getText(), attributes);
// If we've got an explicit
handler, pass the new item to that.
@@ -174,7 +173,7 @@ public class AdsPlcDiscoverer implements PlcDiscoverer {
InetAddress broadcastAddress =
interfaceAddress.getBroadcast();
// Create the UDP packet to the broadcast
address.
- DatagramPacket discoveryRequestPacket = new
DatagramPacket(writeBuffer.getBytes(), writeBuffer.getBytes().length,
broadcastAddress, AdsDiscoveryConstants.ADSDISCOVERYUDPDEFAULTPORT);
+ DatagramPacket discoveryRequestPacket = new
DatagramPacket(writeBuffer.getBytes(), writeBuffer.getBytes().length,
broadcastAddress, Constants.ADSDISCOVERYUDPDEFAULTPORT);
adsDiscoverySocket.send(discoveryRequestPacket);
} catch (SerializationException e) {
logger.error("Error serializing ADS discovery
request", e);
diff --git
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
index 9d8e59afe1..1ca0279f13 100644
---
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
+++
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
@@ -21,6 +21,7 @@ package org.apache.plc4x.java.ads.protocol;
import org.apache.plc4x.java.ads.configuration.AdsConfiguration;
import org.apache.plc4x.java.ads.discovery.readwrite.AmsNetId;
import org.apache.plc4x.java.ads.discovery.readwrite.*;
+import org.apache.plc4x.java.ads.discovery.readwrite.Constants;
import org.apache.plc4x.java.ads.model.AdsSubscriptionHandle;
import org.apache.plc4x.java.ads.readwrite.*;
import org.apache.plc4x.java.ads.tag.AdsTag;
@@ -281,7 +282,7 @@ public class AdsProtocolLogic extends
Plc4xProtocolBase<AmsTCPPacket> implements
new AdsDiscoveryBlockHostName(new
AmsString(localAddress.getHostAddress()))));
// Send the request to the PLC using a UDP socket.
- try (DatagramSocket adsDiscoverySocket = new
DatagramSocket(AdsDiscoveryConstants.ADSDISCOVERYUDPDEFAULTPORT)) {
+ try (DatagramSocket adsDiscoverySocket = new
DatagramSocket(Constants.ADSDISCOVERYUDPDEFAULTPORT)) {
// Serialize the message.
WriteBufferByteBased writeBuffer = new WriteBufferByteBased(
addOrUpdateRouteRequest.getLengthInBytes(),
ByteOrder.LITTLE_ENDIAN);
@@ -294,7 +295,7 @@ public class AdsProtocolLogic extends
Plc4xProtocolBase<AmsTCPPacket> implements
// Create the UDP packet to the broadcast address.
DatagramPacket discoveryRequestPacket = new DatagramPacket(
writeBuffer.getBytes(), writeBuffer.getBytes().length,
- remoteAddress,
AdsDiscoveryConstants.ADSDISCOVERYUDPDEFAULTPORT);
+ remoteAddress, Constants.ADSDISCOVERYUDPDEFAULTPORT);
adsDiscoverySocket.send(discoveryRequestPacket);
// The actual length would be 32, but better be prepared for a
more verbose response
diff --git
a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/protocol/ads/ProbeAdsDiscoveryCommands.java
b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/protocol/ads/ProbeAdsDiscoveryCommands.java
index 76369733a8..201e6c9df7 100644
---
a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/protocol/ads/ProbeAdsDiscoveryCommands.java
+++
b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/protocol/ads/ProbeAdsDiscoveryCommands.java
@@ -43,7 +43,7 @@ public class ProbeAdsDiscoveryCommands {
new AdsDiscoveryBlockAmsNetId(new AmsNetId((byte) 192, (byte)
168, (byte) 23, (byte) 20, (byte) 1, (byte) 1))
));
- try (DatagramSocket adsDiscoverySocket = new
DatagramSocket(AdsDiscoveryConstants.ADSDISCOVERYUDPDEFAULTPORT)) {
+ try (DatagramSocket adsDiscoverySocket = new
DatagramSocket(Constants.ADSDISCOVERYUDPDEFAULTPORT)) {
// Serialize the message.
WriteBufferByteBased writeBuffer = new
WriteBufferByteBased(discoveryRequestMessage.getLengthInBytes(),
ByteOrder.LITTLE_ENDIAN);
discoveryRequestMessage.serialize(writeBuffer);
@@ -52,7 +52,7 @@ public class ProbeAdsDiscoveryCommands {
InetAddress address = InetAddress.getByAddress(new byte[]{(byte)
192, (byte) 168, (byte) 23, (byte) 20});
// Create the UDP packet to the broadcast address.
- DatagramPacket discoveryRequestPacket = new
DatagramPacket(writeBuffer.getBytes(), writeBuffer.getBytes().length, address,
AdsDiscoveryConstants.ADSDISCOVERYUDPDEFAULTPORT);
+ DatagramPacket discoveryRequestPacket = new
DatagramPacket(writeBuffer.getBytes(), writeBuffer.getBytes().length, address,
Constants.ADSDISCOVERYUDPDEFAULTPORT);
adsDiscoverySocket.send(discoveryRequestPacket);
} catch (Exception e) {
e.printStackTrace();
diff --git
a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
index 055e243d9f..0de17686f2 100644
---
a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
+++
b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
@@ -1790,6 +1790,14 @@ public enum BACnetVendorId {
ZAPHIREAS((int) 1557, (int) 1557, (String) "Zaphire AS"),
AJ_MANUFACTURING((int) 1558, (int) 1558, (String) "AJ Manufacturing"),
FUTURE_MOTORS_LTD((int) 1559, (int) 1559, (String) "Future Motors Ltd."),
+ HIMEL_HONG_KONG_LIMITED((int) 1560, (int) 1560, (String) "Himel Hong Kong
Limited"),
+ SHENZHEN_SUNRICHER_TECHNOLOGY_CO_LTD(
+ (int) 1561, (int) 1561, (String) "Shenzhen Sunricher Technology Co.,
Ltd."),
+ ACTILITYSA((int) 1562, (int) 1562, (String) "Actility S.A."),
+ OY_HALTON_GROUP_LTD((int) 1563, (int) 1563, (String) "Oy Halton Group Ltd."),
+ AVTECH_SOFTWARE_INC((int) 1564, (int) 1564, (String) "AVTECH Software,
Inc."),
+ IN_CONTROL_ENGINEERINGLLC((int) 1565, (int) 1565, (String) "InControl
Engineering LLC"),
+ SOUND_WATER_TECHNOLOGIESLLC((int) 1566, (int) 1566, (String) "SoundWater
Technologies LLC"),
UNKNOWN_VENDOR((int) 0xFFFF, (int) 0xFFFF, (String) "Unknown");
private static final Map<Integer, BACnetVendorId> map;
diff --git
a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BacnetConstants.java
b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BacnetConstants.java
deleted file mode 100644
index 79667d2c39..0000000000
---
a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BacnetConstants.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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
- *
- * https://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.java.bacnetip.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class BacnetConstants implements Message {
-
- // Constant values.
- public static final Integer BACNETUDPDEFAULTPORT = 47808;
-
- public BacnetConstants() {
- super();
- }
-
- public int getBacnetUdpDefaultPort() {
- return BACNETUDPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("BacnetConstants");
-
- // Const Field (bacnetUdpDefaultPort)
- writeConstField(
- "bacnetUdpDefaultPort", BACNETUDPDEFAULTPORT,
writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("BacnetConstants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- BacnetConstants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (bacnetUdpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static BacnetConstants staticParse(ReadBuffer readBuffer) throws
ParseException {
- readBuffer.pullContext("BacnetConstants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int bacnetUdpDefaultPort =
- readConstField(
- "bacnetUdpDefaultPort",
- readUnsignedInt(readBuffer, 16),
- BacnetConstants.BACNETUDPDEFAULTPORT);
-
- readBuffer.closeContext("BacnetConstants");
- // Create the instance
- BacnetConstants _bacnetConstants;
- _bacnetConstants = new BacnetConstants();
- return _bacnetConstants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof BacnetConstants)) {
- return false;
- }
- BacnetConstants that = (BacnetConstants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/Constants.java
b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/Constants.java
new file mode 100644
index 0000000000..211f7c1009
--- /dev/null
+++
b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://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.java.bacnetip.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer BACNETUDPDEFAULTPORT = 47808;
+}
diff --git
a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetPcapReplayTransportConfiguration.java
b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetPcapReplayTransportConfiguration.java
index 62a65487c6..36bfad13be 100644
---
a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetPcapReplayTransportConfiguration.java
+++
b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetPcapReplayTransportConfiguration.java
@@ -19,7 +19,7 @@
package org.apache.plc4x.java.bacnetip.configuration;
-import org.apache.plc4x.java.bacnetip.readwrite.BacnetConstants;
+import org.apache.plc4x.java.bacnetip.readwrite.Constants;
import
org.apache.plc4x.java.spi.configuration.annotations.ConfigurationParameter;
import org.apache.plc4x.java.spi.configuration.annotations.Description;
import
org.apache.plc4x.java.spi.configuration.annotations.defaults.BooleanDefaultValue;
@@ -45,7 +45,7 @@ public class BacNetPcapReplayTransportConfiguration extends
DefaultPcapReplayTra
@Override
public int getDefaultPort() {
- return BacnetConstants.BACNETUDPDEFAULTPORT;
+ return Constants.BACNETUDPDEFAULTPORT;
}
/**
diff --git
a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetRawSocketTransportConfiguration.java
b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetRawSocketTransportConfiguration.java
index 7f34273239..5922ea7845 100644
---
a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetRawSocketTransportConfiguration.java
+++
b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetRawSocketTransportConfiguration.java
@@ -19,7 +19,7 @@
package org.apache.plc4x.java.bacnetip.configuration;
-import org.apache.plc4x.java.bacnetip.readwrite.BacnetConstants;
+import org.apache.plc4x.java.bacnetip.readwrite.Constants;
import
org.apache.plc4x.java.spi.configuration.annotations.ConfigurationParameter;
import org.apache.plc4x.java.spi.configuration.annotations.Description;
import
org.apache.plc4x.java.spi.configuration.annotations.defaults.BooleanDefaultValue;
@@ -45,7 +45,7 @@ public class BacNetRawSocketTransportConfiguration extends
DefaultRawSocketTrans
@Override
public int getDefaultPort() {
- return BacnetConstants.BACNETUDPDEFAULTPORT;
+ return Constants.BACNETUDPDEFAULTPORT;
}
/**
diff --git
a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetUdpTransportConfiguration.java
b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetUdpTransportConfiguration.java
index e8692e3cfb..9e059bc0f2 100644
---
a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetUdpTransportConfiguration.java
+++
b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetUdpTransportConfiguration.java
@@ -19,14 +19,14 @@
package org.apache.plc4x.java.bacnetip.configuration;
-import org.apache.plc4x.java.bacnetip.readwrite.BacnetConstants;
+import org.apache.plc4x.java.bacnetip.readwrite.Constants;
import org.apache.plc4x.java.transport.udp.DefaultUdpTransportConfiguration;
public class BacNetUdpTransportConfiguration extends
DefaultUdpTransportConfiguration {
@Override
public int getDefaultPort() {
- return BacnetConstants.BACNETUDPDEFAULTPORT;
+ return Constants.BACNETUDPDEFAULTPORT;
}
}
diff --git
a/plc4j/drivers/c-bus/src/main/generated/org/apache/plc4x/java/cbus/readwrite/CBusConstants.java
b/plc4j/drivers/c-bus/src/main/generated/org/apache/plc4x/java/cbus/readwrite/CBusConstants.java
deleted file mode 100644
index 776bbf504d..0000000000
---
a/plc4j/drivers/c-bus/src/main/generated/org/apache/plc4x/java/cbus/readwrite/CBusConstants.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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
- *
- * https://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.java.cbus.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class CBusConstants implements Message {
-
- // Constant values.
- public static final Integer CBUSTCPDEFAULTPORT = 10001;
-
- public CBusConstants() {
- super();
- }
-
- public int getCbusTcpDefaultPort() {
- return CBUSTCPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("CBusConstants");
-
- // Const Field (cbusTcpDefaultPort)
- writeConstField("cbusTcpDefaultPort", CBUSTCPDEFAULTPORT,
writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("CBusConstants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- CBusConstants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (cbusTcpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static CBusConstants staticParse(ReadBuffer readBuffer) throws
ParseException {
- readBuffer.pullContext("CBusConstants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int cbusTcpDefaultPort =
- readConstField(
- "cbusTcpDefaultPort",
- readUnsignedInt(readBuffer, 16),
- CBusConstants.CBUSTCPDEFAULTPORT);
-
- readBuffer.closeContext("CBusConstants");
- // Create the instance
- CBusConstants _cBusConstants;
- _cBusConstants = new CBusConstants();
- return _cBusConstants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof CBusConstants)) {
- return false;
- }
- CBusConstants that = (CBusConstants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/c-bus/src/main/generated/org/apache/plc4x/java/cbus/readwrite/Constants.java
b/plc4j/drivers/c-bus/src/main/generated/org/apache/plc4x/java/cbus/readwrite/Constants.java
new file mode 100644
index 0000000000..9a52c1706c
--- /dev/null
+++
b/plc4j/drivers/c-bus/src/main/generated/org/apache/plc4x/java/cbus/readwrite/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://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.java.cbus.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer CBUSTCPDEFAULTPORT = 10001;
+}
diff --git
a/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/configuration/CBusTcpTransportConfiguration.java
b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/configuration/CBusTcpTransportConfiguration.java
index b7af063213..125eb28da6 100644
---
a/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/configuration/CBusTcpTransportConfiguration.java
+++
b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/configuration/CBusTcpTransportConfiguration.java
@@ -19,14 +19,14 @@
package org.apache.plc4x.java.cbus.configuration;
-import org.apache.plc4x.java.cbus.readwrite.CBusConstants;
+import org.apache.plc4x.java.cbus.readwrite.Constants;
import org.apache.plc4x.java.transport.tcp.DefaultTcpTransportConfiguration;
public class CBusTcpTransportConfiguration extends
DefaultTcpTransportConfiguration {
@Override
public int getDefaultPort() {
- return CBusConstants.CBUSTCPDEFAULTPORT;
+ return Constants.CBUSTCPDEFAULTPORT;
}
}
diff --git
a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/Constants.java
b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/Constants.java
new file mode 100644
index 0000000000..d75719b001
--- /dev/null
+++
b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/Constants.java
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
+ * https://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.java.eip.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer EIPUDPDISCOVERYDEFAULTPORT = 44818;
+ public static final Integer EIPTCPDEFAULTPORT = 44818;
+}
diff --git
a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/EipConstants.java
b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/EipConstants.java
deleted file mode 100644
index 1f4ee4f1ff..0000000000
---
a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/EipConstants.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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
- *
- * https://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.java.eip.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class EipConstants implements Message {
-
- // Constant values.
- public static final Integer EIPUDPDISCOVERYDEFAULTPORT = 44818;
- public static final Integer EIPTCPDEFAULTPORT = 44818;
-
- public EipConstants() {
- super();
- }
-
- public int getEipUdpDiscoveryDefaultPort() {
- return EIPUDPDISCOVERYDEFAULTPORT;
- }
-
- public int getEipTcpDefaultPort() {
- return EIPTCPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("EipConstants");
-
- // Const Field (eipUdpDiscoveryDefaultPort)
- writeConstField(
- "eipUdpDiscoveryDefaultPort",
- EIPUDPDISCOVERYDEFAULTPORT,
- writeUnsignedInt(writeBuffer, 16));
-
- // Const Field (eipTcpDefaultPort)
- writeConstField("eipTcpDefaultPort", EIPTCPDEFAULTPORT,
writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("EipConstants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- EipConstants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (eipUdpDiscoveryDefaultPort)
- lengthInBits += 16;
-
- // Const Field (eipTcpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static EipConstants staticParse(ReadBuffer readBuffer) throws
ParseException {
- readBuffer.pullContext("EipConstants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int eipUdpDiscoveryDefaultPort =
- readConstField(
- "eipUdpDiscoveryDefaultPort",
- readUnsignedInt(readBuffer, 16),
- EipConstants.EIPUDPDISCOVERYDEFAULTPORT);
-
- int eipTcpDefaultPort =
- readConstField(
- "eipTcpDefaultPort", readUnsignedInt(readBuffer, 16),
EipConstants.EIPTCPDEFAULTPORT);
-
- readBuffer.closeContext("EipConstants");
- // Create the instance
- EipConstants _eipConstants;
- _eipConstants = new EipConstants();
- return _eipConstants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof EipConstants)) {
- return false;
- }
- EipConstants that = (EipConstants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/discovery/EipPlcDiscoverer.java
b/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/discovery/EipPlcDiscoverer.java
index a4a0f20d15..e08ccee43d 100644
---
a/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/discovery/EipPlcDiscoverer.java
+++
b/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/discovery/EipPlcDiscoverer.java
@@ -60,7 +60,7 @@ public class EipPlcDiscoverer implements PlcDiscoverer {
if ((interfaceAddress.getBroadcast() != null) &&
(interfaceAddress.getAddress() instanceof Inet4Address)) {
Inet4Address inet4Address = (Inet4Address)
interfaceAddress.getAddress();
// Open a listening socket on the AMS discovery
default port for taking in responses.
- DatagramSocket discoverySocket = new
DatagramSocket(EipConstants.EIPUDPDISCOVERYDEFAULTPORT, inet4Address);
+ DatagramSocket discoverySocket = new
DatagramSocket(Constants.EIPUDPDISCOVERYDEFAULTPORT, inet4Address);
discoverySocket.setBroadcast(true);
openSockets.add(discoverySocket);
@@ -89,7 +89,7 @@ public class EipPlcDiscoverer implements PlcDiscoverer {
// Add an entry to the
results.
PlcDiscoveryItem
plcDiscoveryItem = new DefaultPlcDiscoveryItem(
"eip", "tcp",
-
plcAddress.getHostAddress() + ":" + EipConstants.EIPTCPDEFAULTPORT,
+
plcAddress.getHostAddress() + ":" + Constants.EIPTCPDEFAULTPORT,
Collections.emptyMap(), identityItem.getProductName(), Collections.emptyMap());
// If we've got an
explicit handler, pass the new item to that.
@@ -131,7 +131,7 @@ public class EipPlcDiscoverer implements PlcDiscoverer {
InetAddress broadcastAddress =
interfaceAddress.getBroadcast();
// Create the UDP packet to the broadcast
address.
- DatagramPacket discoveryRequestPacket = new
DatagramPacket(writeBuffer.getBytes(), writeBuffer.getBytes().length,
broadcastAddress, EipConstants.EIPUDPDISCOVERYDEFAULTPORT);
+ DatagramPacket discoveryRequestPacket = new
DatagramPacket(writeBuffer.getBytes(), writeBuffer.getBytes().length,
broadcastAddress, Constants.EIPUDPDISCOVERYDEFAULTPORT);
discoverySocket.send(discoveryRequestPacket);
} catch (SerializationException e) {
logger.error("Error serializing EIP discovery
request", e);
diff --git
a/plc4j/drivers/iec-60870/src/main/generated/org/apache/plc4x/java/iec608705104/readwrite/Constants.java
b/plc4j/drivers/iec-60870/src/main/generated/org/apache/plc4x/java/iec608705104/readwrite/Constants.java
new file mode 100644
index 0000000000..7b5d5ff43d
--- /dev/null
+++
b/plc4j/drivers/iec-60870/src/main/generated/org/apache/plc4x/java/iec608705104/readwrite/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://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.java.iec608705104.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer DEFAULTPORT = 2404;
+}
diff --git
a/plc4j/drivers/iec-60870/src/main/generated/org/apache/plc4x/java/iec608705104/readwrite/IEC608705104Constants.java
b/plc4j/drivers/iec-60870/src/main/generated/org/apache/plc4x/java/iec608705104/readwrite/IEC608705104Constants.java
deleted file mode 100644
index c69fdace61..0000000000
---
a/plc4j/drivers/iec-60870/src/main/generated/org/apache/plc4x/java/iec608705104/readwrite/IEC608705104Constants.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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
- *
- * https://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.java.iec608705104.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class IEC608705104Constants implements Message {
-
- // Constant values.
- public static final Integer DEFAULTPORT = 2404;
-
- public IEC608705104Constants() {
- super();
- }
-
- public int getDefaultPort() {
- return DEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("IEC608705104Constants");
-
- // Const Field (defaultPort)
- writeConstField("defaultPort", DEFAULTPORT, writeUnsignedInt(writeBuffer,
16));
-
- writeBuffer.popContext("IEC608705104Constants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- IEC608705104Constants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (defaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static IEC608705104Constants staticParse(ReadBuffer readBuffer)
throws ParseException {
- readBuffer.pullContext("IEC608705104Constants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int defaultPort =
- readConstField(
- "defaultPort", readUnsignedInt(readBuffer, 16),
IEC608705104Constants.DEFAULTPORT);
-
- readBuffer.closeContext("IEC608705104Constants");
- // Create the instance
- IEC608705104Constants _iEC608705104Constants;
- _iEC608705104Constants = new IEC608705104Constants();
- return _iEC608705104Constants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof IEC608705104Constants)) {
- return false;
- }
- IEC608705104Constants that = (IEC608705104Constants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/iec-60870/src/main/java/org/apache/plc4x/java/iec608705104/readwrite/configuration/Iec608705014TcpTransportConfiguration.java
b/plc4j/drivers/iec-60870/src/main/java/org/apache/plc4x/java/iec608705104/readwrite/configuration/Iec608705014TcpTransportConfiguration.java
index 1dc4bcd39c..14015f7389 100644
---
a/plc4j/drivers/iec-60870/src/main/java/org/apache/plc4x/java/iec608705104/readwrite/configuration/Iec608705014TcpTransportConfiguration.java
+++
b/plc4j/drivers/iec-60870/src/main/java/org/apache/plc4x/java/iec608705104/readwrite/configuration/Iec608705014TcpTransportConfiguration.java
@@ -19,14 +19,14 @@
package org.apache.plc4x.java.iec608705104.readwrite.configuration;
-import org.apache.plc4x.java.iec608705104.readwrite.IEC608705104Constants;
+import org.apache.plc4x.java.iec608705104.readwrite.Constants;
import org.apache.plc4x.java.transport.tcp.DefaultTcpTransportConfiguration;
public class Iec608705014TcpTransportConfiguration extends
DefaultTcpTransportConfiguration {
@Override
public int getDefaultPort() {
- return IEC608705104Constants.DEFAULTPORT;
+ return Constants.DEFAULTPORT;
}
}
diff --git
a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
index 9dfd4a0049..d92379b9d0 100644
---
a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
+++
b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
@@ -867,7 +867,7 @@ public enum KnxManufacturer {
(int) 739, (int) 800, (String) "Hangzhou Konke Information Technology
Co., Ltd."),
M_SHANGHAI_FANTE_DIGITAL_TECHNOLOGY_CO___LTD(
(int) 740, (int) 801, (String) "Shanghai Fante Digital Technology Co.,
Ltd"),
- M_CONFIO((int) 741, (int) 802, (String) "CONFIO"),
+ M_CONFIO_TECHNOLOGIES_PVT__LTD((int) 741, (int) 802, (String) "Confio
Technologies Pvt. Ltd"),
M_SONIC_TECHNOLOGIES((int) 742, (int) 803, (String) "Sonic Technologies"),
M_SHANGHAI_INNOVATECH_INFORMATION_TECHNOLOGY_CO___LT(
(int) 743, (int) 804, (String) "Shanghai Innovatech Information
Technology Co., Lt"),
@@ -882,9 +882,13 @@ public enum KnxManufacturer {
M_SHANGHAI_YUKON_AUTOMATION_TECHNOLOGIES_CO___LTD_(
(int) 750, (int) 811, (String) "Shanghai YUKON Automation Technologies
Co., Ltd."),
M_TECCO_PTY_LTD((int) 751, (int) 812, (String) "Tecco Pty Ltd"),
- M_ABB___RESERVED((int) 752, (int) 43954, (String) "ABB - reserved"),
+ M_A_LAN_TECHNOLOGIE((int) 752, (int) 813, (String) "A-LAN Technologie"),
+ M_VOLTAN_TECHNOLOGY((int) 753, (int) 814, (String) "Voltan Technology"),
+ M_BAERWINKEL_AND_STRASSER_GMBH((int) 754, (int) 815, (String) "Baerwinkel &
Strasser GmbH"),
+ M_CATERLUX((int) 755, (int) 816, (String) "Caterlux"),
+ M_ABB___RESERVED((int) 756, (int) 43954, (String) "ABB - reserved"),
M_BUSCH_JAEGER_ELEKTRO___RESERVED(
- (int) 753, (int) 43959, (String) "Busch-Jaeger Elektro - reserved");
+ (int) 757, (int) 43959, (String) "Busch-Jaeger Elektro - reserved");
private static final Map<Integer, KnxManufacturer> map;
static {
diff --git
a/plc4j/drivers/modbus/src/main/generated/org/apache/plc4x/java/modbus/readwrite/Constants.java
b/plc4j/drivers/modbus/src/main/generated/org/apache/plc4x/java/modbus/readwrite/Constants.java
new file mode 100644
index 0000000000..24cd5b5012
--- /dev/null
+++
b/plc4j/drivers/modbus/src/main/generated/org/apache/plc4x/java/modbus/readwrite/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://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.java.modbus.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer MODBUSTCPDEFAULTPORT = 502;
+}
diff --git
a/plc4j/drivers/modbus/src/main/generated/org/apache/plc4x/java/modbus/readwrite/ModbusConstants.java
b/plc4j/drivers/modbus/src/main/generated/org/apache/plc4x/java/modbus/readwrite/ModbusConstants.java
deleted file mode 100644
index 0deb0866cd..0000000000
---
a/plc4j/drivers/modbus/src/main/generated/org/apache/plc4x/java/modbus/readwrite/ModbusConstants.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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
- *
- * https://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.java.modbus.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class ModbusConstants implements Message {
-
- // Constant values.
- public static final Integer MODBUSTCPDEFAULTPORT = 502;
-
- public ModbusConstants() {
- super();
- }
-
- public int getModbusTcpDefaultPort() {
- return MODBUSTCPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("ModbusConstants");
-
- // Const Field (modbusTcpDefaultPort)
- writeConstField(
- "modbusTcpDefaultPort", MODBUSTCPDEFAULTPORT,
writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("ModbusConstants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- ModbusConstants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (modbusTcpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static ModbusConstants staticParse(ReadBuffer readBuffer) throws
ParseException {
- readBuffer.pullContext("ModbusConstants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int modbusTcpDefaultPort =
- readConstField(
- "modbusTcpDefaultPort",
- readUnsignedInt(readBuffer, 16),
- ModbusConstants.MODBUSTCPDEFAULTPORT);
-
- readBuffer.closeContext("ModbusConstants");
- // Create the instance
- ModbusConstants _modbusConstants;
- _modbusConstants = new ModbusConstants();
- return _modbusConstants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof ModbusConstants)) {
- return false;
- }
- ModbusConstants that = (ModbusConstants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/config/ModbusTcpTransportConfiguration.java
b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/config/ModbusTcpTransportConfiguration.java
index 506680e9bc..cb49696b1f 100644
---
a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/config/ModbusTcpTransportConfiguration.java
+++
b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/config/ModbusTcpTransportConfiguration.java
@@ -19,14 +19,14 @@
package org.apache.plc4x.java.modbus.tcp.config;
-import org.apache.plc4x.java.modbus.readwrite.ModbusConstants;
+import org.apache.plc4x.java.modbus.readwrite.Constants;
import org.apache.plc4x.java.transport.tcp.DefaultTcpTransportConfiguration;
public class ModbusTcpTransportConfiguration extends
DefaultTcpTransportConfiguration {
@Override
public int getDefaultPort() {
- return ModbusConstants.MODBUSTCPDEFAULTPORT;
+ return Constants.MODBUSTCPDEFAULTPORT;
}
}
diff --git
a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/discovery/ModbusPlcDiscoverer.java
b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/discovery/ModbusPlcDiscoverer.java
index 2527acdb4d..2d12659f05 100644
---
a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/discovery/ModbusPlcDiscoverer.java
+++
b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/tcp/discovery/ModbusPlcDiscoverer.java
@@ -104,7 +104,7 @@ public class ModbusPlcDiscoverer implements PlcDiscoverer {
try {
logger.info("Trying address: {}", possibleAddress);
// Try to get a connection to the given host and port.
- Socket socket = new Socket(possibleAddress.getHostAddress(),
ModbusConstants.MODBUSTCPDEFAULTPORT);
+ Socket socket = new Socket(possibleAddress.getHostAddress(),
Constants.MODBUSTCPDEFAULTPORT);
logger.info("Connected: {}", possibleAddress);
diff --git
a/plc4j/drivers/open-protocol/src/main/generated/org/apache/plc4x/java/openprotocol/readwrite/Constants.java
b/plc4j/drivers/open-protocol/src/main/generated/org/apache/plc4x/java/openprotocol/readwrite/Constants.java
index 1a0b1083e7..65a7e7b972 100644
---
a/plc4j/drivers/open-protocol/src/main/generated/org/apache/plc4x/java/openprotocol/readwrite/Constants.java
+++
b/plc4j/drivers/open-protocol/src/main/generated/org/apache/plc4x/java/openprotocol/readwrite/Constants.java
@@ -35,87 +35,8 @@ import org.apache.plc4x.java.spi.generation.*;
// Code generated by code-generation. DO NOT EDIT.
-public class Constants implements Message {
+public class Constants {
// Constant values.
public static final Integer TCPDEFAULTPORT = 4545;
-
- public Constants() {
- super();
- }
-
- public int getTcpDefaultPort() {
- return TCPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("Constants");
-
- // Const Field (tcpDefaultPort)
- writeConstField("tcpDefaultPort", TCPDEFAULTPORT,
writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("Constants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- Constants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (tcpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static Constants staticParse(ReadBuffer readBuffer) throws
ParseException {
- readBuffer.pullContext("Constants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int tcpDefaultPort =
- readConstField("tcpDefaultPort", readUnsignedInt(readBuffer, 16),
Constants.TCPDEFAULTPORT);
-
- readBuffer.closeContext("Constants");
- // Create the instance
- Constants _constants;
- _constants = new Constants();
- return _constants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof Constants)) {
- return false;
- }
- Constants that = (Constants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
}
diff --git
a/plc4j/drivers/plc4x/src/main/generated/org/apache/plc4x/java/plc4x/readwrite/Constants.java
b/plc4j/drivers/plc4x/src/main/generated/org/apache/plc4x/java/plc4x/readwrite/Constants.java
new file mode 100644
index 0000000000..5d34f46aa4
--- /dev/null
+++
b/plc4j/drivers/plc4x/src/main/generated/org/apache/plc4x/java/plc4x/readwrite/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://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.java.plc4x.readwrite;
+
+import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
+import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
+
+import java.time.*;
+import java.util.*;
+import org.apache.plc4x.java.api.exceptions.*;
+import org.apache.plc4x.java.api.value.*;
+import org.apache.plc4x.java.spi.codegen.*;
+import org.apache.plc4x.java.spi.codegen.fields.*;
+import org.apache.plc4x.java.spi.codegen.io.*;
+import org.apache.plc4x.java.spi.generation.*;
+
+// Code generated by code-generation. DO NOT EDIT.
+
+public class Constants {
+
+ // Constant values.
+ public static final Integer PLC4XTCPDEFAULTPORT = 59837;
+}
diff --git
a/plc4j/drivers/plc4x/src/main/generated/org/apache/plc4x/java/plc4x/readwrite/Plc4xConstants.java
b/plc4j/drivers/plc4x/src/main/generated/org/apache/plc4x/java/plc4x/readwrite/Plc4xConstants.java
deleted file mode 100644
index 08bba8fc8a..0000000000
---
a/plc4j/drivers/plc4x/src/main/generated/org/apache/plc4x/java/plc4x/readwrite/Plc4xConstants.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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
- *
- * https://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.java.plc4x.readwrite;
-
-import static org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.fields.FieldWriterFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataReaderFactory.*;
-import static org.apache.plc4x.java.spi.codegen.io.DataWriterFactory.*;
-import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
-
-import java.time.*;
-import java.util.*;
-import org.apache.plc4x.java.api.exceptions.*;
-import org.apache.plc4x.java.api.value.*;
-import org.apache.plc4x.java.spi.codegen.*;
-import org.apache.plc4x.java.spi.codegen.fields.*;
-import org.apache.plc4x.java.spi.codegen.io.*;
-import org.apache.plc4x.java.spi.generation.*;
-
-// Code generated by code-generation. DO NOT EDIT.
-
-public class Plc4xConstants implements Message {
-
- // Constant values.
- public static final Integer PLC4XTCPDEFAULTPORT = 59837;
-
- public Plc4xConstants() {
- super();
- }
-
- public int getPlc4xTcpDefaultPort() {
- return PLC4XTCPDEFAULTPORT;
- }
-
- public void serialize(WriteBuffer writeBuffer) throws SerializationException
{
- PositionAware positionAware = writeBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- writeBuffer.pushContext("Plc4xConstants");
-
- // Const Field (plc4xTcpDefaultPort)
- writeConstField("plc4xTcpDefaultPort", PLC4XTCPDEFAULTPORT,
writeUnsignedInt(writeBuffer, 16));
-
- writeBuffer.popContext("Plc4xConstants");
- }
-
- @Override
- public int getLengthInBytes() {
- return (int) Math.ceil((float) getLengthInBits() / 8.0);
- }
-
- @Override
- public int getLengthInBits() {
- int lengthInBits = 0;
- Plc4xConstants _value = this;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- // Const Field (plc4xTcpDefaultPort)
- lengthInBits += 16;
-
- return lengthInBits;
- }
-
- public static Plc4xConstants staticParse(ReadBuffer readBuffer) throws
ParseException {
- readBuffer.pullContext("Plc4xConstants");
- PositionAware positionAware = readBuffer;
- boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
-
- int plc4xTcpDefaultPort =
- readConstField(
- "plc4xTcpDefaultPort",
- readUnsignedInt(readBuffer, 16),
- Plc4xConstants.PLC4XTCPDEFAULTPORT);
-
- readBuffer.closeContext("Plc4xConstants");
- // Create the instance
- Plc4xConstants _plc4xConstants;
- _plc4xConstants = new Plc4xConstants();
- return _plc4xConstants;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof Plc4xConstants)) {
- return false;
- }
- Plc4xConstants that = (Plc4xConstants) o;
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash();
- }
-
- @Override
- public String toString() {
- WriteBufferBoxBased writeBufferBoxBased = new WriteBufferBoxBased(true,
true);
- try {
- writeBufferBoxBased.writeSerializable(this);
- } catch (SerializationException e) {
- throw new RuntimeException(e);
- }
- return "\n" + writeBufferBoxBased.getBox().toString() + "\n";
- }
-}
diff --git
a/plc4j/drivers/plc4x/src/main/java/org/apache/plc4x/java/plc4x/config/Plc4xTcpTransportConfiguration.java
b/plc4j/drivers/plc4x/src/main/java/org/apache/plc4x/java/plc4x/config/Plc4xTcpTransportConfiguration.java
index fcfce6f01e..cb51004fab 100644
---
a/plc4j/drivers/plc4x/src/main/java/org/apache/plc4x/java/plc4x/config/Plc4xTcpTransportConfiguration.java
+++
b/plc4j/drivers/plc4x/src/main/java/org/apache/plc4x/java/plc4x/config/Plc4xTcpTransportConfiguration.java
@@ -19,14 +19,14 @@
package org.apache.plc4x.java.plc4x.config;
-import org.apache.plc4x.java.plc4x.readwrite.Plc4xConstants;
+import org.apache.plc4x.java.plc4x.readwrite.Constants;
import org.apache.plc4x.java.transport.tcp.DefaultTcpTransportConfiguration;
public class Plc4xTcpTransportConfiguration extends
DefaultTcpTransportConfiguration {
@Override
public int getDefaultPort() {
- return Plc4xConstants.PLC4XTCPDEFAULTPORT;
+ return Constants.PLC4XTCPDEFAULTPORT;
}
}
diff --git
a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/bacnet/BacnetServerModule.java
b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/bacnet/BacnetServerModule.java
index 6459a0c82b..a907a0fb74 100644
---
a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/bacnet/BacnetServerModule.java
+++
b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/bacnet/BacnetServerModule.java
@@ -32,7 +32,7 @@ import io.netty.handler.codec.MessageToMessageEncoder;
import io.netty.util.concurrent.FastThreadLocal;
import org.apache.plc4x.java.bacnetip.BacNetIpDriver;
import org.apache.plc4x.java.bacnetip.readwrite.BVLC;
-import org.apache.plc4x.java.bacnetip.readwrite.BacnetConstants;
+import org.apache.plc4x.java.bacnetip.readwrite.Constants;
import org.apache.plc4x.java.spi.connection.GeneratedProtocolMessageCodec;
import org.apache.plc4x.java.spi.generation.ByteOrder;
import org.apache.plc4x.simulator.PlcSimulatorConfig;
@@ -109,7 +109,7 @@ public class BacnetServerModule implements ServerModule {
}
});
- int port = BacnetConstants.BACNETUDPDEFAULTPORT;
+ int port = Constants.BACNETUDPDEFAULTPORT;
if (config.getCBusPort() != null) {
port = Integer.parseInt(config.getCBusPort());
}
diff --git
a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
index 1e6f8f02e2..94653a74b2 100644
---
a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
+++
b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
@@ -27,7 +27,7 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import org.apache.plc4x.java.cbus.CBusDriver;
-import org.apache.plc4x.java.cbus.readwrite.CBusConstants;
+import org.apache.plc4x.java.cbus.readwrite.Constants;
import org.apache.plc4x.java.cbus.readwrite.CBusMessage;
import org.apache.plc4x.java.cbus.readwrite.CBusOptions;
import org.apache.plc4x.java.cbus.readwrite.RequestContext;
@@ -95,7 +95,7 @@ public class CBusServerModule implements ServerModule {
.option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true);
- int port = CBusConstants.CBUSTCPDEFAULTPORT;
+ int port = Constants.CBUSTCPDEFAULTPORT;
if (config.getCBusPort() != null) {
port = Integer.parseInt(config.getCBusPort());
}
diff --git a/pom.xml b/pom.xml
index 5e8056ac53..a6725d1688 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,7 +100,7 @@
<sonar.cfamily.build-wrapper-output>${project.basedir}/plc4c/target/build-wrapper-output
</sonar.cfamily.build-wrapper-output>
- <plc4x-code-generation.version>1.8.0</plc4x-code-generation.version>
+
<plc4x-code-generation.version>1.9.0-SNAPSHOT</plc4x-code-generation.version>
<antlr.version>4.13.2</antlr.version>
<apiguardian.version>1.1.2</apiguardian.version>
diff --git a/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec
b/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec
index a8bcb78dd3..010a8e862e 100644
--- a/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec
+++ b/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec
@@ -17,7 +17,7 @@
* under the License.
*/
-[type AdsDiscoveryConstants
+[constants
[const uint 16 adsDiscoveryUdpDefaultPort 48899]
]
diff --git a/protocols/ads/src/main/resources/protocols/ads/ads.mspec
b/protocols/ads/src/main/resources/protocols/ads/ads.mspec
index 5835e7b690..109523320c 100644
--- a/protocols/ads/src/main/resources/protocols/ads/ads.mspec
+++ b/protocols/ads/src/main/resources/protocols/ads/ads.mspec
@@ -17,7 +17,7 @@
* under the License.
*/
-[type AdsConstants
+[constants
[const uint 16 adsTcpDefaultPort 48898]
]
diff --git
a/protocols/bacnetip/src/main/generated/protocols/bacnetip/bacnet-vendorids.mspec
b/protocols/bacnetip/src/main/generated/protocols/bacnetip/bacnet-vendorids.mspec
index 1cf6705cfa..6faad002cc 100644
---
a/protocols/bacnetip/src/main/generated/protocols/bacnetip/bacnet-vendorids.mspec
+++
b/protocols/bacnetip/src/main/generated/protocols/bacnetip/bacnet-vendorids.mspec
@@ -1571,6 +1571,13 @@
['1557' ZAPHIREAS ['1557', '"Zaphire AS"']]
['1558' AJ_MANUFACTURING ['1558', '"AJ Manufacturing"']]
['1559' FUTURE_MOTORS_LTD ['1559', '"Future Motors Ltd."']]
+ ['1560' HIMEL_HONG_KONG_LIMITED ['1560', '"Himel Hong Kong Limited"']]
+ ['1561' SHENZHEN_SUNRICHER_TECHNOLOGY_CO_LTD ['1561', '"Shenzhen Sunricher
Technology Co., Ltd."']]
+ ['1562' ACTILITYSA ['1562', '"Actility S.A."']]
+ ['1563' OY_HALTON_GROUP_LTD ['1563', '"Oy Halton Group Ltd."']]
+ ['1564' AVTECH_SOFTWARE_INC ['1564', '"AVTECH Software, Inc."']]
+ ['1565' IN_CONTROL_ENGINEERINGLLC ['1565', '"InControl Engineering LLC"']]
+ ['1566' SOUND_WATER_TECHNOLOGIESLLC ['1566', '"SoundWater Technologies
LLC"']]
['0xFFFF' UNKNOWN_VENDOR ['0xFFFF', '"Unknown"']]
]
diff --git
a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-tags.mspec
b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-tags.mspec
index 9feddfe8fc..6af4bfdb8a 100644
--- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-tags.mspec
+++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-tags.mspec
@@ -202,6 +202,8 @@
]
[type BACnetTagPayloadBoolean(uint 32 actualLength)
+ // TODO: example [state uint 32 actualLength]
+ // [state bit value 'actualLength == 1']
[virtual bit value 'actualLength == 1' ]
[virtual bit isTrue 'value' ]
[virtual bit isFalse '!value' ]
diff --git
a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
index c9c81f9a60..48e926f985 100644
--- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
+++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
@@ -17,7 +17,7 @@
* under the License.
*/
-[type BacnetConstants
+[constants
[const uint 16 bacnetUdpDefaultPort 47808]
]
diff --git a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
index 71e31493b8..93a67c920d 100644
--- a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
+++ b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
@@ -17,7 +17,7 @@
* under the License.
*/
-[type CBusConstants
+[constants
[const uint 16 cbusTcpDefaultPort 10001]
]
@@ -25,6 +25,35 @@
// Useful for response parsing: Set this to true if you send a identify
request before. This will change the way the response will be parsed
[simple bit sendIdentifyRequestBefore ]
]
+// TODO: idee
+//[context
+// Access via "context.sendIdentifyRequestBefore"
+// // Useful for response parsing: Set this to true if you send a identify
request before. This will change the way the response will be parsed
+// [simple bit sendIdentifyRequestBefore ]
+//]
+
+// TODO: we need global options that can be set
+//[global
+// Access via "global.srchk"
+//// Defines that SAL messages can occur at any time
+//[simple bit connect]
+//// Disable echo of characters. When used with connect SAL have a long
option. Select long from of most CAL replies
+//[simple bit smart ]
+//// only works with smart. Select long form of CAL messages
+//[simple bit idmon ]
+//// useful with smart. Select long form, extended format for all monitored
and initiated status requests
+//[simple bit exstat ]
+//// monitors all traffic for status requests. Status requests will be
returned as CAL. Replies are modified by exstat. Usually used in conjunction
with connect.
+//[simple bit monitor]
+//// Same as connect. In addition it will return remote network SAL
+//[simple bit monall ]
+//// Serial interface will emit a power up notification
+//[simple bit pun ]
+//// causes parameter change notifications to be emitted.
+//[simple bit pcn ]
+//// enabled the checksum checks
+//[simple bit srchk ]
+//]
[type CBusOptions
// Defines that SAL messages can occur at any time
diff --git a/protocols/eip/src/main/resources/protocols/eip/eip.mspec
b/protocols/eip/src/main/resources/protocols/eip/eip.mspec
index da2c40ba01..c252c45bf8 100644
--- a/protocols/eip/src/main/resources/protocols/eip/eip.mspec
+++ b/protocols/eip/src/main/resources/protocols/eip/eip.mspec
@@ -17,7 +17,7 @@
* under the License.
*/
- [type EipConstants
+ [constants
[const uint 16 eipUdpDiscoveryDefaultPort 44818]
[const uint 16 eipTcpDefaultPort 44818]
]
diff --git
a/protocols/iec-60870/src/main/resources/protocols/iec608705104/iec-60870-5-104.mspec
b/protocols/iec-60870/src/main/resources/protocols/iec608705104/iec-60870-5-104.mspec
index 133c690252..07a8191c6a 100644
---
a/protocols/iec-60870/src/main/resources/protocols/iec608705104/iec-60870-5-104.mspec
+++
b/protocols/iec-60870/src/main/resources/protocols/iec608705104/iec-60870-5-104.mspec
@@ -19,7 +19,7 @@
// https://www.fit.vut.cz/research/publication-file/11570/TR-IEC104.pdf
-[type IEC608705104Constants
+[constants
[const uint 16 defaultPort 2404]
]
diff --git
a/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec
b/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec
index 2fa0dcf7d3..ac696d7461 100644
---
a/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec
+++
b/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec
@@ -1490,7 +1490,7 @@
['738' M_ZHONGSHAN_ILLUS_LIGHTING_CO__LTD ['799', '"Zhongshan Illus
LIghting Co.,Ltd"']]
['739' M_HANGZHOU_KONKE_INFORMATION_TECHNOLOGY_CO___LTD_ ['800',
'"Hangzhou Konke Information Technology Co., Ltd."']]
['740' M_SHANGHAI_FANTE_DIGITAL_TECHNOLOGY_CO___LTD ['801', '"Shanghai
Fante Digital Technology Co., Ltd"']]
- ['741' M_CONFIO ['802', '"CONFIO"']]
+ ['741' M_CONFIO_TECHNOLOGIES_PVT__LTD ['802', '"Confio Technologies Pvt.
Ltd"']]
['742' M_SONIC_TECHNOLOGIES ['803', '"Sonic Technologies"']]
['743' M_SHANGHAI_INNOVATECH_INFORMATION_TECHNOLOGY_CO___LT ['804',
'"Shanghai Innovatech Information Technology Co., Lt"']]
['744' M_ABI_SICHERHEITSSYSTEME_GMBH ['805', '"ABI Sicherheitssysteme
GmbH"']]
@@ -1501,8 +1501,12 @@
['749' M_ROGERWELL_CONTROL_SYSTEM_LIMITED ['810', '"Rogerwell Control
System Limited"']]
['750' M_SHANGHAI_YUKON_AUTOMATION_TECHNOLOGIES_CO___LTD_ ['811',
'"Shanghai YUKON Automation Technologies Co., Ltd."']]
['751' M_TECCO_PTY_LTD ['812', '"Tecco Pty Ltd"']]
- ['752' M_ABB___RESERVED ['43954', '"ABB - reserved"']]
- ['753' M_BUSCH_JAEGER_ELEKTRO___RESERVED ['43959', '"Busch-Jaeger Elektro
- reserved"']]
+ ['752' M_A_LAN_TECHNOLOGIE ['813', '"A-LAN Technologie"']]
+ ['753' M_VOLTAN_TECHNOLOGY ['814', '"Voltan Technology"']]
+ ['754' M_BAERWINKEL_AND_STRASSER_GMBH ['815', '"Baerwinkel & Strasser
GmbH"']]
+ ['755' M_CATERLUX ['816', '"Caterlux"']]
+ ['756' M_ABB___RESERVED ['43954', '"ABB - reserved"']]
+ ['757' M_BUSCH_JAEGER_ELEKTRO___RESERVED ['43959', '"Busch-Jaeger Elektro
- reserved"']]
]
diff --git a/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
b/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
index b5b21fe96e..6496e3b416 100644
--- a/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
+++ b/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
@@ -21,7 +21,7 @@
// Remark: The different fields are encoded in Big-endian.
-[type ModbusConstants
+[constants
[const uint 16 modbusTcpDefaultPort 502]
]
diff --git
a/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
b/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
index 0a35e16441..b6151f3420 100644
---
a/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
+++
b/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
@@ -20,7 +20,7 @@
// Spec available from here:
//
https://de.scribd.com/document/428086428/OpenProtocol-Specification-R-2-8-0-9836-4415-01
-[type Constants
+[constants
[const uint 16 tcpDefaultPort 4545]
]
diff --git a/protocols/plc4x/src/main/resources/protocols/plc4x/v0/plc4x.mspec
b/protocols/plc4x/src/main/resources/protocols/plc4x/v0/plc4x.mspec
index 63de2c00a8..c17156c007 100644
--- a/protocols/plc4x/src/main/resources/protocols/plc4x/v0/plc4x.mspec
+++ b/protocols/plc4x/src/main/resources/protocols/plc4x/v0/plc4x.mspec
@@ -17,7 +17,7 @@
* under the License.
*/
-[type Plc4xConstants
+[constants
[const uint 16 plc4xTcpDefaultPort 59837] // Hex of CAFE
]
diff --git a/protocols/umas/src/main/resources/protocols/umas/umas.mspec
b/protocols/umas/src/main/resources/protocols/umas/umas.mspec
index cf65be4c06..102e971dc0 100644
--- a/protocols/umas/src/main/resources/protocols/umas/umas.mspec
+++ b/protocols/umas/src/main/resources/protocols/umas/umas.mspec
@@ -21,7 +21,7 @@
// Remark: The different fields are encoded in Big-endian.
-[type UmasConstants
+[constants
[const uint 16 UmasTcpDefaultPort 502]
]