diff --git a/.asf.yaml b/.asf.yaml old mode 100644 new mode 100755 diff --git a/.dockerignore b/.dockerignore old mode 100644 new mode 100755 diff --git a/.editorconfig b/.editorconfig old mode 100644 new mode 100755 diff --git a/.github/dependabot.yml b/.github/dependabot.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 743d1e00eb5..7d945db5d1b 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: BobAnkh/auto-generate-changelog@v1.2.3 + - uses: BobAnkh/auto-generate-changelog@v1.2.4 with: ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}} TYPE: 'feat:Feature,fix:Bug Fixes,docs:Documentation,refactor:Refactor,perf:Performance Improvements' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/ensure-platforms.yml b/.github/workflows/ensure-platforms.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/sast.yaml b/.github/workflows/sast.yaml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/Go Application.go b/.idea/fileTemplates/Go Application.go old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/Go File.go b/.idea/fileTemplates/Go File.go old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/Go Scratch.go b/.idea/fileTemplates/Go Scratch.go old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/Properties File.properties b/.idea/fileTemplates/Properties File.properties old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/XML File.xml b/.idea/fileTemplates/XML File.xml old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/Yaml FIle.yaml b/.idea/fileTemplates/Yaml FIle.yaml old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/Yml File.yml b/.idea/fileTemplates/Yml File.yml old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/includes/C File Header.h b/.idea/fileTemplates/includes/C File Header.h old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/includes/File Header Go.go b/.idea/fileTemplates/includes/File Header Go.go old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/includes/File Header Properties.properties b/.idea/fileTemplates/includes/File Header Properties.properties old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/includes/File Header XML.xml b/.idea/fileTemplates/includes/File Header XML.xml old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/includes/File Header Yaml.yaml b/.idea/fileTemplates/includes/File Header Yaml.yaml old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/includes/File Header Yml.yml b/.idea/fileTemplates/includes/File Header Yml.yml old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/includes/File Header.java b/.idea/fileTemplates/includes/File Header.java old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/internal/AnnotationType.java b/.idea/fileTemplates/internal/AnnotationType.java old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/internal/Class.java b/.idea/fileTemplates/internal/Class.java old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/internal/Enum.java b/.idea/fileTemplates/internal/Enum.java old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/internal/Interface.java b/.idea/fileTemplates/internal/Interface.java old mode 100644 new mode 100755 diff --git a/.idea/fileTemplates/internal/Record.java b/.idea/fileTemplates/internal/Record.java old mode 100644 new mode 100755 diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml old mode 100644 new mode 100755 diff --git a/.mvn/jvm.config b/.mvn/jvm.config old mode 100644 new mode 100755 diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java old mode 100644 new mode 100755 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties old mode 100644 new mode 100755 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md old mode 100644 new mode 100755 diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 diff --git a/Jenkinsfile b/Jenkinsfile old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/NOTICE b/NOTICE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/RELEASE_NOTES b/RELEASE_NOTES old mode 100644 new mode 100755 diff --git a/build-reproducible.sh b/build-reproducible.sh old mode 100644 new mode 100755 diff --git a/code-generation/language-base-freemarker/pom.xml b/code-generation/language-base-freemarker/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/BaseFreemarkerLanguageTemplateHelper.java b/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/BaseFreemarkerLanguageTemplateHelper.java old mode 100644 new mode 100755 diff --git a/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerException.java b/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerException.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageTemplateHelper.java b/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageTemplateHelper.java old mode 100644 new mode 100755 diff --git a/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/Tracer.java b/code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/Tracer.java old mode 100644 new mode 100755 diff --git a/code-generation/language-base-freemarker/src/test/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/TracerTest.java b/code-generation/language-base-freemarker/src/test/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/TracerTest.java old mode 100644 new mode 100755 diff --git a/code-generation/language-c/pom.xml b/code-generation/language-c/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageOutput.java b/code-generation/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageOutput.java old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java b/code-generation/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput b/code-generation/language-c/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/resources/templates/c/complex-type-template.c.ftlh b/code-generation/language-c/src/main/resources/templates/c/complex-type-template.c.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/resources/templates/c/complex-type-template.h.ftlh b/code-generation/language-c/src/main/resources/templates/c/complex-type-template.h.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/resources/templates/c/data-io-template.c.ftlh b/code-generation/language-c/src/main/resources/templates/c/data-io-template.c.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/resources/templates/c/data-io-template.h.ftlh b/code-generation/language-c/src/main/resources/templates/c/data-io-template.h.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/resources/templates/c/enum-template.c.ftlh b/code-generation/language-c/src/main/resources/templates/c/enum-template.c.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/main/resources/templates/c/enum-template.h.ftlh b/code-generation/language-c/src/main/resources/templates/c/enum-template.h.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/test/resources/integration-test/CMakeLists.txt b/code-generation/language-c/src/test/resources/integration-test/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/test/resources/integration-test/generated-sources/CMakeLists.txt b/code-generation/language-c/src/test/resources/integration-test/generated-sources/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/test/resources/integration-test/generated-sources/test/CMakeLists.txt b/code-generation/language-c/src/test/resources/integration-test/generated-sources/test/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/test/resources/integration-test/include/plc4c/driver_test_static.h b/code-generation/language-c/src/test/resources/integration-test/include/plc4c/driver_test_static.h old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/test/resources/integration-test/pom.xml b/code-generation/language-c/src/test/resources/integration-test/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-c/src/test/resources/settings.xml b/code-generation/language-c/src/test/resources/settings.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/pom.xml b/code-generation/language-cs/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/src/main/java/org/apache/plc4x/language/cs/CsLanguageOutput.java b/code-generation/language-cs/src/main/java/org/apache/plc4x/language/cs/CsLanguageOutput.java old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/src/main/java/org/apache/plc4x/language/cs/CsLanguageTemplateHelper.java b/code-generation/language-cs/src/main/java/org/apache/plc4x/language/cs/CsLanguageTemplateHelper.java old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput b/code-generation/language-cs/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/src/main/resources/templates/cs/data-io-template.cs.ftlh b/code-generation/language-cs/src/main/resources/templates/cs/data-io-template.cs.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/src/main/resources/templates/cs/enum-template.cs.ftlh b/code-generation/language-cs/src/main/resources/templates/cs/enum-template.cs.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/src/main/resources/templates/cs/io-template.cs.ftlh b/code-generation/language-cs/src/main/resources/templates/cs/io-template.cs.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-cs/src/main/resources/templates/cs/model-template.cs.ftlh b/code-generation/language-cs/src/main/resources/templates/cs/model-template.cs.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-go/pom.xml b/code-generation/language-go/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageOutput.java b/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageOutput.java old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageTemplateHelper.java b/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageTemplateHelper.java old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput b/code-generation/language-go/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/resources/templates/go/complex-type-template.go.ftlh b/code-generation/language-go/src/main/resources/templates/go/complex-type-template.go.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/resources/templates/go/data-io-template.go.ftlh b/code-generation/language-go/src/main/resources/templates/go/data-io-template.go.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/resources/templates/go/enum-template.go.ftlh b/code-generation/language-go/src/main/resources/templates/go/enum-template.go.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/resources/templates/go/parser-factory-template.go.ftlh b/code-generation/language-go/src/main/resources/templates/go/parser-factory-template.go.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/main/resources/templates/go/xml-parser-factory-template.go.ftlh b/code-generation/language-go/src/main/resources/templates/go/xml-parser-factory-template.go.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/test/resources/plc4go/go.mod b/code-generation/language-go/src/test/resources/plc4go/go.mod old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/test/resources/plc4go/pom.xml b/code-generation/language-go/src/test/resources/plc4go/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/test/resources/plc4go/protocols/test/readwrite/model/StaticHelper.go b/code-generation/language-go/src/test/resources/plc4go/protocols/test/readwrite/model/StaticHelper.go old mode 100644 new mode 100755 diff --git a/code-generation/language-go/src/test/resources/settings.xml b/code-generation/language-go/src/test/resources/settings.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-java/pom.xml b/code-generation/language-java/pom.xml old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/main/java/org/apache/plc4x/language/java/JavaLanguageTemplateHelper.java b/code-generation/language-java/src/main/java/org/apache/plc4x/language/java/JavaLanguageTemplateHelper.java old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput b/code-generation/language-java/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.language.LanguageOutput old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/main/resources/templates/java/complex-type-template.java.ftlh b/code-generation/language-java/src/main/resources/templates/java/complex-type-template.java.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/main/resources/templates/java/data-io-template.java.ftlh b/code-generation/language-java/src/main/resources/templates/java/data-io-template.java.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/main/resources/templates/java/enum-template.java.ftlh b/code-generation/language-java/src/main/resources/templates/java/enum-template.java.ftlh old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/test/resources/integration-test/pom.xml b/code-generation/language-java/src/test/resources/integration-test/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/test/resources/integration-test/src/main/java/org/apache/plc4x/java/test/readwrite/utils/StaticHelper.java b/code-generation/language-java/src/test/resources/integration-test/src/main/java/org/apache/plc4x/java/test/readwrite/utils/StaticHelper.java old mode 100644 new mode 100755 diff --git a/code-generation/language-java/src/test/resources/settings.xml b/code-generation/language-java/src/test/resources/settings.xml old mode 100644 new mode 100755 diff --git a/code-generation/pom.xml b/code-generation/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/pom.xml b/code-generation/protocol-base-mspec/pom.xml old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/Expression.g4 b/code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/Expression.g4 old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/LazyTypeDefinitionConsumer.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/LazyTypeDefinitionConsumer.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringListener.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringListener.java old mode 100644 new mode 100755 index 4c5f3dd313a..6bc2cc9c328 --- a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringListener.java +++ b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringListener.java @@ -153,6 +153,7 @@ private void schedulePropertyResolution(String propertyName, CompletableFuture defaultArgument = complexTypeDefinition.getAllParserArguments().orElseThrow().stream() diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringParser.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringParser.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultArgument.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultArgument.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultComplexTypeDefinition.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultComplexTypeDefinition.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultDataIoTypeDefinition.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultDataIoTypeDefinition.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultDiscriminatedComplexTypeDefinition.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultDiscriminatedComplexTypeDefinition.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultEnumTypeDefinition.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultEnumTypeDefinition.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultEnumValue.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultEnumValue.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultTypeDefinition.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/definitions/DefaultTypeDefinition.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultAbstractField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultAbstractField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultArrayField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultArrayField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultAssertField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultAssertField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultChecksumField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultChecksumField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultConstField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultConstField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultDiscriminatorField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultDiscriminatorField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultEnumField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultEnumField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultImplicitField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultImplicitField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultManualArrayField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultManualArrayField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultManualField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultManualField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultOptionalField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultOptionalField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultPaddingField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultPaddingField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultPeekField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultPeekField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultReservedField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultReservedField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultSimpleField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultSimpleField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultSwitchField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultSwitchField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultTypedField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultTypedField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultTypedNamedField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultTypedNamedField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultUnknownField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultUnknownField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultValidationField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultValidationField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultVirtualField.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/fields/DefaultVirtualField.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/AbstractSimpleTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/AbstractSimpleTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultArrayTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultArrayTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultBooleanTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultBooleanTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultByteTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultByteTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultComplexTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultComplexTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultDataIoTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultDataIoTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultEnumTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultEnumTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultFloatTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultFloatTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultIntegerTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultIntegerTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultSimpleVarLengthTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultSimpleVarLengthTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultStringTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultStringTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultTemporalTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultTemporalTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultUndefinedTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultUndefinedTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultVintegerTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultVintegerTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultVstringTypeReference.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/references/DefaultVstringTypeReference.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultBinaryTerm.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultBinaryTerm.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultBooleanLiteral.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultBooleanLiteral.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultHexadecimalLiteral.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultHexadecimalLiteral.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultNullLiteral.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultNullLiteral.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultNumericLiteral.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultNumericLiteral.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultStringLiteral.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultStringLiteral.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultTernaryTerm.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultTernaryTerm.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultUnaryTerm.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultUnaryTerm.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultVariableLiteral.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/DefaultVariableLiteral.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/WildcardTerm.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/model/terms/WildcardTerm.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatParser.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatParser.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/protocol/ProtocolHelpers.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/protocol/ProtocolHelpers.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/protocol/ValidatableTypeContext.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/protocol/ValidatableTypeContext.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/remote-resources/LICENSE b/code-generation/protocol-base-mspec/src/remote-resources/LICENSE old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/remote-resources/UNLICENSE b/code-generation/protocol-base-mspec/src/remote-resources/UNLICENSE old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/test/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringParserTest.java b/code-generation/protocol-base-mspec/src/test/java/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/ExpressionStringParserTest.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/test/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatParserTest.java b/code-generation/protocol-base-mspec/src/test/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatParserTest.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/test/resources/logback-test.xml b/code-generation/protocol-base-mspec/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/test/resources/mspec.example b/code-generation/protocol-base-mspec/src/test/resources/mspec.example old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/test/resources/mspec.example2 b/code-generation/protocol-base-mspec/src/test/resources/mspec.example2 old mode 100644 new mode 100755 diff --git a/code-generation/protocol-base-mspec/src/test/resources/mspec.example3 b/code-generation/protocol-base-mspec/src/test/resources/mspec.example3 old mode 100644 new mode 100755 diff --git a/code-generation/protocol-test/pom.xml b/code-generation/protocol-test/pom.xml old mode 100644 new mode 100755 diff --git a/code-generation/protocol-test/src/main/java/org/apache/plc4x/protocol/test/TestProtocol.java b/code-generation/protocol-test/src/main/java/org/apache/plc4x/protocol/test/TestProtocol.java old mode 100644 new mode 100755 diff --git a/code-generation/protocol-test/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/code-generation/protocol-test/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/code-generation/protocol-test/src/main/resources/protocols/test/test.mspec b/code-generation/protocol-test/src/main/resources/protocols/test/test.mspec old mode 100644 new mode 100755 diff --git a/code-generation/protocol-test/src/site/asciidoc/index.adoc b/code-generation/protocol-test/src/site/asciidoc/index.adoc old mode 100644 new mode 100755 diff --git a/code-generation/protocol-test/src/site/site.xml b/code-generation/protocol-test/src/site/site.xml old mode 100644 new mode 100755 diff --git a/compare-reproducible.sh b/compare-reproducible.sh old mode 100644 new mode 100755 diff --git a/jenkins.pom b/jenkins.pom old mode 100644 new mode 100755 diff --git a/licenses/UNLICENSE b/licenses/UNLICENSE old mode 100644 new mode 100755 diff --git a/media/PLC4X_rollup_83x237cm-final.pdf b/media/PLC4X_rollup_83x237cm-final.pdf old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/PLC4X logo without mascot@300x.png b/media/logos/300ppi/PLC4X logo without mascot@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/PLC4X.png b/media/logos/300ppi/PLC4X.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/Toddy colorize@300x.png b/media/logos/300ppi/Toddy colorize@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/logo PLC4X black line@300x.png b/media/logos/300ppi/logo PLC4X black line@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/logo PLC4X color CMYK@300x.png b/media/logos/300ppi/logo PLC4X color CMYK@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/logo PLC4X on dark bg@300x.png b/media/logos/300ppi/logo PLC4X on dark bg@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/logo PLC4X white line@300x.png b/media/logos/300ppi/logo PLC4X white line@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/mascot color with apache feather@300x.png b/media/logos/300ppi/mascot color with apache feather@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/300ppi/mascot color without feather@300x.png b/media/logos/300ppi/mascot color without feather@300x.png old mode 100644 new mode 100755 diff --git a/media/logos/PDF/PLC4X logo without mascot.pdf b/media/logos/PDF/PLC4X logo without mascot.pdf old mode 100644 new mode 100755 diff --git a/media/logos/PDF/Toddy colorize.pdf b/media/logos/PDF/Toddy colorize.pdf old mode 100644 new mode 100755 diff --git a/media/logos/PDF/logo PLC4X black line.pdf b/media/logos/PDF/logo PLC4X black line.pdf old mode 100644 new mode 100755 diff --git a/media/logos/PDF/logo PLC4X color CMYK@300x.pdf b/media/logos/PDF/logo PLC4X color CMYK@300x.pdf old mode 100644 new mode 100755 diff --git a/media/logos/PDF/logo PLC4X on dark bg.pdf b/media/logos/PDF/logo PLC4X on dark bg.pdf old mode 100644 new mode 100755 diff --git a/media/logos/PDF/logo PLC4X white line.pdf b/media/logos/PDF/logo PLC4X white line.pdf old mode 100644 new mode 100755 diff --git a/media/logos/PDF/mascot color with apache feather.pdf b/media/logos/PDF/mascot color with apache feather.pdf old mode 100644 new mode 100755 diff --git a/media/logos/PDF/mascot color without feather.pdf b/media/logos/PDF/mascot color without feather.pdf old mode 100644 new mode 100755 diff --git a/media/logos/SVG/PLC4X logo without mascot.svg b/media/logos/SVG/PLC4X logo without mascot.svg old mode 100644 new mode 100755 diff --git a/media/logos/SVG/logo PLC4X black line only toddy.svg b/media/logos/SVG/logo PLC4X black line only toddy.svg old mode 100644 new mode 100755 diff --git a/media/logos/SVG/logo PLC4X black line.svg b/media/logos/SVG/logo PLC4X black line.svg old mode 100644 new mode 100755 diff --git a/media/logos/SVG/logo PLC4X color CMYK@300x.svg b/media/logos/SVG/logo PLC4X color CMYK@300x.svg old mode 100644 new mode 100755 diff --git a/media/logos/SVG/logo PLC4X on dark bg.svg b/media/logos/SVG/logo PLC4X on dark bg.svg old mode 100644 new mode 100755 diff --git a/media/logos/SVG/logo PLC4X white line.svg b/media/logos/SVG/logo PLC4X white line.svg old mode 100644 new mode 100755 diff --git a/media/logos/SVG/mascot color with apache feather.svg b/media/logos/SVG/mascot color with apache feather.svg old mode 100644 new mode 100755 diff --git a/media/logos/SVG/mascot color without feather.svg b/media/logos/SVG/mascot color without feather.svg old mode 100644 new mode 100755 diff --git a/media/powered-by-plc4x.png b/media/powered-by-plc4x.png old mode 100644 new mode 100755 diff --git a/media/release-image-template.svg b/media/release-image-template.svg old mode 100644 new mode 100755 diff --git a/media/toddy-loves-apache.png b/media/toddy-loves-apache.png old mode 100644 new mode 100755 diff --git a/mvnw.cmd b/mvnw.cmd old mode 100644 new mode 100755 diff --git a/plc4c/.clang-format b/plc4c/.clang-format old mode 100644 new mode 100755 diff --git a/plc4c/.gitignore b/plc4c/.gitignore old mode 100644 new mode 100755 diff --git a/plc4c/.idea/fileTemplates/includes/C File Header.h b/plc4c/.idea/fileTemplates/includes/C File Header.h old mode 100644 new mode 100755 diff --git a/plc4c/CMakeLists.txt b/plc4c/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/CODE_CONVENTIONS.md b/plc4c/CODE_CONVENTIONS.md old mode 100644 new mode 100755 diff --git a/plc4c/README.md b/plc4c/README.md old mode 100644 new mode 100755 diff --git a/plc4c/SonarcloudBuildWrapperHack.groovy b/plc4c/SonarcloudBuildWrapperHack.groovy old mode 100644 new mode 100755 diff --git a/plc4c/api/CMakeLists.txt b/plc4c/api/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/connection.h b/plc4c/api/include/plc4c/connection.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/data.h b/plc4c/api/include/plc4c/data.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/plc4c.h b/plc4c/api/include/plc4c/plc4c.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/read.h b/plc4c/api/include/plc4c/read.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/subscribe.h b/plc4c/api/include/plc4c/subscribe.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/system.h b/plc4c/api/include/plc4c/system.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/types.h b/plc4c/api/include/plc4c/types.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/utils/list.h b/plc4c/api/include/plc4c/utils/list.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/utils/queue.h b/plc4c/api/include/plc4c/utils/queue.h old mode 100644 new mode 100755 diff --git a/plc4c/api/include/plc4c/write.h b/plc4c/api/include/plc4c/write.h old mode 100644 new mode 100755 diff --git a/plc4c/build-utils/parser-serializer-testcase-generator.xsl b/plc4c/build-utils/parser-serializer-testcase-generator.xsl old mode 100644 new mode 100755 diff --git a/plc4c/design-guidelines.adoc b/plc4c/design-guidelines.adoc old mode 100644 new mode 100755 diff --git a/plc4c/drivers/CMakeLists.txt b/plc4c/drivers/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/CMakeLists.txt b/plc4c/drivers/modbus/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/include/plc4c/driver_modbus.h b/plc4c/drivers/modbus/include/plc4c/driver_modbus.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/include/plc4c/driver_modbus_encode_decode.h b/plc4c/drivers/modbus/include/plc4c/driver_modbus_encode_decode.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/include/plc4c/driver_modbus_packets.h b/plc4c/drivers/modbus/include/plc4c/driver_modbus_packets.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/include/plc4c/driver_modbus_sm.h b/plc4c/drivers/modbus/include/plc4c/driver_modbus_sm.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/include/plc4c/driver_modbus_static.h b/plc4c/drivers/modbus/include/plc4c/driver_modbus_static.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus.c b/plc4c/drivers/modbus/src/driver_modbus.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus_encode_decode.c b/plc4c/drivers/modbus/src/driver_modbus_encode_decode.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus_packets.c b/plc4c/drivers/modbus/src/driver_modbus_packets.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus_sm_connect.c b/plc4c/drivers/modbus/src/driver_modbus_sm_connect.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus_sm_disconnect.c b/plc4c/drivers/modbus/src/driver_modbus_sm_disconnect.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus_sm_read.c b/plc4c/drivers/modbus/src/driver_modbus_sm_read.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus_sm_write.c b/plc4c/drivers/modbus/src/driver_modbus_sm_write.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/modbus/src/driver_modbus_static.c b/plc4c/drivers/modbus/src/driver_modbus_static.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/CMakeLists.txt b/plc4c/drivers/plc4x/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/include/plc4c/driver_plc4x.h b/plc4c/drivers/plc4x/include/plc4c/driver_plc4x.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_encode_decode.h b/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_encode_decode.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_packets.h b/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_packets.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_sm.h b/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_sm.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_static.h b/plc4c/drivers/plc4x/include/plc4c/driver_plc4x_static.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x.c b/plc4c/drivers/plc4x/src/driver_plc4x.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x_encode_decode.c b/plc4c/drivers/plc4x/src/driver_plc4x_encode_decode.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x_packets.c b/plc4c/drivers/plc4x/src/driver_plc4x_packets.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x_sm_connect.c b/plc4c/drivers/plc4x/src/driver_plc4x_sm_connect.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x_sm_disconnect.c b/plc4c/drivers/plc4x/src/driver_plc4x_sm_disconnect.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x_sm_read.c b/plc4c/drivers/plc4x/src/driver_plc4x_sm_read.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x_sm_write.c b/plc4c/drivers/plc4x/src/driver_plc4x_sm_write.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/src/driver_plc4x_static.c b/plc4c/drivers/plc4x/src/driver_plc4x_static.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/plc4x/test/plc4x_test.c b/plc4c/drivers/plc4x/test/plc4x_test.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/CMakeLists.txt b/plc4c/drivers/s7/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/include/plc4c/driver_s7.h b/plc4c/drivers/s7/include/plc4c/driver_s7.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/include/plc4c/driver_s7_encode_decode.h b/plc4c/drivers/s7/include/plc4c/driver_s7_encode_decode.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/include/plc4c/driver_s7_packets.h b/plc4c/drivers/s7/include/plc4c/driver_s7_packets.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/include/plc4c/driver_s7_sm.h b/plc4c/drivers/s7/include/plc4c/driver_s7_sm.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/include/plc4c/driver_s7_static.h b/plc4c/drivers/s7/include/plc4c/driver_s7_static.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7.c b/plc4c/drivers/s7/src/driver_s7.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7_encode_decode.c b/plc4c/drivers/s7/src/driver_s7_encode_decode.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7_packets.c b/plc4c/drivers/s7/src/driver_s7_packets.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7_sm_connect.c b/plc4c/drivers/s7/src/driver_s7_sm_connect.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7_sm_disconnect.c b/plc4c/drivers/s7/src/driver_s7_sm_disconnect.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7_sm_read.c b/plc4c/drivers/s7/src/driver_s7_sm_read.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7_sm_write.c b/plc4c/drivers/s7/src/driver_s7_sm_write.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/src/driver_s7_static.c b/plc4c/drivers/s7/src/driver_s7_static.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/test/s7_address_parser_test.c b/plc4c/drivers/s7/test/s7_address_parser_test.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/s7/test/s7_test.c b/plc4c/drivers/s7/test/s7_test.c old mode 100644 new mode 100755 diff --git a/plc4c/drivers/simulated/CMakeLists.txt b/plc4c/drivers/simulated/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/drivers/simulated/include/plc4c/driver_simulated.h b/plc4c/drivers/simulated/include/plc4c/driver_simulated.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/simulated/include/plc4c/static_helper.h b/plc4c/drivers/simulated/include/plc4c/static_helper.h old mode 100644 new mode 100755 diff --git a/plc4c/drivers/simulated/src/driver_simulated.c b/plc4c/drivers/simulated/src/driver_simulated.c old mode 100644 new mode 100755 diff --git a/plc4c/examples/CMakeLists.txt b/plc4c/examples/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/examples/hello-subscriptions/CMakeLists.txt b/plc4c/examples/hello-subscriptions/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/examples/hello-subscriptions/src/hello_subscriptions.c b/plc4c/examples/hello-subscriptions/src/hello_subscriptions.c old mode 100644 new mode 100755 diff --git a/plc4c/examples/hello-world-modbus/CMakeLists.txt b/plc4c/examples/hello-world-modbus/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/examples/hello-world-modbus/src/hello_world_modbus.c b/plc4c/examples/hello-world-modbus/src/hello_world_modbus.c old mode 100644 new mode 100755 diff --git a/plc4c/examples/hello-world-s7/CMakeLists.txt b/plc4c/examples/hello-world-s7/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/examples/hello-world-s7/src/hello_world_s7.c b/plc4c/examples/hello-world-s7/src/hello_world_s7.c old mode 100644 new mode 100755 diff --git a/plc4c/examples/hello-world-s7/src/hello_world_s7_loopback.c b/plc4c/examples/hello-world-s7/src/hello_world_s7_loopback.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/data_item.h b/plc4c/generated-sources/modbus/include/data_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/driver_type.h b/plc4c/generated-sources/modbus/include/driver_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_adu.h b/plc4c/generated-sources/modbus/include/modbus_adu.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_constants.h b/plc4c/generated-sources/modbus/include/modbus_constants.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_data_type.h b/plc4c/generated-sources/modbus/include/modbus_data_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_device_information_conformity_level.h b/plc4c/generated-sources/modbus/include/modbus_device_information_conformity_level.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_device_information_level.h b/plc4c/generated-sources/modbus/include/modbus_device_information_level.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_device_information_more_follows.h b/plc4c/generated-sources/modbus/include/modbus_device_information_more_follows.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_device_information_object.h b/plc4c/generated-sources/modbus/include/modbus_device_information_object.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_error_code.h b/plc4c/generated-sources/modbus/include/modbus_error_code.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_pdu.h b/plc4c/generated-sources/modbus/include/modbus_pdu.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_pdu_read_file_record_request_item.h b/plc4c/generated-sources/modbus/include/modbus_pdu_read_file_record_request_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_pdu_read_file_record_response_item.h b/plc4c/generated-sources/modbus/include/modbus_pdu_read_file_record_response_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_pdu_write_file_record_request_item.h b/plc4c/generated-sources/modbus/include/modbus_pdu_write_file_record_request_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/include/modbus_pdu_write_file_record_response_item.h b/plc4c/generated-sources/modbus/include/modbus_pdu_write_file_record_response_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/data_item.c b/plc4c/generated-sources/modbus/src/data_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/driver_type.c b/plc4c/generated-sources/modbus/src/driver_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_adu.c b/plc4c/generated-sources/modbus/src/modbus_adu.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_constants.c b/plc4c/generated-sources/modbus/src/modbus_constants.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_data_type.c b/plc4c/generated-sources/modbus/src/modbus_data_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_device_information_conformity_level.c b/plc4c/generated-sources/modbus/src/modbus_device_information_conformity_level.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_device_information_level.c b/plc4c/generated-sources/modbus/src/modbus_device_information_level.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_device_information_more_follows.c b/plc4c/generated-sources/modbus/src/modbus_device_information_more_follows.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_device_information_object.c b/plc4c/generated-sources/modbus/src/modbus_device_information_object.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_error_code.c b/plc4c/generated-sources/modbus/src/modbus_error_code.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_pdu.c b/plc4c/generated-sources/modbus/src/modbus_pdu.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_request_item.c b/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_request_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_response_item.c b/plc4c/generated-sources/modbus/src/modbus_pdu_read_file_record_response_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_request_item.c b/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_request_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_response_item.c b/plc4c/generated-sources/modbus/src/modbus_pdu_write_file_record_response_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_constants.h b/plc4c/generated-sources/plc4x/include/plc4x_constants.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_field_request.h b/plc4c/generated-sources/plc4x/include/plc4x_field_request.h new file mode 100755 index 00000000000..88ad54a8cd9 --- /dev/null +++ b/plc4c/generated-sources/plc4x/include/plc4x_field_request.h @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#ifndef PLC4C_PLC4X_READ_WRITE_PLC4X_FIELD_REQUEST_H_ +#define PLC4C_PLC4X_READ_WRITE_PLC4X_FIELD_REQUEST_H_ + +#include +#include +#include +#include +#include +#include "plc4x_field.h" + +// Code generated by code-generation. DO NOT EDIT. + + +struct plc4c_plc4x_read_write_plc4x_field_request { + /* Properties */ + plc4c_plc4x_read_write_plc4x_field* field; +}; +typedef struct plc4c_plc4x_read_write_plc4x_field_request plc4c_plc4x_read_write_plc4x_field_request; + +// Create an empty NULL-struct +plc4c_plc4x_read_write_plc4x_field_request plc4c_plc4x_read_write_plc4x_field_request_null(); + +plc4c_return_code plc4c_plc4x_read_write_plc4x_field_request_parse(plc4c_spi_read_buffer* readBuffer, plc4c_plc4x_read_write_plc4x_field_request** message); + +plc4c_return_code plc4c_plc4x_read_write_plc4x_field_request_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_plc4x_read_write_plc4x_field_request* message); + +uint16_t plc4c_plc4x_read_write_plc4x_field_request_length_in_bytes(plc4c_plc4x_read_write_plc4x_field_request* message); + +uint16_t plc4c_plc4x_read_write_plc4x_field_request_length_in_bits(plc4c_plc4x_read_write_plc4x_field_request* message); + +#endif // PLC4C_PLC4X_READ_WRITE_PLC4X_FIELD_REQUEST_H_ diff --git a/plc4c/generated-sources/plc4x/include/plc4x_message.h b/plc4c/generated-sources/plc4x/include/plc4x_message.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_request_type.h b/plc4c/generated-sources/plc4x/include/plc4x_request_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_response_code.h b/plc4c/generated-sources/plc4x/include/plc4x_response_code.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_return_code.h b/plc4c/generated-sources/plc4x/include/plc4x_return_code.h new file mode 100755 index 00000000000..94bbb1a90ce --- /dev/null +++ b/plc4c/generated-sources/plc4x/include/plc4x_return_code.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifndef PLC4C_PLC4X_READ_WRITE_PLC4X_RETURN_CODE_H_ +#define PLC4C_PLC4X_READ_WRITE_PLC4X_RETURN_CODE_H_ + +#include +#include +#include +#include + +// Code generated by code-generation. DO NOT EDIT. + + +enum plc4c_plc4x_read_write_plc4x_return_code { + plc4c_plc4x_read_write_plc4x_return_code_OK = 0x01, + plc4c_plc4x_read_write_plc4x_return_code_NOT_FOUND = 0x02, + plc4c_plc4x_read_write_plc4x_return_code_ACCESS_DENIED = 0x03, + plc4c_plc4x_read_write_plc4x_return_code_INVALID_ADDRESS = 0x04, + plc4c_plc4x_read_write_plc4x_return_code_INVALID_DATATYPE = 0x05, + plc4c_plc4x_read_write_plc4x_return_code_INVALID_DATA = 0x06, + plc4c_plc4x_read_write_plc4x_return_code_INTERNAL_ERROR = 0x07, + plc4c_plc4x_read_write_plc4x_return_code_REMOTE_BUSY = 0x08, + plc4c_plc4x_read_write_plc4x_return_code_REMOTE_ERROR = 0x09, + plc4c_plc4x_read_write_plc4x_return_code_UNSUPPORTED = 0x0A, + plc4c_plc4x_read_write_plc4x_return_code_RESPONSE_PENDING = 0x0B +}; +typedef enum plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code; + +// Get an empty NULL-struct +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_null(); + +plc4c_return_code plc4c_plc4x_read_write_plc4x_return_code_parse(plc4c_spi_read_buffer* readBuffer, plc4c_plc4x_read_write_plc4x_return_code* message); + +plc4c_return_code plc4c_plc4x_read_write_plc4x_return_code_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_plc4x_read_write_plc4x_return_code* message); + +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_for_value(uint8_t value); + +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_value_of(char* value_string); + +int plc4c_plc4x_read_write_plc4x_return_code_num_values(); + +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_value_for_index(int index); + +uint16_t plc4c_plc4x_read_write_plc4x_return_code_length_in_bytes(plc4c_plc4x_read_write_plc4x_return_code* message); + +uint16_t plc4c_plc4x_read_write_plc4x_return_code_length_in_bits(plc4c_plc4x_read_write_plc4x_return_code* message); + + +#endif // PLC4C_PLC4X_READ_WRITE_PLC4X_RETURN_CODE_H_ diff --git a/plc4c/generated-sources/plc4x/include/plc4x_tag.h b/plc4c/generated-sources/plc4x/include/plc4x_tag.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_tag_request.h b/plc4c/generated-sources/plc4x/include/plc4x_tag_request.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_tag_response.h b/plc4c/generated-sources/plc4x/include/plc4x_tag_response.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_tag_value_request.h b/plc4c/generated-sources/plc4x/include/plc4x_tag_value_request.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_tag_value_response.h b/plc4c/generated-sources/plc4x/include/plc4x_tag_value_response.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_value.h b/plc4c/generated-sources/plc4x/include/plc4x_value.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/include/plc4x_value_type.h b/plc4c/generated-sources/plc4x/include/plc4x_value_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_constants.c b/plc4c/generated-sources/plc4x/src/plc4x_constants.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_message.c b/plc4c/generated-sources/plc4x/src/plc4x_message.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_request_type.c b/plc4c/generated-sources/plc4x/src/plc4x_request_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_response_code.c b/plc4c/generated-sources/plc4x/src/plc4x_response_code.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_return_code.c b/plc4c/generated-sources/plc4x/src/plc4x_return_code.c new file mode 100755 index 00000000000..4fd554cd036 --- /dev/null +++ b/plc4c/generated-sources/plc4x/src/plc4x_return_code.c @@ -0,0 +1,151 @@ +/* + * 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. + */ + +#include +#include + +#include "plc4x_return_code.h" + +// Code generated by code-generation. DO NOT EDIT. + + +// Create an empty NULL-struct +static const plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_null_const; + +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_null() { + return plc4c_plc4x_read_write_plc4x_return_code_null_const; +} + +// Parse function. +plc4c_return_code plc4c_plc4x_read_write_plc4x_return_code_parse(plc4c_spi_read_buffer* readBuffer, plc4c_plc4x_read_write_plc4x_return_code* _message) { + plc4c_return_code _res = OK; + + uint8_t value; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + *_message = plc4c_plc4x_read_write_plc4x_return_code_for_value(value); + + return _res; +} + +plc4c_return_code plc4c_plc4x_read_write_plc4x_return_code_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_plc4x_read_write_plc4x_return_code* _message) { + plc4c_return_code _res = OK; + + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, *_message); + + return _res; +} + +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_for_value(uint8_t value) { + for(int i = 0; i < plc4c_plc4x_read_write_plc4x_return_code_num_values(); i++) { + if(plc4c_plc4x_read_write_plc4x_return_code_value_for_index(i) == value) { + return plc4c_plc4x_read_write_plc4x_return_code_value_for_index(i); + } + } + return -1; +} + +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_value_of(char* value_string) { + if(strcmp(value_string, "OK") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_OK; + } + if(strcmp(value_string, "NOT_FOUND") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_NOT_FOUND; + } + if(strcmp(value_string, "ACCESS_DENIED") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_ACCESS_DENIED; + } + if(strcmp(value_string, "INVALID_ADDRESS") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_INVALID_ADDRESS; + } + if(strcmp(value_string, "INVALID_DATATYPE") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_INVALID_DATATYPE; + } + if(strcmp(value_string, "INVALID_DATA") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_INVALID_DATA; + } + if(strcmp(value_string, "INTERNAL_ERROR") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_INTERNAL_ERROR; + } + if(strcmp(value_string, "REMOTE_BUSY") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_REMOTE_BUSY; + } + if(strcmp(value_string, "REMOTE_ERROR") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_REMOTE_ERROR; + } + if(strcmp(value_string, "UNSUPPORTED") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_UNSUPPORTED; + } + if(strcmp(value_string, "RESPONSE_PENDING") == 0) { + return plc4c_plc4x_read_write_plc4x_return_code_RESPONSE_PENDING; + } + return -1; +} + +int plc4c_plc4x_read_write_plc4x_return_code_num_values() { + return 11; +} + +plc4c_plc4x_read_write_plc4x_return_code plc4c_plc4x_read_write_plc4x_return_code_value_for_index(int index) { + switch(index) { + case 0: { + return plc4c_plc4x_read_write_plc4x_return_code_OK; + } + case 1: { + return plc4c_plc4x_read_write_plc4x_return_code_NOT_FOUND; + } + case 2: { + return plc4c_plc4x_read_write_plc4x_return_code_ACCESS_DENIED; + } + case 3: { + return plc4c_plc4x_read_write_plc4x_return_code_INVALID_ADDRESS; + } + case 4: { + return plc4c_plc4x_read_write_plc4x_return_code_INVALID_DATATYPE; + } + case 5: { + return plc4c_plc4x_read_write_plc4x_return_code_INVALID_DATA; + } + case 6: { + return plc4c_plc4x_read_write_plc4x_return_code_INTERNAL_ERROR; + } + case 7: { + return plc4c_plc4x_read_write_plc4x_return_code_REMOTE_BUSY; + } + case 8: { + return plc4c_plc4x_read_write_plc4x_return_code_REMOTE_ERROR; + } + case 9: { + return plc4c_plc4x_read_write_plc4x_return_code_UNSUPPORTED; + } + case 10: { + return plc4c_plc4x_read_write_plc4x_return_code_RESPONSE_PENDING; + } + default: { + return -1; + } + } +} + +uint16_t plc4c_plc4x_read_write_plc4x_return_code_length_in_bytes(plc4c_plc4x_read_write_plc4x_return_code* _message) { + return plc4c_plc4x_read_write_plc4x_return_code_length_in_bits(_message) / 8; +} + +uint16_t plc4c_plc4x_read_write_plc4x_return_code_length_in_bits(plc4c_plc4x_read_write_plc4x_return_code* _message) { + return 8; +} diff --git a/plc4c/generated-sources/plc4x/src/plc4x_tag.c b/plc4c/generated-sources/plc4x/src/plc4x_tag.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_tag_request.c b/plc4c/generated-sources/plc4x/src/plc4x_tag_request.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_tag_response.c b/plc4c/generated-sources/plc4x/src/plc4x_tag_response.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_tag_value_request.c b/plc4c/generated-sources/plc4x/src/plc4x_tag_value_request.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_tag_value_response.c b/plc4c/generated-sources/plc4x/src/plc4x_tag_value_response.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_value.c b/plc4c/generated-sources/plc4x/src/plc4x_value.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/src/plc4x_value_type.c b/plc4c/generated-sources/plc4x/src/plc4x_value_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/plc4x/test/ParserSerializerTestsuite.c b/plc4c/generated-sources/plc4x/test/ParserSerializerTestsuite.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_ack_object_push_type.h b/plc4c/generated-sources/s7/include/alarm_message_ack_object_push_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_ack_push_type.h b/plc4c/generated-sources/s7/include/alarm_message_ack_push_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_ack_response_type.h b/plc4c/generated-sources/s7/include/alarm_message_ack_response_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_ack_type.h b/plc4c/generated-sources/s7/include/alarm_message_ack_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_object_ack_type.h b/plc4c/generated-sources/s7/include/alarm_message_object_ack_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_object_push_type.h b/plc4c/generated-sources/s7/include/alarm_message_object_push_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_object_query_type.h b/plc4c/generated-sources/s7/include/alarm_message_object_query_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_push_type.h b/plc4c/generated-sources/s7/include/alarm_message_push_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_message_query_type.h b/plc4c/generated-sources/s7/include/alarm_message_query_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_state_type.h b/plc4c/generated-sources/s7/include/alarm_state_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/alarm_type.h b/plc4c/generated-sources/s7/include/alarm_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/associated_value_type.h b/plc4c/generated-sources/s7/include/associated_value_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/cotp_packet.h b/plc4c/generated-sources/s7/include/cotp_packet.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/cotp_parameter.h b/plc4c/generated-sources/s7/include/cotp_parameter.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/cotp_protocol_class.h b/plc4c/generated-sources/s7/include/cotp_protocol_class.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/cotp_tpdu_size.h b/plc4c/generated-sources/s7/include/cotp_tpdu_size.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/cpu_subscribe_events.h b/plc4c/generated-sources/s7/include/cpu_subscribe_events.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/data_item.h b/plc4c/generated-sources/s7/include/data_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/data_transport_error_code.h b/plc4c/generated-sources/s7/include/data_transport_error_code.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/data_transport_size.h b/plc4c/generated-sources/s7/include/data_transport_size.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/date_and_time.h b/plc4c/generated-sources/s7/include/date_and_time.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/device_group.h b/plc4c/generated-sources/s7/include/device_group.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/event_type.h b/plc4c/generated-sources/s7/include/event_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/memory_area.h b/plc4c/generated-sources/s7/include/memory_area.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/mode_transition_type.h b/plc4c/generated-sources/s7/include/mode_transition_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/query_type.h b/plc4c/generated-sources/s7/include/query_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_address.h b/plc4c/generated-sources/s7/include/s7_address.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_data_alarm_message.h b/plc4c/generated-sources/s7/include/s7_data_alarm_message.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_message.h b/plc4c/generated-sources/s7/include/s7_message.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_parameter.h b/plc4c/generated-sources/s7/include/s7_parameter.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_parameter_user_data_item.h b/plc4c/generated-sources/s7/include/s7_parameter_user_data_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_payload.h b/plc4c/generated-sources/s7/include/s7_payload.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_payload_user_data_item.h b/plc4c/generated-sources/s7/include/s7_payload_user_data_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_var_payload_data_item.h b/plc4c/generated-sources/s7/include/s7_var_payload_data_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_var_payload_status_item.h b/plc4c/generated-sources/s7/include/s7_var_payload_status_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/s7_var_request_parameter_item.h b/plc4c/generated-sources/s7/include/s7_var_request_parameter_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/state.h b/plc4c/generated-sources/s7/include/state.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/syntax_id_type.h b/plc4c/generated-sources/s7/include/syntax_id_type.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/szl_data_tree_item.h b/plc4c/generated-sources/s7/include/szl_data_tree_item.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/szl_id.h b/plc4c/generated-sources/s7/include/szl_id.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/szl_module_type_class.h b/plc4c/generated-sources/s7/include/szl_module_type_class.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/szl_sublist.h b/plc4c/generated-sources/s7/include/szl_sublist.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/tpkt_packet.h b/plc4c/generated-sources/s7/include/tpkt_packet.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/include/transport_size.h b/plc4c/generated-sources/s7/include/transport_size.h old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_ack_object_push_type.c b/plc4c/generated-sources/s7/src/alarm_message_ack_object_push_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_ack_push_type.c b/plc4c/generated-sources/s7/src/alarm_message_ack_push_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_ack_response_type.c b/plc4c/generated-sources/s7/src/alarm_message_ack_response_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_ack_type.c b/plc4c/generated-sources/s7/src/alarm_message_ack_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_object_ack_type.c b/plc4c/generated-sources/s7/src/alarm_message_object_ack_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_object_push_type.c b/plc4c/generated-sources/s7/src/alarm_message_object_push_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_object_query_type.c b/plc4c/generated-sources/s7/src/alarm_message_object_query_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_push_type.c b/plc4c/generated-sources/s7/src/alarm_message_push_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_message_query_type.c b/plc4c/generated-sources/s7/src/alarm_message_query_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_state_type.c b/plc4c/generated-sources/s7/src/alarm_state_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/alarm_type.c b/plc4c/generated-sources/s7/src/alarm_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/associated_value_type.c b/plc4c/generated-sources/s7/src/associated_value_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/cotp_packet.c b/plc4c/generated-sources/s7/src/cotp_packet.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/cotp_parameter.c b/plc4c/generated-sources/s7/src/cotp_parameter.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/cotp_protocol_class.c b/plc4c/generated-sources/s7/src/cotp_protocol_class.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/cotp_tpdu_size.c b/plc4c/generated-sources/s7/src/cotp_tpdu_size.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/cpu_subscribe_events.c b/plc4c/generated-sources/s7/src/cpu_subscribe_events.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/data_item.c b/plc4c/generated-sources/s7/src/data_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/data_transport_error_code.c b/plc4c/generated-sources/s7/src/data_transport_error_code.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/data_transport_size.c b/plc4c/generated-sources/s7/src/data_transport_size.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/date_and_time.c b/plc4c/generated-sources/s7/src/date_and_time.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/device_group.c b/plc4c/generated-sources/s7/src/device_group.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/event_type.c b/plc4c/generated-sources/s7/src/event_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/memory_area.c b/plc4c/generated-sources/s7/src/memory_area.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/mode_transition_type.c b/plc4c/generated-sources/s7/src/mode_transition_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/query_type.c b/plc4c/generated-sources/s7/src/query_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_address.c b/plc4c/generated-sources/s7/src/s7_address.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_data_alarm_message.c b/plc4c/generated-sources/s7/src/s7_data_alarm_message.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_message.c b/plc4c/generated-sources/s7/src/s7_message.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_parameter.c b/plc4c/generated-sources/s7/src/s7_parameter.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_parameter_user_data_item.c b/plc4c/generated-sources/s7/src/s7_parameter_user_data_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_payload.c b/plc4c/generated-sources/s7/src/s7_payload.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_payload_user_data_item.c b/plc4c/generated-sources/s7/src/s7_payload_user_data_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c b/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_var_payload_status_item.c b/plc4c/generated-sources/s7/src/s7_var_payload_status_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/s7_var_request_parameter_item.c b/plc4c/generated-sources/s7/src/s7_var_request_parameter_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/state.c b/plc4c/generated-sources/s7/src/state.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/syntax_id_type.c b/plc4c/generated-sources/s7/src/syntax_id_type.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/szl_data_tree_item.c b/plc4c/generated-sources/s7/src/szl_data_tree_item.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/szl_id.c b/plc4c/generated-sources/s7/src/szl_id.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/szl_module_type_class.c b/plc4c/generated-sources/s7/src/szl_module_type_class.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/szl_sublist.c b/plc4c/generated-sources/s7/src/szl_sublist.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/tpkt_packet.c b/plc4c/generated-sources/s7/src/tpkt_packet.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/src/transport_size.c b/plc4c/generated-sources/s7/src/transport_size.c old mode 100644 new mode 100755 diff --git a/plc4c/generated-sources/s7/test/ParserSerializerTestsuite.c b/plc4c/generated-sources/s7/test/ParserSerializerTestsuite.c old mode 100644 new mode 100755 diff --git a/plc4c/integrations/CMakeLists.txt b/plc4c/integrations/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/integrations/apache-mynewt/CMakeLists.txt b/plc4c/integrations/apache-mynewt/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/pom.xml b/plc4c/pom.xml old mode 100644 new mode 100755 diff --git a/plc4c/spi/CMakeLists.txt b/plc4c/spi/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/spi/include/plc4c/spi/evaluation_helper.h b/plc4c/spi/include/plc4c/spi/evaluation_helper.h old mode 100644 new mode 100755 diff --git a/plc4c/spi/include/plc4c/spi/read_buffer.h b/plc4c/spi/include/plc4c/spi/read_buffer.h old mode 100644 new mode 100755 diff --git a/plc4c/spi/include/plc4c/spi/system_private.h b/plc4c/spi/include/plc4c/spi/system_private.h old mode 100644 new mode 100755 diff --git a/plc4c/spi/include/plc4c/spi/types_private.h b/plc4c/spi/include/plc4c/spi/types_private.h old mode 100644 new mode 100755 diff --git a/plc4c/spi/include/plc4c/spi/write_buffer.h b/plc4c/spi/include/plc4c/spi/write_buffer.h old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/connection.c b/plc4c/spi/src/connection.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/data.c b/plc4c/spi/src/data.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/evaluation_helper.c b/plc4c/spi/src/evaluation_helper.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/read.c b/plc4c/spi/src/read.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/read_buffer.c b/plc4c/spi/src/read_buffer.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/subscribe.c b/plc4c/spi/src/subscribe.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/system.c b/plc4c/spi/src/system.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/types.c b/plc4c/spi/src/types.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/utils/list.c b/plc4c/spi/src/utils/list.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/utils/queue.c b/plc4c/spi/src/utils/queue.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/write.c b/plc4c/spi/src/write.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/src/write_buffer.c b/plc4c/spi/src/write_buffer.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/test/read_buffer_test.c b/plc4c/spi/test/read_buffer_test.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/test/spi_test.c b/plc4c/spi/test/spi_test.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/test/system_test.c b/plc4c/spi/test/system_test.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/test/utils/test_utils.c b/plc4c/spi/test/utils/test_utils.c old mode 100644 new mode 100755 diff --git a/plc4c/spi/test/write_buffer_test.c b/plc4c/spi/test/write_buffer_test.c old mode 100644 new mode 100755 diff --git a/plc4c/tools/CMakeLists.txt b/plc4c/tools/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/tools/plc4x-server/CMakeLists.txt b/plc4c/tools/plc4x-server/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/tools/plc4x-server/src/plc4x_server.c b/plc4c/tools/plc4x-server/src/plc4x_server.c old mode 100644 new mode 100755 diff --git a/plc4c/transports/CMakeLists.txt b/plc4c/transports/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/transports/dummy/CMakeLists.txt b/plc4c/transports/dummy/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/transports/dummy/include/plc4c/transport_dummy.h b/plc4c/transports/dummy/include/plc4c/transport_dummy.h old mode 100644 new mode 100755 diff --git a/plc4c/transports/dummy/src/transport_dummy.c b/plc4c/transports/dummy/src/transport_dummy.c old mode 100644 new mode 100755 diff --git a/plc4c/transports/serial/CMakeLists.txt b/plc4c/transports/serial/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/transports/serial/include/plc4c/transport_serial.h b/plc4c/transports/serial/include/plc4c/transport_serial.h old mode 100644 new mode 100755 diff --git a/plc4c/transports/serial/src/transport_serial.c b/plc4c/transports/serial/src/transport_serial.c old mode 100644 new mode 100755 diff --git a/plc4c/transports/tcp/CMakeLists.txt b/plc4c/transports/tcp/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/plc4c/transports/tcp/include/plc4c/transport_tcp.h b/plc4c/transports/tcp/include/plc4c/transport_tcp.h old mode 100644 new mode 100755 diff --git a/plc4c/transports/tcp/src/transport_tcp.c b/plc4c/transports/tcp/src/transport_tcp.c old mode 100644 new mode 100755 diff --git a/plc4go/.idea/fileTemplates/includes/File Header Go.go b/plc4go/.idea/fileTemplates/includes/File Header Go.go old mode 100644 new mode 100755 diff --git a/plc4go/.idea/fileTemplates/internal/Go Application.go b/plc4go/.idea/fileTemplates/internal/Go Application.go old mode 100644 new mode 100755 diff --git a/plc4go/.idea/fileTemplates/internal/Go File.go b/plc4go/.idea/fileTemplates/internal/Go File.go old mode 100644 new mode 100755 diff --git a/plc4go/.idea/fileTemplates/internal/Go Scratch.go b/plc4go/.idea/fileTemplates/internal/Go Scratch.go old mode 100644 new mode 100755 diff --git a/plc4go/Makefile b/plc4go/Makefile old mode 100644 new mode 100755 diff --git a/plc4go/README.md b/plc4go/README.md old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/logback-test.xml b/plc4go/assets/testing/logback-test.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/abeth/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/abeth/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/ads/AdsDiscoverySerializerTest.xml b/plc4go/assets/testing/protocols/ads/AdsDiscoverySerializerTest.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/ads/DriverTestsuite.xml b/plc4go/assets/testing/protocols/ads/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/ads/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/ads/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/bacnet/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/bacnet/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/df1/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/df1/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/eip/DriverTestsuite.xml b/plc4go/assets/testing/protocols/eip/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/firmata/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/firmata/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/knxnetip/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/knxnetip/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/modbus/ascii/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/modbus/ascii/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/modbus/rtu/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/modbus/rtu/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/modbus/tcp/DriverTestsuite.xml b/plc4go/assets/testing/protocols/modbus/tcp/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/modbus/tcp/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/modbus/tcp/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/s7/DriverTestsuite.xml b/plc4go/assets/testing/protocols/s7/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/assets/testing/protocols/s7/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/s7/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4go/examples/ads/discovery/Discovery.go b/plc4go/examples/ads/discovery/Discovery.go old mode 100644 new mode 100755 diff --git a/plc4go/examples/bacnet/discovery/hello_world_plc4go_bacnet_discovery.go b/plc4go/examples/bacnet/discovery/hello_world_plc4go_bacnet_discovery.go old mode 100644 new mode 100755 diff --git a/plc4go/examples/knx/discovery/hello_world_plc4go_knx_discovery.go b/plc4go/examples/knx/discovery/hello_world_plc4go_knx_discovery.go old mode 100644 new mode 100755 diff --git a/plc4go/examples/knx/groupAddressRead/hello_world_plc4go_knx_read_group_address.go b/plc4go/examples/knx/groupAddressRead/hello_world_plc4go_knx_read_group_address.go old mode 100644 new mode 100755 diff --git a/plc4go/examples/knx/subscribe/hello_world_plc4go_knx_subscription.go b/plc4go/examples/knx/subscribe/hello_world_plc4go_knx_subscription.go old mode 100644 new mode 100755 diff --git a/plc4go/examples/read/hello_world_plc4go_read.go b/plc4go/examples/read/hello_world_plc4go_read.go old mode 100644 new mode 100755 diff --git a/plc4go/examples/write/hello_world_plc4go_write.go b/plc4go/examples/write/hello_world_plc4go_write.go old mode 100644 new mode 100755 diff --git a/plc4go/go.mod b/plc4go/go.mod old mode 100644 new mode 100755 diff --git a/plc4go/go.sum b/plc4go/go.sum old mode 100644 new mode 100755 diff --git a/plc4go/internal/ads/Connection.go b/plc4go/internal/ads/Connection.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/ads/Driver.go b/plc4go/internal/ads/Driver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/ads/Field.go b/plc4go/internal/ads/Field.go new file mode 100755 index 00000000000..889081897a8 --- /dev/null +++ b/plc4go/internal/ads/Field.go @@ -0,0 +1,216 @@ +/* + * 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 ads + +import ( + "encoding/xml" + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + model2 "github.com/apache/plc4x/plc4go/protocols/ads/readwrite/model" + "github.com/pkg/errors" +) + +type PlcField struct { + FieldType FieldType + StringLength int32 + NumberOfElements uint32 + Datatype model2.AdsDataType +} + +func (m PlcField) GetTypeName() string { + return m.FieldType.GetName() +} + +func (m PlcField) GetQuantity() uint16 { + return uint16(m.NumberOfElements) +} + +func (m PlcField) GetNumberOfElements() uint32 { + return m.NumberOfElements +} + +func (m PlcField) GetDatatype() model2.AdsDataType { + return m.Datatype +} + +func (m PlcField) GetStringLength() int32 { + return m.StringLength +} + +func (m PlcField) GetAddressString() string { + return fmt.Sprintf("%dx%05d%05d:%s", m.FieldType, m.StringLength, m.NumberOfElements, m.Datatype.String()) +} + +type AdsPlcField interface { + GetDatatype() model2.AdsDataType + GetStringLength() int32 + GetNumberOfElements() uint32 + model.PlcField +} + +func castToAdsFieldFromPlcField(plcField model.PlcField) (AdsPlcField, error) { + if adsField, ok := plcField.(AdsPlcField); ok { + return adsField, nil + } + return nil, errors.Errorf("couldn't %T cast to AdsPlcField", plcField) +} + +type DirectPlcField struct { + IndexGroup uint32 + IndexOffset uint32 + PlcField +} + +func (m DirectPlcField) GetAddressString() string { + return fmt.Sprintf("%dx%05d%05d%05d%05d:%s", m.FieldType, m.IndexGroup, m.IndexOffset, m.StringLength, m.NumberOfElements, m.Datatype.String()) +} + +func newDirectAdsPlcField(indexGroup uint32, indexOffset uint32, adsDataType model2.AdsDataType, stringLength int32, numberOfElements uint32) (model.PlcField, error) { + fieldType := DirectAdsField + if stringLength > 0 { + fieldType = DirectAdsStringField + } + return DirectPlcField{ + IndexGroup: indexGroup, + IndexOffset: indexOffset, + PlcField: PlcField{ + FieldType: fieldType, + StringLength: stringLength, + NumberOfElements: numberOfElements, + Datatype: adsDataType, + }, + }, nil +} + +func castToDirectAdsFieldFromPlcField(plcField model.PlcField) (DirectPlcField, error) { + if adsField, ok := plcField.(DirectPlcField); ok { + return adsField, nil + } + return DirectPlcField{}, errors.Errorf("couldn't %T cast to DirectPlcField", plcField) +} + +func (m DirectPlcField) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext(m.FieldType.GetName()); err != nil { + return err + } + + if err := writeBuffer.WriteUint32("indexGroup", 32, m.IndexGroup); err != nil { + return err + } + if err := writeBuffer.WriteUint32("indexOffset", 32, m.IndexOffset); err != nil { + return err + } + + if err := writeBuffer.WriteUint32("numberOfElements", 32, m.NumberOfElements); err != nil { + return err + } + + if err := writeBuffer.WriteString("dataType", uint32(len([]rune(m.Datatype.String()))*8), "UTF-8", m.Datatype.String()); err != nil { + return err + } + + if m.StringLength != 0 { + if err := writeBuffer.WriteInt32("stringLength", 32, m.StringLength); err != nil { + return err + } + } + + if err := writeBuffer.PopContext(m.FieldType.GetName()); err != nil { + return err + } + return nil +} + +func (m DirectPlcField) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { + panic(name) +} + +type SymbolicPlcField struct { + SymbolicAddress string + PlcField +} + +func (m SymbolicPlcField) GetAddressString() string { + return fmt.Sprintf("%dx%s%05d%05d:%s", m.FieldType, m.SymbolicAddress, m.StringLength, m.NumberOfElements, m.Datatype.String()) +} + +func newAdsSymbolicPlcField(symbolicAddress string, adsDataType model2.AdsDataType, stringLength int32, numberOfElements uint32) (model.PlcField, error) { + fieldType := SymbolicAdsField + if stringLength > 0 { + fieldType = SymbolicAdsStringField + } + return SymbolicPlcField{ + SymbolicAddress: symbolicAddress, + PlcField: PlcField{ + FieldType: fieldType, + StringLength: stringLength, + NumberOfElements: numberOfElements, + Datatype: adsDataType, + }, + }, nil +} + +func needsResolving(plcField model.PlcField) bool { + switch plcField.(type) { + case SymbolicPlcField: + return true + case DirectPlcField: + return false + default: + return false + } +} + +func castToSymbolicPlcFieldFromPlcField(plcField model.PlcField) (SymbolicPlcField, error) { + if adsField, ok := plcField.(SymbolicPlcField); ok { + return adsField, nil + } + return SymbolicPlcField{}, errors.Errorf("couldn't cast %T to SymbolicPlcField", plcField) +} + +func (m SymbolicPlcField) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext(m.FieldType.GetName()); err != nil { + return err + } + + if err := writeBuffer.WriteString("symbolicAddress", uint32(len([]rune(m.SymbolicAddress))*8), "UTF-8", m.SymbolicAddress); err != nil { + return err + } + + if err := writeBuffer.WriteUint32("numberOfElements", 32, m.NumberOfElements); err != nil { + return err + } + + if err := writeBuffer.WriteString("dataType", uint32(len([]rune(m.Datatype.String()))*8), "UTF-8", m.Datatype.String()); err != nil { + return err + } + + if m.StringLength > 0 { + if err := writeBuffer.WriteInt32("stringLength", 32, m.StringLength); err != nil { + return err + } + } + + if err := writeBuffer.PopContext(m.FieldType.GetName()); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/ads/FieldHandler.go b/plc4go/internal/ads/FieldHandler.go new file mode 100755 index 00000000000..0ae8fa9647d --- /dev/null +++ b/plc4go/internal/ads/FieldHandler.go @@ -0,0 +1,162 @@ +/* + * 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 ads + +import ( + "encoding/binary" + "encoding/hex" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + apiModel "github.com/apache/plc4x/plc4go/pkg/api/model" + model2 "github.com/apache/plc4x/plc4go/protocols/ads/readwrite/model" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" + "regexp" + "strconv" +) + +type FieldType uint8 + +//go:generate stringer -type FieldType +const ( + DirectAdsStringField FieldType = 0x00 + DirectAdsField FieldType = 0x01 + SymbolicAdsStringField FieldType = 0x03 + SymbolicAdsField FieldType = 0x04 +) + +func (i FieldType) GetName() string { + return i.String() +} + +type FieldHandler struct { + directAdsStringField *regexp.Regexp + directAdsField *regexp.Regexp + symbolicAdsStringField *regexp.Regexp + symbolicAdsField *regexp.Regexp +} + +func NewFieldHandler() FieldHandler { + return FieldHandler{ + directAdsStringField: regexp.MustCompile(`^((0[xX](?P[0-9a-fA-F]+))|(?P\d+))/((0[xX](?P[0-9a-fA-F]+))|(?P\d+)):(?PSTRING|WSTRING)\((?P\d{1,3})\)(\[(?P\d+)])?`), + directAdsField: regexp.MustCompile(`^((0[xX](?P[0-9a-fA-F]+))|(?P\d+))/((0[xX](?P[0-9a-fA-F]+))|(?P\d+)):(?P\w+)(\[(?P\d+)])?`), + symbolicAdsStringField: regexp.MustCompile(`^(?P.+):(?P'STRING'|'WSTRING')\((?P\d{1,3})\)(\[(?P\d+)])?`), + symbolicAdsField: regexp.MustCompile(`^(?P.+):(?P\w+)(\[(?P\d+)])?`), + } +} + +func (m FieldHandler) ParseQuery(query string) (apiModel.PlcField, error) { + if match := utils.GetSubgroupMatches(m.directAdsStringField, query); match != nil { + var indexGroup uint32 + if indexGroupHexString := match["indexGroupHex"]; indexGroupHexString != "" { + decodeString, err := hex.DecodeString(indexGroupHexString[2:]) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexGroup = binary.BigEndian.Uint32(decodeString) + } else { + parsedIndexGroup, err := strconv.ParseUint(match["indexGroup"], 10, 32) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexGroup = uint32(parsedIndexGroup) + } + var indexOffset uint32 + if indexOffsetHexString := match["indexOffsetHex"]; indexOffsetHexString != "" { + decodeString, err := hex.DecodeString(indexOffsetHexString[2:]) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexOffset = binary.BigEndian.Uint32(decodeString) + } else { + parsedIndexOffset, err := strconv.ParseUint(match["indexOffset"], 10, 32) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexOffset = uint32(parsedIndexOffset) + } + stringLength, err := strconv.ParseInt(match["stringLength"], 10, 32) + if err != nil { + return nil, errors.Wrap(err, "Error decoding string length") + } + numberOfElements, err := strconv.ParseUint(match["numberOfElements"], 10, 32) + if err != nil { + log.Trace().Msg("Falling back to number of elements 1") + numberOfElements = 1 + } + + return newDirectAdsPlcField(indexGroup, indexOffset, model2.AdsDataTypeByName(match["adsDataType"]), int32(stringLength), uint32(numberOfElements)) + } else if match := utils.GetSubgroupMatches(m.directAdsField, query); match != nil { + var indexGroup uint32 + if indexGroupHexString := match["indexGroupHex"]; indexGroupHexString != "" { + decodeString, err := hex.DecodeString(indexGroupHexString[2:]) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexGroup = binary.BigEndian.Uint32(decodeString) + } else { + parsedIndexGroup, err := strconv.ParseUint(match["indexGroup"], 10, 32) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexGroup = uint32(parsedIndexGroup) + } + var indexOffset uint32 + if indexOffsetHexString := match["indexOffsetHex"]; indexOffsetHexString != "" { + decodeString, err := hex.DecodeString(indexOffsetHexString[2:]) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexOffset = binary.BigEndian.Uint32(decodeString) + } else { + parsedIndexOffset, err := strconv.ParseUint(match["indexOffset"], 10, 32) + if err != nil { + return nil, errors.Wrap(err, "Error decoding index group") + } + indexOffset = uint32(parsedIndexOffset) + } + + adsDataType := model2.AdsDataTypeByName(match["adsDataType"]) + numberOfElements, err := strconv.ParseUint(match["numberOfElements"], 10, 32) + if err != nil { + log.Trace().Msg("Falling back to number of elements 1") + numberOfElements = 1 + } + return newDirectAdsPlcField(indexGroup, indexOffset, adsDataType, int32(0), uint32(numberOfElements)) + } else if match := utils.GetSubgroupMatches(m.symbolicAdsStringField, query); match != nil { + stringLength, err := strconv.ParseInt(match["stringLength"], 10, 32) + if err != nil { + return nil, errors.Wrap(err, "Error decoding string length") + } + numberOfElements, err := strconv.ParseUint(match["numberOfElements"], 10, 32) + if err != nil { + return nil, errors.Wrap(err, "Error decoding number of elements") + } + return newAdsSymbolicPlcField(match["symbolicAddress"], model2.AdsDataTypeByName(match["adsDataType"]), int32(stringLength), uint32(numberOfElements)) + } else if match := utils.GetSubgroupMatches(m.symbolicAdsField, query); match != nil { + numberOfElements, err := strconv.ParseUint(match["numberOfElements"], 10, 32) + if err != nil { + log.Trace().Msg("Falling back to number of elements 1") + numberOfElements = 1 + } + return newAdsSymbolicPlcField(match["symbolicAddress"], model2.AdsDataTypeByName(match["adsDataType"]), int32(0), uint32(numberOfElements)) + } else { + return nil, errors.Errorf("Invalid address format for address '%s'", query) + } +} diff --git a/plc4go/internal/ads/MessageCodec.go b/plc4go/internal/ads/MessageCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/ads/Reader.go b/plc4go/internal/ads/Reader.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/ads/ValueHandler.go b/plc4go/internal/ads/ValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/ads/Writer.go b/plc4go/internal/ads/Writer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/ads/model/Configuration.go b/plc4go/internal/ads/model/Configuration.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Capability.go b/plc4go/internal/bacnetip/Capability.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Connection.go b/plc4go/internal/bacnetip/Connection.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Core.go b/plc4go/internal/bacnetip/Core.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Discoverer.go b/plc4go/internal/bacnetip/Discoverer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Driver.go b/plc4go/internal/bacnetip/Driver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Field.go b/plc4go/internal/bacnetip/Field.go new file mode 100755 index 00000000000..a5ebeb2f000 --- /dev/null +++ b/plc4go/internal/bacnetip/Field.go @@ -0,0 +1,103 @@ +/* + * 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 bacnetip + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "strconv" +) + +type BacNetPlcField interface { + GetDeviceIdentifier() uint32 + GetObjectType() uint16 + GetObjectInstance() uint32 + GetPropertyIdentifier() uint32 +} + +type PlcField struct { + DeviceIdentifier uint32 + ObjectType uint16 + ObjectInstance uint32 + PropertyIdentifier uint32 +} + +func (m PlcField) GetAddressString() string { + return strconv.Itoa(int(m.DeviceIdentifier)) +} + +func (m PlcField) GetTypeName() string { + return strconv.Itoa(int(m.ObjectType)) +} + +func (m PlcField) GetQuantity() uint16 { + return 1 +} + +func NewField(deviceIdentifier uint32, objectType uint16, objectInstance uint32, propertyIdentifier uint32) PlcField { + return PlcField{ + DeviceIdentifier: deviceIdentifier, + ObjectType: objectType, + ObjectInstance: objectInstance, + PropertyIdentifier: propertyIdentifier, + } +} + +func (m PlcField) GetDeviceIdentifier() uint32 { + return m.DeviceIdentifier +} + +func (m PlcField) GetObjectType() uint16 { + return m.ObjectType +} + +func (m PlcField) GetObjectInstance() uint32 { + return m.ObjectInstance +} + +func (m PlcField) GetPropertyIdentifier() uint32 { + return m.PropertyIdentifier +} + +func (m PlcField) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("BacNetPlcField"); err != nil { + return err + } + + if err := writeBuffer.WriteUint32("deviceIdentifier", 32, m.DeviceIdentifier); err != nil { + return err + } + + if err := writeBuffer.WriteUint16("objectType", 16, m.ObjectType); err != nil { + return err + } + + if err := writeBuffer.WriteUint32("objectInstance", 32, m.ObjectInstance); err != nil { + return err + } + + if err := writeBuffer.WriteUint32("propertyIdentifier", 32, m.PropertyIdentifier); err != nil { + return err + } + + if err := writeBuffer.PopContext("BacNetPlcField"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/bacnetip/FieldHandler.go b/plc4go/internal/bacnetip/FieldHandler.go new file mode 100755 index 00000000000..3ea4e61c2e8 --- /dev/null +++ b/plc4go/internal/bacnetip/FieldHandler.go @@ -0,0 +1,101 @@ +/* + * 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 bacnetip + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + "github.com/pkg/errors" + "regexp" + "strconv" +) + +type FieldHandler struct { + addressPattern *regexp.Regexp +} + +func NewFieldHandler() FieldHandler { + return FieldHandler{ + addressPattern: regexp.MustCompile(`^(?P(\d|\*))/(?P(\d|\*))/(?P(\d|\*))/(?P(\d|\*))`), + } +} + +const ( + DEVICE_IDENTIFIER = "deviceIdentifier" + OBJECT_TYPE = "objectType" + OBJECT_INSTANCE = "objectInstance" + PROPERTY_IDENTIFIER = "propertyIdentifier" +) + +func (m FieldHandler) ParseQuery(query string) (model.PlcField, error) { + if match := utils.GetSubgroupMatches(m.addressPattern, query); match != nil { + deviceIdentifierString := match[DEVICE_IDENTIFIER] + var deviceIdentifier uint32 + if deviceIdentifierString == "*" { + // TODO: find a way to express a wildcard. -1 not an option here + deviceIdentifier = 0 + } else { + if parsedDeviceIdentifier, err := strconv.ParseUint(deviceIdentifierString, 10, 32); err != nil { + return nil, err + } else { + deviceIdentifier = uint32(parsedDeviceIdentifier) + } + } + objectTypeString := match[OBJECT_TYPE] + var objectType uint16 + if objectTypeString == "*" { + // TODO: find a way to express a wildcard. -1 not an option here + deviceIdentifier = 0 + } else { + if parsedObjectType, err := strconv.ParseUint(objectTypeString, 10, 16); err != nil { + return nil, err + } else { + objectType = uint16(parsedObjectType) + } + } + objectInstanceString := match[OBJECT_INSTANCE] + var objectInstance uint32 + if objectInstanceString == "*" { + // TODO: find a way to express a wildcard. -1 not an option here + objectInstance = 0 + } else { + if parsedObjectInstance, err := strconv.ParseUint(objectInstanceString, 10, 32); err != nil { + return nil, err + } else { + objectInstance = uint32(parsedObjectInstance) + } + } + + propertyIdentifierString := match[PROPERTY_IDENTIFIER] + var propertyIdentifier uint32 + if propertyIdentifierString == "*" { + propertyIdentifier = 0 + } else { + if parsedPropertyIdentifier, err := strconv.ParseUint(propertyIdentifierString, 10, 32); err != nil { + return nil, err + } else { + propertyIdentifier = uint32(parsedPropertyIdentifier) + } + } + + return NewField(deviceIdentifier, objectType, objectInstance, propertyIdentifier), nil + } + return nil, errors.Errorf("Unable to parse %s", query) +} diff --git a/plc4go/internal/bacnetip/MessageCodec.go b/plc4go/internal/bacnetip/MessageCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Subscriber.go b/plc4go/internal/bacnetip/Subscriber.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/Task.go b/plc4go/internal/bacnetip/Task.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/UDPCommunicationsModule.go b/plc4go/internal/bacnetip/UDPCommunicationsModule.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/ValueHandler.go b/plc4go/internal/bacnetip/ValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/service/Device.go b/plc4go/internal/bacnetip/service/Device.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/bacnetip/service/Object.go b/plc4go/internal/bacnetip/service/Object.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/cbus/tagtype_string.go b/plc4go/internal/cbus/tagtype_string.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/doc.go b/plc4go/internal/doc.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/Configuration.go b/plc4go/internal/eip/Configuration.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/Connection.go b/plc4go/internal/eip/Connection.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/Driver.go b/plc4go/internal/eip/Driver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/DriverContext.go b/plc4go/internal/eip/DriverContext.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/MessageCodec.go b/plc4go/internal/eip/MessageCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/Reader.go b/plc4go/internal/eip/Reader.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/Tag.go b/plc4go/internal/eip/Tag.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/TagHandler.go b/plc4go/internal/eip/TagHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/ValueHandler.go b/plc4go/internal/eip/ValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/eip/Writer.go b/plc4go/internal/eip/Writer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Browser.go b/plc4go/internal/knxnetip/Browser.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Connection.go b/plc4go/internal/knxnetip/Connection.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/ConnectionDriverSpecificOperations.go b/plc4go/internal/knxnetip/ConnectionDriverSpecificOperations.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/ConnectionHelper.go b/plc4go/internal/knxnetip/ConnectionHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/ConnectionInternalOperations.go b/plc4go/internal/knxnetip/ConnectionInternalOperations.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Discoverer.go b/plc4go/internal/knxnetip/Discoverer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Driver.go b/plc4go/internal/knxnetip/Driver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Field.go b/plc4go/internal/knxnetip/Field.go new file mode 100755 index 00000000000..a4dd0b2fa31 --- /dev/null +++ b/plc4go/internal/knxnetip/Field.go @@ -0,0 +1,446 @@ +/* + * 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 knxnetip + +import ( + "errors" + "fmt" + apiModel "github.com/apache/plc4x/plc4go/pkg/api/model" + driverModel "github.com/apache/plc4x/plc4go/protocols/knxnetip/readwrite/model" + "strconv" + "strings" +) + +type Field interface { + apiModel.PlcField +} + +type GroupAddressField interface { + GetFieldType() *driverModel.KnxDatapointType + IsPatternField() bool + matches(knxGroupAddress driverModel.KnxGroupAddress) bool + toGroupAddress() driverModel.KnxGroupAddress + Field +} + +type DeviceField interface { + toKnxAddress() driverModel.KnxAddress + Field +} + +type GroupAddress3LevelPlcField struct { + MainGroup string // 5 Bits: Values 0-31 + MiddleGroup string // 3 Bits: values 0-7 + SubGroup string // 8 Bits + FieldType *driverModel.KnxDatapointType +} + +func NewGroupAddress3LevelPlcField(mainGroup string, middleGroup string, subGroup string, fieldType *driverModel.KnxDatapointType) GroupAddress3LevelPlcField { + return GroupAddress3LevelPlcField{ + MainGroup: mainGroup, + MiddleGroup: middleGroup, + SubGroup: subGroup, + FieldType: fieldType, + } +} + +func (k GroupAddress3LevelPlcField) GetAddressString() string { + return fmt.Sprintf("%s/%s/%s:%s", k.MainGroup, k.MiddleGroup, k.SubGroup, k.FieldType.String()) +} + +func (k GroupAddress3LevelPlcField) GetTypeName() string { + return k.FieldType.Name() +} + +func (k GroupAddress3LevelPlcField) GetFieldType() *driverModel.KnxDatapointType { + return k.FieldType +} + +func (k GroupAddress3LevelPlcField) GetQuantity() uint16 { + return 1 +} + +func (k GroupAddress3LevelPlcField) IsPatternField() bool { + _, err := strconv.Atoi(k.MainGroup) + if err == nil { + _, err = strconv.Atoi(k.MiddleGroup) + if err == nil { + _, err = strconv.Atoi(k.SubGroup) + if err == nil { + return false + } + } + } + return true +} + +func (k GroupAddress3LevelPlcField) matches(knxGroupAddress driverModel.KnxGroupAddress) bool { + level3KnxGroupAddress := driverModel.CastKnxGroupAddress3Level(knxGroupAddress) + if level3KnxGroupAddress == nil { + return false + } + return matches(k.MainGroup, strconv.Itoa(int(level3KnxGroupAddress.GetMainGroup()))) && + matches(k.MiddleGroup, strconv.Itoa(int(level3KnxGroupAddress.GetMiddleGroup()))) && + matches(k.SubGroup, strconv.Itoa(int(level3KnxGroupAddress.GetSubGroup()))) +} + +func (k GroupAddress3LevelPlcField) toGroupAddress() driverModel.KnxGroupAddress { + mainGroup, err := strconv.ParseUint(k.MainGroup, 10, 8) + if err != nil { + return nil + } + middleGroup, err := strconv.ParseUint(k.MiddleGroup, 10, 8) + if err != nil { + return nil + } + subGroup, err := strconv.ParseUint(k.SubGroup, 10, 8) + if err != nil { + return nil + } + return driverModel.NewKnxGroupAddress3Level(uint8(mainGroup), uint8(middleGroup), uint8(subGroup)) +} + +type GroupAddress2LevelPlcField struct { + MainGroup string // 5 Bits: Values 0-31 + SubGroup string // 11 Bits + FieldType *driverModel.KnxDatapointType + Field +} + +func NewGroupAddress2LevelPlcField(mainGroup string, subGroup string, fieldType *driverModel.KnxDatapointType) GroupAddress2LevelPlcField { + return GroupAddress2LevelPlcField{ + MainGroup: mainGroup, + SubGroup: subGroup, + FieldType: fieldType, + } +} + +func (k GroupAddress2LevelPlcField) GetAddressString() string { + return fmt.Sprintf("%s/%s:%s", k.MainGroup, k.SubGroup, k.FieldType.String()) +} + +func (k GroupAddress2LevelPlcField) GetTypeName() string { + return k.FieldType.Name() +} + +func (k GroupAddress2LevelPlcField) GetFieldType() *driverModel.KnxDatapointType { + return k.FieldType +} + +func (k GroupAddress2LevelPlcField) GetQuantity() uint16 { + return 1 +} + +func (k GroupAddress2LevelPlcField) IsPatternField() bool { + _, err := strconv.Atoi(k.MainGroup) + if err == nil { + _, err = strconv.Atoi(k.SubGroup) + if err == nil { + return false + } + } + return true +} + +func (k GroupAddress2LevelPlcField) matches(knxGroupAddress driverModel.KnxGroupAddress) bool { + level2KnxGroupAddress := driverModel.CastKnxGroupAddress2Level(knxGroupAddress) + if level2KnxGroupAddress == nil { + return false + } + return matches(k.MainGroup, strconv.Itoa(int(level2KnxGroupAddress.GetMainGroup()))) && + matches(k.SubGroup, strconv.Itoa(int(level2KnxGroupAddress.GetSubGroup()))) +} + +func (k GroupAddress2LevelPlcField) toGroupAddress() driverModel.KnxGroupAddress { + mainGroup, err := strconv.ParseUint(k.MainGroup, 10, 8) + if err != nil { + return nil + } + subGroup, err := strconv.ParseUint(k.SubGroup, 10, 16) + if err != nil { + return nil + } + return driverModel.NewKnxGroupAddress2Level(uint8(mainGroup), uint16(subGroup)) +} + +type GroupAddress1LevelPlcField struct { + MainGroup string // 16 Bits + FieldType *driverModel.KnxDatapointType + Field +} + +func NewGroupAddress1LevelPlcField(mainGroup string, fieldType *driverModel.KnxDatapointType) GroupAddress1LevelPlcField { + return GroupAddress1LevelPlcField{ + MainGroup: mainGroup, + FieldType: fieldType, + } +} + +func (k GroupAddress1LevelPlcField) GetAddressString() string { + return fmt.Sprintf("%s:%s", k.MainGroup, k.FieldType.String()) +} + +func (k GroupAddress1LevelPlcField) GetTypeName() string { + return k.FieldType.Name() +} + +func (k GroupAddress1LevelPlcField) GetFieldType() *driverModel.KnxDatapointType { + return k.FieldType +} + +func (k GroupAddress1LevelPlcField) GetQuantity() uint16 { + return 1 +} + +func (k GroupAddress1LevelPlcField) IsPatternField() bool { + _, err := strconv.Atoi(k.MainGroup) + if err == nil { + return false + } + return true +} + +func (k GroupAddress1LevelPlcField) matches(knxGroupAddress driverModel.KnxGroupAddress) bool { + level1KnxGroupAddress := driverModel.CastKnxGroupAddressFreeLevel(knxGroupAddress) + if level1KnxGroupAddress == nil { + return false + } + return matches(k.MainGroup, strconv.Itoa(int(level1KnxGroupAddress.GetSubGroup()))) +} + +func (k GroupAddress1LevelPlcField) toGroupAddress() driverModel.KnxGroupAddress { + mainGroup, err := strconv.ParseUint(k.MainGroup, 10, 16) + if err != nil { + return nil + } + return driverModel.NewKnxGroupAddressFreeLevel(uint16(mainGroup)) +} + +type DeviceQueryField struct { + MainGroup string // 5 Bits: Values 0-31 + MiddleGroup string // 3 Bits: values 0-7 + SubGroup string // 8 Bits + DeviceField +} + +func NewDeviceQueryField(mainGroup string, middleGroup string, subGroup string) DeviceQueryField { + return DeviceQueryField{ + MainGroup: mainGroup, + MiddleGroup: middleGroup, + SubGroup: subGroup, + } +} + +func (k DeviceQueryField) GetAddressString() string { + return fmt.Sprintf("%s.%s.%s", k.MainGroup, k.MiddleGroup, k.SubGroup) +} + +func (k DeviceQueryField) GetTypeName() string { + return "" +} + +func (k DeviceQueryField) GetQuantity() uint16 { + return 1 +} + +func (k DeviceQueryField) toKnxAddress() driverModel.KnxAddress { + return nil +} + +type DevicePropertyAddressPlcField struct { + MainGroup uint8 // 5 Bits: Values 0-31 + MiddleGroup uint8 // 3 Bits: values 0-7 + SubGroup uint8 // 8 Bits + ObjectId uint8 + PropertyId uint8 + PropertyIndex uint16 + NumElements uint8 + DeviceField +} + +func NewDevicePropertyAddressPlcField(mainGroup uint8, middleGroup uint8, subGroup uint8, objectId uint8, propertyId uint8, propertyIndex uint16, numElements uint8) DevicePropertyAddressPlcField { + return DevicePropertyAddressPlcField{ + MainGroup: mainGroup, + MiddleGroup: middleGroup, + SubGroup: subGroup, + ObjectId: objectId, + PropertyId: propertyId, + PropertyIndex: propertyIndex, + NumElements: numElements, + } +} + +func (k DevicePropertyAddressPlcField) GetAddressString() string { + return fmt.Sprintf("%d/%d/%d#%d/%d/%d[%d]", + k.MainGroup, k.MiddleGroup, k.SubGroup, k.ObjectId, k.PropertyId, k.PropertyIndex, k.NumElements) +} + +func (k DevicePropertyAddressPlcField) GetTypeName() string { + return "" +} + +func (k DevicePropertyAddressPlcField) GetQuantity() uint16 { + return 1 +} + +func (k DevicePropertyAddressPlcField) toKnxAddress() driverModel.KnxAddress { + return driverModel.NewKnxAddress( + k.MainGroup, + k.MiddleGroup, + k.SubGroup, + ) +} + +type DeviceMemoryAddressPlcField struct { + MainGroup uint8 // 5 Bits: Values 0-31 + MiddleGroup uint8 // 3 Bits: values 0-7 + SubGroup uint8 // 8 Bits + Address uint16 + NumElements uint8 + FieldType *driverModel.KnxDatapointType + DeviceField +} + +func NewDeviceMemoryAddressPlcField(mainGroup uint8, middleGroup uint8, subGroup uint8, address uint16, numElements uint8, fieldType *driverModel.KnxDatapointType) DeviceMemoryAddressPlcField { + return DeviceMemoryAddressPlcField{ + MainGroup: mainGroup, + MiddleGroup: middleGroup, + SubGroup: subGroup, + Address: address, + NumElements: numElements, + FieldType: fieldType, + } +} + +func (k DeviceMemoryAddressPlcField) GetAddressString() string { + return fmt.Sprintf("%d/%d/%d#%d:%s[%d]", + k.MainGroup, k.MiddleGroup, k.SubGroup, k.Address, k.FieldType.String(), k.NumElements) +} + +func (k DeviceMemoryAddressPlcField) GetTypeName() string { + if k.FieldType != nil { + return k.FieldType.Name() + } + return "" +} + +func (k DeviceMemoryAddressPlcField) GetFieldType() *driverModel.KnxDatapointType { + return k.FieldType +} + +func (k DeviceMemoryAddressPlcField) GetQuantity() uint16 { + return uint16(k.NumElements) +} + +func (k DeviceMemoryAddressPlcField) toKnxAddress() driverModel.KnxAddress { + individualAddress := driverModel.NewKnxAddress( + k.MainGroup, + k.MiddleGroup, + k.SubGroup, + ) + return individualAddress +} + +type CommunicationObjectQueryField struct { + MainGroup uint8 // 5 Bits: Values 0-31 + MiddleGroup uint8 // 3 Bits: values 0-7 + SubGroup uint8 // 8 Bits + DeviceField +} + +func NewCommunicationObjectQueryField(mainGroup uint8, middleGroup uint8, subGroup uint8) CommunicationObjectQueryField { + return CommunicationObjectQueryField{ + MainGroup: mainGroup, + MiddleGroup: middleGroup, + SubGroup: subGroup, + } +} + +func (k CommunicationObjectQueryField) GetAddressString() string { + return fmt.Sprintf("%d.%d.%d#com-obj", + k.MainGroup, k.MiddleGroup, k.SubGroup) +} + +func (k CommunicationObjectQueryField) GetTypeName() string { + return "" +} + +func (k CommunicationObjectQueryField) GetQuantity() uint16 { + return 1 +} + +func (k CommunicationObjectQueryField) toKnxAddress() driverModel.KnxAddress { + individualAddress := driverModel.NewKnxAddress( + k.MainGroup, + k.MiddleGroup, + k.SubGroup, + ) + return individualAddress +} + +func CastToFieldFromPlcField(plcField apiModel.PlcField) (Field, error) { + if field, ok := plcField.(Field); ok { + return field, nil + } + return nil, errors.New("couldn't cast to KnxNetIpField") +} + +func matches(pattern string, groupAddressPart string) bool { + // A "*" simply matches everything + if pattern == "*" { + return true + } + // If the pattern starts and ends with square brackets, it's a list of values or range queries + if strings.HasPrefix(pattern, "[") && strings.HasSuffix(pattern, "]") { + matches := false + for _, segment := range strings.Split(pattern, ",") { + if strings.Contains(segment, "-") { + // If the segment contains a "-", then it's a range query + split := strings.Split(segment, "-") + if len(split) == 2 { + if val, err := strconv.Atoi(groupAddressPart); err != nil { + var err error + var from int + if from, err = strconv.Atoi(split[0]); err != nil { + continue + } + if val < from { + continue + } + var to int + if to, err = strconv.Atoi(split[1]); err == nil { + continue + } + if val > to { + continue + } + matches = true + } + } + } else if segment == groupAddressPart { + // In all other cases it's an explicit value + matches = true + } + } + return matches + } else { + return pattern == groupAddressPart + } +} diff --git a/plc4go/internal/knxnetip/MessageCodec.go b/plc4go/internal/knxnetip/MessageCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Reader.go b/plc4go/internal/knxnetip/Reader.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Subscriber.go b/plc4go/internal/knxnetip/Subscriber.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/SubscriptionEvent.go b/plc4go/internal/knxnetip/SubscriptionEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/TagHandler.go b/plc4go/internal/knxnetip/TagHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Utils.go b/plc4go/internal/knxnetip/Utils.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/ValueDecoder.go b/plc4go/internal/knxnetip/ValueDecoder.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/ValueHandler.go b/plc4go/internal/knxnetip/ValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/knxnetip/Writer.go b/plc4go/internal/knxnetip/Writer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/Connection.go b/plc4go/internal/modbus/Connection.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/Field.go b/plc4go/internal/modbus/Field.go new file mode 100755 index 00000000000..058f9740f29 --- /dev/null +++ b/plc4go/internal/modbus/Field.go @@ -0,0 +1,112 @@ +/* + * 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 modbus + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + model2 "github.com/apache/plc4x/plc4go/protocols/modbus/readwrite/model" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" + "strconv" +) + +const ( + AddressOffset = 1 +) + +type PlcField struct { + FieldType FieldType + Address uint16 + Quantity uint16 + Datatype model2.ModbusDataType +} + +func NewField(fieldType FieldType, address uint16, quantity uint16, datatype model2.ModbusDataType) PlcField { + return PlcField{ + FieldType: fieldType, + Address: address - AddressOffset, + Quantity: quantity, + Datatype: datatype, + } +} + +func NewModbusPlcFieldFromStrings(fieldType FieldType, addressString string, quantityString string, datatype model2.ModbusDataType) (model.PlcField, error) { + address, err := strconv.ParseUint(addressString, 10, 16) + if err != nil { + return nil, errors.Errorf("Couldn't parse address string '%s' into an int", addressString) + } + if quantityString == "" { + log.Debug().Msg("No quantity supplied, assuming 1") + quantityString = "1" + } + quantity, err := strconv.ParseUint(quantityString, 10, 16) + if err != nil { + log.Warn().Err(err).Msgf("Error during parsing for %s. Falling back to 1", quantityString) + quantity = 1 + } + return NewField(fieldType, uint16(address), uint16(quantity), datatype), nil +} + +func (m PlcField) GetAddressString() string { + return fmt.Sprintf("%dx%05d:%s[%d]", m.FieldType, m.Address, m.Datatype.String(), m.Quantity) +} + +func (m PlcField) GetTypeName() string { + return m.Datatype.String() +} + +func (m PlcField) GetDataType() model2.ModbusDataType { + return m.Datatype +} + +func (m PlcField) GetQuantity() uint16 { + return m.Quantity +} + +func CastToModbusFieldFromPlcField(plcField model.PlcField) (PlcField, error) { + if modbusField, ok := plcField.(PlcField); ok { + return modbusField, nil + } + return PlcField{}, errors.New("couldn't cast to ModbusPlcField") +} + +func (m PlcField) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext(m.FieldType.GetName()); err != nil { + return err + } + + if err := writeBuffer.WriteUint16("address", 16, m.Address); err != nil { + return err + } + if err := writeBuffer.WriteUint16("numberOfElements", 16, m.GetQuantity()); err != nil { + return err + } + dataType := m.GetDataType().String() + if err := writeBuffer.WriteString("dataType", uint32(len([]rune(dataType))*8), "UTF-8", dataType); err != nil { + return err + } + + if err := writeBuffer.PopContext(m.FieldType.GetName()); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/modbus/FieldHandler.go b/plc4go/internal/modbus/FieldHandler.go new file mode 100755 index 00000000000..fe8d3ef9812 --- /dev/null +++ b/plc4go/internal/modbus/FieldHandler.go @@ -0,0 +1,99 @@ +/* + * 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 modbus + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + model2 "github.com/apache/plc4x/plc4go/protocols/modbus/readwrite/model" + "github.com/pkg/errors" + "regexp" +) + +type FieldType uint8 + +//go:generate stringer -type FieldType +const ( + Coil FieldType = 0x00 + DiscreteInput FieldType = 0x01 + InputRegister FieldType = 0x03 + HoldingRegister FieldType = 0x04 + ExtendedRegister FieldType = 0x06 +) + +func (i FieldType) GetName() string { + return fmt.Sprintf("ModbusField%s", i.String()) +} + +type FieldHandler struct { + plc4xCoilPattern *regexp.Regexp + numericCoilPattern *regexp.Regexp + plc4xDiscreteInputPattern *regexp.Regexp + numericDiscreteInputPattern *regexp.Regexp + plc4xInputRegisterPattern *regexp.Regexp + numericInputRegisterPattern *regexp.Regexp + plc4xHoldingRegisterPattern *regexp.Regexp + numericHoldingRegisterPattern *regexp.Regexp + plc4xExtendedRegisterPattern *regexp.Regexp + numericExtendedRegisterPattern *regexp.Regexp +} + +func NewFieldHandler() FieldHandler { + generalAddressPattern := `(?P
\d+)(:(?P[a-zA-Z_]+))?(\[(?P\d+)])?$` + generalFixedDigitAddressPattern := `(?P
\d{4,5})?(:(?P[a-zA-Z_]+))?(\[(?P\d+)])?$` + return FieldHandler{ + plc4xCoilPattern: regexp.MustCompile("^coil:" + generalAddressPattern), + numericCoilPattern: regexp.MustCompile("^0[xX]?" + generalFixedDigitAddressPattern), + plc4xDiscreteInputPattern: regexp.MustCompile("^discrete-input:" + generalAddressPattern), + numericDiscreteInputPattern: regexp.MustCompile("^1[xX]?" + generalFixedDigitAddressPattern), + plc4xInputRegisterPattern: regexp.MustCompile("^input-register:" + generalAddressPattern), + numericInputRegisterPattern: regexp.MustCompile("^3[xX]?" + generalFixedDigitAddressPattern), + plc4xHoldingRegisterPattern: regexp.MustCompile("^holding-register:" + generalAddressPattern), + numericHoldingRegisterPattern: regexp.MustCompile("^4[xX]?" + generalFixedDigitAddressPattern), + plc4xExtendedRegisterPattern: regexp.MustCompile("^extended-register:" + generalAddressPattern), + numericExtendedRegisterPattern: regexp.MustCompile("^6[xX]?" + generalFixedDigitAddressPattern), + } +} + +func (m FieldHandler) ParseQuery(query string) (model.PlcField, error) { + if match := utils.GetSubgroupMatches(m.plc4xCoilPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(Coil, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.numericCoilPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(Coil, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.plc4xDiscreteInputPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(DiscreteInput, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.numericDiscreteInputPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(DiscreteInput, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.plc4xInputRegisterPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(InputRegister, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.numericInputRegisterPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(InputRegister, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.plc4xHoldingRegisterPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(HoldingRegister, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.numericHoldingRegisterPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(HoldingRegister, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.plc4xExtendedRegisterPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(ExtendedRegister, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } else if match := utils.GetSubgroupMatches(m.numericExtendedRegisterPattern, query); match != nil { + return NewModbusPlcFieldFromStrings(ExtendedRegister, match["address"], match["quantity"], model2.ModbusDataTypeByName(match["datatype"])) + } + return nil, errors.Errorf("Invalid address format for address '%s'", query) +} diff --git a/plc4go/internal/modbus/MessageCodec.go b/plc4go/internal/modbus/MessageCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/ModbusAsciiDriver.go b/plc4go/internal/modbus/ModbusAsciiDriver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/ModbusRtuDriver.go b/plc4go/internal/modbus/ModbusRtuDriver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/ModbusTcpDriver.go b/plc4go/internal/modbus/ModbusTcpDriver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/Reader.go b/plc4go/internal/modbus/Reader.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/ValueHandler.go b/plc4go/internal/modbus/ValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/Writer.go b/plc4go/internal/modbus/Writer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/modbus/tagtype_string.go b/plc4go/internal/modbus/tagtype_string.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/Configuration.go b/plc4go/internal/s7/Configuration.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/Connection.go b/plc4go/internal/s7/Connection.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/ControllerType.go b/plc4go/internal/s7/ControllerType.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/Driver.go b/plc4go/internal/s7/Driver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/DriverContext.go b/plc4go/internal/s7/DriverContext.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/MessageCodec.go b/plc4go/internal/s7/MessageCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/Reader.go b/plc4go/internal/s7/Reader.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/Tag.go b/plc4go/internal/s7/Tag.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/TagHandler.go b/plc4go/internal/s7/TagHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/TsapIdEncoder.go b/plc4go/internal/s7/TsapIdEncoder.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/ValueHandler.go b/plc4go/internal/s7/ValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/Writer.go b/plc4go/internal/s7/Writer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/s7Io_test.go b/plc4go/internal/s7/s7Io_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/s7/tagtype_string.go b/plc4go/internal/s7/tagtype_string.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Connection.go b/plc4go/internal/simulated/Connection.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Connection_test.go b/plc4go/internal/simulated/Connection_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Device.go b/plc4go/internal/simulated/Device.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Device_test.go b/plc4go/internal/simulated/Device_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Driver.go b/plc4go/internal/simulated/Driver.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Driver_test.go b/plc4go/internal/simulated/Driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Reader.go b/plc4go/internal/simulated/Reader.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Reader_test.go b/plc4go/internal/simulated/Reader_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Tag.go b/plc4go/internal/simulated/Tag.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/TagHandler.go b/plc4go/internal/simulated/TagHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/TagHandler_test.go b/plc4go/internal/simulated/TagHandler_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Tag_test.go b/plc4go/internal/simulated/Tag_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/ValueHandler.go b/plc4go/internal/simulated/ValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Writer.go b/plc4go/internal/simulated/Writer.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/simulated/Writer_test.go b/plc4go/internal/simulated/Writer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/internal/spi/model/DefaultBrowseRequest.go b/plc4go/internal/spi/model/DefaultBrowseRequest.go new file mode 100755 index 00000000000..f80a13917dd --- /dev/null +++ b/plc4go/internal/spi/model/DefaultBrowseRequest.go @@ -0,0 +1,103 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi" + "github.com/apache/plc4x/plc4go/pkg/api/model" +) + +type DefaultPlcBrowseRequestBuilder struct { + browser spi.PlcBrowser + queries map[string]string +} + +func NewDefaultPlcBrowseRequestBuilder(browser spi.PlcBrowser) *DefaultPlcBrowseRequestBuilder { + return &DefaultPlcBrowseRequestBuilder{ + browser: browser, + queries: map[string]string{}, + } +} + +func (m *DefaultPlcBrowseRequestBuilder) AddItem(name string, query string) model.PlcBrowseRequestBuilder { + m.queries[name] = query + return m +} + +func (m *DefaultPlcBrowseRequestBuilder) Build() (model.PlcBrowseRequest, error) { + queries := m.queries + return DefaultPlcBrowseRequest{ + queries: queries, + browser: m.browser, + }, nil +} + +type DefaultPlcBrowseRequest struct { + queries map[string]string + browser spi.PlcBrowser +} + +func (d DefaultPlcBrowseRequest) GetQueryNames() []string { + var queryNames []string + for queryName := range d.queries { + queryNames = append(queryNames, queryName) + } + return queryNames +} + +func (d DefaultPlcBrowseRequest) GetQueryString(name string) string { + return d.queries[name] +} + +func (d DefaultPlcBrowseRequest) Execute() <-chan model.PlcBrowseRequestResult { + return d.browser.Browse(d) +} + +func (d DefaultPlcBrowseRequest) ExecuteWithInterceptor(interceptor func(result model.PlcBrowseEvent) bool) <-chan model.PlcBrowseRequestResult { + return d.browser.BrowseWithInterceptor(d, interceptor) +} + +type DefaultPlcBrowseResponse struct { + request model.PlcBrowseRequest + results map[string][]model.PlcBrowseQueryResult +} + +func NewDefaultPlcBrowseResponse(request model.PlcBrowseRequest, results map[string][]model.PlcBrowseQueryResult) DefaultPlcBrowseResponse { + return DefaultPlcBrowseResponse{ + request: request, + results: results, + } +} + +func (d DefaultPlcBrowseResponse) GetRequest() model.PlcBrowseRequest { + return d.request +} + +func (d DefaultPlcBrowseResponse) GetQueryNames() []string { + var queryNames []string + for queryName := range d.results { + queryNames = append(queryNames, queryName) + } + return queryNames +} + +func (d DefaultPlcBrowseResponse) GetQueryResults(queryName string) []model.PlcBrowseQueryResult { + return d.results[queryName] +} diff --git a/plc4go/internal/spi/model/DefaultPlcBrowseQueryResult.go b/plc4go/internal/spi/model/DefaultPlcBrowseQueryResult.go new file mode 100755 index 00000000000..9fb7dab46e9 --- /dev/null +++ b/plc4go/internal/spi/model/DefaultPlcBrowseQueryResult.go @@ -0,0 +1,55 @@ +/* + * 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 model + +import "github.com/apache/plc4x/plc4go/pkg/api/model" + +type DefaultPlcBrowseQueryResult struct { + Field model.PlcField + Name string + Readable bool + Writable bool + Subscribable bool + PossibleDataTypes []string +} + +func (d *DefaultPlcBrowseQueryResult) GetField() model.PlcField { + return d.Field +} + +func (d *DefaultPlcBrowseQueryResult) GetName() string { + return d.Name +} + +func (d *DefaultPlcBrowseQueryResult) IsReadable() bool { + return d.Readable +} + +func (d *DefaultPlcBrowseQueryResult) IsWritable() bool { + return d.Writable +} + +func (d *DefaultPlcBrowseQueryResult) IsSubscribable() bool { + return d.Subscribable +} + +func (d *DefaultPlcBrowseQueryResult) GetPossibleDataTypes() []string { + return d.PossibleDataTypes +} diff --git a/plc4go/internal/spi/model/DefaultPlcReadRequest.go b/plc4go/internal/spi/model/DefaultPlcReadRequest.go new file mode 100755 index 00000000000..d78cc4df5a8 --- /dev/null +++ b/plc4go/internal/spi/model/DefaultPlcReadRequest.go @@ -0,0 +1,174 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi" + "github.com/apache/plc4x/plc4go/internal/spi/interceptors" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + "github.com/pkg/errors" + "time" +) + +type DefaultPlcReadRequestBuilder struct { + reader spi.PlcReader + fieldHandler spi.PlcFieldHandler + queries map[string]string + queryNames []string + fields map[string]model.PlcField + fieldNames []string + readRequestInterceptor interceptors.ReadRequestInterceptor +} + +func NewDefaultPlcReadRequestBuilder(fieldHandler spi.PlcFieldHandler, reader spi.PlcReader) *DefaultPlcReadRequestBuilder { + return NewDefaultPlcReadRequestBuilderWithInterceptor(fieldHandler, reader, nil) +} + +func NewDefaultPlcReadRequestBuilderWithInterceptor(fieldHandler spi.PlcFieldHandler, reader spi.PlcReader, readRequestInterceptor interceptors.ReadRequestInterceptor) *DefaultPlcReadRequestBuilder { + return &DefaultPlcReadRequestBuilder{ + reader: reader, + fieldHandler: fieldHandler, + queries: map[string]string{}, + queryNames: make([]string, 0), + fields: map[string]model.PlcField{}, + fieldNames: make([]string, 0), + readRequestInterceptor: readRequestInterceptor, + } +} + +func (m *DefaultPlcReadRequestBuilder) AddQuery(name string, query string) model.PlcReadRequestBuilder { + m.queryNames = append(m.queryNames, name) + m.queries[name] = query + return m +} + +func (m *DefaultPlcReadRequestBuilder) AddField(name string, field model.PlcField) model.PlcReadRequestBuilder { + m.fieldNames = append(m.fieldNames, name) + m.fields[name] = field + return m +} + +func (m *DefaultPlcReadRequestBuilder) Build() (model.PlcReadRequest, error) { + for _, name := range m.queryNames { + query := m.queries[name] + field, err := m.fieldHandler.ParseQuery(query) + if err != nil { + return nil, errors.Wrapf(err, "Error parsing query: %s", query) + } + m.AddField(name, field) + } + return NewDefaultPlcReadRequest(m.fields, m.fieldNames, m.reader, m.readRequestInterceptor), nil +} + +type DefaultPlcReadRequest struct { + DefaultRequest + reader spi.PlcReader + readRequestInterceptor interceptors.ReadRequestInterceptor +} + +func NewDefaultPlcReadRequest(fields map[string]model.PlcField, fieldNames []string, reader spi.PlcReader, readRequestInterceptor interceptors.ReadRequestInterceptor) model.PlcReadRequest { + return DefaultPlcReadRequest{ + DefaultRequest: NewDefaultRequest(fields, fieldNames), + reader: reader, + readRequestInterceptor: readRequestInterceptor, + } +} + +func (m DefaultPlcReadRequest) GetReader() spi.PlcReader { + return m.reader +} + +func (m DefaultPlcReadRequest) GetReadRequestInterceptor() interceptors.ReadRequestInterceptor { + return m.readRequestInterceptor +} + +func (m DefaultPlcReadRequest) Execute() <-chan model.PlcReadRequestResult { + // Shortcut, if no interceptor is defined + if m.readRequestInterceptor == nil { + return m.reader.Read(m) + } + + // Split the requests up into multiple ones. + readRequests := m.readRequestInterceptor.InterceptReadRequest(m) + // Shortcut for single-request-requests + if len(readRequests) == 1 { + return m.reader.Read(readRequests[0]) + } + // Create a sub-result-channel slice + var subResultChannels []<-chan model.PlcReadRequestResult + + // Iterate over all requests and add the result-channels to the list + for _, subRequest := range readRequests { + subResultChannels = append(subResultChannels, m.reader.Read(subRequest)) + // TODO: Replace this with a real queueing of requests. Later on we need throttling. At the moment this avoids race condition as the read above writes to fast on the line which is a problem for the test + time.Sleep(time.Millisecond * 4) + } + + // Create a new result-channel, which completes as soon as all sub-result-channels have returned + resultChannel := make(chan model.PlcReadRequestResult) + go func() { + var subResults []model.PlcReadRequestResult + // Iterate over all sub-results + for _, subResultChannel := range subResultChannels { + subResult := <-subResultChannel + subResults = append(subResults, subResult) + } + // As soon as all are done, process the results + result := m.readRequestInterceptor.ProcessReadResponses(m, subResults) + // Return the final result + resultChannel <- result + }() + + return resultChannel +} + +func (m DefaultPlcReadRequest) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("PlcReadRequest"); err != nil { + return err + } + + if err := writeBuffer.PushContext("fields"); err != nil { + return err + } + for _, fieldName := range m.GetFieldNames() { + if err := writeBuffer.PushContext(fieldName); err != nil { + return err + } + field := m.GetField(fieldName) + if serializableField, ok := field.(utils.Serializable); ok { + if err := serializableField.Serialize(writeBuffer); err != nil { + return err + } + } else { + return errors.Errorf("Error serializing. Field %T doesn't implement Serializable", field) + } + if err := writeBuffer.PopContext(fieldName); err != nil { + return err + } + } + if err := writeBuffer.PopContext("fields"); err != nil { + return err + } + if err := writeBuffer.PopContext("PlcReadRequest"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/spi/model/DefaultPlcReadResponse.go b/plc4go/internal/spi/model/DefaultPlcReadResponse.go new file mode 100755 index 00000000000..5b7e5ac04d1 --- /dev/null +++ b/plc4go/internal/spi/model/DefaultPlcReadResponse.go @@ -0,0 +1,115 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + values2 "github.com/apache/plc4x/plc4go/internal/spi/values" + "github.com/apache/plc4x/plc4go/pkg/api/model" + "github.com/apache/plc4x/plc4go/pkg/api/values" +) + +type DefaultPlcReadResponse struct { + DefaultResponse + request model.PlcReadRequest + values map[string]values.PlcValue +} + +func NewDefaultPlcReadResponse(request model.PlcReadRequest, responseCodes map[string]model.PlcResponseCode, values map[string]values.PlcValue) model.PlcReadResponse { + return DefaultPlcReadResponse{ + DefaultResponse: NewDefaultResponse(responseCodes), + request: request, + values: values, + } +} + +func (m DefaultPlcReadResponse) GetFieldNames() []string { + var fieldNames []string + // We take the field names from the request to keep order as map is not ordered + for _, name := range m.request.GetFieldNames() { + if _, ok := m.values[name]; ok { + fieldNames = append(fieldNames, name) + } + } + return fieldNames +} + +func (m DefaultPlcReadResponse) GetRequest() model.PlcReadRequest { + return m.request +} + +func (m DefaultPlcReadResponse) GetValue(name string) values.PlcValue { + return m.values[name] +} + +func (m DefaultPlcReadResponse) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("PlcReadResponse"); err != nil { + return err + } + + if request, ok := m.request.(utils.Serializable); ok { + if err := request.Serialize(writeBuffer); err != nil { + return err + } + } + if err := writeBuffer.PushContext("values"); err != nil { + return err + } + for _, fieldName := range m.GetFieldNames() { + if err := writeBuffer.PushContext(fieldName); err != nil { + return err + } + if err := writeBuffer.PushContext("ResponseItem"); err != nil { + return err + } + codeName := m.GetResponseCode(fieldName).GetName() + if err := writeBuffer.WriteString("result", uint32(len([]rune(codeName))*8), "UTF-8", codeName); err != nil { + return err + } + + valueResponse := m.GetValue(fieldName) + if _, ok := valueResponse.(values2.PlcNULL); ok { + // We ignore nulls + if err := writeBuffer.PopContext("ResponseItem"); err != nil { + return err + } + if err := writeBuffer.PopContext(fieldName); err != nil { + return err + } + continue + } + if err := valueResponse.(utils.Serializable).Serialize(writeBuffer); err != nil { + return err + } + if err := writeBuffer.PopContext("ResponseItem"); err != nil { + return err + } + if err := writeBuffer.PopContext(fieldName); err != nil { + return err + } + } + if err := writeBuffer.PopContext("values"); err != nil { + return err + } + if err := writeBuffer.PopContext("PlcReadResponse"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/spi/model/DefaultPlcSubscriptionEvent.go b/plc4go/internal/spi/model/DefaultPlcSubscriptionEvent.go new file mode 100755 index 00000000000..8f8dc0ace74 --- /dev/null +++ b/plc4go/internal/spi/model/DefaultPlcSubscriptionEvent.go @@ -0,0 +1,104 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + "github.com/apache/plc4x/plc4go/pkg/api/values" + "time" +) + +type DefaultPlcSubscriptionEvent struct { + DefaultResponse + fields map[string]model.PlcField + types map[string]SubscriptionType + intervals map[string]time.Duration + values map[string]values.PlcValue +} + +func NewDefaultPlcSubscriptionEvent(fields map[string]model.PlcField, types map[string]SubscriptionType, + intervals map[string]time.Duration, responseCodes map[string]model.PlcResponseCode, + values map[string]values.PlcValue) DefaultPlcSubscriptionEvent { + return DefaultPlcSubscriptionEvent{ + DefaultResponse: NewDefaultResponse(responseCodes), + fields: fields, + types: types, + intervals: intervals, + values: values, + } +} + +func (m DefaultPlcSubscriptionEvent) GetFieldNames() []string { + var fieldNames []string + for fieldName := range m.fields { + fieldNames = append(fieldNames, fieldName) + } + return fieldNames +} + +func (m DefaultPlcSubscriptionEvent) GetField(name string) model.PlcField { + return m.fields[name] +} + +func (m DefaultPlcSubscriptionEvent) GetType(name string) SubscriptionType { + return m.types[name] +} + +func (m DefaultPlcSubscriptionEvent) GetInterval(name string) time.Duration { + return m.intervals[name] +} + +func (m DefaultPlcSubscriptionEvent) GetAddress(name string) string { + panic("GetAddress not implemented") +} + +func (m DefaultPlcSubscriptionEvent) GetValue(name string) values.PlcValue { + return m.values[name] +} + +func (m DefaultPlcSubscriptionEvent) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("PlcReadResponse"); err != nil { + return err + } + + if err := writeBuffer.PushContext("fields"); err != nil { + return err + } + for _, fieldName := range m.GetFieldNames() { + if err := writeBuffer.PushContext(fieldName); err != nil { + return err + } + valueResponse := m.GetValue(fieldName) + if err := valueResponse.(utils.Serializable).Serialize(writeBuffer); err != nil { + return err + } + if err := writeBuffer.PopContext(fieldName); err != nil { + return err + } + } + if err := writeBuffer.PopContext("fields"); err != nil { + return err + } + if err := writeBuffer.PopContext("PlcReadResponse"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/spi/model/DefaultPlcSubscriptionRequest.go b/plc4go/internal/spi/model/DefaultPlcSubscriptionRequest.go new file mode 100755 index 00000000000..4f805a5976f --- /dev/null +++ b/plc4go/internal/spi/model/DefaultPlcSubscriptionRequest.go @@ -0,0 +1,185 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + "github.com/pkg/errors" + "time" +) + +type SubscriptionType uint8 + +const ( + SubscriptionCyclic SubscriptionType = 0x01 + SubscriptionChangeOfState SubscriptionType = 0x02 + SubscriptionEvent SubscriptionType = 0x03 +) + +type DefaultPlcSubscriptionRequestBuilder struct { + subscriber spi.PlcSubscriber + fieldHandler spi.PlcFieldHandler + valueHandler spi.PlcValueHandler + eventHandler model.PlcSubscriptionEventHandler + queries map[string]string + queryNames []string + fields map[string]model.PlcField + fieldNames []string + types map[string]SubscriptionType + intervals map[string]time.Duration +} + +func NewDefaultPlcSubscriptionRequestBuilder(fieldHandler spi.PlcFieldHandler, valueHandler spi.PlcValueHandler, subscriber spi.PlcSubscriber) *DefaultPlcSubscriptionRequestBuilder { + return &DefaultPlcSubscriptionRequestBuilder{ + subscriber: subscriber, + fieldHandler: fieldHandler, + valueHandler: valueHandler, + queries: map[string]string{}, + fields: map[string]model.PlcField{}, + fieldNames: make([]string, 0), + types: map[string]SubscriptionType{}, + intervals: map[string]time.Duration{}, + } +} + +func (m *DefaultPlcSubscriptionRequestBuilder) AddCyclicQuery(name string, query string, interval time.Duration) model.PlcSubscriptionRequestBuilder { + m.queryNames = append(m.queryNames, name) + m.queries[name] = query + m.types[name] = SubscriptionCyclic + m.intervals[name] = interval + return m +} + +func (m *DefaultPlcSubscriptionRequestBuilder) AddCyclicField(name string, field model.PlcField, interval time.Duration) model.PlcSubscriptionRequestBuilder { + m.fieldNames = append(m.fieldNames, name) + m.fields[name] = field + m.types[name] = SubscriptionCyclic + m.intervals[name] = interval + return m +} + +func (m *DefaultPlcSubscriptionRequestBuilder) AddChangeOfStateQuery(name string, query string) model.PlcSubscriptionRequestBuilder { + m.queryNames = append(m.queryNames, name) + m.queries[name] = query + m.types[name] = SubscriptionChangeOfState + return m +} + +func (m *DefaultPlcSubscriptionRequestBuilder) AddChangeOfStateField(name string, field model.PlcField) model.PlcSubscriptionRequestBuilder { + m.fieldNames = append(m.fieldNames, name) + m.fields[name] = field + m.types[name] = SubscriptionChangeOfState + return m +} + +func (m *DefaultPlcSubscriptionRequestBuilder) AddEventQuery(name string, query string) model.PlcSubscriptionRequestBuilder { + m.queryNames = append(m.queryNames, name) + m.queries[name] = query + m.types[name] = SubscriptionEvent + return m +} + +func (m *DefaultPlcSubscriptionRequestBuilder) AddEventField(name string, field model.PlcField) model.PlcSubscriptionRequestBuilder { + m.fieldNames = append(m.fieldNames, name) + m.fields[name] = field + m.types[name] = SubscriptionEvent + return m +} + +func (m *DefaultPlcSubscriptionRequestBuilder) AddItemHandler(eventHandler model.PlcSubscriptionEventHandler) model.PlcSubscriptionRequestBuilder { + m.eventHandler = eventHandler + return m +} + +func (m *DefaultPlcSubscriptionRequestBuilder) Build() (model.PlcSubscriptionRequest, error) { + for _, name := range m.queryNames { + query := m.queries[name] + field, err := m.fieldHandler.ParseQuery(query) + if err != nil { + return nil, errors.Wrapf(err, "Error parsing query: %s", query) + } + m.fieldNames = append(m.fieldNames, name) + m.fields[name] = field + } + return NewDefaultPlcSubscriptionRequest(m.fields, m.fieldNames, m.types, m.intervals, m.subscriber, m.eventHandler), nil +} + +type DefaultPlcSubscriptionRequest struct { + DefaultRequest + types map[string]SubscriptionType + intervals map[string]time.Duration + subscriber spi.PlcSubscriber + eventHandler model.PlcSubscriptionEventHandler +} + +func NewDefaultPlcSubscriptionRequest(fields map[string]model.PlcField, fieldNames []string, types map[string]SubscriptionType, intervals map[string]time.Duration, subscriber spi.PlcSubscriber, eventHandler model.PlcSubscriptionEventHandler) model.PlcSubscriptionRequest { + return DefaultPlcSubscriptionRequest{NewDefaultRequest(fields, fieldNames), types, intervals, subscriber, eventHandler} +} + +func (m DefaultPlcSubscriptionRequest) Execute() <-chan model.PlcSubscriptionRequestResult { + return m.subscriber.Subscribe(m) +} + +func (m DefaultPlcSubscriptionRequest) GetEventHandler() model.PlcSubscriptionEventHandler { + return m.eventHandler +} + +func (m DefaultPlcSubscriptionRequest) GetType(name string) SubscriptionType { + return m.types[name] +} + +func (m DefaultPlcSubscriptionRequest) GetInterval(name string) time.Duration { + return m.intervals[name] +} + +func (m DefaultPlcSubscriptionRequest) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("PlcSubscriptionRequest"); err != nil { + return err + } + + if err := writeBuffer.PushContext("fields"); err != nil { + return err + } + for _, fieldName := range m.GetFieldNames() { + if err := writeBuffer.PushContext(fieldName); err != nil { + return err + } + field := m.GetField(fieldName) + if serializableField, ok := field.(utils.Serializable); ok { + if err := serializableField.Serialize(writeBuffer); err != nil { + return err + } + } else { + return errors.New("Error serializing. Field doesn't implement Serializable") + } + if err := writeBuffer.PopContext(fieldName); err != nil { + return err + } + } + if err := writeBuffer.PopContext("fields"); err != nil { + return err + } + if err := writeBuffer.PopContext("PlcSubscriptionRequest"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/spi/model/DefaultPlcSubscriptionResponse.go b/plc4go/internal/spi/model/DefaultPlcSubscriptionResponse.go new file mode 100755 index 00000000000..3ae453f5855 --- /dev/null +++ b/plc4go/internal/spi/model/DefaultPlcSubscriptionResponse.go @@ -0,0 +1,91 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/model" + "github.com/apache/plc4x/plc4go/pkg/api/values" +) + +type DefaultPlcSubscriptionResponse struct { + DefaultResponse + request model.PlcSubscriptionRequest +} + +func NewDefaultPlcSubscriptionResponse(request model.PlcSubscriptionRequest, responseCodes map[string]model.PlcResponseCode) DefaultPlcSubscriptionResponse { + return DefaultPlcSubscriptionResponse{ + DefaultResponse: NewDefaultResponse(responseCodes), + request: request, + } +} + +func (m DefaultPlcSubscriptionResponse) GetRequest() model.PlcSubscriptionRequest { + return m.request +} + +func (m DefaultPlcSubscriptionResponse) GetFieldNames() []string { + var fieldNames []string + // We take the field names from the request to keep order as map is not ordered + for _, name := range m.request.GetFieldNames() { + if _, ok := m.responseCodes[name]; ok { + fieldNames = append(fieldNames, name) + } + } + return fieldNames +} + +func (m DefaultPlcSubscriptionResponse) GetValue(name string) values.PlcValue { + panic("not implemented: implement me") +} + +func (m DefaultPlcSubscriptionResponse) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("PlcSubscriptionResponse"); err != nil { + return err + } + + if request, ok := m.request.(utils.Serializable); ok { + if err := request.Serialize(writeBuffer); err != nil { + return err + } + } + if err := writeBuffer.PushContext("values"); err != nil { + return err + } + for _, fieldName := range m.GetFieldNames() { + if err := writeBuffer.PushContext(fieldName); err != nil { + return err + } + valueResponse := m.GetValue(fieldName) + if err := valueResponse.(utils.Serializable).Serialize(writeBuffer); err != nil { + return err + } + if err := writeBuffer.PopContext(fieldName); err != nil { + return err + } + } + if err := writeBuffer.PopContext("values"); err != nil { + return err + } + if err := writeBuffer.PopContext("PlcSubscriptionResponse"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/spi/model/DefaultPlcWriteRequest.go b/plc4go/internal/spi/model/DefaultPlcWriteRequest.go new file mode 100755 index 00000000000..1627f05285e --- /dev/null +++ b/plc4go/internal/spi/model/DefaultPlcWriteRequest.go @@ -0,0 +1,232 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi" + "github.com/apache/plc4x/plc4go/internal/spi/interceptors" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + spiValues "github.com/apache/plc4x/plc4go/internal/spi/values" + "github.com/apache/plc4x/plc4go/pkg/api/model" + "github.com/apache/plc4x/plc4go/pkg/api/values" + "github.com/pkg/errors" + "time" +) + +type DefaultPlcWriteRequestBuilder struct { + writer spi.PlcWriter + fieldHandler spi.PlcFieldHandler + valueHandler spi.PlcValueHandler + queries map[string]string + queryNames []string + fields map[string]model.PlcField + fieldNames []string + values map[string]interface{} + writeRequestInterceptor interceptors.WriteRequestInterceptor +} + +func NewDefaultPlcWriteRequestBuilder(fieldHandler spi.PlcFieldHandler, valueHandler spi.PlcValueHandler, writer spi.PlcWriter) *DefaultPlcWriteRequestBuilder { + return &DefaultPlcWriteRequestBuilder{ + writer: writer, + fieldHandler: fieldHandler, + valueHandler: valueHandler, + queries: map[string]string{}, + queryNames: make([]string, 0), + fields: map[string]model.PlcField{}, + fieldNames: make([]string, 0), + values: map[string]interface{}{}, + } +} + +func NewDefaultPlcWriteRequestBuilderWithInterceptor(fieldHandler spi.PlcFieldHandler, valueHandler spi.PlcValueHandler, writer spi.PlcWriter, writeRequestInterceptor interceptors.WriteRequestInterceptor) *DefaultPlcWriteRequestBuilder { + return &DefaultPlcWriteRequestBuilder{ + writer: writer, + fieldHandler: fieldHandler, + valueHandler: valueHandler, + queries: map[string]string{}, + queryNames: make([]string, 0), + fields: map[string]model.PlcField{}, + fieldNames: make([]string, 0), + values: map[string]interface{}{}, + writeRequestInterceptor: writeRequestInterceptor, + } +} + +func (m *DefaultPlcWriteRequestBuilder) GetWriter() spi.PlcWriter { + return m.writer +} + +func (m *DefaultPlcWriteRequestBuilder) GetWriteRequestInterceptor() interceptors.WriteRequestInterceptor { + return m.writeRequestInterceptor +} + +func (m *DefaultPlcWriteRequestBuilder) AddQuery(name string, query string, value interface{}) model.PlcWriteRequestBuilder { + m.queryNames = append(m.queryNames, name) + m.queries[name] = query + m.values[name] = value + return m +} + +func (m *DefaultPlcWriteRequestBuilder) AddField(name string, field model.PlcField, value interface{}) model.PlcWriteRequestBuilder { + m.fieldNames = append(m.fieldNames, name) + m.fields[name] = field + m.values[name] = value + return m +} + +func (m *DefaultPlcWriteRequestBuilder) Build() (model.PlcWriteRequest, error) { + // Parse the queries as well as pro + for _, name := range m.queryNames { + query := m.queries[name] + field, err := m.fieldHandler.ParseQuery(query) + if err != nil { + return nil, errors.Wrapf(err, "Error parsing query: %s", query) + } + m.AddField(name, field, m.values[name]) + } + + // Process the values for fields. + plcValues := make(map[string]values.PlcValue) + for name, field := range m.fields { + value, err := m.valueHandler.NewPlcValue(field, m.values[name]) + if err != nil { + return nil, errors.Wrapf(err, "Error parsing value of type: %s", field.GetTypeName()) + } + plcValues[name] = value + } + return NewDefaultPlcWriteRequest(m.fields, m.fieldNames, plcValues, m.writer, m.writeRequestInterceptor), nil +} + +type DefaultPlcWriteRequest struct { + DefaultRequest + values map[string]values.PlcValue + writer spi.PlcWriter + writeRequestInterceptor interceptors.WriteRequestInterceptor +} + +func NewDefaultPlcWriteRequest(fields map[string]model.PlcField, fieldNames []string, values map[string]values.PlcValue, writer spi.PlcWriter, writeRequestInterceptor interceptors.WriteRequestInterceptor) model.PlcWriteRequest { + return DefaultPlcWriteRequest{NewDefaultRequest(fields, fieldNames), values, writer, writeRequestInterceptor} +} + +func (m DefaultPlcWriteRequest) Execute() <-chan model.PlcWriteRequestResult { + // Shortcut, if no interceptor is defined + if m.writeRequestInterceptor == nil { + return m.writer.Write(m) + } + + // Split the requests up into multiple ones. + writeRequests := m.writeRequestInterceptor.InterceptWriteRequest(m) + // Shortcut for single-request-requests + if len(writeRequests) == 1 { + return m.writer.Write(writeRequests[0]) + } + // Create a sub-result-channel slice + var subResultChannels []<-chan model.PlcWriteRequestResult + + // Iterate over all requests and add the result-channels to the list + for _, subRequest := range writeRequests { + subResultChannels = append(subResultChannels, m.writer.Write(subRequest)) + // TODO: Replace this with a real queueing of requests. Later on we need throttling. At the moment this avoids race condition as the read above writes to fast on the line which is a problem for the test + time.Sleep(time.Millisecond * 4) + } + + // Create a new result-channel, which completes as soon as all sub-result-channels have returned + resultChannel := make(chan model.PlcWriteRequestResult) + go func() { + var subResults []model.PlcWriteRequestResult + // Iterate over all sub-results + for _, subResultChannel := range subResultChannels { + subResult := <-subResultChannel + subResults = append(subResults, subResult) + } + // As soon as all are done, process the results + result := m.writeRequestInterceptor.ProcessWriteResponses(m, subResults) + // Return the final result + resultChannel <- result + }() + + return resultChannel +} + +func (m DefaultPlcWriteRequest) GetWriter() spi.PlcWriter { + return m.writer +} + +func (m DefaultPlcWriteRequest) GetWriteRequestInterceptor() interceptors.WriteRequestInterceptor { + return m.writeRequestInterceptor +} + +func (m DefaultPlcWriteRequest) GetValue(name string) values.PlcValue { + return m.values[name] +} + +func (m DefaultPlcWriteRequest) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("PlcWriteRequest"); err != nil { + return err + } + + if err := writeBuffer.PushContext("fields"); err != nil { + return err + } + for _, fieldName := range m.GetFieldNames() { + if err := writeBuffer.PushContext(fieldName); err != nil { + return err + } + field := m.GetField(fieldName) + if serializableField, ok := field.(utils.Serializable); ok { + if err := serializableField.Serialize(writeBuffer); err != nil { + return err + } + } else { + return errors.New("Error serializing. Field doesn't implement Serializable") + } + value := m.GetValue(fieldName) + switch value.(type) { + case spiValues.PlcList: + listValue, ok := value.(spiValues.PlcList) + if !ok { + return errors.New("couldn't cast PlcValue to PlcList") + } + for _, subValue := range listValue.Values { + if !subValue.IsString() { + return errors.New("value not serializable to string") + } + subValue.GetString() + if err := writeBuffer.WriteString("value", uint32(len([]rune(subValue.GetString()))*8), "UTF-8", subValue.GetString()); err != nil { + return err + } + } + default: + if err := writeBuffer.WriteString("value", uint32(len([]rune(value.GetString()))*8), "UTF-8", value.GetString()); err != nil { + return err + } + } + if err := writeBuffer.PopContext(fieldName); err != nil { + return err + } + } + if err := writeBuffer.PopContext("fields"); err != nil { + return err + } + if err := writeBuffer.PopContext("PlcWriteRequest"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/spi/transports/TransportInstance.go b/plc4go/internal/spi/transports/TransportInstance.go new file mode 100755 index 00000000000..0cf5679c45f --- /dev/null +++ b/plc4go/internal/spi/transports/TransportInstance.go @@ -0,0 +1,40 @@ +/* + * 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 transports + +type TransportInstance interface { + Connect() error + Close() error + + IsConnected() bool + + GetNumReadableBytes() (uint32, error) + PeekReadableBytes(numBytes uint32) ([]uint8, error) + Read(numBytes uint32) ([]uint8, error) + + Write(data []uint8) error +} + +type TestTransportInstance interface { + TransportInstance + FillReadBuffer(data []uint8) error + GetNumDrainableBytes() uint32 + DrainWriteBuffer(numBytes uint32) ([]uint8, error) +} diff --git a/plc4go/internal/spi/values/BINT.go b/plc4go/internal/spi/values/BINT.go new file mode 100755 index 00000000000..2d658739920 --- /dev/null +++ b/plc4go/internal/spi/values/BINT.go @@ -0,0 +1,146 @@ +/* + * 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 values + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "math" + "math/big" + "strconv" +) + +type PlcBINT struct { + value *big.Int + PlcSimpleNumericValueAdapter +} + +func NewPlcBINT(value *big.Int) PlcBINT { + return PlcBINT{ + value: value, + } +} + +func (m PlcBINT) GetRaw() []byte { + return m.value.Bytes() +} + +func (m PlcBINT) GetBoolean() bool { + if m.isZero() { + return false + } + return true +} + +func (m PlcBINT) IsUint8() bool { + return m.isEqualsOrGreaterZero() && m.value.Cmp(big.NewInt(math.MaxUint8)) <= 0 +} + +func (m PlcBINT) GetUint8() uint8 { + if m.IsUint8() { + return uint8(m.GetInt16()) + } + return 0 +} + +func (m PlcBINT) IsUint16() bool { + return m.isEqualsOrGreaterZero() +} + +func (m PlcBINT) GetUint16() uint16 { + if m.IsUint16() { + return uint16(m.GetInt16()) + } + return 0 +} + +func (m PlcBINT) IsUint32() bool { + return m.isEqualsOrGreaterZero() +} + +func (m PlcBINT) GetUint32() uint32 { + if m.IsUint32() { + return uint32(m.GetInt32()) + } + return 0 +} + +func (m PlcBINT) IsUint64() bool { + return m.isEqualsOrGreaterZero() +} + +func (m PlcBINT) GetUint64() uint64 { + if m.IsUint64() { + return uint64(m.value.Int64()) + } + return 0 +} + +func (m PlcBINT) IsInt8() bool { + return m.isGreaterOrEqual(math.MinInt8) && m.isLowerOrEqual(math.MaxInt8) +} + +func (m PlcBINT) GetInt8() int8 { + return int8(m.value.Int64()) +} + +func (m PlcBINT) GetInt16() int16 { + return int16(m.value.Int64()) +} + +func (m PlcBINT) GetInt32() int32 { + return int32(m.value.Int64()) +} + +func (m PlcBINT) GetInt64() int64 { + return m.value.Int64() +} + +func (m PlcBINT) GetFloat32() float32 { + //TODO: Check if this is ok + return float32(m.value.Int64()) +} + +func (m PlcBINT) GetFloat64() float64 { + //TODO: Check if this is ok + return float64(m.value.Int64()) +} + +func (m PlcBINT) GetString() string { + return strconv.Itoa(int(m.GetInt64())) +} +func (m PlcBINT) isZero() bool { + return m.value.Cmp(big.NewInt(0)) == 0 +} + +func (m PlcBINT) isEqualsOrGreaterZero() bool { + return m.isGreaterOrEqual(0) +} + +func (m PlcBINT) isGreaterOrEqual(other int64) bool { + return m.value.Cmp(big.NewInt(other)) >= 0 +} + +func (m PlcBINT) isLowerOrEqual(other int64) bool { + return m.value.Cmp(big.NewInt(other)) <= 0 +} + +func (m PlcBINT) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteBigInt("PlcBINT", uint8(m.value.BitLen()), m.value) +} diff --git a/plc4go/internal/spi/values/BREAL.go b/plc4go/internal/spi/values/BREAL.go new file mode 100755 index 00000000000..e69af7bb778 --- /dev/null +++ b/plc4go/internal/spi/values/BREAL.go @@ -0,0 +1,178 @@ +/* + * 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 values + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "math" + "math/big" +) + +type PlcBREAL struct { + value *big.Float + PlcSimpleNumericValueAdapter +} + +func NewPlcBREAL(value *big.Float) PlcBREAL { + return PlcBREAL{ + value: value, + } +} + +func (m PlcBREAL) GetRaw() []byte { + buf := utils.NewWriteBufferByteBased() + m.Serialize(buf) + return buf.GetBytes() +} + +func (m PlcBREAL) GetBoolean() bool { + if m.isZero() { + return false + } + return true +} + +func (m PlcBREAL) IsUint8() bool { + return m.isGreaterOrEqual(0.0) && m.isLowerOrEqual(math.MaxUint8) +} + +func (m PlcBREAL) GetUint8() uint8 { + if m.IsUint8() { + return uint8(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) IsUint16() bool { + return m.isGreaterOrEqual(0.0) && m.isLowerOrEqual(math.MaxUint16) +} + +func (m PlcBREAL) GetUint16() uint16 { + if m.IsUint16() { + return uint16(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) IsUint32() bool { + return m.isGreaterOrEqual(0.0) && m.isLowerOrEqual(math.MaxUint32) +} + +func (m PlcBREAL) GetUint32() uint32 { + if m.IsUint32() { + return uint32(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) IsUint64() bool { + return m.isGreaterOrEqual(0.0) && m.isLowerOrEqual(math.MaxUint64) +} + +func (m PlcBREAL) GetUint64() uint64 { + if m.IsUint64() { + return uint64(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) IsInt8() bool { + return m.isGreaterOrEqual(math.MinInt8) && m.isLowerOrEqual(math.MaxInt8) +} + +func (m PlcBREAL) GetInt8() int8 { + if m.IsInt8() { + return int8(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) IsInt16() bool { + return m.isGreaterOrEqual(math.MinInt16) && m.isLowerOrEqual(math.MaxInt16) +} + +func (m PlcBREAL) GetInt16() int16 { + if m.IsInt16() { + return int16(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) IsInt32() bool { + return m.isGreaterOrEqual(math.MinInt32) && m.isLowerOrEqual(math.MaxInt32) +} + +func (m PlcBREAL) GetInt32() int32 { + if m.IsInt32() { + return int32(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) IsInt64() bool { + return m.isGreaterOrEqual(math.MinInt64) && m.isLowerOrEqual(math.MaxInt64) +} + +func (m PlcBREAL) GetInt64() int64 { + if m.IsInt64() { + return int64(m.GetFloat32()) + } + return 0 +} + +func (m PlcBREAL) GetFloat32() float32 { + f, _ := m.value.Float32() + return f +} + +func (m PlcBREAL) GetFloat64() float64 { + f, _ := m.value.Float64() + return f +} + +func (m PlcBREAL) IsString() bool { + return true +} + +func (m PlcBREAL) GetString() string { + return fmt.Sprintf("%g", m.GetFloat64()) +} + +func (m PlcBREAL) isZero() bool { + return m.value.Cmp(big.NewFloat(0.0)) == 0.0 +} + +func (m PlcBREAL) isEqualsOrGreaterZero() bool { + return m.isGreaterOrEqual(0) +} + +func (m PlcBREAL) isGreaterOrEqual(other float64) bool { + return m.value.Cmp(big.NewFloat(other)) >= 0 +} + +func (m PlcBREAL) isLowerOrEqual(other float64) bool { + return m.value.Cmp(big.NewFloat(other)) <= 0 +} + +func (m PlcBREAL) Serialize(writeBuffer utils.WriteBuffer) error { + // TODO: fix this a insert a valid bit length calculation + return writeBuffer.WriteBigFloat("PlcBREAL", uint8(m.value.MinPrec()), m.value) +} diff --git a/plc4go/internal/spi/values/DATE_AND_TIME.go b/plc4go/internal/spi/values/DATE_AND_TIME.go new file mode 100755 index 00000000000..ef4310d8c0f --- /dev/null +++ b/plc4go/internal/spi/values/DATE_AND_TIME.go @@ -0,0 +1,58 @@ +/* + * 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 values + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "time" +) + +type PlcDATE_AND_TIME struct { + value time.Time + PlcValueAdapter +} + +func NewPlcDATE_AND_TIME(value time.Time) PlcDATE_AND_TIME { + return PlcDATE_AND_TIME{ + value: value, + } +} + +func (m PlcDATE_AND_TIME) GetRaw() []byte { + buf := utils.NewWriteBufferByteBased() + m.Serialize(buf) + return buf.GetBytes() +} + +func (m PlcDATE_AND_TIME) IsDateTime() bool { + return true +} +func (m PlcDATE_AND_TIME) GetDateTime() time.Time { + return time.Time{}.Add(m.GetDuration()) +} + +func (m PlcDATE_AND_TIME) GetString() string { + return fmt.Sprintf("%v", m.GetDateTime()) +} + +func (m PlcDATE_AND_TIME) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteString("PlcDATE_AND_TIME", uint32(len([]rune(m.GetString()))*8), "UTF-8", m.GetString()) +} diff --git a/plc4go/internal/spi/values/PlcBitString.go b/plc4go/internal/spi/values/PlcBitString.go new file mode 100755 index 00000000000..c30740d0ac6 --- /dev/null +++ b/plc4go/internal/spi/values/PlcBitString.go @@ -0,0 +1,81 @@ +/* + * 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 values + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + api "github.com/apache/plc4x/plc4go/pkg/api/values" +) + +type PlcBitString struct { + PlcList +} + +func NewPlcBitString(value interface{}) PlcBitString { + var bools []api.PlcValue + switch value.(type) { + case uint8: + bools = make([]api.PlcValue, 8) + for i := 0; i < 8; i++ { + bools[i] = NewPlcBOOL(((value.(uint8) >> uint8((8-1)-i)) & 0x01) == 0x01) + } + case uint16: + bools = make([]api.PlcValue, 16) + for i := 0; i < 16; i++ { + bools[i] = NewPlcBOOL(((value.(uint16) >> uint8((16-1)-i)) & 0x01) == 0x01) + } + case uint32: + bools = make([]api.PlcValue, 32) + for i := 0; i < 32; i++ { + bools[i] = NewPlcBOOL(((value.(uint32) >> uint8((32-1)-i)) & 0x01) == 0x01) + } + case uint64: + bools = make([]api.PlcValue, 64) + for i := 0; i < 64; i++ { + bools[i] = NewPlcBOOL(((value.(uint64) >> uint8((64-1)-i)) & 0x01) == 0x01) + } + } + + return PlcBitString{ + PlcList{Values: bools}, + } +} + +func (m PlcBitString) GetRaw() []byte { + buf := utils.NewWriteBufferByteBased() + m.Serialize(buf) + return buf.GetBytes() +} + +func (m PlcBitString) IsList() bool { + return true +} + +func (m PlcBitString) GetLength() uint32 { + return uint32(len(m.Values)) +} + +func (m PlcBitString) GetIndex(i uint32) api.PlcValue { + return m.Values[i] +} + +func (m PlcBitString) GetList() []api.PlcValue { + return m.Values +} diff --git a/plc4go/internal/spi/values/PlcList.go b/plc4go/internal/spi/values/PlcList.go new file mode 100755 index 00000000000..e561b5053ac --- /dev/null +++ b/plc4go/internal/spi/values/PlcList.go @@ -0,0 +1,78 @@ +/* + * 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 values + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/apache/plc4x/plc4go/pkg/api/values" + "github.com/pkg/errors" +) + +type PlcList struct { + Values []values.PlcValue + PlcValueAdapter +} + +func NewPlcList(values []values.PlcValue) values.PlcValue { + return PlcList{ + Values: values, + } +} + +func (m PlcList) GetRaw() []byte { + buf := utils.NewWriteBufferByteBased() + m.Serialize(buf) + return buf.GetBytes() +} + +func (m PlcList) IsList() bool { + return true +} + +func (m PlcList) GetLength() uint32 { + return uint32(len(m.Values)) +} + +func (m PlcList) GetIndex(i uint32) values.PlcValue { + return m.Values[i] +} + +func (m PlcList) GetList() []values.PlcValue { + return m.Values +} + +func (m PlcList) Serialize(writeBuffer utils.WriteBuffer) error { + if err := writeBuffer.PushContext("PlcList"); err != nil { + return err + } + for _, listItem := range m.GetList() { + if listItemSerializable, ok := listItem.(utils.Serializable); ok { + if err := listItemSerializable.Serialize(writeBuffer); err != nil { + return err + } + } else { + return errors.New("Error serializing. List item doesn't implement Serializable") + } + } + if err := writeBuffer.PopContext("PlcList"); err != nil { + return err + } + return nil +} diff --git a/plc4go/internal/spi/values/PlcSimpleValueAdapter.go b/plc4go/internal/spi/values/PlcSimpleValueAdapter.go new file mode 100755 index 00000000000..0caa9a2b4f9 --- /dev/null +++ b/plc4go/internal/spi/values/PlcSimpleValueAdapter.go @@ -0,0 +1,92 @@ +/* + * 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 values + +type PlcSimpleValueAdapter struct { + PlcValueAdapter +} + +func (m PlcSimpleValueAdapter) IsSimple() bool { + return true +} + +func (m PlcSimpleValueAdapter) GetLength() uint32 { + return 1 +} + +type PlcSimpleNumericValueAdapter struct { + PlcSimpleValueAdapter +} + +func (m PlcSimpleNumericValueAdapter) IsBool() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsByte() bool { + return m.IsUint8() +} + +func (m PlcSimpleNumericValueAdapter) GetByte() byte { + return m.GetUint8() +} + +func (m PlcSimpleNumericValueAdapter) IsUint8() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsUint16() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsUint32() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsUint64() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsUnt8() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsUnt16() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsUnt32() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsUnt64() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsFloat32() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsFloat64() bool { + return true +} + +func (m PlcSimpleNumericValueAdapter) IsString() bool { + return true +} diff --git a/plc4go/internal/spi/values/RawPlcValue.go b/plc4go/internal/spi/values/RawPlcValue.go new file mode 100755 index 00000000000..44be37a66f2 --- /dev/null +++ b/plc4go/internal/spi/values/RawPlcValue.go @@ -0,0 +1,83 @@ +/* + * 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 values + +import ( + "encoding/hex" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + api "github.com/apache/plc4x/plc4go/pkg/api/values" +) + +type PlcValueDecoder interface { + Decode(typeName string) api.PlcValue +} + +type RawPlcValue struct { + readBuffer utils.ReadBuffer + decoder PlcValueDecoder + PlcValueAdapter +} + +func NewRawPlcValue(readBuffer utils.ReadBuffer, decoder PlcValueDecoder) RawPlcValue { + return RawPlcValue{ + readBuffer: readBuffer, + decoder: decoder, + } +} + +func (m RawPlcValue) GetRaw() []byte { + return m.readBuffer.(utils.ReadBufferByteBased).GetBytes() +} + +func (m RawPlcValue) IsList() bool { + return true +} + +func (m RawPlcValue) GetLength() uint32 { + return uint32(m.readBuffer.(utils.ReadBufferByteBased).GetTotalBytes()) +} + +func (m RawPlcValue) GetIndex(i uint32) api.PlcValue { + return NewPlcUSINT(m.readBuffer.(utils.ReadBufferByteBased).GetBytes()[i]) +} + +func (m RawPlcValue) GetList() []api.PlcValue { + var plcValues []api.PlcValue + for _, value := range m.readBuffer.(utils.ReadBufferByteBased).GetBytes() { + plcValues = append(plcValues, NewPlcUSINT(value)) + } + return plcValues +} + +func (m RawPlcValue) RawDecodeValue(typeName string) api.PlcValue { + return m.decoder.Decode(typeName) +} + +func (m RawPlcValue) RawHasMore() bool { + return m.readBuffer.HasMore(1) +} + +func (m RawPlcValue) RawReset() { + m.readBuffer.(utils.ReadBufferByteBased).Reset(0) +} + +func (m RawPlcValue) GetString() string { + return hex.EncodeToString(m.GetRaw()) +} diff --git a/plc4go/pkg/api/cache/plc_connection_cache.go b/plc4go/pkg/api/cache/plc_connection_cache.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/cache/plc_connection_cache_test.go b/plc4go/pkg/api/cache/plc_connection_cache_test.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/config/config.go b/plc4go/pkg/api/config/config.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/connection.go b/plc4go/pkg/api/connection.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/doc.go b/plc4go/pkg/api/doc.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/driver.go b/plc4go/pkg/api/driver.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/driverManager.go b/plc4go/pkg/api/driverManager.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/drivers/drivers.go b/plc4go/pkg/api/drivers/drivers.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/logging/init.go b/plc4go/pkg/api/logging/init.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_array_info.go b/plc4go/pkg/api/model/plc_array_info.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_browse.go b/plc4go/pkg/api/model/plc_browse.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_connection_metadata.go b/plc4go/pkg/api/model/plc_connection_metadata.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_discovery.go b/plc4go/pkg/api/model/plc_discovery.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_message.go b/plc4go/pkg/api/model/plc_message.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_query.go b/plc4go/pkg/api/model/plc_query.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_read.go b/plc4go/pkg/api/model/plc_read.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_request.go b/plc4go/pkg/api/model/plc_request.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_response.go b/plc4go/pkg/api/model/plc_response.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_response_code.go b/plc4go/pkg/api/model/plc_response_code.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_subscription.go b/plc4go/pkg/api/model/plc_subscription.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_tag.go b/plc4go/pkg/api/model/plc_tag.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_unsubscription.go b/plc4go/pkg/api/model/plc_unsubscription.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/model/plc_write.go b/plc4go/pkg/api/model/plc_write.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/transports/transports.go b/plc4go/pkg/api/transports/transports.go old mode 100644 new mode 100755 diff --git a/plc4go/pkg/api/values/plc_value.go b/plc4go/pkg/api/values/plc_value.go old mode 100644 new mode 100755 diff --git a/plc4go/pom.xml b/plc4go/pom.xml old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/ParserHelper.go b/plc4go/protocols/abeth/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/XmlParserHelper.go b/plc4go/protocols/abeth/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationConnectionRequest.go b/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationConnectionRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationConnectionResponse.go b/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationConnectionResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationPacket.go b/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationPacket.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationReadRequest.go b/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationReadRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationReadResponse.go b/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationReadResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/DF1CommandRequestMessage.go b/plc4go/protocols/abeth/readwrite/model/DF1CommandRequestMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/DF1CommandResponseMessageProtectedTypedLogicalRead.go b/plc4go/protocols/abeth/readwrite/model/DF1CommandResponseMessageProtectedTypedLogicalRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/DF1RequestCommand.go b/plc4go/protocols/abeth/readwrite/model/DF1RequestCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/DF1RequestMessage.go b/plc4go/protocols/abeth/readwrite/model/DF1RequestMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/DF1RequestProtectedTypedLogicalRead.go b/plc4go/protocols/abeth/readwrite/model/DF1RequestProtectedTypedLogicalRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/abeth/readwrite/model/DF1ResponseMessage.go b/plc4go/protocols/abeth/readwrite/model/DF1ResponseMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/discovery/readwrite/ParserHelper.go b/plc4go/protocols/ads/discovery/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/discovery/readwrite/XmlParserHelper.go b/plc4go/protocols/ads/discovery/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/ParserHelper.go b/plc4go/protocols/ads/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/XmlParserHelper.go b/plc4go/protocols/ads/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationRequest.go b/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationResponse.go b/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsData.go b/plc4go/protocols/ads/readwrite/model/AdsData.go new file mode 100755 index 00000000000..01da0c4989f --- /dev/null +++ b/plc4go/protocols/ads/readwrite/model/AdsData.go @@ -0,0 +1,214 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// AdsData is the corresponding interface of AdsData +type AdsData interface { + utils.LengthAware + utils.Serializable + // GetCommandId returns CommandId (discriminator field) + GetCommandId() CommandId + // GetResponse returns Response (discriminator field) + GetResponse() bool +} + +// AdsDataExactly can be used when we want exactly this type and not a type which fulfills AdsData. +// This is useful for switch cases. +type AdsDataExactly interface { + AdsData + isAdsData() bool +} + +// _AdsData is the data-structure of this message +type _AdsData struct { + _AdsDataChildRequirements +} + +type _AdsDataChildRequirements interface { + utils.Serializable + GetLengthInBits() uint16 + GetLengthInBitsConditional(lastItem bool) uint16 + GetCommandId() CommandId + GetResponse() bool +} + +type AdsDataParent interface { + SerializeParent(writeBuffer utils.WriteBuffer, child AdsData, serializeChildFunction func() error) error + GetTypeName() string +} + +type AdsDataChild interface { + utils.Serializable + InitializeParent(parent AdsData) + GetParent() *AdsData + + GetTypeName() string + AdsData +} + +// NewAdsData factory function for _AdsData +func NewAdsData() *_AdsData { + return &_AdsData{} +} + +// Deprecated: use the interface for direct cast +func CastAdsData(structType interface{}) AdsData { + if casted, ok := structType.(AdsData); ok { + return casted + } + if casted, ok := structType.(*AdsData); ok { + return *casted + } + return nil +} + +func (m *_AdsData) GetTypeName() string { + return "AdsData" +} + +func (m *_AdsData) GetParentLengthInBits() uint16 { + lengthInBits := uint16(0) + + return lengthInBits +} + +func (m *_AdsData) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func AdsDataParse(readBuffer utils.ReadBuffer, commandId CommandId, response bool) (AdsData, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("AdsData"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for AdsData") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + type AdsDataChildSerializeRequirement interface { + AdsData + InitializeParent(AdsData) + GetParent() AdsData + } + var _childTemp interface{} + var _child AdsDataChildSerializeRequirement + var typeSwitchError error + switch { + case commandId == CommandId_INVALID && response == bool(false): // AdsInvalidRequest + _childTemp, typeSwitchError = AdsInvalidRequestParse(readBuffer, commandId, response) + case commandId == CommandId_INVALID && response == bool(true): // AdsInvalidResponse + _childTemp, typeSwitchError = AdsInvalidResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ_DEVICE_INFO && response == bool(false): // AdsReadDeviceInfoRequest + _childTemp, typeSwitchError = AdsReadDeviceInfoRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ_DEVICE_INFO && response == bool(true): // AdsReadDeviceInfoResponse + _childTemp, typeSwitchError = AdsReadDeviceInfoResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ && response == bool(false): // AdsReadRequest + _childTemp, typeSwitchError = AdsReadRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ && response == bool(true): // AdsReadResponse + _childTemp, typeSwitchError = AdsReadResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_WRITE && response == bool(false): // AdsWriteRequest + _childTemp, typeSwitchError = AdsWriteRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_WRITE && response == bool(true): // AdsWriteResponse + _childTemp, typeSwitchError = AdsWriteResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ_STATE && response == bool(false): // AdsReadStateRequest + _childTemp, typeSwitchError = AdsReadStateRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ_STATE && response == bool(true): // AdsReadStateResponse + _childTemp, typeSwitchError = AdsReadStateResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_WRITE_CONTROL && response == bool(false): // AdsWriteControlRequest + _childTemp, typeSwitchError = AdsWriteControlRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_WRITE_CONTROL && response == bool(true): // AdsWriteControlResponse + _childTemp, typeSwitchError = AdsWriteControlResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_ADD_DEVICE_NOTIFICATION && response == bool(false): // AdsAddDeviceNotificationRequest + _childTemp, typeSwitchError = AdsAddDeviceNotificationRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_ADD_DEVICE_NOTIFICATION && response == bool(true): // AdsAddDeviceNotificationResponse + _childTemp, typeSwitchError = AdsAddDeviceNotificationResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_DELETE_DEVICE_NOTIFICATION && response == bool(false): // AdsDeleteDeviceNotificationRequest + _childTemp, typeSwitchError = AdsDeleteDeviceNotificationRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_DELETE_DEVICE_NOTIFICATION && response == bool(true): // AdsDeleteDeviceNotificationResponse + _childTemp, typeSwitchError = AdsDeleteDeviceNotificationResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_DEVICE_NOTIFICATION && response == bool(false): // AdsDeviceNotificationRequest + _childTemp, typeSwitchError = AdsDeviceNotificationRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_DEVICE_NOTIFICATION && response == bool(true): // AdsDeviceNotificationResponse + _childTemp, typeSwitchError = AdsDeviceNotificationResponseParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ_WRITE && response == bool(false): // AdsReadWriteRequest + _childTemp, typeSwitchError = AdsReadWriteRequestParse(readBuffer, commandId, response) + case commandId == CommandId_ADS_READ_WRITE && response == bool(true): // AdsReadWriteResponse + _childTemp, typeSwitchError = AdsReadWriteResponseParse(readBuffer, commandId, response) + default: + // TODO: return actual type + typeSwitchError = errors.New("Unmapped type") + } + if typeSwitchError != nil { + return nil, errors.Wrap(typeSwitchError, "Error parsing sub-type for type-switch.") + } + _child = _childTemp.(AdsDataChildSerializeRequirement) + + if closeErr := readBuffer.CloseContext("AdsData"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for AdsData") + } + + // Finish initializing + _child.InitializeParent(_child) + return _child, nil +} + +func (pm *_AdsData) SerializeParent(writeBuffer utils.WriteBuffer, child AdsData, serializeChildFunction func() error) error { + // We redirect all calls through client as some methods are only implemented there + m := child + _ = m + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("AdsData"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for AdsData") + } + + // Switch field (Depending on the discriminator values, passes the serialization to a sub-type) + if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil { + return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field") + } + + if popErr := writeBuffer.PopContext("AdsData"); popErr != nil { + return errors.Wrap(popErr, "Error popping for AdsData") + } + return nil +} + +func (m *_AdsData) isAdsData() bool { + return true +} + +func (m *_AdsData) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/ads/readwrite/model/AdsDataType.go b/plc4go/protocols/ads/readwrite/model/AdsDataType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsDeleteDeviceNotificationRequest.go b/plc4go/protocols/ads/readwrite/model/AdsDeleteDeviceNotificationRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsDeleteDeviceNotificationResponse.go b/plc4go/protocols/ads/readwrite/model/AdsDeleteDeviceNotificationResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsDeviceNotificationRequest.go b/plc4go/protocols/ads/readwrite/model/AdsDeviceNotificationRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsDeviceNotificationResponse.go b/plc4go/protocols/ads/readwrite/model/AdsDeviceNotificationResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsInvalidRequest.go b/plc4go/protocols/ads/readwrite/model/AdsInvalidRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsInvalidResponse.go b/plc4go/protocols/ads/readwrite/model/AdsInvalidResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItem.go b/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItemRead.go b/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItemRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItemReadWrite.go b/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItemReadWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItemWrite.go b/plc4go/protocols/ads/readwrite/model/AdsMultiRequestItemWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsNotificationSample.go b/plc4go/protocols/ads/readwrite/model/AdsNotificationSample.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadDeviceInfoRequest.go b/plc4go/protocols/ads/readwrite/model/AdsReadDeviceInfoRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadDeviceInfoResponse.go b/plc4go/protocols/ads/readwrite/model/AdsReadDeviceInfoResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadRequest.go b/plc4go/protocols/ads/readwrite/model/AdsReadRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadResponse.go b/plc4go/protocols/ads/readwrite/model/AdsReadResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadStateRequest.go b/plc4go/protocols/ads/readwrite/model/AdsReadStateRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadStateResponse.go b/plc4go/protocols/ads/readwrite/model/AdsReadStateResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadWriteRequest.go b/plc4go/protocols/ads/readwrite/model/AdsReadWriteRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsReadWriteResponse.go b/plc4go/protocols/ads/readwrite/model/AdsReadWriteResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsStampHeader.go b/plc4go/protocols/ads/readwrite/model/AdsStampHeader.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsWriteControlRequest.go b/plc4go/protocols/ads/readwrite/model/AdsWriteControlRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsWriteControlResponse.go b/plc4go/protocols/ads/readwrite/model/AdsWriteControlResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsWriteRequest.go b/plc4go/protocols/ads/readwrite/model/AdsWriteRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AdsWriteResponse.go b/plc4go/protocols/ads/readwrite/model/AdsWriteResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AmsNetId.go b/plc4go/protocols/ads/readwrite/model/AmsNetId.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AmsPacket.go b/plc4go/protocols/ads/readwrite/model/AmsPacket.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AmsSerialAcknowledgeFrame.go b/plc4go/protocols/ads/readwrite/model/AmsSerialAcknowledgeFrame.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AmsSerialFrame.go b/plc4go/protocols/ads/readwrite/model/AmsSerialFrame.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AmsSerialResetFrame.go b/plc4go/protocols/ads/readwrite/model/AmsSerialResetFrame.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/AmsTCPPacket.go b/plc4go/protocols/ads/readwrite/model/AmsTCPPacket.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/CommandId.go b/plc4go/protocols/ads/readwrite/model/CommandId.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/DataItem.go b/plc4go/protocols/ads/readwrite/model/DataItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/ReservedIndexGroups.go b/plc4go/protocols/ads/readwrite/model/ReservedIndexGroups.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/ReturnCode.go b/plc4go/protocols/ads/readwrite/model/ReturnCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/ads/readwrite/model/State.go b/plc4go/protocols/ads/readwrite/model/State.go new file mode 100755 index 00000000000..55019316a01 --- /dev/null +++ b/plc4go/protocols/ads/readwrite/model/State.go @@ -0,0 +1,375 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + +// Code generated by code-generation. DO NOT EDIT. + +// State is the corresponding interface of State +type State interface { + utils.LengthAware + utils.Serializable + // GetInitCommand returns InitCommand (property field) + GetInitCommand() bool + // GetUpdCommand returns UpdCommand (property field) + GetUpdCommand() bool + // GetTimestampAdded returns TimestampAdded (property field) + GetTimestampAdded() bool + // GetHighPriorityCommand returns HighPriorityCommand (property field) + GetHighPriorityCommand() bool + // GetSystemCommand returns SystemCommand (property field) + GetSystemCommand() bool + // GetAdsCommand returns AdsCommand (property field) + GetAdsCommand() bool + // GetNoReturn returns NoReturn (property field) + GetNoReturn() bool + // GetResponse returns Response (property field) + GetResponse() bool + // GetBroadcast returns Broadcast (property field) + GetBroadcast() bool +} + +// StateExactly can be used when we want exactly this type and not a type which fulfills State. +// This is useful for switch cases. +type StateExactly interface { + State + isState() bool +} + +// _State is the data-structure of this message +type _State struct { + InitCommand bool + UpdCommand bool + TimestampAdded bool + HighPriorityCommand bool + SystemCommand bool + AdsCommand bool + NoReturn bool + Response bool + Broadcast bool +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_State) GetInitCommand() bool { + return m.InitCommand +} + +func (m *_State) GetUpdCommand() bool { + return m.UpdCommand +} + +func (m *_State) GetTimestampAdded() bool { + return m.TimestampAdded +} + +func (m *_State) GetHighPriorityCommand() bool { + return m.HighPriorityCommand +} + +func (m *_State) GetSystemCommand() bool { + return m.SystemCommand +} + +func (m *_State) GetAdsCommand() bool { + return m.AdsCommand +} + +func (m *_State) GetNoReturn() bool { + return m.NoReturn +} + +func (m *_State) GetResponse() bool { + return m.Response +} + +func (m *_State) GetBroadcast() bool { + return m.Broadcast +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewState factory function for _State +func NewState(initCommand bool, updCommand bool, timestampAdded bool, highPriorityCommand bool, systemCommand bool, adsCommand bool, noReturn bool, response bool, broadcast bool) *_State { + return &_State{InitCommand: initCommand, UpdCommand: updCommand, TimestampAdded: timestampAdded, HighPriorityCommand: highPriorityCommand, SystemCommand: systemCommand, AdsCommand: adsCommand, NoReturn: noReturn, Response: response, Broadcast: broadcast} +} + +// Deprecated: use the interface for direct cast +func CastState(structType interface{}) State { + if casted, ok := structType.(State); ok { + return casted + } + if casted, ok := structType.(*State); ok { + return *casted + } + return nil +} + +func (m *_State) GetTypeName() string { + return "State" +} + +func (m *_State) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_State) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (initCommand) + lengthInBits += 1 + + // Simple field (updCommand) + lengthInBits += 1 + + // Simple field (timestampAdded) + lengthInBits += 1 + + // Simple field (highPriorityCommand) + lengthInBits += 1 + + // Simple field (systemCommand) + lengthInBits += 1 + + // Simple field (adsCommand) + lengthInBits += 1 + + // Simple field (noReturn) + lengthInBits += 1 + + // Simple field (response) + lengthInBits += 1 + + // Simple field (broadcast) + lengthInBits += 1 + + // Reserved Field (reserved) + lengthInBits += 7 + + return lengthInBits +} + +func (m *_State) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func StateParse(readBuffer utils.ReadBuffer) (State, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("State"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for State") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (initCommand) + _initCommand, _initCommandErr := readBuffer.ReadBit("initCommand") + if _initCommandErr != nil { + return nil, errors.Wrap(_initCommandErr, "Error parsing 'initCommand' field") + } + initCommand := _initCommand + + // Simple Field (updCommand) + _updCommand, _updCommandErr := readBuffer.ReadBit("updCommand") + if _updCommandErr != nil { + return nil, errors.Wrap(_updCommandErr, "Error parsing 'updCommand' field") + } + updCommand := _updCommand + + // Simple Field (timestampAdded) + _timestampAdded, _timestampAddedErr := readBuffer.ReadBit("timestampAdded") + if _timestampAddedErr != nil { + return nil, errors.Wrap(_timestampAddedErr, "Error parsing 'timestampAdded' field") + } + timestampAdded := _timestampAdded + + // Simple Field (highPriorityCommand) + _highPriorityCommand, _highPriorityCommandErr := readBuffer.ReadBit("highPriorityCommand") + if _highPriorityCommandErr != nil { + return nil, errors.Wrap(_highPriorityCommandErr, "Error parsing 'highPriorityCommand' field") + } + highPriorityCommand := _highPriorityCommand + + // Simple Field (systemCommand) + _systemCommand, _systemCommandErr := readBuffer.ReadBit("systemCommand") + if _systemCommandErr != nil { + return nil, errors.Wrap(_systemCommandErr, "Error parsing 'systemCommand' field") + } + systemCommand := _systemCommand + + // Simple Field (adsCommand) + _adsCommand, _adsCommandErr := readBuffer.ReadBit("adsCommand") + if _adsCommandErr != nil { + return nil, errors.Wrap(_adsCommandErr, "Error parsing 'adsCommand' field") + } + adsCommand := _adsCommand + + // Simple Field (noReturn) + _noReturn, _noReturnErr := readBuffer.ReadBit("noReturn") + if _noReturnErr != nil { + return nil, errors.Wrap(_noReturnErr, "Error parsing 'noReturn' field") + } + noReturn := _noReturn + + // Simple Field (response) + _response, _responseErr := readBuffer.ReadBit("response") + if _responseErr != nil { + return nil, errors.Wrap(_responseErr, "Error parsing 'response' field") + } + response := _response + + // Simple Field (broadcast) + _broadcast, _broadcastErr := readBuffer.ReadBit("broadcast") + if _broadcastErr != nil { + return nil, errors.Wrap(_broadcastErr, "Error parsing 'broadcast' field") + } + broadcast := _broadcast + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadInt8("reserved", 7) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != int8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": int8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + if closeErr := readBuffer.CloseContext("State"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for State") + } + + // Create the instance + return NewState(initCommand, updCommand, timestampAdded, highPriorityCommand, systemCommand, adsCommand, noReturn, response, broadcast), nil +} + +func (m *_State) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("State"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for State") + } + + // Simple Field (initCommand) + initCommand := bool(m.GetInitCommand()) + _initCommandErr := writeBuffer.WriteBit("initCommand", (initCommand)) + if _initCommandErr != nil { + return errors.Wrap(_initCommandErr, "Error serializing 'initCommand' field") + } + + // Simple Field (updCommand) + updCommand := bool(m.GetUpdCommand()) + _updCommandErr := writeBuffer.WriteBit("updCommand", (updCommand)) + if _updCommandErr != nil { + return errors.Wrap(_updCommandErr, "Error serializing 'updCommand' field") + } + + // Simple Field (timestampAdded) + timestampAdded := bool(m.GetTimestampAdded()) + _timestampAddedErr := writeBuffer.WriteBit("timestampAdded", (timestampAdded)) + if _timestampAddedErr != nil { + return errors.Wrap(_timestampAddedErr, "Error serializing 'timestampAdded' field") + } + + // Simple Field (highPriorityCommand) + highPriorityCommand := bool(m.GetHighPriorityCommand()) + _highPriorityCommandErr := writeBuffer.WriteBit("highPriorityCommand", (highPriorityCommand)) + if _highPriorityCommandErr != nil { + return errors.Wrap(_highPriorityCommandErr, "Error serializing 'highPriorityCommand' field") + } + + // Simple Field (systemCommand) + systemCommand := bool(m.GetSystemCommand()) + _systemCommandErr := writeBuffer.WriteBit("systemCommand", (systemCommand)) + if _systemCommandErr != nil { + return errors.Wrap(_systemCommandErr, "Error serializing 'systemCommand' field") + } + + // Simple Field (adsCommand) + adsCommand := bool(m.GetAdsCommand()) + _adsCommandErr := writeBuffer.WriteBit("adsCommand", (adsCommand)) + if _adsCommandErr != nil { + return errors.Wrap(_adsCommandErr, "Error serializing 'adsCommand' field") + } + + // Simple Field (noReturn) + noReturn := bool(m.GetNoReturn()) + _noReturnErr := writeBuffer.WriteBit("noReturn", (noReturn)) + if _noReturnErr != nil { + return errors.Wrap(_noReturnErr, "Error serializing 'noReturn' field") + } + + // Simple Field (response) + response := bool(m.GetResponse()) + _responseErr := writeBuffer.WriteBit("response", (response)) + if _responseErr != nil { + return errors.Wrap(_responseErr, "Error serializing 'response' field") + } + + // Simple Field (broadcast) + broadcast := bool(m.GetBroadcast()) + _broadcastErr := writeBuffer.WriteBit("broadcast", (broadcast)) + if _broadcastErr != nil { + return errors.Wrap(_broadcastErr, "Error serializing 'broadcast' field") + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteInt8("reserved", 7, int8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + if popErr := writeBuffer.PopContext("State"); popErr != nil { + return errors.Wrap(popErr, "Error popping for State") + } + return nil +} + +func (m *_State) isState() bool { + return true +} + +func (m *_State) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/ads/readwrite/model/StaticHelper.go b/plc4go/protocols/ads/readwrite/model/StaticHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/ParserHelper.go b/plc4go/protocols/bacnetip/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go b/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDU.go b/plc4go/protocols/bacnetip/readwrite/model/APDU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUAbort.go b/plc4go/protocols/bacnetip/readwrite/model/APDUAbort.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUComplexAck.go b/plc4go/protocols/bacnetip/readwrite/model/APDUComplexAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUConfirmedRequest.go b/plc4go/protocols/bacnetip/readwrite/model/APDUConfirmedRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUError.go b/plc4go/protocols/bacnetip/readwrite/model/APDUError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUReject.go b/plc4go/protocols/bacnetip/readwrite/model/APDUReject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUSegmentAck.go b/plc4go/protocols/bacnetip/readwrite/model/APDUSegmentAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUSimpleAck.go b/plc4go/protocols/bacnetip/readwrite/model/APDUSimpleAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUUnconfirmedRequest.go b/plc4go/protocols/bacnetip/readwrite/model/APDUUnconfirmedRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUUnknown.go b/plc4go/protocols/bacnetip/readwrite/model/APDUUnknown.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ApduType.go b/plc4go/protocols/bacnetip/readwrite/model/ApduType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAbortReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAbortReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAbortReasonTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAbortReasonTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessAuthenticationFactorDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessAuthenticationFactorDisable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessAuthenticationFactorDisableTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessAuthenticationFactorDisableTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisableReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisableReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisableReasonTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisableReasonTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisableTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessCredentialDisableTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessEventTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessEventTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessPassbackMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessPassbackMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessPassbackModeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessPassbackModeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRule.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRule.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleLocationSpecifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleLocationSpecifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleLocationSpecifierTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleLocationSpecifierTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleTimeRangeSpecifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleTimeRangeSpecifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleTimeRangeSpecifierTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessRuleTimeRangeSpecifierTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessThreatLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessThreatLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessUserType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessUserType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessUserTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessUserTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessZoneOccupancyState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessZoneOccupancyState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessZoneOccupancyStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessZoneOccupancyStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccumulatorRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccumulatorRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccumulatorRecordAccumulatorStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccumulatorRecordAccumulatorStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccumulatorRecordAccumulatorStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccumulatorRecordAccumulatorStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAction.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAction.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetActionCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetActionCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetActionList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetActionList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetActionTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetActionTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressBinding.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressBinding.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTag.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTag.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagObjectIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagObjectIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagSignedInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagSignedInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagUnsignedInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetApplicationTagUnsignedInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedAccessRights.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedAccessRights.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedLandingCalls.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedLandingCalls.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedLandingCallsLandingCallsList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedLandingCallsLandingCallsList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedLandingCallsLandingCallsListEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedLandingCallsLandingCallsListEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactor.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactor.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorFormat.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorFormat.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationPolicy.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationPolicy.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationPolicyList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationPolicyList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationPolicyListEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationPolicyListEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationExemption.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationExemption.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationExemptionTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationExemptionTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationModeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthorizationModeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetBDTEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetBDTEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetBackupState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetBackupState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetBackupStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetBackupStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryLightingPV.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryLightingPV.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryLightingPVTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryLightingPVTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryPV.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryPV.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryPVTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetBinaryPVTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscription.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscription.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVSubscription.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVSubscription.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryDateRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryDateRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryWeekNDay.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCalendarEntryWeekNDay.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueLightingCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueLightingCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueObjectidentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueObjectidentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetChannelValueUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCharacterEncoding.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCharacterEncoding.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetClientCOV.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetClientCOV.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetClientCOVNone.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetClientCOVNone.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetClientCOVObject.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetClientCOVObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetClosingTag.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetClosingTag.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceChoice.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceChoice.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequest.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAcknowledgeAlarm.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAcknowledgeAlarm.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAddListElement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAddListElement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFile.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFile.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFileRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFileRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFileStream.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFileStream.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFileStreamOrRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicReadFileStreamOrRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicWriteFile.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAtomicWriteFile.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAuthenticate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestAuthenticate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedCOVNotification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedCOVNotification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedCOVNotificationMultiple.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedCOVNotificationMultiple.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedEventNotification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedEventNotification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedPrivateTransfer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedPrivateTransfer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessage.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessageClass.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessageClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessageClassCharacter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessageClassCharacter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessageClassNumeric.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessageClassNumeric.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessagePriority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessagePriority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessagePriorityTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestConfirmedTextMessageMessagePriorityTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestCreateObject.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestCreateObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestCreateObjectObjectSpecifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestCreateObjectObjectSpecifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeleteObject.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeleteObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeviceCommunicationControl.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeviceCommunicationControl.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeviceCommunicationControlEnableDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeviceCommunicationControlEnableDisable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeviceCommunicationControlEnableDisableTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestDeviceCommunicationControlEnableDisableTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummary.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummary.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryAcknowledgementFilter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryAcknowledgementFilter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryAcknowledgementFilterTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryAcknowledgementFilterTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryEventStateFilter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryEventStateFilter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryEventStateFilterTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryEventStateFilterTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryPriorityFilter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEnrollmentSummaryPriorityFilter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEventInformation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestGetEventInformation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestLifeSafetyOperation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestLifeSafetyOperation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadPropertyConditional.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadPropertyConditional.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadPropertyMultiple.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadPropertyMultiple.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRangeByPosition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRangeByPosition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRangeBySequenceNumber.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRangeBySequenceNumber.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRangeByTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReadRangeRangeByTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReinitializeDevice.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReinitializeDevice.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReinitializeDeviceReinitializedStateOfDevice.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReinitializeDeviceReinitializedStateOfDevice.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReinitializeDeviceReinitializedStateOfDeviceTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestReinitializeDeviceReinitializedStateOfDeviceTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestRemoveListElement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestRemoveListElement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestRequestKey.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestRequestKey.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOV.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOV.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultiple.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultiple.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultipleListOfCovSubscriptionSpecifications.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultipleListOfCovSubscriptionSpecifications.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultipleListOfCovSubscriptionSpecificationsList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultipleListOfCovSubscriptionSpecificationsList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultipleListOfCovSubscriptionSpecificationsReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestSubscribeCOVPropertyMultipleListOfCovSubscriptionSpecificationsReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestUnknown.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestUnknown.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestVTClose.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestVTClose.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestVTData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestVTData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestVTOpen.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestVTOpen.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestWriteProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestWriteProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestWritePropertyMultiple.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConfirmedServiceRequestWritePropertyMultiple.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDULength.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDULength.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUSegmentTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUSegmentTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAbsenteeLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAbsenteeLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAcceptedModes.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAcceptedModes.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessAlarmEvents.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessAlarmEvents.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoorRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoors.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessDoors.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventAuthenticationFactor.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventAuthenticationFactor.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventCredential.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventCredential.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventTag.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventTag.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessEventTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessPointAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessPointAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessRightsAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessRightsAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessTransactionEvents.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessTransactionEvents.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessUserAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessUserAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessZoneAdjustValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessZoneAdjustValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessZoneAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessZoneAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessZoneAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessZoneAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccompaniment.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccompaniment.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccompanimentTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccompanimentTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorFaultHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorFaultHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorFaultLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorFaultLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorMinPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccumulatorMinPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAckRequired.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAckRequired.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAckedTransitions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAckedTransitions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAction.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAction.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActionText.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActionText.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActivationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActivationTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveAuthenticationPolicy.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveAuthenticationPolicy.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVMultipleSubscriptions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVMultipleSubscriptions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVSubscriptions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVSubscriptions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveText.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveText.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveVTSessions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveVTSessions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActualShedLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActualShedLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAdjustValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAdjustValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlarmValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlarmValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlertEnrollmentAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlertEnrollmentAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlertEnrollmentPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlertEnrollmentPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlignIntervals.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAlignIntervals.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAllWritesSuccessful.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAllWritesSuccessful.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAllowGroupDelayInhibit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAllowGroupDelayInhibit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputFaultHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputFaultHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputFaultLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputFaultLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputInterfaceValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputInterfaceValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogInputPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputInterfaceValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputInterfaceValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogOutputRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueFaultHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueFaultHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueFaultLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueFaultLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAnalogValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataApplicationSoftwareVersion.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataApplicationSoftwareVersion.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataArchive.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataArchive.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAssignedAccessRights.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAssignedAccessRights.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAssignedLandingCalls.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAssignedLandingCalls.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAttemptedSamples.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAttemptedSamples.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationFactors.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationFactors.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationPolicyList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationPolicyList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationPolicyNames.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationPolicyNames.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthorizationExemptions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthorizationExemptions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthorizationMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthorizationMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAutoSlaveDiscovery.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAutoSlaveDiscovery.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAverageValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAverageValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAveragingAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAveragingAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPGlobalAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPGlobalAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPMulticastAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPMulticastAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPNATTraversal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPNATTraversal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPUDPPort.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPUDPPort.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPv6Mode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPv6Mode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPv6MulticastAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPv6MulticastAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPv6UDPPort.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBACnetIPv6UDPPort.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBBMDAcceptFDRegistrations.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBBMDAcceptFDRegistrations.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBBMDBroadcastDistributionTable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBBMDBroadcastDistributionTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBBMDForeignDeviceTable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBBMDForeignDeviceTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupAndRestoreState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupAndRestoreState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupFailureTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupFailureTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupPreparationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupPreparationTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBaseDeviceSecurityPolicy.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBaseDeviceSecurityPolicy.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBelongsTo.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBelongsTo.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBias.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBias.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryInputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryInputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryInputInterfaceValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryInputInterfaceValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryInputPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryInputPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputFeedbackValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputFeedbackValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryLightingOutputRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputFeedbackValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputFeedbackValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputInterfaceValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputInterfaceValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryOutputRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBinaryValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitMask.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitMask.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitStringValueAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitStringValueAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitStringValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitStringValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitStringValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitStringValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitText.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitText.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitstringValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBitstringValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBlinkWarnEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBlinkWarnEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBufferSize.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBufferSize.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVIncrement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVIncrement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVPeriod.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVPeriod.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVResubscriptionInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVResubscriptionInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVUPeriod.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVUPeriod.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVURecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCOVURecipients.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCalendarAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCalendarAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCalendarPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCalendarPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarAssignedDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarAssignedDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorText.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorText.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorZone.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDoorZone.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDriveStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarDriveStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarLoad.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarLoad.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarLoadUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarLoadUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarMovingDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarMovingDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarPosition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCarPosition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChangeOfStateCount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChangeOfStateCount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChangeOfStateTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChangeOfStateTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChangesPending.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChangesPending.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelListOfObjectPropertyReferences.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelListOfObjectPropertyReferences.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelNumber.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelNumber.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataChannelPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValueAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValueAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValueFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValueFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterStringValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterstringValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCharacterstringValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataClientCOVIncrement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataClientCOVIncrement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommandAction.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommandAction.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommandAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommandAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommandTimeArray.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCommandTimeArray.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataConfigurationFiles.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataConfigurationFiles.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlGroups.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlGroups.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlledVariableReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlledVariableReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlledVariableUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlledVariableUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlledVariableValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataControlledVariableValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCountBeforeChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCountBeforeChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCountChangeTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCountChangeTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDataInputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDataInputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDataInputPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDataInputPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDataInputUpdateTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDataInputUpdateTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDisable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentials.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentials.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialsInZone.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialsInZone.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCurrentCommandPriority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCurrentCommandPriority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatabaseRevision.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatabaseRevision.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatePatternValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatePatternValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatePatternValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatePatternValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimePatternValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimePatternValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimePatternValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimePatternValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimeValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimeValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimeValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateTimeValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDateValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatepatternValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatepatternValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatetimeValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatetimeValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatetimepatternValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatetimepatternValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaylightSavingsStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaylightSavingsStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaysRemaining.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaysRemaining.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeadband.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeadband.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultFadeTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultFadeTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultRampRate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultRampRate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultStepIncrement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultStepIncrement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultSubordinateRelationship.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultSubordinateRelationship.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDefaultTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeployedProfileLocation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeployedProfileLocation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDerivativeConstant.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDerivativeConstant.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDerivativeConstantUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDerivativeConstantUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDescription.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDescription.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDescriptionOfHalt.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDescriptionOfHalt.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceAddressBinding.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceAddressBinding.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceMaxInfoFrames.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceMaxInfoFrames.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceMaxMaster.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceMaxMaster.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDirectReading.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDirectReading.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDistributionKeyRevision.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDistributionKeyRevision.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoNotHide.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoNotHide.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorAlarmState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorAlarmState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorExtendedPulseTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorExtendedPulseTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorMembers.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorMembers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorOpenTooLongTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorOpenTooLongTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorPulseTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorPulseTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorUnlockDelayTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDoorUnlockDelayTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDutyWindow.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDutyWindow.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEffectivePeriod.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEffectivePeriod.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEgressActive.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEgressActive.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEgressTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEgressTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElapsedActiveTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElapsedActiveTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElevatorGroup.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElevatorGroup.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElevatorGroupAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElevatorGroupAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElevatorGroupGroupMembers.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataElevatorGroupGroupMembers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEnergyMeter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEnergyMeter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEnergyMeterRef.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEnergyMeterRef.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEntryPoints.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEntryPoints.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataErrorLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataErrorLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorFaultSignals.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorFaultSignals.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventAlgorithmInhibit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventAlgorithmInhibit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventAlgorithmInhibitRef.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventAlgorithmInhibitRef.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventDetectionEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventDetectionEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventEnrollmentAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventEnrollmentAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventLogAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventLogAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventLogLogBuffer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventLogLogBuffer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventMessageTexts.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventMessageTexts.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventMessageTextsConfig.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventMessageTextsConfig.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventParameters.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventParameters.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventTimeStamps.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventTimeStamps.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEventType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExceptionSchedule.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExceptionSchedule.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExecutionDelay.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExecutionDelay.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExitPoints.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExitPoints.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExpectedShedLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExpectedShedLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExpirationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExpirationTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExtendedTimeEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExtendedTimeEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFDBBMDAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFDBBMDAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFDSubscriptionLifetime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFDSubscriptionLifetime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFailedAttemptEvents.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFailedAttemptEvents.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFailedAttempts.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFailedAttempts.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFailedAttemptsTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFailedAttemptsTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultParameters.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultParameters.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultSignals.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultSignals.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileAccessMethod.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileAccessMethod.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileRecordCount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileRecordCount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileSize.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileSize.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFileType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFirmwareRevision.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFirmwareRevision.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFloorText.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFloorText.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFullDutyBaseline.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFullDutyBaseline.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalGroupAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalGroupAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalGroupGroupMembers.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalGroupGroupMembers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalGroupPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalGroupPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGlobalIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupID.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupID.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupMemberNames.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupMemberNames.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupMembers.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupMembers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataGroupPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataHigherDeck.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataHigherDeck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPLeaseTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPLeaseTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPLeaseTimeRemaining.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPLeaseTimeRemaining.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPServer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDHCPServer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDNSServer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDNSServer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDefaultGateway.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPDefaultGateway.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPSubnetMask.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPSubnetMask.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6Address.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6Address.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6AutoAddressingEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6AutoAddressingEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DHCPLeaseTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DHCPLeaseTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DHCPLeaseTimeRemaining.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DHCPLeaseTimeRemaining.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DHCPServer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DHCPServer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DNSServer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DNSServer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DefaultGateway.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6DefaultGateway.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6PrefixLength.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6PrefixLength.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6ZoneIndex.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIPv6ZoneIndex.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInProcess.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInProcess.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInProgress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInProgress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInactiveText.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInactiveText.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInitialTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInitialTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInputReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInputReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInstallationID.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInstallationID.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInstanceOf.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInstanceOf.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInstantaneousPower.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataInstantaneousPower.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueCOVIncrement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueCOVIncrement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueDeadband.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueDeadband.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueFaultHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueFaultHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueFaultLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueFaultLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueMinPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueMinPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueResolution.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegerValueResolution.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegralConstant.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegralConstant.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegralConstantUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntegralConstantUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntervalOffset.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIntervalOffset.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIsUTC.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataIsUTC.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataKeySets.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataKeySets.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLandingCallControl.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLandingCallControl.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLandingCalls.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLandingCalls.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLandingDoorStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLandingDoorStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueCOVIncrement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueCOVIncrement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueDeadband.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueDeadband.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueFaultHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueFaultHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueFaultLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueFaultLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueMinPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueMinPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueResolution.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLargeAnalogValueResolution.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessPoint.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessPoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCommandTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCommandTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialAdded.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialAdded.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialAddedTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialAddedTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialRemoved.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialRemoved.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialRemovedTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastCredentialRemovedTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastKeyServer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastKeyServer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastNotifyRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastNotifyRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastPriority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastPriority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestartReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestartReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestoreTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestoreTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastStateChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastStateChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastUseTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastUseTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyPointPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneMaintenanceRequired.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZoneMaintenanceRequired.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZonePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLifeSafetyZonePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLiftAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLiftAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLiftFaultSignals.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLiftFaultSignals.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingCommandDefaultPriority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingCommandDefaultPriority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputFeedbackValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputFeedbackValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputTrackingValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLightingOutputTrackingValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLimitEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLimitEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLimitMonitoringInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLimitMonitoringInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLinkSpeed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLinkSpeed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLinkSpeedAutonegotiate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLinkSpeedAutonegotiate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLinkSpeeds.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLinkSpeeds.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataListOfGroupMembers.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataListOfGroupMembers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataListOfObjectPropertyReferences.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataListOfObjectPropertyReferences.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoadControlAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoadControlAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoadControlPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoadControlPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalForwardingOnly.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalForwardingOnly.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLockStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLockStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLockout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLockout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLockoutRelinquishTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLockoutRelinquishTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLogBuffer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLogBuffer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLogDeviceObjectProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLogDeviceObjectProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLogInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLogInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoggingObject.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoggingObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoggingRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoggingRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoggingType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoggingType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoopAction.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoopAction.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoopAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoopAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoopPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLoopPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLowDiffLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLowDiffLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLowerDeck.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLowerDeck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMACAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMACAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMachineRoomID.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMachineRoomID.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaintenanceRequired.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaintenanceRequired.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMakingCarCall.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMakingCarCall.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataManipulatedVariableReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataManipulatedVariableReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataManualSlaveAddressBinding.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataManualSlaveAddressBinding.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaskedAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaskedAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxAPDULengthAccepted.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxAPDULengthAccepted.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxActualValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxActualValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxFailedAttempts.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxFailedAttempts.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxInfoFrames.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxInfoFrames.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxMaster.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxMaster.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxSegmentsAccepted.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxSegmentsAccepted.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaximumOutput.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaximumOutput.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaximumValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaximumValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaximumValueTimestamp.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaximumValueTimestamp.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMemberOf.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMemberOf.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMemberStatusFlags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMemberStatusFlags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMembers.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMembers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinActualValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinActualValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumOffTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumOffTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumOnTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumOnTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumOutput.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumOutput.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumValueTimestamp.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMinimumValueTimestamp.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataModelName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataModelName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataModificationDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataModificationDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputInterfaceValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateInputInterfaceValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputFeedbackValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputFeedbackValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputInterfaceValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputInterfaceValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateOutputRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMultiStateValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMusterPoint.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMusterPoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNegativeAccessRules.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNegativeAccessRules.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkAccessSecurityPolicies.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkAccessSecurityPolicies.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkInterfaceName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkInterfaceName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkNumber.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkNumber.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkNumberQuality.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkNumberQuality.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkPortAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkPortAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkPortMaxInfoFrames.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkPortMaxInfoFrames.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkPortMaxMaster.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkPortMaxMaster.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkSecurityAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkSecurityAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNetworkType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNextStoppingFloor.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNextStoppingFloor.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNodeSubtype.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNodeSubtype.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNodeType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNodeType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationClass.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationClassAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationClassAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationForwarderAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationForwarderAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationThreshold.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotificationThreshold.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotifyType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNotifyType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfAPDURetries.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfAPDURetries.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfAuthenticationPolicies.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfAuthenticationPolicies.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfStates.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfStates.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectPropertyReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectPropertyReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyCount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyCount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyCountAdjust.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyCountAdjust.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyCountEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyCountEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyLowerLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyLowerLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyLowerLimitEnforced.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyLowerLimitEnforced.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyUpperLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyUpperLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyUpperLimitEnforced.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOccupancyUpperLimitEnforced.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOctetStringValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOctetStringValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOctetStringValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOctetStringValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOctetstringValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOctetstringValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOperationDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOperationDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOperationExpected.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOperationExpected.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOptional.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOptional.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOutOfService.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOutOfService.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOutputUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOutputUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPacketReorderTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPacketReorderTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPassbackMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPassbackMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPassbackTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPassbackTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPassengerAlarm.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPassengerAlarm.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPolarity.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPolarity.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPortFilter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPortFilter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveAccessRules.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveAccessRules.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueCOVIncrement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueCOVIncrement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueDeadband.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueDeadband.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueFaultHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueFaultHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueFaultLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueFaultLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueHighLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueHighLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueLowLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueLowLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueMinPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueMinPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueResolution.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPositiveIntegerValueResolution.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPower.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPower.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPowerMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPowerMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPrescale.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPrescale.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriorityArray.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriorityArray.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriorityForWriting.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriorityForWriting.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProcessIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProcessIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProcessIdentifierFilter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProcessIdentifierFilter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProfileLocation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProfileLocation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProfileName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProfileName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramLocation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramLocation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProgramState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPropertyList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPropertyList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProportionalConstant.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProportionalConstant.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProportionalConstantUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProportionalConstantUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolObjectTypesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolObjectTypesSupported.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolRevision.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolRevision.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolServicesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolServicesSupported.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolVersion.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolVersion.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseConverterAdjustValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseConverterAdjustValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseConverterAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseConverterAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseConverterPresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseConverterPresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseRate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPulseRate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReadOnly.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReadOnly.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReasonForDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReasonForDisable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReasonForHalt.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReasonForHalt.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRecipientList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRecipientList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRecordCount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRecordCount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRecordsSinceNotification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRecordsSinceNotification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReferencePort.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReferencePort.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRegisteredCarCall.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRegisteredCarCall.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReliability.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReliability.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReliabilityEvaluationInhibit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReliabilityEvaluationInhibit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRepresents.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRepresents.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRequestedShedLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRequestedShedLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRequestedUpdateInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRequestedUpdateInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRequired.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRequired.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataResolution.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataResolution.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestartNotificationRecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestartNotificationRecipients.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestoreCompletionTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestoreCompletionTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestorePreparationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestorePreparationTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRoutingTable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRoutingTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScale.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScale.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScaleFactor.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScaleFactor.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScheduleAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScheduleAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScheduleDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataScheduleDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSchedulePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSchedulePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSecuredStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSecuredStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSecurityPDUTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSecurityPDUTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSecurityTimeWindow.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSecurityTimeWindow.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSegmentationSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSegmentationSupported.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSerialNumber.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSerialNumber.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSetpoint.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSetpoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSetpointReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSetpointReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSetting.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSetting.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataShedDuration.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataShedDuration.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataShedLevelDescriptions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataShedLevelDescriptions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataShedLevels.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataShedLevels.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSilenced.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSilenced.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSlaveAddressBinding.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSlaveAddressBinding.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSlaveProxyEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSlaveProxyEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStartTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStartTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStateChangeValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStateChangeValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStateDescription.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStateDescription.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStateText.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStateText.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStatusFlags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStatusFlags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStopTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStopTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStopWhenFull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStopWhenFull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStrikeCount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStrikeCount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStructuredObjectList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStructuredObjectList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStructuredViewAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStructuredViewAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateAnnotations.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateAnnotations.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateNodeTypes.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateNodeTypes.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateRelationships.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateRelationships.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateTags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubordinateTags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubscribedRecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSubscribedRecipients.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSupportedFormatClasses.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSupportedFormatClasses.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSupportedFormats.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSupportedFormats.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSupportedSecurityAlgorithms.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSupportedSecurityAlgorithms.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSystemStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSystemStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataThreatAuthority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataThreatAuthority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataThreatLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataThreatLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeDelay.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeDelay.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeDelayNormal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeDelayNormal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfActiveTimeReset.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfActiveTimeReset.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfDeviceRestart.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfDeviceRestart.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfStateCountReset.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfStateCountReset.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfStrikeCountReset.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfStrikeCountReset.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimePatternValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimePatternValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimePatternValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimePatternValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationRecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationRecipients.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeValuePresentValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeValuePresentValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeValueRelinquishDefault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeValueRelinquishDefault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimepatternValueAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimepatternValueAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerMaxPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerMaxPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerMinPresValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerMinPresValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerResolution.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerResolution.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerRunning.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerRunning.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimerState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTotalRecordCount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTotalRecordCount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTraceFlag.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTraceFlag.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrackingValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrackingValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTransactionNotificationClass.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTransactionNotificationClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTransition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTransition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogLogBuffer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogLogBuffer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogLogDeviceObjectProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogLogDeviceObjectProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogMultipleAll.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogMultipleAll.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogMultipleLogBuffer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogMultipleLogBuffer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogMultipleLogDeviceObjectProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrendLogMultipleLogDeviceObjectProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrigger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTrigger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCOffset.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCOffset.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCTimeSynchronizationRecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCTimeSynchronizationRecipients.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUnspecified.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUnspecified.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUpdateInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUpdateInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUpdateKeySetTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUpdateKeySetTimeout.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUpdateTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUpdateTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserExternalIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserExternalIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserInformationReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserInformationReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUserType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUsesRemaining.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUsesRemaining.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVTClassesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVTClassesSupported.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValidSamples.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValidSamples.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueBeforeChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueBeforeChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueChangeTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueChangeTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueSet.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueSet.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueSource.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueSource.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueSourceArray.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataValueSourceArray.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVarianceValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVarianceValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVerificationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVerificationTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVirtualMACAddressTable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVirtualMACAddressTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWeeklySchedule.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWeeklySchedule.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWindowInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWindowInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWindowSamples.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWindowSamples.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWriteStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataWriteStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataZoneFrom.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataZoneFrom.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataZoneMembers.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataZoneMembers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataZoneTo.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataZoneTo.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTag.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTag.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagObjectIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagObjectIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagSignedInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagSignedInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagUnknown.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagUnknown.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagUnsignedInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetContextTagUnsignedInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCredentialAuthenticationFactor.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCredentialAuthenticationFactor.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDailySchedule.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDailySchedule.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDataType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDataType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDateRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDateRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDateRangeEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDateRangeEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDateTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDateTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDateTimeEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDateTimeEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDaysOfWeek.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDaysOfWeek.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDaysOfWeekTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDaysOfWeekTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDestination.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDestination.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectPropertyReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectPropertyReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectPropertyReferenceEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectPropertyReferenceEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectReferenceEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceObjectReferenceEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDeviceStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorAlarmState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorAlarmState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorAlarmStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorAlarmStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorSecuredStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorSecuredStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorSecuredStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorSecuredStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorValueTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetDoorValueTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEngineeringUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEngineeringUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEngineeringUnitsTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEngineeringUnitsTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetError.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetErrorGeneral.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetErrorGeneral.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorFault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorFault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorFaultTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorFaultTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorModeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorModeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorOperationDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorOperationDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorOperationDirectionTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEscalatorOperationDirectionTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatum.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatum.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatumLogStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatumLogStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatumNotification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatumNotification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatumTimeChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventLogRecordLogDatumTimeChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventNotificationSubscription.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventNotificationSubscription.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterAccessEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterAccessEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterAccessEventListOfAccessEvents.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterAccessEventListOfAccessEvents.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterBufferReady.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterBufferReady.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfBitstring.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfBitstring.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfBitstringListOfBitstringValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfBitstringListOfBitstringValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfCharacterStringListOfAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfCharacterStringListOfAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfDiscreteValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfDiscreteValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfLifeSavety.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfLifeSavety.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfLifeSavetyListOfAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfLifeSavetyListOfAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfLifeSavetyListOfLifeSavetyAlarmValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfLifeSavetyListOfLifeSavetyAlarmValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfStateListOfValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfStateListOfValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfStatusFlags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfStatusFlags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfTimer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfTimer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfTimerAlarmValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfTimerAlarmValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValueCivCriteria.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValueCivCriteria.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValueCivCriteriaBitmask.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValueCivCriteriaBitmask.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValueCivCriteriaReferencedPropertyIncrement.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterChangeOfValueCivCriteriaReferencedPropertyIncrement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterCommandFailure.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterCommandFailure.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterDoubleOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterDoubleOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterExtended.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterExtended.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterExtendedParameters.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterExtendedParameters.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterFloatingLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterFloatingLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterNone.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterNone.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterSignedOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterSignedOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterUnsignedOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterUnsignedOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterUnsignedRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventParameterUnsignedRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventPriorities.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventPriorities.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventSummariesList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventSummariesList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventSummary.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventSummary.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTimestamps.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTimestamps.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTimestampsEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTimestampsEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTransitionBits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTransitionBits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTransitionBitsTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTransitionBitsTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetEventTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameter.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultCharacterStringListOfFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultCharacterStringListOfFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtended.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtended.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParameters.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParameters.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryObjectidentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryObjectidentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultExtendedParametersEntryUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultLifeSafety.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultLifeSafety.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultLifeSafetyListOfFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultLifeSafetyListOfFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultListed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultListed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMaxNormalValueUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultOutOfRangeMinNormalValueUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultStateListOfFaultValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultStateListOfFaultValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultStatusFlags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterFaultStatusFlags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterNone.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultParameterNone.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFaultTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFileAccessMethod.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFileAccessMethod.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetFileAccessMethodTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetFileAccessMethodTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetGroupChannelValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetGroupChannelValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetGroupChannelValueList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetGroupChannelValueList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressIpAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressIpAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetHostAddressNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetHostNPort.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetHostNPort.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetHostNPortEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetHostNPortEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetIPMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetIPMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetIPModeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetIPModeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetKeyIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetKeyIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatusCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatusCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatusCommandDestination.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatusCommandDestination.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatusCommandDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingCallStatusCommandDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingDoorStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingDoorStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingDoorStatusLandingDoorsList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingDoorStatusLandingDoorsList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingDoorStatusLandingDoorsListEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLandingDoorStatusLandingDoorsListEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyModeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyModeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyOperation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyOperation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyOperationTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyOperationTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLifeSafetyStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarCallList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarCallList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarCallListFloorList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarCallListFloorList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDirectionTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDirectionTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDoorCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDoorCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDoorCommandTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDoorCommandTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDriveStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDriveStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDriveStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarDriveStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarModeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftCarModeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftFault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftFault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftFaultTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftFaultTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftGroupMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftGroupMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftGroupModeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLiftGroupModeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingCommandEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingCommandEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingInProgress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingInProgress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingInProgressTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingInProgressTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingOperation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingOperation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingOperationTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingOperationTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingTransition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingTransition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingTransitionTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLightingTransitionTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLimitEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLimitEnable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLimitEnableTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLimitEnableTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLockStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLockStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLockStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLockStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryAnyValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryAnyValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryBitStringValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryBitStringValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryBooleanValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryBooleanValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryEnumeratedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryEnumeratedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryFailure.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryFailure.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryIntegerValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryIntegerValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryNullValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryNullValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryRealValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryRealValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryUnsignedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataEntryUnsignedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataTimeChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogDataTimeChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogDataLogStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogMultipleRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogMultipleRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatum.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatum.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumAnyValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumAnyValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumBitStringValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumBitStringValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumBooleanValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumBooleanValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumEnumeratedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumEnumeratedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumFailure.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumFailure.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumIntegerValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumIntegerValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumLogStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumLogStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumNullValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumNullValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumRealValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumRealValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumTimeChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumTimeChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumUnsignedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogRecordLogDatumUnsignedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLogStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLogStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLoggingType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLoggingType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetLoggingTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetLoggingTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetMaintenance.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetMaintenance.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetMaintenanceTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetMaintenanceTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNameValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNameValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNameValueCollection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNameValueCollection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkNumberQuality.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkNumberQuality.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkNumberQualityTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkNumberQualityTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkPortCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkPortCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkPortCommandTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkPortCommandTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkSecurityPolicy.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkSecurityPolicy.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNetworkTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNodeType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNodeType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNodeTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNodeTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParameters.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParameters.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersAccessEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersAccessEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersBufferReady.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersBufferReady.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueDatetime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueDatetime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueObjectidentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueObjectidentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueOctetDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueOctetDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueOctetTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueOctetTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfDiscreteValueNewValueUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfLifeSafety.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfLifeSafety.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfReliability.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfReliability.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfStatusFlags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfStatusFlags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfTimer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfTimer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValueNewValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValueNewValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValueNewValueChangedBits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValueNewValueChangedBits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValueNewValueChangedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersChangeOfValueNewValueChangedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersCommandFailure.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersCommandFailure.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersComplexEventType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersComplexEventType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersDoubleOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersDoubleOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersExtended.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersExtended.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersExtendedParameters.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersExtendedParameters.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersFloatingLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersFloatingLimit.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersSignedOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersSignedOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersUnsignedOutOfRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersUnsignedOutOfRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersUnsignedRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotificationParametersUnsignedRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotifyType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotifyType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetNotifyTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetNotifyTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectPropertyReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectPropertyReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectPropertyReferenceEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectPropertyReferenceEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypesSupported.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypesSupportedTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypesSupportedTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOpeningTag.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOpeningTag.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalBinaryPV.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalBinaryPV.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalBinaryPVNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalBinaryPVNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalBinaryPVValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalBinaryPVValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalCharacterStringNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalCharacterStringNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalCharacterStringValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalCharacterStringValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalREAL.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalREAL.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalREALNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalREALNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalREALValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalREALValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalUnsignedNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalUnsignedNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalUnsignedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetOptionalUnsignedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPolarity.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPolarity.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPolarityTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPolarityTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPortPermission.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPortPermission.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPrescale.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPrescale.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityArray.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityArray.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueConstructedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueConstructedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueDateTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueDateTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueObjectidentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueObjectidentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPriorityValueUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProcessIdSelection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProcessIdSelection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProcessIdSelectionNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProcessIdSelectionNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProcessIdSelectionValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProcessIdSelectionValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramError.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramErrorTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramErrorTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramRequest.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramRequestTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramRequestTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProgramStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResult.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResult.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResultAccessResult.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResultAccessResult.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResultAccessResultPropertyAccessError.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResultAccessResultPropertyAccessError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResultAccessResultPropertyValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyAccessResultAccessResultPropertyValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyIdentifierTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyIdentifierTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyReferenceEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyReferenceEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStateActionUnknown.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStateActionUnknown.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStates.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStates.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAccessCredentialDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAccessCredentialDisable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAccessCredentialDisableReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAccessCredentialDisableReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAccessEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAccessEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAction.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAction.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAuthenticationStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesAuthenticationStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBackupState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBackupState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBacnetIpMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBacnetIpMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBinaryLightningValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBinaryLightningValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBinaryValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBinaryValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorAlarmState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorAlarmState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorSecuredStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorSecuredStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesDoorValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEscalatorFault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEscalatorFault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEscalatorMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEscalatorMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEscalatorOperationDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEscalatorOperationDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEventType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesEventType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesExtendedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesExtendedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesFileAccessMethod.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesFileAccessMethod.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesIntegerValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesIntegerValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLifeSafetyMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLifeSafetyMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLifeSafetyOperations.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLifeSafetyOperations.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLifeSafetyState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLifeSafetyState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarDirection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarDoorCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarDoorCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarDriveStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarDriveStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftCarMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftFault.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftFault.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftGroupMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLiftGroupMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLightningInProgress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLightningInProgress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLightningOperation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLightningOperation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLightningTransition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLightningTransition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLockStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesLockStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesMaintenance.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesMaintenance.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNetworkNumberQuality.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNetworkNumberQuality.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNetworkPortCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNetworkPortCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNetworkType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNetworkType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNodeType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNodeType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNotifyType.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesNotifyType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesPolarity.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesPolarity.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesProgramChange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesProgramChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesProtocolLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesProtocolLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesReasonForHalt.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesReasonForHalt.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesReliability.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesReliability.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesRestartReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesRestartReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesSecurityLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesSecurityLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesShedState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesShedState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesSilencedState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesSilencedState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesSystemStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesSystemStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesTimerState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesTimerState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesTimerTransition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesTimerTransition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesUnits.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesUnits.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesWriteStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesWriteStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesZoneOccupanyState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyStatesZoneOccupanyState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyWriteDefinition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetPropertyWriteDefinition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProtocolLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProtocolLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetProtocolLevelTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetProtocolLevelTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessPropertyReadResult.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessPropertyReadResult.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessResult.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessResult.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessResultListOfResults.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessResultListOfResults.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessSpecification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetReadAccessSpecification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipient.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipient.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientDevice.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientDevice.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientProcess.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientProcess.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientProcessEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRecipientProcessEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRejectReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRejectReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRejectReasonTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRejectReasonTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRelationship.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRelationship.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRelationshipTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRelationshipTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetReliability.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetReliability.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetReliabilityTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetReliabilityTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRestartReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRestartReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRestartReasonTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRestartReasonTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetResultFlags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetResultFlags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetResultFlagsTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetResultFlagsTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRouterEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRouterEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRouterEntryStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRouterEntryStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetRouterEntryStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetRouterEntryStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetScale.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetScale.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetScaleFloatScale.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetScaleFloatScale.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetScaleIntegerScale.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetScaleIntegerScale.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityKeySet.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityKeySet.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityKeySetKeyIds.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityKeySetKeyIds.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityLevelTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityLevelTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityPolicy.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityPolicy.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityPolicyTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSecurityPolicyTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSegmentation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSegmentation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSegmentationTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSegmentationTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAck.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFile.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFile.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFileRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFileRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFileStream.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFileStream.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFileStreamOrRecord.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicReadFileStreamOrRecord.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicWriteFile.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAtomicWriteFile.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAuthenticate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckAuthenticate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckConfirmedPrivateTransfer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckConfirmedPrivateTransfer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckCreateObject.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckCreateObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckGetAlarmSummary.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckGetAlarmSummary.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckGetEnrollmentSummary.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckGetEnrollmentSummary.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckGetEventInformation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckGetEventInformation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadProperty.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadPropertyConditional.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadPropertyConditional.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadPropertyMultiple.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadPropertyMultiple.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadRange.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckReadRange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckRequestKey.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckRequestKey.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckVTData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckVTData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckVTOpen.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServiceAckVTOpen.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServicesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServicesSupported.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetServicesSupportedTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServicesSupportedTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSetpointReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSetpointReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevelAmount.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevelAmount.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevelLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevelLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevelPercent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetShedLevelPercent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetShedState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetShedState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetShedStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetShedStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSilencedState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSilencedState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSilencedStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSilencedStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventListOfTimeValues.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventListOfTimeValues.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventPeriod.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventPeriod.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventPeriodCalendarEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventPeriodCalendarEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventPeriodCalendarReference.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetSpecialEventPeriodCalendarReference.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetStatusFlags.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetStatusFlags.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetStatusFlagsTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetStatusFlagsTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagHeader.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagHeader.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadObjectIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadObjectIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadSignedInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadSignedInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadUnsignedInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTagPayloadUnsignedInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStamp.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStamp.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampDateTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampDateTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampSequence.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampSequence.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampsEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeStampsEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimeValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueBitString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueBitString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueBoolean.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueBoolean.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueCharacterString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueCharacterString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueConstructedValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueConstructedValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueDate.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueDateTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueDateTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueDouble.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueDouble.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueEnumerated.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueEnumerated.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueInteger.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueLightingCommand.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueLightingCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueNoValue.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueNoValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueNull.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueNull.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueObjectidentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueObjectidentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueOctetString.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueOctetString.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueReal.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueReal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueUnsigned.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateChangeValueUnsigned.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerStateTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerTransition.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerTransition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerTransitionTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetTimerTransitionTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceChoice.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceChoice.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceChoiceTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceChoiceTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequest.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestIAm.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestIAm.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestIHave.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestIHave.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestTimeSynchronization.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestTimeSynchronization.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUTCTimeSynchronization.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUTCTimeSynchronization.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedCOVNotification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedCOVNotification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedCOVNotificationMultiple.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedCOVNotificationMultiple.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedEventNotification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedEventNotification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedPrivateTransfer.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedPrivateTransfer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedTextMessage.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnconfirmedTextMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnknown.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestUnknown.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHas.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHas.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHasObject.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHasObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHasObjectIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHasObjectIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHasObjectName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoHasObjectName.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoIs.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWhoIs.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWriteGroup.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetUnconfirmedServiceRequestWriteGroup.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVMACEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVMACEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVTClass.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVTClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVTClassTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVTClassTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVTSession.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVTSession.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSource.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSource.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSourceAddress.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSourceAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSourceNone.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSourceNone.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSourceObject.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetValueSourceObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorIdTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorIdTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetWeekNDay.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetWeekNDay.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetWeekNDayTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetWeekNDayTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetWriteAccessSpecification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetWriteAccessSpecification.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetWriteStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetWriteStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetWriteStatusTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetWriteStatusTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLC.go b/plc4go/protocols/bacnetip/readwrite/model/BVLC.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCBroadcastDistributionTableEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCBroadcastDistributionTableEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCDeleteForeignDeviceTableEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCDeleteForeignDeviceTableEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCDistributeBroadcastToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCDistributeBroadcastToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCForeignDeviceTableEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCForeignDeviceTableEntry.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCForwardedNPDU.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCForwardedNPDU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCOriginalBroadcastNPDU.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCOriginalBroadcastNPDU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCOriginalUnicastNPDU.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCOriginalUnicastNPDU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCReadBroadcastDistributionTable.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCReadBroadcastDistributionTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCReadBroadcastDistributionTableAck.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCReadBroadcastDistributionTableAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCReadForeignDeviceTable.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCReadForeignDeviceTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCReadForeignDeviceTableAck.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCReadForeignDeviceTableAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCRegisterForeignDevice.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCRegisterForeignDevice.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCResult.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCResult.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCResultCode.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCResultCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCResultCodeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCResultCodeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCSecureBVLL.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCSecureBVLL.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/BVLCWriteBroadcastDistributionTable.go b/plc4go/protocols/bacnetip/readwrite/model/BVLCWriteBroadcastDistributionTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ChangeListAddError.go b/plc4go/protocols/bacnetip/readwrite/model/ChangeListAddError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ChangeListRemoveError.go b/plc4go/protocols/bacnetip/readwrite/model/ChangeListRemoveError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ConfirmedEventNotificationRequest.go b/plc4go/protocols/bacnetip/readwrite/model/ConfirmedEventNotificationRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ConfirmedPrivateTransferError.go b/plc4go/protocols/bacnetip/readwrite/model/ConfirmedPrivateTransferError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/CreateObjectError.go b/plc4go/protocols/bacnetip/readwrite/model/CreateObjectError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/Error.go b/plc4go/protocols/bacnetip/readwrite/model/Error.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ErrorClass.go b/plc4go/protocols/bacnetip/readwrite/model/ErrorClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ErrorClassTagged.go b/plc4go/protocols/bacnetip/readwrite/model/ErrorClassTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ErrorCode.go b/plc4go/protocols/bacnetip/readwrite/model/ErrorCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ErrorCodeTagged.go b/plc4go/protocols/bacnetip/readwrite/model/ErrorCodeTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ErrorEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/ErrorEnclosed.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ListOfCovNotifications.go b/plc4go/protocols/bacnetip/readwrite/model/ListOfCovNotifications.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ListOfCovNotificationsList.go b/plc4go/protocols/bacnetip/readwrite/model/ListOfCovNotificationsList.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/ListOfCovNotificationsValue.go b/plc4go/protocols/bacnetip/readwrite/model/ListOfCovNotificationsValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/MaxApduLengthAccepted.go b/plc4go/protocols/bacnetip/readwrite/model/MaxApduLengthAccepted.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/MaxApduLengthAcceptedTagged.go b/plc4go/protocols/bacnetip/readwrite/model/MaxApduLengthAcceptedTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/MaxSegmentsAccepted.go b/plc4go/protocols/bacnetip/readwrite/model/MaxSegmentsAccepted.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/MaxSegmentsAcceptedTagged.go b/plc4go/protocols/bacnetip/readwrite/model/MaxSegmentsAcceptedTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLM.go b/plc4go/protocols/bacnetip/readwrite/model/NLM.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMDisconnectConnectionToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMDisconnectConnectionToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMEstablishConnectionToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMEstablishConnectionToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMIAmRouterToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMIAmRouterToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMICouldBeRouterToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMICouldBeRouterToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMInitalizeRoutingTable.go b/plc4go/protocols/bacnetip/readwrite/model/NLMInitalizeRoutingTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMInitalizeRoutingTableAck.go b/plc4go/protocols/bacnetip/readwrite/model/NLMInitalizeRoutingTableAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMInitalizeRoutingTablePortMapping.go b/plc4go/protocols/bacnetip/readwrite/model/NLMInitalizeRoutingTablePortMapping.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMRejectRouterToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMRejectRouterToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMRejectRouterToNetworkRejectReason.go b/plc4go/protocols/bacnetip/readwrite/model/NLMRejectRouterToNetworkRejectReason.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMRouterAvailableToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMRouterAvailableToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMRouterBusyToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMRouterBusyToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NLMWhoIsRouterToNetwork.go b/plc4go/protocols/bacnetip/readwrite/model/NLMWhoIsRouterToNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NPDU.go b/plc4go/protocols/bacnetip/readwrite/model/NPDU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NPDUControl.go b/plc4go/protocols/bacnetip/readwrite/model/NPDUControl.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NPDUNetworkPriority.go b/plc4go/protocols/bacnetip/readwrite/model/NPDUNetworkPriority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/NPDUNetworkPriorityTagged.go b/plc4go/protocols/bacnetip/readwrite/model/NPDUNetworkPriorityTagged.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/StaticHelper.go b/plc4go/protocols/bacnetip/readwrite/model/StaticHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/SubscribeCOVPropertyMultipleError.go b/plc4go/protocols/bacnetip/readwrite/model/SubscribeCOVPropertyMultipleError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/SubscribeCOVPropertyMultipleErrorFirstFailedSubscription.go b/plc4go/protocols/bacnetip/readwrite/model/SubscribeCOVPropertyMultipleErrorFirstFailedSubscription.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/TagClass.go b/plc4go/protocols/bacnetip/readwrite/model/TagClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/VTCloseError.go b/plc4go/protocols/bacnetip/readwrite/model/VTCloseError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/VTCloseErrorListOfVTSessionIdentifiers.go b/plc4go/protocols/bacnetip/readwrite/model/VTCloseErrorListOfVTSessionIdentifiers.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/bacnetip/readwrite/model/WritePropertyMultipleError.go b/plc4go/protocols/bacnetip/readwrite/model/WritePropertyMultipleError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/ParserHelper.go b/plc4go/protocols/cbus/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/Alpha.go b/plc4go/protocols/cbus/readwrite/model/Alpha.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/ApplicationId.go b/plc4go/protocols/cbus/readwrite/model/ApplicationId.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/ApplicationIdContainer.go b/plc4go/protocols/cbus/readwrite/model/ApplicationIdContainer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/Attribute.go b/plc4go/protocols/cbus/readwrite/model/Attribute.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/BridgeAddress.go b/plc4go/protocols/cbus/readwrite/model/BridgeAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/BridgeCount.go b/plc4go/protocols/cbus/readwrite/model/BridgeCount.go new file mode 100755 index 00000000000..d6df77143a6 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/BridgeCount.go @@ -0,0 +1,157 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// BridgeCount is the corresponding interface of BridgeCount +type BridgeCount interface { + utils.LengthAware + utils.Serializable + // GetCount returns Count (property field) + GetCount() uint8 +} + +// BridgeCountExactly can be used when we want exactly this type and not a type which fulfills BridgeCount. +// This is useful for switch cases. +type BridgeCountExactly interface { + BridgeCount + isBridgeCount() bool +} + +// _BridgeCount is the data-structure of this message +type _BridgeCount struct { + Count uint8 +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_BridgeCount) GetCount() uint8 { + return m.Count +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBridgeCount factory function for _BridgeCount +func NewBridgeCount(count uint8) *_BridgeCount { + return &_BridgeCount{Count: count} +} + +// Deprecated: use the interface for direct cast +func CastBridgeCount(structType interface{}) BridgeCount { + if casted, ok := structType.(BridgeCount); ok { + return casted + } + if casted, ok := structType.(*BridgeCount); ok { + return *casted + } + return nil +} + +func (m *_BridgeCount) GetTypeName() string { + return "BridgeCount" +} + +func (m *_BridgeCount) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_BridgeCount) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (count) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_BridgeCount) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BridgeCountParse(readBuffer utils.ReadBuffer) (BridgeCount, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BridgeCount"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for BridgeCount") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (count) + _count, _countErr := readBuffer.ReadUint8("count", 8) + if _countErr != nil { + return nil, errors.Wrap(_countErr, "Error parsing 'count' field") + } + count := _count + + if closeErr := readBuffer.CloseContext("BridgeCount"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for BridgeCount") + } + + // Create the instance + return NewBridgeCount(count), nil +} + +func (m *_BridgeCount) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BridgeCount"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for BridgeCount") + } + + // Simple Field (count) + count := uint8(m.GetCount()) + _countErr := writeBuffer.WriteUint8("count", 8, (count)) + if _countErr != nil { + return errors.Wrap(_countErr, "Error serializing 'count' field") + } + + if popErr := writeBuffer.PopContext("BridgeCount"); popErr != nil { + return errors.Wrap(popErr, "Error popping for BridgeCount") + } + return nil +} + +func (m *_BridgeCount) isBridgeCount() bool { + return true +} + +func (m *_BridgeCount) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALCommandType.go b/plc4go/protocols/cbus/readwrite/model/CALCommandType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CALCommandTypeContainer.go b/plc4go/protocols/cbus/readwrite/model/CALCommandTypeContainer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CALData.go b/plc4go/protocols/cbus/readwrite/model/CALData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataIdentify.go b/plc4go/protocols/cbus/readwrite/model/CALDataIdentify.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataRecall.go b/plc4go/protocols/cbus/readwrite/model/CALDataRecall.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataReplyAcknowledge.go b/plc4go/protocols/cbus/readwrite/model/CALDataReplyAcknowledge.go new file mode 100755 index 00000000000..eefca3862b6 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CALDataReplyAcknowledge.go @@ -0,0 +1,216 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CALDataReplyAcknowledge is the corresponding interface of CALDataReplyAcknowledge +type CALDataReplyAcknowledge interface { + utils.LengthAware + utils.Serializable + CALData + // GetParamNo returns ParamNo (property field) + GetParamNo() uint8 + // GetCode returns Code (property field) + GetCode() uint8 +} + +// CALDataReplyAcknowledgeExactly can be used when we want exactly this type and not a type which fulfills CALDataReplyAcknowledge. +// This is useful for switch cases. +type CALDataReplyAcknowledgeExactly interface { + CALDataReplyAcknowledge + isCALDataReplyAcknowledge() bool +} + +// _CALDataReplyAcknowledge is the data-structure of this message +type _CALDataReplyAcknowledge struct { + *_CALData + ParamNo uint8 + Code uint8 +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CALDataReplyAcknowledge) InitializeParent(parent CALData, commandTypeContainer CALCommandTypeContainer) { + m.CommandTypeContainer = commandTypeContainer +} + +func (m *_CALDataReplyAcknowledge) GetParent() CALData { + return m._CALData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CALDataReplyAcknowledge) GetParamNo() uint8 { + return m.ParamNo +} + +func (m *_CALDataReplyAcknowledge) GetCode() uint8 { + return m.Code +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCALDataReplyAcknowledge factory function for _CALDataReplyAcknowledge +func NewCALDataReplyAcknowledge(paramNo uint8, code uint8, commandTypeContainer CALCommandTypeContainer) *_CALDataReplyAcknowledge { + _result := &_CALDataReplyAcknowledge{ + ParamNo: paramNo, + Code: code, + _CALData: NewCALData(commandTypeContainer), + } + _result._CALData._CALDataChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCALDataReplyAcknowledge(structType interface{}) CALDataReplyAcknowledge { + if casted, ok := structType.(CALDataReplyAcknowledge); ok { + return casted + } + if casted, ok := structType.(*CALDataReplyAcknowledge); ok { + return *casted + } + return nil +} + +func (m *_CALDataReplyAcknowledge) GetTypeName() string { + return "CALDataReplyAcknowledge" +} + +func (m *_CALDataReplyAcknowledge) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CALDataReplyAcknowledge) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (paramNo) + lengthInBits += 8 + + // Simple field (code) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_CALDataReplyAcknowledge) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CALDataReplyAcknowledgeParse(readBuffer utils.ReadBuffer) (CALDataReplyAcknowledge, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CALDataReplyAcknowledge"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CALDataReplyAcknowledge") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (paramNo) + _paramNo, _paramNoErr := readBuffer.ReadUint8("paramNo", 8) + if _paramNoErr != nil { + return nil, errors.Wrap(_paramNoErr, "Error parsing 'paramNo' field") + } + paramNo := _paramNo + + // Simple Field (code) + _code, _codeErr := readBuffer.ReadUint8("code", 8) + if _codeErr != nil { + return nil, errors.Wrap(_codeErr, "Error parsing 'code' field") + } + code := _code + + if closeErr := readBuffer.CloseContext("CALDataReplyAcknowledge"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CALDataReplyAcknowledge") + } + + // Create a partially initialized instance + _child := &_CALDataReplyAcknowledge{ + ParamNo: paramNo, + Code: code, + _CALData: &_CALData{}, + } + _child._CALData._CALDataChildRequirements = _child + return _child, nil +} + +func (m *_CALDataReplyAcknowledge) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CALDataReplyAcknowledge"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CALDataReplyAcknowledge") + } + + // Simple Field (paramNo) + paramNo := uint8(m.GetParamNo()) + _paramNoErr := writeBuffer.WriteUint8("paramNo", 8, (paramNo)) + if _paramNoErr != nil { + return errors.Wrap(_paramNoErr, "Error serializing 'paramNo' field") + } + + // Simple Field (code) + code := uint8(m.GetCode()) + _codeErr := writeBuffer.WriteUint8("code", 8, (code)) + if _codeErr != nil { + return errors.Wrap(_codeErr, "Error serializing 'code' field") + } + + if popErr := writeBuffer.PopContext("CALDataReplyAcknowledge"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CALDataReplyAcknowledge") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CALDataReplyAcknowledge) isCALDataReplyAcknowledge() bool { + return true +} + +func (m *_CALDataReplyAcknowledge) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataReplyReply.go b/plc4go/protocols/cbus/readwrite/model/CALDataReplyReply.go new file mode 100755 index 00000000000..be3cabfd92a --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CALDataReplyReply.go @@ -0,0 +1,216 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CALDataReplyReply is the corresponding interface of CALDataReplyReply +type CALDataReplyReply interface { + utils.LengthAware + utils.Serializable + CALData + // GetParamNumber returns ParamNumber (property field) + GetParamNumber() uint8 + // GetData returns Data (property field) + GetData() []byte +} + +// CALDataReplyReplyExactly can be used when we want exactly this type and not a type which fulfills CALDataReplyReply. +// This is useful for switch cases. +type CALDataReplyReplyExactly interface { + CALDataReplyReply + isCALDataReplyReply() bool +} + +// _CALDataReplyReply is the data-structure of this message +type _CALDataReplyReply struct { + *_CALData + ParamNumber uint8 + Data []byte +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CALDataReplyReply) InitializeParent(parent CALData, commandTypeContainer CALCommandTypeContainer) { + m.CommandTypeContainer = commandTypeContainer +} + +func (m *_CALDataReplyReply) GetParent() CALData { + return m._CALData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CALDataReplyReply) GetParamNumber() uint8 { + return m.ParamNumber +} + +func (m *_CALDataReplyReply) GetData() []byte { + return m.Data +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCALDataReplyReply factory function for _CALDataReplyReply +func NewCALDataReplyReply(paramNumber uint8, data []byte, commandTypeContainer CALCommandTypeContainer) *_CALDataReplyReply { + _result := &_CALDataReplyReply{ + ParamNumber: paramNumber, + Data: data, + _CALData: NewCALData(commandTypeContainer), + } + _result._CALData._CALDataChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCALDataReplyReply(structType interface{}) CALDataReplyReply { + if casted, ok := structType.(CALDataReplyReply); ok { + return casted + } + if casted, ok := structType.(*CALDataReplyReply); ok { + return *casted + } + return nil +} + +func (m *_CALDataReplyReply) GetTypeName() string { + return "CALDataReplyReply" +} + +func (m *_CALDataReplyReply) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CALDataReplyReply) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (paramNumber) + lengthInBits += 8 + + // Array field + if len(m.Data) > 0 { + lengthInBits += 8 * uint16(len(m.Data)) + } + + return lengthInBits +} + +func (m *_CALDataReplyReply) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CALDataReplyReplyParse(readBuffer utils.ReadBuffer, commandTypeContainer CALCommandTypeContainer) (CALDataReplyReply, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CALDataReplyReply"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CALDataReplyReply") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (paramNumber) + _paramNumber, _paramNumberErr := readBuffer.ReadUint8("paramNumber", 8) + if _paramNumberErr != nil { + return nil, errors.Wrap(_paramNumberErr, "Error parsing 'paramNumber' field") + } + paramNumber := _paramNumber + // Byte Array field (data) + numberOfBytesdata := int(commandTypeContainer.NumBytes()) + data, _readArrayErr := readBuffer.ReadByteArray("data", numberOfBytesdata) + if _readArrayErr != nil { + return nil, errors.Wrap(_readArrayErr, "Error parsing 'data' field") + } + + if closeErr := readBuffer.CloseContext("CALDataReplyReply"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CALDataReplyReply") + } + + // Create a partially initialized instance + _child := &_CALDataReplyReply{ + ParamNumber: paramNumber, + Data: data, + _CALData: &_CALData{}, + } + _child._CALData._CALDataChildRequirements = _child + return _child, nil +} + +func (m *_CALDataReplyReply) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CALDataReplyReply"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CALDataReplyReply") + } + + // Simple Field (paramNumber) + paramNumber := uint8(m.GetParamNumber()) + _paramNumberErr := writeBuffer.WriteUint8("paramNumber", 8, (paramNumber)) + if _paramNumberErr != nil { + return errors.Wrap(_paramNumberErr, "Error serializing 'paramNumber' field") + } + + // Array Field (data) + // Byte Array field (data) + if err := writeBuffer.WriteByteArray("data", m.GetData()); err != nil { + return errors.Wrap(err, "Error serializing 'data' field") + } + + if popErr := writeBuffer.PopContext("CALDataReplyReply"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CALDataReplyReply") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CALDataReplyReply) isCALDataReplyReply() bool { + return true +} + +func (m *_CALDataReplyReply) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataReplyStatus.go b/plc4go/protocols/cbus/readwrite/model/CALDataReplyStatus.go new file mode 100755 index 00000000000..9f40dd4ef44 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CALDataReplyStatus.go @@ -0,0 +1,253 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CALDataReplyStatus is the corresponding interface of CALDataReplyStatus +type CALDataReplyStatus interface { + utils.LengthAware + utils.Serializable + CALData + // GetApplication returns Application (property field) + GetApplication() ApplicationIdContainer + // GetBlockStart returns BlockStart (property field) + GetBlockStart() uint8 + // GetData returns Data (property field) + GetData() []byte +} + +// CALDataReplyStatusExactly can be used when we want exactly this type and not a type which fulfills CALDataReplyStatus. +// This is useful for switch cases. +type CALDataReplyStatusExactly interface { + CALDataReplyStatus + isCALDataReplyStatus() bool +} + +// _CALDataReplyStatus is the data-structure of this message +type _CALDataReplyStatus struct { + *_CALData + Application ApplicationIdContainer + BlockStart uint8 + Data []byte +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CALDataReplyStatus) InitializeParent(parent CALData, commandTypeContainer CALCommandTypeContainer) { + m.CommandTypeContainer = commandTypeContainer +} + +func (m *_CALDataReplyStatus) GetParent() CALData { + return m._CALData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CALDataReplyStatus) GetApplication() ApplicationIdContainer { + return m.Application +} + +func (m *_CALDataReplyStatus) GetBlockStart() uint8 { + return m.BlockStart +} + +func (m *_CALDataReplyStatus) GetData() []byte { + return m.Data +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCALDataReplyStatus factory function for _CALDataReplyStatus +func NewCALDataReplyStatus(application ApplicationIdContainer, blockStart uint8, data []byte, commandTypeContainer CALCommandTypeContainer) *_CALDataReplyStatus { + _result := &_CALDataReplyStatus{ + Application: application, + BlockStart: blockStart, + Data: data, + _CALData: NewCALData(commandTypeContainer), + } + _result._CALData._CALDataChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCALDataReplyStatus(structType interface{}) CALDataReplyStatus { + if casted, ok := structType.(CALDataReplyStatus); ok { + return casted + } + if casted, ok := structType.(*CALDataReplyStatus); ok { + return *casted + } + return nil +} + +func (m *_CALDataReplyStatus) GetTypeName() string { + return "CALDataReplyStatus" +} + +func (m *_CALDataReplyStatus) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CALDataReplyStatus) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (application) + lengthInBits += 8 + + // Simple field (blockStart) + lengthInBits += 8 + + // Array field + if len(m.Data) > 0 { + lengthInBits += 8 * uint16(len(m.Data)) + } + + return lengthInBits +} + +func (m *_CALDataReplyStatus) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CALDataReplyStatusParse(readBuffer utils.ReadBuffer, commandTypeContainer CALCommandTypeContainer) (CALDataReplyStatus, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CALDataReplyStatus"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CALDataReplyStatus") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (application) + if pullErr := readBuffer.PullContext("application"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for application") + } + _application, _applicationErr := ApplicationIdContainerParse(readBuffer) + if _applicationErr != nil { + return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field") + } + application := _application + if closeErr := readBuffer.CloseContext("application"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for application") + } + + // Simple Field (blockStart) + _blockStart, _blockStartErr := readBuffer.ReadUint8("blockStart", 8) + if _blockStartErr != nil { + return nil, errors.Wrap(_blockStartErr, "Error parsing 'blockStart' field") + } + blockStart := _blockStart + // Byte Array field (data) + numberOfBytesdata := int(commandTypeContainer.NumBytes()) + data, _readArrayErr := readBuffer.ReadByteArray("data", numberOfBytesdata) + if _readArrayErr != nil { + return nil, errors.Wrap(_readArrayErr, "Error parsing 'data' field") + } + + if closeErr := readBuffer.CloseContext("CALDataReplyStatus"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CALDataReplyStatus") + } + + // Create a partially initialized instance + _child := &_CALDataReplyStatus{ + Application: application, + BlockStart: blockStart, + Data: data, + _CALData: &_CALData{}, + } + _child._CALData._CALDataChildRequirements = _child + return _child, nil +} + +func (m *_CALDataReplyStatus) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CALDataReplyStatus"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CALDataReplyStatus") + } + + // Simple Field (application) + if pushErr := writeBuffer.PushContext("application"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for application") + } + _applicationErr := writeBuffer.WriteSerializable(m.GetApplication()) + if popErr := writeBuffer.PopContext("application"); popErr != nil { + return errors.Wrap(popErr, "Error popping for application") + } + if _applicationErr != nil { + return errors.Wrap(_applicationErr, "Error serializing 'application' field") + } + + // Simple Field (blockStart) + blockStart := uint8(m.GetBlockStart()) + _blockStartErr := writeBuffer.WriteUint8("blockStart", 8, (blockStart)) + if _blockStartErr != nil { + return errors.Wrap(_blockStartErr, "Error serializing 'blockStart' field") + } + + // Array Field (data) + // Byte Array field (data) + if err := writeBuffer.WriteByteArray("data", m.GetData()); err != nil { + return errors.Wrap(err, "Error serializing 'data' field") + } + + if popErr := writeBuffer.PopContext("CALDataReplyStatus"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CALDataReplyStatus") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CALDataReplyStatus) isCALDataReplyStatus() bool { + return true +} + +func (m *_CALDataReplyStatus) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataReplyStatusExtended.go b/plc4go/protocols/cbus/readwrite/model/CALDataReplyStatusExtended.go new file mode 100755 index 00000000000..04a1eec7291 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CALDataReplyStatusExtended.go @@ -0,0 +1,279 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CALDataReplyStatusExtended is the corresponding interface of CALDataReplyStatusExtended +type CALDataReplyStatusExtended interface { + utils.LengthAware + utils.Serializable + CALData + // GetEncoding returns Encoding (property field) + GetEncoding() uint8 + // GetApplication returns Application (property field) + GetApplication() ApplicationIdContainer + // GetBlockStart returns BlockStart (property field) + GetBlockStart() uint8 + // GetData returns Data (property field) + GetData() []byte +} + +// CALDataReplyStatusExtendedExactly can be used when we want exactly this type and not a type which fulfills CALDataReplyStatusExtended. +// This is useful for switch cases. +type CALDataReplyStatusExtendedExactly interface { + CALDataReplyStatusExtended + isCALDataReplyStatusExtended() bool +} + +// _CALDataReplyStatusExtended is the data-structure of this message +type _CALDataReplyStatusExtended struct { + *_CALData + Encoding uint8 + Application ApplicationIdContainer + BlockStart uint8 + Data []byte +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CALDataReplyStatusExtended) InitializeParent(parent CALData, commandTypeContainer CALCommandTypeContainer) { + m.CommandTypeContainer = commandTypeContainer +} + +func (m *_CALDataReplyStatusExtended) GetParent() CALData { + return m._CALData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CALDataReplyStatusExtended) GetEncoding() uint8 { + return m.Encoding +} + +func (m *_CALDataReplyStatusExtended) GetApplication() ApplicationIdContainer { + return m.Application +} + +func (m *_CALDataReplyStatusExtended) GetBlockStart() uint8 { + return m.BlockStart +} + +func (m *_CALDataReplyStatusExtended) GetData() []byte { + return m.Data +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCALDataReplyStatusExtended factory function for _CALDataReplyStatusExtended +func NewCALDataReplyStatusExtended(encoding uint8, application ApplicationIdContainer, blockStart uint8, data []byte, commandTypeContainer CALCommandTypeContainer) *_CALDataReplyStatusExtended { + _result := &_CALDataReplyStatusExtended{ + Encoding: encoding, + Application: application, + BlockStart: blockStart, + Data: data, + _CALData: NewCALData(commandTypeContainer), + } + _result._CALData._CALDataChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCALDataReplyStatusExtended(structType interface{}) CALDataReplyStatusExtended { + if casted, ok := structType.(CALDataReplyStatusExtended); ok { + return casted + } + if casted, ok := structType.(*CALDataReplyStatusExtended); ok { + return *casted + } + return nil +} + +func (m *_CALDataReplyStatusExtended) GetTypeName() string { + return "CALDataReplyStatusExtended" +} + +func (m *_CALDataReplyStatusExtended) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CALDataReplyStatusExtended) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (encoding) + lengthInBits += 8 + + // Simple field (application) + lengthInBits += 8 + + // Simple field (blockStart) + lengthInBits += 8 + + // Array field + if len(m.Data) > 0 { + lengthInBits += 8 * uint16(len(m.Data)) + } + + return lengthInBits +} + +func (m *_CALDataReplyStatusExtended) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CALDataReplyStatusExtendedParse(readBuffer utils.ReadBuffer, commandTypeContainer CALCommandTypeContainer) (CALDataReplyStatusExtended, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CALDataReplyStatusExtended"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CALDataReplyStatusExtended") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (encoding) + _encoding, _encodingErr := readBuffer.ReadUint8("encoding", 8) + if _encodingErr != nil { + return nil, errors.Wrap(_encodingErr, "Error parsing 'encoding' field") + } + encoding := _encoding + + // Simple Field (application) + if pullErr := readBuffer.PullContext("application"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for application") + } + _application, _applicationErr := ApplicationIdContainerParse(readBuffer) + if _applicationErr != nil { + return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field") + } + application := _application + if closeErr := readBuffer.CloseContext("application"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for application") + } + + // Simple Field (blockStart) + _blockStart, _blockStartErr := readBuffer.ReadUint8("blockStart", 8) + if _blockStartErr != nil { + return nil, errors.Wrap(_blockStartErr, "Error parsing 'blockStart' field") + } + blockStart := _blockStart + // Byte Array field (data) + numberOfBytesdata := int(commandTypeContainer.NumBytes()) + data, _readArrayErr := readBuffer.ReadByteArray("data", numberOfBytesdata) + if _readArrayErr != nil { + return nil, errors.Wrap(_readArrayErr, "Error parsing 'data' field") + } + + if closeErr := readBuffer.CloseContext("CALDataReplyStatusExtended"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CALDataReplyStatusExtended") + } + + // Create a partially initialized instance + _child := &_CALDataReplyStatusExtended{ + Encoding: encoding, + Application: application, + BlockStart: blockStart, + Data: data, + _CALData: &_CALData{}, + } + _child._CALData._CALDataChildRequirements = _child + return _child, nil +} + +func (m *_CALDataReplyStatusExtended) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CALDataReplyStatusExtended"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CALDataReplyStatusExtended") + } + + // Simple Field (encoding) + encoding := uint8(m.GetEncoding()) + _encodingErr := writeBuffer.WriteUint8("encoding", 8, (encoding)) + if _encodingErr != nil { + return errors.Wrap(_encodingErr, "Error serializing 'encoding' field") + } + + // Simple Field (application) + if pushErr := writeBuffer.PushContext("application"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for application") + } + _applicationErr := writeBuffer.WriteSerializable(m.GetApplication()) + if popErr := writeBuffer.PopContext("application"); popErr != nil { + return errors.Wrap(popErr, "Error popping for application") + } + if _applicationErr != nil { + return errors.Wrap(_applicationErr, "Error serializing 'application' field") + } + + // Simple Field (blockStart) + blockStart := uint8(m.GetBlockStart()) + _blockStartErr := writeBuffer.WriteUint8("blockStart", 8, (blockStart)) + if _blockStartErr != nil { + return errors.Wrap(_blockStartErr, "Error serializing 'blockStart' field") + } + + // Array Field (data) + // Byte Array field (data) + if err := writeBuffer.WriteByteArray("data", m.GetData()); err != nil { + return errors.Wrap(err, "Error serializing 'data' field") + } + + if popErr := writeBuffer.PopContext("CALDataReplyStatusExtended"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CALDataReplyStatusExtended") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CALDataReplyStatusExtended) isCALDataReplyStatusExtended() bool { + return true +} + +func (m *_CALDataReplyStatusExtended) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataRequestRecall.go b/plc4go/protocols/cbus/readwrite/model/CALDataRequestRecall.go new file mode 100755 index 00000000000..4b82561a4ea --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CALDataRequestRecall.go @@ -0,0 +1,216 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CALDataRequestRecall is the corresponding interface of CALDataRequestRecall +type CALDataRequestRecall interface { + utils.LengthAware + utils.Serializable + CALData + // GetParamNo returns ParamNo (property field) + GetParamNo() uint8 + // GetCount returns Count (property field) + GetCount() uint8 +} + +// CALDataRequestRecallExactly can be used when we want exactly this type and not a type which fulfills CALDataRequestRecall. +// This is useful for switch cases. +type CALDataRequestRecallExactly interface { + CALDataRequestRecall + isCALDataRequestRecall() bool +} + +// _CALDataRequestRecall is the data-structure of this message +type _CALDataRequestRecall struct { + *_CALData + ParamNo uint8 + Count uint8 +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CALDataRequestRecall) InitializeParent(parent CALData, commandTypeContainer CALCommandTypeContainer) { + m.CommandTypeContainer = commandTypeContainer +} + +func (m *_CALDataRequestRecall) GetParent() CALData { + return m._CALData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CALDataRequestRecall) GetParamNo() uint8 { + return m.ParamNo +} + +func (m *_CALDataRequestRecall) GetCount() uint8 { + return m.Count +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCALDataRequestRecall factory function for _CALDataRequestRecall +func NewCALDataRequestRecall(paramNo uint8, count uint8, commandTypeContainer CALCommandTypeContainer) *_CALDataRequestRecall { + _result := &_CALDataRequestRecall{ + ParamNo: paramNo, + Count: count, + _CALData: NewCALData(commandTypeContainer), + } + _result._CALData._CALDataChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCALDataRequestRecall(structType interface{}) CALDataRequestRecall { + if casted, ok := structType.(CALDataRequestRecall); ok { + return casted + } + if casted, ok := structType.(*CALDataRequestRecall); ok { + return *casted + } + return nil +} + +func (m *_CALDataRequestRecall) GetTypeName() string { + return "CALDataRequestRecall" +} + +func (m *_CALDataRequestRecall) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CALDataRequestRecall) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (paramNo) + lengthInBits += 8 + + // Simple field (count) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_CALDataRequestRecall) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CALDataRequestRecallParse(readBuffer utils.ReadBuffer) (CALDataRequestRecall, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CALDataRequestRecall"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CALDataRequestRecall") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (paramNo) + _paramNo, _paramNoErr := readBuffer.ReadUint8("paramNo", 8) + if _paramNoErr != nil { + return nil, errors.Wrap(_paramNoErr, "Error parsing 'paramNo' field") + } + paramNo := _paramNo + + // Simple Field (count) + _count, _countErr := readBuffer.ReadUint8("count", 8) + if _countErr != nil { + return nil, errors.Wrap(_countErr, "Error parsing 'count' field") + } + count := _count + + if closeErr := readBuffer.CloseContext("CALDataRequestRecall"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CALDataRequestRecall") + } + + // Create a partially initialized instance + _child := &_CALDataRequestRecall{ + ParamNo: paramNo, + Count: count, + _CALData: &_CALData{}, + } + _child._CALData._CALDataChildRequirements = _child + return _child, nil +} + +func (m *_CALDataRequestRecall) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CALDataRequestRecall"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CALDataRequestRecall") + } + + // Simple Field (paramNo) + paramNo := uint8(m.GetParamNo()) + _paramNoErr := writeBuffer.WriteUint8("paramNo", 8, (paramNo)) + if _paramNoErr != nil { + return errors.Wrap(_paramNoErr, "Error serializing 'paramNo' field") + } + + // Simple Field (count) + count := uint8(m.GetCount()) + _countErr := writeBuffer.WriteUint8("count", 8, (count)) + if _countErr != nil { + return errors.Wrap(_countErr, "Error serializing 'count' field") + } + + if popErr := writeBuffer.PopContext("CALDataRequestRecall"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CALDataRequestRecall") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CALDataRequestRecall) isCALDataRequestRecall() bool { + return true +} + +func (m *_CALDataRequestRecall) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALDataRequestReset.go b/plc4go/protocols/cbus/readwrite/model/CALDataRequestReset.go new file mode 100755 index 00000000000..4192406684a --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CALDataRequestReset.go @@ -0,0 +1,154 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CALDataRequestReset is the corresponding interface of CALDataRequestReset +type CALDataRequestReset interface { + utils.LengthAware + utils.Serializable + CALData +} + +// CALDataRequestResetExactly can be used when we want exactly this type and not a type which fulfills CALDataRequestReset. +// This is useful for switch cases. +type CALDataRequestResetExactly interface { + CALDataRequestReset + isCALDataRequestReset() bool +} + +// _CALDataRequestReset is the data-structure of this message +type _CALDataRequestReset struct { + *_CALData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CALDataRequestReset) InitializeParent(parent CALData, commandTypeContainer CALCommandTypeContainer) { + m.CommandTypeContainer = commandTypeContainer +} + +func (m *_CALDataRequestReset) GetParent() CALData { + return m._CALData +} + +// NewCALDataRequestReset factory function for _CALDataRequestReset +func NewCALDataRequestReset(commandTypeContainer CALCommandTypeContainer) *_CALDataRequestReset { + _result := &_CALDataRequestReset{ + _CALData: NewCALData(commandTypeContainer), + } + _result._CALData._CALDataChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCALDataRequestReset(structType interface{}) CALDataRequestReset { + if casted, ok := structType.(CALDataRequestReset); ok { + return casted + } + if casted, ok := structType.(*CALDataRequestReset); ok { + return *casted + } + return nil +} + +func (m *_CALDataRequestReset) GetTypeName() string { + return "CALDataRequestReset" +} + +func (m *_CALDataRequestReset) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CALDataRequestReset) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + return lengthInBits +} + +func (m *_CALDataRequestReset) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CALDataRequestResetParse(readBuffer utils.ReadBuffer) (CALDataRequestReset, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CALDataRequestReset"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CALDataRequestReset") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("CALDataRequestReset"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CALDataRequestReset") + } + + // Create a partially initialized instance + _child := &_CALDataRequestReset{ + _CALData: &_CALData{}, + } + _child._CALData._CALDataChildRequirements = _child + return _child, nil +} + +func (m *_CALDataRequestReset) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CALDataRequestReset"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CALDataRequestReset") + } + + if popErr := writeBuffer.PopContext("CALDataRequestReset"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CALDataRequestReset") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CALDataRequestReset) isCALDataRequestReset() bool { + return true +} + +func (m *_CALDataRequestReset) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALReply.go b/plc4go/protocols/cbus/readwrite/model/CALReply.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go b/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go b/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go new file mode 100755 index 00000000000..354bd141e37 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go @@ -0,0 +1,201 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CALReplyReply is the corresponding interface of CALReplyReply +type CALReplyReply interface { + utils.LengthAware + utils.Serializable + Reply + // GetIsA returns IsA (property field) + GetIsA() CALReply +} + +// CALReplyReplyExactly can be used when we want exactly this type and not a type which fulfills CALReplyReply. +// This is useful for switch cases. +type CALReplyReplyExactly interface { + CALReplyReply + isCALReplyReply() bool +} + +// _CALReplyReply is the data-structure of this message +type _CALReplyReply struct { + *_Reply + IsA CALReply +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CALReplyReply) InitializeParent(parent Reply, magicByte byte) { + m.MagicByte = magicByte +} + +func (m *_CALReplyReply) GetParent() Reply { + return m._Reply +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CALReplyReply) GetIsA() CALReply { + return m.IsA +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCALReplyReply factory function for _CALReplyReply +func NewCALReplyReply(isA CALReply, magicByte byte) *_CALReplyReply { + _result := &_CALReplyReply{ + IsA: isA, + _Reply: NewReply(magicByte), + } + _result._Reply._ReplyChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCALReplyReply(structType interface{}) CALReplyReply { + if casted, ok := structType.(CALReplyReply); ok { + return casted + } + if casted, ok := structType.(*CALReplyReply); ok { + return *casted + } + return nil +} + +func (m *_CALReplyReply) GetTypeName() string { + return "CALReplyReply" +} + +func (m *_CALReplyReply) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CALReplyReply) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (isA) + lengthInBits += m.IsA.GetLengthInBits() + + return lengthInBits +} + +func (m *_CALReplyReply) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CALReplyReplyParse(readBuffer utils.ReadBuffer) (CALReplyReply, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CALReplyReply"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CALReplyReply") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (isA) + if pullErr := readBuffer.PullContext("isA"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for isA") + } + _isA, _isAErr := CALReplyParse(readBuffer) + if _isAErr != nil { + return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field") + } + isA := _isA.(CALReply) + if closeErr := readBuffer.CloseContext("isA"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for isA") + } + + if closeErr := readBuffer.CloseContext("CALReplyReply"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CALReplyReply") + } + + // Create a partially initialized instance + _child := &_CALReplyReply{ + IsA: isA, + _Reply: &_Reply{}, + } + _child._Reply._ReplyChildRequirements = _child + return _child, nil +} + +func (m *_CALReplyReply) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CALReplyReply"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CALReplyReply") + } + + // Simple Field (isA) + if pushErr := writeBuffer.PushContext("isA"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for isA") + } + _isAErr := writeBuffer.WriteSerializable(m.GetIsA()) + if popErr := writeBuffer.PopContext("isA"); popErr != nil { + return errors.Wrap(popErr, "Error popping for isA") + } + if _isAErr != nil { + return errors.Wrap(_isAErr, "Error serializing 'isA' field") + } + + if popErr := writeBuffer.PopContext("CALReplyReply"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CALReplyReply") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CALReplyReply) isCALReplyReply() bool { + return true +} + +func (m *_CALReplyReply) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyShort.go b/plc4go/protocols/cbus/readwrite/model/CALReplyShort.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToMultiPoint.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToMultiPoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPoint.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPoint.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go new file mode 100755 index 00000000000..9a174a52bfb --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go @@ -0,0 +1,401 @@ +/* + * 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 model + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" + "io" +) + +// Code generated by code-generation. DO NOT EDIT. + +// Constant values. +const CBusCommandPointToPointToMultiPointNormal_CR byte = 0xD + +// CBusCommandPointToPointToMultiPointNormal is the corresponding interface of CBusCommandPointToPointToMultiPointNormal +type CBusCommandPointToPointToMultiPointNormal interface { + utils.LengthAware + utils.Serializable + CBusPointToPointToMultipointCommand + // GetApplication returns Application (property field) + GetApplication() ApplicationIdContainer + // GetSalData returns SalData (property field) + GetSalData() SALData + // GetCrc returns Crc (property field) + GetCrc() Checksum + // GetPeekAlpha returns PeekAlpha (property field) + GetPeekAlpha() byte + // GetAlpha returns Alpha (property field) + GetAlpha() Alpha +} + +// CBusCommandPointToPointToMultiPointNormalExactly can be used when we want exactly this type and not a type which fulfills CBusCommandPointToPointToMultiPointNormal. +// This is useful for switch cases. +type CBusCommandPointToPointToMultiPointNormalExactly interface { + CBusCommandPointToPointToMultiPointNormal + isCBusCommandPointToPointToMultiPointNormal() bool +} + +// _CBusCommandPointToPointToMultiPointNormal is the data-structure of this message +type _CBusCommandPointToPointToMultiPointNormal struct { + *_CBusPointToPointToMultipointCommand + Application ApplicationIdContainer + SalData SALData + Crc Checksum + PeekAlpha byte + Alpha Alpha +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CBusCommandPointToPointToMultiPointNormal) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) { + m.BridgeAddress = bridgeAddress + m.NetworkRoute = networkRoute + m.PeekedApplication = peekedApplication +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetParent() CBusPointToPointToMultipointCommand { + return m._CBusPointToPointToMultipointCommand +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetApplication() ApplicationIdContainer { + return m.Application +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetSalData() SALData { + return m.SalData +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetCrc() Checksum { + return m.Crc +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetPeekAlpha() byte { + return m.PeekAlpha +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetAlpha() Alpha { + return m.Alpha +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for const fields. +/////////////////////// + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetCr() byte { + return CBusCommandPointToPointToMultiPointNormal_CR +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCBusCommandPointToPointToMultiPointNormal factory function for _CBusCommandPointToPointToMultiPointNormal +func NewCBusCommandPointToPointToMultiPointNormal(application ApplicationIdContainer, salData SALData, crc Checksum, peekAlpha byte, alpha Alpha, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusCommandPointToPointToMultiPointNormal { + _result := &_CBusCommandPointToPointToMultiPointNormal{ + Application: application, + SalData: salData, + Crc: crc, + PeekAlpha: peekAlpha, + Alpha: alpha, + _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, srchk), + } + _result._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCBusCommandPointToPointToMultiPointNormal(structType interface{}) CBusCommandPointToPointToMultiPointNormal { + if casted, ok := structType.(CBusCommandPointToPointToMultiPointNormal); ok { + return casted + } + if casted, ok := structType.(*CBusCommandPointToPointToMultiPointNormal); ok { + return *casted + } + return nil +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetTypeName() string { + return "CBusCommandPointToPointToMultiPointNormal" +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (application) + lengthInBits += 8 + + // Simple field (salData) + lengthInBits += m.SalData.GetLengthInBits() + + // Optional Field (crc) + if m.Crc != nil { + lengthInBits += m.Crc.GetLengthInBits() + } + + // Optional Field (alpha) + if m.Alpha != nil { + lengthInBits += m.Alpha.GetLengthInBits() + } + + // Const Field (cr) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CBusCommandPointToPointToMultiPointNormalParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandPointToPointToMultiPointNormal, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CBusCommandPointToPointToMultiPointNormal"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CBusCommandPointToPointToMultiPointNormal") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (application) + if pullErr := readBuffer.PullContext("application"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for application") + } + _application, _applicationErr := ApplicationIdContainerParse(readBuffer) + if _applicationErr != nil { + return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field") + } + application := _application + if closeErr := readBuffer.CloseContext("application"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for application") + } + + // Simple Field (salData) + if pullErr := readBuffer.PullContext("salData"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for salData") + } + _salData, _salDataErr := SALDataParse(readBuffer) + if _salDataErr != nil { + return nil, errors.Wrap(_salDataErr, "Error parsing 'salData' field") + } + salData := _salData.(SALData) + if closeErr := readBuffer.CloseContext("salData"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for salData") + } + + // Optional Field (crc) (Can be skipped, if a given expression evaluates to false) + var crc Checksum = nil + if srchk { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("crc"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for crc") + } + _val, _err := ChecksumParse(readBuffer) + switch { + case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): + log.Debug().Err(_err).Msg("Resetting position because optional threw an error") + readBuffer.Reset(currentPos) + case _err != nil: + return nil, errors.Wrap(_err, "Error parsing 'crc' field") + default: + crc = _val.(Checksum) + if closeErr := readBuffer.CloseContext("crc"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for crc") + } + } + } + + // Peek Field (peekAlpha) + currentPos = positionAware.GetPos() + peekAlpha, _err := readBuffer.ReadByte("peekAlpha") + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'peekAlpha' field") + } + + readBuffer.Reset(currentPos) + + // Optional Field (alpha) (Can be skipped, if a given expression evaluates to false) + var alpha Alpha = nil + if bool(bool(bool((peekAlpha) >= (0x67)))) && bool(bool(bool((peekAlpha) <= (0x7A)))) { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("alpha"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for alpha") + } + _val, _err := AlphaParse(readBuffer) + switch { + case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): + log.Debug().Err(_err).Msg("Resetting position because optional threw an error") + readBuffer.Reset(currentPos) + case _err != nil: + return nil, errors.Wrap(_err, "Error parsing 'alpha' field") + default: + alpha = _val.(Alpha) + if closeErr := readBuffer.CloseContext("alpha"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for alpha") + } + } + } + + // Const Field (cr) + cr, _crErr := readBuffer.ReadByte("cr") + if _crErr != nil { + return nil, errors.Wrap(_crErr, "Error parsing 'cr' field") + } + if cr != CBusCommandPointToPointToMultiPointNormal_CR { + return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", CBusCommandPointToPointToMultiPointNormal_CR) + " but got " + fmt.Sprintf("%d", cr)) + } + + if closeErr := readBuffer.CloseContext("CBusCommandPointToPointToMultiPointNormal"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CBusCommandPointToPointToMultiPointNormal") + } + + // Create a partially initialized instance + _child := &_CBusCommandPointToPointToMultiPointNormal{ + Application: application, + SalData: salData, + Crc: crc, + PeekAlpha: peekAlpha, + Alpha: alpha, + _CBusPointToPointToMultipointCommand: &_CBusPointToPointToMultipointCommand{ + Srchk: srchk, + }, + } + _child._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _child + return _child, nil +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CBusCommandPointToPointToMultiPointNormal"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CBusCommandPointToPointToMultiPointNormal") + } + + // Simple Field (application) + if pushErr := writeBuffer.PushContext("application"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for application") + } + _applicationErr := writeBuffer.WriteSerializable(m.GetApplication()) + if popErr := writeBuffer.PopContext("application"); popErr != nil { + return errors.Wrap(popErr, "Error popping for application") + } + if _applicationErr != nil { + return errors.Wrap(_applicationErr, "Error serializing 'application' field") + } + + // Simple Field (salData) + if pushErr := writeBuffer.PushContext("salData"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for salData") + } + _salDataErr := writeBuffer.WriteSerializable(m.GetSalData()) + if popErr := writeBuffer.PopContext("salData"); popErr != nil { + return errors.Wrap(popErr, "Error popping for salData") + } + if _salDataErr != nil { + return errors.Wrap(_salDataErr, "Error serializing 'salData' field") + } + + // Optional Field (crc) (Can be skipped, if the value is null) + var crc Checksum = nil + if m.GetCrc() != nil { + if pushErr := writeBuffer.PushContext("crc"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for crc") + } + crc = m.GetCrc() + _crcErr := writeBuffer.WriteSerializable(crc) + if popErr := writeBuffer.PopContext("crc"); popErr != nil { + return errors.Wrap(popErr, "Error popping for crc") + } + if _crcErr != nil { + return errors.Wrap(_crcErr, "Error serializing 'crc' field") + } + } + + // Optional Field (alpha) (Can be skipped, if the value is null) + var alpha Alpha = nil + if m.GetAlpha() != nil { + if pushErr := writeBuffer.PushContext("alpha"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for alpha") + } + alpha = m.GetAlpha() + _alphaErr := writeBuffer.WriteSerializable(alpha) + if popErr := writeBuffer.PopContext("alpha"); popErr != nil { + return errors.Wrap(popErr, "Error popping for alpha") + } + if _alphaErr != nil { + return errors.Wrap(_alphaErr, "Error serializing 'alpha' field") + } + } + + // Const Field (cr) + _crErr := writeBuffer.WriteByte("cr", 0xD) + if _crErr != nil { + return errors.Wrap(_crErr, "Error serializing 'cr' field") + } + + if popErr := writeBuffer.PopContext("CBusCommandPointToPointToMultiPointNormal"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CBusCommandPointToPointToMultiPointNormal") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) isCBusCommandPointToPointToMultiPointNormal() bool { + return true +} + +func (m *_CBusCommandPointToPointToMultiPointNormal) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go new file mode 100755 index 00000000000..715c7cc0eba --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go @@ -0,0 +1,389 @@ +/* + * 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 model + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" + "io" +) + +// Code generated by code-generation. DO NOT EDIT. + +// Constant values. +const CBusCommandPointToPointToMultiPointStatus_CR byte = 0xD + +// CBusCommandPointToPointToMultiPointStatus is the corresponding interface of CBusCommandPointToPointToMultiPointStatus +type CBusCommandPointToPointToMultiPointStatus interface { + utils.LengthAware + utils.Serializable + CBusPointToPointToMultipointCommand + // GetStatusRequest returns StatusRequest (property field) + GetStatusRequest() StatusRequest + // GetCrc returns Crc (property field) + GetCrc() Checksum + // GetPeekAlpha returns PeekAlpha (property field) + GetPeekAlpha() byte + // GetAlpha returns Alpha (property field) + GetAlpha() Alpha +} + +// CBusCommandPointToPointToMultiPointStatusExactly can be used when we want exactly this type and not a type which fulfills CBusCommandPointToPointToMultiPointStatus. +// This is useful for switch cases. +type CBusCommandPointToPointToMultiPointStatusExactly interface { + CBusCommandPointToPointToMultiPointStatus + isCBusCommandPointToPointToMultiPointStatus() bool +} + +// _CBusCommandPointToPointToMultiPointStatus is the data-structure of this message +type _CBusCommandPointToPointToMultiPointStatus struct { + *_CBusPointToPointToMultipointCommand + StatusRequest StatusRequest + Crc Checksum + PeekAlpha byte + Alpha Alpha +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CBusCommandPointToPointToMultiPointStatus) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) { + m.BridgeAddress = bridgeAddress + m.NetworkRoute = networkRoute + m.PeekedApplication = peekedApplication +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetParent() CBusPointToPointToMultipointCommand { + return m._CBusPointToPointToMultipointCommand +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetStatusRequest() StatusRequest { + return m.StatusRequest +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetCrc() Checksum { + return m.Crc +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetPeekAlpha() byte { + return m.PeekAlpha +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetAlpha() Alpha { + return m.Alpha +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for const fields. +/////////////////////// + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetCr() byte { + return CBusCommandPointToPointToMultiPointStatus_CR +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCBusCommandPointToPointToMultiPointStatus factory function for _CBusCommandPointToPointToMultiPointStatus +func NewCBusCommandPointToPointToMultiPointStatus(statusRequest StatusRequest, crc Checksum, peekAlpha byte, alpha Alpha, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusCommandPointToPointToMultiPointStatus { + _result := &_CBusCommandPointToPointToMultiPointStatus{ + StatusRequest: statusRequest, + Crc: crc, + PeekAlpha: peekAlpha, + Alpha: alpha, + _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, srchk), + } + _result._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCBusCommandPointToPointToMultiPointStatus(structType interface{}) CBusCommandPointToPointToMultiPointStatus { + if casted, ok := structType.(CBusCommandPointToPointToMultiPointStatus); ok { + return casted + } + if casted, ok := structType.(*CBusCommandPointToPointToMultiPointStatus); ok { + return *casted + } + return nil +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetTypeName() string { + return "CBusCommandPointToPointToMultiPointStatus" +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 8 + + // Simple field (statusRequest) + lengthInBits += m.StatusRequest.GetLengthInBits() + + // Optional Field (crc) + if m.Crc != nil { + lengthInBits += m.Crc.GetLengthInBits() + } + + // Optional Field (alpha) + if m.Alpha != nil { + lengthInBits += m.Alpha.GetLengthInBits() + } + + // Const Field (cr) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandPointToPointToMultiPointStatus, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CBusCommandPointToPointToMultiPointStatus"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CBusCommandPointToPointToMultiPointStatus") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadByte("reserved") + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != byte(0xFF) { + log.Info().Fields(map[string]interface{}{ + "expected value": byte(0xFF), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (statusRequest) + if pullErr := readBuffer.PullContext("statusRequest"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for statusRequest") + } + _statusRequest, _statusRequestErr := StatusRequestParse(readBuffer) + if _statusRequestErr != nil { + return nil, errors.Wrap(_statusRequestErr, "Error parsing 'statusRequest' field") + } + statusRequest := _statusRequest.(StatusRequest) + if closeErr := readBuffer.CloseContext("statusRequest"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for statusRequest") + } + + // Optional Field (crc) (Can be skipped, if a given expression evaluates to false) + var crc Checksum = nil + if srchk { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("crc"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for crc") + } + _val, _err := ChecksumParse(readBuffer) + switch { + case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): + log.Debug().Err(_err).Msg("Resetting position because optional threw an error") + readBuffer.Reset(currentPos) + case _err != nil: + return nil, errors.Wrap(_err, "Error parsing 'crc' field") + default: + crc = _val.(Checksum) + if closeErr := readBuffer.CloseContext("crc"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for crc") + } + } + } + + // Peek Field (peekAlpha) + currentPos = positionAware.GetPos() + peekAlpha, _err := readBuffer.ReadByte("peekAlpha") + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'peekAlpha' field") + } + + readBuffer.Reset(currentPos) + + // Optional Field (alpha) (Can be skipped, if a given expression evaluates to false) + var alpha Alpha = nil + if bool(bool(bool((peekAlpha) >= (0x67)))) && bool(bool(bool((peekAlpha) <= (0x7A)))) { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("alpha"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for alpha") + } + _val, _err := AlphaParse(readBuffer) + switch { + case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): + log.Debug().Err(_err).Msg("Resetting position because optional threw an error") + readBuffer.Reset(currentPos) + case _err != nil: + return nil, errors.Wrap(_err, "Error parsing 'alpha' field") + default: + alpha = _val.(Alpha) + if closeErr := readBuffer.CloseContext("alpha"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for alpha") + } + } + } + + // Const Field (cr) + cr, _crErr := readBuffer.ReadByte("cr") + if _crErr != nil { + return nil, errors.Wrap(_crErr, "Error parsing 'cr' field") + } + if cr != CBusCommandPointToPointToMultiPointStatus_CR { + return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", CBusCommandPointToPointToMultiPointStatus_CR) + " but got " + fmt.Sprintf("%d", cr)) + } + + if closeErr := readBuffer.CloseContext("CBusCommandPointToPointToMultiPointStatus"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CBusCommandPointToPointToMultiPointStatus") + } + + // Create a partially initialized instance + _child := &_CBusCommandPointToPointToMultiPointStatus{ + StatusRequest: statusRequest, + Crc: crc, + PeekAlpha: peekAlpha, + Alpha: alpha, + _CBusPointToPointToMultipointCommand: &_CBusPointToPointToMultipointCommand{ + Srchk: srchk, + }, + } + _child._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _child + return _child, nil +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CBusCommandPointToPointToMultiPointStatus"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CBusCommandPointToPointToMultiPointStatus") + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteByte("reserved", byte(0xFF)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (statusRequest) + if pushErr := writeBuffer.PushContext("statusRequest"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for statusRequest") + } + _statusRequestErr := writeBuffer.WriteSerializable(m.GetStatusRequest()) + if popErr := writeBuffer.PopContext("statusRequest"); popErr != nil { + return errors.Wrap(popErr, "Error popping for statusRequest") + } + if _statusRequestErr != nil { + return errors.Wrap(_statusRequestErr, "Error serializing 'statusRequest' field") + } + + // Optional Field (crc) (Can be skipped, if the value is null) + var crc Checksum = nil + if m.GetCrc() != nil { + if pushErr := writeBuffer.PushContext("crc"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for crc") + } + crc = m.GetCrc() + _crcErr := writeBuffer.WriteSerializable(crc) + if popErr := writeBuffer.PopContext("crc"); popErr != nil { + return errors.Wrap(popErr, "Error popping for crc") + } + if _crcErr != nil { + return errors.Wrap(_crcErr, "Error serializing 'crc' field") + } + } + + // Optional Field (alpha) (Can be skipped, if the value is null) + var alpha Alpha = nil + if m.GetAlpha() != nil { + if pushErr := writeBuffer.PushContext("alpha"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for alpha") + } + alpha = m.GetAlpha() + _alphaErr := writeBuffer.WriteSerializable(alpha) + if popErr := writeBuffer.PopContext("alpha"); popErr != nil { + return errors.Wrap(popErr, "Error popping for alpha") + } + if _alphaErr != nil { + return errors.Wrap(_alphaErr, "Error serializing 'alpha' field") + } + } + + // Const Field (cr) + _crErr := writeBuffer.WriteByte("cr", 0xD) + if _crErr != nil { + return errors.Wrap(_crErr, "Error serializing 'cr' field") + } + + if popErr := writeBuffer.PopContext("CBusCommandPointToPointToMultiPointStatus"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CBusCommandPointToPointToMultiPointStatus") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) isCBusCommandPointToPointToMultiPointStatus() bool { + return true +} + +func (m *_CBusCommandPointToPointToMultiPointStatus) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/CBusHeader.go b/plc4go/protocols/cbus/readwrite/model/CBusHeader.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusOptions.go b/plc4go/protocols/cbus/readwrite/model/CBusOptions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultiPointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultiPointCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/ChannelStatus.go b/plc4go/protocols/cbus/readwrite/model/ChannelStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/Checksum.go b/plc4go/protocols/cbus/readwrite/model/Checksum.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/CommandHeader.go b/plc4go/protocols/cbus/readwrite/model/CommandHeader.go new file mode 100755 index 00000000000..b80cf94e177 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CommandHeader.go @@ -0,0 +1,157 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// CommandHeader is the corresponding interface of CommandHeader +type CommandHeader interface { + utils.LengthAware + utils.Serializable + // GetValue returns Value (property field) + GetValue() byte +} + +// CommandHeaderExactly can be used when we want exactly this type and not a type which fulfills CommandHeader. +// This is useful for switch cases. +type CommandHeaderExactly interface { + CommandHeader + isCommandHeader() bool +} + +// _CommandHeader is the data-structure of this message +type _CommandHeader struct { + Value byte +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CommandHeader) GetValue() byte { + return m.Value +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCommandHeader factory function for _CommandHeader +func NewCommandHeader(value byte) *_CommandHeader { + return &_CommandHeader{Value: value} +} + +// Deprecated: use the interface for direct cast +func CastCommandHeader(structType interface{}) CommandHeader { + if casted, ok := structType.(CommandHeader); ok { + return casted + } + if casted, ok := structType.(*CommandHeader); ok { + return *casted + } + return nil +} + +func (m *_CommandHeader) GetTypeName() string { + return "CommandHeader" +} + +func (m *_CommandHeader) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CommandHeader) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (value) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_CommandHeader) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CommandHeaderParse(readBuffer utils.ReadBuffer) (CommandHeader, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CommandHeader"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CommandHeader") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (value) + _value, _valueErr := readBuffer.ReadByte("value") + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("CommandHeader"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CommandHeader") + } + + // Create the instance + return NewCommandHeader(value), nil +} + +func (m *_CommandHeader) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("CommandHeader"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CommandHeader") + } + + // Simple Field (value) + value := byte(m.GetValue()) + _valueErr := writeBuffer.WriteByte("value", (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("CommandHeader"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CommandHeader") + } + return nil +} + +func (m *_CommandHeader) isCommandHeader() bool { + return true +} + +func (m *_CommandHeader) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/Confirmation.go b/plc4go/protocols/cbus/readwrite/model/Confirmation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go b/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go new file mode 100755 index 00000000000..c0c20e26e0f --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go @@ -0,0 +1,201 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ConfirmationReply is the corresponding interface of ConfirmationReply +type ConfirmationReply interface { + utils.LengthAware + utils.Serializable + Reply + // GetIsA returns IsA (property field) + GetIsA() Confirmation +} + +// ConfirmationReplyExactly can be used when we want exactly this type and not a type which fulfills ConfirmationReply. +// This is useful for switch cases. +type ConfirmationReplyExactly interface { + ConfirmationReply + isConfirmationReply() bool +} + +// _ConfirmationReply is the data-structure of this message +type _ConfirmationReply struct { + *_Reply + IsA Confirmation +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ConfirmationReply) InitializeParent(parent Reply, magicByte byte) { + m.MagicByte = magicByte +} + +func (m *_ConfirmationReply) GetParent() Reply { + return m._Reply +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ConfirmationReply) GetIsA() Confirmation { + return m.IsA +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewConfirmationReply factory function for _ConfirmationReply +func NewConfirmationReply(isA Confirmation, magicByte byte) *_ConfirmationReply { + _result := &_ConfirmationReply{ + IsA: isA, + _Reply: NewReply(magicByte), + } + _result._Reply._ReplyChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastConfirmationReply(structType interface{}) ConfirmationReply { + if casted, ok := structType.(ConfirmationReply); ok { + return casted + } + if casted, ok := structType.(*ConfirmationReply); ok { + return *casted + } + return nil +} + +func (m *_ConfirmationReply) GetTypeName() string { + return "ConfirmationReply" +} + +func (m *_ConfirmationReply) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_ConfirmationReply) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (isA) + lengthInBits += m.IsA.GetLengthInBits() + + return lengthInBits +} + +func (m *_ConfirmationReply) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func ConfirmationReplyParse(readBuffer utils.ReadBuffer) (ConfirmationReply, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ConfirmationReply"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ConfirmationReply") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (isA) + if pullErr := readBuffer.PullContext("isA"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for isA") + } + _isA, _isAErr := ConfirmationParse(readBuffer) + if _isAErr != nil { + return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field") + } + isA := _isA.(Confirmation) + if closeErr := readBuffer.CloseContext("isA"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for isA") + } + + if closeErr := readBuffer.CloseContext("ConfirmationReply"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ConfirmationReply") + } + + // Create a partially initialized instance + _child := &_ConfirmationReply{ + IsA: isA, + _Reply: &_Reply{}, + } + _child._Reply._ReplyChildRequirements = _child + return _child, nil +} + +func (m *_ConfirmationReply) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("ConfirmationReply"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ConfirmationReply") + } + + // Simple Field (isA) + if pushErr := writeBuffer.PushContext("isA"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for isA") + } + _isAErr := writeBuffer.WriteSerializable(m.GetIsA()) + if popErr := writeBuffer.PopContext("isA"); popErr != nil { + return errors.Wrap(popErr, "Error popping for isA") + } + if _isAErr != nil { + return errors.Wrap(_isAErr, "Error serializing 'isA' field") + } + + if popErr := writeBuffer.PopContext("ConfirmationReply"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ConfirmationReply") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_ConfirmationReply) isConfirmationReply() bool { + return true +} + +func (m *_ConfirmationReply) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/ConfirmationSuccessful.go b/plc4go/protocols/cbus/readwrite/model/ConfirmationSuccessful.go new file mode 100755 index 00000000000..2e9c24cb1aa --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/ConfirmationSuccessful.go @@ -0,0 +1,158 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ConfirmationSuccessful is the corresponding interface of ConfirmationSuccessful +type ConfirmationSuccessful interface { + utils.LengthAware + utils.Serializable + Confirmation +} + +// ConfirmationSuccessfulExactly can be used when we want exactly this type and not a type which fulfills ConfirmationSuccessful. +// This is useful for switch cases. +type ConfirmationSuccessfulExactly interface { + ConfirmationSuccessful + isConfirmationSuccessful() bool +} + +// _ConfirmationSuccessful is the data-structure of this message +type _ConfirmationSuccessful struct { + *_Confirmation +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_ConfirmationSuccessful) GetConfirmationType() byte { + return 0x2E +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ConfirmationSuccessful) InitializeParent(parent Confirmation, alpha Alpha) { + m.Alpha = alpha +} + +func (m *_ConfirmationSuccessful) GetParent() Confirmation { + return m._Confirmation +} + +// NewConfirmationSuccessful factory function for _ConfirmationSuccessful +func NewConfirmationSuccessful(alpha Alpha) *_ConfirmationSuccessful { + _result := &_ConfirmationSuccessful{ + _Confirmation: NewConfirmation(alpha), + } + _result._Confirmation._ConfirmationChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastConfirmationSuccessful(structType interface{}) ConfirmationSuccessful { + if casted, ok := structType.(ConfirmationSuccessful); ok { + return casted + } + if casted, ok := structType.(*ConfirmationSuccessful); ok { + return *casted + } + return nil +} + +func (m *_ConfirmationSuccessful) GetTypeName() string { + return "ConfirmationSuccessful" +} + +func (m *_ConfirmationSuccessful) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_ConfirmationSuccessful) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + return lengthInBits +} + +func (m *_ConfirmationSuccessful) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func ConfirmationSuccessfulParse(readBuffer utils.ReadBuffer) (ConfirmationSuccessful, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ConfirmationSuccessful"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ConfirmationSuccessful") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("ConfirmationSuccessful"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ConfirmationSuccessful") + } + + // Create a partially initialized instance + _child := &_ConfirmationSuccessful{ + _Confirmation: &_Confirmation{}, + } + _child._Confirmation._ConfirmationChildRequirements = _child + return _child, nil +} + +func (m *_ConfirmationSuccessful) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("ConfirmationSuccessful"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ConfirmationSuccessful") + } + + if popErr := writeBuffer.PopContext("ConfirmationSuccessful"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ConfirmationSuccessful") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_ConfirmationSuccessful) isConfirmationSuccessful() bool { + return true +} + +func (m *_ConfirmationSuccessful) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/DestinationAddressType.go b/plc4go/protocols/cbus/readwrite/model/DestinationAddressType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/ExclamationMark.go b/plc4go/protocols/cbus/readwrite/model/ExclamationMark.go new file mode 100755 index 00000000000..b69118208ec --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/ExclamationMark.go @@ -0,0 +1,123 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ExclamationMark is the corresponding interface of ExclamationMark +type ExclamationMark interface { + utils.LengthAware + utils.Serializable +} + +// ExclamationMarkExactly can be used when we want exactly this type and not a type which fulfills ExclamationMark. +// This is useful for switch cases. +type ExclamationMarkExactly interface { + ExclamationMark + isExclamationMark() bool +} + +// _ExclamationMark is the data-structure of this message +type _ExclamationMark struct { +} + +// NewExclamationMark factory function for _ExclamationMark +func NewExclamationMark() *_ExclamationMark { + return &_ExclamationMark{} +} + +// Deprecated: use the interface for direct cast +func CastExclamationMark(structType interface{}) ExclamationMark { + if casted, ok := structType.(ExclamationMark); ok { + return casted + } + if casted, ok := structType.(*ExclamationMark); ok { + return *casted + } + return nil +} + +func (m *_ExclamationMark) GetTypeName() string { + return "ExclamationMark" +} + +func (m *_ExclamationMark) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_ExclamationMark) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + return lengthInBits +} + +func (m *_ExclamationMark) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func ExclamationMarkParse(readBuffer utils.ReadBuffer) (ExclamationMark, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ExclamationMark"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ExclamationMark") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("ExclamationMark"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ExclamationMark") + } + + // Create the instance + return NewExclamationMark(), nil +} + +func (m *_ExclamationMark) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("ExclamationMark"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ExclamationMark") + } + + if popErr := writeBuffer.PopContext("ExclamationMark"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ExclamationMark") + } + return nil +} + +func (m *_ExclamationMark) isExclamationMark() bool { + return true +} + +func (m *_ExclamationMark) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/ExclamationMarkReply.go b/plc4go/protocols/cbus/readwrite/model/ExclamationMarkReply.go new file mode 100755 index 00000000000..c4af8855e7b --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/ExclamationMarkReply.go @@ -0,0 +1,201 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ExclamationMarkReply is the corresponding interface of ExclamationMarkReply +type ExclamationMarkReply interface { + utils.LengthAware + utils.Serializable + Reply + // GetIsA returns IsA (property field) + GetIsA() ExclamationMark +} + +// ExclamationMarkReplyExactly can be used when we want exactly this type and not a type which fulfills ExclamationMarkReply. +// This is useful for switch cases. +type ExclamationMarkReplyExactly interface { + ExclamationMarkReply + isExclamationMarkReply() bool +} + +// _ExclamationMarkReply is the data-structure of this message +type _ExclamationMarkReply struct { + *_Reply + IsA ExclamationMark +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_ExclamationMarkReply) InitializeParent(parent Reply, magicByte byte) { + m.MagicByte = magicByte +} + +func (m *_ExclamationMarkReply) GetParent() Reply { + return m._Reply +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ExclamationMarkReply) GetIsA() ExclamationMark { + return m.IsA +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewExclamationMarkReply factory function for _ExclamationMarkReply +func NewExclamationMarkReply(isA ExclamationMark, magicByte byte) *_ExclamationMarkReply { + _result := &_ExclamationMarkReply{ + IsA: isA, + _Reply: NewReply(magicByte), + } + _result._Reply._ReplyChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastExclamationMarkReply(structType interface{}) ExclamationMarkReply { + if casted, ok := structType.(ExclamationMarkReply); ok { + return casted + } + if casted, ok := structType.(*ExclamationMarkReply); ok { + return *casted + } + return nil +} + +func (m *_ExclamationMarkReply) GetTypeName() string { + return "ExclamationMarkReply" +} + +func (m *_ExclamationMarkReply) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_ExclamationMarkReply) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (isA) + lengthInBits += m.IsA.GetLengthInBits() + + return lengthInBits +} + +func (m *_ExclamationMarkReply) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func ExclamationMarkReplyParse(readBuffer utils.ReadBuffer) (ExclamationMarkReply, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ExclamationMarkReply"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ExclamationMarkReply") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (isA) + if pullErr := readBuffer.PullContext("isA"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for isA") + } + _isA, _isAErr := ExclamationMarkParse(readBuffer) + if _isAErr != nil { + return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field") + } + isA := _isA.(ExclamationMark) + if closeErr := readBuffer.CloseContext("isA"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for isA") + } + + if closeErr := readBuffer.CloseContext("ExclamationMarkReply"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ExclamationMarkReply") + } + + // Create a partially initialized instance + _child := &_ExclamationMarkReply{ + IsA: isA, + _Reply: &_Reply{}, + } + _child._Reply._ReplyChildRequirements = _child + return _child, nil +} + +func (m *_ExclamationMarkReply) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("ExclamationMarkReply"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ExclamationMarkReply") + } + + // Simple Field (isA) + if pushErr := writeBuffer.PushContext("isA"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for isA") + } + _isAErr := writeBuffer.WriteSerializable(m.GetIsA()) + if popErr := writeBuffer.PopContext("isA"); popErr != nil { + return errors.Wrap(popErr, "Error popping for isA") + } + if _isAErr != nil { + return errors.Wrap(_isAErr, "Error serializing 'isA' field") + } + + if popErr := writeBuffer.PopContext("ExclamationMarkReply"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ExclamationMarkReply") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_ExclamationMarkReply) isExclamationMarkReply() bool { + return true +} + +func (m *_ExclamationMarkReply) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReply.go b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReply.go new file mode 100755 index 00000000000..fd790c3e64a --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReply.go @@ -0,0 +1,407 @@ +/* + * 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 model + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// Constant values. +const ExtendedFormatStatusReply_CR byte = 0x0D +const ExtendedFormatStatusReply_LF byte = 0x0A + +// ExtendedFormatStatusReply is the corresponding interface of ExtendedFormatStatusReply +type ExtendedFormatStatusReply interface { + utils.LengthAware + utils.Serializable + // GetStatusHeader returns StatusHeader (property field) + GetStatusHeader() ExtendedStatusHeader + // GetCoding returns Coding (property field) + GetCoding() StatusCoding + // GetApplication returns Application (property field) + GetApplication() ApplicationIdContainer + // GetBlockStart returns BlockStart (property field) + GetBlockStart() uint8 + // GetStatusBytes returns StatusBytes (property field) + GetStatusBytes() []StatusByte + // GetCrc returns Crc (property field) + GetCrc() Checksum +} + +// ExtendedFormatStatusReplyExactly can be used when we want exactly this type and not a type which fulfills ExtendedFormatStatusReply. +// This is useful for switch cases. +type ExtendedFormatStatusReplyExactly interface { + ExtendedFormatStatusReply + isExtendedFormatStatusReply() bool +} + +// _ExtendedFormatStatusReply is the data-structure of this message +type _ExtendedFormatStatusReply struct { + StatusHeader ExtendedStatusHeader + Coding StatusCoding + Application ApplicationIdContainer + BlockStart uint8 + StatusBytes []StatusByte + Crc Checksum +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ExtendedFormatStatusReply) GetStatusHeader() ExtendedStatusHeader { + return m.StatusHeader +} + +func (m *_ExtendedFormatStatusReply) GetCoding() StatusCoding { + return m.Coding +} + +func (m *_ExtendedFormatStatusReply) GetApplication() ApplicationIdContainer { + return m.Application +} + +func (m *_ExtendedFormatStatusReply) GetBlockStart() uint8 { + return m.BlockStart +} + +func (m *_ExtendedFormatStatusReply) GetStatusBytes() []StatusByte { + return m.StatusBytes +} + +func (m *_ExtendedFormatStatusReply) GetCrc() Checksum { + return m.Crc +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for const fields. +/////////////////////// + +func (m *_ExtendedFormatStatusReply) GetCr() byte { + return ExtendedFormatStatusReply_CR +} + +func (m *_ExtendedFormatStatusReply) GetLf() byte { + return ExtendedFormatStatusReply_LF +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewExtendedFormatStatusReply factory function for _ExtendedFormatStatusReply +func NewExtendedFormatStatusReply(statusHeader ExtendedStatusHeader, coding StatusCoding, application ApplicationIdContainer, blockStart uint8, statusBytes []StatusByte, crc Checksum) *_ExtendedFormatStatusReply { + return &_ExtendedFormatStatusReply{StatusHeader: statusHeader, Coding: coding, Application: application, BlockStart: blockStart, StatusBytes: statusBytes, Crc: crc} +} + +// Deprecated: use the interface for direct cast +func CastExtendedFormatStatusReply(structType interface{}) ExtendedFormatStatusReply { + if casted, ok := structType.(ExtendedFormatStatusReply); ok { + return casted + } + if casted, ok := structType.(*ExtendedFormatStatusReply); ok { + return *casted + } + return nil +} + +func (m *_ExtendedFormatStatusReply) GetTypeName() string { + return "ExtendedFormatStatusReply" +} + +func (m *_ExtendedFormatStatusReply) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_ExtendedFormatStatusReply) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (statusHeader) + lengthInBits += m.StatusHeader.GetLengthInBits() + + // Simple field (coding) + lengthInBits += 8 + + // Simple field (application) + lengthInBits += 8 + + // Simple field (blockStart) + lengthInBits += 8 + + // Array field + if len(m.StatusBytes) > 0 { + for i, element := range m.StatusBytes { + last := i == len(m.StatusBytes)-1 + lengthInBits += element.(interface{ GetLengthInBitsConditional(bool) uint16 }).GetLengthInBitsConditional(last) + } + } + + // Simple field (crc) + lengthInBits += m.Crc.GetLengthInBits() + + // Const Field (cr) + lengthInBits += 8 + + // Const Field (lf) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_ExtendedFormatStatusReply) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func ExtendedFormatStatusReplyParse(readBuffer utils.ReadBuffer) (ExtendedFormatStatusReply, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ExtendedFormatStatusReply"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ExtendedFormatStatusReply") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (statusHeader) + if pullErr := readBuffer.PullContext("statusHeader"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for statusHeader") + } + _statusHeader, _statusHeaderErr := ExtendedStatusHeaderParse(readBuffer) + if _statusHeaderErr != nil { + return nil, errors.Wrap(_statusHeaderErr, "Error parsing 'statusHeader' field") + } + statusHeader := _statusHeader.(ExtendedStatusHeader) + if closeErr := readBuffer.CloseContext("statusHeader"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for statusHeader") + } + + // Simple Field (coding) + if pullErr := readBuffer.PullContext("coding"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for coding") + } + _coding, _codingErr := StatusCodingParse(readBuffer) + if _codingErr != nil { + return nil, errors.Wrap(_codingErr, "Error parsing 'coding' field") + } + coding := _coding + if closeErr := readBuffer.CloseContext("coding"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for coding") + } + + // Simple Field (application) + if pullErr := readBuffer.PullContext("application"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for application") + } + _application, _applicationErr := ApplicationIdContainerParse(readBuffer) + if _applicationErr != nil { + return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field") + } + application := _application + if closeErr := readBuffer.CloseContext("application"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for application") + } + + // Simple Field (blockStart) + _blockStart, _blockStartErr := readBuffer.ReadUint8("blockStart", 8) + if _blockStartErr != nil { + return nil, errors.Wrap(_blockStartErr, "Error parsing 'blockStart' field") + } + blockStart := _blockStart + + // Array field (statusBytes) + if pullErr := readBuffer.PullContext("statusBytes", utils.WithRenderAsList(true)); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for statusBytes") + } + // Count array + statusBytes := make([]StatusByte, uint16(statusHeader.GetNumberOfCharacterPairs())-uint16(uint16(3))) + // This happens when the size is set conditional to 0 + if len(statusBytes) == 0 { + statusBytes = nil + } + { + for curItem := uint16(0); curItem < uint16(uint16(statusHeader.GetNumberOfCharacterPairs())-uint16(uint16(3))); curItem++ { + _item, _err := StatusByteParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'statusBytes' field") + } + statusBytes[curItem] = _item.(StatusByte) + } + } + if closeErr := readBuffer.CloseContext("statusBytes", utils.WithRenderAsList(true)); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for statusBytes") + } + + // Simple Field (crc) + if pullErr := readBuffer.PullContext("crc"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for crc") + } + _crc, _crcErr := ChecksumParse(readBuffer) + if _crcErr != nil { + return nil, errors.Wrap(_crcErr, "Error parsing 'crc' field") + } + crc := _crc.(Checksum) + if closeErr := readBuffer.CloseContext("crc"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for crc") + } + + // Const Field (cr) + cr, _crErr := readBuffer.ReadByte("cr") + if _crErr != nil { + return nil, errors.Wrap(_crErr, "Error parsing 'cr' field") + } + if cr != ExtendedFormatStatusReply_CR { + return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", ExtendedFormatStatusReply_CR) + " but got " + fmt.Sprintf("%d", cr)) + } + + // Const Field (lf) + lf, _lfErr := readBuffer.ReadByte("lf") + if _lfErr != nil { + return nil, errors.Wrap(_lfErr, "Error parsing 'lf' field") + } + if lf != ExtendedFormatStatusReply_LF { + return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", ExtendedFormatStatusReply_LF) + " but got " + fmt.Sprintf("%d", lf)) + } + + if closeErr := readBuffer.CloseContext("ExtendedFormatStatusReply"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ExtendedFormatStatusReply") + } + + // Create the instance + return NewExtendedFormatStatusReply(statusHeader, coding, application, blockStart, statusBytes, crc), nil +} + +func (m *_ExtendedFormatStatusReply) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("ExtendedFormatStatusReply"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ExtendedFormatStatusReply") + } + + // Simple Field (statusHeader) + if pushErr := writeBuffer.PushContext("statusHeader"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for statusHeader") + } + _statusHeaderErr := writeBuffer.WriteSerializable(m.GetStatusHeader()) + if popErr := writeBuffer.PopContext("statusHeader"); popErr != nil { + return errors.Wrap(popErr, "Error popping for statusHeader") + } + if _statusHeaderErr != nil { + return errors.Wrap(_statusHeaderErr, "Error serializing 'statusHeader' field") + } + + // Simple Field (coding) + if pushErr := writeBuffer.PushContext("coding"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for coding") + } + _codingErr := writeBuffer.WriteSerializable(m.GetCoding()) + if popErr := writeBuffer.PopContext("coding"); popErr != nil { + return errors.Wrap(popErr, "Error popping for coding") + } + if _codingErr != nil { + return errors.Wrap(_codingErr, "Error serializing 'coding' field") + } + + // Simple Field (application) + if pushErr := writeBuffer.PushContext("application"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for application") + } + _applicationErr := writeBuffer.WriteSerializable(m.GetApplication()) + if popErr := writeBuffer.PopContext("application"); popErr != nil { + return errors.Wrap(popErr, "Error popping for application") + } + if _applicationErr != nil { + return errors.Wrap(_applicationErr, "Error serializing 'application' field") + } + + // Simple Field (blockStart) + blockStart := uint8(m.GetBlockStart()) + _blockStartErr := writeBuffer.WriteUint8("blockStart", 8, (blockStart)) + if _blockStartErr != nil { + return errors.Wrap(_blockStartErr, "Error serializing 'blockStart' field") + } + + // Array Field (statusBytes) + if pushErr := writeBuffer.PushContext("statusBytes", utils.WithRenderAsList(true)); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for statusBytes") + } + for _, _element := range m.GetStatusBytes() { + _elementErr := writeBuffer.WriteSerializable(_element) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'statusBytes' field") + } + } + if popErr := writeBuffer.PopContext("statusBytes", utils.WithRenderAsList(true)); popErr != nil { + return errors.Wrap(popErr, "Error popping for statusBytes") + } + + // Simple Field (crc) + if pushErr := writeBuffer.PushContext("crc"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for crc") + } + _crcErr := writeBuffer.WriteSerializable(m.GetCrc()) + if popErr := writeBuffer.PopContext("crc"); popErr != nil { + return errors.Wrap(popErr, "Error popping for crc") + } + if _crcErr != nil { + return errors.Wrap(_crcErr, "Error serializing 'crc' field") + } + + // Const Field (cr) + _crErr := writeBuffer.WriteByte("cr", 0x0D) + if _crErr != nil { + return errors.Wrap(_crErr, "Error serializing 'cr' field") + } + + // Const Field (lf) + _lfErr := writeBuffer.WriteByte("lf", 0x0A) + if _lfErr != nil { + return errors.Wrap(_lfErr, "Error serializing 'lf' field") + } + + if popErr := writeBuffer.PopContext("ExtendedFormatStatusReply"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ExtendedFormatStatusReply") + } + return nil +} + +func (m *_ExtendedFormatStatusReply) isExtendedFormatStatusReply() bool { + return true +} + +func (m *_ExtendedFormatStatusReply) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/ExtendedStatusHeader.go b/plc4go/protocols/cbus/readwrite/model/ExtendedStatusHeader.go new file mode 100755 index 00000000000..c500602af47 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/ExtendedStatusHeader.go @@ -0,0 +1,183 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + +// Code generated by code-generation. DO NOT EDIT. + +// ExtendedStatusHeader is the corresponding interface of ExtendedStatusHeader +type ExtendedStatusHeader interface { + utils.LengthAware + utils.Serializable + // GetNumberOfCharacterPairs returns NumberOfCharacterPairs (property field) + GetNumberOfCharacterPairs() uint8 +} + +// ExtendedStatusHeaderExactly can be used when we want exactly this type and not a type which fulfills ExtendedStatusHeader. +// This is useful for switch cases. +type ExtendedStatusHeaderExactly interface { + ExtendedStatusHeader + isExtendedStatusHeader() bool +} + +// _ExtendedStatusHeader is the data-structure of this message +type _ExtendedStatusHeader struct { + NumberOfCharacterPairs uint8 +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_ExtendedStatusHeader) GetNumberOfCharacterPairs() uint8 { + return m.NumberOfCharacterPairs +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewExtendedStatusHeader factory function for _ExtendedStatusHeader +func NewExtendedStatusHeader(numberOfCharacterPairs uint8) *_ExtendedStatusHeader { + return &_ExtendedStatusHeader{NumberOfCharacterPairs: numberOfCharacterPairs} +} + +// Deprecated: use the interface for direct cast +func CastExtendedStatusHeader(structType interface{}) ExtendedStatusHeader { + if casted, ok := structType.(ExtendedStatusHeader); ok { + return casted + } + if casted, ok := structType.(*ExtendedStatusHeader); ok { + return *casted + } + return nil +} + +func (m *_ExtendedStatusHeader) GetTypeName() string { + return "ExtendedStatusHeader" +} + +func (m *_ExtendedStatusHeader) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_ExtendedStatusHeader) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Reserved Field (reserved) + lengthInBits += 3 + + // Simple field (numberOfCharacterPairs) + lengthInBits += 5 + + return lengthInBits +} + +func (m *_ExtendedStatusHeader) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func ExtendedStatusHeaderParse(readBuffer utils.ReadBuffer) (ExtendedStatusHeader, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("ExtendedStatusHeader"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for ExtendedStatusHeader") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 3) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x7) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x7), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (numberOfCharacterPairs) + _numberOfCharacterPairs, _numberOfCharacterPairsErr := readBuffer.ReadUint8("numberOfCharacterPairs", 5) + if _numberOfCharacterPairsErr != nil { + return nil, errors.Wrap(_numberOfCharacterPairsErr, "Error parsing 'numberOfCharacterPairs' field") + } + numberOfCharacterPairs := _numberOfCharacterPairs + + if closeErr := readBuffer.CloseContext("ExtendedStatusHeader"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for ExtendedStatusHeader") + } + + // Create the instance + return NewExtendedStatusHeader(numberOfCharacterPairs), nil +} + +func (m *_ExtendedStatusHeader) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("ExtendedStatusHeader"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for ExtendedStatusHeader") + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 3, uint8(0x7)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (numberOfCharacterPairs) + numberOfCharacterPairs := uint8(m.GetNumberOfCharacterPairs()) + _numberOfCharacterPairsErr := writeBuffer.WriteUint8("numberOfCharacterPairs", 5, (numberOfCharacterPairs)) + if _numberOfCharacterPairsErr != nil { + return errors.Wrap(_numberOfCharacterPairsErr, "Error serializing 'numberOfCharacterPairs' field") + } + + if popErr := writeBuffer.PopContext("ExtendedStatusHeader"); popErr != nil { + return errors.Wrap(popErr, "Error popping for ExtendedStatusHeader") + } + return nil +} + +func (m *_ExtendedStatusHeader) isExtendedStatusHeader() bool { + return true +} + +func (m *_ExtendedStatusHeader) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/GAVState.go b/plc4go/protocols/cbus/readwrite/model/GAVState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommand.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandCurrentSenseLevels.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandCurrentSenseLevels.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandDSIStatus.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandDSIStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandDelays.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandDelays.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandExtendedDiagnosticSummary.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandExtendedDiagnosticSummary.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandFirmwareVersion.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandFirmwareVersion.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandGAVPhysicalAddresses.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandGAVPhysicalAddresses.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandGAVValuesCurrent.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandGAVValuesCurrent.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandGAVValuesStored.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandGAVValuesStored.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandLogicalAssignment.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandLogicalAssignment.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandManufacturer.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandManufacturer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandMaximumLevels.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandMaximumLevels.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandMinimumLevels.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandMinimumLevels.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkTerminalLevels.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkTerminalLevels.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkVoltage.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkVoltage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandOutputUnitSummary.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandOutputUnitSummary.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandSummary.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandSummary.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandTerminalLevels.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandTerminalLevels.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandType.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/LightingCompatible.go b/plc4go/protocols/cbus/readwrite/model/LightingCompatible.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/LightingDataOff.go b/plc4go/protocols/cbus/readwrite/model/LightingDataOff.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/LightingDataOn.go b/plc4go/protocols/cbus/readwrite/model/LightingDataOn.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/LightingDataRampToLevel.go b/plc4go/protocols/cbus/readwrite/model/LightingDataRampToLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSAL.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSAL.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALShortFormBasicMode.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALShortFormBasicMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/NetworkNumber.go b/plc4go/protocols/cbus/readwrite/model/NetworkNumber.go new file mode 100755 index 00000000000..4cb338c4a7a --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/NetworkNumber.go @@ -0,0 +1,157 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// NetworkNumber is the corresponding interface of NetworkNumber +type NetworkNumber interface { + utils.LengthAware + utils.Serializable + // GetNumber returns Number (property field) + GetNumber() uint8 +} + +// NetworkNumberExactly can be used when we want exactly this type and not a type which fulfills NetworkNumber. +// This is useful for switch cases. +type NetworkNumberExactly interface { + NetworkNumber + isNetworkNumber() bool +} + +// _NetworkNumber is the data-structure of this message +type _NetworkNumber struct { + Number uint8 +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_NetworkNumber) GetNumber() uint8 { + return m.Number +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewNetworkNumber factory function for _NetworkNumber +func NewNetworkNumber(number uint8) *_NetworkNumber { + return &_NetworkNumber{Number: number} +} + +// Deprecated: use the interface for direct cast +func CastNetworkNumber(structType interface{}) NetworkNumber { + if casted, ok := structType.(NetworkNumber); ok { + return casted + } + if casted, ok := structType.(*NetworkNumber); ok { + return *casted + } + return nil +} + +func (m *_NetworkNumber) GetTypeName() string { + return "NetworkNumber" +} + +func (m *_NetworkNumber) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_NetworkNumber) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (number) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_NetworkNumber) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func NetworkNumberParse(readBuffer utils.ReadBuffer) (NetworkNumber, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("NetworkNumber"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for NetworkNumber") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (number) + _number, _numberErr := readBuffer.ReadUint8("number", 8) + if _numberErr != nil { + return nil, errors.Wrap(_numberErr, "Error parsing 'number' field") + } + number := _number + + if closeErr := readBuffer.CloseContext("NetworkNumber"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for NetworkNumber") + } + + // Create the instance + return NewNetworkNumber(number), nil +} + +func (m *_NetworkNumber) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("NetworkNumber"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for NetworkNumber") + } + + // Simple Field (number) + number := uint8(m.GetNumber()) + _numberErr := writeBuffer.WriteUint8("number", 8, (number)) + if _numberErr != nil { + return errors.Wrap(_numberErr, "Error serializing 'number' field") + } + + if popErr := writeBuffer.PopContext("NetworkNumber"); popErr != nil { + return errors.Wrap(popErr, "Error popping for NetworkNumber") + } + return nil +} + +func (m *_NetworkNumber) isNetworkNumber() bool { + return true +} + +func (m *_NetworkNumber) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/NetworkProtocolControlInformation.go b/plc4go/protocols/cbus/readwrite/model/NetworkProtocolControlInformation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/NetworkRoute.go b/plc4go/protocols/cbus/readwrite/model/NetworkRoute.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/NotTransmittedCorruption.go b/plc4go/protocols/cbus/readwrite/model/NotTransmittedCorruption.go new file mode 100755 index 00000000000..83081e2dfaa --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/NotTransmittedCorruption.go @@ -0,0 +1,158 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// NotTransmittedCorruption is the corresponding interface of NotTransmittedCorruption +type NotTransmittedCorruption interface { + utils.LengthAware + utils.Serializable + Confirmation +} + +// NotTransmittedCorruptionExactly can be used when we want exactly this type and not a type which fulfills NotTransmittedCorruption. +// This is useful for switch cases. +type NotTransmittedCorruptionExactly interface { + NotTransmittedCorruption + isNotTransmittedCorruption() bool +} + +// _NotTransmittedCorruption is the data-structure of this message +type _NotTransmittedCorruption struct { + *_Confirmation +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_NotTransmittedCorruption) GetConfirmationType() byte { + return 0x24 +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_NotTransmittedCorruption) InitializeParent(parent Confirmation, alpha Alpha) { + m.Alpha = alpha +} + +func (m *_NotTransmittedCorruption) GetParent() Confirmation { + return m._Confirmation +} + +// NewNotTransmittedCorruption factory function for _NotTransmittedCorruption +func NewNotTransmittedCorruption(alpha Alpha) *_NotTransmittedCorruption { + _result := &_NotTransmittedCorruption{ + _Confirmation: NewConfirmation(alpha), + } + _result._Confirmation._ConfirmationChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastNotTransmittedCorruption(structType interface{}) NotTransmittedCorruption { + if casted, ok := structType.(NotTransmittedCorruption); ok { + return casted + } + if casted, ok := structType.(*NotTransmittedCorruption); ok { + return *casted + } + return nil +} + +func (m *_NotTransmittedCorruption) GetTypeName() string { + return "NotTransmittedCorruption" +} + +func (m *_NotTransmittedCorruption) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_NotTransmittedCorruption) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + return lengthInBits +} + +func (m *_NotTransmittedCorruption) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func NotTransmittedCorruptionParse(readBuffer utils.ReadBuffer) (NotTransmittedCorruption, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("NotTransmittedCorruption"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for NotTransmittedCorruption") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("NotTransmittedCorruption"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for NotTransmittedCorruption") + } + + // Create a partially initialized instance + _child := &_NotTransmittedCorruption{ + _Confirmation: &_Confirmation{}, + } + _child._Confirmation._ConfirmationChildRequirements = _child + return _child, nil +} + +func (m *_NotTransmittedCorruption) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("NotTransmittedCorruption"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for NotTransmittedCorruption") + } + + if popErr := writeBuffer.PopContext("NotTransmittedCorruption"); popErr != nil { + return errors.Wrap(popErr, "Error popping for NotTransmittedCorruption") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_NotTransmittedCorruption) isNotTransmittedCorruption() bool { + return true +} + +func (m *_NotTransmittedCorruption) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/NotTransmittedSyncLoss.go b/plc4go/protocols/cbus/readwrite/model/NotTransmittedSyncLoss.go new file mode 100755 index 00000000000..f52b59d7a24 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/NotTransmittedSyncLoss.go @@ -0,0 +1,158 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// NotTransmittedSyncLoss is the corresponding interface of NotTransmittedSyncLoss +type NotTransmittedSyncLoss interface { + utils.LengthAware + utils.Serializable + Confirmation +} + +// NotTransmittedSyncLossExactly can be used when we want exactly this type and not a type which fulfills NotTransmittedSyncLoss. +// This is useful for switch cases. +type NotTransmittedSyncLossExactly interface { + NotTransmittedSyncLoss + isNotTransmittedSyncLoss() bool +} + +// _NotTransmittedSyncLoss is the data-structure of this message +type _NotTransmittedSyncLoss struct { + *_Confirmation +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_NotTransmittedSyncLoss) GetConfirmationType() byte { + return 0x25 +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_NotTransmittedSyncLoss) InitializeParent(parent Confirmation, alpha Alpha) { + m.Alpha = alpha +} + +func (m *_NotTransmittedSyncLoss) GetParent() Confirmation { + return m._Confirmation +} + +// NewNotTransmittedSyncLoss factory function for _NotTransmittedSyncLoss +func NewNotTransmittedSyncLoss(alpha Alpha) *_NotTransmittedSyncLoss { + _result := &_NotTransmittedSyncLoss{ + _Confirmation: NewConfirmation(alpha), + } + _result._Confirmation._ConfirmationChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastNotTransmittedSyncLoss(structType interface{}) NotTransmittedSyncLoss { + if casted, ok := structType.(NotTransmittedSyncLoss); ok { + return casted + } + if casted, ok := structType.(*NotTransmittedSyncLoss); ok { + return *casted + } + return nil +} + +func (m *_NotTransmittedSyncLoss) GetTypeName() string { + return "NotTransmittedSyncLoss" +} + +func (m *_NotTransmittedSyncLoss) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_NotTransmittedSyncLoss) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + return lengthInBits +} + +func (m *_NotTransmittedSyncLoss) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func NotTransmittedSyncLossParse(readBuffer utils.ReadBuffer) (NotTransmittedSyncLoss, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("NotTransmittedSyncLoss"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for NotTransmittedSyncLoss") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("NotTransmittedSyncLoss"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for NotTransmittedSyncLoss") + } + + // Create a partially initialized instance + _child := &_NotTransmittedSyncLoss{ + _Confirmation: &_Confirmation{}, + } + _child._Confirmation._ConfirmationChildRequirements = _child + return _child, nil +} + +func (m *_NotTransmittedSyncLoss) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("NotTransmittedSyncLoss"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for NotTransmittedSyncLoss") + } + + if popErr := writeBuffer.PopContext("NotTransmittedSyncLoss"); popErr != nil { + return errors.Wrap(popErr, "Error popping for NotTransmittedSyncLoss") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_NotTransmittedSyncLoss) isNotTransmittedSyncLoss() bool { + return true +} + +func (m *_NotTransmittedSyncLoss) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/NotTransmittedToManyReTransmissions.go b/plc4go/protocols/cbus/readwrite/model/NotTransmittedToManyReTransmissions.go new file mode 100755 index 00000000000..264035ec6ae --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/NotTransmittedToManyReTransmissions.go @@ -0,0 +1,158 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// NotTransmittedToManyReTransmissions is the corresponding interface of NotTransmittedToManyReTransmissions +type NotTransmittedToManyReTransmissions interface { + utils.LengthAware + utils.Serializable + Confirmation +} + +// NotTransmittedToManyReTransmissionsExactly can be used when we want exactly this type and not a type which fulfills NotTransmittedToManyReTransmissions. +// This is useful for switch cases. +type NotTransmittedToManyReTransmissionsExactly interface { + NotTransmittedToManyReTransmissions + isNotTransmittedToManyReTransmissions() bool +} + +// _NotTransmittedToManyReTransmissions is the data-structure of this message +type _NotTransmittedToManyReTransmissions struct { + *_Confirmation +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_NotTransmittedToManyReTransmissions) GetConfirmationType() byte { + return 0x23 +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_NotTransmittedToManyReTransmissions) InitializeParent(parent Confirmation, alpha Alpha) { + m.Alpha = alpha +} + +func (m *_NotTransmittedToManyReTransmissions) GetParent() Confirmation { + return m._Confirmation +} + +// NewNotTransmittedToManyReTransmissions factory function for _NotTransmittedToManyReTransmissions +func NewNotTransmittedToManyReTransmissions(alpha Alpha) *_NotTransmittedToManyReTransmissions { + _result := &_NotTransmittedToManyReTransmissions{ + _Confirmation: NewConfirmation(alpha), + } + _result._Confirmation._ConfirmationChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastNotTransmittedToManyReTransmissions(structType interface{}) NotTransmittedToManyReTransmissions { + if casted, ok := structType.(NotTransmittedToManyReTransmissions); ok { + return casted + } + if casted, ok := structType.(*NotTransmittedToManyReTransmissions); ok { + return *casted + } + return nil +} + +func (m *_NotTransmittedToManyReTransmissions) GetTypeName() string { + return "NotTransmittedToManyReTransmissions" +} + +func (m *_NotTransmittedToManyReTransmissions) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_NotTransmittedToManyReTransmissions) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + return lengthInBits +} + +func (m *_NotTransmittedToManyReTransmissions) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func NotTransmittedToManyReTransmissionsParse(readBuffer utils.ReadBuffer) (NotTransmittedToManyReTransmissions, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("NotTransmittedToManyReTransmissions"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for NotTransmittedToManyReTransmissions") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("NotTransmittedToManyReTransmissions"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for NotTransmittedToManyReTransmissions") + } + + // Create a partially initialized instance + _child := &_NotTransmittedToManyReTransmissions{ + _Confirmation: &_Confirmation{}, + } + _child._Confirmation._ConfirmationChildRequirements = _child + return _child, nil +} + +func (m *_NotTransmittedToManyReTransmissions) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("NotTransmittedToManyReTransmissions"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for NotTransmittedToManyReTransmissions") + } + + if popErr := writeBuffer.PopContext("NotTransmittedToManyReTransmissions"); popErr != nil { + return errors.Wrap(popErr, "Error popping for NotTransmittedToManyReTransmissions") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_NotTransmittedToManyReTransmissions) isNotTransmittedToManyReTransmissions() bool { + return true +} + +func (m *_NotTransmittedToManyReTransmissions) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/NotTransmittedTooLong.go b/plc4go/protocols/cbus/readwrite/model/NotTransmittedTooLong.go new file mode 100755 index 00000000000..dca23711ce0 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/NotTransmittedTooLong.go @@ -0,0 +1,158 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// NotTransmittedTooLong is the corresponding interface of NotTransmittedTooLong +type NotTransmittedTooLong interface { + utils.LengthAware + utils.Serializable + Confirmation +} + +// NotTransmittedTooLongExactly can be used when we want exactly this type and not a type which fulfills NotTransmittedTooLong. +// This is useful for switch cases. +type NotTransmittedTooLongExactly interface { + NotTransmittedTooLong + isNotTransmittedTooLong() bool +} + +// _NotTransmittedTooLong is the data-structure of this message +type _NotTransmittedTooLong struct { + *_Confirmation +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_NotTransmittedTooLong) GetConfirmationType() byte { + return 0x27 +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_NotTransmittedTooLong) InitializeParent(parent Confirmation, alpha Alpha) { + m.Alpha = alpha +} + +func (m *_NotTransmittedTooLong) GetParent() Confirmation { + return m._Confirmation +} + +// NewNotTransmittedTooLong factory function for _NotTransmittedTooLong +func NewNotTransmittedTooLong(alpha Alpha) *_NotTransmittedTooLong { + _result := &_NotTransmittedTooLong{ + _Confirmation: NewConfirmation(alpha), + } + _result._Confirmation._ConfirmationChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastNotTransmittedTooLong(structType interface{}) NotTransmittedTooLong { + if casted, ok := structType.(NotTransmittedTooLong); ok { + return casted + } + if casted, ok := structType.(*NotTransmittedTooLong); ok { + return *casted + } + return nil +} + +func (m *_NotTransmittedTooLong) GetTypeName() string { + return "NotTransmittedTooLong" +} + +func (m *_NotTransmittedTooLong) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_NotTransmittedTooLong) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + return lengthInBits +} + +func (m *_NotTransmittedTooLong) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func NotTransmittedTooLongParse(readBuffer utils.ReadBuffer) (NotTransmittedTooLong, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("NotTransmittedTooLong"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for NotTransmittedTooLong") + } + currentPos := positionAware.GetPos() + _ = currentPos + + if closeErr := readBuffer.CloseContext("NotTransmittedTooLong"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for NotTransmittedTooLong") + } + + // Create a partially initialized instance + _child := &_NotTransmittedTooLong{ + _Confirmation: &_Confirmation{}, + } + _child._Confirmation._ConfirmationChildRequirements = _child + return _child, nil +} + +func (m *_NotTransmittedTooLong) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("NotTransmittedTooLong"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for NotTransmittedTooLong") + } + + if popErr := writeBuffer.PopContext("NotTransmittedTooLong"); popErr != nil { + return errors.Wrap(popErr, "Error popping for NotTransmittedTooLong") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_NotTransmittedTooLong) isNotTransmittedTooLong() bool { + return true +} + +func (m *_NotTransmittedTooLong) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/ParameterChange.go b/plc4go/protocols/cbus/readwrite/model/ParameterChange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go b/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/PowerUp.go b/plc4go/protocols/cbus/readwrite/model/PowerUp.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go b/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/PriorityClass.go b/plc4go/protocols/cbus/readwrite/model/PriorityClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/Reply.go b/plc4go/protocols/cbus/readwrite/model/Reply.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/ReplyNetwork.go b/plc4go/protocols/cbus/readwrite/model/ReplyNetwork.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/RouteType.go b/plc4go/protocols/cbus/readwrite/model/RouteType.go new file mode 100755 index 00000000000..2d108e87e08 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/RouteType.go @@ -0,0 +1,208 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// RouteType is an enum +type RouteType byte + +type IRouteType interface { + AdditionalBridges() uint8 + Serialize(writeBuffer utils.WriteBuffer) error +} + +const ( + RouteType_NoBridgeAtAll RouteType = 0x00 + RouteType_NoAdditionalBridge RouteType = 0x09 + RouteType_OneAdditionalBridge RouteType = 0x12 + RouteType_TwoAdditionalBridge RouteType = 0x1B + RouteType_ThreeAdditionalBridge RouteType = 0x24 + RouteType_FourAdditionalBridge RouteType = 0x2D + RouteType_FiveAdditionalBridge RouteType = 0x36 +) + +var RouteTypeValues []RouteType + +func init() { + _ = errors.New + RouteTypeValues = []RouteType{ + RouteType_NoBridgeAtAll, + RouteType_NoAdditionalBridge, + RouteType_OneAdditionalBridge, + RouteType_TwoAdditionalBridge, + RouteType_ThreeAdditionalBridge, + RouteType_FourAdditionalBridge, + RouteType_FiveAdditionalBridge, + } +} + +func (e RouteType) AdditionalBridges() uint8 { + switch e { + case 0x00: + { /* '0x00' */ + return 0 + } + case 0x09: + { /* '0x09' */ + return 0 + } + case 0x12: + { /* '0x12' */ + return 1 + } + case 0x1B: + { /* '0x1B' */ + return 2 + } + case 0x24: + { /* '0x24' */ + return 3 + } + case 0x2D: + { /* '0x2D' */ + return 4 + } + case 0x36: + { /* '0x36' */ + return 5 + } + default: + { + return 0 + } + } +} + +func RouteTypeFirstEnumForFieldAdditionalBridges(value uint8) (RouteType, error) { + for _, sizeValue := range RouteTypeValues { + if sizeValue.AdditionalBridges() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing AdditionalBridges not found", value) +} +func RouteTypeByValue(value byte) RouteType { + switch value { + case 0x00: + return RouteType_NoBridgeAtAll + case 0x09: + return RouteType_NoAdditionalBridge + case 0x12: + return RouteType_OneAdditionalBridge + case 0x1B: + return RouteType_TwoAdditionalBridge + case 0x24: + return RouteType_ThreeAdditionalBridge + case 0x2D: + return RouteType_FourAdditionalBridge + case 0x36: + return RouteType_FiveAdditionalBridge + } + return 0 +} + +func RouteTypeByName(value string) RouteType { + switch value { + case "NoBridgeAtAll": + return RouteType_NoBridgeAtAll + case "NoAdditionalBridge": + return RouteType_NoAdditionalBridge + case "OneAdditionalBridge": + return RouteType_OneAdditionalBridge + case "TwoAdditionalBridge": + return RouteType_TwoAdditionalBridge + case "ThreeAdditionalBridge": + return RouteType_ThreeAdditionalBridge + case "FourAdditionalBridge": + return RouteType_FourAdditionalBridge + case "FiveAdditionalBridge": + return RouteType_FiveAdditionalBridge + } + return 0 +} + +func RouteTypeKnows(value byte) bool { + for _, typeValue := range RouteTypeValues { + if byte(typeValue) == value { + return true + } + } + return false +} + +func CastRouteType(structType interface{}) RouteType { + castFunc := func(typ interface{}) RouteType { + if sRouteType, ok := typ.(RouteType); ok { + return sRouteType + } + return 0 + } + return castFunc(structType) +} + +func (m RouteType) GetLengthInBits() uint16 { + return 8 +} + +func (m RouteType) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func RouteTypeParse(readBuffer utils.ReadBuffer) (RouteType, error) { + val, err := readBuffer.ReadByte("RouteType") + if err != nil { + return 0, nil + } + return RouteTypeByValue(val), nil +} + +func (e RouteType) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteByte("RouteType", byte(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e RouteType) name() string { + switch e { + case RouteType_NoBridgeAtAll: + return "NoBridgeAtAll" + case RouteType_NoAdditionalBridge: + return "NoAdditionalBridge" + case RouteType_OneAdditionalBridge: + return "OneAdditionalBridge" + case RouteType_TwoAdditionalBridge: + return "TwoAdditionalBridge" + case RouteType_ThreeAdditionalBridge: + return "ThreeAdditionalBridge" + case RouteType_FourAdditionalBridge: + return "FourAdditionalBridge" + case RouteType_FiveAdditionalBridge: + return "FiveAdditionalBridge" + } + return "" +} + +func (e RouteType) String() string { + return e.name() +} diff --git a/plc4go/protocols/cbus/readwrite/model/SALCommandType.go b/plc4go/protocols/cbus/readwrite/model/SALCommandType.go new file mode 100755 index 00000000000..4bf09ae3be3 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/SALCommandType.go @@ -0,0 +1,138 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// SALCommandType is an enum +type SALCommandType uint8 + +type ISALCommandType interface { + Serialize(writeBuffer utils.WriteBuffer) error +} + +const ( + SALCommandType_OFF SALCommandType = 0x00 + SALCommandType_ON SALCommandType = 0x01 + SALCommandType_RAMP_TO_LEVEL SALCommandType = 0x02 + SALCommandType_TERMINATE_RAMP SALCommandType = 0x03 +) + +var SALCommandTypeValues []SALCommandType + +func init() { + _ = errors.New + SALCommandTypeValues = []SALCommandType{ + SALCommandType_OFF, + SALCommandType_ON, + SALCommandType_RAMP_TO_LEVEL, + SALCommandType_TERMINATE_RAMP, + } +} + +func SALCommandTypeByValue(value uint8) SALCommandType { + switch value { + case 0x00: + return SALCommandType_OFF + case 0x01: + return SALCommandType_ON + case 0x02: + return SALCommandType_RAMP_TO_LEVEL + case 0x03: + return SALCommandType_TERMINATE_RAMP + } + return 0 +} + +func SALCommandTypeByName(value string) SALCommandType { + switch value { + case "OFF": + return SALCommandType_OFF + case "ON": + return SALCommandType_ON + case "RAMP_TO_LEVEL": + return SALCommandType_RAMP_TO_LEVEL + case "TERMINATE_RAMP": + return SALCommandType_TERMINATE_RAMP + } + return 0 +} + +func SALCommandTypeKnows(value uint8) bool { + for _, typeValue := range SALCommandTypeValues { + if uint8(typeValue) == value { + return true + } + } + return false +} + +func CastSALCommandType(structType interface{}) SALCommandType { + castFunc := func(typ interface{}) SALCommandType { + if sSALCommandType, ok := typ.(SALCommandType); ok { + return sSALCommandType + } + return 0 + } + return castFunc(structType) +} + +func (m SALCommandType) GetLengthInBits() uint16 { + return 4 +} + +func (m SALCommandType) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func SALCommandTypeParse(readBuffer utils.ReadBuffer) (SALCommandType, error) { + val, err := readBuffer.ReadUint8("SALCommandType", 4) + if err != nil { + return 0, nil + } + return SALCommandTypeByValue(val), nil +} + +func (e SALCommandType) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteUint8("SALCommandType", 4, uint8(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e SALCommandType) name() string { + switch e { + case SALCommandType_OFF: + return "OFF" + case SALCommandType_ON: + return "ON" + case SALCommandType_RAMP_TO_LEVEL: + return "RAMP_TO_LEVEL" + case SALCommandType_TERMINATE_RAMP: + return "TERMINATE_RAMP" + } + return "" +} + +func (e SALCommandType) String() string { + return e.name() +} diff --git a/plc4go/protocols/cbus/readwrite/model/SALCommandTypeContainer.go b/plc4go/protocols/cbus/readwrite/model/SALCommandTypeContainer.go new file mode 100755 index 00000000000..e61a4b5fa34 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/SALCommandTypeContainer.go @@ -0,0 +1,352 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// SALCommandTypeContainer is an enum +type SALCommandTypeContainer uint8 + +type ISALCommandTypeContainer interface { + CommandType() SALCommandType + Serialize(writeBuffer utils.WriteBuffer) error +} + +const ( + SALCommandTypeContainer_SALCommandOff SALCommandTypeContainer = 0x01 + SALCommandTypeContainer_SALCommandOn SALCommandTypeContainer = 0x79 + SALCommandTypeContainer_SALCommandRampToLevel_Instantaneous SALCommandTypeContainer = 0x02 + SALCommandTypeContainer_SALCommandRampToLevel_4Second SALCommandTypeContainer = 0x0A + SALCommandTypeContainer_SALCommandRampToLevel_8Second SALCommandTypeContainer = 0x12 + SALCommandTypeContainer_SALCommandRampToLevel_12Second SALCommandTypeContainer = 0x1A + SALCommandTypeContainer_SALCommandRampToLevel_20Second SALCommandTypeContainer = 0x22 + SALCommandTypeContainer_SALCommandRampToLevel_30Second SALCommandTypeContainer = 0x2A + SALCommandTypeContainer_SALCommandRampToLevel_40Second SALCommandTypeContainer = 0x32 + SALCommandTypeContainer_SALCommandRampToLevel_60Second SALCommandTypeContainer = 0x3A + SALCommandTypeContainer_SALCommandRampToLevel_90Second SALCommandTypeContainer = 0x42 + SALCommandTypeContainer_SALCommandRampToLevel_120Second SALCommandTypeContainer = 0x4A + SALCommandTypeContainer_SALCommandRampToLevel_180Second SALCommandTypeContainer = 0x52 + SALCommandTypeContainer_SALCommandRampToLevel_300Second SALCommandTypeContainer = 0x5A + SALCommandTypeContainer_SALCommandRampToLevel_420Second SALCommandTypeContainer = 0x62 + SALCommandTypeContainer_SALCommandRampToLevel_600Second SALCommandTypeContainer = 0x6A + SALCommandTypeContainer_SALCommandRampToLevel_900Second SALCommandTypeContainer = 0x72 + SALCommandTypeContainer_SALCommandRampToLevel_1020Second SALCommandTypeContainer = 0x7A + SALCommandTypeContainer_SALCommandTerminateRamp SALCommandTypeContainer = 0x09 +) + +var SALCommandTypeContainerValues []SALCommandTypeContainer + +func init() { + _ = errors.New + SALCommandTypeContainerValues = []SALCommandTypeContainer{ + SALCommandTypeContainer_SALCommandOff, + SALCommandTypeContainer_SALCommandOn, + SALCommandTypeContainer_SALCommandRampToLevel_Instantaneous, + SALCommandTypeContainer_SALCommandRampToLevel_4Second, + SALCommandTypeContainer_SALCommandRampToLevel_8Second, + SALCommandTypeContainer_SALCommandRampToLevel_12Second, + SALCommandTypeContainer_SALCommandRampToLevel_20Second, + SALCommandTypeContainer_SALCommandRampToLevel_30Second, + SALCommandTypeContainer_SALCommandRampToLevel_40Second, + SALCommandTypeContainer_SALCommandRampToLevel_60Second, + SALCommandTypeContainer_SALCommandRampToLevel_90Second, + SALCommandTypeContainer_SALCommandRampToLevel_120Second, + SALCommandTypeContainer_SALCommandRampToLevel_180Second, + SALCommandTypeContainer_SALCommandRampToLevel_300Second, + SALCommandTypeContainer_SALCommandRampToLevel_420Second, + SALCommandTypeContainer_SALCommandRampToLevel_600Second, + SALCommandTypeContainer_SALCommandRampToLevel_900Second, + SALCommandTypeContainer_SALCommandRampToLevel_1020Second, + SALCommandTypeContainer_SALCommandTerminateRamp, + } +} + +func (e SALCommandTypeContainer) CommandType() SALCommandType { + switch e { + case 0x01: + { /* '0x01' */ + return SALCommandType_OFF + } + case 0x02: + { /* '0x02' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x09: + { /* '0x09' */ + return SALCommandType_TERMINATE_RAMP + } + case 0x0A: + { /* '0x0A' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x12: + { /* '0x12' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x1A: + { /* '0x1A' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x22: + { /* '0x22' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x2A: + { /* '0x2A' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x32: + { /* '0x32' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x3A: + { /* '0x3A' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x42: + { /* '0x42' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x4A: + { /* '0x4A' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x52: + { /* '0x52' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x5A: + { /* '0x5A' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x62: + { /* '0x62' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x6A: + { /* '0x6A' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x72: + { /* '0x72' */ + return SALCommandType_RAMP_TO_LEVEL + } + case 0x79: + { /* '0x79' */ + return SALCommandType_ON + } + case 0x7A: + { /* '0x7A' */ + return SALCommandType_RAMP_TO_LEVEL + } + default: + { + return 0 + } + } +} + +func SALCommandTypeContainerFirstEnumForFieldCommandType(value SALCommandType) (SALCommandTypeContainer, error) { + for _, sizeValue := range SALCommandTypeContainerValues { + if sizeValue.CommandType() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing CommandType not found", value) +} +func SALCommandTypeContainerByValue(value uint8) SALCommandTypeContainer { + switch value { + case 0x01: + return SALCommandTypeContainer_SALCommandOff + case 0x02: + return SALCommandTypeContainer_SALCommandRampToLevel_Instantaneous + case 0x09: + return SALCommandTypeContainer_SALCommandTerminateRamp + case 0x0A: + return SALCommandTypeContainer_SALCommandRampToLevel_4Second + case 0x12: + return SALCommandTypeContainer_SALCommandRampToLevel_8Second + case 0x1A: + return SALCommandTypeContainer_SALCommandRampToLevel_12Second + case 0x22: + return SALCommandTypeContainer_SALCommandRampToLevel_20Second + case 0x2A: + return SALCommandTypeContainer_SALCommandRampToLevel_30Second + case 0x32: + return SALCommandTypeContainer_SALCommandRampToLevel_40Second + case 0x3A: + return SALCommandTypeContainer_SALCommandRampToLevel_60Second + case 0x42: + return SALCommandTypeContainer_SALCommandRampToLevel_90Second + case 0x4A: + return SALCommandTypeContainer_SALCommandRampToLevel_120Second + case 0x52: + return SALCommandTypeContainer_SALCommandRampToLevel_180Second + case 0x5A: + return SALCommandTypeContainer_SALCommandRampToLevel_300Second + case 0x62: + return SALCommandTypeContainer_SALCommandRampToLevel_420Second + case 0x6A: + return SALCommandTypeContainer_SALCommandRampToLevel_600Second + case 0x72: + return SALCommandTypeContainer_SALCommandRampToLevel_900Second + case 0x79: + return SALCommandTypeContainer_SALCommandOn + case 0x7A: + return SALCommandTypeContainer_SALCommandRampToLevel_1020Second + } + return 0 +} + +func SALCommandTypeContainerByName(value string) SALCommandTypeContainer { + switch value { + case "SALCommandOff": + return SALCommandTypeContainer_SALCommandOff + case "SALCommandRampToLevel_Instantaneous": + return SALCommandTypeContainer_SALCommandRampToLevel_Instantaneous + case "SALCommandTerminateRamp": + return SALCommandTypeContainer_SALCommandTerminateRamp + case "SALCommandRampToLevel_4Second": + return SALCommandTypeContainer_SALCommandRampToLevel_4Second + case "SALCommandRampToLevel_8Second": + return SALCommandTypeContainer_SALCommandRampToLevel_8Second + case "SALCommandRampToLevel_12Second": + return SALCommandTypeContainer_SALCommandRampToLevel_12Second + case "SALCommandRampToLevel_20Second": + return SALCommandTypeContainer_SALCommandRampToLevel_20Second + case "SALCommandRampToLevel_30Second": + return SALCommandTypeContainer_SALCommandRampToLevel_30Second + case "SALCommandRampToLevel_40Second": + return SALCommandTypeContainer_SALCommandRampToLevel_40Second + case "SALCommandRampToLevel_60Second": + return SALCommandTypeContainer_SALCommandRampToLevel_60Second + case "SALCommandRampToLevel_90Second": + return SALCommandTypeContainer_SALCommandRampToLevel_90Second + case "SALCommandRampToLevel_120Second": + return SALCommandTypeContainer_SALCommandRampToLevel_120Second + case "SALCommandRampToLevel_180Second": + return SALCommandTypeContainer_SALCommandRampToLevel_180Second + case "SALCommandRampToLevel_300Second": + return SALCommandTypeContainer_SALCommandRampToLevel_300Second + case "SALCommandRampToLevel_420Second": + return SALCommandTypeContainer_SALCommandRampToLevel_420Second + case "SALCommandRampToLevel_600Second": + return SALCommandTypeContainer_SALCommandRampToLevel_600Second + case "SALCommandRampToLevel_900Second": + return SALCommandTypeContainer_SALCommandRampToLevel_900Second + case "SALCommandOn": + return SALCommandTypeContainer_SALCommandOn + case "SALCommandRampToLevel_1020Second": + return SALCommandTypeContainer_SALCommandRampToLevel_1020Second + } + return 0 +} + +func SALCommandTypeContainerKnows(value uint8) bool { + for _, typeValue := range SALCommandTypeContainerValues { + if uint8(typeValue) == value { + return true + } + } + return false +} + +func CastSALCommandTypeContainer(structType interface{}) SALCommandTypeContainer { + castFunc := func(typ interface{}) SALCommandTypeContainer { + if sSALCommandTypeContainer, ok := typ.(SALCommandTypeContainer); ok { + return sSALCommandTypeContainer + } + return 0 + } + return castFunc(structType) +} + +func (m SALCommandTypeContainer) GetLengthInBits() uint16 { + return 8 +} + +func (m SALCommandTypeContainer) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func SALCommandTypeContainerParse(readBuffer utils.ReadBuffer) (SALCommandTypeContainer, error) { + val, err := readBuffer.ReadUint8("SALCommandTypeContainer", 8) + if err != nil { + return 0, nil + } + return SALCommandTypeContainerByValue(val), nil +} + +func (e SALCommandTypeContainer) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteUint8("SALCommandTypeContainer", 8, uint8(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e SALCommandTypeContainer) name() string { + switch e { + case SALCommandTypeContainer_SALCommandOff: + return "SALCommandOff" + case SALCommandTypeContainer_SALCommandRampToLevel_Instantaneous: + return "SALCommandRampToLevel_Instantaneous" + case SALCommandTypeContainer_SALCommandTerminateRamp: + return "SALCommandTerminateRamp" + case SALCommandTypeContainer_SALCommandRampToLevel_4Second: + return "SALCommandRampToLevel_4Second" + case SALCommandTypeContainer_SALCommandRampToLevel_8Second: + return "SALCommandRampToLevel_8Second" + case SALCommandTypeContainer_SALCommandRampToLevel_12Second: + return "SALCommandRampToLevel_12Second" + case SALCommandTypeContainer_SALCommandRampToLevel_20Second: + return "SALCommandRampToLevel_20Second" + case SALCommandTypeContainer_SALCommandRampToLevel_30Second: + return "SALCommandRampToLevel_30Second" + case SALCommandTypeContainer_SALCommandRampToLevel_40Second: + return "SALCommandRampToLevel_40Second" + case SALCommandTypeContainer_SALCommandRampToLevel_60Second: + return "SALCommandRampToLevel_60Second" + case SALCommandTypeContainer_SALCommandRampToLevel_90Second: + return "SALCommandRampToLevel_90Second" + case SALCommandTypeContainer_SALCommandRampToLevel_120Second: + return "SALCommandRampToLevel_120Second" + case SALCommandTypeContainer_SALCommandRampToLevel_180Second: + return "SALCommandRampToLevel_180Second" + case SALCommandTypeContainer_SALCommandRampToLevel_300Second: + return "SALCommandRampToLevel_300Second" + case SALCommandTypeContainer_SALCommandRampToLevel_420Second: + return "SALCommandRampToLevel_420Second" + case SALCommandTypeContainer_SALCommandRampToLevel_600Second: + return "SALCommandRampToLevel_600Second" + case SALCommandTypeContainer_SALCommandRampToLevel_900Second: + return "SALCommandRampToLevel_900Second" + case SALCommandTypeContainer_SALCommandOn: + return "SALCommandOn" + case SALCommandTypeContainer_SALCommandRampToLevel_1020Second: + return "SALCommandRampToLevel_1020Second" + } + return "" +} + +func (e SALCommandTypeContainer) String() string { + return e.name() +} diff --git a/plc4go/protocols/cbus/readwrite/model/SALData.go b/plc4go/protocols/cbus/readwrite/model/SALData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/SALDataTerminateRamp.go b/plc4go/protocols/cbus/readwrite/model/SALDataTerminateRamp.go new file mode 100755 index 00000000000..36b56450da1 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/SALDataTerminateRamp.go @@ -0,0 +1,190 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// SALDataTerminateRamp is the corresponding interface of SALDataTerminateRamp +type SALDataTerminateRamp interface { + utils.LengthAware + utils.Serializable + SALData + // GetGroup returns Group (property field) + GetGroup() byte +} + +// SALDataTerminateRampExactly can be used when we want exactly this type and not a type which fulfills SALDataTerminateRamp. +// This is useful for switch cases. +type SALDataTerminateRampExactly interface { + SALDataTerminateRamp + isSALDataTerminateRamp() bool +} + +// _SALDataTerminateRamp is the data-structure of this message +type _SALDataTerminateRamp struct { + *_SALData + Group byte +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_SALDataTerminateRamp) InitializeParent(parent SALData, commandTypeContainer SALCommandTypeContainer) { + m.CommandTypeContainer = commandTypeContainer +} + +func (m *_SALDataTerminateRamp) GetParent() SALData { + return m._SALData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_SALDataTerminateRamp) GetGroup() byte { + return m.Group +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewSALDataTerminateRamp factory function for _SALDataTerminateRamp +func NewSALDataTerminateRamp(group byte, commandTypeContainer SALCommandTypeContainer) *_SALDataTerminateRamp { + _result := &_SALDataTerminateRamp{ + Group: group, + _SALData: NewSALData(commandTypeContainer), + } + _result._SALData._SALDataChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastSALDataTerminateRamp(structType interface{}) SALDataTerminateRamp { + if casted, ok := structType.(SALDataTerminateRamp); ok { + return casted + } + if casted, ok := structType.(*SALDataTerminateRamp); ok { + return *casted + } + return nil +} + +func (m *_SALDataTerminateRamp) GetTypeName() string { + return "SALDataTerminateRamp" +} + +func (m *_SALDataTerminateRamp) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_SALDataTerminateRamp) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (group) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_SALDataTerminateRamp) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func SALDataTerminateRampParse(readBuffer utils.ReadBuffer) (SALDataTerminateRamp, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("SALDataTerminateRamp"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for SALDataTerminateRamp") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (group) + _group, _groupErr := readBuffer.ReadByte("group") + if _groupErr != nil { + return nil, errors.Wrap(_groupErr, "Error parsing 'group' field") + } + group := _group + + if closeErr := readBuffer.CloseContext("SALDataTerminateRamp"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for SALDataTerminateRamp") + } + + // Create a partially initialized instance + _child := &_SALDataTerminateRamp{ + Group: group, + _SALData: &_SALData{}, + } + _child._SALData._SALDataChildRequirements = _child + return _child, nil +} + +func (m *_SALDataTerminateRamp) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("SALDataTerminateRamp"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for SALDataTerminateRamp") + } + + // Simple Field (group) + group := byte(m.GetGroup()) + _groupErr := writeBuffer.WriteByte("group", (group)) + if _groupErr != nil { + return errors.Wrap(_groupErr, "Error serializing 'group' field") + } + + if popErr := writeBuffer.PopContext("SALDataTerminateRamp"); popErr != nil { + return errors.Wrap(popErr, "Error popping for SALDataTerminateRamp") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_SALDataTerminateRamp) isSALDataTerminateRamp() bool { + return true +} + +func (m *_SALDataTerminateRamp) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/SerialInterfaceAddress.go b/plc4go/protocols/cbus/readwrite/model/SerialInterfaceAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReply.go b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReply.go new file mode 100755 index 00000000000..829bf40aec3 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReply.go @@ -0,0 +1,372 @@ +/* + * 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 model + +import ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// Constant values. +const StandardFormatStatusReply_CR byte = 0x0D +const StandardFormatStatusReply_LF byte = 0x0A + +// StandardFormatStatusReply is the corresponding interface of StandardFormatStatusReply +type StandardFormatStatusReply interface { + utils.LengthAware + utils.Serializable + // GetStatusHeader returns StatusHeader (property field) + GetStatusHeader() StatusHeader + // GetApplication returns Application (property field) + GetApplication() ApplicationIdContainer + // GetBlockStart returns BlockStart (property field) + GetBlockStart() uint8 + // GetStatusBytes returns StatusBytes (property field) + GetStatusBytes() []StatusByte + // GetCrc returns Crc (property field) + GetCrc() Checksum +} + +// StandardFormatStatusReplyExactly can be used when we want exactly this type and not a type which fulfills StandardFormatStatusReply. +// This is useful for switch cases. +type StandardFormatStatusReplyExactly interface { + StandardFormatStatusReply + isStandardFormatStatusReply() bool +} + +// _StandardFormatStatusReply is the data-structure of this message +type _StandardFormatStatusReply struct { + StatusHeader StatusHeader + Application ApplicationIdContainer + BlockStart uint8 + StatusBytes []StatusByte + Crc Checksum +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_StandardFormatStatusReply) GetStatusHeader() StatusHeader { + return m.StatusHeader +} + +func (m *_StandardFormatStatusReply) GetApplication() ApplicationIdContainer { + return m.Application +} + +func (m *_StandardFormatStatusReply) GetBlockStart() uint8 { + return m.BlockStart +} + +func (m *_StandardFormatStatusReply) GetStatusBytes() []StatusByte { + return m.StatusBytes +} + +func (m *_StandardFormatStatusReply) GetCrc() Checksum { + return m.Crc +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for const fields. +/////////////////////// + +func (m *_StandardFormatStatusReply) GetCr() byte { + return StandardFormatStatusReply_CR +} + +func (m *_StandardFormatStatusReply) GetLf() byte { + return StandardFormatStatusReply_LF +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewStandardFormatStatusReply factory function for _StandardFormatStatusReply +func NewStandardFormatStatusReply(statusHeader StatusHeader, application ApplicationIdContainer, blockStart uint8, statusBytes []StatusByte, crc Checksum) *_StandardFormatStatusReply { + return &_StandardFormatStatusReply{StatusHeader: statusHeader, Application: application, BlockStart: blockStart, StatusBytes: statusBytes, Crc: crc} +} + +// Deprecated: use the interface for direct cast +func CastStandardFormatStatusReply(structType interface{}) StandardFormatStatusReply { + if casted, ok := structType.(StandardFormatStatusReply); ok { + return casted + } + if casted, ok := structType.(*StandardFormatStatusReply); ok { + return *casted + } + return nil +} + +func (m *_StandardFormatStatusReply) GetTypeName() string { + return "StandardFormatStatusReply" +} + +func (m *_StandardFormatStatusReply) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_StandardFormatStatusReply) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (statusHeader) + lengthInBits += m.StatusHeader.GetLengthInBits() + + // Simple field (application) + lengthInBits += 8 + + // Simple field (blockStart) + lengthInBits += 8 + + // Array field + if len(m.StatusBytes) > 0 { + for i, element := range m.StatusBytes { + last := i == len(m.StatusBytes)-1 + lengthInBits += element.(interface{ GetLengthInBitsConditional(bool) uint16 }).GetLengthInBitsConditional(last) + } + } + + // Simple field (crc) + lengthInBits += m.Crc.GetLengthInBits() + + // Const Field (cr) + lengthInBits += 8 + + // Const Field (lf) + lengthInBits += 8 + + return lengthInBits +} + +func (m *_StandardFormatStatusReply) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func StandardFormatStatusReplyParse(readBuffer utils.ReadBuffer) (StandardFormatStatusReply, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("StandardFormatStatusReply"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for StandardFormatStatusReply") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (statusHeader) + if pullErr := readBuffer.PullContext("statusHeader"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for statusHeader") + } + _statusHeader, _statusHeaderErr := StatusHeaderParse(readBuffer) + if _statusHeaderErr != nil { + return nil, errors.Wrap(_statusHeaderErr, "Error parsing 'statusHeader' field") + } + statusHeader := _statusHeader.(StatusHeader) + if closeErr := readBuffer.CloseContext("statusHeader"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for statusHeader") + } + + // Simple Field (application) + if pullErr := readBuffer.PullContext("application"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for application") + } + _application, _applicationErr := ApplicationIdContainerParse(readBuffer) + if _applicationErr != nil { + return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field") + } + application := _application + if closeErr := readBuffer.CloseContext("application"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for application") + } + + // Simple Field (blockStart) + _blockStart, _blockStartErr := readBuffer.ReadUint8("blockStart", 8) + if _blockStartErr != nil { + return nil, errors.Wrap(_blockStartErr, "Error parsing 'blockStart' field") + } + blockStart := _blockStart + + // Array field (statusBytes) + if pullErr := readBuffer.PullContext("statusBytes", utils.WithRenderAsList(true)); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for statusBytes") + } + // Count array + statusBytes := make([]StatusByte, uint16(statusHeader.GetNumberOfCharacterPairs())-uint16(uint16(2))) + // This happens when the size is set conditional to 0 + if len(statusBytes) == 0 { + statusBytes = nil + } + { + for curItem := uint16(0); curItem < uint16(uint16(statusHeader.GetNumberOfCharacterPairs())-uint16(uint16(2))); curItem++ { + _item, _err := StatusByteParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'statusBytes' field") + } + statusBytes[curItem] = _item.(StatusByte) + } + } + if closeErr := readBuffer.CloseContext("statusBytes", utils.WithRenderAsList(true)); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for statusBytes") + } + + // Simple Field (crc) + if pullErr := readBuffer.PullContext("crc"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for crc") + } + _crc, _crcErr := ChecksumParse(readBuffer) + if _crcErr != nil { + return nil, errors.Wrap(_crcErr, "Error parsing 'crc' field") + } + crc := _crc.(Checksum) + if closeErr := readBuffer.CloseContext("crc"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for crc") + } + + // Const Field (cr) + cr, _crErr := readBuffer.ReadByte("cr") + if _crErr != nil { + return nil, errors.Wrap(_crErr, "Error parsing 'cr' field") + } + if cr != StandardFormatStatusReply_CR { + return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", StandardFormatStatusReply_CR) + " but got " + fmt.Sprintf("%d", cr)) + } + + // Const Field (lf) + lf, _lfErr := readBuffer.ReadByte("lf") + if _lfErr != nil { + return nil, errors.Wrap(_lfErr, "Error parsing 'lf' field") + } + if lf != StandardFormatStatusReply_LF { + return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", StandardFormatStatusReply_LF) + " but got " + fmt.Sprintf("%d", lf)) + } + + if closeErr := readBuffer.CloseContext("StandardFormatStatusReply"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for StandardFormatStatusReply") + } + + // Create the instance + return NewStandardFormatStatusReply(statusHeader, application, blockStart, statusBytes, crc), nil +} + +func (m *_StandardFormatStatusReply) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("StandardFormatStatusReply"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for StandardFormatStatusReply") + } + + // Simple Field (statusHeader) + if pushErr := writeBuffer.PushContext("statusHeader"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for statusHeader") + } + _statusHeaderErr := writeBuffer.WriteSerializable(m.GetStatusHeader()) + if popErr := writeBuffer.PopContext("statusHeader"); popErr != nil { + return errors.Wrap(popErr, "Error popping for statusHeader") + } + if _statusHeaderErr != nil { + return errors.Wrap(_statusHeaderErr, "Error serializing 'statusHeader' field") + } + + // Simple Field (application) + if pushErr := writeBuffer.PushContext("application"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for application") + } + _applicationErr := writeBuffer.WriteSerializable(m.GetApplication()) + if popErr := writeBuffer.PopContext("application"); popErr != nil { + return errors.Wrap(popErr, "Error popping for application") + } + if _applicationErr != nil { + return errors.Wrap(_applicationErr, "Error serializing 'application' field") + } + + // Simple Field (blockStart) + blockStart := uint8(m.GetBlockStart()) + _blockStartErr := writeBuffer.WriteUint8("blockStart", 8, (blockStart)) + if _blockStartErr != nil { + return errors.Wrap(_blockStartErr, "Error serializing 'blockStart' field") + } + + // Array Field (statusBytes) + if pushErr := writeBuffer.PushContext("statusBytes", utils.WithRenderAsList(true)); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for statusBytes") + } + for _, _element := range m.GetStatusBytes() { + _elementErr := writeBuffer.WriteSerializable(_element) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'statusBytes' field") + } + } + if popErr := writeBuffer.PopContext("statusBytes", utils.WithRenderAsList(true)); popErr != nil { + return errors.Wrap(popErr, "Error popping for statusBytes") + } + + // Simple Field (crc) + if pushErr := writeBuffer.PushContext("crc"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for crc") + } + _crcErr := writeBuffer.WriteSerializable(m.GetCrc()) + if popErr := writeBuffer.PopContext("crc"); popErr != nil { + return errors.Wrap(popErr, "Error popping for crc") + } + if _crcErr != nil { + return errors.Wrap(_crcErr, "Error serializing 'crc' field") + } + + // Const Field (cr) + _crErr := writeBuffer.WriteByte("cr", 0x0D) + if _crErr != nil { + return errors.Wrap(_crErr, "Error serializing 'cr' field") + } + + // Const Field (lf) + _lfErr := writeBuffer.WriteByte("lf", 0x0A) + if _lfErr != nil { + return errors.Wrap(_lfErr, "Error serializing 'lf' field") + } + + if popErr := writeBuffer.PopContext("StandardFormatStatusReply"); popErr != nil { + return errors.Wrap(popErr, "Error popping for StandardFormatStatusReply") + } + return nil +} + +func (m *_StandardFormatStatusReply) isStandardFormatStatusReply() bool { + return true +} + +func (m *_StandardFormatStatusReply) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/StatusByte.go b/plc4go/protocols/cbus/readwrite/model/StatusByte.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/StatusCoding.go b/plc4go/protocols/cbus/readwrite/model/StatusCoding.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/StatusHeader.go b/plc4go/protocols/cbus/readwrite/model/StatusHeader.go new file mode 100755 index 00000000000..122cfd261d3 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/StatusHeader.go @@ -0,0 +1,183 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + +// Code generated by code-generation. DO NOT EDIT. + +// StatusHeader is the corresponding interface of StatusHeader +type StatusHeader interface { + utils.LengthAware + utils.Serializable + // GetNumberOfCharacterPairs returns NumberOfCharacterPairs (property field) + GetNumberOfCharacterPairs() uint8 +} + +// StatusHeaderExactly can be used when we want exactly this type and not a type which fulfills StatusHeader. +// This is useful for switch cases. +type StatusHeaderExactly interface { + StatusHeader + isStatusHeader() bool +} + +// _StatusHeader is the data-structure of this message +type _StatusHeader struct { + NumberOfCharacterPairs uint8 +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_StatusHeader) GetNumberOfCharacterPairs() uint8 { + return m.NumberOfCharacterPairs +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewStatusHeader factory function for _StatusHeader +func NewStatusHeader(numberOfCharacterPairs uint8) *_StatusHeader { + return &_StatusHeader{NumberOfCharacterPairs: numberOfCharacterPairs} +} + +// Deprecated: use the interface for direct cast +func CastStatusHeader(structType interface{}) StatusHeader { + if casted, ok := structType.(StatusHeader); ok { + return casted + } + if casted, ok := structType.(*StatusHeader); ok { + return *casted + } + return nil +} + +func (m *_StatusHeader) GetTypeName() string { + return "StatusHeader" +} + +func (m *_StatusHeader) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_StatusHeader) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Reserved Field (reserved) + lengthInBits += 2 + + // Simple field (numberOfCharacterPairs) + lengthInBits += 6 + + return lengthInBits +} + +func (m *_StatusHeader) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func StatusHeaderParse(readBuffer utils.ReadBuffer) (StatusHeader, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("StatusHeader"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for StatusHeader") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 2) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x3) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x3), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (numberOfCharacterPairs) + _numberOfCharacterPairs, _numberOfCharacterPairsErr := readBuffer.ReadUint8("numberOfCharacterPairs", 6) + if _numberOfCharacterPairsErr != nil { + return nil, errors.Wrap(_numberOfCharacterPairsErr, "Error parsing 'numberOfCharacterPairs' field") + } + numberOfCharacterPairs := _numberOfCharacterPairs + + if closeErr := readBuffer.CloseContext("StatusHeader"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for StatusHeader") + } + + // Create the instance + return NewStatusHeader(numberOfCharacterPairs), nil +} + +func (m *_StatusHeader) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("StatusHeader"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for StatusHeader") + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 2, uint8(0x3)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (numberOfCharacterPairs) + numberOfCharacterPairs := uint8(m.GetNumberOfCharacterPairs()) + _numberOfCharacterPairsErr := writeBuffer.WriteUint8("numberOfCharacterPairs", 6, (numberOfCharacterPairs)) + if _numberOfCharacterPairsErr != nil { + return errors.Wrap(_numberOfCharacterPairsErr, "Error serializing 'numberOfCharacterPairs' field") + } + + if popErr := writeBuffer.PopContext("StatusHeader"); popErr != nil { + return errors.Wrap(popErr, "Error popping for StatusHeader") + } + return nil +} + +func (m *_StatusHeader) isStatusHeader() bool { + return true +} + +func (m *_StatusHeader) String() string { + if m == nil { + return "" + } + writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true) + if err := writeBuffer.WriteSerializable(m); err != nil { + return err.Error() + } + return writeBuffer.GetBox().String() +} diff --git a/plc4go/protocols/cbus/readwrite/model/StatusRequest.go b/plc4go/protocols/cbus/readwrite/model/StatusRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/StatusRequestBinaryState.go b/plc4go/protocols/cbus/readwrite/model/StatusRequestBinaryState.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/StatusRequestLevel.go b/plc4go/protocols/cbus/readwrite/model/StatusRequestLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/UnitAddress.go b/plc4go/protocols/cbus/readwrite/model/UnitAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/cbus/readwrite/model/UnitStatus.go b/plc4go/protocols/cbus/readwrite/model/UnitStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/ParserHelper.go b/plc4go/protocols/df1/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/XmlParserHelper.go b/plc4go/protocols/df1/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/DF1Command.go b/plc4go/protocols/df1/readwrite/model/DF1Command.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/DF1Symbol.go b/plc4go/protocols/df1/readwrite/model/DF1Symbol.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/DF1SymbolMessageFrame.go b/plc4go/protocols/df1/readwrite/model/DF1SymbolMessageFrame.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/DF1SymbolMessageFrameACK.go b/plc4go/protocols/df1/readwrite/model/DF1SymbolMessageFrameACK.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/DF1SymbolMessageFrameNAK.go b/plc4go/protocols/df1/readwrite/model/DF1SymbolMessageFrameNAK.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/DF1UnprotectedReadRequest.go b/plc4go/protocols/df1/readwrite/model/DF1UnprotectedReadRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/DF1UnprotectedReadResponse.go b/plc4go/protocols/df1/readwrite/model/DF1UnprotectedReadResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/StaticHelper.go b/plc4go/protocols/df1/readwrite/model/StaticHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/df1/readwrite/model/StaticHelper_test.go b/plc4go/protocols/df1/readwrite/model/StaticHelper_test.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/doc.go b/plc4go/protocols/doc.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/ParserHelper.go b/plc4go/protocols/eip/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/XmlParserHelper.go b/plc4go/protocols/eip/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CIPDataTypeCode.go b/plc4go/protocols/eip/readwrite/model/CIPDataTypeCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CIPStructTypeCode.go b/plc4go/protocols/eip/readwrite/model/CIPStructTypeCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipExchange.go b/plc4go/protocols/eip/readwrite/model/CipExchange.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipRRData.go b/plc4go/protocols/eip/readwrite/model/CipRRData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipReadRequest.go b/plc4go/protocols/eip/readwrite/model/CipReadRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipReadResponse.go b/plc4go/protocols/eip/readwrite/model/CipReadResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipService.go b/plc4go/protocols/eip/readwrite/model/CipService.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipUnconnectedRequest.go b/plc4go/protocols/eip/readwrite/model/CipUnconnectedRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipWriteRequest.go b/plc4go/protocols/eip/readwrite/model/CipWriteRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/CipWriteResponse.go b/plc4go/protocols/eip/readwrite/model/CipWriteResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/EiPCommand.go b/plc4go/protocols/eip/readwrite/model/EiPCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/EipConnectionRequest.go b/plc4go/protocols/eip/readwrite/model/EipConnectionRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/EipDisconnectRequest.go b/plc4go/protocols/eip/readwrite/model/EipDisconnectRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/EipPacket.go b/plc4go/protocols/eip/readwrite/model/EipPacket.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/MultipleServiceRequest.go b/plc4go/protocols/eip/readwrite/model/MultipleServiceRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/MultipleServiceResponse.go b/plc4go/protocols/eip/readwrite/model/MultipleServiceResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/eip/readwrite/model/Services.go b/plc4go/protocols/eip/readwrite/model/Services.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/ParserHelper.go b/plc4go/protocols/firmata/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/XmlParserHelper.go b/plc4go/protocols/firmata/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommand.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommandProtocolVersion.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommandProtocolVersion.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetDigitalPinValue.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetDigitalPinValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetPinMode.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetPinMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSysex.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSysex.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSystemReset.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSystemReset.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessage.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessageAnalogIO.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessageAnalogIO.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessageCommand.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessageCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessageDigitalIO.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessageDigitalIO.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeAnalogPinValue.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeAnalogPinValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeDigitalPinValue.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeDigitalPinValue.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/PinMode.go b/plc4go/protocols/firmata/readwrite/model/PinMode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/StaticHelper.go b/plc4go/protocols/firmata/readwrite/model/StaticHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommand.go b/plc4go/protocols/firmata/readwrite/model/SysexCommand.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandAnalogMappingQueryRequest.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandAnalogMappingQueryRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandAnalogMappingQueryResponse.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandAnalogMappingQueryResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandAnalogMappingResponse.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandAnalogMappingResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandCapabilityQuery.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandCapabilityQuery.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandCapabilityResponse.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandCapabilityResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandExtendedAnalog.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandExtendedAnalog.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandExtendedId.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandExtendedId.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandPinStateQuery.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandPinStateQuery.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandPinStateResponse.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandPinStateResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandReportFirmwareRequest.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandReportFirmwareRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandReportFirmwareResponse.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandReportFirmwareResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandSamplingInterval.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandSamplingInterval.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandStringData.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandStringData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandSysexNonRealtime.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandSysexNonRealtime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/firmata/readwrite/model/SysexCommandSysexRealtime.go b/plc4go/protocols/firmata/readwrite/model/SysexCommandSysexRealtime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/ParserHelper.go b/plc4go/protocols/knxnetip/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/XmlParserHelper.go b/plc4go/protocols/knxnetip/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/AccessLevel.go b/plc4go/protocols/knxnetip/readwrite/model/AccessLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/Apdu.go b/plc4go/protocols/knxnetip/readwrite/model/Apdu.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduControl.go b/plc4go/protocols/knxnetip/readwrite/model/ApduControl.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduControlAck.go b/plc4go/protocols/knxnetip/readwrite/model/ApduControlAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduControlConnect.go b/plc4go/protocols/knxnetip/readwrite/model/ApduControlConnect.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduControlContainer.go b/plc4go/protocols/knxnetip/readwrite/model/ApduControlContainer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduControlDisconnect.go b/plc4go/protocols/knxnetip/readwrite/model/ApduControlDisconnect.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduControlNack.go b/plc4go/protocols/knxnetip/readwrite/model/ApduControlNack.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduData.go b/plc4go/protocols/knxnetip/readwrite/model/ApduData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataAdcRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataAdcRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataAdcResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataAdcResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataContainer.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataContainer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataDeviceDescriptorRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataDeviceDescriptorRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataDeviceDescriptorResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataDeviceDescriptorResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExt.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExt.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtAuthorizeRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtAuthorizeRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtAuthorizeResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtAuthorizeResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSelectiveRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSelectiveRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtDomainAddressWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtFileStreamInfoReport.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtFileStreamInfoReport.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueInfoReport.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueInfoReport.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtKeyResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtKeyResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtKeyWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtKeyWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtLinkRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtLinkRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtLinkResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtLinkResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtLinkWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtLinkWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtMemoryBitWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtMemoryBitWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtNetworkParameterRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtNetworkParameterRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtNetworkParameterResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtNetworkParameterResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtNetworkParameterWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtNetworkParameterWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtOpenRoutingTableRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtOpenRoutingTableRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyValueRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyValueRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyValueResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyValueResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyValueWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyValueWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterStatusRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterStatusRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterStatusResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRouterStatusResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRoutingTableRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRoutingTableRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRoutingTableResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtReadRoutingTableResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtWriteRouterMemoryRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtWriteRouterMemoryRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtWriteRouterStatusRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtWriteRouterStatusRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtWriteRoutingTableRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtWriteRoutingTableRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataIndividualAddressRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataIndividualAddressRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataIndividualAddressResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataIndividualAddressResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataIndividualAddressWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataIndividualAddressWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataMemoryRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataMemoryRead.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataMemoryResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataMemoryResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataMemoryWrite.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataMemoryWrite.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataOther.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataOther.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataRestart.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataRestart.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataUserMessage.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataUserMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/CEMI.go b/plc4go/protocols/knxnetip/readwrite/model/CEMI.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/CEMIAdditionalInformation.go b/plc4go/protocols/knxnetip/readwrite/model/CEMIAdditionalInformation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/CEMIAdditionalInformationBusmonitorInfo.go b/plc4go/protocols/knxnetip/readwrite/model/CEMIAdditionalInformationBusmonitorInfo.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/CEMIAdditionalInformationRelativeTimestamp.go b/plc4go/protocols/knxnetip/readwrite/model/CEMIAdditionalInformationRelativeTimestamp.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/CEMIPriority.go b/plc4go/protocols/knxnetip/readwrite/model/CEMIPriority.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ChannelInformation.go b/plc4go/protocols/knxnetip/readwrite/model/ChannelInformation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ComObjectTable.go b/plc4go/protocols/knxnetip/readwrite/model/ComObjectTable.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableAddresses.go b/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableAddresses.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableRealisationType1.go b/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableRealisationType1.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableRealisationType2.go b/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableRealisationType2.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableRealisationType6.go b/plc4go/protocols/knxnetip/readwrite/model/ComObjectTableRealisationType6.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ComObjectValueType.go b/plc4go/protocols/knxnetip/readwrite/model/ComObjectValueType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformation.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationDeviceManagement.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationDeviceManagement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponseDataBlock.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponseDataBlock.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponseDataBlockDeviceManagement.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponseDataBlockDeviceManagement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponseDataBlockTunnelConnection.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionResponseDataBlockTunnelConnection.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DIBDeviceInfo.go b/plc4go/protocols/knxnetip/readwrite/model/DIBDeviceInfo.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DIBSuppSvcFamilies.go b/plc4go/protocols/knxnetip/readwrite/model/DIBSuppSvcFamilies.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DescriptionRequest.go b/plc4go/protocols/knxnetip/readwrite/model/DescriptionRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DescriptionResponse.go b/plc4go/protocols/knxnetip/readwrite/model/DescriptionResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationAck.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationAckDataBlock.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationAckDataBlock.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequest.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceDescriptor.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceDescriptor.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceDescriptorMediumType.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceDescriptorMediumType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceDescriptorType2.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceDescriptorType2.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceStatus.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceStatus.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DisconnectRequest.go b/plc4go/protocols/knxnetip/readwrite/model/DisconnectRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/DisconnectResponse.go b/plc4go/protocols/knxnetip/readwrite/model/DisconnectResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/FirmwareType.go b/plc4go/protocols/knxnetip/readwrite/model/FirmwareType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.go b/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType2.go b/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType2.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType6.go b/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType6.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType7.go b/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType7.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationTypeB.go b/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationTypeB.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/HPAIControlEndpoint.go b/plc4go/protocols/knxnetip/readwrite/model/HPAIControlEndpoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/HPAIDataEndpoint.go b/plc4go/protocols/knxnetip/readwrite/model/HPAIDataEndpoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/HPAIDiscoveryEndpoint.go b/plc4go/protocols/knxnetip/readwrite/model/HPAIDiscoveryEndpoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/HostProtocolCode.go b/plc4go/protocols/knxnetip/readwrite/model/HostProtocolCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/IPAddress.go b/plc4go/protocols/knxnetip/readwrite/model/IPAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxAddress.go b/plc4go/protocols/knxnetip/readwrite/model/KnxAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxDatapoint.go b/plc4go/protocols/knxnetip/readwrite/model/KnxDatapoint.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxDatapointMainType.go b/plc4go/protocols/knxnetip/readwrite/model/KnxDatapointMainType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxDatapointType.go b/plc4go/protocols/knxnetip/readwrite/model/KnxDatapointType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddress.go b/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddress2Level.go b/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddress2Level.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddress3Level.go b/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddress3Level.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddressFreeLevel.go b/plc4go/protocols/knxnetip/readwrite/model/KnxGroupAddressFreeLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxInterfaceObjectProperty.go b/plc4go/protocols/knxnetip/readwrite/model/KnxInterfaceObjectProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxInterfaceObjectType.go b/plc4go/protocols/knxnetip/readwrite/model/KnxInterfaceObjectType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxLayer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxLayer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxMedium.go b/plc4go/protocols/knxnetip/readwrite/model/KnxMedium.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpCore.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpCore.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpDeviceManagement.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpDeviceManagement.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpMessage.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpRouting.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpRouting.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpTunneling.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetIpTunneling.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetObjectServer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetObjectServer.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetRemoteConfigurationAndDiagnosis.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetRemoteConfigurationAndDiagnosis.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxNetRemoteLogging.go b/plc4go/protocols/knxnetip/readwrite/model/KnxNetRemoteLogging.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxProperty.go b/plc4go/protocols/knxnetip/readwrite/model/KnxProperty.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxPropertyDataType.go b/plc4go/protocols/knxnetip/readwrite/model/KnxPropertyDataType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LBusmonInd.go b/plc4go/protocols/knxnetip/readwrite/model/LBusmonInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LDataCon.go b/plc4go/protocols/knxnetip/readwrite/model/LDataCon.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LDataExtended.go b/plc4go/protocols/knxnetip/readwrite/model/LDataExtended.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LDataFrame.go b/plc4go/protocols/knxnetip/readwrite/model/LDataFrame.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LDataFrameACK.go b/plc4go/protocols/knxnetip/readwrite/model/LDataFrameACK.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LDataInd.go b/plc4go/protocols/knxnetip/readwrite/model/LDataInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LDataReq.go b/plc4go/protocols/knxnetip/readwrite/model/LDataReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LPollData.go b/plc4go/protocols/knxnetip/readwrite/model/LPollData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LPollDataCon.go b/plc4go/protocols/knxnetip/readwrite/model/LPollDataCon.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LPollDataReq.go b/plc4go/protocols/knxnetip/readwrite/model/LPollDataReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LRawCon.go b/plc4go/protocols/knxnetip/readwrite/model/LRawCon.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LRawInd.go b/plc4go/protocols/knxnetip/readwrite/model/LRawInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/LRawReq.go b/plc4go/protocols/knxnetip/readwrite/model/LRawReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MACAddress.go b/plc4go/protocols/knxnetip/readwrite/model/MACAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MFuncPropCommandReq.go b/plc4go/protocols/knxnetip/readwrite/model/MFuncPropCommandReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MFuncPropCon.go b/plc4go/protocols/knxnetip/readwrite/model/MFuncPropCon.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MFuncPropStateReadReq.go b/plc4go/protocols/knxnetip/readwrite/model/MFuncPropStateReadReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MPropInfoInd.go b/plc4go/protocols/knxnetip/readwrite/model/MPropInfoInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MPropReadCon.go b/plc4go/protocols/knxnetip/readwrite/model/MPropReadCon.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MPropReadReq.go b/plc4go/protocols/knxnetip/readwrite/model/MPropReadReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MPropWriteCon.go b/plc4go/protocols/knxnetip/readwrite/model/MPropWriteCon.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MPropWriteReq.go b/plc4go/protocols/knxnetip/readwrite/model/MPropWriteReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MResetInd.go b/plc4go/protocols/knxnetip/readwrite/model/MResetInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/MResetReq.go b/plc4go/protocols/knxnetip/readwrite/model/MResetReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ProjectInstallationIdentifier.go b/plc4go/protocols/knxnetip/readwrite/model/ProjectInstallationIdentifier.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/RelativeTimestamp.go b/plc4go/protocols/knxnetip/readwrite/model/RelativeTimestamp.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/RoutingIndication.go b/plc4go/protocols/knxnetip/readwrite/model/RoutingIndication.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/SearchRequest.go b/plc4go/protocols/knxnetip/readwrite/model/SearchRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/SearchResponse.go b/plc4go/protocols/knxnetip/readwrite/model/SearchResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/ServiceId.go b/plc4go/protocols/knxnetip/readwrite/model/ServiceId.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/Status.go b/plc4go/protocols/knxnetip/readwrite/model/Status.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/SupportedPhysicalMedia.go b/plc4go/protocols/knxnetip/readwrite/model/SupportedPhysicalMedia.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TDataConnectedInd.go b/plc4go/protocols/knxnetip/readwrite/model/TDataConnectedInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TDataConnectedReq.go b/plc4go/protocols/knxnetip/readwrite/model/TDataConnectedReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TDataIndividualInd.go b/plc4go/protocols/knxnetip/readwrite/model/TDataIndividualInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TDataIndividualReq.go b/plc4go/protocols/knxnetip/readwrite/model/TDataIndividualReq.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequest.go b/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequestDataBlock.go b/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequestDataBlock.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TunnelingResponse.go b/plc4go/protocols/knxnetip/readwrite/model/TunnelingResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/TunnelingResponseDataBlock.go b/plc4go/protocols/knxnetip/readwrite/model/TunnelingResponseDataBlock.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/knxnetip/readwrite/model/UnknownMessage.go b/plc4go/protocols/knxnetip/readwrite/model/UnknownMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/ParserHelper.go b/plc4go/protocols/modbus/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/XmlParserHelper.go b/plc4go/protocols/modbus/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/DataItem.go b/plc4go/protocols/modbus/readwrite/model/DataItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/DriverType.go b/plc4go/protocols/modbus/readwrite/model/DriverType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusADU.go b/plc4go/protocols/modbus/readwrite/model/ModbusADU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusAsciiADU.go b/plc4go/protocols/modbus/readwrite/model/ModbusAsciiADU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusConstants.go b/plc4go/protocols/modbus/readwrite/model/ModbusConstants.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusDataType.go b/plc4go/protocols/modbus/readwrite/model/ModbusDataType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationConformityLevel.go b/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationConformityLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationLevel.go b/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationLevel.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationMoreFollows.go b/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationMoreFollows.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationObject.go b/plc4go/protocols/modbus/readwrite/model/ModbusDeviceInformationObject.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusErrorCode.go b/plc4go/protocols/modbus/readwrite/model/ModbusErrorCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDU.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUDiagnosticRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUDiagnosticRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUDiagnosticResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUDiagnosticResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUError.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventCounterRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventCounterRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventCounterResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventCounterResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventLogRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventLogRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventLogResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUGetComEventLogResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUMaskWriteHoldingRegisterRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUMaskWriteHoldingRegisterRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUMaskWriteHoldingRegisterResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUMaskWriteHoldingRegisterResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadCoilsRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadCoilsRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadCoilsResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadCoilsResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDeviceIdentificationRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDeviceIdentificationRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDeviceIdentificationResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDeviceIdentificationResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDiscreteInputsRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDiscreteInputsRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDiscreteInputsResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadDiscreteInputsResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadExceptionStatusRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadExceptionStatusRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadExceptionStatusResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadExceptionStatusResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFifoQueueRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFifoQueueRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFifoQueueResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFifoQueueResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordRequestItem.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordRequestItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordResponseItem.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadFileRecordResponseItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadHoldingRegistersRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadHoldingRegistersRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadHoldingRegistersResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadHoldingRegistersResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadInputRegistersRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadInputRegistersRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadInputRegistersResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadInputRegistersResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadWriteMultipleHoldingRegistersRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadWriteMultipleHoldingRegistersRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadWriteMultipleHoldingRegistersResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReadWriteMultipleHoldingRegistersResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReportServerIdRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReportServerIdRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUReportServerIdResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUReportServerIdResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordRequestItem.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordRequestItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordResponseItem.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteFileRecordResponseItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleCoilsRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleCoilsRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleCoilsResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleCoilsResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleHoldingRegistersRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleHoldingRegistersRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleHoldingRegistersResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteMultipleHoldingRegistersResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleCoilRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleCoilRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleCoilResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleCoilResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleRegisterRequest.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleRegisterRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleRegisterResponse.go b/plc4go/protocols/modbus/readwrite/model/ModbusPDUWriteSingleRegisterResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusRtuADU.go b/plc4go/protocols/modbus/readwrite/model/ModbusRtuADU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/ModbusTcpADU.go b/plc4go/protocols/modbus/readwrite/model/ModbusTcpADU.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/modbus/readwrite/model/StaticHelper.go b/plc4go/protocols/modbus/readwrite/model/StaticHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/ParserHelper.go b/plc4go/protocols/s7/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/XmlParserHelper.go b/plc4go/protocols/s7/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageAckObjectPushType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageAckObjectPushType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageAckPushType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageAckPushType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageAckResponseType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageAckResponseType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageAckType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageAckType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectAckType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectAckType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectPushType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectPushType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectQueryType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectQueryType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessagePushType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessagePushType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageQueryType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageQueryType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmStateType.go b/plc4go/protocols/s7/readwrite/model/AlarmStateType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AlarmType.go b/plc4go/protocols/s7/readwrite/model/AlarmType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/AssociatedValueType.go b/plc4go/protocols/s7/readwrite/model/AssociatedValueType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacket.go b/plc4go/protocols/s7/readwrite/model/COTPPacket.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacketConnectionRequest.go b/plc4go/protocols/s7/readwrite/model/COTPPacketConnectionRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacketConnectionResponse.go b/plc4go/protocols/s7/readwrite/model/COTPPacketConnectionResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacketData.go b/plc4go/protocols/s7/readwrite/model/COTPPacketData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacketDisconnectRequest.go b/plc4go/protocols/s7/readwrite/model/COTPPacketDisconnectRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacketDisconnectResponse.go b/plc4go/protocols/s7/readwrite/model/COTPPacketDisconnectResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacketTpduError.go b/plc4go/protocols/s7/readwrite/model/COTPPacketTpduError.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPParameter.go b/plc4go/protocols/s7/readwrite/model/COTPParameter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPParameterCalledTsap.go b/plc4go/protocols/s7/readwrite/model/COTPParameterCalledTsap.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPParameterCallingTsap.go b/plc4go/protocols/s7/readwrite/model/COTPParameterCallingTsap.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPParameterChecksum.go b/plc4go/protocols/s7/readwrite/model/COTPParameterChecksum.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPParameterDisconnectAdditionalInformation.go b/plc4go/protocols/s7/readwrite/model/COTPParameterDisconnectAdditionalInformation.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPParameterTpduSize.go b/plc4go/protocols/s7/readwrite/model/COTPParameterTpduSize.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPProtocolClass.go b/plc4go/protocols/s7/readwrite/model/COTPProtocolClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/COTPTpduSize.go b/plc4go/protocols/s7/readwrite/model/COTPTpduSize.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/CpuSubscribeEvents.go b/plc4go/protocols/s7/readwrite/model/CpuSubscribeEvents.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/DataItem.go b/plc4go/protocols/s7/readwrite/model/DataItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/DataTransportErrorCode.go b/plc4go/protocols/s7/readwrite/model/DataTransportErrorCode.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/DataTransportSize.go b/plc4go/protocols/s7/readwrite/model/DataTransportSize.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/DateAndTime.go b/plc4go/protocols/s7/readwrite/model/DateAndTime.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/DeviceGroup.go b/plc4go/protocols/s7/readwrite/model/DeviceGroup.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/EventType.go b/plc4go/protocols/s7/readwrite/model/EventType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/MemoryArea.go b/plc4go/protocols/s7/readwrite/model/MemoryArea.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/ModeTransitionType.go b/plc4go/protocols/s7/readwrite/model/ModeTransitionType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/QueryType.go b/plc4go/protocols/s7/readwrite/model/QueryType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7Address.go b/plc4go/protocols/s7/readwrite/model/S7Address.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7AddressAny.go b/plc4go/protocols/s7/readwrite/model/S7AddressAny.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7DataAlarmMessage.go b/plc4go/protocols/s7/readwrite/model/S7DataAlarmMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7Message.go b/plc4go/protocols/s7/readwrite/model/S7Message.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageObjectRequest.go b/plc4go/protocols/s7/readwrite/model/S7MessageObjectRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageObjectResponse.go b/plc4go/protocols/s7/readwrite/model/S7MessageObjectResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageRequest.go b/plc4go/protocols/s7/readwrite/model/S7MessageRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageResponse.go b/plc4go/protocols/s7/readwrite/model/S7MessageResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageResponseData.go b/plc4go/protocols/s7/readwrite/model/S7MessageResponseData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageUserData.go b/plc4go/protocols/s7/readwrite/model/S7MessageUserData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7Parameter.go b/plc4go/protocols/s7/readwrite/model/S7Parameter.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterModeTransition.go b/plc4go/protocols/s7/readwrite/model/S7ParameterModeTransition.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterReadVarRequest.go b/plc4go/protocols/s7/readwrite/model/S7ParameterReadVarRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterReadVarResponse.go b/plc4go/protocols/s7/readwrite/model/S7ParameterReadVarResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterSetupCommunication.go b/plc4go/protocols/s7/readwrite/model/S7ParameterSetupCommunication.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterUserData.go b/plc4go/protocols/s7/readwrite/model/S7ParameterUserData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterUserDataItem.go b/plc4go/protocols/s7/readwrite/model/S7ParameterUserDataItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterUserDataItemCPUFunctions.go b/plc4go/protocols/s7/readwrite/model/S7ParameterUserDataItemCPUFunctions.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterWriteVarRequest.go b/plc4go/protocols/s7/readwrite/model/S7ParameterWriteVarRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterWriteVarResponse.go b/plc4go/protocols/s7/readwrite/model/S7ParameterWriteVarResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7Payload.go b/plc4go/protocols/s7/readwrite/model/S7Payload.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadAlarm8.go b/plc4go/protocols/s7/readwrite/model/S7PayloadAlarm8.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmAckInd.go b/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmAckInd.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmS.go b/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmS.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmSC.go b/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmSC.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmSQ.go b/plc4go/protocols/s7/readwrite/model/S7PayloadAlarmSQ.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadDiagnosticMessage.go b/plc4go/protocols/s7/readwrite/model/S7PayloadDiagnosticMessage.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadNotify.go b/plc4go/protocols/s7/readwrite/model/S7PayloadNotify.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadNotify8.go b/plc4go/protocols/s7/readwrite/model/S7PayloadNotify8.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadReadVarResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadReadVarResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserData.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserData.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItem.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmAck.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmAck.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmAckResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmAckResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQuery.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQuery.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQueryResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQueryResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscription.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscription.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscriptionAlarmResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscriptionAlarmResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscriptionResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscriptionResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscriptionSysResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscriptionSysResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionReadSzlRequest.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionReadSzlRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionReadSzlResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionReadSzlResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadWriteVarRequest.go b/plc4go/protocols/s7/readwrite/model/S7PayloadWriteVarRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadWriteVarResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadWriteVarResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7VarPayloadDataItem.go b/plc4go/protocols/s7/readwrite/model/S7VarPayloadDataItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7VarPayloadStatusItem.go b/plc4go/protocols/s7/readwrite/model/S7VarPayloadStatusItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7VarRequestParameterItem.go b/plc4go/protocols/s7/readwrite/model/S7VarRequestParameterItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/S7VarRequestParameterItemAddress.go b/plc4go/protocols/s7/readwrite/model/S7VarRequestParameterItemAddress.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/State.go b/plc4go/protocols/s7/readwrite/model/State.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/StaticHelper.go b/plc4go/protocols/s7/readwrite/model/StaticHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/SyntaxIdType.go b/plc4go/protocols/s7/readwrite/model/SyntaxIdType.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/SzlDataTreeItem.go b/plc4go/protocols/s7/readwrite/model/SzlDataTreeItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/SzlId.go b/plc4go/protocols/s7/readwrite/model/SzlId.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/SzlModuleTypeClass.go b/plc4go/protocols/s7/readwrite/model/SzlModuleTypeClass.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/SzlSublist.go b/plc4go/protocols/s7/readwrite/model/SzlSublist.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/TPKTPacket.go b/plc4go/protocols/s7/readwrite/model/TPKTPacket.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/s7/readwrite/model/TransportSize.go b/plc4go/protocols/s7/readwrite/model/TransportSize.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/simulated/readwrite/ParserHelper.go b/plc4go/protocols/simulated/readwrite/ParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/simulated/readwrite/XmlParserHelper.go b/plc4go/protocols/simulated/readwrite/XmlParserHelper.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/simulated/readwrite/model/DataItem.go b/plc4go/protocols/simulated/readwrite/model/DataItem.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/simulated/readwrite/model/Dummy.go b/plc4go/protocols/simulated/readwrite/model/Dummy.go old mode 100644 new mode 100755 diff --git a/plc4go/protocols/simulated/readwrite/model/SimulatedDataTypeSizes.go b/plc4go/protocols/simulated/readwrite/model/SimulatedDataTypeSizes.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/HandlerExposer.go b/plc4go/spi/HandlerExposer.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/Message.go b/plc4go/spi/Message.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/MessageCodec.go b/plc4go/spi/MessageCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcBrowser.go b/plc4go/spi/PlcBrowser.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcConnection.go b/plc4go/spi/PlcConnection.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcDiscoverer.go b/plc4go/spi/PlcDiscoverer.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcReader.go b/plc4go/spi/PlcReader.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcSubscriber.go b/plc4go/spi/PlcSubscriber.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcTagHandler.go b/plc4go/spi/PlcTagHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcValueHandler.go b/plc4go/spi/PlcValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/PlcWriter.go b/plc4go/spi/PlcWriter.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/RequestTransactionManager.go b/plc4go/spi/RequestTransactionManager.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/Tracer.go b/plc4go/spi/Tracer.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/TransportAware.go b/plc4go/spi/TransportAware.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/TransportInstanceExposer.go b/plc4go/spi/TransportInstanceExposer.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/default/DefaultCodec.go b/plc4go/spi/default/DefaultCodec.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/default/DefaultConnection.go b/plc4go/spi/default/DefaultConnection.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/default/DefaultDriver.go b/plc4go/spi/default/DefaultDriver.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/default/doc.go b/plc4go/spi/default/doc.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/interceptors/RequestInterceptor.go b/plc4go/spi/interceptors/RequestInterceptor.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/interceptors/SingleItemRequestInterceptor.go b/plc4go/spi/interceptors/SingleItemRequestInterceptor.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultArrayInfo.go b/plc4go/spi/model/DefaultArrayInfo.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcBrowseEvent.go b/plc4go/spi/model/DefaultPlcBrowseEvent.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcBrowseRequestResult.go b/plc4go/spi/model/DefaultPlcBrowseRequestResult.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcDiscoveryItem.go b/plc4go/spi/model/DefaultPlcDiscoveryItem.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcReadRequestResult.go b/plc4go/spi/model/DefaultPlcReadRequestResult.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcSubscriptionRequestResult.go b/plc4go/spi/model/DefaultPlcSubscriptionRequestResult.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcUnsubscriptionRequest.go b/plc4go/spi/model/DefaultPlcUnsubscriptionRequest.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcUnsubscriptionRequestResult.go b/plc4go/spi/model/DefaultPlcUnsubscriptionRequestResult.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcUnsubscriptionResponse.go b/plc4go/spi/model/DefaultPlcUnsubscriptionResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcWriteRequestResult.go b/plc4go/spi/model/DefaultPlcWriteRequestResult.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultPlcWriteResponse.go b/plc4go/spi/model/DefaultPlcWriteResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/model/DefaultResponse.go b/plc4go/spi/model/DefaultResponse.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/options/DiscoveryOption.go b/plc4go/spi/options/DiscoveryOption.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/options/Option.go b/plc4go/spi/options/Option.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/plcerrors/TimeoutError.go b/plc4go/spi/plcerrors/TimeoutError.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/testutils/DriverTestRunner.go b/plc4go/spi/testutils/DriverTestRunner.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/testutils/ManualTestRunner.go b/plc4go/spi/testutils/ManualTestRunner.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/testutils/ParserSerializerTestRunner.go b/plc4go/spi/testutils/ParserSerializerTestRunner.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/testutils/TestUtils.go b/plc4go/spi/testutils/TestUtils.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/testutils/steptype_string.go b/plc4go/spi/testutils/steptype_string.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/transports/Transport.go b/plc4go/spi/transports/Transport.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/transports/pcap/Transport.go b/plc4go/spi/transports/pcap/Transport.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/transports/serial/Transport.go b/plc4go/spi/transports/serial/Transport.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/transports/tcp/Transport.go b/plc4go/spi/transports/tcp/Transport.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/transports/test/Transport.go b/plc4go/spi/transports/test/Transport.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/transports/udp/Transport.go b/plc4go/spi/transports/udp/Transport.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/transports/utils/TransportLogger.go b/plc4go/spi/transports/utils/TransportLogger.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/Buffer.go b/plc4go/spi/utils/Buffer.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/CastUtils.go b/plc4go/spi/utils/CastUtils.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/Errors.go b/plc4go/spi/utils/Errors.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/IdGenerator.go b/plc4go/spi/utils/IdGenerator.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/LengthAware.go b/plc4go/spi/utils/LengthAware.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/Misc.go b/plc4go/spi/utils/Misc.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/PositionAware.go b/plc4go/spi/utils/PositionAware.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/ReadBuffer.go b/plc4go/spi/utils/ReadBuffer.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/ReadBufferByteBased.go b/plc4go/spi/utils/ReadBufferByteBased.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/ReadBufferByteBased_test.go b/plc4go/spi/utils/ReadBufferByteBased_test.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/ReadBufferJsonBased.go b/plc4go/spi/utils/ReadBufferJsonBased.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/ReadBufferXmlBased.go b/plc4go/spi/utils/ReadBufferXmlBased.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/Regexp.go b/plc4go/spi/utils/Regexp.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/Serializable.go b/plc4go/spi/utils/Serializable.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/WriteBuffer.go b/plc4go/spi/utils/WriteBuffer.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/WriteBufferBoxBased.go b/plc4go/spi/utils/WriteBufferBoxBased.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/WriteBufferByteBased.go b/plc4go/spi/utils/WriteBufferByteBased.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/WriteBufferJsonBased.go b/plc4go/spi/utils/WriteBufferJsonBased.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/WriteBufferXmlBased.go b/plc4go/spi/utils/WriteBufferXmlBased.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/asciiBox.go b/plc4go/spi/utils/asciiBox.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/asciiBox_test.go b/plc4go/spi/utils/asciiBox_test.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/bufferCommons.go b/plc4go/spi/utils/bufferCommons.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/dumpUtils.go b/plc4go/spi/utils/dumpUtils.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/dumpUtils_test.go b/plc4go/spi/utils/dumpUtils_test.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/hex.go b/plc4go/spi/utils/hex.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/utils/hex_test.go b/plc4go/spi/utils/hex_test.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcBOOL.go b/plc4go/spi/values/PlcBOOL.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcBYTE.go b/plc4go/spi/values/PlcBYTE.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcCHAR.go b/plc4go/spi/values/PlcCHAR.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcDATE.go b/plc4go/spi/values/PlcDATE.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcDINT.go b/plc4go/spi/values/PlcDINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcDWORD.go b/plc4go/spi/values/PlcDWORD.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcINT.go b/plc4go/spi/values/PlcINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcLINT.go b/plc4go/spi/values/PlcLINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcLREAL.go b/plc4go/spi/values/PlcLREAL.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcLTIME.go b/plc4go/spi/values/PlcLTIME.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcLWORD.go b/plc4go/spi/values/PlcLWORD.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcREAL.go b/plc4go/spi/values/PlcREAL.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcRawByteArray.go b/plc4go/spi/values/PlcRawByteArray.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcSINT.go b/plc4go/spi/values/PlcSINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcSTRING.go b/plc4go/spi/values/PlcSTRING.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcStruct.go b/plc4go/spi/values/PlcStruct.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcTIME.go b/plc4go/spi/values/PlcTIME.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcTIME_OF_DAY.go b/plc4go/spi/values/PlcTIME_OF_DAY.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcUDINT.go b/plc4go/spi/values/PlcUDINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcUINT.go b/plc4go/spi/values/PlcUINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcULINT.go b/plc4go/spi/values/PlcULINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcUSINT.go b/plc4go/spi/values/PlcUSINT.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcValueAdapter.go b/plc4go/spi/values/PlcValueAdapter.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcValueHandler.go b/plc4go/spi/values/PlcValueHandler.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcWCHAR.go b/plc4go/spi/values/PlcWCHAR.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcWORD.go b/plc4go/spi/values/PlcWORD.go old mode 100644 new mode 100755 diff --git a/plc4go/spi/values/PlcWSTRING.go b/plc4go/spi/values/PlcWSTRING.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/abeth_driver_test.go b/plc4go/tests/drivers/tests/abeth_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/abeth_parser_serializer_test.go b/plc4go/tests/drivers/tests/abeth_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/ads_driver_test.go b/plc4go/tests/drivers/tests/ads_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/ads_parser_serializer_test.go b/plc4go/tests/drivers/tests/ads_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/bacnet_parser_serializer_test.go b/plc4go/tests/drivers/tests/bacnet_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/df1_driver_test.go b/plc4go/tests/drivers/tests/df1_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/df1_parser_serializer_test.go b/plc4go/tests/drivers/tests/df1_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/eip_driver_test.go b/plc4go/tests/drivers/tests/eip_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/eip_parser_serializer_test.go b/plc4go/tests/drivers/tests/eip_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/firmata_driver_test.go b/plc4go/tests/drivers/tests/firmata_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/firmata_parser_serializer_test.go b/plc4go/tests/drivers/tests/firmata_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/knxnetip_driver_test.go b/plc4go/tests/drivers/tests/knxnetip_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/knxnetip_parser_serializer_test.go b/plc4go/tests/drivers/tests/knxnetip_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/manual_ads_driver_test.go b/plc4go/tests/drivers/tests/manual_ads_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/manual_bacnet_PcapTest_test.go b/plc4go/tests/drivers/tests/manual_bacnet_PcapTest_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/manual_bacnet_test.go b/plc4go/tests/drivers/tests/manual_bacnet_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/manual_s7_driver_test.go b/plc4go/tests/drivers/tests/manual_s7_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/modbus_driver_test.go b/plc4go/tests/drivers/tests/modbus_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/modbus_parser_serializer_test.go b/plc4go/tests/drivers/tests/modbus_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/s7_driver_test.go b/plc4go/tests/drivers/tests/s7_driver_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/drivers/tests/s7_parser_serializer_test.go b/plc4go/tests/drivers/tests/s7_parser_serializer_test.go old mode 100644 new mode 100755 diff --git a/plc4go/tests/initializetest/init.go b/plc4go/tests/initializetest/init.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xbrowser/main.go b/plc4go/tools/plc4xbrowser/main.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go b/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/cmd/root.go b/plc4go/tools/plc4xpcapanalyzer/cmd/root.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/config/AnalyzeConfig.go b/plc4go/tools/plc4xpcapanalyzer/config/AnalyzeConfig.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/config/PcapConfig.go b/plc4go/tools/plc4xpcapanalyzer/config/PcapConfig.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/config/RootConfig.go b/plc4go/tools/plc4xpcapanalyzer/config/RootConfig.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/bacnetanalyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/bacnetanalyzer/analyzer.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/pcaphandler/pcaphandler.go b/plc4go/tools/plc4xpcapanalyzer/internal/pcaphandler/pcaphandler.go old mode 100644 new mode 100755 diff --git a/plc4go/tools/plc4xpcapanalyzer/main.go b/plc4go/tools/plc4xpcapanalyzer/main.go old mode 100644 new mode 100755 diff --git a/plc4go/utils/exposedUtils.go b/plc4go/utils/exposedUtils.go new file mode 100755 index 00000000000..edfb6c9cd82 --- /dev/null +++ b/plc4go/utils/exposedUtils.go @@ -0,0 +1,66 @@ +/* + * 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 utils + +import ( + "bytes" + "encoding/binary" + "github.com/apache/plc4x/plc4go/internal/spi/utils" +) + +// Serializable indicates that something is serializable +type Serializable interface { + utils.Serializable +} + +// ReadBufferByteBased is a byte based read buffer +type ReadBufferByteBased interface { + utils.ReadBufferByteBased +} + +// NewReadBufferByteBased creates a byte based read buffer +func NewReadBufferByteBased(data []byte) ReadBufferByteBased { + return utils.NewReadBufferByteBased(data) +} + +// NewLittleEndianReadBufferByteBased creates a little endian byte based read buffer +func NewLittleEndianReadBufferByteBased(data []byte) ReadBufferByteBased { + return utils.NewLittleEndianReadBufferByteBased(data) +} + +// WriteBufferByteBased is a byte based write buffer +type WriteBufferByteBased interface { + utils.WriteBufferByteBased +} + +// NewWriteBufferByteBased creates a byte based write buffer +func NewWriteBufferByteBased() WriteBufferByteBased { + return utils.NewWriteBufferByteBased() +} + +// NewLittleEndianWriteBufferByteBased creates a little endian byte write read buffer +func NewLittleEndianWriteBufferByteBased() WriteBufferByteBased { + return utils.NewLittleEndianWriteBufferByteBased() +} + +// NewCustomWriteBufferByteBased creates a byte base write buffer with a custom underlying bytes.Buffer +func NewCustomWriteBufferByteBased(buffer *bytes.Buffer, byteOrder binary.ByteOrder) WriteBufferByteBased { + return utils.NewCustomWriteBufferByteBased(buffer, byteOrder) +} 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 1c53db9310d..855ecba5d35 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 @@ -1230,7 +1230,7 @@ public enum BACnetVendorId { (int) 1069, (int) 1069, (String) "Building Automation Products, Inc."), ASSET_MAPPING((int) 1070, (int) 1070, (String) "Asset Mapping"), SMARTEH_COMPANY((int) 1071, (int) 1071, (String) "Smarteh Company"), - DATAPOD_AUSTRALIA_PTY_LTD((int) 1072, (int) 1072, (String) "Datapod Australia Pty Ltd."), + DATAPOD_AUSTRALIA_PTY_LTD((int) 1072, (int) 1072, (String) "Datapod (Australia) Pty Ltd."), BUILDINGS_ALIVE_PTY_LTD((int) 1073, (int) 1073, (String) "Buildings Alive Pty Ltd"), DIGITAL_ELEKTRONIK((int) 1074, (int) 1074, (String) "Digital Elektronik"), TALENT_AUTOMAOE_TECNOLOGIA_LTDA( @@ -1603,6 +1603,7 @@ public enum BACnetVendorId { (int) 1392, (int) 1392, (String) "AKVO Atmospheric Water Systems Pvt. Ltd."), EM_FIRST_CO_LTD((int) 1393, (int) 1393, (String) "EmFirst Co. Ltd."), IION_SYSTEMS_APS((int) 1394, (int) 1394, (String) "Iion Systems ApS"), + SAF_TEHNIKAJSC((int) 1396, (int) 1396, (String) "SAF Tehnika JSC"), UNKNOWN_VENDOR((int) 0xFFFF, (int) 0xFFFF, (String) "Unknown"); private static final Map map; 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 769d37c9e64..6d96ae3f37c 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 @@ -684,24 +684,23 @@ public enum KnxManufacturer { M_ZHEJIANG_MOORGEN_INTELLIGENT_TECHNOLOGY_CO___LTD( (int) 595, (int) 653, (String) "Zhejiang Moorgen Intelligent Technology Co., Ltd"), M_GUANGDONG_KANWAY((int) 596, (int) 654, (String) "Guangdong Kanway"), - M_PHOENIX_CONTACT_2((int) 597, (int) 655, (String) "Phoenix Contact"), - M_RAMIREZ_ENGINEERING_GMBH((int) 598, (int) 656, (String) "RAMIREZ Engineering GmbH"), + M_RAMIREZ_ENGINEERING_GMBH((int) 597, (int) 656, (String) "RAMIREZ Engineering GmbH"), M_ZHONGSHAN_TAIYANG_IMPANDEXP__CO_LTD( - (int) 599, (int) 657, (String) "Zhongshan Taiyang IMP&EXP. CO LTD"), - M_VIHAN_ELECTRIC_PVT_LTD((int) 600, (int) 658, (String) "Vihan electric pvt ltd"), - M_SPLENDID_MINDS_GMBH((int) 601, (int) 659, (String) "Splendid Minds GmbH"), - M_ESTADA((int) 602, (int) 660, (String) "Estada"), + (int) 598, (int) 657, (String) "Zhongshan Taiyang IMP&EXP. CO LTD"), + M_VIHAN_ELECTRIC_PVT_LTD((int) 599, (int) 658, (String) "Vihan electric pvt ltd"), + M_SPLENDID_MINDS_GMBH((int) 600, (int) 659, (String) "Splendid Minds GmbH"), + M_ESTADA((int) 601, (int) 660, (String) "Estada"), M_ZHONGYUNXINZHIKONGGUJITUANYOUXIANGONGSI( - (int) 603, (int) 661, (String) "zhongyunxinzhikonggujituanyouxiangongsi"), - M_STUHL_REGELSYSTEME_GMBH((int) 604, (int) 662, (String) "Stuhl Regelsysteme GmbH"), + (int) 602, (int) 661, (String) "zhongyunxinzhikonggujituanyouxiangongsi"), + M_STUHL_REGELSYSTEME_GMBH((int) 603, (int) 662, (String) "Stuhl Regelsysteme GmbH"), M_SHENZHEN_GLUCK_TECHNOLOGY_CO___LTD( - (int) 605, (int) 663, (String) "Shenzhen Gluck Technology Co., LTD"), - M_GAIMEX((int) 606, (int) 664, (String) "Gaimex"), - M_B3_INTERNATIONAL_S_R_L((int) 607, (int) 665, (String) "B3 International S.R.L"), - M_MM_ELECTRO((int) 608, (int) 666, (String) "MM Electro"), - M_ABB___RESERVED((int) 609, (int) 43954, (String) "ABB - reserved"), + (int) 604, (int) 663, (String) "Shenzhen Gluck Technology Co., LTD"), + M_GAIMEX((int) 605, (int) 664, (String) "Gaimex"), + M_B3_INTERNATIONAL_S_R_L((int) 606, (int) 665, (String) "B3 International S.R.L"), + M_MM_ELECTRO((int) 607, (int) 666, (String) "MM Electro"), + M_ABB___RESERVED((int) 608, (int) 43954, (String) "ABB - reserved"), M_BUSCH_JAEGER_ELEKTRO___RESERVED( - (int) 610, (int) 43959, (String) "Busch-Jaeger Elektro - reserved"); + (int) 609, (int) 43959, (String) "Busch-Jaeger Elektro - reserved"); private static final Map map; static { diff --git a/plc4j/tools/app/app-libs/pom.xml b/plc4j/tools/app/app-libs/pom.xml new file mode 100644 index 00000000000..8184f9faba8 --- /dev/null +++ b/plc4j/tools/app/app-libs/pom.xml @@ -0,0 +1,280 @@ + + + + 4.0.0 + + org.apache.plc4x + app-parent + 0.11.0-SNAPSHOT + + app-libs + nbm + + + + org.apache.netbeans.utilities + nbm-maven-plugin + true + + + org.apache.plc4x.java.api.* + org.openide.util.lookup.* + + + + + org.apache.maven.plugins + maven-jar-plugin + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.2 + + + check-dependencies + + analyze-only + + + false + + + + + + + + + org.netbeans.api + org-netbeans-api-annotations-common + ${netbeans.version} + + + + ch.qos.logback + logback-classic + ${logback.version} + provided + + + ch.qos.logback + logback-core + ${logback.version} + provided + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-simple + ${slf4j.version} + + + org.slf4j + log4j-over-slf4j + ${slf4j.version} + + + com.github.jinahya + bit-io + ${bit-io.version} + + + + + commons-beanutils + commons-beanutils + ${commons-beanutils.version} + + + commons-cli + commons-cli + ${commons-cli.version} + + + commons-codec + commons-codec + ${commons-codec.version} + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + org.apache.commons + commons-compress + ${commons-compress.version} + + + org.apache.commons + commons-configuration2 + ${commons-configuration2.version} + + + commons-io + commons-io + ${commons-io.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + commons-net + commons-net + ${commons-net.version} + + + org.apache.commons + commons-pool2 + ${commons-pool2.version} + + + org.apache.commons + commons-text + ${commons-text.version} + + + org.apache.commons + commons-csv + ${commons-csv.version} + + + + com.fazecast + jSerialComm + ${jserialcom.version} + + + + com.fasterxml.woodstox + woodstox-core + ${woodstox-core.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + ${jackson.version} + + + + net.java.dev.jna + jna + ${jna.version} + + + + org.pcap4j + pcap4j-core + ${pcap4j.version} + + + org.pcap4j + pcap4j-packetfactory-static + ${pcap4j.version} + + + ${project.groupId} + plc4j-api + ${version} + + + ${project.groupId} + plc4j-spi + ${version} + + + ${project.groupId} + plc4j-transport-pcap-shared + ${version} + + + ${project.groupId} + plc4j-transport-raw-socket + ${version} + + + ${project.groupId} + plc4j-transport-serial + ${version} + + + ${project.groupId} + plc4j-transport-tcp + ${version} + + + ${project.groupId} + plc4j-utils-pcap-shared + ${version} + + + ${project.groupId} + plc4j-utils-raw-sockets + ${version} + + + org.netbeans.api + org-openide-nodes + RELEASE160 + + + org.netbeans.api + org-openide-util-lookup + RELEASE160 + + + \ No newline at end of file diff --git a/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/DeviceRecord.java b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/DeviceRecord.java new file mode 100644 index 00000000000..9cbc98c1fdd --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/DeviceRecord.java @@ -0,0 +1,191 @@ +/* + * 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.app.api; + +import java.beans.PropertyChangeListener; +import java.time.Instant; +import java.time.Instant; +import java.util.Collection; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import org.openide.util.Lookup; + +/* + * + */ +public interface DeviceRecord extends Lookup.Provider { + + /* + * + */ + public void setDeviceName(String name); + + /* + * + */ + public String getDeviceName(); + + /* + * + */ + public void setDeviceDescription(String desc); + + /* + * + */ + public String getDeviceDescription(); + + /* + * + */ + public void setUUID(UUID uuid); + + /* + * + */ + public UUID getUUID(); + + /* + * + */ + public void setProtocolCode(UUID protocol); + + /* + * + */ + public UUID getProtocolCode(); + + /* + * + */ + public void setTreeLocation(UUID treenode); + + /* + * + */ + public UUID getTreeLocation(); + + /* + * + */ + public void setEnable(Boolean enable); + + /* + * + */ + public Boolean getEnable(); + + /* + * + */ + public void setPropertie(String id, String str); + + /* + * + */ + public String getPropertie(String id); + + /* + * + */ + public Map getProperties(); + + /* + * + */ + public void addTagGroup(TagGroupRecord tagg); + + /* + * + */ + public Optional getTagGroup(TagGroupRecord tagg); + + /* + * + */ + public Optional getTagGroup(UUID uuid); + + /* + * + */ + public Optional getTagGroup(String name); + + /* + * + */ + public Collection getTagGroups(); + + /* + * + */ + public void removeTagGroup(TagGroupRecord device); + + /* + * + */ + public void addPropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public void removePropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public int getTransmits(); + + /* + * + */ + public int getReceives(); + + /* + * + */ + public int getErrors(); + + /* + * + */ + public int getNumberOfTagGroups(); + + /* + * + */ + public int getNumberOfTags(); + + /* + * + */ + public Instant getStartInstant(); + + /* + * + */ + public Instant getCurrentInstant(); + + /* + * + */ + public Instant getLastUpdateInstant(); + + +} diff --git a/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/DriverRecord.java b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/DriverRecord.java new file mode 100644 index 00000000000..89dc80bd49f --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/DriverRecord.java @@ -0,0 +1,167 @@ +/* + * 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.app.api; + +import java.beans.PropertyChangeListener; +import java.time.Instant; +import java.time.Instant; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import org.apache.plc4x.java.api.PlcDriver; +import org.openide.util.Lookup; + +/* + * + */ +public interface DriverRecord extends Lookup.Provider { + + /* + * + */ + public void setProtocolCode(String protocol); + + /* + * + */ + public String getProtocolCode(); + + /* + * + */ + public void setProtocolName(String name); + + /* + * + */ + public String getProtocolName(); + + /* + * + */ + public void setUUID(UUID uuid); + + /* + * + */ + public UUID getUUID(); + + /* + * + */ + public PlcDriver getPlcDriver(); + + /* + * + */ + public void setEnable(Boolean enable); + + /* + * + */ + public Boolean getEnable(); + + /* + * + */ + public void addDevice(DeviceRecord device); + + /* + * + */ + public Optional getDevice(DeviceRecord uuid); + + /* + * + */ + public Optional getDevice(UUID uuid); + + /* + * + */ + public Optional getDevice(String name); + + /* + * + */ + public Collection getDevices(); + + /* + * + */ + public void removeDevice(DeviceRecord device); + + /* + * + */ + public void addPropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public void removePropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public int getTransmits(); + + /* + * + */ + public int getReceives(); + + /* + * + */ + public int getErrors(); + + /* + * + */ + public int getNumberOfDevice(); + + /* + * + */ + public int getNumberOfTagGroups(); + + /* + * + */ + public int getNumberOfTags(); + + /* + * + */ + public Instant getStartInstant(); + + /* + * + */ + public Instant getCurrentInstant(); + + /* + * + */ + public Instant getLastUpdateInstant(); + +} diff --git a/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/MasterDB.java b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/MasterDB.java new file mode 100644 index 00000000000..ea8478b16a8 --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/MasterDB.java @@ -0,0 +1,213 @@ +/* + * 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.app.api; + +import java.beans.PropertyChangeListener; +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +/* + * + */ +public interface MasterDB { + + /* + * + */ + public void addDriver(DriverRecord driver); + + /* + * + */ + public Optional getDriver(UUID uuid); + + /* + * + */ + public Optional getDriver(String drvname); + + /* + * + */ + public Collection getDrivers(); + + /* + * + */ + public void removeDriver(UUID uuid); + + /* + * + */ + public void addDevice(UUID driver, DeviceRecord device); + + /* + * + */ + public Optional getDevice(UUID uuid); + + /* + * + */ + public Optional getDevice(String devicename); + + /* + * + */ + public void removeDevice(DeviceRecord device); + + /* + * + */ + public void removeDevice(UUID uuid); + + /* + * + */ + public void addTagGroup(UUID device, TagGroupRecord taggroup); + + /* + * + */ + public Optional getTagGroup(UUID uuid); + + /* + * + */ + public Optional getTagGroup(String taggname); + + /* + * + */ + public void removeTagGroup(TagGroupRecord taggroup); + + /* + * + */ + public void removeTagGroup(UUID uuid); + + /* + * + */ + public void addTag(UUID taggroup, TagRecord tag); + + /* + * + */ + public Optional getTag(UUID uuid); + + /* + * + */ + public Optional getTag(String tagname); + + /* + * + */ + public void removeTag(TagRecord tag); + + /* + * + */ + public void removeTag(UUID uuid); + + /* + * + */ + public DriverRecord getDriverByCode(String code); + + /* + * + */ + public DriverRecord getDriverByName(String name); + + /* + * + */ + public DeviceRecord createDeviceDBRecord(); + + /* + * + */ + public TagGroupRecord createTagGroupDBRecord(); + + /* + * + */ + public TagRecord createTagDBRecord(); + + /* + * + */ + public void addPropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public void removePropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public List getDriverCodes(); + + /* + * + */ + public List getDriverNames(); + + /* + * + */ + public int getNumberOfDrivers(); + + /* + * + */ + public int getNumberOfDevice(); + + /* + * + */ + public int getNumberOfTagGroups(); + + /* + * + */ + public int getNumberOfTags(); + + /* + * + */ + public int getTransmits(); + + /* + * + */ + public int getReceives(); + + /* + * + */ + public int getErrors(); + + +} diff --git a/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/Plc4xDialog.java b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/Plc4xDialog.java new file mode 100644 index 00000000000..ba07eb949f2 --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/Plc4xDialog.java @@ -0,0 +1,30 @@ +/* + * 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.app.api; + +import org.openide.nodes.Node; + +/* + * + */ +public interface Plc4xDialog { + + public void setNode(Node node); + +} diff --git a/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/Plc4xPropertyEnum.java b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/Plc4xPropertyEnum.java new file mode 100644 index 00000000000..dd92d8f470d --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/Plc4xPropertyEnum.java @@ -0,0 +1,53 @@ +/* + * 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.app.api; + +/* + * + */ +public enum Plc4xPropertyEnum { + + //Commons fields in dialogs + NAME, + DESCRIPTION, + SCANTIME, + ENABLE, + DISABLE_OUTPUT, + + //Serial connection parameters + SERIAL_PORT, + BAUD_RATE, + DATA_BITS, + STOP_BITS, + PARITY, + + //TCP or UDP Connections parameters + IS_TCP, + IS_UDP, + IS_REDUNDANCE, + TCP_MAIN, + TCP_SECONDARY, + PORT_MAIN, + PORT_SECONDARY, + + //Common parameters + TIMEOUT + + +} diff --git a/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/TagGroupRecord.java b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/TagGroupRecord.java new file mode 100644 index 00000000000..12b959de4cf --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/TagGroupRecord.java @@ -0,0 +1,170 @@ +/* + * 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.app.api; + +import java.beans.PropertyChangeListener; +import java.time.Instant; +import java.util.Collection; +import java.util.Optional; +import java.util.UUID; +import org.openide.util.Lookup; + + +/* + * + */ +public interface TagGroupRecord extends Lookup.Provider { + + + /* + * + */ + public void setTagGroupName(String name); + + /* + * + */ + public String getTagGroupName(); + + /* + * + */ + public void setTagGroupDesc(String desc); + + /* + * + */ + public String getTagGroupDesc(); + + /* + * + */ + public void setUUID(UUID uuid); + + /* + * + */ + public UUID getUUID(); + + /* + * + */ + public void setScanTime(int ms); + + /* + * + */ + public int getScanTime(); + + /* + * + */ + public void setEnable(Boolean enable); + + /* + * + */ + public Boolean getEnable(); + + /* + * + */ + public void addTag(TagRecord tag); + + /* + * + */ + public Optional getTag(TagRecord tag); + + /* + * + */ + public Optional getTag(UUID uuid); + + /* + * + */ + public Optional getTag(String name); + + /* + * + */ + public Collection getTags(); + + /* + * + */ + public void removeTag(TagRecord tag); + + /* + * + */ + public void addPropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public void removePropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public UUID getDeviceRecord(); + + /* + * + */ + public int getJitter(); + + /* + * + */ + public int getTransmits(); + + /* + * + */ + public int getReceives(); + + /* + * + */ + public int getErrors(); + + /* + * + */ + public int getNumberOfTags(); + + /* + * + */ + public Instant getStartInstant(); + + /* + * + */ + public Instant getCurrentInstant(); + + /* + * + */ + public Instant getLastUpdateDateTime(); + +} diff --git a/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/TagRecord.java b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/TagRecord.java new file mode 100644 index 00000000000..339ec4aa81e --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/java/org/apache/plc4x/app/api/TagRecord.java @@ -0,0 +1,135 @@ +/* + * 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.app.api; + +import java.beans.PropertyChangeListener; +import java.time.Instant; +import java.util.UUID; + +/* + * + */ +public interface TagRecord { + + /* + * + */ + public void setTagName(String name); + + /* + * + */ + public String getTagName(); + + /* + * + */ + public void setTagDesc(String desc); + + /* + * + */ + public String getTagDesc(); + + /* + * + */ + public void setTagID(String id); + + /* + * + */ + public String getTagID(); + + /* + * + */ + public void setUUID(UUID uuid); + + /* + * + */ + public UUID getUUID(); + + /* + * + */ + public void setEnable(Boolean enable); + + /* + * + */ + public Boolean getEnable(); + + /* + * + */ + public void setDisableOutput(Boolean disableOutput); + + /* + * + */ + public Boolean getDisableOutput(); + + /* + * + */ + public void addPropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public void removePropertyChangeListener(PropertyChangeListener listener); + + /* + * + */ + public UUID getTagGroup(); + + /* + * + */ + public int getTransmits(); + + /* + * + */ + public int getReceives(); + + /* + * + */ + public int getErrors(); + + /* + * + */ + public Instant getLastReadInstant(); + + /* + * + */ + public Instant getLastWriteInstant(); + + /* + * + */ + public Instant getLastErrorInstant(); + +} diff --git a/plc4j/tools/app/app-libs/src/main/nbm/manifest.mf b/plc4j/tools/app/app-libs/src/main/nbm/manifest.mf new file mode 100644 index 00000000000..9d947d369c3 --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/nbm/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +OpenIDE-Module-Localizing-Bundle: org/apache/plc4x/app/libs/Bundle.properties + diff --git a/plc4j/tools/app/app-libs/src/main/resources/org/apache/plc4x/app/libs/Bundle.properties b/plc4j/tools/app/app-libs/src/main/resources/org/apache/plc4x/app/libs/Bundle.properties new file mode 100644 index 00000000000..326693c64d8 --- /dev/null +++ b/plc4j/tools/app/app-libs/src/main/resources/org/apache/plc4x/app/libs/Bundle.properties @@ -0,0 +1,6 @@ +#Localized module labels. Defaults taken from POM (, , ) if unset. +#OpenIDE-Module-Name= +#OpenIDE-Module-Short-Description= +#OpenIDE-Module-Long-Description= +#OpenIDE-Module-Display-Category= +#Tue Dec 20 02:37:11 VET 2022 diff --git a/plc4j/tools/app/app-modbus/pom.xml b/plc4j/tools/app/app-modbus/pom.xml new file mode 100644 index 00000000000..c45d7fc9ec4 --- /dev/null +++ b/plc4j/tools/app/app-modbus/pom.xml @@ -0,0 +1,114 @@ + + + + 4.0.0 + + org.apache.plc4x + app-parent + 0.11.0-SNAPSHOT + + app-modbus + nbm + + + + org.apache.netbeans.utilities + nbm-maven-plugin + true + + + + ${project.groupId}:app-libs + impl + + + org.netbeans.modules:org-netbeans-core-windows + impl + + + org.netbeans.api:org-openide-nodes + impl + + + + org.apache.plc4x.java.modbus.* + + + + + org.apache.maven.plugins + maven-jar-plugin + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.2 + + + check-dependencies + + analyze-only + + + false + + + + + + + + + org.netbeans.api + org-netbeans-api-annotations-common + ${netbeans.version} + + + org.netbeans.api + org-openide-util-lookup + ${netbeans.version} + + + ${project.groupId} + app-libs + ${project.version} + + + ${project.groupId} + plc4j-driver-modbus + ${project.version} + + + org.netbeans.api + org-openide-nodes + RELEASE160 + + + org.netbeans.api + org-openide-util + RELEASE160 + + + \ No newline at end of file diff --git a/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusAsciiDialog.form b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusAsciiDialog.form new file mode 100644 index 00000000000..f8df1cd800d --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusAsciiDialog.form @@ -0,0 +1,497 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusAsciiDialog.java b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusAsciiDialog.java new file mode 100644 index 00000000000..5ce6d51fe2e --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusAsciiDialog.java @@ -0,0 +1,531 @@ +/* + * 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.app.modbus.core; + +import java.io.IOException; +import java.util.Optional; +import java.util.UUID; +import javax.swing.JDialog; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.openide.cookies.InstanceCookie; +import org.openide.nodes.BeanNode; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.lookup.ServiceProvider; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; + +@ServiceProvider(service=Plc4xDialog.class, path="Plc4xDriver/modbus-ascii") +public class Plc4xModbusAsciiDialog extends JDialog implements Plc4xDialog { + + private final String DRIVER_CODE = "modbus-ascii"; + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + + public BeanNode node; + private DriverRecord driverrecord = null; + private DeviceRecord devicerecord = null; + private UUID uuid; + + private Plc4xPropertyEnum parameters; + + public Plc4xModbusAsciiDialog() { + super(new javax.swing.JFrame(), true); + initComponents(); + } + + /** + * Creates new form NewJDialog + */ + public Plc4xModbusAsciiDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + cbSerialPort = new javax.swing.JComboBox<>(); + cbBaudRate = new javax.swing.JComboBox<>(); + cbDataBits = new javax.swing.JComboBox<>(); + cbStopBits = new javax.swing.JComboBox<>(); + cbParity = new javax.swing.JComboBox<>(); + tfTimeOut = new javax.swing.JTextField(); + jPanel2 = new javax.swing.JPanel(); + brOk = new javax.swing.JButton(); + btCancel = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + tfDeviceProtocol = new javax.swing.JTextField(); + tfDeviceName = new javax.swing.JTextField(); + tfDeviceDescription = new javax.swing.JTextField(); + tfUUID = new javax.swing.JTextField(); + cbEnable = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + cbS88Node = new javax.swing.JComboBox<>(); + tfS88UUID = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Communication parameters"); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("TCP/UDP connection")); + + jLabel1.setText("Serial port:"); + jLabel1.setToolTipText(""); + + jLabel2.setText("Baud rate:"); + + jLabel3.setText("Data bits:"); + + jLabel4.setText("Stop bits:"); + + jLabel5.setText("Parity:"); + jLabel5.setToolTipText(""); + + jLabel6.setText("Timeout (Sec):"); + + cbSerialPort.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbBaudRate.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbDataBits.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbStopBits.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbParity.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + tfTimeOut.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + tfTimeOut.setText("1"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel4) + .addComponent(jLabel5) + .addComponent(jLabel6)) + .addGap(33, 33, 33) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbSerialPort, 0, 167, Short.MAX_VALUE) + .addComponent(cbBaudRate, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cbDataBits, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cbStopBits, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cbParity, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(tfTimeOut, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(cbSerialPort, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(cbBaudRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(cbDataBits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(cbStopBits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(cbParity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addComponent(tfTimeOut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(12, 12, 12)) + ); + + brOk.setText("Ok"); + brOk.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + brOkActionPerformed(evt); + } + }); + + btCancel.setText("Cancel"); + btCancel.setToolTipText(""); + btCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btCancelActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(40, 40, 40) + .addComponent(brOk, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 92, Short.MAX_VALUE) + .addComponent(btCancel) + .addGap(40, 40, 40)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(brOk) + .addComponent(btCancel)) + .addContainerGap(21, Short.MAX_VALUE)) + ); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Device")); + + jLabel9.setText("Device protocol:"); + jLabel9.setToolTipText(""); + + jLabel10.setText("Device name:"); + + jLabel11.setText("Device description:"); + jLabel11.setToolTipText(""); + + jLabel12.setText("UUID:"); + + jLabel13.setText("Enable:"); + + tfDeviceProtocol.setEnabled(false); + + tfUUID.setEnabled(false); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9) + .addComponent(jLabel10) + .addComponent(jLabel11)) + .addGap(25, 25, 25) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfDeviceProtocol) + .addComponent(tfDeviceName) + .addComponent(tfDeviceDescription))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel12) + .addGap(18, 18, 18) + .addComponent(tfUUID)) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbEnable) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9) + .addComponent(tfDeviceProtocol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(tfDeviceName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(tfDeviceDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(tfUUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbEnable) + .addComponent(jLabel13)) + .addContainerGap(15, Short.MAX_VALUE)) + ); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("S88 Tree")); + + jLabel7.setText("Node:"); + + jLabel8.setText("UUID:"); + + cbS88Node.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + tfS88UUID.setText("No UUID"); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(18, 18, 18) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbS88Node, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tfS88UUID)) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(5, 5, 5) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(cbS88Node, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(14, 14, 14) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel8) + .addComponent(tfS88UUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(10, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void brOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_brOkActionPerformed + + driverrecord = db.getDriverByCode(DRIVER_CODE); + devicerecord = db.createDeviceDBRecord(); + + Optional opdevice = driverrecord.getDevice(tfDeviceName.getText().trim()); + + if ((driverrecord != null) && (devicerecord != null) && (!opdevice.isPresent())) { + + devicerecord.setDeviceName(tfDeviceName.getText().trim()); + devicerecord.setDeviceName(tfDeviceName.getText().trim()); + devicerecord.setUUID(UUID.fromString(tfUUID.getText())); + + devicerecord.getProperties().put(parameters.SERIAL_PORT.name(), (String) cbSerialPort.getSelectedItem()); + devicerecord.getProperties().put(parameters.BAUD_RATE.name(), (String) cbBaudRate.getSelectedItem()); + devicerecord.getProperties().put(parameters.DATA_BITS.name(), (String) cbBaudRate.getSelectedItem()); + devicerecord.getProperties().put(parameters.PARITY.name(), (String) cbParity.getSelectedItem()); + devicerecord.getProperties().put(parameters.STOP_BITS.name(), (String) cbStopBits.getSelectedItem()); + devicerecord.getProperties().put(parameters.TIMEOUT.name(), (String) tfTimeOut.getText()); + + driverrecord.addDevice(devicerecord); + + } + + this.setVisible(false); + }//GEN-LAST:event_brOkActionPerformed + + private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_btCancelActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusAsciiDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusAsciiDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusAsciiDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusAsciiDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Plc4xModbusAsciiDialog dialog = new Plc4xModbusAsciiDialog(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton brOk; + private javax.swing.JButton btCancel; + private javax.swing.JComboBox cbBaudRate; + private javax.swing.JComboBox cbDataBits; + private javax.swing.JCheckBox cbEnable; + private javax.swing.JComboBox cbParity; + private javax.swing.JComboBox cbS88Node; + private javax.swing.JComboBox cbSerialPort; + private javax.swing.JComboBox cbStopBits; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JTextField tfDeviceDescription; + private javax.swing.JTextField tfDeviceName; + private javax.swing.JTextField tfDeviceProtocol; + private javax.swing.JTextField tfS88UUID; + private javax.swing.JTextField tfTimeOut; + private javax.swing.JTextField tfUUID; + // End of variables declaration//GEN-END:variables + + @Override + public void setNode(Node node) { + this.node = (BeanNode) node; + //Transfer and clean all information + final InstanceCookie cookie = node.getLookup().lookup(InstanceCookie.class); + driverrecord = null; + try { + driverrecord = (DriverRecord) cookie.instanceCreate(); + initfields(); + } catch (IOException | ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + } + } + + private void initfields() { + if (driverrecord != null) { + + devicerecord = (DeviceRecord) node.getValue("DEVICE"); + + tfDeviceProtocol.setText(driverrecord.getProtocolCode()); + + tfDeviceName.setText(""); + tfDeviceDescription.setText(""); + + uuid = UUID.randomUUID(); + + tfUUID.setText(uuid.toString()); + + //Default no S88 node selected + tfS88UUID.setText(""); + + //Default to 3 seconds delay + tfTimeOut.setText("3"); + + } + + } + +} diff --git a/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusRtuDialog.form b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusRtuDialog.form new file mode 100644 index 00000000000..f8df1cd800d --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusRtuDialog.form @@ -0,0 +1,497 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusRtuDialog.java b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusRtuDialog.java new file mode 100644 index 00000000000..897fcc60b39 --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusRtuDialog.java @@ -0,0 +1,535 @@ +/* + * 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.app.modbus.core; + +import java.io.IOException; +import java.util.UUID; +import javax.swing.JDialog; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.openide.cookies.InstanceCookie; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.BeanNode; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.lookup.ServiceProvider; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; + +@ServiceProvider(service=Plc4xDialog.class, path="Plc4xDriver/modbus-rtu") +public class Plc4xModbusRtuDialog extends JDialog implements Plc4xDialog { + + public BeanNode node; + private DriverRecord driverrecord = null; + private DeviceRecord devicerecord = null; + private UUID uuid; + + private Plc4xPropertyEnum parameters; + + public Plc4xModbusRtuDialog() { + super(new javax.swing.JFrame(), true); + initComponents(); + } + + /** + * Creates new form NewJDialog + */ + public Plc4xModbusRtuDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + cbSerialPort = new javax.swing.JComboBox<>(); + cbBaudRate = new javax.swing.JComboBox<>(); + cbDataBits = new javax.swing.JComboBox<>(); + cbStopBits = new javax.swing.JComboBox<>(); + cbParity = new javax.swing.JComboBox<>(); + tfTimeOut = new javax.swing.JTextField(); + jPanel2 = new javax.swing.JPanel(); + brOk = new javax.swing.JButton(); + btCancel = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + tfDeviceProtocol = new javax.swing.JTextField(); + tfDeviceName = new javax.swing.JTextField(); + tfDeviceDescription = new javax.swing.JTextField(); + tfUUID = new javax.swing.JTextField(); + cbEnable = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + cbS88Node = new javax.swing.JComboBox<>(); + tfS88UUID = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Communication parameters"); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("TCP/UDP connection")); + + jLabel1.setText("Serial port:"); + jLabel1.setToolTipText(""); + + jLabel2.setText("Baud rate:"); + + jLabel3.setText("Data bits:"); + + jLabel4.setText("Stop bits:"); + + jLabel5.setText("Parity:"); + jLabel5.setToolTipText(""); + + jLabel6.setText("Timeout (Sec):"); + + cbSerialPort.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbBaudRate.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbDataBits.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbStopBits.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + cbParity.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + tfTimeOut.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + tfTimeOut.setText("1"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel4) + .addComponent(jLabel5) + .addComponent(jLabel6)) + .addGap(33, 33, 33) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbSerialPort, 0, 167, Short.MAX_VALUE) + .addComponent(cbBaudRate, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cbDataBits, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cbStopBits, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cbParity, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(tfTimeOut, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(cbSerialPort, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(cbBaudRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(cbDataBits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(cbStopBits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(cbParity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addComponent(tfTimeOut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(12, 12, 12)) + ); + + brOk.setText("Ok"); + brOk.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + brOkActionPerformed(evt); + } + }); + + btCancel.setText("Cancel"); + btCancel.setToolTipText(""); + btCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btCancelActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(40, 40, 40) + .addComponent(brOk, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 92, Short.MAX_VALUE) + .addComponent(btCancel) + .addGap(40, 40, 40)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(brOk) + .addComponent(btCancel)) + .addContainerGap(21, Short.MAX_VALUE)) + ); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Device")); + + jLabel9.setText("Device protocol:"); + jLabel9.setToolTipText(""); + + jLabel10.setText("Device name:"); + + jLabel11.setText("Device description:"); + jLabel11.setToolTipText(""); + + jLabel12.setText("UUID:"); + + jLabel13.setText("Enable:"); + + tfDeviceProtocol.setEnabled(false); + + tfUUID.setEnabled(false); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9) + .addComponent(jLabel10) + .addComponent(jLabel11)) + .addGap(25, 25, 25) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfDeviceProtocol) + .addComponent(tfDeviceName) + .addComponent(tfDeviceDescription))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel12) + .addGap(18, 18, 18) + .addComponent(tfUUID)) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbEnable) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9) + .addComponent(tfDeviceProtocol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(tfDeviceName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(tfDeviceDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(tfUUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbEnable) + .addComponent(jLabel13)) + .addContainerGap(15, Short.MAX_VALUE)) + ); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("S88 Tree")); + + jLabel7.setText("Node:"); + + jLabel8.setText("UUID:"); + + cbS88Node.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + tfS88UUID.setText("No UUID"); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(18, 18, 18) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbS88Node, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tfS88UUID)) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(5, 5, 5) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(cbS88Node, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(14, 14, 14) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel8) + .addComponent(tfS88UUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(10, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void brOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_brOkActionPerformed + // TODO add your handling code here: + /* + final InstanceCookie cookie = node.getLookup().lookup(InstanceCookie.class); + final DeviceRecord dbr = (DeviceRecord) cookie.instanceCreate(); + node.setValue(parameters.SERIAL_PORT.name(), (String) cbSerialPort.getSelectedItem()); + node.setValue(parameters.BAUD_RATE.name(), (String) cbBaudRate.getSelectedItem()); + node.setValue(parameters.DATA_BITS.name(), (String) cbBaudRate.getSelectedItem()); + node.setValue(parameters.PARITY.name(), (String) cbParity.getSelectedItem()); + node.setValue(parameters.STOP_BITS.name(), (String) cbStopBits.getSelectedItem()); + node.setValue(parameters.TIMEOUT.name(), (String) cbTimeOut.getSelectedItem()); + */ + if ((driverrecord != null) && (devicerecord != null)) { + + devicerecord.setDeviceName(tfDeviceName.getText()); + devicerecord.setUUID(UUID.fromString(tfUUID.getText())); + //driverrecord.getMapDevices().put(devicerecord.getUUID(), devicerecord); + + } + this.setVisible(false); + }//GEN-LAST:event_brOkActionPerformed + + private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_btCancelActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusRtuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusRtuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusRtuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusRtuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Plc4xModbusRtuDialog dialog = new Plc4xModbusRtuDialog(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton brOk; + private javax.swing.JButton btCancel; + private javax.swing.JComboBox cbBaudRate; + private javax.swing.JComboBox cbDataBits; + private javax.swing.JCheckBox cbEnable; + private javax.swing.JComboBox cbParity; + private javax.swing.JComboBox cbS88Node; + private javax.swing.JComboBox cbSerialPort; + private javax.swing.JComboBox cbStopBits; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JTextField tfDeviceDescription; + private javax.swing.JTextField tfDeviceName; + private javax.swing.JTextField tfDeviceProtocol; + private javax.swing.JTextField tfS88UUID; + private javax.swing.JTextField tfTimeOut; + private javax.swing.JTextField tfUUID; + // End of variables declaration//GEN-END:variables + + @Override + public void setNode(Node node) { + this.node = (BeanNode) node; + //Transfer and clean all information + final InstanceCookie cookie = node.getLookup().lookup(InstanceCookie.class); + driverrecord = null; + try { + driverrecord = (DriverRecord) cookie.instanceCreate(); + initfields(); + } catch (IOException | ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + } + } + + private void initfields() { + if (driverrecord != null) { + devicerecord = (DeviceRecord) node.getValue("DEVICE"); + tfDeviceProtocol.setText(driverrecord.getProtocolCode()); + + tfDeviceName.setText(""); + tfDeviceDescription.setText(""); + + uuid = UUID.randomUUID(); + + tfUUID.setText(uuid.toString()); + + //Default no S88 node selected + tfS88UUID.setText(""); + + + tfTimeOut.setText("3"); + + } + + } + +} diff --git a/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusTcpDialog.form b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusTcpDialog.form new file mode 100644 index 00000000000..bebf4cae650 --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusTcpDialog.form @@ -0,0 +1,398 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusTcpDialog.java b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusTcpDialog.java new file mode 100644 index 00000000000..50178b3bb77 --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/java/org/apache/plc4x/app/modbus/core/Plc4xModbusTcpDialog.java @@ -0,0 +1,494 @@ +/* + * 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.app.modbus.core; + +import java.io.IOException; +import java.util.UUID; +import javax.swing.JDialog; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.openide.cookies.InstanceCookie; +import org.openide.nodes.BeanNode; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.lookup.ServiceProvider; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; + +@ServiceProvider(service=Plc4xDialog.class, path="Plc4xDriver/modbus-tcp") +public class Plc4xModbusTcpDialog extends JDialog implements Plc4xDialog { + + private BeanNode node; + private DriverRecord driverrecord = null; + private DeviceRecord devicerecord = null; + private UUID uuid; + + private Plc4xPropertyEnum parameters; + + public Plc4xModbusTcpDialog() { + super(new javax.swing.JFrame(), true); + initComponents(); + } + + /** + * Creates new form NewJDialog + */ + public Plc4xModbusTcpDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + tfTimeOut = new javax.swing.JTextField(); + tfIPAddress = new javax.swing.JTextField(); + tfPort = new javax.swing.JTextField(); + jPanel2 = new javax.swing.JPanel(); + brOk = new javax.swing.JButton(); + btCancel = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + tfDeviceProtocol = new javax.swing.JTextField(); + tfDeviceName = new javax.swing.JTextField(); + tfDeviceDescription = new javax.swing.JTextField(); + tfUUID = new javax.swing.JTextField(); + jCheckBox1 = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + cbS88Node = new javax.swing.JComboBox<>(); + tfS88UUID = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Communication parameters"); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("TCP/UDP connection")); + + jLabel1.setText("Host:"); + jLabel1.setToolTipText(""); + + jLabel2.setText("Port:"); + + jLabel6.setText("Timeout (Sec):"); + + tfTimeOut.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + tfTimeOut.setText("1"); + + tfIPAddress.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + + tfPort.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel6)) + .addGap(33, 33, 33) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfIPAddress) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(tfPort) + .addComponent(tfTimeOut, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(11, 11, 11) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(tfIPAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(tfPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(tfTimeOut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + brOk.setText("Ok"); + brOk.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + brOkActionPerformed(evt); + } + }); + + btCancel.setText("Cancel"); + btCancel.setToolTipText(""); + btCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btCancelActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(40, 40, 40) + .addComponent(brOk, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 103, Short.MAX_VALUE) + .addComponent(btCancel) + .addGap(40, 40, 40)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(brOk) + .addComponent(btCancel)) + .addContainerGap(21, Short.MAX_VALUE)) + ); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Device")); + + jLabel9.setText("Device protocol:"); + jLabel9.setToolTipText(""); + + jLabel10.setText("Device name:"); + + jLabel11.setText("Device description:"); + jLabel11.setToolTipText(""); + + jLabel12.setText("UUID:"); + + jLabel13.setText("Enable:"); + + tfDeviceProtocol.setEnabled(false); + + tfUUID.setEnabled(false); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9) + .addComponent(jLabel10) + .addComponent(jLabel11)) + .addGap(25, 25, 25) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfDeviceProtocol) + .addComponent(tfDeviceName) + .addComponent(tfDeviceDescription))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel12) + .addGap(18, 18, 18) + .addComponent(tfUUID)) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jCheckBox1) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9) + .addComponent(tfDeviceProtocol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(tfDeviceName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(tfDeviceDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(tfUUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jCheckBox1) + .addComponent(jLabel13)) + .addContainerGap(15, Short.MAX_VALUE)) + ); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("S88 Tree")); + + jLabel7.setText("Node:"); + + jLabel8.setText("UUID:"); + + cbS88Node.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + tfS88UUID.setText("No UUID"); + tfS88UUID.setEnabled(false); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(18, 18, 18) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbS88Node, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tfS88UUID)) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(5, 5, 5) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(cbS88Node, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(14, 14, 14) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel8) + .addComponent(tfS88UUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(10, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void brOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_brOkActionPerformed + // TODO add your handling code here: + /* + final InstanceCookie cookie = node.getLookup().lookup(InstanceCookie.class); + final DeviceRecord dbr = (DeviceRecord) cookie.instanceCreate(); + node.setValue(parameters.SERIAL_PORT.name(), (String) cbSerialPort.getSelectedItem()); + node.setValue(parameters.BAUD_RATE.name(), (String) cbBaudRate.getSelectedItem()); + node.setValue(parameters.DATA_BITS.name(), (String) cbBaudRate.getSelectedItem()); + node.setValue(parameters.PARITY.name(), (String) cbParity.getSelectedItem()); + node.setValue(parameters.STOP_BITS.name(), (String) cbStopBits.getSelectedItem()); + node.setValue(parameters.TIMEOUT.name(), (String) cbTimeOut.getSelectedItem()); + */ + if ((driverrecord != null) && (devicerecord != null)) { + devicerecord.setDeviceName(tfDeviceName.getText()); + devicerecord.setUUID(UUID.fromString(tfUUID.getText())); + //driverrecord.getMapDevices().put(devicerecord.getUUID(), devicerecord); + } + + this.setVisible(false); + }//GEN-LAST:event_brOkActionPerformed + + private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed + // TODO add your handling code here: + this.setVisible(false); + + }//GEN-LAST:event_btCancelActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusTcpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusTcpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusTcpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Plc4xModbusTcpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Plc4xModbusTcpDialog dialog = new Plc4xModbusTcpDialog(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton brOk; + private javax.swing.JButton btCancel; + private javax.swing.JComboBox cbS88Node; + private javax.swing.JCheckBox jCheckBox1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JTextField tfDeviceDescription; + private javax.swing.JTextField tfDeviceName; + private javax.swing.JTextField tfDeviceProtocol; + private javax.swing.JTextField tfIPAddress; + private javax.swing.JTextField tfPort; + private javax.swing.JTextField tfS88UUID; + private javax.swing.JTextField tfTimeOut; + private javax.swing.JTextField tfUUID; + // End of variables declaration//GEN-END:variables + + @Override + public void setNode(Node node) { + this.node = (BeanNode) node; + //Transfer and clean all information + final InstanceCookie cookie = node.getLookup().lookup(InstanceCookie.class); + driverrecord = null; + try { + driverrecord = (DriverRecord) cookie.instanceCreate(); + initfields(); + } catch (IOException | ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + } + } + + private void initfields() { + if (driverrecord != null) { + devicerecord = (DeviceRecord) node.getValue("DEVICE"); + tfDeviceProtocol.setText(driverrecord.getProtocolCode()); + + tfDeviceName.setText(""); + tfDeviceDescription.setText(""); + + uuid = UUID.randomUUID(); + + tfUUID.setText(uuid.toString()); + + //Default no S88 node selected + tfS88UUID.setText(""); + + + tfTimeOut.setText("3"); + + } + + } + + +} diff --git a/plc4j/tools/app/app-modbus/src/main/nbm/manifest.mf b/plc4j/tools/app/app-modbus/src/main/nbm/manifest.mf new file mode 100644 index 00000000000..91365538ab6 --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/nbm/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +OpenIDE-Module-Localizing-Bundle: org/apache/plc4x/app/modbus/Bundle.properties + diff --git a/plc4j/tools/app/app-modbus/src/main/resources/org/apache/plc4x/app/modbus/Bundle.properties b/plc4j/tools/app/app-modbus/src/main/resources/org/apache/plc4x/app/modbus/Bundle.properties new file mode 100644 index 00000000000..5dc430e68f5 --- /dev/null +++ b/plc4j/tools/app/app-modbus/src/main/resources/org/apache/plc4x/app/modbus/Bundle.properties @@ -0,0 +1,6 @@ +#Localized module labels. Defaults taken from POM (, , ) if unset. +#OpenIDE-Module-Name= +#OpenIDE-Module-Short-Description= +#OpenIDE-Module-Long-Description= +#OpenIDE-Module-Display-Category= +#Tue Dec 20 02:53:52 VET 2022 diff --git a/plc4j/tools/app/app-services/pom.xml b/plc4j/tools/app/app-services/pom.xml new file mode 100644 index 00000000000..071f86c7424 --- /dev/null +++ b/plc4j/tools/app/app-services/pom.xml @@ -0,0 +1,166 @@ + + + + 4.0.0 + + org.apache.plc4x + app-parent + 0.11.0-SNAPSHOT + + app-services + nbm + + + + org.apache.netbeans.utilities + nbm-maven-plugin + true + + + + ${project.groupId}:app-libs + impl + + + org.netbeans.modules:org-netbeans-core-windows + impl + + + org.netbeans.api:org-openide-util-lookup + impl + + + + org.apache.plc4x.app.services.api.* + + + + + org.apache.maven.plugins + maven-jar-plugin + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + org.apache.maven.plugins + maven-dependency-plugin + + 3.1.2 + + + check-dependencies + + analyze-only + + + false + + + + + + + + + + org.netbeans.api + org-netbeans-api-annotations-common + ${netbeans.version} + + + org.netbeans.api + org-openide-actions + ${netbeans.version} + + + org.netbeans.api + org-openide-nodes + ${netbeans.version} + + + + org.netbeans.api + org-openide-util-lookup + ${netbeans.version} + provided + + + + org.netbeans.api + org-openide-dialogs + ${netbeans.version} + + + org.netbeans.api + org-openide-util + ${netbeans.version} + + + org.netbeans.api + org-netbeans-core-ide + ${netbeans.version} + + + org.netbeans.api + org-openide-util-ui + ${netbeans.version} + + + org.netbeans.modules + org-netbeans-core-windows + ${netbeans.version} + + + ${project.groupId} + plc4j-api + ${project.version} + + + ${project.groupId} + app-libs + ${project.version} + + + org.netbeans.api + org-openide-awt + ${netbeans.version} + + + org.netbeans.api + org-openide-filesystems + RELEASE160 + + + org.netbeans.api + org-openide-explorer + RELEASE160 + + + \ No newline at end of file diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/InstantPropertyEditor.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/InstantPropertyEditor.java new file mode 100644 index 00000000000..308fa7dfe57 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/InstantPropertyEditor.java @@ -0,0 +1,51 @@ +/* + * 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.app.services.core; + +import java.beans.PropertyEditorSupport; +import java.time.Instant; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import org.openide.explorer.propertysheet.ExPropertyEditor; +import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.nodes.PropertyEditorRegistration; + +@PropertyEditorRegistration(targetType = Instant.class) +public class InstantPropertyEditor extends PropertyEditorSupport implements ExPropertyEditor { + + private static final String PATTERN_FORMAT = "dd.MM.yyyy HH:mm:ss"; + private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(PATTERN_FORMAT) + .withZone(ZoneId.systemDefault()); + + @Override + public String getAsText() { + Instant instant = (Instant) getValue(); + if (instant == null) { + return "No Instant assigned"; + } + return formatter.format(instant); + } + + @Override + public void attachEnv(PropertyEnv pe) { + + } + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddDeviceAction.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddDeviceAction.java new file mode 100644 index 00000000000..a5b6b29cbc0 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddDeviceAction.java @@ -0,0 +1,91 @@ +/* + * 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.app.services.core; + +import org.apache.plc4x.app.services.view.Plc4xAddDeviceDialog; +import org.apache.plc4x.app.services.model.Plc4xDriverNode; +import java.awt.event.ActionEvent; +import java.awt.event.ComponentListener; +import java.beans.IntrospectionException; +import javax.swing.AbstractAction; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.services.impl.DeviceRecordImpl; +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; +import org.apache.plc4x.app.api.DeviceRecord; + + +public class Plc4xAddDeviceAction extends AbstractAction{ + + private final Plc4xDriverNode node; + + public Plc4xAddDeviceAction(final Plc4xDriverNode node) { + this.node = node; + this.putValue(AbstractAction.NAME, "Add Device..."); + } + + /* + * TODO: Apply regex to device name. Only letter and number, including "_". + */ + @Override + public void actionPerformed(ActionEvent ae) { + Lookup lk = Lookups.forPath("Plc4xDriver/" + node.getDriverRecord().getProtocolCode()); + if ( lk != null) { + DeviceRecord devicerecord = new DeviceRecordImpl(); + node.setValue("DEVICE", devicerecord); + final Plc4xDialog dialog = lk.lookup(Plc4xDialog.class); + dialog.setNode(node); + ((JDialog) dialog).setVisible(true); + /* + if (devicerecord.getDeviceName() !=null) { + String name = devicerecord.getDeviceName(); + Boolean isBlank = name.isEmpty(); + if (!isBlank) { + Node[] nodes = new Plc4xDeviceNode[1]; + try { + //1. Add to MasterDB. + + //2. Register to Plc4xDriver Service. + // Any problem disable the device record. + + //3. Add the node representation. + nodes[0] = new Plc4xDeviceNode(devicerecord); + node.getChildren().add(nodes); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + } + }*/ + } + /* + Plc4xAddDeviceDialog dialog = Lookup.getDefault().lookup(Plc4xAddDeviceDialog.class); + dialog.setNode(node); + dialog.setVisible(true); + */ + // Node[] nodes = new Plc4xDeviceNode[1]; + // nodes[0] = new Plc4xDeviceNode("NOmbre"); + // node.getChildren().add(nodes); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddTagAction.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddTagAction.java new file mode 100644 index 00000000000..30917b755ca --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddTagAction.java @@ -0,0 +1,53 @@ +/* + * 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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xTagGroupNode; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.JDialog; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; + +/** + * + * @author cgarcia + */ +public class Plc4xAddTagAction extends AbstractAction { + + private final Plc4xTagGroupNode node; + + public Plc4xAddTagAction(Plc4xTagGroupNode node) { + this.node = node; + this.putValue(AbstractAction.NAME, "Add Tag..."); + } + + @Override + public void actionPerformed(ActionEvent ae) { + Lookup lk = Lookups.forPath("Plc4xDriver/tag"); + + if ( lk != null) { + final Plc4xDialog dialog = lk.lookup(Plc4xDialog.class); + dialog.setNode(node); + ((JDialog) dialog).setVisible(true); + } + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddTagGroupAction.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddTagGroupAction.java new file mode 100644 index 00000000000..747887383a5 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xAddTagGroupAction.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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.api.TagGroupRecord; +import org.apache.plc4x.app.services.impl.DeviceRecordImpl; +import org.apache.plc4x.app.services.impl.TagGroupRecordImpl; +import org.apache.plc4x.app.services.view.Plc4xAddTagGroupDialog; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; + +/** + * + * @author cgarcia + */ +public class Plc4xAddTagGroupAction extends AbstractAction { + + private final Plc4xDeviceNode node; + + public Plc4xAddTagGroupAction(Plc4xDeviceNode node) { + this.node = node; + this.putValue(AbstractAction.NAME, "Add TagGroup..."); + } + + @Override + public void actionPerformed(ActionEvent ae) { + Lookup lk = Lookups.forPath("Plc4xDriver/taggroup"); + + if ( lk != null) { + final Plc4xDialog dialog = lk.lookup(Plc4xDialog.class); + dialog.setNode(node); + ((JDialog) dialog).setVisible(true); + } + + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelDeviceAction.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelDeviceAction.java new file mode 100644 index 00000000000..95fa45a9c7a --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelDeviceAction.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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xDriverNode; +import java.awt.event.ActionEvent; +import java.io.IOException; +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import org.openide.nodes.AbstractNode; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.apache.plc4x.app.api.DeviceRecord; + +/** + * + * @author cgarcia + */ +public class Plc4xDelDeviceAction extends AbstractAction { + + private final Plc4xDeviceNode node; + + public Plc4xDelDeviceAction(final Plc4xDeviceNode node) { + this.node = node; + this.putValue(AbstractAction.NAME, "Delete Device"); + } + + @Override + public void actionPerformed(ActionEvent ae) { + //1. Get the node selected + System.out.println("ActionEvent: " + ae.getSource().getClass().getName()); + System.out.println("Este: " + node.getDisplayName()); + try { + node.destroy(); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + + //2. Get the DeviceRecord associated to the noe + + //3. Delete from database. + + JOptionPane.showMessageDialog(null, "Borrar Device!"); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelTagAction.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelTagAction.java new file mode 100644 index 00000000000..143c9500f3f --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelTagAction.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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xTagGroupNode; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; + +/** + * + * @author cgarcia + */ +public class Plc4xDelTagAction extends AbstractAction { + + private final Plc4xTagGroupNode node; + + public Plc4xDelTagAction(Plc4xTagGroupNode node) { + this.node = node; + this.putValue(AbstractAction.NAME, "Del Tag"); + } + + @Override + public void actionPerformed(ActionEvent ae) { + throw new UnsupportedOperationException("Not supported yet."); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelTagGroupAction.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelTagGroupAction.java new file mode 100644 index 00000000000..564fc7fb082 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDelTagGroupAction.java @@ -0,0 +1,44 @@ +/* + * 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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; + +/** + * + * @author cgarcia + */ +public class Plc4xDelTagGroupAction extends AbstractAction { + + private final Plc4xDeviceNode node; + + public Plc4xDelTagGroupAction(Plc4xDeviceNode node) { + this.node = node; + this.putValue(AbstractAction.NAME, "Del TagGroup"); + } + + @Override + public void actionPerformed(ActionEvent ae) { + JOptionPane.showMessageDialog(null, "Borrar TagGroup!"); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDeviceChildFactory.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDeviceChildFactory.java new file mode 100644 index 00000000000..8515d5ef996 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDeviceChildFactory.java @@ -0,0 +1,87 @@ +/* + * 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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xTagGroupNode; +import java.beans.IntrospectionException; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.openide.nodes.ChildFactory; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.LookupEvent; +import org.openide.util.LookupListener; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.TagGroupRecord; +import org.openide.util.Lookup; + + +public class Plc4xDeviceChildFactory extends ChildFactory.Detachable implements LookupListener { + + private final DeviceRecord device; + private final Lookup.Result plc4xresult; + private final Lookup.Template template = new Lookup.Template(TagGroupRecord.class); + private PropertyChangeListener listener; + + public Plc4xDeviceChildFactory(DeviceRecord device) { + this.device = device; + plc4xresult = device.getLookup().lookup(template); + plc4xresult.addLookupListener(this); + } + + @Override + protected void addNotify() { + device.addPropertyChangeListener(listener = (PropertyChangeEvent ev) -> { + refresh(true); + }); + } + + @Override + protected void removeNotify() { + if (listener != null) { + device.removePropertyChangeListener(listener); + listener = null; + } + } + + @Override + protected Node createNodeForKey(TagGroupRecord key) { + try { + return new Plc4xTagGroupNode(key); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return Node.EMPTY; + } + + @Override + protected boolean createKeys(List toPopulate) { + device.getTagGroups().stream().forEach(b -> toPopulate.add(b)); + return true; + } + + @Override + public void resultChanged(LookupEvent ev) { + this.refresh(true); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDriverChildFactory.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDriverChildFactory.java new file mode 100644 index 00000000000..01765165229 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xDriverChildFactory.java @@ -0,0 +1,89 @@ +/* + * 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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import java.beans.IntrospectionException; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.openide.nodes.ChildFactory; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.LookupEvent; +import org.openide.util.LookupListener; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; + + +public class Plc4xDriverChildFactory extends ChildFactory.Detachable implements LookupListener { + + private final DriverRecord driver; + private final Lookup.Result plc4xresult; + private final Lookup.Template template = new Lookup.Template(DeviceRecord.class); + private PropertyChangeListener listener; + + public Plc4xDriverChildFactory(DriverRecord driver) { + this.driver = driver; + + plc4xresult = driver.getLookup().lookup(template); + plc4xresult.addLookupListener(this); + } + + @Override + protected void addNotify() { + driver.addPropertyChangeListener(listener = (PropertyChangeEvent ev) -> { + refresh(true); + }); + } + + @Override + protected void removeNotify() { + if (listener != null) { + driver.removePropertyChangeListener(listener); + listener = null; + } + } + + @Override + protected Node createNodeForKey(DeviceRecord key) { + try { + return new Plc4xDeviceNode(key); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return Node.EMPTY; + } + + @Override + protected boolean createKeys(List toPopulate) { + driver.getDevices().stream(). + forEach(b -> {if (b != null) toPopulate.add(b);}); + return true; + } + + @Override + public void resultChanged(LookupEvent ev) { + this.refresh(true); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xPropertiesNotifier.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xPropertiesNotifier.java new file mode 100644 index 00000000000..c23496b92db --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xPropertiesNotifier.java @@ -0,0 +1,44 @@ +/* + * 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.app.services.core; + +import javax.swing.event.ChangeListener; +import org.openide.util.ChangeSupport; + +/** + * + * @author cgarcia + */ +public class Plc4xPropertiesNotifier { + + private static final ChangeSupport cs = new ChangeSupport(Plc4xPropertiesNotifier.class); + + public static void addChangeListener(ChangeListener listener) { + cs.addChangeListener(listener); + } + + public static void removeChangeListener(ChangeListener listener) { + cs.removeChangeListener(listener); + } + + public static void changed() { + cs.fireChange(); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xRootChildFactory.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xRootChildFactory.java new file mode 100644 index 00000000000..719f13cbadf --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xRootChildFactory.java @@ -0,0 +1,91 @@ +/* + * 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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xDriverNode; +import java.beans.IntrospectionException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.apache.plc4x.app.api.MasterDB; +import org.openide.nodes.ChildFactory; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.LookupEvent; +import org.openide.util.LookupListener; + +/** + * + * @author cgarcia + */ +public class Plc4xRootChildFactory extends ChildFactory.Detachable implements LookupListener { + + private ChangeListener listener; + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + + @Override + protected void addNotify() { + Plc4xPropertiesNotifier.addChangeListener(listener = (ChangeEvent ev) -> { + refresh(true); + }); + } + + @Override + protected void removeNotify() { + if (listener != null) { + Plc4xPropertiesNotifier.removeChangeListener(listener); + listener = null; + } + } + + @Override + protected Node createNodeForKey(String key) { + try { + return new Plc4xDriverNode(db.getDriverByName(key)); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return null; + } + + @Override + protected boolean createKeys(List toPopulate) { + + List keys = new ArrayList(); + + for (String name:db.getDriverNames()) { + keys.add(name); + + } + + Collections.sort(keys); + toPopulate.addAll(keys); + + return true; + } + + @Override + public void resultChanged(LookupEvent ev) { + this.refresh(true); + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xRootNodeSaveAction.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xRootNodeSaveAction.java new file mode 100644 index 00000000000..1ccd6ed0d59 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xRootNodeSaveAction.java @@ -0,0 +1,70 @@ +/* + * 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.app.services.core; + +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import java.awt.event.ActionEvent; +import java.io.PrintWriter; +import javax.swing.AbstractAction; +import org.apache.plc4x.app.api.MasterDB; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; + +/** + * + * @author cgarcia + */ +public class Plc4xRootNodeSaveAction extends AbstractAction { + + private MasterDB db = null; + private final XmlMapper mapper = new XmlMapper(); + + public Plc4xRootNodeSaveAction() { + this.putValue(AbstractAction.NAME, "Save config..."); + } + + @Override + public void actionPerformed(ActionEvent ae) { + db = Lookup.getDefault().lookup(MasterDB.class); + if (db != null) { + try { + FileObject fo = FileUtil.getConfigRoot(); + String dir = FileUtil.getFileDisplayName(fo); + FileObject fxml = FileUtil.createData(fo, "db.plc4x.xml"); + if (fxml.isLocked()) System.out.println("Archivo bloqueado!"); + System.out.println("Dir: " + dir); + + String result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(db); + System.out.println(result); + if (fxml.canWrite()) { + PrintWriter output = new PrintWriter(fxml.getOutputStream()); + output.println(result); + output.close(); + } + + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } + } + + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xTagGroupChildFactory.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xTagGroupChildFactory.java new file mode 100644 index 00000000000..c5569748e83 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/Plc4xTagGroupChildFactory.java @@ -0,0 +1,74 @@ +/* + * 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.app.services.core; + +import org.apache.plc4x.app.services.model.Plc4xTagNode; +import java.beans.IntrospectionException; +import java.util.List; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.openide.nodes.ChildFactory; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.apache.plc4x.app.api.TagRecord; +import org.apache.plc4x.app.api.TagGroupRecord; + + +public class Plc4xTagGroupChildFactory extends ChildFactory.Detachable { + + private final TagGroupRecord tagg; + private ChangeListener listener; + + public Plc4xTagGroupChildFactory(TagGroupRecord tagg) { + this.tagg = tagg; + } + + @Override + protected void addNotify() { + Plc4xPropertiesNotifier.addChangeListener(listener = (ChangeEvent ev) -> { + refresh(true); + }); + } + + @Override + protected void removeNotify() { + if (listener != null) { + Plc4xPropertiesNotifier.removeChangeListener(listener); + listener = null; + } + } + + @Override + protected Node createNodeForKey(TagRecord key) { + try { + return new Plc4xTagNode(key); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return Node.EMPTY; + } + + @Override + protected boolean createKeys(List toPopulate) { + //device.getDevices().stream().forEach(b -> toPopulate.add(b)); + + return true; + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/UUIDPropertyEditor.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/UUIDPropertyEditor.java new file mode 100644 index 00000000000..ecdb051f76c --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/core/UUIDPropertyEditor.java @@ -0,0 +1,46 @@ +/* + * 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.app.services.core; + +import java.beans.PropertyEditorSupport; +import java.util.UUID; +import org.openide.explorer.propertysheet.ExPropertyEditor; +import org.openide.explorer.propertysheet.InplaceEditor; +import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.nodes.PropertyEditorRegistration; + +@PropertyEditorRegistration(targetType = UUID.class) +public class UUIDPropertyEditor extends PropertyEditorSupport implements ExPropertyEditor { + + @Override + public String getAsText() { + UUID uuid = (UUID) getValue(); + if (uuid == null) { + return "No UUID assigned"; + } + return uuid.toString(); + } + + @Override + public void attachEnv(PropertyEnv pe) { + + } + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/DeviceRecordImpl.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/DeviceRecordImpl.java new file mode 100644 index 00000000000..6afe60b509d --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/DeviceRecordImpl.java @@ -0,0 +1,271 @@ +/* + * 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.app.services.impl; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.time.Instant; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import org.openide.util.Lookup; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.apache.plc4x.app.api.TagGroupRecord; +import org.openide.util.lookup.AbstractLookup; +import org.openide.util.lookup.InstanceContent; + +@JsonPropertyOrder({ "deviceName","deviceDesc","protocolCode","uuid","treenode", + "enable","properties","tagGroups"}) +public class DeviceRecordImpl implements DeviceRecord, Lookup.Provider { + + private Plc4xPropertyEnum P; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private final Lookup lk; + private final InstanceContent ic; + + private String deviceName; + private String deviceDesc; + private UUID protocolCode; + private UUID uuid; + private UUID treenode; + + private Boolean enable = false; + + private int transmits = 0; + private int receives = 0; + private int errors = 0; + + private Instant startInstant; + private Instant currentInstant; + private Instant lastUpdateInstant; + + private Map properties = new HashMap(); + + + + public DeviceRecordImpl() { + this.ic = new InstanceContent (); + this.lk = new AbstractLookup (ic); + } + + public DeviceRecordImpl(UUID uuid) { + this.ic = new InstanceContent (); + this.lk = new AbstractLookup (ic); + this.uuid = uuid; + } + + + @Override + public void setDeviceName(String name) { + String oldValue = this.deviceName; + this.deviceName = name; + this.pcs.firePropertyChange(P.NAME.name(), oldValue, name); + } + + @Override + public String getDeviceName() { + return deviceName; + } + + @Override + public void setDeviceDescription(String desc) { + String oldValue = this.deviceDesc; + this.deviceDesc = desc; + this.pcs.firePropertyChange(P.DESCRIPTION.name(), oldValue, desc); + } + + @Override + public String getDeviceDescription() { + return deviceDesc; + } + + @Override + public void setUUID(UUID uuid) { + this.uuid = uuid; + } + + @Override + public UUID getUUID() { + return uuid; + } + + @Override + public void setProtocolCode(UUID protocol) { + this.protocolCode = protocol; + } + + @Override + public UUID getProtocolCode() { + return protocolCode; + } + + @Override + public void setTreeLocation(UUID treenode) { + this.treenode = treenode; + } + + @Override + public UUID getTreeLocation() { + return treenode; + } + + @Override + public void setEnable(Boolean enable) { + Boolean oldValue = this.enable; + this.enable = enable; + if (enable) startInstant = Instant.now(); + lastUpdateInstant = startInstant; + this.pcs.firePropertyChange(P.ENABLE.name(), oldValue, enable); + } + + @Override + public Boolean getEnable() { + return enable; + } + + @Override + public void setPropertie(String id, String str) { + properties.put(id, str); + } + + @Override + public String getPropertie(String id) { + return properties.get(id); + } + + @Override + public Map getProperties() { + return properties; + } + + @Override + public void addTagGroup(TagGroupRecord tagg) { + ic.add(tagg); + } + + @Override + public Optional getTagGroup(TagGroupRecord tagg) { + Optional optagg = (Optional) lk.lookupAll(TagGroupRecord.class).stream(). + filter(t -> t.equals(tagg)). + findFirst(); + return optagg; + } + + @Override + public Optional getTagGroup(UUID uuid) { + Optional optagg = (Optional) lk.lookupAll(TagGroupRecord.class).stream(). + filter(t -> t.getUUID().equals(uuid)). + findFirst(); + return optagg; + } + + @Override + public Optional getTagGroup(String name) { + Optional optagg = (Optional) lk.lookupAll(TagGroupRecord.class).stream(). + filter(t -> t.getTagGroupName().equals(name)). + findFirst(); + return optagg; + } + + @Override + public Collection getTagGroups() { + System.out.println("Paso por aqui..." + lk.lookupAll(TagGroupRecord.class)); + return (Collection) lk.lookupAll(TagGroupRecord.class); + } + + @Override + public void removeTagGroup(TagGroupRecord tagg) { + ic.remove(tagg); + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + this.pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + this.pcs.removePropertyChangeListener(listener); + } + + @JsonIgnore + @Override + public int getTransmits() { + return transmits; + } + + @JsonIgnore + @Override + public int getReceives() { + return receives; + } + + @JsonIgnore + @Override + public int getErrors() { + return errors; + } + + @JsonIgnore + @Override + public int getNumberOfTagGroups() { + // return tagg.size(); + return 12; + } + + @JsonIgnore + @Override + public int getNumberOfTags() { + int[] ntags = new int[1]; + // tagg.entrySet().stream() + // .forEach(item -> ntags[0] += item.getValue().getNumberOfTags()); + return ntags[0]; + } + + @JsonIgnore + @Override + public Instant getStartInstant() { + return startInstant; + } + + @JsonIgnore + @Override + public Instant getCurrentInstant() { + return Instant.now(); + } + + @JsonIgnore + @Override + public Instant getLastUpdateInstant() { + return lastUpdateInstant; + } + + @JsonIgnore + @Override + public Lookup getLookup() { + return lk; + } + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/DriverRecordImpl.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/DriverRecordImpl.java new file mode 100644 index 00000000000..0baef8910bf --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/DriverRecordImpl.java @@ -0,0 +1,234 @@ +/* + * 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.app.services.impl; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.time.Instant; +import java.util.Collection; +import java.util.HashMap; +import java.util.Optional; +import java.util.UUID; +import org.apache.plc4x.java.api.PlcDriver; +import org.openide.util.Lookup; +import org.openide.util.lookup.AbstractLookup; +import org.openide.util.lookup.InstanceContent; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; + +@JsonPropertyOrder({ "protocolCode","protocolName","uuid","enable","devices"}) +@JsonIgnoreProperties(value = { "plcdriver","transmits","receives","errors", + "startInstant","currentInstant","lastUpdateInstant"}) +public class DriverRecordImpl implements DriverRecord { + + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private final Lookup lk; + private final InstanceContent ic; + + private String protocolCode; + private String protocolName; + private final UUID uuid; + + private Boolean enable = false; + + private final PlcDriver plcdriver; + + private int transmits = 0; + private int receives = 0; + private int errors = 0; + + private Instant startInstant; + private Instant currentInstant; + private Instant lastUpdateInstant; + + + public DriverRecordImpl() { + this.lk = null; + this.ic = null; + this.uuid = null; + this.plcdriver = null; + } + + public DriverRecordImpl(UUID uuid, PlcDriver plcdriver) { + ic = new InstanceContent (); + lk = new AbstractLookup (ic); + this.uuid = uuid; + this.plcdriver = plcdriver; + } + + @Override + public void setProtocolCode(String protocol) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getProtocolCode() { + return plcdriver.getProtocolCode(); + } + + @Override + public void setProtocolName(String name) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getProtocolName() { + return plcdriver.getProtocolName(); + } + + @Override + public void setUUID(UUID uuid) { + //this.uuid = uuid; + } + + @Override + public UUID getUUID() { + return uuid; + } + + @JsonIgnore + @Override + public PlcDriver getPlcDriver() { + return plcdriver; + } + + @Override + public void setEnable(Boolean enable) { + this.enable = enable; + } + + @Override + public Boolean getEnable() { + return enable; + } + + @Override + public void addDevice(DeviceRecord device) { + ic.add(device); + } + + @Override + public Optional getDevice(DeviceRecord device) { + Optional opdevice = (Optional) lk.lookupAll(DeviceRecord.class).stream(). + filter(d -> d.equals(device)). + findFirst(); + + return opdevice; + } + + @Override + public Optional getDevice(UUID uuid) { + Optional opdevice = (Optional) lk.lookupAll(DeviceRecord.class).stream(). + filter(d -> d.getUUID().equals(uuid)). + findFirst(); + return opdevice; + } + + @Override + public Optional getDevice(String name) { + Optional opdevice = (Optional) lk.lookupAll(DeviceRecord.class).stream(). + filter(d -> d.getDeviceName().equals(name)). + findFirst(); + return opdevice; + } + + @Override + public Collection getDevices() { + return (Collection) lk.lookupAll(DeviceRecord.class); + } + + @Override + public void removeDevice(DeviceRecord device) { + ic.remove(device); + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + this.pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + this.pcs.removePropertyChangeListener(listener); + } + + @Override + public int getTransmits() { + return transmits; + } + + @Override + public int getReceives() { + return receives; + } + + @Override + public int getErrors() { + return errors; + } + + @Override + public int getNumberOfDevice() { + return 0; + } + + @Override + public int getNumberOfTagGroups() { + int[] n = new int[1]; + n[0] = 0; + // devices.entrySet().stream() + // .forEach(drv -> n[0] += drv.getValue().getNumberOfTagGroups()); + return n[0]; + } + + @Override + public int getNumberOfTags() { + int[] n = new int[1]; + n[0] = 0; + //devices.entrySet().stream() + // .forEach(drv -> n[0] += drv.getValue().getNumberOfTags()); + return n[0]; + } + + @Override + public Instant getStartInstant() { + return startInstant; + } + + @Override + public Instant getCurrentInstant() { + return currentInstant; + } + + @Override + public Instant getLastUpdateInstant() { + return lastUpdateInstant; + } + + @JsonIgnore + @Override + public Lookup getLookup() { + return lk; + } + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/MasterDBImpl.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/MasterDBImpl.java new file mode 100644 index 00000000000..5bb63da8f0d --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/MasterDBImpl.java @@ -0,0 +1,426 @@ +/* + * 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.app.services.impl; + + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.java.api.PlcDriver; +import org.openide.util.Lookup; +import org.openide.util.LookupEvent; +import org.openide.util.LookupListener; +import org.openide.util.lookup.AbstractLookup; +import org.openide.util.lookup.InstanceContent; +import org.openide.util.lookup.ServiceProvider; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; +import org.apache.plc4x.app.api.TagRecord; +import org.apache.plc4x.app.api.TagGroupRecord; + +@JsonPropertyOrder({"db"}) +@ServiceProvider(service=MasterDB.class) +public class MasterDBImpl implements MasterDB, Lookup.Provider, LookupListener { + + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private final HashMap db = new HashMap(); + private final HashMap taggs = new HashMap(); + private final HashMap tags = new HashMap(); + + private final InstanceContent ic; + private final Lookup lk; + private final Lookup.Result plc4xresult; + private final Lookup.Result dbresult; + + private final Lookup.Template drivertemplate = new Lookup.Template(PlcDriver.class); + private Lookup.Template dbtemplate = new Lookup.Template(DriverRecord.class); + + private UUID tempUuid; + + public MasterDBImpl() { + ic = new InstanceContent (); + lk = new AbstractLookup (ic); + + //1. Jackson must first try to rebuild the structures from a file + + //2. We take the drivers registered in the CLASSPATH + plc4xresult = Lookup.getDefault().lookup(drivertemplate); + plc4xresult.addLookupListener(this); + + Collection drivers = (Collection) plc4xresult.allInstances(); + + drivers.stream(). + forEach(p -> ic.add(new DriverRecordImpl(UUID.randomUUID(), p))); + + dbresult = lk.lookup(dbtemplate); + + /* + for (PlcDriver driver:Lookup.getDefault().lookupAll(PlcDriver.class)) { + tempUuid = UUID.randomUUID(); + addDriver(new DriverRecordImpl(tempUuid, driver)); + } + */ + } + + public HashMap getDB(){ + return db; + } + + @Override + public void addDriver(DriverRecord driver) { + final DriverRecord tempdrv = getDriverByCode(driver.getProtocolCode()); + if (null == tempdrv) { + if(null == driver.getUUID()){ + tempUuid = UUID.randomUUID(); + } else { + tempUuid = driver.getUUID(); + } + db.put(tempUuid, driver); + } + + } + + @Override + public Optional getDriver(UUID uuid) { + return (Optional) dbresult.allInstances().stream(). + filter(r -> r.getUUID().equals(uuid)). + findFirst(); + } + + @Override + public Optional getDriver(String drvname) { + return (Optional) dbresult.allInstances().stream(). + filter(r -> r.getProtocolCode().equals(drvname)). + findFirst(); + } + + @Override + public Collection getDrivers() { + return (Collection) dbresult.allInstances(); + + } + + @Override + public void removeDriver(UUID uuid) { + Optional oprecord = getDriver(uuid); + if (oprecord.isPresent()) ic.remove(oprecord.get()); + } + + @Override + public void addDevice(UUID driver, DeviceRecord device) { + Optional opdriver = getDriver(driver); + if (opdriver.isPresent()) { + opdriver.get().addDevice(device); + } + } + + @Override + public Optional getDevice(UUID uuid) { + Optional opdriver = + (Optional) dbresult.allInstances().stream(). + filter(drv -> ((Optional) drv.getDevice(uuid)).isPresent()). + findFirst(); + + return opdriver.isPresent() ? opdriver.get().getDevice(uuid): Optional.empty(); + + } + + @Override + public Optional getDevice(String devicename) { + Optional opdriver = + (Optional) dbresult.allInstances().stream(). + filter(drv -> ((Optional) drv.getDevice(devicename)).isPresent()). + findFirst(); + + return opdriver.isPresent() ? opdriver.get().getDevice(devicename): Optional.empty(); + } + + + @Override + public void removeDevice(DeviceRecord device) { + removeDevice(device.getUUID()); + } + + @Override + public void removeDevice(UUID uuid) { + Optional opdriver = (Optional) dbresult.allInstances().stream(). + filter(drv -> drv.getDevice(uuid).equals(uuid)). + findFirst(); + if (opdriver.isPresent()) { + Optional opdev = opdriver.get().getDevice(uuid); + if (opdev.isPresent()) + if (!opdev.get().getEnable()){ + opdev.get().getTagGroups().stream(). + forEach(tg -> { + taggs.remove(tg.getUUID()); + removeTagGroup(tg.getUUID()); + }); + if (opdev.get().getTagGroups().isEmpty()) + opdriver.get().removeDevice(opdev.get()); + opdev = null; + }; + } + } + + @Override + public void addTagGroup(UUID device, TagGroupRecord taggroup) { + Optional opdevice = getDevice(device); + if (opdevice.isPresent()){ + opdevice.get().addTagGroup(taggroup); + taggs.put(taggroup.getUUID(), taggroup); + } else { + System.out.println("Dispositivo no encontrado: " + device.toString()); + } + } + + @Override + public Optional getTagGroup(UUID uuid) { + return taggs.values().stream(). + filter(t -> t.getUUID().equals(uuid)). + findFirst(); + } + + + @Override + public Optional getTagGroup(String taggname) { + return taggs.values().stream(). + filter(t -> t.getTagGroupName().equals(taggname)). + findFirst(); + } + + @Override + public void removeTagGroup(TagGroupRecord taggroup) { + removeTagGroup(taggroup.getUUID()); + } + + @Override + public void removeTagGroup(UUID uuid) { + Optional opTagGroup = getTagGroup(uuid); + if (opTagGroup.isPresent()) + if (!opTagGroup.get().getEnable()) { + Optional optag = opTagGroup.get().getTags().stream(). + filter(t -> t.getEnable()). + findFirst(); + if (!optag.isPresent()) { + taggs.remove(opTagGroup.get()); + opTagGroup.get().getTags().stream().forEach(t -> tags.remove(t.getUUID())); + Optional opdevice = getDevice(opTagGroup.get().getDeviceRecord()); + if (opdevice.isPresent()) opdevice.get().removeTagGroup(opTagGroup.get()); + opTagGroup = null; + } + } + } + + @Override + public void addTag(UUID taggroup, TagRecord tag) { + Optional optagg = getTagGroup(taggroup); + if (optagg.isPresent()){ + optagg.get().addTag(tag); + tags.put(tag.getUUID(), tag); + } + + } + + @Override + public Optional getTag(UUID uuid) { + return tags.values().stream(). + filter(t -> t.getUUID().equals(uuid)). + findFirst(); + } + + @Override + public Optional getTag(String tagname) { + return tags.values().stream(). + filter(t -> t.getTagName().equals(tagname)). + findFirst(); + } + + @Override + public void removeTag(TagRecord tag) { + Optional optag = getTag(tag.getUUID()); + if (optag.isPresent()) { + tags.remove(tag.getUUID()); + Optional optagg = getTagGroup(tag.getTagGroup()); + if (optagg.isPresent()) { + optagg.get().removeTag(tag); + } + optag =null; //To GC? + } + } + + @Override + public void removeTag(UUID uuid) { + Optional optag = getTag(uuid); + if (optag.isPresent()){ + if (!optag.get().getEnable()) { + tags.remove(optag.get().getUUID()); + Optional optagg = getTagGroup(optag.get().getTagGroup()); + if (optagg.isPresent()) { + optagg.get().removeTag(optag.get()); + } + optag = null; //To GC? + } + } + } + + @JsonIgnore + @Override + public List getDriverCodes() { + return dbresult.allInstances().stream() + .filter(e -> true) + .map(driver -> driver.getProtocolCode()) + .collect(Collectors.toList()); + } + + @JsonIgnore + @Override + public List getDriverNames() { + return dbresult.allInstances().stream() + .filter(e -> true) + .map(driver -> driver.getProtocolName()) + .collect(Collectors.toList()); + } + + @JsonIgnore + @Override + public DriverRecord getDriverByCode(String code) { + Optional oprecord = (Optional) + dbresult.allInstances().stream() + .filter(r -> r.getPlcDriver().getProtocolCode().equals(code)) + .findFirst(); + + return oprecord.isPresent()?oprecord.get():null; + } + + @JsonIgnore + @Override + public DriverRecord getDriverByName(String name) { + Optional oprecord = (Optional) + dbresult.allInstances().stream() + .filter(r -> r.getPlcDriver().getProtocolName().equals(name)) + .findFirst(); + if (oprecord.isPresent()) return oprecord.get(); + return null; + } + + @Override + public DeviceRecord createDeviceDBRecord() { + return new DeviceRecordImpl(); + } + + @Override + public TagGroupRecord createTagGroupDBRecord() { + UUID uuid = UUID.randomUUID(); + return new TagGroupRecordImpl(uuid); + } + + @Override + public TagRecord createTagDBRecord() { + UUID uuid = UUID.randomUUID(); + return new TagRecordImpl(uuid); + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + this.pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + this.pcs.removePropertyChangeListener(listener); + } + + @JsonIgnore + @Override + public int getNumberOfDrivers() { + return db.size(); + } + + @JsonIgnore + @Override + public int getNumberOfDevice() { + int[] n = new int[1]; + n[0] = 0; + dbresult.allInstances().stream(). + forEach(drv -> n[0] += drv.getNumberOfDevice()); + return n[0]; + } + + @JsonIgnore + @Override + public int getNumberOfTagGroups() { + int[] n = new int[1]; + n[0] = 0; + dbresult.allInstances().stream(). + forEach(drv -> n[0] += drv.getNumberOfTagGroups()); + return n[0]; + } + + @JsonIgnore + @Override + public int getNumberOfTags() { + int[] n = new int[1]; + n[0] = 0; + dbresult.allInstances().stream(). + forEach(drv -> n[0] += drv.getNumberOfTags()); + return n[0]; + } + + @JsonIgnore + @Override + public int getTransmits() { + return 0; + } + + @JsonIgnore + @Override + public int getReceives() { + return 0; + } + + @JsonIgnore + @Override + public int getErrors() { + return 0; + } + + @JsonIgnore + @Override + public Lookup getLookup() { + return lk; + } + + @Override + public void resultChanged(LookupEvent ev) { + System.out.println("Evento: " + ev.toString()); + } + + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/TagGroupRecordImpl.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/TagGroupRecordImpl.java new file mode 100644 index 00000000000..a28be361349 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/TagGroupRecordImpl.java @@ -0,0 +1,241 @@ +/* + * 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.app.services.impl; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.time.Instant; +import java.util.Collection; +import java.util.HashMap; +import java.util.Optional; +import java.util.UUID; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.openide.util.Lookup; +import org.apache.plc4x.app.api.TagRecord; +import org.apache.plc4x.app.api.TagGroupRecord; +import org.openide.util.lookup.AbstractLookup; +import org.openide.util.lookup.InstanceContent; + +@JsonPropertyOrder({"groupName","groupDesc","uuid","deviceuuid","enable","tags"}) +@JsonIgnoreProperties(value = {"startInstant","currentInstant","lastUpdateInstant"}) +public class TagGroupRecordImpl implements TagGroupRecord, Lookup.Provider { + + private Plc4xPropertyEnum P; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private final Lookup lk; + private final InstanceContent ic; + private String groupName; + private String groupDesc; + private UUID uuid; + private UUID deviceuuid; + + private Boolean enable = false; + + private int scanTime = 100; + + private Instant startInstant; + private Instant currentInstant; + private Instant lastUpdateInstant; + + + public TagGroupRecordImpl(UUID deviceuuid) { + this.ic = new InstanceContent (); + this.lk = new AbstractLookup (ic); + this.deviceuuid = uuid; + } + + @Override + public void setTagGroupName(String name) { + String oldValue = this.groupName; + this.groupName = name; + this.pcs.firePropertyChange(P.NAME.name(), oldValue, name); + } + + @Override + public String getTagGroupName() { + return groupName; + } + + @Override + public void setTagGroupDesc(String desc) { + String oldValue = this.groupDesc; + this.groupDesc = desc; + this.pcs.firePropertyChange(P.DESCRIPTION.name(), oldValue, desc); + } + + @Override + public String getTagGroupDesc() { + return groupDesc; + } + + @Override + public void setUUID(UUID uuid) { + this.uuid = uuid; + } + + @Override + public UUID getUUID() { + return uuid; + } + + @Override + public void setScanTime(int ms) { + Integer oldValue = scanTime; + if (ms < 100) scanTime=100; + else scanTime = ms; + Integer newValue = scanTime; + this.pcs.firePropertyChange(P.SCANTIME.name(), oldValue, newValue); + } + + @Override + public int getScanTime() { + return scanTime; + } + + @Override + public void addTag(TagRecord tag) { + ic.add(tag); + } + + + + @Override + public Optional getTag(UUID uuid) { + return (Optional) lk.lookupAll(TagRecord.class).stream(). + filter(d -> d.getUUID().equals(uuid)). + findFirst(); + } + + @Override + public Optional getTag(TagRecord tag) { + return (Optional) lk.lookupAll(TagRecord.class).stream(). + filter(d -> d.getTagName().equals(tag.getTagName())). + findFirst(); + } + + @Override + public Optional getTag(String name) { + return (Optional) lk.lookupAll(TagRecord.class).stream(). + filter(t -> t.getTagName().equals(name)). + findFirst(); + } + + @Override + public Collection getTags() { + return (Collection) lk.lookupAll(TagRecord.class); + } + + @Override + public void removeTag(TagRecord tag) { + ic.remove(tag); + } + + @Override + public void setEnable(Boolean enable) { + Boolean oldValue = this.enable; + this.enable = enable; + if (enable) startInstant = Instant.now(); + lastUpdateInstant = startInstant; + this.pcs.firePropertyChange(P.ENABLE.name(), oldValue, enable); + } + + @Override + public Boolean getEnable() { + return enable; + } + + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + this.pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + this.pcs.removePropertyChangeListener(listener); + } + + @Override + public UUID getDeviceRecord() { + return deviceuuid; + } + + + @JsonIgnore + @Override + public int getJitter() { + return 0; + } + + @JsonIgnore + @Override + public int getTransmits() { + return 0; + } + + @JsonIgnore + @Override + public int getReceives() { + return 0; + } + + @JsonIgnore + @Override + public int getErrors() { + return 0; + } + + @JsonIgnore + @Override + public int getNumberOfTags() { + return lk.lookupAll(TagRecord.class).size(); + } + + @JsonIgnore + @Override + public Instant getStartInstant() { + return startInstant; + } + + @JsonIgnore + @Override + public Instant getCurrentInstant() { + return currentInstant; + } + + @JsonIgnore + @Override + public Instant getLastUpdateDateTime() { + return lastUpdateInstant; + } + + @JsonIgnore + @Override + public Lookup getLookup() { + return lk; + } + + + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/TagRecordImpl.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/TagRecordImpl.java new file mode 100644 index 00000000000..75a96d59c19 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/impl/TagRecordImpl.java @@ -0,0 +1,174 @@ +/* + * 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.app.services.impl; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.time.Instant; +import java.util.UUID; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.apache.plc4x.app.api.TagRecord; + + +/** + * + * @author cgarcia + */ +public class TagRecordImpl implements TagRecord { + + private Plc4xPropertyEnum P; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private String tagname; + private String tagdesc; + private String id; + + private UUID uuid; + private final UUID tagguuid; + + private Boolean enable = false; + private Boolean disableOutput = true; + + private int transmits = 0; + private int receives = 0; + private int errors = 0; + + private Instant startInstant; + private Instant currentInstant; + private Instant lastUpdateInstant; + + public TagRecordImpl(UUID tagguuid) { + this.tagguuid = tagguuid; + } + + @Override + public void setTagName(String name) { + String oldValue = this.tagname; + this.tagname = name; + this.pcs.firePropertyChange(P.NAME.name(), oldValue, name); + } + + @Override + public String getTagName() { + return tagname; + } + + @Override + public void setTagDesc(String desc) { + String oldValue = this.tagdesc; + this.tagdesc = desc; + this.pcs.firePropertyChange(P.DESCRIPTION.name(), oldValue, desc); + } + + @Override + public String getTagDesc() { + return tagdesc; + } + + @Override + public void setTagID(String id) { + this.id = id; + } + + @Override + public String getTagID() { + return id; + } + + @Override + public void setUUID(UUID uuid) { + this.uuid = uuid; + } + + @Override + public UUID getUUID() { + return uuid; + } + + @Override + public void setEnable(Boolean enable) { + Boolean oldValue = this.enable; + this.enable = enable; + if ((!oldValue) && enable) startInstant = Instant.now(); + lastUpdateInstant = startInstant; + this.pcs.firePropertyChange(P.ENABLE.name(), oldValue, enable); + } + + @Override + public Boolean getEnable() { + return enable; + } + + @Override + public void setDisableOutput(Boolean disableOutput) { + Boolean oldValue = this.disableOutput ; + this.disableOutput = disableOutput; + this.pcs.firePropertyChange(P.DISABLE_OUTPUT.name(), oldValue, disableOutput); + } + + @Override + public Boolean getDisableOutput() { + return disableOutput; + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + this.pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + this.pcs.removePropertyChangeListener(listener); + } + + @Override + public UUID getTagGroup() { + return tagguuid; + } + + @Override + public int getTransmits() { + return transmits; + } + + @Override + public int getReceives() { + return receives; + } + + @Override + public int getErrors() { + return errors; + } + + @Override + public Instant getLastReadInstant() { + return startInstant; + } + + @Override + public Instant getLastWriteInstant() { + return currentInstant; + } + + @Override + public Instant getLastErrorInstant() { + return lastUpdateInstant; + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xDeviceNode.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xDeviceNode.java new file mode 100644 index 00000000000..12fbc7622e2 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xDeviceNode.java @@ -0,0 +1,146 @@ +/* + * 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.app.services.model; + +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.IOException; +import javax.swing.Action; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.services.core.Plc4xAddTagGroupAction; +import org.apache.plc4x.app.services.core.Plc4xDelDeviceAction; +import org.apache.plc4x.app.services.core.Plc4xDelTagGroupAction; +import org.apache.plc4x.app.services.core.Plc4xDeviceChildFactory; +import org.apache.plc4x.app.services.core.Plc4xPropertiesNotifier; +import org.openide.actions.OpenLocalExplorerAction; +import org.openide.actions.PropertiesAction; +import org.openide.actions.RenameAction; +import org.openide.nodes.BeanNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.NbBundle.Messages; +import org.openide.util.actions.SystemAction; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; + + +public class Plc4xDeviceNode extends BeanNode implements PropertyChangeListener{ + + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + Plc4xPropertyEnum P; + private final DeviceRecord bean; + private String key; + private PropertyChangeListener listener; + + @Messages("HINT_Plc4xDeviceNode=Represents one Plc4x driver.") + public Plc4xDeviceNode(DeviceRecord bean) throws IntrospectionException { + super(bean, Children.create(new Plc4xDeviceChildFactory(bean), false)); + this.bean = bean; + this.bean.addPropertyChangeListener(this); + setIconBaseWithExtension("org/apache/plc4x/app/services/Device_16x16.png"); + super.setName(this.bean.getDeviceName()); + setShortDescription(this.bean.getDeviceDescription()); + final BeanInfo info = Introspector.getBeanInfo(DeviceRecord.class); + this.setValue("BEAN", bean); + } + + @Override + public Action[] getActions(boolean context) { + Action[] result = new Action[]{ + SystemAction.get(OpenLocalExplorerAction.class), + new Plc4xAddTagGroupAction(this), + new Plc4xDelTagGroupAction(this), + SystemAction.get(RenameAction.class), + null, + new Plc4xDelDeviceAction(this), + SystemAction.get(PropertiesAction.class), + }; + return result; + } + + + @Override + public Action getPreferredAction() { + return SystemAction.get(PropertiesAction.class); + } + + @Override + public Node cloneNode() { + try { + return new Plc4xDeviceNode(bean); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return Node.EMPTY; + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + if (listener != null) { + bean.removePropertyChangeListener(listener); + } + } + + @Override + public boolean canRename() { + return true; + } + + @Override + public void setName(String nue) { + super.setName(nue); + } + + @Override + public boolean canDestroy() { + return true; + } + + @Override + public void destroy() throws IOException { + bean.removePropertyChangeListener(this); + db.removeDevice(bean); + } + + @Override + public void propertyChange(PropertyChangeEvent pce) { + switch (Plc4xPropertyEnum.valueOf(pce.getPropertyName())) { + case NAME: setName((String) this.bean.getDeviceName()); + break; + case DESCRIPTION: setShortDescription(this.bean.getDeviceDescription()); + break; + case ENABLE: { + final Boolean b = (Boolean) pce.getNewValue(); + String str = b ? "org/apache/plc4x/app/services/tag_verde_16x16.png" : + "org/apache/plc4x/app/services/tag_roja_16x16.png"; + setIconBaseWithExtension(str); + } + default:; + } + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xDriverNode.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xDriverNode.java new file mode 100644 index 00000000000..0f37da6a945 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xDriverNode.java @@ -0,0 +1,180 @@ +/* + * 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.app.services.model; + +import java.beans.IntrospectionException; +import java.beans.PropertyChangeListener; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; +import javax.swing.Action; +import javax.swing.event.ChangeListener; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.services.core.Plc4xAddDeviceAction; +import org.apache.plc4x.app.services.core.Plc4xDriverChildFactory; +import org.apache.plc4x.app.services.core.Plc4xPropertiesNotifier; +import org.apache.plc4x.java.api.PlcDriver; +import org.openide.actions.OpenLocalExplorerAction; +import org.openide.actions.PropertiesAction; +import org.openide.actions.ToolsAction; +import org.openide.nodes.BeanNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.nodes.Sheet; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.LookupEvent; +import org.openide.util.LookupListener; +import org.openide.util.NbBundle.Messages; +import org.openide.util.actions.SystemAction; +import org.openide.util.lookup.AbstractLookup; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; + + +public class Plc4xDriverNode extends BeanNode implements LookupListener { + + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + private final DriverRecord bean; + private PropertyChangeListener listener; + private final Lookup.Result plc4xresult; + private final Lookup.Template template = new Lookup.Template(DeviceRecord.class); + + @Messages("HINT_Plc4xDriverNode=Represents one Plc4x driver.") + public Plc4xDriverNode(DriverRecord bean) throws IntrospectionException { + super(bean, Children.create(new Plc4xDriverChildFactory(bean), false)); + this.bean = bean; + setIconBaseWithExtension("org/apache/plc4x/app/services/Driver_16x16.png"); + super.setName(bean.getProtocolName()); + setShortDescription(Bundle.HINT_Plc4xDriverNode()); + + plc4xresult = bean.getLookup().lookup(template); + plc4xresult.addLookupListener(this); + + } + + @Override + public Action[] getActions(boolean context) { + Action[] result = new Action[]{ + SystemAction.get(OpenLocalExplorerAction.class), + new Plc4xAddDeviceAction(this), + null, + null, + SystemAction.get(ToolsAction.class), + SystemAction.get(PropertiesAction.class), + }; + return result; + } + + @Override + public Action getPreferredAction() { + return SystemAction.get(PropertiesAction.class); + } + + @Override + public Node cloneNode() { + try { + return new Plc4xDriverNode(bean); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return null; + } + + @Messages({"PROP_Driver_value=Value", + "HINT_Driver_value=Value of this system property."}) + @Override + protected Sheet createSheet() { + + Sheet sheet = super.createSheet(); + Sheet.Set props = sheet.get(Sheet.PROPERTIES); + /* + if (props == null) { + props = Sheet.createPropertiesSet(); + sheet.put(props); + } + props.put(new PropertySupport.Name(this)); + + class ValueProp extends PropertySupport.ReadWrite { + public ValueProp() { + super("value", String.class, Bundle.PROP_Driver_value(), Bundle.HINT_Driver_value()); + } + + @Override + public Object getValue() { + return System.getProperty(key); + } + + @Override + public void setValue(Object nue) { + System.setProperty(key, (String) nue); + Plc4xPropertiesNotifier.changed(); + } + } + + props.put(new ValueProp()); + Plc4xPropertiesNotifier.addChangeListener(listener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent ev) { + firePropertyChange("value", null, null); + } + }); + */ + return sheet; + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + if (listener != null) { + bean.removePropertyChangeListener(listener); + } + } + + @Override + public boolean canRename() { + return true; + } + + @Override + public void setName(String nue) { + + } + + @Override + public boolean canDestroy() { + return true; + } + + @Override + public void destroy() throws IOException { + + } + + public DriverRecord getDriverRecord() { + return bean; + } + + @Override + public void resultChanged(LookupEvent ev) { + + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xTagGroupNode.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xTagGroupNode.java new file mode 100644 index 00000000000..5550168f1cf --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xTagGroupNode.java @@ -0,0 +1,181 @@ +/* + * 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.app.services.model; + +import java.beans.IntrospectionException; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.IOException; +import java.util.Properties; +import javax.swing.Action; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.services.core.Plc4xAddTagAction; +import org.apache.plc4x.app.services.core.Plc4xDelTagAction; +import org.apache.plc4x.app.services.core.Plc4xPropertiesNotifier; +import org.apache.plc4x.app.services.core.Plc4xTagGroupChildFactory; +import org.openide.actions.DeleteAction; +import org.openide.actions.OpenLocalExplorerAction; +import org.openide.actions.PropertiesAction; +import org.openide.actions.RenameAction; +import org.openide.nodes.BeanNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.nodes.PropertySupport; +import org.openide.nodes.Sheet; +import org.openide.util.Exceptions; +import org.openide.util.NbBundle.Messages; +import org.openide.util.actions.SystemAction; +import org.apache.plc4x.app.api.TagGroupRecord; +import org.openide.util.Lookup; + +/** + * + * @author cgarcia + */ +public class Plc4xTagGroupNode extends BeanNode implements PropertyChangeListener { + + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + private final TagGroupRecord bean; + private String key; + private PropertyChangeListener listener; + + @Messages("HINT_Plc4xTagGroupNode=Represents one Plc4x driver.") + public Plc4xTagGroupNode(TagGroupRecord bean) throws IntrospectionException { + super(bean, Children.create(new Plc4xTagGroupChildFactory(bean), false)); + this.bean = bean; + setIconBaseWithExtension("org/apache/plc4x/app/services/tags_doble_16x16.png"); + super.setName(bean.getTagGroupName()); + setShortDescription(Bundle.HINT_Plc4xTagGroupNode()); + } + + @Override + public Action[] getActions(boolean context) { + Action[] result = new Action[]{ + SystemAction.get(OpenLocalExplorerAction.class), + new Plc4xAddTagAction(this), + new Plc4xDelTagAction(this), + SystemAction.get(RenameAction.class), + null, + SystemAction.get(DeleteAction.class), + SystemAction.get(PropertiesAction.class), + }; + return result; + } + + @Override + public Action getPreferredAction() { + return SystemAction.get(PropertiesAction.class); + } + + @Override + public Node cloneNode() { + try { + return new Plc4xTagGroupNode(bean); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return Node.EMPTY; + } + + @Messages({"PROP_TagGroup_value=Value", + "HINT_TagGroup_value=Value of this system property."}) + @Override + protected Sheet createSheet() { + Sheet sheet = super.createSheet(); + Sheet.Set props = sheet.get(Sheet.PROPERTIES); + if (props == null) { + props = Sheet.createPropertiesSet(); + sheet.put(props); + } + props.put(new PropertySupport.Name(this)); + + class ValueProp extends PropertySupport.ReadWrite { + public ValueProp() { + super("value", String.class, Bundle.PROP_TagGroup_value(), Bundle.HINT_TagGroup_value()); + } + + @Override + public Object getValue() { + return System.getProperty(key); + } + + @Override + public void setValue(Object nue) { + System.setProperty(key, (String) nue); + Plc4xPropertiesNotifier.changed(); + } + } + + props.put(new ValueProp()); + + /* + Plc4xPropertiesNotifier.addChangeListener(listener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent ev) { + firePropertyChange("value", null, null); + } + }); */ + + return sheet; + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + } + + @Override + public boolean canRename() { + return true; + } + + @Override + public void setName(String nue) { + Properties p = System.getProperties(); + String value = p.getProperty(key); + p.remove(key); + + if (value != null) { + p.setProperty(nue, value); + } + + System.setProperties(p); + + Plc4xPropertiesNotifier.changed(); + } + + @Override + public boolean canDestroy() { + return true; + } + + @Override + public void destroy() throws IOException { + bean.removePropertyChangeListener(listener); + db.removeTagGroup(bean.getUUID()); + } + + @Override + public void propertyChange(PropertyChangeEvent pce) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xTagNode.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xTagNode.java new file mode 100644 index 00000000000..8f839a2281b --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/model/Plc4xTagNode.java @@ -0,0 +1,182 @@ +/* + * 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.app.services.model; + +import java.beans.IntrospectionException; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.IOException; +import java.util.Properties; +import javax.swing.Action; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import static org.apache.plc4x.app.api.Plc4xPropertyEnum.DESCRIPTION; +import static org.apache.plc4x.app.api.Plc4xPropertyEnum.ENABLE; +import static org.apache.plc4x.app.api.Plc4xPropertyEnum.NAME; +import org.apache.plc4x.app.services.core.Plc4xPropertiesNotifier; +import org.openide.actions.DeleteAction; +import org.openide.actions.OpenLocalExplorerAction; +import org.openide.actions.PropertiesAction; +import org.openide.actions.RenameAction; +import org.openide.nodes.BeanNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.nodes.PropertySupport; +import org.openide.nodes.Sheet; +import org.openide.util.Exceptions; +import org.openide.util.NbBundle.Messages; +import org.openide.util.actions.SystemAction; +import org.apache.plc4x.app.api.TagRecord; + +/** + * + * @author cgarcia + */ +public class Plc4xTagNode extends BeanNode implements PropertyChangeListener { + + private final TagRecord bean; + private String key; + private ChangeListener listener; + + @Messages("HINT_Plc4xTagNode=Represents one Plc4x driver.") + public Plc4xTagNode(TagRecord bean) throws IntrospectionException { + super(bean, Children.LEAF); + this.bean = bean; + this.bean.addPropertyChangeListener(this); + setIconBaseWithExtension("org/apache/plc4x/app/services/tag_amarilla_linea_16x16.png"); + super.setName(bean.getTagName()); + setShortDescription(Bundle.HINT_Plc4xTagNode()); + } + + @Override + public Action[] getActions(boolean context) { + Action[] result = new Action[]{ + SystemAction.get(OpenLocalExplorerAction.class), + null, + null, + SystemAction.get(RenameAction.class), + null, + SystemAction.get(DeleteAction.class), + SystemAction.get(PropertiesAction.class), + }; + return result; + } + + @Override + public Action getPreferredAction() { + return SystemAction.get(PropertiesAction.class); + } + + @Override + public Node cloneNode() { + try { + return new Plc4xTagNode(bean); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + return Node.EMPTY; + } + + @Messages({"PROP_TagNode_value=Value", + "HINT_TagNode_value=Value of this system property."}) + @Override + protected Sheet createSheet() { + Sheet sheet = super.createSheet(); + Sheet.Set props = sheet.get(Sheet.PROPERTIES); + if (props == null) { + props = Sheet.createPropertiesSet(); + sheet.put(props); + } + props.put(new PropertySupport.Name(this)); + + class ValueProp extends PropertySupport.ReadWrite { + public ValueProp() { + super("value", String.class, Bundle.PROP_TagNode_value(), Bundle.HINT_TagNode_value()); + } + + @Override + public Object getValue() { + return System.getProperty(key); + } + + @Override + public void setValue(Object nue) { + System.setProperty(key, (String) nue); + Plc4xPropertiesNotifier.changed(); + } + } + + props.put(new ValueProp()); + Plc4xPropertiesNotifier.addChangeListener(listener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent ev) { + firePropertyChange("value", null, null); + } + }); + + return sheet; + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + if (listener != null) { + Plc4xPropertiesNotifier.removeChangeListener(listener); + } + } + + @Override + public boolean canRename() { + return true; + } + + @Override + public void setName(String name) { + this.setDisplayName(name); + } + + @Override + public boolean canDestroy() { + return true; + } + + @Override + public void destroy() throws IOException { + + } + + @Override + public void propertyChange(PropertyChangeEvent pce) { + switch (Plc4xPropertyEnum.valueOf(pce.getPropertyName())) { + case NAME: setName((String) this.bean.getTagName()); + break; + case DESCRIPTION: setShortDescription(this.bean.getTagDesc()); + break; + case ENABLE: { + final Boolean b = (Boolean) pce.getNewValue(); + String str = b ? "org/apache/plc4x/app/services/tag_verde_16x16.png" : + "org/apache/plc4x/app/services/tag_roja_16x16.png"; + setIconBaseWithExtension(str); + } + default:; + } + } + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddDeviceDialog.form b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddDeviceDialog.form new file mode 100644 index 00000000000..bc0de5920d0 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddDeviceDialog.form @@ -0,0 +1,368 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddDeviceDialog.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddDeviceDialog.java new file mode 100644 index 00000000000..02ad18b34ed --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddDeviceDialog.java @@ -0,0 +1,439 @@ +/* + * 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.app.services.view; + +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import org.apache.plc4x.app.services.model.Plc4xDriverNode; +import java.beans.IntrospectionException; +import java.io.IOException; +import java.util.UUID; +import javax.swing.JDialog; +import javax.swing.JFrame; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.apache.plc4x.app.services.impl.DeviceRecordImpl; +import org.openide.cookies.InstanceCookie; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; +import org.openide.util.lookup.ServiceProvider; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; + +@ServiceProvider(service=Plc4xAddDeviceDialog.class) +public class Plc4xAddDeviceDialog extends javax.swing.JDialog implements Plc4xDialog { + + private Plc4xPropertyEnum parameters; + private final JFrame myJframe = new javax.swing.JFrame(); + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + Plc4xDriverNode drivernode; + Node[] devicenodes = new Plc4xDeviceNode[1]; + + + public Plc4xAddDeviceDialog() { + super(new javax.swing.JFrame(), true); + initComponents(); + + DeviceRecord device = new DeviceRecordImpl(); + device.setUUID(UUID.randomUUID()); + try { + devicenodes[0] = new Plc4xDeviceNode(device); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + } + + /** + * Creates new form NewJDialog + */ + public Plc4xAddDeviceDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel2 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + tfDeviceProtocol = new javax.swing.JTextField(); + tfDeviceName = new javax.swing.JTextField(); + tfDeviceDesc = new javax.swing.JTextField(); + tfUUID = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + cbEnable = new javax.swing.JCheckBox(); + jPanel1 = new javax.swing.JPanel(); + btOk = new javax.swing.JButton(); + btCancel = new javax.swing.JButton(); + btComms = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + jLabel6 = new javax.swing.JLabel(); + cbS88Tree = new javax.swing.JComboBox<>(); + jLabel7 = new javax.swing.JLabel(); + tfS88Uuid = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.title")); // NOI18N + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jPanel2.border.title"))); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel1.text")); // NOI18N + jLabel1.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel1.toolTipText")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel2.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel3.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel4.text")); // NOI18N + + tfDeviceProtocol.setEditable(false); + tfDeviceProtocol.setText(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.tfDeviceProtocol.text")); // NOI18N + + tfDeviceName.setText(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.tfDeviceName.text")); // NOI18N + + tfDeviceDesc.setText(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.tfDeviceDesc.text")); // NOI18N + + tfUUID.setEditable(false); + tfUUID.setText(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.tfUUID.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel5.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(cbEnable, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.cbEnable.text")); // NOI18N + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel1)) + .addGap(51, 51, 51) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfDeviceProtocol, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(tfDeviceName, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jLabel4) + .addComponent(jLabel5)) + .addGap(29, 29, 29) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbEnable) + .addComponent(tfDeviceDesc) + .addComponent(tfUUID)))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(11, 11, 11) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(tfDeviceProtocol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(tfDeviceName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(12, 12, 12) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(tfDeviceDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(tfUUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbEnable)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel4) + .addGap(18, 18, 18) + .addComponent(jLabel5))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + btOk.setLabel(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.btOk.label")); // NOI18N + btOk.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btOkActionPerformed(evt); + } + }); + + btCancel.setLabel(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.btCancel.label")); // NOI18N + btCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btCancelActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(btComms, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.btComms.text_1")); // NOI18N + btComms.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.btComms.toolTipText")); // NOI18N + btComms.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btCommsActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(btOk, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btComms) + .addGap(89, 89, 89) + .addComponent(btCancel) + .addGap(30, 30, 30)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btOk) + .addComponent(btCancel) + .addComponent(btComms)) + .addContainerGap(29, Short.MAX_VALUE)) + ); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jPanel3.border.title"))); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel6.text")); // NOI18N + + cbS88Tree.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.jLabel7.text")); // NOI18N + + tfS88Uuid.setEditable(false); + tfS88Uuid.setText(org.openide.util.NbBundle.getMessage(Plc4xAddDeviceDialog.class, "Plc4xAddDeviceDialog.tfS88Uuid.text")); // NOI18N + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addComponent(jLabel7)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbS88Tree, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(tfS88Uuid, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(cbS88Tree, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel7) + .addComponent(tfS88Uuid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(10, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed + this.setVisible(false); + }//GEN-LAST:event_btCancelActionPerformed + + private void btOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOkActionPerformed + // TODO add your handling code here: + devicenodes[0].setDisplayName(tfDeviceName.getText()); + + //Everything's okay? Then we attach it to the database and to the representation on the screen + final Plc4xDeviceNode beannode = (Plc4xDeviceNode) devicenodes[0]; + + final InstanceCookie cookie = devicenodes[0].getLookup().lookup(InstanceCookie.class); + + try { + + final DeviceRecord dbr = (DeviceRecord) cookie.instanceCreate(); + dbr.setDeviceName(tfDeviceName.getText()); + dbr.setDeviceDescription(tfDeviceDesc.getText()); + //dbr.setUUID(uuid); + //dbr.setTreeLocation(treenode); + + dbr.setPropertie(parameters.SERIAL_PORT.name(), (String) devicenodes[0].getValue(parameters.SERIAL_PORT.name())); + dbr.setPropertie(parameters.BAUD_RATE.name(), (String) devicenodes[0].getValue(parameters.BAUD_RATE.name())); + dbr.setPropertie(parameters.DATA_BITS.name(), (String) devicenodes[0].getValue(parameters.DATA_BITS.name())); + dbr.setPropertie(parameters.PARITY.name(), (String) devicenodes[0].getValue(parameters.PARITY.name())); + dbr.setPropertie(parameters.STOP_BITS.name(), (String) devicenodes[0].getValue(parameters.STOP_BITS.name())); + dbr.setPropertie(parameters.TIMEOUT.name(), (String) devicenodes[0].getValue(parameters.TIMEOUT.name())); + + + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } catch (ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + } + + drivernode.getChildren().add(devicenodes); + }//GEN-LAST:event_btOkActionPerformed + + private void btCommsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCommsActionPerformed + // TODO add your handling code here: + Lookup lk = Lookups.forPath("Plc4xDriver/" + drivernode.getDriverRecord().getProtocolCode()); + if ( lk != null) { + JDialog dialog = lk.lookup(JDialog.class); + ((Plc4xDialog) dialog).setNode(devicenodes[0]); + dialog.setVisible(true); + } + }//GEN-LAST:event_btCommsActionPerformed + + @Override + public void setNode(Node node) { + if (node instanceof Plc4xDriverNode) { + this.drivernode = (Plc4xDriverNode) node; + tfDeviceProtocol.setText(drivernode.getDriverRecord().getProtocolCode()); + } else + System.out.println("Asignado tipo erroneo"); + } + + @Override + public void setVisible(boolean b) { + super.setVisible(b); + if (b) { + + //Crea nueva instanci o se debe reiniciar todos los parametros; + final DriverRecord driver = db.getDriverByCode(drivernode.getDriverRecord().getProtocolCode()); + DeviceRecord device = new DeviceRecordImpl(); + try { + devicenodes[0] = new Plc4xDeviceNode(device); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + } else { + devicenodes[0] = null; + } + } + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Plc4xAddDeviceDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Plc4xAddDeviceDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Plc4xAddDeviceDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Plc4xAddDeviceDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Plc4xAddDeviceDialog dialog = new Plc4xAddDeviceDialog(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btCancel; + private javax.swing.JButton btComms; + private javax.swing.JButton btOk; + private javax.swing.JCheckBox cbEnable; + private javax.swing.JComboBox cbS88Tree; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JTextField tfDeviceDesc; + private javax.swing.JTextField tfDeviceName; + private javax.swing.JTextField tfDeviceProtocol; + private javax.swing.JTextField tfS88Uuid; + private javax.swing.JTextField tfUUID; + // End of variables declaration//GEN-END:variables + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagDialog.form b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagDialog.form new file mode 100644 index 00000000000..f0430f58cb6 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagDialog.form @@ -0,0 +1,411 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagDialog.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagDialog.java new file mode 100644 index 00000000000..2529d7685fb --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagDialog.java @@ -0,0 +1,473 @@ +/* + * 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.app.services.view; + +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import org.apache.plc4x.app.services.model.Plc4xDriverNode; +import java.beans.IntrospectionException; +import java.io.IOException; +import java.util.Optional; +import java.util.UUID; +import javax.swing.JDialog; +import javax.swing.JFrame; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.apache.plc4x.app.services.impl.DeviceRecordImpl; +import org.openide.cookies.InstanceCookie; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; +import org.openide.util.lookup.ServiceProvider; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; +import org.apache.plc4x.app.api.TagGroupRecord; +import org.apache.plc4x.app.api.TagRecord; +import org.apache.plc4x.app.services.model.Plc4xTagGroupNode; +import org.apache.plc4x.app.services.model.Plc4xTagNode; +import org.apache.plc4x.java.api.types.PlcValueType; + +@ServiceProvider(service=Plc4xDialog.class, path="Plc4xDriver/tag") +public class Plc4xAddTagDialog extends javax.swing.JDialog implements Plc4xDialog { + + private Plc4xPropertyEnum parameters; + private final JFrame myJframe = new javax.swing.JFrame(); + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + Plc4xTagGroupNode taggroupnode; + Node[] tagnodes = new Plc4xTagNode[1]; + + + public Plc4xAddTagDialog() { + super(new javax.swing.JFrame(), true); + initComponents(); + initComponentsApp(); + } + + /** + * Creates new form NewJDialog + */ + public Plc4xAddTagDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + initComponentsApp(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel2 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + tfTagGroup = new javax.swing.JTextField(); + tfTagName = new javax.swing.JTextField(); + tfTagDesc = new javax.swing.JTextField(); + tfUUID = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + cbEnableOutput = new javax.swing.JCheckBox(); + jLabel8 = new javax.swing.JLabel(); + cbEnable = new javax.swing.JCheckBox(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + cbPlcTypes = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + tfTagAddress = new javax.swing.JTextField(); + jLabel9 = new javax.swing.JLabel(); + cbIsArray = new javax.swing.JCheckBox(); + tfArraySize = new javax.swing.JTextField(); + jPanel1 = new javax.swing.JPanel(); + btOk = new javax.swing.JButton(); + btCancel = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.title")); // NOI18N + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jPanel2.border.title"))); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel1.text")); // NOI18N + jLabel1.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel1.toolTipText")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel2.text")); // NOI18N + jLabel2.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel2.toolTipText")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel3.text")); // NOI18N + jLabel3.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel3.toolTipText")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel4.text")); // NOI18N + + tfTagGroup.setEditable(false); + tfTagGroup.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.tfTagGroup.text")); // NOI18N + + tfTagName.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.tfTagName.text")); // NOI18N + + tfTagDesc.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.tfTagDesc.text")); // NOI18N + + tfUUID.setEditable(false); + tfUUID.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.tfUUID.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel5.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(cbEnableOutput, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.cbEnableOutput.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel8.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(cbEnable, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.cbEnable.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel6.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel7.text")); // NOI18N + + cbPlcTypes.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jButton1.text")); // NOI18N + jButton1.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jButton1.toolTipText")); // NOI18N + + tfTagAddress.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.tfTagAddress.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel9, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel9.text")); // NOI18N + jLabel9.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.jLabel9.toolTipText")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(cbIsArray, org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.cbIsArray.text")); // NOI18N + cbIsArray.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cbIsArrayActionPerformed(evt); + } + }); + + tfArraySize.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.tfArraySize.text")); // NOI18N + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel1)) + .addGap(67, 67, 67) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfTagGroup, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(tfTagName, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jLabel4) + .addComponent(jLabel8) + .addComponent(jLabel5) + .addComponent(jLabel7) + .addComponent(jLabel6) + .addComponent(jLabel9)) + .addGap(29, 29, 29) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfTagDesc) + .addComponent(tfUUID) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(cbEnableOutput, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbEnable, javax.swing.GroupLayout.Alignment.LEADING)) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(tfTagAddress)) + .addGap(18, 18, 18) + .addComponent(jButton1)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addComponent(tfArraySize) + .addGap(18, 18, 18) + .addComponent(cbIsArray)) + .addComponent(cbPlcTypes, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 0, Short.MAX_VALUE))))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(11, 11, 11) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(tfTagGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(tfTagName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(12, 12, 12) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(tfTagDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfUUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1) + .addComponent(tfTagAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(cbPlcTypes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(jLabel9)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tfArraySize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cbIsArray)))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(cbEnableOutput, javax.swing.GroupLayout.Alignment.TRAILING)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(cbEnable, javax.swing.GroupLayout.Alignment.TRAILING)) + .addGap(27, 27, 27)) + ); + + btOk.setLabel(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.btOk.label")); // NOI18N + btOk.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btOkActionPerformed(evt); + } + }); + + btCancel.setLabel(org.openide.util.NbBundle.getMessage(Plc4xAddTagDialog.class, "Plc4xAddTagDialog.btCancel.label")); // NOI18N + btCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btCancelActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(btOk, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btCancel) + .addGap(30, 30, 30)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btOk) + .addComponent(btCancel)) + .addContainerGap(29, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed + this.setVisible(false); + }//GEN-LAST:event_btCancelActionPerformed + + private void btOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOkActionPerformed + // TODO add your handling code here: + TagRecord tag = db.createTagDBRecord(); + tag.setUUID(UUID.randomUUID()); + + try { + tagnodes[0] = new Plc4xTagNode(tag); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + + tagnodes[0].setDisplayName(tfTagName.getText()); + + //Everything's okay? Then we attach it to the database and to the representation on the screen + final Plc4xTagNode beannode = (Plc4xTagNode) tagnodes[0]; + + final InstanceCookie cookie = tagnodes[0].getLookup().lookup(InstanceCookie.class); + + try { + + tag = (TagRecord) cookie.instanceCreate(); + tag.setTagName(tfTagName.getText()); + tag.setTagDesc(tfTagDesc.getText()); + + //dbr.setUUID(uuid); + //dbr.setTreeLocation(treenode); + System.out.println("Nombre fel TagGroup: " + taggroupnode.getDisplayName()); + Optional optagg = db.getTagGroup(taggroupnode.getDisplayName()); + if (optagg.isPresent()){ + System.out.println("Encontro el TagGroup..."); + optagg.get().addTag(tag); + } + + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } catch (ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + } + + taggroupnode.getChildren().add(tagnodes); + this.setVisible(false); + }//GEN-LAST:event_btOkActionPerformed + + private void cbIsArrayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbIsArrayActionPerformed + // TODO add your handling code here: + if (cbIsArray.isSelected()) { + tfArraySize.setEnabled(true); + } else { + tfArraySize.setEnabled(false); + } + }//GEN-LAST:event_cbIsArrayActionPerformed + + @Override + public void setNode(Node node) { + if (node instanceof Plc4xTagGroupNode) { + this.taggroupnode = (Plc4xTagGroupNode) node; + tfTagGroup.setText(taggroupnode.getDisplayName()); + } else + System.out.println("Asignado tipo erroneo"); + } + + @Override + public void setVisible(boolean b) { + super.setVisible(b); + } + + private void initComponentsApp() { + cbPlcTypes.removeAllItems(); + for (PlcValueType plctype:PlcValueType.values()){ + cbPlcTypes.addItem(plctype.name()); + } + tfArraySize.setEnabled(false); + } + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + // + // + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Plc4xAddTagDialog dialog = new Plc4xAddTagDialog(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btCancel; + private javax.swing.JButton btOk; + private javax.swing.JCheckBox cbEnable; + private javax.swing.JCheckBox cbEnableOutput; + private javax.swing.JCheckBox cbIsArray; + private javax.swing.JComboBox cbPlcTypes; + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JTextField tfArraySize; + private javax.swing.JTextField tfTagAddress; + private javax.swing.JTextField tfTagDesc; + private javax.swing.JTextField tfTagGroup; + private javax.swing.JTextField tfTagName; + private javax.swing.JTextField tfUUID; + // End of variables declaration//GEN-END:variables + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagGroupDialog.form b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagGroupDialog.form new file mode 100644 index 00000000000..2c14a6899d0 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagGroupDialog.form @@ -0,0 +1,296 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagGroupDialog.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagGroupDialog.java new file mode 100644 index 00000000000..1e83fd27fed --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xAddTagGroupDialog.java @@ -0,0 +1,383 @@ +/* + * 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.app.services.view; + +import org.apache.plc4x.app.services.model.Plc4xDeviceNode; +import org.apache.plc4x.app.services.model.Plc4xDriverNode; +import java.beans.IntrospectionException; +import java.io.IOException; +import java.util.Optional; +import java.util.UUID; +import javax.swing.JDialog; +import javax.swing.JFrame; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.api.Plc4xDialog; +import org.apache.plc4x.app.api.Plc4xPropertyEnum; +import org.apache.plc4x.app.services.impl.DeviceRecordImpl; +import org.openide.cookies.InstanceCookie; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; +import org.openide.util.lookup.ServiceProvider; +import org.apache.plc4x.app.api.DeviceRecord; +import org.apache.plc4x.app.api.DriverRecord; +import org.apache.plc4x.app.api.TagGroupRecord; +import org.apache.plc4x.app.services.model.Plc4xTagGroupNode; + +@ServiceProvider(service=Plc4xDialog.class, path="Plc4xDriver/taggroup") +public class Plc4xAddTagGroupDialog extends javax.swing.JDialog implements Plc4xDialog { + + private Plc4xPropertyEnum P; + private final JFrame myJframe = new javax.swing.JFrame(); + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + Plc4xDeviceNode devicenode; + Node[] taggnodes = new Plc4xTagGroupNode[1]; + + + public Plc4xAddTagGroupDialog() { + super(new javax.swing.JFrame(), true); + initComponents(); + } + + /** + * Creates new form NewJDialog + */ + public Plc4xAddTagGroupDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel2 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + tfDeviceName = new javax.swing.JTextField(); + tfTagGroupName = new javax.swing.JTextField(); + tfTagGroupDesc = new javax.swing.JTextField(); + tfUUID = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + cbEnable = new javax.swing.JCheckBox(); + jLabel8 = new javax.swing.JLabel(); + tfScanTime = new javax.swing.JTextField(); + jPanel1 = new javax.swing.JPanel(); + btOk = new javax.swing.JButton(); + btCancel = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.title")); // NOI18N + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jPanel2.border.title"))); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jLabel1.text")); // NOI18N + jLabel1.setToolTipText(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jLabel1.toolTipText")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jLabel2.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jLabel3.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jLabel4.text")); // NOI18N + + tfDeviceName.setEditable(false); + tfDeviceName.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.tfDeviceName.text")); // NOI18N + + tfTagGroupName.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.tfTagGroupName.text")); // NOI18N + + tfTagGroupDesc.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.tfTagGroupDesc.text")); // NOI18N + + tfUUID.setEditable(false); + tfUUID.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.tfUUID.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jLabel5.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(cbEnable, org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.cbEnable.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.jLabel8.text")); // NOI18N + + tfScanTime.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + tfScanTime.setText(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.tfScanTime.text")); // NOI18N + tfScanTime.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tfScanTimeActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel1)) + .addGap(70, 70, 70) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfDeviceName, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(tfTagGroupName, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jLabel4) + .addComponent(jLabel8) + .addComponent(jLabel5)) + .addGap(29, 29, 29) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbEnable) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfTagGroupDesc) + .addComponent(tfUUID) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(tfScanTime, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)))))) + .addContainerGap(7, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(11, 11, 11) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(tfDeviceName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(tfTagGroupName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(12, 12, 12) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(tfTagGroupDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tfUUID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel8) + .addComponent(tfScanTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel5) + .addGap(28, 28, 28)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbEnable) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + ); + + btOk.setLabel(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.btOk.label")); // NOI18N + btOk.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btOkActionPerformed(evt); + } + }); + + btCancel.setLabel(org.openide.util.NbBundle.getMessage(Plc4xAddTagGroupDialog.class, "Plc4xAddTagGroupDialog.btCancel.label")); // NOI18N + btCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btCancelActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(btOk, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btCancel) + .addGap(30, 30, 30)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btOk) + .addComponent(btCancel)) + .addContainerGap(29, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed + this.setVisible(false); + }//GEN-LAST:event_btCancelActionPerformed + + private void btOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOkActionPerformed + // TODO add your handling code here: + TagGroupRecord tagg = db.createTagGroupDBRecord(); + + tagg.setUUID(UUID.randomUUID()); + try { + taggnodes[0] = new Plc4xTagGroupNode(tagg); + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + } + + taggnodes[0].setDisplayName(tfTagGroupName.getText()); + + + final InstanceCookie cookie = taggnodes[0].getLookup().lookup(InstanceCookie.class); + + try { + + final TagGroupRecord taggr = (TagGroupRecord) cookie.instanceCreate(); + + taggr.setTagGroupName(tfTagGroupName.getText()); + taggr.setTagGroupDesc(tfTagGroupDesc.getText()); + taggr.setScanTime(Integer.decode(tfScanTime.getText())); + taggr.setEnable(cbEnable.isSelected()); + + Optional dev = db.getDevice(devicenode.getDisplayName()); + if (dev.isPresent()){ + System.out.println("Agrego el TagGroupRecord..."); + db.addTagGroup(dev.get().getUUID(), taggr); + } + + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } catch (ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + } + + devicenode.getChildren().add(taggnodes); + this.setVisible(false); + }//GEN-LAST:event_btOkActionPerformed + + private void tfScanTimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfScanTimeActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_tfScanTimeActionPerformed + + @Override + public void setNode(Node node) { + if (node instanceof Plc4xDeviceNode) { + this.devicenode = (Plc4xDeviceNode) node; + tfDeviceName.setText(devicenode.getDisplayName()); + } + } + + @Override + public void setVisible(boolean b) { + super.setVisible(b); + } + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagGroupDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagGroupDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagGroupDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Plc4xAddTagGroupDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Plc4xAddTagGroupDialog dialog = new Plc4xAddTagGroupDialog(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btCancel; + private javax.swing.JButton btOk; + private javax.swing.JCheckBox cbEnable; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel8; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JTextField tfDeviceName; + private javax.swing.JTextField tfScanTime; + private javax.swing.JTextField tfTagGroupDesc; + private javax.swing.JTextField tfTagGroupName; + private javax.swing.JTextField tfUUID; + // End of variables declaration//GEN-END:variables + + +} diff --git a/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xRootNode.java b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xRootNode.java new file mode 100644 index 00000000000..1f3f992a1f7 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/java/org/apache/plc4x/app/services/view/Plc4xRootNode.java @@ -0,0 +1,93 @@ +/* + * 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.app.services.view; + +import java.awt.Image; +import java.beans.IntrospectionException; +import javax.swing.Action; +import org.apache.plc4x.app.api.MasterDB; +import org.apache.plc4x.app.services.core.Plc4xRootChildFactory; +import org.apache.plc4x.app.services.core.Plc4xRootNodeSaveAction; +import org.netbeans.api.core.ide.ServicesTabNodeRegistration; +import org.openide.actions.OpenLocalExplorerAction; +import org.openide.actions.PropertiesAction; +import org.openide.actions.ToolsAction; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.util.ImageUtilities; +import org.openide.util.Lookup; +import org.openide.util.LookupEvent; +import org.openide.util.LookupListener; +import org.openide.util.NbBundle.Messages; +import org.openide.util.actions.SystemAction; + +@ServicesTabNodeRegistration(name = "Plc4xRootNode", + displayName = "#LBL_Plc4xRootNode", + shortDescription = "#HINT_Plc4xRootNode", + iconResource = "org/apache/plc4x/app/services/toddy_s7_16x16.png", + position = 2021) +@Messages({"LBL_Plc4xRootNode=Plc4x Drivers", + "HINT_Plc4xRootNode=Shows all currently set system properties." }) +public class Plc4xRootNode extends AbstractNode implements LookupListener { + + public final Image closeicon = ImageUtilities.loadImage("org/apache/plc4x/app/services/toddy_s7_16x16.png"); + public final Image openicon = ImageUtilities.loadImage("org/apache/plc4x/app/services/toddy_s7_16x16.png"); + + private final MasterDB db = Lookup.getDefault().lookup(MasterDB.class); + + public Plc4xRootNode() throws IntrospectionException { + super(Children.create(new Plc4xRootChildFactory(), false)); + setDisplayName(Bundle.LBL_Plc4xRootNode()); + setShortDescription(Bundle.HINT_Plc4xRootNode()); + } + + + @Override + public javax.swing.Action[] getActions(boolean context) { + Action[] result = new Action[]{ + null, + null, + SystemAction.get(OpenLocalExplorerAction.class), + null, + new Plc4xRootNodeSaveAction(), + null, + SystemAction.get(ToolsAction.class), + SystemAction.get(PropertiesAction.class),}; + return result; + } + + @Override + public Image getIcon(int type) { + return closeicon; + } + + @Override + public Image getOpenedIcon(int type) { + return openicon; + } + + @Override + public void resultChanged(LookupEvent ev) { + + } + + + + +} diff --git a/plc4j/tools/app/app-services/src/main/nbm/manifest.mf b/plc4j/tools/app/app-services/src/main/nbm/manifest.mf new file mode 100644 index 00000000000..10fd8bcde4c --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/nbm/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +OpenIDE-Module-Localizing-Bundle: org/apache/plc4x/app/services/Bundle.properties + diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Bundle.properties b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Bundle.properties new file mode 100644 index 00000000000..1c9e9996ca7 --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Bundle.properties @@ -0,0 +1,6 @@ +#Localized module labels. Defaults taken from POM (, , ) if unset. +#OpenIDE-Module-Name= +#OpenIDE-Module-Short-Description= +#OpenIDE-Module-Long-Description= +#OpenIDE-Module-Display-Category= +#Tue Dec 20 00:32:01 VET 2022 diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Device_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Device_16x16.png new file mode 100644 index 00000000000..6d01942c38b Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Device_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Driver_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Driver_16x16.png new file mode 100644 index 00000000000..52cc354c631 Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/Driver_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/core/Bundle.properties b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/core/Bundle.properties new file mode 100644 index 00000000000..a4a6fc444cb --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/core/Bundle.properties @@ -0,0 +1,3 @@ +Plc4xAddDeviceDialog.jButton1.text=jButton1 +Plc4xAddDeviceDialog.jButton2.text=jButton2 +Plc4xAddDeviceDialog.title=Add Device diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_amarilla_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_amarilla_16x16.png new file mode 100644 index 00000000000..f0e2b3df070 Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_amarilla_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_amarilla_linea_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_amarilla_linea_16x16.png new file mode 100644 index 00000000000..402f24a7fde Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_amarilla_linea_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_resaltada_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_resaltada_16x16.png new file mode 100644 index 00000000000..3c274663bbe Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_resaltada_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_roja_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_roja_16x16.png new file mode 100644 index 00000000000..65074cd73f2 Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_roja_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_rojo_lineas_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_rojo_lineas_16x16.png new file mode 100644 index 00000000000..f1dcac16d35 Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_rojo_lineas_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_verde_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_verde_16x16.png new file mode 100644 index 00000000000..eb2c101daa6 Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_verde_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_verde_linea_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_verde_linea_16x16.png new file mode 100644 index 00000000000..c522611e759 Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tag_verde_linea_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tags_doble_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tags_doble_16x16.png new file mode 100644 index 00000000000..24f7615fa68 Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/tags_doble_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/toddy_s7_16x16.png b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/toddy_s7_16x16.png new file mode 100644 index 00000000000..35e8793612f Binary files /dev/null and b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/toddy_s7_16x16.png differ diff --git a/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/view/Bundle.properties b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/view/Bundle.properties new file mode 100644 index 00000000000..5272193d36f --- /dev/null +++ b/plc4j/tools/app/app-services/src/main/resources/org/apache/plc4x/app/services/view/Bundle.properties @@ -0,0 +1,77 @@ + +# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template + + +Plc4xAddDeviceDialog.jLabel5.text=Enable: +Plc4xAddDeviceDialog.tfS88Uuid.text= +Plc4xAddDeviceDialog.tfUUID.text= +Plc4xAddDeviceDialog.jLabel7.text=UUID: +Plc4xAddDeviceDialog.tfDeviceDesc.text= +Plc4xAddDeviceDialog.tfDeviceName.text= +Plc4xAddDeviceDialog.tfDeviceProtocol.text= +Plc4xAddDeviceDialog.jLabel4.text=UUID: +Plc4xAddDeviceDialog.jLabel3.text=Device Protocol: +Plc4xAddDeviceDialog.jLabel2.text=Device Description: +Plc4xAddDeviceDialog.jLabel1.toolTipText= +Plc4xAddDeviceDialog.jLabel1.text=Device Name: +Plc4xAddDeviceDialog.jPanel2.border.title=Device +Plc4xAddDeviceDialog.jLabel6.text=Node: +Plc4xAddDeviceDialog.jPanel3.border.title=S88 Tree +Plc4xAddDeviceDialog.btComms.toolTipText= +Plc4xAddDeviceDialog.btComms.text_1=Comms +Plc4xAddDeviceDialog.btCancel.label=Cancel +Plc4xAddDeviceDialog.btOk.label=Ok +Plc4xAddDeviceDialog.cbEnable.text= +Plc4xAddTagGroupDialog.jLabel1.text=Tag group name: +Plc4xAddTagGroupDialog.jPanel2.border.title=Tag group +Plc4xAddTagGroupDialog.cbEnable.text= +Plc4xAddTagGroupDialog.title=Add Device + +# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template + +Plc4xAddTagGroupDialog.jLabel5.text=Enable: +Plc4xAddTagGroupDialog.tfUUID.text= +Plc4xAddTagGroupDialog.jLabel4.text=UUID: +Plc4xAddTagGroupDialog.jLabel3.text=Device: +Plc4xAddTagGroupDialog.btCancel.label=Cancel +Plc4xAddTagGroupDialog.jLabel2.text=Tag group description: +Plc4xAddTagGroupDialog.btOk.label=Ok +Plc4xAddTagGroupDialog.jLabel1.toolTipText= +Plc4xAddTagDialog.title=Add Device + +# Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +# Click nbfs://nbhost/SystemFileSystem/Templates/Other/properties.properties to edit this template +Plc4xAddTagDialog.jLabel5.text=Enable output: +Plc4xAddTagDialog.tfUUID.text= +Plc4xAddTagDialog.jLabel4.text=UUID: +Plc4xAddTagDialog.jLabel3.text=Tag group: +Plc4xAddTagDialog.btCancel.label=Cancel +Plc4xAddTagDialog.jLabel2.text=Tag description: +Plc4xAddTagDialog.btOk.label=Ok +Plc4xAddTagDialog.jLabel1.toolTipText= +Plc4xAddTagDialog.jLabel1.text=Tag name: +Plc4xAddTagDialog.jPanel2.border.title=Tag +Plc4xAddTagGroupDialog.jLabel8.text=Scan time (ms): +Plc4xAddTagDialog.jLabel3.toolTipText= +Plc4xAddTagDialog.jLabel2.toolTipText= +Plc4xAddTagDialog.jLabel8.text=Enable: +Plc4xAddTagGroupDialog.tfTagGroupName.text= +Plc4xAddTagGroupDialog.tfTagGroupDesc.text= +Plc4xAddTagGroupDialog.tfScanTime.text=1000 +Plc4xAddTagGroupDialog.tfDeviceName.text= +Plc4xAddTagDialog.tfTagName.text= +Plc4xAddTagDialog.tfTagDesc.text= +Plc4xAddTagDialog.cbEnableOutput.text= +Plc4xAddTagDialog.tfTagGroup.text= +Plc4xAddTagDialog.jLabel6.text=Tag address: +Plc4xAddTagDialog.jLabel7.text=Type: +Plc4xAddTagDialog.jButton1.text=Test +Plc4xAddTagDialog.jButton1.toolTipText= +Plc4xAddTagDialog.tfTagAddress.text= +Plc4xAddTagDialog.jLabel9.text=Array size: +Plc4xAddTagDialog.jLabel9.toolTipText= +Plc4xAddTagDialog.tfArraySize.text= +Plc4xAddTagDialog.cbIsArray.text=Is Array +Plc4xAddTagDialog.cbEnable.text= diff --git a/plc4j/tools/app/application/pom.xml b/plc4j/tools/app/application/pom.xml new file mode 100644 index 00000000000..2cbd9899e13 --- /dev/null +++ b/plc4j/tools/app/application/pom.xml @@ -0,0 +1,141 @@ + + + + 4.0.0 + + org.apache.plc4x + app-parent + 0.11.0-SNAPSHOT + + + app-app + nbm-application + + app-app + + + UTF-8 + ${project.build.directory}/${brandingToken} + ssss + + + + + org.netbeans.cluster + platform + ${netbeans.version} + pom + + + ${project.groupId} + app-branding + ${project.version} + + + + org.netbeans.api + org-netbeans-modules-nbjunit + ${netbeans.version} + test + + + + ${project.groupId} + plc4x-services + ${project.version} + + + ${project.groupId} + app-services + ${project.version} + + + ${project.groupId} + app-modbus + ${project.version} + + + ${project.groupId} + app-libs + ${project.version} + + + + + + + org.apache.netbeans.utilities + nbm-maven-plugin + true + + + org.openide.util.lookup.Lookup + org.openide.util.lookup.AbstractLookup + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.2 + + + ${all.clusters} + ${brandingToken} + + -Xmx4096m + + + + + + + + deployment + + + + org.apache.netbeans.utilities + nbm-maven-plugin + + + extra + + autoupdate + webstart-app + build-installers + + + + + + + + + diff --git a/plc4j/tools/app/application/src/test/java/org/apache/plc4x/app/ApplicationTest.java b/plc4j/tools/app/application/src/test/java/org/apache/plc4x/app/ApplicationTest.java new file mode 100644 index 00000000000..49608a3e8bf --- /dev/null +++ b/plc4j/tools/app/application/src/test/java/org/apache/plc4x/app/ApplicationTest.java @@ -0,0 +1,50 @@ +/* + * 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.app; + +import java.util.logging.Level; +import junit.framework.Test; +import org.netbeans.junit.NbModuleSuite; +import org.netbeans.junit.NbTestCase; + +public class ApplicationTest extends NbTestCase { + + public static Test suite() { + return NbModuleSuite.createConfiguration(ApplicationTest.class). + gui(false). + failOnMessage(Level.WARNING). // works at least in RELEASE71 + failOnException(Level.INFO). + enableClasspathModules(false). + clusters(".*"). + suite(); // RELEASE71+, else use NbModuleSuite.create(NbModuleSuite.createConfiguration(...)) + } + + public ApplicationTest(String n) { + super(n); + } + + public void testApplication() { + // pass if there are merely no warnings/exceptions + /* Example of using Jelly Tools (additional test dependencies required) with gui(true): + new ActionNoBlock("Help|About", null).performMenu(); + new NbDialogOperator("About").closeByButton(); + */ + } + +} diff --git a/plc4j/tools/app/branding/pom.xml b/plc4j/tools/app/branding/pom.xml new file mode 100644 index 00000000000..572aae5f331 --- /dev/null +++ b/plc4j/tools/app/branding/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + org.apache.plc4x + app-parent + 0.11.0-SNAPSHOT + + + app-branding + nbm + + app-branding + + + UTF-8 + + + + + org.netbeans.api + org-netbeans-api-annotations-common + ${netbeans.version} + runtime + + + + + + + org.apache.netbeans.utilities + nbm-maven-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + + + diff --git a/plc4j/tools/app/branding/src/main/nbm/manifest.mf b/plc4j/tools/app/branding/src/main/nbm/manifest.mf new file mode 100644 index 00000000000..f32474f41f3 --- /dev/null +++ b/plc4j/tools/app/branding/src/main/nbm/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +OpenIDE-Module-Localizing-Bundle: org/apache/plc4x/app/branding/Bundle.properties +AutoUpdate-Essential-Module: true diff --git a/plc4j/tools/app/branding/src/main/resources/org/apache/plc4x/app/branding/Bundle.properties b/plc4j/tools/app/branding/src/main/resources/org/apache/plc4x/app/branding/Bundle.properties new file mode 100644 index 00000000000..e9991764a26 --- /dev/null +++ b/plc4j/tools/app/branding/src/main/resources/org/apache/plc4x/app/branding/Bundle.properties @@ -0,0 +1,5 @@ +# Localized module labels. Defaults taken from POM (, , ) if unset. +#OpenIDE-Module-Name= +#OpenIDE-Module-Short-Description= +#OpenIDE-Module-Long-Description= +#OpenIDE-Module-Display-Category= diff --git a/plc4j/tools/app/pom.xml b/plc4j/tools/app/pom.xml new file mode 100644 index 00000000000..35e249e7912 --- /dev/null +++ b/plc4j/tools/app/pom.xml @@ -0,0 +1,115 @@ + + + + 4.0.0 + + plc4j-tools + org.apache.plc4x + 0.11.0-SNAPSHOT + + + org.apache.plc4x + app-parent + 0.11.0-SNAPSHOT + pom + + app-parent + + + + + + org.apache.netbeans.utilities + nbm-maven-plugin + 14.0-SNAPSHOT + true + + ${brandingToken} + ${brandingToken} + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + javac + ${java.version} + ${java.version} + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.2 + + + org.apache.maven.plugins + maven-dependency-plugin + 3.4.0 + + + check-dependencies + + analyze-only + + + true + + + + + + junit:junit:jar + + + + org.apache.plc4x:app-services + org.apache.plc4x:app-modbus + org.apache.plc4x:plc4x-services + org.apache.plc4x:app-libs + org.netbeans.cluster:platform + org.apache.plc4x:app-branding + + + + + + + + + + + + + + + branding + application + app-services + app-libs + app-modbus + + + RELEASE160 + app + + diff --git a/plc4j/tools/pom.xml b/plc4j/tools/pom.xml index c3fbe156a47..15357568c1d 100644 --- a/plc4j/tools/pom.xml +++ b/plc4j/tools/pom.xml @@ -1,4 +1,4 @@ - + - - + --> + + 4.0.0 - + + + + org.apache.plc4x + + plc4j + + 0.11.0-SNAPSHOT + + - + + plc4j-tools + + pom - + + PLC4J: Tools + + A collection of tools that provide additional services to users. - + + + + capture-replay + + connection-cache + + connection-pool + + opm + + plc4x-server + + scraper + + ui + + + app + + - \ No newline at end of file + diff --git a/plc4net/.gitignore b/plc4net/.gitignore old mode 100644 new mode 100755 diff --git a/plc4net/Makefile b/plc4net/Makefile old mode 100644 new mode 100755 diff --git a/plc4net/api/PlcDriverManager.cs b/plc4net/api/PlcDriverManager.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/IPlcConnection.cs b/plc4net/api/api/IPlcConnection.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/IPlcDriver.cs b/plc4net/api/api/IPlcDriver.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/authentication/IPlcAuthentication.cs b/plc4net/api/api/authentication/IPlcAuthentication.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/authentication/PlcUsernamePasswordAuthentication.cs b/plc4net/api/api/authentication/PlcUsernamePasswordAuthentication.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/exceptions/PlcConnectionException.cs b/plc4net/api/api/exceptions/PlcConnectionException.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/exceptions/PlcException.cs b/plc4net/api/api/exceptions/PlcException.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/exceptions/PlcInvalidFieldException.cs b/plc4net/api/api/exceptions/PlcInvalidFieldException.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcFieldRequest.cs b/plc4net/api/api/messages/IPlcFieldRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcFieldResponse.cs b/plc4net/api/api/messages/IPlcFieldResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcMessage.cs b/plc4net/api/api/messages/IPlcMessage.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcReadRequest.cs b/plc4net/api/api/messages/IPlcReadRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcReadRequestBuilder.cs b/plc4net/api/api/messages/IPlcReadRequestBuilder.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcReadResponse.cs b/plc4net/api/api/messages/IPlcReadResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcRequest.cs b/plc4net/api/api/messages/IPlcRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcRequestBuilder.cs b/plc4net/api/api/messages/IPlcRequestBuilder.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcResponse.cs b/plc4net/api/api/messages/IPlcResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcSubscriptionEventArgs.cs b/plc4net/api/api/messages/IPlcSubscriptionEventArgs.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcSubscriptionRequest.cs b/plc4net/api/api/messages/IPlcSubscriptionRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcSubscriptionRequestBuilder.cs b/plc4net/api/api/messages/IPlcSubscriptionRequestBuilder.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcSubscriptionResponse.cs b/plc4net/api/api/messages/IPlcSubscriptionResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcUnsubscriptionRequest.cs b/plc4net/api/api/messages/IPlcUnsubscriptionRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcUnsubscriptionRequestBuilder.cs b/plc4net/api/api/messages/IPlcUnsubscriptionRequestBuilder.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcUnsubscriptionResponse.cs b/plc4net/api/api/messages/IPlcUnsubscriptionResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcWriteRequest.cs b/plc4net/api/api/messages/IPlcWriteRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/messages/IPlcWriteRequestBuilder.cs b/plc4net/api/api/messages/IPlcWriteRequestBuilder.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/metadata/IPlcConnectionMetadata.cs b/plc4net/api/api/metadata/IPlcConnectionMetadata.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/model/IPlcField.cs b/plc4net/api/api/model/IPlcField.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/model/IPlcSubscriptionHandle.cs b/plc4net/api/api/model/IPlcSubscriptionHandle.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/types/PlcResponseCode.cs b/plc4net/api/api/types/PlcResponseCode.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/api/value/IPlcValue.cs b/plc4net/api/api/value/IPlcValue.cs old mode 100644 new mode 100755 diff --git a/plc4net/api/plc4net-api.csproj b/plc4net/api/plc4net-api.csproj old mode 100644 new mode 100755 diff --git a/plc4net/api/pom.xml b/plc4net/api/pom.xml old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip-test/plc4net-driver-knxproj-test.csproj b/plc4net/drivers/knxnetip-test/plc4net-driver-knxproj-test.csproj old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip-test/resources/logback-test.xml b/plc4net/drivers/knxnetip-test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip-test/resources/protocols/knxnetip/ParserSerializerTestsuite.xml b/plc4net/drivers/knxnetip-test/resources/protocols/knxnetip/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip-test/test/knxnetip/readwrite/model/KnxDatapointTests.cs b/plc4net/drivers/knxnetip-test/test/knxnetip/readwrite/model/KnxDatapointTests.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj b/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/AccessLevel.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/AccessLevel.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/Apdu.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/Apdu.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControl.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControl.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlAck.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlAck.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlConnect.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlConnect.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlContainer.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlContainer.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlDisconnect.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlDisconnect.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlNack.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduControlNack.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduData.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduData.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataAdcRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataAdcRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataAdcResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataAdcResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataContainer.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataContainer.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataDeviceDescriptorRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataDeviceDescriptorRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataDeviceDescriptorResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataDeviceDescriptorResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExt.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExt.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtAuthorizeRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtAuthorizeRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtAuthorizeResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtAuthorizeResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSelectiveRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSelectiveRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressSerialNumberWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtDomainAddressWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtFileStreamInfoReport.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtFileStreamInfoReport.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueInfoReport.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueInfoReport.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtGroupPropertyValueWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtIndividualAddressSerialNumberWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtKeyResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtKeyResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtKeyWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtKeyWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtLinkRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtLinkRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtLinkResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtLinkResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtLinkWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtLinkWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtMemoryBitWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtMemoryBitWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtNetworkParameterRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtNetworkParameterRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtNetworkParameterResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtNetworkParameterResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtNetworkParameterWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtNetworkParameterWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtOpenRoutingTableRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtOpenRoutingTableRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyValueRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyValueRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyValueResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyValueResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyValueWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtPropertyValueWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterMemoryResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterStatusRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterStatusRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterStatusResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRouterStatusResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRoutingTableRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRoutingTableRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRoutingTableResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtReadRoutingTableResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtWriteRouterMemoryRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtWriteRouterMemoryRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtWriteRouterStatusRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtWriteRouterStatusRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtWriteRoutingTableRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataExtWriteRoutingTableRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataGroupValueRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataGroupValueRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataGroupValueResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataGroupValueResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataGroupValueWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataGroupValueWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataIndividualAddressRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataIndividualAddressRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataIndividualAddressResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataIndividualAddressResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataIndividualAddressWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataIndividualAddressWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataMemoryRead.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataMemoryRead.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataMemoryResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataMemoryResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataMemoryWrite.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataMemoryWrite.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataOther.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataOther.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataRestart.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataRestart.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataUserMessage.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ApduDataUserMessage.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMI.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMI.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIAdditionalInformation.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIAdditionalInformation.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIAdditionalInformationBusmonitorInfo.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIAdditionalInformationBusmonitorInfo.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIAdditionalInformationRelativeTimestamp.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIAdditionalInformationRelativeTimestamp.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIPriority.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/CEMIPriority.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ChannelInformation.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ChannelInformation.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTable.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTable.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableAddresses.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableAddresses.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableRealisationType1.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableRealisationType1.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableRealisationType2.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableRealisationType2.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableRealisationType6.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectTableRealisationType6.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectValueType.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ComObjectValueType.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequestInformation.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequestInformation.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequestInformationDeviceManagement.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequestInformationDeviceManagement.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponseDataBlock.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponseDataBlock.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponseDataBlockDeviceManagement.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponseDataBlockDeviceManagement.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponseDataBlockTunnelConnection.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionResponseDataBlockTunnelConnection.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionStateRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionStateRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionStateResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ConnectionStateResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DIBDeviceInfo.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DIBDeviceInfo.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DIBSuppSvcFamilies.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DIBSuppSvcFamilies.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DescriptionRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DescriptionRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DescriptionResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DescriptionResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationAck.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationAck.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationAckDataBlock.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationAckDataBlock.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceDescriptor.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceDescriptor.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceDescriptorMediumType.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceDescriptorMediumType.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceDescriptorType2.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceDescriptorType2.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceStatus.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DeviceStatus.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DisconnectRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DisconnectRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DisconnectResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/DisconnectResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/FirmwareType.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/FirmwareType.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType2.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType2.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType6.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType6.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType7.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType7.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationTypeB.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/GroupObjectDescriptorRealisationTypeB.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HPAIControlEndpoint.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HPAIControlEndpoint.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HPAIDataEndpoint.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HPAIDataEndpoint.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HPAIDiscoveryEndpoint.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HPAIDiscoveryEndpoint.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HostProtocolCode.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/HostProtocolCode.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/IPAddress.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/IPAddress.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxAddress.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxAddress.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxDatapoint.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxDatapoint.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxDatapointMainType.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxDatapointMainType.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxDatapointType.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxDatapointType.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddress.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddress.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddress2Level.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddress2Level.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddress3Level.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddress3Level.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddressFreeLevel.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxGroupAddressFreeLevel.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxInterfaceObjectProperty.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxInterfaceObjectProperty.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxInterfaceObjectType.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxInterfaceObjectType.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxLayer.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxLayer.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxManufacturer.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxManufacturer.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxMedium.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxMedium.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpCore.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpCore.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpDeviceManagement.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpDeviceManagement.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpMessage.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpMessage.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpRouting.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpRouting.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpTunneling.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetIpTunneling.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetObjectServer.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetObjectServer.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetRemoteConfigurationAndDiagnosis.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetRemoteConfigurationAndDiagnosis.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetRemoteLogging.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxNetRemoteLogging.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxProperty.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxProperty.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxPropertyDataType.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxPropertyDataType.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LBusmonInd.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LBusmonInd.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataCon.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataCon.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataExtended.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataExtended.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataFrame.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataFrame.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataFrameACK.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataFrameACK.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataInd.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataInd.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LDataReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LPollData.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LPollData.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LPollDataCon.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LPollDataCon.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LPollDataReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LPollDataReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LRawCon.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LRawCon.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LRawInd.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LRawInd.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LRawReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/LRawReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MACAddress.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MACAddress.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MFuncPropCommandReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MFuncPropCommandReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MFuncPropCon.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MFuncPropCon.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MFuncPropStateReadReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MFuncPropStateReadReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropInfoInd.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropInfoInd.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropReadCon.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropReadCon.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropReadReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropReadReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropWriteCon.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropWriteCon.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropWriteReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MPropWriteReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MResetInd.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MResetInd.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MResetReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/MResetReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ProjectInstallationIdentifier.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ProjectInstallationIdentifier.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/RelativeTimestamp.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/RelativeTimestamp.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/RoutingIndication.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/RoutingIndication.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/SearchRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/SearchRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/SearchResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/SearchResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ServiceId.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/ServiceId.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/Status.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/Status.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/SupportedPhysicalMedia.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/SupportedPhysicalMedia.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataConnectedInd.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataConnectedInd.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataConnectedReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataConnectedReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataIndividualInd.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataIndividualInd.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataIndividualReq.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TDataIndividualReq.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingRequest.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingRequest.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingRequestDataBlock.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingRequestDataBlock.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingResponse.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingResponse.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingResponseDataBlock.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/TunnelingResponseDataBlock.cs old mode 100644 new mode 100755 diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/UnknownMessage.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/UnknownMessage.cs old mode 100644 new mode 100755 diff --git a/plc4net/plc4net.sln b/plc4net/plc4net.sln old mode 100644 new mode 100755 diff --git a/plc4net/pom.xml b/plc4net/pom.xml old mode 100644 new mode 100755 diff --git a/plc4net/spi/plc4net-spi.csproj b/plc4net/spi/plc4net-spi.csproj old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/generation/ByteOrder.cs b/plc4net/spi/spi/generation/ByteOrder.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/generation/EvaluationHelper.cs b/plc4net/spi/spi/generation/EvaluationHelper.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/generation/ParseException.cs b/plc4net/spi/spi/generation/ParseException.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/generation/ReadBuffer.cs b/plc4net/spi/spi/generation/ReadBuffer.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/generation/WriteBuffer.cs b/plc4net/spi/spi/generation/WriteBuffer.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcBOOL.cs b/plc4net/spi/spi/model/values/PlcBOOL.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcBYTE.cs b/plc4net/spi/spi/model/values/PlcBYTE.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcBitString.cs b/plc4net/spi/spi/model/values/PlcBitString.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcCHAR.cs b/plc4net/spi/spi/model/values/PlcCHAR.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcDATE.cs b/plc4net/spi/spi/model/values/PlcDATE.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcDATE_AND_TIME.cs b/plc4net/spi/spi/model/values/PlcDATE_AND_TIME.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcDINT.cs b/plc4net/spi/spi/model/values/PlcDINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcDWORD.cs b/plc4net/spi/spi/model/values/PlcDWORD.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcINT.cs b/plc4net/spi/spi/model/values/PlcINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcLINT.cs b/plc4net/spi/spi/model/values/PlcLINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcLREAL.cs b/plc4net/spi/spi/model/values/PlcLREAL.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcLTIME.cs b/plc4net/spi/spi/model/values/PlcLTIME.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcLWORD.cs b/plc4net/spi/spi/model/values/PlcLWORD.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcNULL.cs b/plc4net/spi/spi/model/values/PlcNULL.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcPlcList.cs b/plc4net/spi/spi/model/values/PlcPlcList.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcREAL.cs b/plc4net/spi/spi/model/values/PlcREAL.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcSINT.cs b/plc4net/spi/spi/model/values/PlcSINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcSTRING.cs b/plc4net/spi/spi/model/values/PlcSTRING.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcSimpleNumericValueAdapter.cs b/plc4net/spi/spi/model/values/PlcSimpleNumericValueAdapter.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcSimpleValueAdapter.cs b/plc4net/spi/spi/model/values/PlcSimpleValueAdapter.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcStruct.cs b/plc4net/spi/spi/model/values/PlcStruct.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcTIME _OF_DAY.cs b/plc4net/spi/spi/model/values/PlcTIME _OF_DAY.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcTIME.cs b/plc4net/spi/spi/model/values/PlcTIME.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcUDINT.cs b/plc4net/spi/spi/model/values/PlcUDINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcUINT.cs b/plc4net/spi/spi/model/values/PlcUINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcULINT.cs b/plc4net/spi/spi/model/values/PlcULINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcUSINT.cs b/plc4net/spi/spi/model/values/PlcUSINT.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcValueAdapter.cs b/plc4net/spi/spi/model/values/PlcValueAdapter.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcWCHAR.cs b/plc4net/spi/spi/model/values/PlcWCHAR.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcWORD.cs b/plc4net/spi/spi/model/values/PlcWORD.cs old mode 100644 new mode 100755 diff --git a/plc4net/spi/spi/model/values/PlcWSTRING.cs b/plc4net/spi/spi/model/values/PlcWSTRING.cs old mode 100644 new mode 100755 diff --git a/pom.xml b/pom.xml old mode 100644 new mode 100755 index 3bcf2382aa5..8c2dafff3b9 --- a/pom.xml +++ b/pom.xml @@ -820,6 +820,11 @@ **/hs_err_pid* **/replay_pid* + + + **/manifest.mf + **/Bundle.properties + **/*.form @@ -1348,7 +1353,7 @@ [WARNING] org.apache.commons:commons-pool2:jar:2.11.1:compile [WARNING] org.apache.plc4x:plc4j-api:jar:0.11.0-SNAPSHOT:compile --> - 3.1.2 + 3.1.2 diff --git a/protocols/ab-eth/pom.xml b/protocols/ab-eth/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/ab-eth/src/main/java/org/apache/plc4x/protocol/abeth/ABETHProtocol.java b/protocols/ab-eth/src/main/java/org/apache/plc4x/protocol/abeth/ABETHProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/ab-eth/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/ab-eth/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/ab-eth/src/main/resources/protocols/abeth/ab-eth.mspec b/protocols/ab-eth/src/main/resources/protocols/abeth/ab-eth.mspec old mode 100644 new mode 100755 diff --git a/protocols/ab-eth/src/test/java/org/apache/plc4x/protocol/abeth/ABETHProtocolTest.java b/protocols/ab-eth/src/test/java/org/apache/plc4x/protocol/abeth/ABETHProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/ab-eth/src/test/resources/logback-test.xml b/protocols/ab-eth/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/ab-eth/src/test/resources/protocols/abeth/ParserSerializerTestsuite.xml b/protocols/ab-eth/src/test/resources/protocols/abeth/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/ads/pom.xml b/protocols/ads/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/ads/src/main/java/org/apache/plc4x/protocol/ads/ADSDiscoveryProtocol.java b/protocols/ads/src/main/java/org/apache/plc4x/protocol/ads/ADSDiscoveryProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/ads/src/main/java/org/apache/plc4x/protocol/ads/ADSProtocol.java b/protocols/ads/src/main/java/org/apache/plc4x/protocol/ads/ADSProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/ads/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/ads/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec b/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec old mode 100644 new mode 100755 diff --git a/protocols/ads/src/main/resources/protocols/ads/ads.mspec b/protocols/ads/src/main/resources/protocols/ads/ads.mspec old mode 100644 new mode 100755 diff --git a/protocols/ads/src/test/java/org/apache/plc4x/protocol/ads/ADSDiscoveryProtocolTest.java b/protocols/ads/src/test/java/org/apache/plc4x/protocol/ads/ADSDiscoveryProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/ads/src/test/java/org/apache/plc4x/protocol/ads/ADSProtocolTest.java b/protocols/ads/src/test/java/org/apache/plc4x/protocol/ads/ADSProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/ads/src/test/resources/logback-test.xml b/protocols/ads/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/ads/src/test/resources/protocols/ads/AdsDiscoverySerializerTest.xml b/protocols/ads/src/test/resources/protocols/ads/AdsDiscoverySerializerTest.xml old mode 100644 new mode 100755 diff --git a/protocols/ads/src/test/resources/protocols/ads/DriverTestsuite.xml b/protocols/ads/src/test/resources/protocols/ads/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/ads/src/test/resources/protocols/ads/ParserSerializerTestsuite.xml b/protocols/ads/src/test/resources/protocols/ads/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/ads/src/test/resources/protocols/ads/manual-test-capture.pcapng b/protocols/ads/src/test/resources/protocols/ads/manual-test-capture.pcapng old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/pom.xml b/protocols/bacnetip/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/java/org/apache/plc4x/protocol/bacnetip/BacNetIpProtocol.java b/protocols/bacnetip/src/main/java/org/apache/plc4x/protocol/bacnetip/BacNetIpProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/bacnetip/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-bit-strings.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-bit-strings.mspec old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-enums.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-enums.mspec old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-private-enums.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-private-enums.mspec old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-tags.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-tags.mspec old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/script/getVendorIds.groovy b/protocols/bacnetip/src/main/script/getVendorIds.groovy old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/script/produceTaggedBitStrings.groovy b/protocols/bacnetip/src/main/script/produceTaggedBitStrings.groovy old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/script/produceTaggedEnums.groovy b/protocols/bacnetip/src/main/script/produceTaggedEnums.groovy old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/main/script/produceTaggedPrivateEnums.groovy b/protocols/bacnetip/src/main/script/produceTaggedPrivateEnums.groovy old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BACnetObjectsDefinitions.java b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BACnetObjectsDefinitions.java old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BacNetIpProtocolTest.java b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BacNetIpProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/test/resources/logback-test.xml b/protocols/bacnetip/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/bacnetip/src/test/resources/protocols/bacnet/ParserSerializerTestsuite.xml b/protocols/bacnetip/src/test/resources/protocols/bacnet/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/c-bus/pom.xml b/protocols/c-bus/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/c-bus/src/main/java/org/apache/plc4x/protocol/cbus/CBusProtocol.java b/protocols/c-bus/src/main/java/org/apache/plc4x/protocol/cbus/CBusProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/c-bus/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/c-bus/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/protocols/c-bus/src/test/java/org/apache/plc4x/protocol/cbus/CBusProtocolTest.java b/protocols/c-bus/src/test/java/org/apache/plc4x/protocol/cbus/CBusProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/c-bus/src/test/resources/logback-test.xml b/protocols/c-bus/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/canopen/pom.xml b/protocols/canopen/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/main/java/org/apache/plc4x/protocol/canopen/CANOpenProtocol.java b/protocols/canopen/src/main/java/org/apache/plc4x/protocol/canopen/CANOpenProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/canopen/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/main/resources/protocols/can/canopen.mspec b/protocols/canopen/src/main/resources/protocols/can/canopen.mspec old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/test/java/org/apache/plc4x/protocol/canopen/CANOpenProtocolTest.java b/protocols/canopen/src/test/java/org/apache/plc4x/protocol/canopen/CANOpenProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/test/resources/logback-test.xml b/protocols/canopen/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/test/resources/protocols/canopen/CANOpenDriverSDOIT.xml b/protocols/canopen/src/test/resources/protocols/canopen/CANOpenDriverSDOIT.xml old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/test/resources/protocols/canopen/CANOpenPayloadTestSuite.xml b/protocols/canopen/src/test/resources/protocols/canopen/CANOpenPayloadTestSuite.xml old mode 100644 new mode 100755 diff --git a/protocols/canopen/src/test/resources/protocols/canopen/CANOpenWiresharkTestSuite.xml b/protocols/canopen/src/test/resources/protocols/canopen/CANOpenWiresharkTestSuite.xml old mode 100644 new mode 100755 diff --git a/protocols/df1/pom.xml b/protocols/df1/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/df1/src/main/java/org/apache/plc4x/protocol/df1/Df1Protocol.java b/protocols/df1/src/main/java/org/apache/plc4x/protocol/df1/Df1Protocol.java old mode 100644 new mode 100755 diff --git a/protocols/df1/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/df1/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/df1/src/main/resources/protocols/df1/df1.mspec b/protocols/df1/src/main/resources/protocols/df1/df1.mspec old mode 100644 new mode 100755 diff --git a/protocols/df1/src/test/java/org/apache/plc4x/protocol/df1/Df1ProtocolTest.java b/protocols/df1/src/test/java/org/apache/plc4x/protocol/df1/Df1ProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/df1/src/test/resources/logback-test.xml b/protocols/df1/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/df1/src/test/resources/protocols/df1/ParserSerializerTestsuite.xml b/protocols/df1/src/test/resources/protocols/df1/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/eip/pom.xml b/protocols/eip/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/eip/src/main/java/org/apache/plc4x/protocol/eip/EipProtocol.java b/protocols/eip/src/main/java/org/apache/plc4x/protocol/eip/EipProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/eip/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/eip/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/eip/src/main/resources/protocols/eip/eip.mspec b/protocols/eip/src/main/resources/protocols/eip/eip.mspec old mode 100644 new mode 100755 diff --git a/protocols/eip/src/test/java/org/apache/plc4x/protocol/eip/EipProtocolTest.java b/protocols/eip/src/test/java/org/apache/plc4x/protocol/eip/EipProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/eip/src/test/resources/logback-test.xml b/protocols/eip/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/eip/src/test/resources/protocols/eip/DriverTestsuite.xml b/protocols/eip/src/test/resources/protocols/eip/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuite.xml b/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/firmata/pom.xml b/protocols/firmata/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/firmata/src/main/java/org/apache/plc4x/protocol/firmata/FirmataProtocol.java b/protocols/firmata/src/main/java/org/apache/plc4x/protocol/firmata/FirmataProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/firmata/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/firmata/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/firmata/src/main/resources/protocols/firmata/firmata.mspec b/protocols/firmata/src/main/resources/protocols/firmata/firmata.mspec old mode 100644 new mode 100755 diff --git a/protocols/firmata/src/test/java/org/apache/plc4x/protocol/firmata/FirmataProtocolTest.java b/protocols/firmata/src/test/java/org/apache/plc4x/protocol/firmata/FirmataProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/firmata/src/test/resources/logback-test.xml b/protocols/firmata/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/firmata/src/test/resources/protocols/firmata/ParserSerializerTestsuite.xml b/protocols/firmata/src/test/resources/protocols/firmata/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/genericcan/pom.xml b/protocols/genericcan/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/genericcan/src/main/java/org/apache/plc4x/protocol/genericcan/GenericCANProtocol.java b/protocols/genericcan/src/main/java/org/apache/plc4x/protocol/genericcan/GenericCANProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/genericcan/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/genericcan/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/genericcan/src/main/resources/protocols/can/genericcan.mspec b/protocols/genericcan/src/main/resources/protocols/can/genericcan.mspec old mode 100644 new mode 100755 diff --git a/protocols/genericcan/src/test/java/org/apache/plc4x/protocol/genericcan/GenericCANProtocolTest.java b/protocols/genericcan/src/test/java/org/apache/plc4x/protocol/genericcan/GenericCANProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/genericcan/src/test/resources/logback-test.xml b/protocols/genericcan/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/pom.xml b/protocols/knxnetip/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/main/java/org/apache/plc4x/protocol/knxnetip/KnxNetIpProtocol.java b/protocols/knxnetip/src/main/java/org/apache/plc4x/protocol/knxnetip/KnxNetIpProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/knxnetip/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/main/resources/protocols/knxnetip/device-info.mspec b/protocols/knxnetip/src/main/resources/protocols/knxnetip/device-info.mspec old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/main/resources/protocols/knxnetip/knxnetip.mspec b/protocols/knxnetip/src/main/resources/protocols/knxnetip/knxnetip.mspec old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/main/script/getKnxMasterData.groovy b/protocols/knxnetip/src/main/script/getKnxMasterData.groovy old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/main/xslt/knx-types.xsl b/protocols/knxnetip/src/main/xslt/knx-types.xsl old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/site/asciidoc/index.adoc b/protocols/knxnetip/src/site/asciidoc/index.adoc old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/BaseKnxWebserviceContentProcessor.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/BaseKnxWebserviceContentProcessor.java old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxDefinitionsGenerator.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxDefinitionsGenerator.java old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxNetIpProtocolTest.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxNetIpProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxSpecificationStoreUpdater.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxSpecificationStoreUpdater.java old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/handlers/ManufacturerIdsHandler.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/handlers/ManufacturerIdsHandler.java old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/handlers/ProductDescriptionHandler.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/handlers/ProductDescriptionHandler.java old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/resources/logback-test.xml b/protocols/knxnetip/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/resources/org/apache/plc4x/protocols/knxnetip/protocol.tdml b/protocols/knxnetip/src/test/resources/org/apache/plc4x/protocols/knxnetip/protocol.tdml old mode 100644 new mode 100755 diff --git a/protocols/knxnetip/src/test/resources/protocols/knxnetip/ParserSerializerTestsuite.xml b/protocols/knxnetip/src/test/resources/protocols/knxnetip/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/modbus/pom.xml b/protocols/modbus/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/main/java/org/apache/plc4x/protocol/modbus/ModbusProtocol.java b/protocols/modbus/src/main/java/org/apache/plc4x/protocol/modbus/ModbusProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/modbus/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec b/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/test/java/org/apache/plc4x/protocol/modbus/ModbusProtocolTest.java b/protocols/modbus/src/test/java/org/apache/plc4x/protocol/modbus/ModbusProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/test/resources/logback-test.xml b/protocols/modbus/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/test/resources/protocols/modbus/ascii/ParserSerializerTestsuite.xml b/protocols/modbus/src/test/resources/protocols/modbus/ascii/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/test/resources/protocols/modbus/rtu/ParserSerializerTestsuite.xml b/protocols/modbus/src/test/resources/protocols/modbus/rtu/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/test/resources/protocols/modbus/tcp/DriverTestsuite.xml b/protocols/modbus/src/test/resources/protocols/modbus/tcp/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/test/resources/protocols/modbus/tcp/ParserSerializerTestsuite.xml b/protocols/modbus/src/test/resources/protocols/modbus/tcp/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/modbus/src/test/resources/protocols/modbus/tcp/manual-test-capture.pcapng b/protocols/modbus/src/test/resources/protocols/modbus/tcp/manual-test-capture.pcapng old mode 100644 new mode 100755 diff --git a/protocols/mqtt/pom.xml b/protocols/mqtt/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/mqtt/src/main/java/org/apache/plc4x/protocol/mqtt/MqttProtocol.java b/protocols/mqtt/src/main/java/org/apache/plc4x/protocol/mqtt/MqttProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/mqtt/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/mqtt/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/mqtt/src/main/resources/protocols/mqtt/mqtt.mspec b/protocols/mqtt/src/main/resources/protocols/mqtt/mqtt.mspec old mode 100644 new mode 100755 diff --git a/protocols/mqtt/src/test/resources/protocols/mqtt/ParserSerializerTestsuite.xml b/protocols/mqtt/src/test/resources/protocols/mqtt/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/opcua/pom.xml b/protocols/opcua/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/main/java/org/apache/plc4x/protocol/opcua/OpcuaProtocol.java b/protocols/opcua/src/main/java/org/apache/plc4x/protocol/opcua/OpcuaProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/opcua/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/main/xslt/opc-common.xsl b/protocols/opcua/src/main/xslt/opc-common.xsl old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/main/xslt/opc-manual.xsl b/protocols/opcua/src/main/xslt/opc-manual.xsl old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/main/xslt/opc-services.xsl b/protocols/opcua/src/main/xslt/opc-services.xsl old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/main/xslt/opc-status.xsl b/protocols/opcua/src/main/xslt/opc-status.xsl old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/main/xslt/opc-types.xsl b/protocols/opcua/src/main/xslt/opc-types.xsl old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/test/java/org/apache/plc4x/protocol/opcua/OpcuaProtocolTest.java b/protocols/opcua/src/test/java/org/apache/plc4x/protocol/opcua/OpcuaProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/test/resources/logback-test.xml b/protocols/opcua/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/opcua/src/test/resources/protocols/opcua/DriverTestsuite.xml b/protocols/opcua/src/test/resources/protocols/opcua/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/plc4x-api/pom.xml b/protocols/plc4x-api/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/plc4x-api/src/test/java/org/apache/plc4x/protocol/plc4xapi/v0/Plc4xProtocolTest.java b/protocols/plc4x-api/src/test/java/org/apache/plc4x/protocol/plc4xapi/v0/Plc4xProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/plc4x-api/src/test/resources/logback-test.xml b/protocols/plc4x-api/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/plc4x/pom.xml b/protocols/plc4x/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/plc4x/src/main/java/org/apache/plc4x/protocol/plc4x/v0/Plc4xProtocol.java b/protocols/plc4x/src/main/java/org/apache/plc4x/protocol/plc4x/v0/Plc4xProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/plc4x/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/plc4x/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/plc4x/src/main/resources/protocols/plc4x/v0/plc4x.mspec b/protocols/plc4x/src/main/resources/protocols/plc4x/v0/plc4x.mspec old mode 100644 new mode 100755 diff --git a/protocols/plc4x/src/test/java/org/apache/plc4x/protocol/plc4x/v0/Plc4xProtocolTest.java b/protocols/plc4x/src/test/java/org/apache/plc4x/protocol/plc4x/v0/Plc4xProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/plc4x/src/test/resources/logback-test.xml b/protocols/plc4x/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/plc4x/src/test/resources/protocols/plc4x/ParserSerializerTestsuite.xml b/protocols/plc4x/src/test/resources/protocols/plc4x/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/pom.xml b/protocols/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/profinet/pom.xml b/protocols/profinet/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/profinet/src/main/java/org/apache/plc4x/protocol/profinet/ProfinetProtocol.java b/protocols/profinet/src/main/java/org/apache/plc4x/protocol/profinet/ProfinetProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/profinet/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/profinet/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/profinet/src/main/resources/protocols/profinet/profinet.mspec b/protocols/profinet/src/main/resources/protocols/profinet/profinet.mspec old mode 100644 new mode 100755 diff --git a/protocols/profinet/src/test/java/org/apache/plc4x/protocol/profinet/ProfinetProtocolTest.java b/protocols/profinet/src/test/java/org/apache/plc4x/protocol/profinet/ProfinetProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/profinet/src/test/resources/logback-test.xml b/protocols/profinet/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/profinet/src/test/resources/pcap/working-profinet-recording-plc4x.pcapng b/protocols/profinet/src/test/resources/pcap/working-profinet-recording-plc4x.pcapng old mode 100644 new mode 100755 diff --git a/protocols/profinet/src/test/resources/protocols/profinet/ParserSerializerTestsuite.xml b/protocols/profinet/src/test/resources/protocols/profinet/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/s7/pom.xml b/protocols/s7/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/s7/src/main/java/org/apache/plc4x/protocol/s7/S7Protocol.java b/protocols/s7/src/main/java/org/apache/plc4x/protocol/s7/S7Protocol.java old mode 100644 new mode 100755 diff --git a/protocols/s7/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/s7/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/s7/src/main/resources/protocols/s7/s7.mspec b/protocols/s7/src/main/resources/protocols/s7/s7.mspec old mode 100644 new mode 100755 diff --git a/protocols/s7/src/test/java/org/apache/plc4x/protocol/s7/S7ProtocolTest.java b/protocols/s7/src/test/java/org/apache/plc4x/protocol/s7/S7ProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/s7/src/test/resources/logback-test.xml b/protocols/s7/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/s7/src/test/resources/org/apache/plc4x/protocols/s7/protocol.tdml b/protocols/s7/src/test/resources/org/apache/plc4x/protocols/s7/protocol.tdml old mode 100644 new mode 100755 diff --git a/protocols/s7/src/test/resources/protocols/s7/DriverTestsuite.xml b/protocols/s7/src/test/resources/protocols/s7/DriverTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/s7/src/test/resources/protocols/s7/ParserSerializerTestsuite.xml b/protocols/s7/src/test/resources/protocols/s7/ParserSerializerTestsuite.xml old mode 100644 new mode 100755 diff --git a/protocols/s7/src/test/resources/protocols/s7/manual-test-capture.pcapng b/protocols/s7/src/test/resources/protocols/s7/manual-test-capture.pcapng old mode 100644 new mode 100755 diff --git a/protocols/simulated/pom.xml b/protocols/simulated/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/simulated/src/main/java/org/apache/plc4x/protocol/simulated/SimulatedProtocol.java b/protocols/simulated/src/main/java/org/apache/plc4x/protocol/simulated/SimulatedProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/simulated/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/simulated/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/simulated/src/main/resources/protocols/simulated/simulated.mspec b/protocols/simulated/src/main/resources/protocols/simulated/simulated.mspec old mode 100644 new mode 100755 diff --git a/protocols/simulated/src/test/java/org/apache/plc4x/protocol/simulated/SimulatedProtocolTest.java b/protocols/simulated/src/test/java/org/apache/plc4x/protocol/simulated/SimulatedProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/simulated/src/test/resources/logback-test.xml b/protocols/simulated/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/protocols/socketcan/pom.xml b/protocols/socketcan/pom.xml old mode 100644 new mode 100755 diff --git a/protocols/socketcan/src/main/java/org/apache/plc4x/protocol/socketcan/SocketCANProtocol.java b/protocols/socketcan/src/main/java/org/apache/plc4x/protocol/socketcan/SocketCANProtocol.java old mode 100644 new mode 100755 diff --git a/protocols/socketcan/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/socketcan/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol old mode 100644 new mode 100755 diff --git a/protocols/socketcan/src/main/resources/protocols/can/socketcan.mspec b/protocols/socketcan/src/main/resources/protocols/can/socketcan.mspec old mode 100644 new mode 100755 diff --git a/protocols/socketcan/src/test/java/org/apache/plc4x/protocol/socketcan/SocketCANProtocolTest.java b/protocols/socketcan/src/test/java/org/apache/plc4x/protocol/socketcan/SocketCANProtocolTest.java old mode 100644 new mode 100755 diff --git a/protocols/socketcan/src/test/resources/logback-test.xml b/protocols/socketcan/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/reactors/all-drivers/pom.xml b/reactors/all-drivers/pom.xml old mode 100644 new mode 100755 diff --git a/sandbox/.gitignore b/sandbox/.gitignore old mode 100644 new mode 100755 diff --git a/sandbox/code-gen/src/main/antlr4/imaginary.g4 b/sandbox/code-gen/src/main/antlr4/imaginary.g4 new file mode 100755 index 00000000000..5e09808bc80 --- /dev/null +++ b/sandbox/code-gen/src/main/antlr4/imaginary.g4 @@ -0,0 +1,149 @@ +grammar imaginary; +/* + * 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. + */ + +file + : statement* + ; + +statement + : COMMENT + | typeDefinition + ; + +typeDefinition + : LBRACKET K_TYPE IDENTIFIER COMMENT? (fieldDefinition COMMENT?)+ RBRACKET + | LBRACKET K_DISCRIMINATED_TYPE IDENTIFIER '[length]'? COMMENT? (fieldDefinition COMMENT?)+ RBRACKET + ; + + +fieldDefinition + : LBRACKET simpleField RBRACKET + | typeSwitch + ; + +simpleField + : K_CONST dataType IDENTIFIER expression + | K_RESERVED dataType expression + | K_IMPLICIT dataType IDENTIFIER expression + | K_EMBEDDED IDENTIFIER LCBRACKET context RCBRACKET + | K_DISCRIMINATOR dataType IDENTIFIER + | 'context' (dataType | IDENTIFIER) expression + | 'optionalField' (dataType | IDENTIFIER) expression + | 'field' dataType IDENTIFIER + | arrayField + ; + +typeSwitch + : LBRACKET 'typeSwitch' IDENTIFIER COMMENT? caseStatement* RBRACKET + ; + +caseStatement + : LBRACKET expression IDENTIFIER COMMENT? (fieldDefinition COMMENT?)+ RBRACKET + ; + +arrayField + : 'arrayField' (IDENTIFIER | dataType) IDENTIFIER IDENTIFIER expression COMMENT* + ; + +dataType + : 'bit' + | 'uint7' + | K_UINT8 + | K_UINT16 + ; + +expression + : TICK innerExpression TICK + ; + +innerExpression + : HEX_LITERAL + | INTEGER_LITERAL + | IDENTIFIER // Variable reference + | innerExpression '.' IDENTIFIER // Field Reference + | innerExpression BinaryOperator innerExpression // Addition + | '(' innerExpression ')' + ; + +context + : IDENTIFIER ':' expression (',' IDENTIFIER ':' expression)* + ; + +COMMENT + : K_COMMENT [a-zA-Z0-9,.'":()/ \t\r\n\u000C-]* + | '//' [a-zA-Z0-9,.'":()/ \t-]* + ; + +INTEGER_LITERAL + : [0-9]+ + ; + +HEX_LITERAL + : HexNumeral + ; + +fragment HexNumeral + : '0' [xX] HexDigit HexDigit?; + +fragment HexDigit + : [0-9a-fA-F] +; + +modifier + : K_CONST + | K_RESERVED + | K_IMPLICIT + | K_EMBEDDED + ; + +fragment K_COMMENT : '<--'; +K_CONST : 'const'; +K_RESERVED : 'reserved'; +K_IMPLICIT : 'implicit'; +K_EMBEDDED : 'embedded'; +K_DISCRIMINATOR : 'discriminator'; +K_TYPE : 'type'; +K_DISCRIMINATED_TYPE : 'discriminatedType'; + +K_UINT8 : 'uint8'; +K_UINT16 : 'uint16'; + +TICK : '\''; +TIMES : 'x'; +LBRACKET : '['; +RBRACKET : ']'; +LCBRACKET : '{'; +RCBRACKET : '}'; + +BinaryOperator + : '+' + | '-' + | '==' + ; + +ZERO : '0'; +HEX_VALUE : [0-9A-F]; + +IDENTIFIER + : [A-Za-z0-9_-]+ + ; + +WS : [ \t\r\n\u000C]+ -> skip +; \ No newline at end of file diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/DFDLUtil.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/DFDLUtil.java new file mode 100755 index 00000000000..1ac3a9ee02b --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/DFDLUtil.java @@ -0,0 +1,104 @@ +/* + * 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.codegen; + +import org.apache.plc4x.codegen.ast.*; +import org.apache.plc4x.codegen.util.PojoFactory; +import org.dom4j.*; +import org.dom4j.io.SAXReader; +import org.xml.sax.SAXException; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Util to create a POJO from a DFDL file. + */ +public class DFDLUtil { + + private static final Namespace XS_NAMESPACE = new Namespace("xs", "http://www.w3.org/2001/XMLSchema"); + private static final QName COMPLEX_TYPE = new QName("complexType", XS_NAMESPACE); + private static final QName SEQUENCE = new QName("sequence", XS_NAMESPACE); + private static final QName ELEMENT = new QName("element", XS_NAMESPACE); + + public void transform(File dfdlSchemaFile, File outputDir) throws IOException { + if (!outputDir.exists()) { + throw new FileNotFoundException(outputDir.getAbsolutePath() + " does not exist"); + } + if (!outputDir.isDirectory()) { + throw new FileNotFoundException(outputDir.getAbsolutePath() + " is not a directory"); + } + + final Document schema = parseDFDLSchema(dfdlSchemaFile); + + final Iterator iterator = getMainTypes(schema); + + final PojoFactory factory = new PojoFactory(); + while (iterator.hasNext()) { + final Element element = iterator.next(); + final Iterator sequenceIterator = element.elementIterator(SEQUENCE); + final Element sequence = getSequence(sequenceIterator); + + // Now make a POJO with all "elements" as fields + final ArrayList fields = new ArrayList<>(); + final Iterator elementIterator = sequence.elementIterator(ELEMENT); + while (elementIterator.hasNext()) { + final Element elem = elementIterator.next(); + fields.add(new PojoFactory.Field(Expressions.typeOf(elem.attributeValue("type")), elem.attributeValue("name"))); + } + final PojoFactory.PojoDescription desc = new PojoFactory.PojoDescription(element.attributeValue("name"), fields); + final ClassDeclaration classDeclaration = factory.create(desc); + + // Now generate the code for that + final CodeWriter writer = new CodeWriter(4); + final Generator generator = new JavaGenerator(writer); + classDeclaration.write(generator); + + System.out.println("Class Definition"); + System.out.println("----------------------------"); + System.out.println(writer.getCode()); + } + } + + private Element getSequence(Iterator sequenceIterator) { + assert sequenceIterator.hasNext(); + final Element sequence = sequenceIterator.next(); + assert !sequenceIterator.hasNext(); + return sequence; + } + + private Document parseDFDLSchema(File schemaFile) throws IOException { + try { + SAXReader reader = new SAXReader(); + reader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + return reader.read(schemaFile); + } catch (DocumentException | SAXException e) { + // Do something + throw new IOException("Unable to read DFDL Schema File", e); + } + } + + private Iterator getMainTypes(Document dfdlSchema) { + Element rootElement = dfdlSchema.getRootElement(); + return rootElement.elementIterator(COMPLEX_TYPE); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/AbstractNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/AbstractNode.java new file mode 100755 index 00000000000..bad22ed0715 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/AbstractNode.java @@ -0,0 +1,32 @@ +/* + * 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.codegen.ast; + +public abstract class AbstractNode implements Node { + + public final TypeDefinition type; + + protected AbstractNode(TypeDefinition type) { + this.type = type; + } + + public TypeDefinition getType() { + return this.type; + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/BlockBuilder.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/BlockBuilder.java new file mode 100755 index 00000000000..b26aebeefaf --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/BlockBuilder.java @@ -0,0 +1,48 @@ +/* + * 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.codegen.ast; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Builds a Block. + */ +public class BlockBuilder { + + private final List statements = new ArrayList<>(); + + public BlockBuilder() { + } + + public BlockBuilder add(Node statements) { + this.statements.add(statements); + return this; + } + + public BlockBuilder add(Collection statements) { + this.statements.addAll(statements); + return this; + } + + public Block toBlock() { + return new Block(this.statements); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/CallExpression.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/CallExpression.java new file mode 100755 index 00000000000..6181c646010 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/CallExpression.java @@ -0,0 +1,64 @@ +/* + * 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.codegen.ast; + +import java.util.Arrays; +import java.util.List; + +public class CallExpression extends Expression { + + private final Method method; + private final Node target; + private final List arguments; + + /** + * Static Method ==> target == null + * @param method . + * @param target . + * @param arguments . + */ + CallExpression(Method method, Node target, Node... arguments) { + super(method.getReturnType()); + this.method = method; + this.target = target; + this.arguments = Arrays.asList(arguments); + } + + public Method getMethod() { + return method; + } + + public Node getTarget() { + return target; + } + + @Override + public T accept(NodeVisitor visitor) { + return null; + } + + @Override + public void write(Generator writer) { + if (target == null) { + writer.generateStaticCall(method, arguments); + } else { + writer.generateCall(target, method, arguments); + } + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/ClassDeclaration.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/ClassDeclaration.java new file mode 100755 index 00000000000..68d817541d7 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/ClassDeclaration.java @@ -0,0 +1,75 @@ +/* + * 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.codegen.ast; + +import java.util.List; + +public class ClassDeclaration implements Node { + + private final String namespace; + private final String className; + + private final List fields; + private final List constructors; + private final List methods; + private final List innerClasses; + + public ClassDeclaration(String namespace, String className, List fields, List constructors, List methods, List innerClasses) { + this.namespace = namespace; + this.className = className; + this.fields = fields; + this.constructors = constructors; + this.methods = methods; + this.innerClasses = innerClasses; + } + + public String getNamespace() { + return namespace; + } + + public String getClassName() { + return className; + } + + public List getFields() { + return fields; + } + + public List getConstructors() { + return constructors; + } + + public List getMethods() { + return methods; + } + + public List getInnerClasses() { + return innerClasses; + } + + @Override + public T accept(NodeVisitor visitor) { + return null; + } + + @Override + public void write(Generator writer) { + writer.generateClass(this.namespace, this.className, this.fields, this.constructors, this.methods, innerClasses, true); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/CodeWriter.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/CodeWriter.java new file mode 100755 index 00000000000..e9027ba38e2 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/CodeWriter.java @@ -0,0 +1,75 @@ +/* + * 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.codegen.ast; + +import java.util.stream.IntStream; + +/** + * Helper class to print code. + */ +public class CodeWriter { + + private StringBuffer buffer = new StringBuffer(); + private int tabSize; + + private int intendationLvl = 0; + + public CodeWriter(int tabSize) { + this.tabSize = tabSize; + } + + public void startBlock() { + this.intendationLvl += tabSize; + } + + public void endBlock() { + if (intendationLvl < tabSize) { + throw new RuntimeException("Closing a Block which is not open!"); + } + this.intendationLvl -= tabSize; + } + + public void write(String s) { + buffer.append(s); + } + + public void startLine(String s) { + writeIntendation(); + write(s); + } + + public void endLine() { + buffer.append("\n"); + } + + public void writeLine(String s) { + writeIntendation(); + buffer.append(s); + buffer.append("\n"); + } + + private void writeIntendation() { + // Write the intendation + IntStream.range(0, intendationLvl).forEach(i -> buffer.append(" ")); + } + + public String getCode() { + return buffer.toString(); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Expressions.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Expressions.java new file mode 100755 index 00000000000..f38a71d4b73 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Expressions.java @@ -0,0 +1,322 @@ +/* + * 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.codegen.ast; + +import java.util.Collections; +import java.util.List; + +/** + * General Factory method to use for Code Generation. + * Generally, the Structure which is generated by this class is a (incomplete) Abstact Syntax Tree + * which covers a subset of things which is possible in many programming languages. + * This tree is the basis for the generation of code in many languages which is performed by + * the implementations of the {@link Generator} interface. + * + * In this sense the AST is Language Agnostic and should be seen as such. It is oriented at Java + * as the whole thing is java based but is a bit more generic that it would need to be for java alone. + * This is something to keep in mind. + * + * So some examples on how to implement some things with the AST. + * + * Variable Definition / Assignment + * + * Expressions.declaration("a", Primitive.DOUBLE) + * + * is similar to + * + * Double a; + * + * in java, or in Python + * + * a: float = None + * + * (we use Type Hints) and Python cannot declare variables without initialization. + * + * Another thing is to initialize a variable with a constant value: + * + * Expressions.declaration("a", Expressions.constant(5.0)) + * + * this will lead (in Java) to + * + * Double a = 5.0; + * + * The type is inferred for the constant expression from 5.0 and is then passed to the variable. + * In Python this will become + * + * a: float = 5.0 + * + * + * If Statement: + * A more complex example with an if statement is + * + * Block.build() + * .add(Expressions.declaration("pi", Primitive.DOUBLE)) + * .add( + * Expressions.ifElse( + * Expressions.binaryExpression( + * Expressions.BOOLEAN, + * Expressions.parameter("x", Primitive.DOUBLE), + * Expressions.constant(5.0), + * BinaryExpression.Operation.EQ + * ), + * Block.build().add( + * Expressions.assignment( + * Expressions.parameter("pi"), + * Expressions.constant(3.141) + * ) + * ) + * ) + * .toBlock() + * + * This could will transform to something like (in Java) + * + * Double pi; + * if (x == 5.0) { + * pi = 3.141; + * } + * + * + * More Examples of (complex) structures can be found, e.g., in the + * {@link org.apache.plc4x.codegen.util.PojoFactory} or in the {@link org.apache.plc4x.codegen.util.EnumFactory} + * which are "layers" on top of this AST whcih make it easier to create POJOs or ENUM-like constructs. + * They define the class and all fields / methods / getters / setters and constructor and such stuff. + */ +public class Expressions { + + private Expressions() { + // do not instantiate + } + + /** + * Assign a value to a target (field or parameter) + * @param target Where the value is assigned + * @param value What to assign + * @return Assignment Expression + */ + public static Expression assignment(Expression target, Node value) { + return new AssignementExpression(target, value); + } + + /** + * Base for all Binary Expression, i.e., Expressions which take + * two inputs and return one Output. + * Examples are Comparators, Math, ... . + * @param type Type of the returned expression + * @param left + * @param right + * @param op + * @return + */ + public static Expression binaryExpression(TypeDefinition type, Node left, Node right, BinaryExpression.Operation op) { + return new BinaryExpression(type, left, right, op); + } + + /** + * A Block of code. + * @param statements + * @return + */ + public static Statement block(List statements) { + return new Block(statements); + } + + /** + * A block of code. + * @param statements + * @return + */ + public static Statement block(Node... statements) { + return new Block(statements); + } + + /** + * Regular (dynamic) call. + * @param instance + * @param method + * @param arguments + */ + public static Expression call(Node instance, Method method, Node... arguments) { + return new CallExpression(method, instance, arguments); + } + + /** + * Static call (call to a static method) + * + * TODO check if Method is static + * + * @param method + * @param arguments + */ + public static Expression staticCall(Method method, Node... arguments) { + return new CallExpression(method, null, arguments); + } + + /** + * Simple if-then-else. + * If no else is needed, orElse can be null. + */ + public static Statement ifElse(Expression condition, Block then, Block orElse) { + return new IfStatement(condition, then, orElse); + } + + /** + * Simple if-then-else. + * If no else is needed, orElse can be null. + */ + public static Statement ifElse(Expression condition, Block then) { + return new IfStatement(condition, then, null); + } + + /** + * Conditional Statement of the form + * + * if (cond1) { + * ... + * } else if (cond2) { + * ... + * } else { + * ... + * } + * + */ + public static Statement conditionalStatement(List condition, List blocks) { + return new IfStatement(condition, blocks); + } + + /** + * Defines a compile time constant and infers the type based on what java would do. + */ + public static Expression constant(Object value) { + return new ConstantExpression(value); + } + + /** + * Define a compile time constant and also passes + * the expected type for usage in the code generation later. + */ + public static Expression constant(TypeDefinition type, Object value) { + return new ConstantExpression(value); + } + + /** + * Declares a constant (no field). + * Variable type is infered from the initializing expression. + */ + public static Statement declaration(String variable, Expression initializer) { + return new DeclarationStatement(parameter(variable, initializer.getType()), initializer); + } + + public static Statement declaration(ParameterExpression variable, Expression initializer) { + return new DeclarationStatement(variable, initializer); + } + + /** + * Declares a constant (no field), which is not initialized. + */ + public static Statement declaration(String variable, TypeDefinition type) { + return new DeclarationStatement(parameter(variable, type), null); + } + + /** + * Reference to a field in the surrounding class. + */ + public static Expression field(String name) { + return new FieldReference(UnknownType.INSTANCE, name); + } + + /** + * Reference to a field on the given target + */ + public static Expression field(Node target, String name) { + return new FieldReference(UnknownType.INSTANCE, name, target); + } + + /** + * Adds a line of comment. + */ + public static Node comment(String comment) { + return new LineComment(comment); + } + + /** + * Simple call to a method which throws no exception and that stuff. + */ + public static Expression call(Node target, String methodName, Node... arguments) { + return new CallExpression( + new Method(UnknownType.INSTANCE, methodName, UnknownType.INSTANCE, + Collections.emptyList(), Collections.emptyList()), + target, + arguments + ); + } + + public static Expression call(Method method, Node target, Node... arguments) { + return new CallExpression(method, target, arguments); + } + + /** + * Static call. + */ + public static Expression call(Method method, Node... arguments) { + return new CallExpression(method, null, arguments); + } + + /** + * Reference to a Method, similar than field-reference + * @return + */ + public static Method method(TypeDefinition definingClass, String name, TypeDefinition returnType, List parameterTypes, List exceptions) { + return new Method(definingClass, name, returnType, parameterTypes, exceptions); + } + + /** + * References a variable. + */ + public static ParameterExpression parameter(String name, TypeDefinition type) { + return new ParameterExpression(type, name); + } + + /** + * New Instance of Class / Type. + */ + public static Expression new_(TypeDefinition type, Node... arguments) { + return new NewExpression(type, arguments); + } + + /** + * New Instance of Class / Type. + */ + public static Expression new_(TypeDefinition type, List arguments) { + return new NewExpression(type, arguments); + } + + /** + * Return Statements. + */ + public static ReturnStatement return_(Expression value) { + return new ReturnStatement(value); + } + + /** + * Declares a Class as type. + */ + public static TypeDefinition typeOf(String className) { + return new TypeDefinition(className); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/FieldDeclaration.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/FieldDeclaration.java new file mode 100755 index 00000000000..5539efc5295 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/FieldDeclaration.java @@ -0,0 +1,58 @@ +/* + * 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.codegen.ast; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +public class FieldDeclaration implements Node { + + private final Set modifiers; + private final TypeDefinition type; + private final String name; + + private final Expression initializer; + + public FieldDeclaration(Set modifiers, TypeDefinition type, String name, Expression initializer) { + this.modifiers = modifiers; + this.type = type; + this.name = name; + this.initializer = initializer; + } + + public FieldDeclaration(TypeDefinition type, String name) { + this(Collections.emptySet(), type, name, null); + } + + public FieldDeclaration(TypeDefinition type, String name, Modifier... modifiers) { + this(new HashSet<>(Arrays.asList(modifiers)), type, name, null); + } + + @Override + public T accept(NodeVisitor visitor) { + return null; + } + + @Override + public void write(Generator writer) { + writer.generateFieldDeclaration(modifiers, type, name, initializer); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Generator.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Generator.java new file mode 100755 index 00000000000..205f5a44cfa --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Generator.java @@ -0,0 +1,76 @@ +/* + * 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.codegen.ast; + +import java.util.List; +import java.util.Set; + +public interface Generator { + + /** + * Do preliminary stuff. + * @param root . + * @return . + */ + Node prepare(Node root); + + void generate(ConstantExpression constantExpression); + + void generateDeclarationWithInitializer(DeclarationStatement declarationStatement); + + void generateDeclaration(DeclarationStatement declarationStatement); + + void generate(ParameterExpression parameterExpression); + + void generatePrimitive(Primitive.DataType primitive); + + void generate(IfStatement ifStatement); + + void writeBlock(Block statements); + + void generate(BinaryExpression binaryExpression); + + void generate(AssignementExpression assignementExpression); + + void generateStaticCall(Method method, List constantNode); + + void generateCall(Node target, Method method, List constantNode); + + void generate(NewExpression newExpression); + + void generate(MethodDefinition methodDefinition); + + void generateReturn(Expression value); + + void generateClass(String namespace, String className, List fields, List constructors, List methods, List innerClasses, boolean mainClass); + + void generateFieldDeclaration(Set modifiers, TypeDefinition type, String name, Expression initializer); + + void generateFieldReference(TypeDefinition type, String name); + + void generateConstructor(Set modifiers, String className, List parameters, Block body); + + void generateFile(ClassDeclaration mainClass, List innerClasses); + + void generateType(String typeString); + + void generateComment(String comment); + + void generateNoOp(); +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/IfStatement.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/IfStatement.java new file mode 100755 index 00000000000..f8fdef85fd4 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/IfStatement.java @@ -0,0 +1,62 @@ +/* + * 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.codegen.ast; + +import java.util.Arrays; +import java.util.List; + +public class IfStatement extends Statement { + + private List condition; + private List blocks; + + IfStatement(Expression condition, Block body, Block orElse) { + this.condition = Arrays.asList(condition); + if (orElse == null) { + this.blocks = Arrays.asList(body); + } else { + this.blocks = Arrays.asList(body, orElse); + } + } + + IfStatement(List condition, List blocks) { + assert condition.size() == blocks.size() || condition.size() == (blocks.size() -1); + this.condition = condition; + this.blocks = blocks; + } + + public List getConditions() { + return condition; + } + + public List getBlocks() { + return blocks; + } + + @Override + public T accept(NodeVisitor visitor) { + return null; + } + + @Override + public void write(Generator writer) { + writer.generate(this); + } + +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/JavaGenerator.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/JavaGenerator.java new file mode 100755 index 00000000000..ee928651277 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/JavaGenerator.java @@ -0,0 +1,351 @@ +/* + * 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.codegen.ast; + +import java.util.List; +import java.util.Set; + +public class JavaGenerator implements Generator { + + public static final String PUBLIC_ = "public "; + public static final String STATIC_ = "static "; + private final CodeWriter writer; + + public JavaGenerator(CodeWriter writer) { + this.writer = writer; + } + + @Override + public Node prepare(Node root) { + return root; + } + + @Override + public void generate(ConstantExpression constantExpression) { + writer.write(constantExpression.getValue().toString()); + } + + @Override + public void generateDeclarationWithInitializer(DeclarationStatement declarationStatement) { + declarationStatement.getParameterExpression().getType().write(this); + writer.write(" "); + declarationStatement.getParameterExpression().write(this); + writer.write(" = "); + declarationStatement.getInitializer().write(this); + } + + @Override + public void generateDeclaration(DeclarationStatement declarationStatement) { + declarationStatement.getParameterExpression().getType().write(this); + writer.write(" "); + declarationStatement.getParameterExpression().write(this); + } + + @Override + public void generate(ParameterExpression parameterExpression) { + writer.write(parameterExpression.getName()); + } + + @Override + public void generatePrimitive(Primitive.DataType primitive) { + switch (primitive) { + case STRING: + writer.write("String"); + break; + case DOUBLE: + writer.write("Double"); + break; + case LONG: + writer.write("Long"); + break; + case INTEGER: + writer.write("Integer"); + break; + case BOOLEAN: + writer.write("Boolean"); + break; + case VOID: + writer.write("Void"); + break; + default: + throw new UnsupportedOperationException("The primitive type " + primitive + " is not implemented!"); + } + } + + @Override + public void generate(IfStatement ifStatement) { + writer.startLine("if ("); + ifStatement.getConditions().get(0).write(this); + writer.write(") {\n"); + writeBlock(ifStatement.getBlocks().get(0)); + // For each remaining condition to an else if + for (int i = 1; i < ifStatement.getConditions().size(); i++) { + writer.startLine("} else if ("); + ifStatement.getConditions().get(i).write(this); + writer.write(") {\n"); + writeBlock(ifStatement.getBlocks().get(i)); + } + if (ifStatement.getBlocks().size() == ifStatement.getConditions().size() + 1) { + writer.writeLine("} else {"); + writeBlock(ifStatement.getBlocks().get(ifStatement.getBlocks().size() - 1)); + } + writer.writeLine("}"); + } + + @Override + public void writeBlock(Block statements) { + if (statements == null) { + return; + } + writer.startBlock(); + for (Node statement : statements.getStatements()) { + // Dont to the wrapping for If Statements + if (statement instanceof IfStatement) { + statement.write(this); + } else { + writer.startLine(""); + statement.write(this); + writer.write(";"); + writer.endLine(); + } + } + writer.endBlock(); + } + + @Override + public void generate(BinaryExpression binaryExpression) { + binaryExpression.getLeft().write(this); + writer.write(" "); + writer.write(getOperator(binaryExpression.getOp())); + writer.write(" "); + binaryExpression.getRight().write(this); + } + + @Override + public void generate(AssignementExpression assignementExpression) { + assignementExpression.getTarget().write(this); + writer.write(" = "); + assignementExpression.getValue().write(this); + } + + @Override + public void generateStaticCall(Method method, List arguments) { + writer.write(method.getType().getTypeString()); + writer.write("."); + writer.write(method.getName()); + writer.write("("); + generateArgumentList(arguments); + writer.write(")"); + } + + private void generateArgumentList(List arguments) { + for (int i = 0; i < arguments.size(); i++) { + arguments.get(i).write(this); + if (i < arguments.size() - 1) { + writer.write(", "); + } + } + } + + @Override + public void generateCall(Node target, Method method, List arguments) { + target.write(this); + writer.write("."); + writer.write(method.getName()); + writer.write("("); + generateArgumentList(arguments); + writer.write(")"); + } + + @Override + public void generate(NewExpression newExpression) { + writer.write("new "); + newExpression.getType().write(this); + writer.write("("); + generateArgumentList(newExpression.getArguments()); + writer.write(")"); + } + + @Override + public void generate(MethodDefinition methodDefinition) { + writer.startLine(PUBLIC_); + if (methodDefinition.getModifiers().contains(Modifier.STATIC)) { + writer.write(STATIC_); + } + // Special handling of VOID is necessary, to avoid having to return null in the end. + if (methodDefinition.getResultType() instanceof Primitive && + ((Primitive) methodDefinition.getResultType()).getType() == Primitive.DataType.VOID) { + writer.write("void"); + } else { + methodDefinition.getResultType().write(this); + } + writer.write(" "); + writer.write(methodDefinition.getName()); + writer.write("("); + for (int i = 0; i < methodDefinition.getParameters().size(); i++) { + methodDefinition.getParameters().get(i).getType().write(this); + writer.write(" "); + methodDefinition.getParameters().get(i).write(this); + if (i < methodDefinition.getParameters().size() - 1) { + writer.write(", "); + } + } + writer.write(") {"); + writer.endLine(); + methodDefinition.getBody().write(this); + writer.writeLine("}"); + } + + @Override + public void generateReturn(Expression value) { + writer.write("return "); + value.write(this); + } + + @Override + public void generateClass(String namespace, String className, List fields, List constructors, List methods, List innerClasses, boolean mainClass) { + // Add static?! + // Own File? + writer.startLine(PUBLIC_); + if (!mainClass) { + writer.write(STATIC_); + } + writer.write("class "); + writer.write(className); + // TODO extends / implements + writer.write(" {"); + writer.endLine(); + writer.startBlock(); + + writer.writeLine(""); + // Fields + for (FieldDeclaration field : fields) { + field.write(this); + writer.writeLine(""); + } + + // Constructors + if (constructors != null) { + for (ConstructorDeclaration constructor : constructors) { + this.generateConstructor(constructor.getModifiers(), className, constructor.getParameters(), constructor.getBody()); + writer.writeLine(""); + } + } + + // Methods + for (MethodDefinition method : methods) { + method.write(this); + writer.writeLine(""); + } + + // If there are inner classes, implement them + if (innerClasses != null) { + for (ClassDeclaration innerClass : innerClasses) { + this.generateClass(innerClass.getNamespace(), innerClass.getClassName(), innerClass.getFields(), innerClass.getConstructors(), innerClass.getMethods(), innerClass.getInnerClasses(), false); + } + } + + writer.endBlock(); + writer.writeLine("}"); + } + + @Override + public void generateFieldDeclaration(Set modifiers, TypeDefinition type, String name, Expression initializer) { + if (modifiers.contains(Modifier.PRIVATE)) { + writer.startLine("private "); + } else { + writer.startLine(PUBLIC_); + } + if (modifiers.contains(Modifier.STATIC)) { + writer.write(STATIC_); + } + if (modifiers.contains(Modifier.FINAL)) { + writer.write("final "); + } + type.write(this); + writer.write(" "); + writer.write(name); + // If it has an initializer, then do it here... + if (initializer != null) { + writer.write( " = "); + initializer.write(this); + } + writer.write(";"); + writer.endLine(); + } + + @Override + public void generateFieldReference(TypeDefinition type, String name) { + writer.write("this."); + writer.write(name); + } + + @Override + public void generateConstructor(Set modifiers, String className, List parameters, Block body) { + if (modifiers.contains(Modifier.PRIVATE)) { + writer.startLine("private "); + } else { + writer.startLine(PUBLIC_); + } + writer.write(className); + writer.write("("); + for (int i = 0; i < parameters.size(); i++) { + parameters.get(i).getType().write(this); + writer.write(" "); + parameters.get(i).write(this); + if (i < parameters.size() - 1) { + writer.write(", "); + } + } + writer.write(") {"); + writer.endLine(); + body.write(this); + writer.writeLine("}"); + } + + @Override + public void generateFile(ClassDeclaration mainClass, List innerClasses) { + generateClass(mainClass.getNamespace(), mainClass.getClassName(), mainClass.getFields(), mainClass.getConstructors(), mainClass.getMethods(), innerClasses, true); + } + + @Override + public void generateType(String typeString) { + writer.write(typeString); + } + + @Override + public void generateComment(String comment) { + writer.writeLine("// " + comment); + } + + @Override + public void generateNoOp() { + writer.write(";"); + } + + private String getOperator(BinaryExpression.Operation op) { + switch (op) { + case EQ: + return "=="; + case PLUS: + return "+"; + } + throw new UnsupportedOperationException("The Operator " + op + " is currently not implemented!"); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Method.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Method.java new file mode 100755 index 00000000000..f581925f414 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Method.java @@ -0,0 +1,73 @@ +/* + * 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.codegen.ast; + +import java.util.List; + +/** + * Method Declaration + * + * TODO is this duplicate to something??? + */ +public class Method implements Node { + + private final TypeDefinition type; // Type where this thing is defined on + private final String name; + private final TypeDefinition returnType; + private final List parameterTypes; + private final List expressionTypes; + + public Method(TypeDefinition type, String name, TypeDefinition returnType, List parameterTypes, List expressionTypes) { + this.type = type; + this.name = name; + this.returnType = returnType; + this.parameterTypes = parameterTypes; + this.expressionTypes = expressionTypes; + } + + public TypeDefinition getType() { + return type; + } + + public String getName() { + return name; + } + + public TypeDefinition getReturnType() { + return returnType; + } + + public List getParameterTypes() { + return parameterTypes; + } + + public List getExpressionTypes() { + return expressionTypes; + } + + @Override + public T accept(NodeVisitor visitor) { + return null; + } + + @Override + public void write(Generator writer) { + + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/MethodDefinition.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/MethodDefinition.java new file mode 100755 index 00000000000..9af66991da7 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/MethodDefinition.java @@ -0,0 +1,75 @@ +/* + * 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.codegen.ast; + +import java.util.Collections; +import java.util.List; +import java.util.Set; + +public class MethodDefinition implements Node { + + private final Set modifiers; + private final String name; + private final TypeDefinition resultType; + private final List parameters; + private final Block body; + + public MethodDefinition(Set modifiers, String name, TypeDefinition resultType, List parameters, Block body) { + this.modifiers = modifiers; + this.name = name; + this.resultType = resultType; + this.parameters = parameters; + this.body = body; + } + + public MethodDefinition(String name, TypeDefinition resultType, List parameters, Block body) { + this(Collections.emptySet(), name, resultType, parameters, body); + } + + public Set getModifiers() { + return modifiers; + } + + public String getName() { + return name; + } + + public TypeDefinition getResultType() { + return resultType; + } + + public List getParameters() { + return parameters; + } + + public Block getBody() { + return body; + } + + @Override + public T accept(NodeVisitor visitor) { + return null; + } + + @Override + public void write(Generator writer) { + writer.generate(this); + } + +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Modifier.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Modifier.java new file mode 100755 index 00000000000..d98b7847cbf --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Modifier.java @@ -0,0 +1,25 @@ +/* + * 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.codegen.ast; + +public enum Modifier { + STATIC, + PRIVATE, + FINAL +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/NodeVisitor.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/NodeVisitor.java new file mode 100755 index 00000000000..9465f9ff67c --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/NodeVisitor.java @@ -0,0 +1,28 @@ +/* + * 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.codegen.ast; + +public interface NodeVisitor { + + T visit(ConstantExpression constantExpression); + + T visit(DeclarationStatement declarationStatement); + + T visit(ParameterExpression parameterExpression); +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/ParameterExpression.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/ParameterExpression.java new file mode 100755 index 00000000000..1dd1687c10b --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/ParameterExpression.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.codegen.ast; + +public class ParameterExpression extends Expression { + + private final String name; + + ParameterExpression(TypeDefinition type, String name) { + super(type); + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } + + @Override + public void write(Generator generator) { + generator.generate(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Primitive.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Primitive.java new file mode 100755 index 00000000000..53af1f25958 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/Primitive.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.codegen.ast; + +public class Primitive extends TypeDefinition { + + // Shorthands + public static final Primitive VOID = new Primitive(DataType.VOID); + public static final Primitive BOOLEAN = new Primitive(DataType.BOOLEAN); + public static final Primitive INTEGER = new Primitive(DataType.INTEGER); + public static final Primitive LONG = new Primitive(DataType.LONG); + public static final Primitive DOUBLE = new Primitive(DataType.DOUBLE); + public static final Primitive STRING = new Primitive(DataType.STRING); + + private final DataType type; + + public Primitive(DataType dataType) { + super(dataType.toString()); + this.type = dataType; + } + + public DataType getType() { + return type; + } + + @Override + public T accept(NodeVisitor visitor) { + return null; + } + + @Override + public void write(Generator generator) { + generator.generatePrimitive(this.getType()); + } + + public enum DataType { + VOID, + BOOLEAN, + INTEGER, + LONG, + DOUBLE, + STRING + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/PythonGenerator.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/PythonGenerator.java new file mode 100755 index 00000000000..c40fdfe184e --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/PythonGenerator.java @@ -0,0 +1,341 @@ +/* + * 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.codegen.ast; + +import java.util.List; +import java.util.Set; + +public class PythonGenerator implements Generator { + + private final CodeWriter writer; + + public PythonGenerator(CodeWriter writer) { + this.writer = writer; + } + + @Override + public Node prepare(Node root) { + return null; + } + + @Override + public void generate(ConstantExpression constantExpression) { + writer.write(constantExpression.getValue().toString()); + } + + @Override + public void generateDeclarationWithInitializer(DeclarationStatement declarationStatement) { + declarationStatement.getParameterExpression().write(this); + writer.write(": "); + declarationStatement.getParameterExpression().getType().write(this); + writer.write(" = "); + declarationStatement.getInitializer().write(this); + } + + @Override + public void generateDeclaration(DeclarationStatement declarationStatement) { + declarationStatement.getParameterExpression().write(this); + writer.write(": "); + declarationStatement.getParameterExpression().getType().write(this); + writer.write(" = None"); + } + + @Override + public void generate(ParameterExpression parameterExpression) { + writer.write(parameterExpression.getName()); + } + + @Override + public void generatePrimitive(Primitive.DataType primitive) { + switch (primitive) { + case STRING: + writer.write("string"); + break; + case LONG: + case INTEGER: + writer.write("long"); + break; + case DOUBLE: + writer.write("float"); + break; + case BOOLEAN: + writer.write("bool"); + break; + case VOID: + default: + throw new UnsupportedOperationException("Primitive type " + primitive + " is not implemented!"); + } + } + + @Override + public void generate(IfStatement ifStatement) { + writer.startLine("if "); + ifStatement.getConditions().get(0).write(this); + writer.write(":\n"); + writeBlock(ifStatement.getBlocks().get(0)); + // For each remaining condition to an else if + for (int i = 1; i < ifStatement.getConditions().size(); i++) { + writer.startLine("elif "); + ifStatement.getConditions().get(i).write(this); + writer.write(":\n"); + writeBlock(ifStatement.getBlocks().get(i)); + } + if (ifStatement.getBlocks().size() == ifStatement.getConditions().size() + 1) { + writer.writeLine("else:"); + writeBlock(ifStatement.getBlocks().get(ifStatement.getBlocks().size() - 1)); + } + + + +// writer.startLine("if "); +// ifStatement.getConditions().get(0).write(this); +// writer.write(":\n"); +// writeBlock(ifStatement.getBlocks().get(0)); +// if (ifStatement.getBlocks().size() == 2 && ifStatement.getBlocks().get(1) != null) { +// writer.writeLine("else:"); +// writeBlock(ifStatement.getBlocks().get(1)); +// } + } + + @Override + public void writeBlock(Block statements) { + writer.startBlock(); + if (statements.getStatements().isEmpty()) { + writer.writeLine("pass"); + } + for (Node statement : statements.getStatements()) { + // Dont to the wrapping for If Statements + if (statement instanceof IfStatement) { + statement.write(this); + } else { + writer.startLine(""); + statement.write(this); + writer.endLine(); + } + } + writer.endBlock(); + } + + @Override + public void generate(BinaryExpression binaryExpression) { + binaryExpression.getLeft().write(this); + writer.write(" "); + writer.write(getOperator(binaryExpression.getOp())); + writer.write(" "); + binaryExpression.getRight().write(this); + } + + @Override + public void generate(AssignementExpression assignementExpression) { + assignementExpression.getTarget().write(this); + writer.write(" = "); + assignementExpression.getValue().write(this); + } + + @Override + public void generateStaticCall(Method method, List arguments) { + writer.write(method.getType().getTypeString()); + writer.write("."); + writer.write(method.getName()); + writer.write("("); + generateArgumentList(arguments); + writer.write(")"); + } + + private void generateArgumentList(List arguments) { + for (int i = 0; i < arguments.size(); i++) { + arguments.get(i).write(this); + if (i < arguments.size() - 1) { + writer.write(", "); + } + } + } + + @Override + public void generateCall(Node target, Method method, List arguments) { + target.write(this); + writer.write("."); + writer.write(method.getName()); + writer.write("("); + generateArgumentList(arguments); + writer.write(")"); + } + + @Override + public void generate(NewExpression newExpression) { + newExpression.getType().write(this); + writer.write("("); + generateArgumentList(newExpression.getArguments()); + writer.write(")"); + } + + @Override + public void generate(MethodDefinition methodDefinition) { + if (methodDefinition.getModifiers().contains(Modifier.STATIC)) { + writer.writeLine("@classmethod"); + } + writer.startLine("def "); + writer.write(methodDefinition.getName()); + writer.write("("); + writer.write("self"); + if (!methodDefinition.getParameters().isEmpty()) { + writer.write(", "); + } + for (int i = 0; i < methodDefinition.getParameters().size(); i++) { + methodDefinition.getParameters().get(i).write(this); + writer.write(": "); + methodDefinition.getParameters().get(i).getType().write(this); + if (i < methodDefinition.getParameters().size() - 1) { + writer.write(", "); + } + } + writer.write(") -> "); + // Special handling of VOID is necessary + if (methodDefinition.getResultType() == Primitive.VOID) { + writer.write("None"); + } else { + methodDefinition.getResultType().write(this); + } + writer.write(":"); + writer.endLine(); + methodDefinition.getBody().write(this); + } + + @Override + public void generateReturn(Expression value) { + writer.write("return "); + value.write(this); + } + + @Override + public void generateClass(String namespace, String className, List fields, List constructors, List methods, List innerClasses, boolean mainClass) { + // Add static?! + // Own File? + writer.startLine("class "); + writer.write(className); + // TODO extends / implements + writer.write(":"); + writer.endLine(); + writer.startBlock(); + + // Insert a pass if there are no fields or methods + if (fields.size() == 0 && methods.size() == 0) { + writer.writeLine("pass"); + } + + writer.writeLine(""); + + // Fields + for (FieldDeclaration field : fields) { + field.write(this); + writer.writeLine(""); + } + + // Constructors + if (constructors != null) { + for (ConstructorDeclaration constructor : constructors) { + this.generateConstructor(constructor.getModifiers(), className, constructor.getParameters(), constructor.getBody()); + writer.writeLine(""); + } + } + + // Methods + for (MethodDefinition method : methods) { + method.write(this); + writer.writeLine(""); + } + + // If there are inner classes, implement them + if (innerClasses != null) { + for (ClassDeclaration innerClass : innerClasses) { + this.generateClass(innerClass.getNamespace(), innerClass.getClassName(), innerClass.getFields(), innerClass.getConstructors(), innerClass.getMethods(), innerClass.getInnerClasses(), false); + } + } + + writer.endBlock(); + } + + @Override + public void generateFieldDeclaration(Set modifiers, TypeDefinition type, String name, Expression initializer) { + writer.startLine(""); + writer.write(name); + writer.write(": "); + type.write(this); + // If its static, assign here + if (initializer != null) { + assert modifiers.contains(Modifier.STATIC); + // TODO Python cannot self reference + writer.write(" = "); + initializer.write(this); + } + writer.endLine(); + } + + @Override + public void generateFieldReference(TypeDefinition type, String name) { + writer.write("self."); + writer.write(name); + } + + @Override + public void generateConstructor(Set modifiers, String className, List parameters, Block body) { + writer.startLine("def __init__("); + for (int i = 0; i < parameters.size(); i++) { + parameters.get(i).getType().write(this); + writer.write(" "); + parameters.get(i).write(this); + if (i < parameters.size() - 1) { + writer.write(", "); + } + } + writer.write("):"); + writer.endLine(); + body.write(this); + } + + @Override + public void generateFile(ClassDeclaration mainClass, List innerClasses) { + generateClass(mainClass.getNamespace(), mainClass.getClassName(), mainClass.getFields(), mainClass.getConstructors(), mainClass.getMethods(), innerClasses, true); + } + + @Override + public void generateType(String typeString) { + writer.write(typeString); + } + + @Override + public void generateComment(String comment) { + writer.writeLine("# " + comment); + } + + @Override + public void generateNoOp() { + writer.write("pass"); + } + + private String getOperator(BinaryExpression.Operation op) { + switch (op) { + case EQ: + return "=="; + case PLUS: + return "+"; + } + throw new UnsupportedOperationException("The Operator " + op + " is currently not implemented!"); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/TypeUtil.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/TypeUtil.java new file mode 100755 index 00000000000..88114a97268 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/ast/TypeUtil.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.ast; + +public class TypeUtil { + + public static TypeDefinition infer(Object o) { + if (o instanceof Double) { + return Primitive.DOUBLE; + } + throw new UnsupportedOperationException("No type available for object " + o); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AbstractNodeVisitor.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AbstractNodeVisitor.java new file mode 100755 index 00000000000..bb3a5e584da --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AbstractNodeVisitor.java @@ -0,0 +1,259 @@ +/* + * 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.codegen.python; + + +public class AbstractNodeVisitor implements NodeVisitor { + + @Override + public T visit(AugAssignNode augAssignNode) { + augAssignNode.getOp().accept(this); + augAssignNode.getTarget().accept(this); + augAssignNode.getValue().accept(this); + return null; + } + + @Override + public T visit(AddNode addNode) { + return null; + } + + @Override + public T visit(EqNode eqNode) { + return null; + } + + @Override + public T visit(IfNode ifNode) { + for (Node node : ifNode.getBody()) { + node.accept(this); + } + for (Node node : ifNode.getOrelse()) { + node.accept(this); + } + ifNode.getTest().accept(this); + return null; + } + + @Override + public T visit(WhileNode whileNode) { + for (Node node : whileNode.getBody()) { + node.accept(this); + } + for (Node node : whileNode.getOrelse()) { + node.accept(this); + } + whileNode.getTest().accept(this); + return null; + } + + @Override + public T visit(NotEqNode notEqNode) { + return null; + } + + @Override + public T visit(NumNode numNode) { + return null; + } + + @Override + public T visit(PassNode passNode) { + return null; + } + + @Override + public T visit(ReturnNode returnNode) { + returnNode.getValue().accept(this); + return null; + } + + @Override + public T visit(StoreNode storeNode) { + return null; + } + + @Override + public T visit(StrNode strNode) { + return null; + } + + @Override + public T visit(TupleNode tupleNode) { + for (Node elt : tupleNode.getElts()) { + elt.accept(this); + } + return null; + } + + @Override + public T visit(NameNode nameNode) { + return null; + } + + @Override + public T visit(NameConstantNode nameConstantNode) { + return null; + } + + @Override + public T visit(MultNode multNode) { + return null; + } + + @Override + public T visit(ModuleNode moduleNode) { + for (Node node : moduleNode.getBody()) { + node.accept(this); + } + return null; + } + + @Override + public T visit(LoadNode loadNode) { + return null; + } + + @Override + public T visit(ListNode listNode) { + for (Node elt : listNode.getElts()) { + elt.accept(this); + } + return null; + } + + @Override + public T visit(KeywordNode keywordNode) { + keywordNode.getValue().accept(this); + return null; + } + + @Override + public T visit(ImportFromNode importFromNode) { + for (Node name : importFromNode.getNames()) { + name.accept(this); + } + return null; + } + + @Override + public T visit(FunctionDefNode functionDefNode) { + functionDefNode.getArgs().accept(this); + for (Node node : functionDefNode.getBody()) { + node.accept(this); + } + if (functionDefNode.getReturns() != null) { + functionDefNode.getReturns().accept(this); + } + return null; + } + + @Override + public T visit(ExprNode exprNode) { + return exprNode.getValue().accept(this); + } + + @Override + public T visit(CompareNode compareNode) { + for (Node comparator : compareNode.getComparators()) { + comparator.accept(this); + } + compareNode.getLeft().accept(this); + for (Node op : compareNode.getOps()) { + op.accept(this); + } + return null; + } + + @Override + public T visit(AliasNode aliasNode) { + return null; + } + + @Override + public T visit(AnnAssignerNode annAssignerNode) { + annAssignerNode.getAnnotation().accept(this); + annAssignerNode.getTarget().accept(this); + if (annAssignerNode.getValue() != null) { + return annAssignerNode.getValue().accept(this); + } else { + return null; + } + } + + @Override + public T visit(ArgNode argNode) { + if (argNode.getAnnotation() != null) { + return argNode.getAnnotation().accept(this); + } else { + return null; + } + } + + @Override + public T visit(ClassDefNode classDefNode) { + for (Node basis : classDefNode.getBases()) { + basis.accept(this); + } + for (Node node : classDefNode.getBody()) { + node.accept(this); + } + return null; + } + + @Override + public T visit(CallNode callNode) { + for (Node arg : callNode.getArgs()) { + arg.accept(this); + } + for (Node keyword : callNode.getKeywords()) { + keyword.accept(this); + } + return callNode.getFunc().accept(this); + } + + @Override + public T visit(BinOpNode binOpNode) { + binOpNode.getLeft().accept(this); + binOpNode.getOp().accept(this); + binOpNode.getRight().accept(this); + return null; + } + + @Override + public T visit(AttributeNode attributeNode) { + return attributeNode.getValue().accept(this); + } + + @Override + public T visit(AssignNode assignNode) { + for (Node target : assignNode.getTargets()) { + target.accept(this); + } + return assignNode.getValue().accept(this); + } + + @Override + public T visit(ArgumentsNode argumentsNode) { + for (Node arg : argumentsNode.getArgs()) { + arg.accept(this); + } + return null; + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AddNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AddNode.java new file mode 100755 index 00000000000..d00c57b97b4 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AddNode.java @@ -0,0 +1,31 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Add") +public class AddNode extends Node { + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } + +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AliasNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AliasNode.java new file mode 100755 index 00000000000..bbd7667813b --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AliasNode.java @@ -0,0 +1,53 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("alias") +public class AliasNode extends Node { + + @JsonProperty("asname") + private String asname; + + @JsonProperty("name") + private String name; + + public String getAsname() { + return asname; + } + + public void setAsname(String asname) { + this.asname = asname; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AnnAssignerNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AnnAssignerNode.java new file mode 100755 index 00000000000..0d1972ec8f3 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AnnAssignerNode.java @@ -0,0 +1,75 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("AnnAssign") +public class AnnAssignerNode extends LineEntryNode { + + @JsonProperty("annotation") + private Node annotation; + + @JsonProperty("simple") + private int simple; + + @JsonProperty("target") + private Node target; + + @JsonProperty("value") + private Node value; + + public Node getAnnotation() { + return annotation; + } + + public void setAnnotation(Node annotation) { + this.annotation = annotation; + } + + public int getSimple() { + return simple; + } + + public void setSimple(int simple) { + this.simple = simple; + } + + public Node getTarget() { + return target; + } + + public void setTarget(Node target) { + this.target = target; + } + + public Node getValue() { + return value; + } + + public void setValue(Node value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ArgNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ArgNode.java new file mode 100755 index 00000000000..b5a3b5ecba8 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ArgNode.java @@ -0,0 +1,53 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("arg") +public class ArgNode extends LineEntryNode { + + @JsonProperty("annotation") + private Node annotation; + + @JsonProperty("arg") + private String arg; + + public Node getAnnotation() { + return annotation; + } + + public void setAnnotation(Node annotation) { + this.annotation = annotation; + } + + public String getArg() { + return arg; + } + + public void setArg(String arg) { + this.arg = arg; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ArgumentsNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ArgumentsNode.java new file mode 100755 index 00000000000..bfcc08cb8be --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ArgumentsNode.java @@ -0,0 +1,47 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("arguments") +@JsonIgnoreProperties(ignoreUnknown = true) +public class ArgumentsNode extends Node { + + @JsonProperty("args") + private List args = new ArrayList<>(); + + public List getArgs() { + return args; + } + + public void setArgs(List args) { + this.args = args; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AssignNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AssignNode.java new file mode 100755 index 00000000000..b88056acb8a --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AssignNode.java @@ -0,0 +1,56 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("Assign") +public class AssignNode extends LineEntryNode { + + @JsonProperty("targets") + private List targets = new ArrayList<>(); + + @JsonProperty("value") + private Node value; + + public List getTargets() { + return targets; + } + + public void setTargets(List targets) { + this.targets = targets; + } + + public Node getValue() { + return value; + } + + public void setValue(Node value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AttributeNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AttributeNode.java new file mode 100755 index 00000000000..e8ae85746b7 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AttributeNode.java @@ -0,0 +1,64 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Attribute") +public class AttributeNode extends LineEntryNode { + + @JsonProperty("attr") + private String attr; + + @JsonProperty("ctx") + private ContextNode ctx; + + @JsonProperty("value") + private Node value; + + public String getAttr() { + return attr; + } + + public void setAttr(String attr) { + this.attr = attr; + } + + public ContextNode getCtx() { + return ctx; + } + + public void setCtx(ContextNode ctx) { + this.ctx = ctx; + } + + public Node getValue() { + return value; + } + + public void setValue(Node value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AugAssignNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AugAssignNode.java new file mode 100755 index 00000000000..f377b2dafd1 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/AugAssignNode.java @@ -0,0 +1,64 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("AugAssign") +public class AugAssignNode extends LineEntryNode { + + @JsonProperty("op") + private Node op; + + @JsonProperty("target") + private Node target; + + @JsonProperty("value") + private Node value; + + public Node getOp() { + return op; + } + + public void setOp(Node op) { + this.op = op; + } + + public Node getTarget() { + return target; + } + + public void setTarget(Node target) { + this.target = target; + } + + public Node getValue() { + return value; + } + + public void setValue(Node value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/BinOpNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/BinOpNode.java new file mode 100755 index 00000000000..38c57c55b5b --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/BinOpNode.java @@ -0,0 +1,64 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("BinOp") +public class BinOpNode extends LineEntryNode { + + @JsonProperty("left") + private Node left; + + @JsonProperty("op") + private Node op; + + @JsonProperty("right") + private Node right; + + public Node getLeft() { + return left; + } + + public void setLeft(Node left) { + this.left = left; + } + + public Node getOp() { + return op; + } + + public void setOp(Node op) { + this.op = op; + } + + public Node getRight() { + return right; + } + + public void setRight(Node right) { + this.right = right; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CallNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CallNode.java new file mode 100755 index 00000000000..ac1133bfae9 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CallNode.java @@ -0,0 +1,67 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("Call") +public class CallNode extends LineEntryNode { + + @JsonProperty("args") + private List args = new ArrayList<>(); + + @JsonProperty("func") + private Node func; + + @JsonProperty("keywords") + private List keywords = new ArrayList<>(); + + public List getArgs() { + return args; + } + + public void setArgs(List args) { + this.args = args; + } + + public Node getFunc() { + return func; + } + + public void setFunc(Node func) { + this.func = func; + } + + public List getKeywords() { + return keywords; + } + + public void setKeywords(List keywords) { + this.keywords = keywords; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ClassDefNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ClassDefNode.java new file mode 100755 index 00000000000..dd14f4ccdbe --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ClassDefNode.java @@ -0,0 +1,74 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("ClassDef") +@JsonIgnoreProperties(ignoreUnknown = true) +public class ClassDefNode extends LineEntryNode { + + @JsonProperty("bases") + private List bases = new ArrayList<>(); + + @JsonProperty("body") + private List body = new ArrayList<>(); + + @JsonProperty("name") + private String name; + + @JsonCreator + public ClassDefNode() { + } + + public List getBases() { + return bases; + } + + public void setBases(List bases) { + this.bases = bases; + } + + public List getBody() { + return body; + } + + public void setBody(List body) { + this.body = body; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CodePrinter.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CodePrinter.java new file mode 100755 index 00000000000..31f9c937669 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CodePrinter.java @@ -0,0 +1,74 @@ +/* + * 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.codegen.python; + +import java.util.stream.IntStream; + +/** + * Helper class to print code. + */ +public class CodePrinter { + + private StringBuffer buffer = new StringBuffer(); + private int tabSize; + + private int intendationLvl = 0; + + public CodePrinter(int tabSize) { + this.tabSize = tabSize; + } + + public void startBlock() { + this.intendationLvl += tabSize; + } + + public void endBlock() { + if (intendationLvl < tabSize) { + throw new RuntimeException("Closing a Block which is not open!"); + } + this.intendationLvl -= tabSize; + } + + public void write(String s) { + buffer.append(s); + } + + public void startLine(String s) { + writeIntendation(); + } + + public void endLine() { + buffer.append("\n"); + } + + public void writeLine(String s) { + writeIntendation(); + buffer.append(s); + buffer.append("\n"); + } + + private void writeIntendation() { + // Write the intendation + IntStream.range(0, intendationLvl).forEach(i -> buffer.append(" ")); + } + + public String getCode() { + return buffer.toString(); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CompareNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CompareNode.java new file mode 100755 index 00000000000..0ed4191297d --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/CompareNode.java @@ -0,0 +1,67 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("Compare") +public class CompareNode extends LineEntryNode { + + @JsonProperty("comparators") + private List comparators = new ArrayList<>(); + + @JsonProperty("left") + private Node left; + + @JsonProperty("ops") + private List ops; + + public List getComparators() { + return comparators; + } + + public void setComparators(List comparators) { + this.comparators = comparators; + } + + public Node getLeft() { + return left; + } + + public void setLeft(Node left) { + this.left = left; + } + + public List getOps() { + return ops; + } + + public void setOps(List ops) { + this.ops = ops; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/EqNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/EqNode.java new file mode 100755 index 00000000000..c43de0ff869 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/EqNode.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Eq") +public class EqNode extends Node { + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ExprNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ExprNode.java new file mode 100755 index 00000000000..2521fe5bbe5 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ExprNode.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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Expr") +public class ExprNode extends LineEntryNode { + + @JsonProperty("value") + private Node value; + + public Node getValue() { + return value; + } + + public void setValue(Node value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/FunctionDefNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/FunctionDefNode.java new file mode 100755 index 00000000000..68adeaa0203 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/FunctionDefNode.java @@ -0,0 +1,80 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("FunctionDef") +@JsonIgnoreProperties(ignoreUnknown = true) +public class FunctionDefNode extends LineEntryNode { + + @JsonProperty("args") + private ArgumentsNode args; + + @JsonProperty("body") + private List body = new ArrayList<>(); + + @JsonProperty("name") + private String name; + + @JsonProperty("returns") + private Node returns; + + public ArgumentsNode getArgs() { + return args; + } + + public void setArgs(ArgumentsNode args) { + this.args = args; + } + + public List getBody() { + return body; + } + + public void setBody(List body) { + this.body = body; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Node getReturns() { + return returns; + } + + public void setReturns(Node returns) { + this.returns = returns; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/IfNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/IfNode.java new file mode 100755 index 00000000000..e48ba5b349f --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/IfNode.java @@ -0,0 +1,67 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("If") +public class IfNode extends LineEntryNode { + + @JsonProperty("body") + private List body = new ArrayList<>(); + + @JsonProperty("orelse") + private List orelse = new ArrayList<>(); + + @JsonProperty("test") + private Node test; + + public List getBody() { + return body; + } + + public void setBody(List body) { + this.body = body; + } + + public List getOrelse() { + return orelse; + } + + public void setOrelse(List orelse) { + this.orelse = orelse; + } + + public Node getTest() { + return test; + } + + public void setTest(Node test) { + this.test = test; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ImportFromNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ImportFromNode.java new file mode 100755 index 00000000000..e33ad014687 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ImportFromNode.java @@ -0,0 +1,67 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("ImportFrom") +public class ImportFromNode extends LineEntryNode { + + @JsonProperty("level") + private long level; + + @JsonProperty("module") + private String module; + + @JsonProperty("names") + private List names = new ArrayList<>(); + + public long getLevel() { + return level; + } + + public void setLevel(long level) { + this.level = level; + } + + public String getModule() { + return module; + } + + public void setModule(String module) { + this.module = module; + } + + public List getNames() { + return names; + } + + public void setNames(List names) { + this.names = names; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/KeywordNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/KeywordNode.java new file mode 100755 index 00000000000..d832ac182a0 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/KeywordNode.java @@ -0,0 +1,53 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("keyword") +public class KeywordNode extends Node { + + @JsonProperty("arg") + private String arg; + + @JsonProperty("value") + private Node value; + + public String getArg() { + return arg; + } + + public void setArg(String arg) { + this.arg = arg; + } + + public Node getValue() { + return value; + } + + public void setValue(Node value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/LineEntryNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/LineEntryNode.java new file mode 100755 index 00000000000..49e579266bb --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/LineEntryNode.java @@ -0,0 +1,46 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public abstract class LineEntryNode extends Node { + + @JsonProperty("col_offset") + private long colOffset; + + @JsonProperty("lineno") + private long lineno; + + public long getColOffset() { + return colOffset; + } + + public void setColOffset(long colOffset) { + this.colOffset = colOffset; + } + + public long getLineno() { + return lineno; + } + + public void setLineno(long lineno) { + this.lineno = lineno; + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ListNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ListNode.java new file mode 100755 index 00000000000..6a14af53d7d --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ListNode.java @@ -0,0 +1,56 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("List") +public class ListNode extends LineEntryNode { + + @JsonProperty("ctx") + private ContextNode ctx; + + @JsonProperty("elts") + private List elts = new ArrayList<>(); + + public ContextNode getCtx() { + return ctx; + } + + public void setCtx(ContextNode ctx) { + this.ctx = ctx; + } + + public List getElts() { + return elts; + } + + public void setElts(List elts) { + this.elts = elts; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/LoadNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/LoadNode.java new file mode 100755 index 00000000000..d2a9bddc8d5 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/LoadNode.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Load") +public class LoadNode extends ContextNode { + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ModuleNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ModuleNode.java new file mode 100755 index 00000000000..6f9f1fbd5f2 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ModuleNode.java @@ -0,0 +1,45 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("Module") +public class ModuleNode extends Node { + + @JsonProperty + private List body = new ArrayList<>(); + + public List getBody() { + return body; + } + + public void setBody(List body) { + this.body = body; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} \ No newline at end of file diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/MultNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/MultNode.java new file mode 100755 index 00000000000..67256fa2fc9 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/MultNode.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Mult") +public class MultNode extends LineEntryNode { + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NameConstantNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NameConstantNode.java new file mode 100755 index 00000000000..fe439542189 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NameConstantNode.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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("NameConstant") +public class NameConstantNode extends LineEntryNode { + + @JsonProperty("value") + private boolean value; + + public boolean isValue() { + return value; + } + + public void setValue(boolean value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NameNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NameNode.java new file mode 100755 index 00000000000..4d2bb832c0e --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NameNode.java @@ -0,0 +1,53 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Name") +public class NameNode extends LineEntryNode { + + @JsonProperty("ctx") + private ContextNode ctx; + + @JsonProperty("id") + private String id; + + public ContextNode getCtx() { + return ctx; + } + + public void setCtx(ContextNode ctx) { + this.ctx = ctx; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/Node.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/Node.java new file mode 100755 index 00000000000..562745a4543 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/Node.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + property = "_type") +public abstract class Node { + + public abstract T accept(NodeVisitor visitor); +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NodeVisitor.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NodeVisitor.java new file mode 100755 index 00000000000..29e292b3657 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NodeVisitor.java @@ -0,0 +1,86 @@ +/* + * 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.codegen.python; + +public interface NodeVisitor { + + T visit(AugAssignNode augAssignNode); + + T visit(AddNode addNode); + + T visit(EqNode eqNode); + + T visit(IfNode ifNode); + + T visit(WhileNode whileNode); + + T visit(NotEqNode notEqNode); + + T visit(NumNode numNode); + + T visit(PassNode passNode); + + T visit(ReturnNode returnNode); + + T visit(StoreNode storeNode); + + T visit(StrNode strNode); + + T visit(TupleNode tupleNode); + + T visit(NameNode nameNode); + + T visit(NameConstantNode nameConstantNode); + + T visit(MultNode multNode); + + T visit(ModuleNode moduleNode); + + T visit(LoadNode loadNode); + + T visit(ListNode listNode); + + T visit(KeywordNode keywordNode); + + T visit(ImportFromNode importFromNode); + + T visit(FunctionDefNode functionDefNode); + + T visit(ExprNode exprNode); + + T visit(CompareNode compareNode); + + T visit(AliasNode aliasNode); + + T visit(AnnAssignerNode annAssignerNode); + + T visit(ArgNode argNode); + + T visit(ClassDefNode classDefNode); + + T visit(CallNode callNode); + + T visit(BinOpNode binOpNode); + + T visit(AttributeNode attributeNode); + + T visit(AssignNode assignNode); + + T visit(ArgumentsNode argumentsNode); +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NotEqNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NotEqNode.java new file mode 100755 index 00000000000..fa80f0f934b --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NotEqNode.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("NotEq") +public class NotEqNode extends Node { + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NumNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NumNode.java new file mode 100755 index 00000000000..5bb6799dab7 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/NumNode.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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Num") +public class NumNode extends LineEntryNode { + + @JsonProperty("n") + private double n; + + public double getN() { + return n; + } + + public void setN(double n) { + this.n = n; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/PassNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/PassNode.java new file mode 100755 index 00000000000..0078f383662 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/PassNode.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Pass") +public class PassNode extends LineEntryNode { + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ReturnNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ReturnNode.java new file mode 100755 index 00000000000..da5d240832a --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/ReturnNode.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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Return") +public class ReturnNode extends LineEntryNode { + + @JsonProperty("value") + private Node value; + + public Node getValue() { + return value; + } + + public void setValue(Node value) { + this.value = value; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/StoreNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/StoreNode.java new file mode 100755 index 00000000000..d6143be7b73 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/StoreNode.java @@ -0,0 +1,29 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Store") +public class StoreNode extends ContextNode { + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/StrNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/StrNode.java new file mode 100755 index 00000000000..62fc16ee619 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/StrNode.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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName("Str") +public class StrNode extends LineEntryNode { + + @JsonProperty("s") + private String s; + + public String getS() { + return s; + } + + public void setS(String s) { + this.s = s; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/TupleNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/TupleNode.java new file mode 100755 index 00000000000..814da041956 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/TupleNode.java @@ -0,0 +1,56 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("Tuple") +public class TupleNode extends LineEntryNode { + + @JsonProperty("ctx") + private ContextNode ctx; + + @JsonProperty("elts") + private List elts = new ArrayList<>(); + + public ContextNode getCtx() { + return ctx; + } + + public void setCtx(ContextNode ctx) { + this.ctx = ctx; + } + + public List getElts() { + return elts; + } + + public void setElts(List elts) { + this.elts = elts; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/WhileNode.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/WhileNode.java new file mode 100755 index 00000000000..6b32f7623ff --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/python/WhileNode.java @@ -0,0 +1,67 @@ +/* + * 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.codegen.python; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.ArrayList; +import java.util.List; + +@JsonTypeName("While") +public class WhileNode extends LineEntryNode { + + @JsonProperty("body") + private List body = new ArrayList<>(); + + @JsonProperty("orelse") + private List orelse = new ArrayList<>(); + + @JsonProperty("test") + private Node test; + + public List getBody() { + return body; + } + + public void setBody(List body) { + this.body = body; + } + + public List getOrelse() { + return orelse; + } + + public void setOrelse(List orelse) { + this.orelse = orelse; + } + + public Node getTest() { + return test; + } + + public void setTest(Node test) { + this.test = test; + } + + @Override + public T accept(NodeVisitor visitor) { + return visitor.visit(this); + } +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/BufferUtil.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/BufferUtil.java new file mode 100755 index 00000000000..09de5e1de1a --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/BufferUtil.java @@ -0,0 +1,45 @@ +/* + * 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.codegen.util; + +import org.apache.plc4x.codegen.ast.Expressions; +import org.apache.plc4x.codegen.ast.Method; +import org.apache.plc4x.codegen.ast.Primitive; +import org.apache.plc4x.codegen.ast.TypeDefinition; + +import java.util.Collections; + +/** + * This class defines constants necessary for the code generation related to the + * "Buffer API" which has to be implemented natively. + */ +public class BufferUtil { + + static final TypeDefinition BUFFER_TYPE = Expressions.typeOf("org.apache.plc4x.codegen.api.Buffer"); + + // Read Methods + static final Method READ_UINT8 = new Method(BUFFER_TYPE, "readUint8", Primitive.INTEGER, Collections.emptyList(), Collections.emptyList()); + static final Method READ_UINT16 = new Method(BUFFER_TYPE, "readUint16", Primitive.INTEGER, Collections.emptyList(), Collections.emptyList()); + static final Method READ_UINT32 = new Method(BUFFER_TYPE, "readUint32", Primitive.LONG, Collections.emptyList(), Collections.emptyList()); + + private BufferUtil() { + } + + +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/EnumFactory.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/EnumFactory.java new file mode 100755 index 00000000000..70d982e8bfe --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/EnumFactory.java @@ -0,0 +1,153 @@ +/* + * 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.codegen.util; + +import org.apache.plc4x.codegen.ast.*; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * Creates Enum Like things... + */ +public class EnumFactory { + + public ClassDeclaration create(PojoDescription desc, List enumEntries) { + // Create all Fields first + final List constructorStatements = new ArrayList<>(); + final List fields = new ArrayList<>(); + for (Field field1 : desc.fields) { + FieldDeclaration fieldDeclaration = new FieldDeclaration(field1.getType(), field1.getName(), Modifier.PRIVATE, Modifier.FINAL); + fields.add(fieldDeclaration); + constructorStatements.add(Expressions.assignment( + Expressions.field(field1.getName()), + Expressions.parameter(field1.getName(), field1.getType()) + )); + } + + // Create the Getters + final List getters = desc.fields.stream() + .map(field -> getGetterDefinition(field.getName(), field.getType())) + .collect(Collectors.toList()); + + // Now add all these getters + final List methods = new ArrayList<>(getters); + + final ArrayList finalFields = new ArrayList<>(); + + // Now add all these static methods on top + for (EnumEntry enumEntry : enumEntries) { + final TypeDefinition clazzType = Expressions.typeOf(desc.getName()); + final String fieldName = enumEntry.getName().toUpperCase(); + finalFields.add(new FieldDeclaration( + new HashSet<>(Arrays.asList(Modifier.STATIC, Modifier.FINAL)), + clazzType, + fieldName, + Expressions.new_(clazzType, enumEntry.getArguments()) + )); + } + + finalFields.addAll(fields); + + // Add constructor + final ConstructorDeclaration constructor = new ConstructorDeclaration(Collections.singleton(Modifier.PRIVATE), + desc.fields.stream() + .map(field -> Expressions.parameter(field.getName(), field.getType())).collect(Collectors.toList()), + Block.build().add(constructorStatements).toBlock()); + + + return new ClassDeclaration("", desc.getName(), finalFields, Arrays.asList(constructor), methods, null); + } + + static MethodDefinition getGetterDefinition(String name, TypeDefinition type) { + String getter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); + Block body = Block.build().add(Expressions.return_(Expressions.field(name))).toBlock(); + return new MethodDefinition(getter, type, Collections.emptyList(), body); + } + + static MethodDefinition getSetterDefinition(String name, TypeDefinition type) { + String getter = "set" + name.substring(0, 1).toUpperCase() + name.substring(1); + final ParameterExpression param = Expressions.parameter(name, type); + Block body = Block.build().add(Expressions.assignment(Expressions.field(name), param)).toBlock(); + return new MethodDefinition(getter, Primitive.VOID, Collections.singletonList(param), body); + } + + public static class EnumEntry { + + private final String name; + private final List arguments; + + public EnumEntry(String name, List arguments) { + this.name = name; + this.arguments = arguments; + } + + public String getName() { + return name; + } + + public List getArguments() { + return arguments; + } + } + + public static class PojoDescription { + + private final String name; + private final List fields; + + public PojoDescription(String name, Field... fields) { + this.name = name; + this.fields = Arrays.asList(fields); + } + + public PojoDescription(String name, List fields) { + this.name = name; + this.fields = fields; + } + + public String getName() { + return name; + } + + public List getFields() { + return fields; + } + } + + public static class Field { + + private final TypeDefinition type; + private final String name; + + public Field(TypeDefinition type, String name) { + this.type = type; + this.name = name; + } + + public TypeDefinition getType() { + return type; + } + + public String getName() { + return name; + } + } + +} diff --git a/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/PojoFactory.java b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/PojoFactory.java new file mode 100755 index 00000000000..27971d8cf65 --- /dev/null +++ b/sandbox/code-gen/src/main/java/org/apache/plc4x/codegen/util/PojoFactory.java @@ -0,0 +1,120 @@ +/* + * 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.codegen.util; + +import org.apache.plc4x.codegen.ast.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static org.apache.plc4x.codegen.util.EnumFactory.getGetterDefinition; +import static org.apache.plc4x.codegen.util.EnumFactory.getSetterDefinition; + +public class PojoFactory { + + public ClassDeclaration create(PojoDescription desc) { + // Create all Fields first + final List fields = desc.fields.stream() + .map(field -> new FieldDeclaration(field.getType(), field.getName(), Modifier.PRIVATE)) + .collect(Collectors.toList()); + + // Create the Getters + final List getters = desc.fields.stream() + .map(field -> getGetterDefinition(field.getName(), field.getType())) + .collect(Collectors.toList()); + + // Create the Setters + final List setters = desc.fields.stream() + .map(field -> getSetterDefinition(field.getName(), field.getType())) + .collect(Collectors.toList()); + + final List methods = new ArrayList<>(); + + methods.addAll(getters); + methods.addAll(setters); + + // Encode Method + methods.add(new MethodDefinition("encode", Primitive.VOID, Collections.singletonList( + Expressions.parameter("buffer", BufferUtil.BUFFER_TYPE) + ), Block.build().toBlock())); + + // Decode Method + final ParameterExpression buffer = Expressions.parameter("buffer", BufferUtil.BUFFER_TYPE); + final TypeDefinition clazz = Expressions.typeOf(desc.getName()); + final ParameterExpression instance = Expressions.parameter("instance", clazz); + methods.add(new MethodDefinition(Collections.singleton(Modifier.STATIC), "decode", clazz, Collections.singletonList( + buffer + ), Block.build() + .add(Expressions.declaration(instance, Expressions.new_(clazz))) + .add(Expressions.call(buffer, BufferUtil.READ_UINT8)) + .add(Expressions.return_(instance)) + .toBlock() + )); + + + return new ClassDeclaration("", desc.getName(), fields, Arrays.asList(new ConstructorDeclaration(Collections.emptyList(), Block.EMPTY_BLOCK)), methods, null); + } + + public static class PojoDescription { + + private final String name; + private final List fields; + + public PojoDescription(String name, Field... fields) { + this.name = name; + this.fields = Arrays.asList(fields); + } + + public PojoDescription(String name, List fields) { + this.name = name; + this.fields = fields; + } + + public String getName() { + return name; + } + + public List getFields() { + return fields; + } + } + + public static class Field { + + private final TypeDefinition type; + private final String name; + + public Field(TypeDefinition type, String name) { + this.type = type; + this.name = name; + } + + public TypeDefinition getType() { + return type; + } + + public String getName() { + return name; + } + } + +} diff --git a/sandbox/code-gen/src/main/resources/example.json b/sandbox/code-gen/src/main/resources/example.json new file mode 100755 index 00000000000..8faa3d9cb48 --- /dev/null +++ b/sandbox/code-gen/src/main/resources/example.json @@ -0,0 +1,142 @@ +{ + "_type": "Module", + "body": [ + { + "_type": "ClassDef", + "bases": [], + "body": [ + { + "_type": "Pass", + "col_offset": 4, + "lineno": 5 + } + ], + "col_offset": 0, + "decorator_list": [], + "keywords": [], + "lineno": 4, + "name": "MyClass" + }, + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Expr", + "col_offset": 4, + "lineno": 8, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Str", + "col_offset": 10, + "lineno": 8, + "s": "Hallo" + } + ], + "col_offset": 4, + "func": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "print", + "lineno": 8 + }, + "keywords": [], + "lineno": 8 + } + } + ], + "col_offset": 0, + "decorator_list": [], + "lineno": 7, + "name": "myMethod", + "returns": null + }, + { + "_type": "Expr", + "col_offset": 0, + "lineno": 10, + "value": { + "_type": "Call", + "args": [], + "col_offset": 0, + "func": { + "_type": "Name", + "col_offset": 0, + "ctx": { + "_type": "Load" + }, + "id": "myMethod", + "lineno": 10 + }, + "keywords": [], + "lineno": 10 + } + }, + { + "_type": "AnnAssign", + "annotation": { + "_type": "Name", + "col_offset": 3, + "ctx": { + "_type": "Load" + }, + "id": "Integer", + "lineno": 12 + }, + "col_offset": 0, + "lineno": 12, + "simple": 1, + "target": { + "_type": "Name", + "col_offset": 0, + "ctx": { + "_type": "Store" + }, + "id": "a", + "lineno": 12 + }, + "value": { + "_type": "Num", + "col_offset": 13, + "lineno": 12, + "n": 5 + } + }, + { + "_type": "AugAssign", + "col_offset": 0, + "lineno": 14, + "op": { + "_type": "Add" + }, + "target": { + "_type": "Name", + "col_offset": 0, + "ctx": { + "_type": "Store" + }, + "id": "a", + "lineno": 14 + }, + "value": { + "_type": "Num", + "col_offset": 5, + "lineno": 14, + "n": 1 + } + } + ] +} \ No newline at end of file diff --git a/sandbox/code-gen/src/main/resources/example2.json b/sandbox/code-gen/src/main/resources/example2.json new file mode 100755 index 00000000000..ea0f37061c4 --- /dev/null +++ b/sandbox/code-gen/src/main/resources/example2.json @@ -0,0 +1,2129 @@ +{ + "_type": "Module", + "body": [ + { + "_type": "ImportFrom", + "col_offset": 0, + "level": 0, + "lineno": 1, + "module": "pymodbus.datastore", + "names": [ + { + "_type": "alias", + "asname": null, + "name": "ModbusSlaveContext" + }, + { + "_type": "alias", + "asname": null, + "name": "ModbusSequentialDataBlock" + }, + { + "_type": "alias", + "asname": null, + "name": "ModbusServerContext" + } + ] + }, + { + "_type": "ImportFrom", + "col_offset": 0, + "level": 0, + "lineno": 2, + "module": "pymodbus.device", + "names": [ + { + "_type": "alias", + "asname": null, + "name": "ModbusDeviceIdentification" + } + ] + }, + { + "_type": "ImportFrom", + "col_offset": 0, + "level": 0, + "lineno": 3, + "module": "pymodbus.server.sync", + "names": [ + { + "_type": "alias", + "asname": null, + "name": "ModbusTcpServer" + }, + { + "_type": "alias", + "asname": null, + "name": "StartTcpServer" + } + ] + }, + { + "_type": "ImportFrom", + "col_offset": 0, + "level": 0, + "lineno": 5, + "module": "Api", + "names": [ + { + "_type": "alias", + "asname": null, + "name": "Message" + }, + { + "_type": "alias", + "asname": null, + "name": "Protocol" + }, + { + "_type": "alias", + "asname": null, + "name": "Buffer" + } + ] + }, + { + "_type": "ClassDef", + "bases": [ + { + "_type": "Name", + "col_offset": 17, + "ctx": { + "_type": "Load" + }, + "id": "object", + "lineno": 8 + } + ], + "body": [ + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 17, + "lineno": 10 + }, + { + "_type": "arg", + "annotation": { + "_type": "Name", + "col_offset": 33, + "ctx": { + "_type": "Load" + }, + "id": "Protocol", + "lineno": 10 + }, + "arg": "protocol", + "col_offset": 23, + "lineno": 10 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Assign", + "col_offset": 8, + "lineno": 11, + "targets": [ + { + "_type": "Attribute", + "attr": "protocol", + "col_offset": 8, + "ctx": { + "_type": "Store" + }, + "lineno": 11, + "value": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "self", + "lineno": 11 + } + } + ], + "value": { + "_type": "Name", + "col_offset": 24, + "ctx": { + "_type": "Load" + }, + "id": "protocol", + "lineno": 11 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 10, + "name": "__init__", + "returns": null + }, + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 16, + "lineno": 13 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Pass", + "col_offset": 8, + "lineno": 14 + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 13, + "name": "connect", + "returns": null + } + ], + "col_offset": 0, + "decorator_list": [], + "keywords": [], + "lineno": 8, + "name": "DriverBase" + }, + { + "_type": "ClassDef", + "bases": [ + { + "_type": "Name", + "col_offset": 14, + "ctx": { + "_type": "Load" + }, + "id": "Message", + "lineno": 17 + } + ], + "body": [ + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 15, + "lineno": 19 + }, + { + "_type": "arg", + "annotation": { + "_type": "Name", + "col_offset": 29, + "ctx": { + "_type": "Load" + }, + "id": "Buffer", + "lineno": 19 + }, + "arg": "buffer", + "col_offset": 21, + "lineno": 19 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Expr", + "col_offset": 8, + "lineno": 20, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Call", + "args": [ + { + "_type": "Str", + "col_offset": 30, + "lineno": 20, + "s": "Hallo I'm a Request" + }, + { + "_type": "Str", + "col_offset": 54, + "lineno": 20, + "s": "utf-8" + } + ], + "col_offset": 20, + "func": { + "_type": "Name", + "col_offset": 20, + "ctx": { + "_type": "Load" + }, + "id": "bytearray", + "lineno": 20 + }, + "keywords": [], + "lineno": 20 + } + ], + "col_offset": 8, + "func": { + "_type": "Attribute", + "attr": "send", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "lineno": 20, + "value": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "buffer", + "lineno": 20 + } + }, + "keywords": [], + "lineno": 20 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 19, + "name": "encode", + "returns": null + } + ], + "col_offset": 0, + "decorator_list": [], + "keywords": [], + "lineno": 17, + "name": "Request" + }, + { + "_type": "ClassDef", + "bases": [ + { + "_type": "Name", + "col_offset": 15, + "ctx": { + "_type": "Load" + }, + "id": "Message", + "lineno": 23 + } + ], + "body": [ + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 15, + "lineno": 26 + }, + { + "_type": "arg", + "annotation": { + "_type": "Name", + "col_offset": 29, + "ctx": { + "_type": "Load" + }, + "id": "Buffer", + "lineno": 26 + }, + "arg": "buffer", + "col_offset": 21, + "lineno": 26 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Assign", + "col_offset": 8, + "lineno": 27, + "targets": [ + { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Store" + }, + "id": "bytes", + "lineno": 27 + } + ], + "value": { + "_type": "Call", + "args": [], + "col_offset": 16, + "func": { + "_type": "Name", + "col_offset": 16, + "ctx": { + "_type": "Load" + }, + "id": "bytearray", + "lineno": 27 + }, + "keywords": [], + "lineno": 27 + } + }, + { + "_type": "Assign", + "col_offset": 8, + "lineno": 28, + "targets": [ + { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Store" + }, + "id": "b", + "lineno": 28 + } + ], + "value": { + "_type": "Call", + "args": [], + "col_offset": 12, + "func": { + "_type": "Attribute", + "attr": "readByte", + "col_offset": 12, + "ctx": { + "_type": "Load" + }, + "lineno": 28, + "value": { + "_type": "Name", + "col_offset": 12, + "ctx": { + "_type": "Load" + }, + "id": "buffer", + "lineno": 28 + } + }, + "keywords": [], + "lineno": 28 + } + }, + { + "_type": "While", + "body": [ + { + "_type": "Expr", + "col_offset": 12, + "lineno": 30, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Name", + "col_offset": 25, + "ctx": { + "_type": "Load" + }, + "id": "b", + "lineno": 30 + } + ], + "col_offset": 12, + "func": { + "_type": "Attribute", + "attr": "append", + "col_offset": 12, + "ctx": { + "_type": "Load" + }, + "lineno": 30, + "value": { + "_type": "Name", + "col_offset": 12, + "ctx": { + "_type": "Load" + }, + "id": "bytes", + "lineno": 30 + } + }, + "keywords": [], + "lineno": 30 + } + }, + { + "_type": "Assign", + "col_offset": 12, + "lineno": 31, + "targets": [ + { + "_type": "Name", + "col_offset": 12, + "ctx": { + "_type": "Store" + }, + "id": "b", + "lineno": 31 + } + ], + "value": { + "_type": "Call", + "args": [], + "col_offset": 16, + "func": { + "_type": "Attribute", + "attr": "readByte", + "col_offset": 16, + "ctx": { + "_type": "Load" + }, + "lineno": 31, + "value": { + "_type": "Name", + "col_offset": 16, + "ctx": { + "_type": "Load" + }, + "id": "buffer", + "lineno": 31 + } + }, + "keywords": [], + "lineno": 31 + } + } + ], + "col_offset": 8, + "lineno": 29, + "orelse": [], + "test": { + "_type": "Compare", + "col_offset": 14, + "comparators": [ + { + "_type": "Num", + "col_offset": 19, + "lineno": 29, + "n": 0 + } + ], + "left": { + "_type": "Name", + "col_offset": 14, + "ctx": { + "_type": "Load" + }, + "id": "b", + "lineno": 29 + }, + "lineno": 29, + "ops": [ + { + "_type": "NotEq" + } + ] + } + }, + { + "_type": "Expr", + "col_offset": 8, + "lineno": 32, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Call", + "args": [ + { + "_type": "Name", + "col_offset": 18, + "ctx": { + "_type": "Load" + }, + "id": "bytearray", + "lineno": 32 + } + ], + "col_offset": 14, + "func": { + "_type": "Name", + "col_offset": 14, + "ctx": { + "_type": "Load" + }, + "id": "str", + "lineno": 32 + }, + "keywords": [], + "lineno": 32 + } + ], + "col_offset": 8, + "func": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "print", + "lineno": 32 + }, + "keywords": [], + "lineno": 32 + } + }, + { + "_type": "Return", + "col_offset": 8, + "lineno": 33, + "value": { + "_type": "Call", + "args": [], + "col_offset": 15, + "func": { + "_type": "Name", + "col_offset": 15, + "ctx": { + "_type": "Load" + }, + "id": "Response", + "lineno": 33 + }, + "keywords": [], + "lineno": 33 + } + } + ], + "col_offset": 4, + "decorator_list": [ + { + "_type": "Name", + "col_offset": 5, + "ctx": { + "_type": "Load" + }, + "id": "classmethod", + "lineno": 25 + } + ], + "lineno": 25, + "name": "decode", + "returns": null + } + ], + "col_offset": 0, + "decorator_list": [], + "keywords": [], + "lineno": 23, + "name": "Response" + }, + { + "_type": "ClassDef", + "bases": [ + { + "_type": "Name", + "col_offset": 20, + "ctx": { + "_type": "Load" + }, + "id": "DriverBase", + "lineno": 36 + } + ], + "body": [ + { + "_type": "AnnAssign", + "annotation": { + "_type": "Name", + "col_offset": 12, + "ctx": { + "_type": "Load" + }, + "id": "Buffer", + "lineno": 37 + }, + "col_offset": 4, + "lineno": 37, + "simple": 1, + "target": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "id": "buffer", + "lineno": 37 + }, + "value": null + }, + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 17, + "lineno": 39 + }, + { + "_type": "arg", + "annotation": { + "_type": "Name", + "col_offset": 33, + "ctx": { + "_type": "Load" + }, + "id": "Protocol", + "lineno": 39 + }, + "arg": "protocol", + "col_offset": 23, + "lineno": 39 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Expr", + "col_offset": 8, + "lineno": 40, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Name", + "col_offset": 25, + "ctx": { + "_type": "Load" + }, + "id": "protocol", + "lineno": 40 + } + ], + "col_offset": 8, + "func": { + "_type": "Attribute", + "attr": "__init__", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "lineno": 40, + "value": { + "_type": "Call", + "args": [], + "col_offset": 8, + "func": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "super", + "lineno": 40 + }, + "keywords": [], + "lineno": 40 + } + }, + "keywords": [], + "lineno": 40 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 39, + "name": "__init__", + "returns": null + }, + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 16, + "lineno": 42 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Assign", + "col_offset": 8, + "lineno": 44, + "targets": [ + { + "_type": "Attribute", + "attr": "buffer", + "col_offset": 8, + "ctx": { + "_type": "Store" + }, + "lineno": 44, + "value": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "self", + "lineno": 44 + } + } + ], + "value": { + "_type": "Call", + "args": [], + "col_offset": 22, + "func": { + "_type": "Attribute", + "attr": "connect", + "col_offset": 22, + "ctx": { + "_type": "Load" + }, + "lineno": 44, + "value": { + "_type": "Attribute", + "attr": "protocol", + "col_offset": 22, + "ctx": { + "_type": "Load" + }, + "lineno": 44, + "value": { + "_type": "Name", + "col_offset": 22, + "ctx": { + "_type": "Load" + }, + "id": "self", + "lineno": 44 + } + } + }, + "keywords": [], + "lineno": 44 + } + }, + { + "_type": "AnnAssign", + "annotation": { + "_type": "Name", + "col_offset": 17, + "ctx": { + "_type": "Load" + }, + "id": "Request", + "lineno": 46 + }, + "col_offset": 8, + "lineno": 46, + "simple": 1, + "target": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Store" + }, + "id": "request", + "lineno": 46 + }, + "value": { + "_type": "Call", + "args": [], + "col_offset": 27, + "func": { + "_type": "Name", + "col_offset": 27, + "ctx": { + "_type": "Load" + }, + "id": "Request", + "lineno": 46 + }, + "keywords": [], + "lineno": 46 + } + }, + { + "_type": "Expr", + "col_offset": 8, + "lineno": 48, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Attribute", + "attr": "buffer", + "col_offset": 23, + "ctx": { + "_type": "Load" + }, + "lineno": 48, + "value": { + "_type": "Name", + "col_offset": 23, + "ctx": { + "_type": "Load" + }, + "id": "self", + "lineno": 48 + } + } + ], + "col_offset": 8, + "func": { + "_type": "Attribute", + "attr": "encode", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "lineno": 48, + "value": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "request", + "lineno": 48 + } + }, + "keywords": [], + "lineno": 48 + } + }, + { + "_type": "Expr", + "col_offset": 8, + "lineno": 51, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Name", + "col_offset": 28, + "ctx": { + "_type": "Load" + }, + "id": "Response", + "lineno": 51 + } + ], + "col_offset": 8, + "func": { + "_type": "Attribute", + "attr": "receive", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "lineno": 51, + "value": { + "_type": "Attribute", + "attr": "buffer", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "lineno": 51, + "value": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "self", + "lineno": 51 + } + } + }, + "keywords": [], + "lineno": 51 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 42, + "name": "connect", + "returns": null + } + ], + "col_offset": 0, + "decorator_list": [], + "keywords": [], + "lineno": 36, + "name": "ExampleDriver" + }, + { + "_type": "ClassDef", + "bases": [ + { + "_type": "Name", + "col_offset": 18, + "ctx": { + "_type": "Load" + }, + "id": "Buffer", + "lineno": 54 + } + ], + "body": [ + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 17, + "lineno": 56 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Return", + "col_offset": 8, + "lineno": 57, + "value": { + "_type": "Num", + "col_offset": 15, + "lineno": 57, + "n": 0 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 56, + "name": "readByte", + "returns": null + }, + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 13, + "lineno": 59 + }, + { + "_type": "arg", + "annotation": { + "_type": "Name", + "col_offset": 26, + "ctx": { + "_type": "Load" + }, + "id": "bytearray", + "lineno": 59 + }, + "arg": "bytes", + "col_offset": 19, + "lineno": 59 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Expr", + "col_offset": 8, + "lineno": 60, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Call", + "args": [ + { + "_type": "Name", + "col_offset": 18, + "ctx": { + "_type": "Load" + }, + "id": "bytes", + "lineno": 60 + } + ], + "col_offset": 14, + "func": { + "_type": "Name", + "col_offset": 14, + "ctx": { + "_type": "Load" + }, + "id": "str", + "lineno": 60 + }, + "keywords": [], + "lineno": 60 + } + ], + "col_offset": 8, + "func": { + "_type": "Name", + "col_offset": 8, + "ctx": { + "_type": "Load" + }, + "id": "print", + "lineno": 60 + }, + "keywords": [], + "lineno": 60 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 59, + "name": "send", + "returns": null + }, + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 16, + "lineno": 62 + }, + { + "_type": "arg", + "annotation": { + "_type": "Name", + "col_offset": 32, + "ctx": { + "_type": "Load" + }, + "id": "type", + "lineno": 62 + }, + "arg": "response", + "col_offset": 22, + "lineno": 62 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Return", + "col_offset": 8, + "lineno": 63, + "value": { + "_type": "Call", + "args": [ + { + "_type": "Name", + "col_offset": 31, + "ctx": { + "_type": "Load" + }, + "id": "self", + "lineno": 63 + } + ], + "col_offset": 15, + "func": { + "_type": "Attribute", + "attr": "decode", + "col_offset": 15, + "ctx": { + "_type": "Load" + }, + "lineno": 63, + "value": { + "_type": "Name", + "col_offset": 15, + "ctx": { + "_type": "Load" + }, + "id": "response", + "lineno": 63 + } + }, + "keywords": [], + "lineno": 63 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 62, + "name": "receive", + "returns": null + } + ], + "col_offset": 0, + "decorator_list": [], + "keywords": [], + "lineno": 54, + "name": "DummyBuffer" + }, + { + "_type": "ClassDef", + "bases": [ + { + "_type": "Name", + "col_offset": 20, + "ctx": { + "_type": "Load" + }, + "id": "Protocol", + "lineno": 66 + } + ], + "body": [ + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 16, + "lineno": 68 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Return", + "col_offset": 8, + "lineno": 69, + "value": { + "_type": "Call", + "args": [], + "col_offset": 15, + "func": { + "_type": "Name", + "col_offset": 15, + "ctx": { + "_type": "Load" + }, + "id": "DummyBuffer", + "lineno": 69 + }, + "keywords": [], + "lineno": 69 + } + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 68, + "name": "connect", + "returns": { + "_type": "Name", + "col_offset": 25, + "ctx": { + "_type": "Load" + }, + "id": "Buffer", + "lineno": 68 + } + }, + { + "_type": "FunctionDef", + "args": { + "_type": "arguments", + "args": [ + { + "_type": "arg", + "annotation": null, + "arg": "self", + "col_offset": 14, + "lineno": 71 + } + ], + "defaults": [], + "kw_defaults": [], + "kwarg": null, + "kwonlyargs": [], + "vararg": null + }, + "body": [ + { + "_type": "Pass", + "col_offset": 8, + "lineno": 72 + } + ], + "col_offset": 4, + "decorator_list": [], + "lineno": 71, + "name": "close", + "returns": null + } + ], + "col_offset": 0, + "decorator_list": [], + "keywords": [], + "lineno": 66, + "name": "DummyProtocol" + }, + { + "_type": "If", + "body": [ + { + "_type": "Assign", + "col_offset": 4, + "lineno": 77, + "targets": [ + { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "id": "store", + "lineno": 77 + } + ], + "value": { + "_type": "Call", + "args": [], + "col_offset": 12, + "func": { + "_type": "Name", + "col_offset": 12, + "ctx": { + "_type": "Load" + }, + "id": "ModbusSlaveContext", + "lineno": 77 + }, + "keywords": [ + { + "_type": "keyword", + "arg": "di", + "value": { + "_type": "Call", + "args": [ + { + "_type": "Num", + "col_offset": 37, + "lineno": 78, + "n": 0 + }, + { + "_type": "BinOp", + "col_offset": 40, + "left": { + "_type": "List", + "col_offset": 40, + "ctx": { + "_type": "Load" + }, + "elts": [ + { + "_type": "Num", + "col_offset": 41, + "lineno": 78, + "n": 17 + } + ], + "lineno": 78 + }, + "lineno": 78, + "op": { + "_type": "Mult" + }, + "right": { + "_type": "Num", + "col_offset": 47, + "lineno": 78, + "n": 100 + } + } + ], + "col_offset": 11, + "func": { + "_type": "Name", + "col_offset": 11, + "ctx": { + "_type": "Load" + }, + "id": "ModbusSequentialDataBlock", + "lineno": 78 + }, + "keywords": [], + "lineno": 78 + } + }, + { + "_type": "keyword", + "arg": "co", + "value": { + "_type": "Call", + "args": [ + { + "_type": "Num", + "col_offset": 37, + "lineno": 79, + "n": 0 + }, + { + "_type": "BinOp", + "col_offset": 40, + "left": { + "_type": "List", + "col_offset": 40, + "ctx": { + "_type": "Load" + }, + "elts": [ + { + "_type": "Num", + "col_offset": 41, + "lineno": 79, + "n": 17 + } + ], + "lineno": 79 + }, + "lineno": 79, + "op": { + "_type": "Mult" + }, + "right": { + "_type": "Num", + "col_offset": 47, + "lineno": 79, + "n": 100 + } + } + ], + "col_offset": 11, + "func": { + "_type": "Name", + "col_offset": 11, + "ctx": { + "_type": "Load" + }, + "id": "ModbusSequentialDataBlock", + "lineno": 79 + }, + "keywords": [], + "lineno": 79 + } + }, + { + "_type": "keyword", + "arg": "hr", + "value": { + "_type": "Call", + "args": [ + { + "_type": "Num", + "col_offset": 37, + "lineno": 80, + "n": 0 + }, + { + "_type": "BinOp", + "col_offset": 40, + "left": { + "_type": "List", + "col_offset": 40, + "ctx": { + "_type": "Load" + }, + "elts": [ + { + "_type": "Num", + "col_offset": 41, + "lineno": 80, + "n": 17 + } + ], + "lineno": 80 + }, + "lineno": 80, + "op": { + "_type": "Mult" + }, + "right": { + "_type": "Num", + "col_offset": 47, + "lineno": 80, + "n": 100 + } + } + ], + "col_offset": 11, + "func": { + "_type": "Name", + "col_offset": 11, + "ctx": { + "_type": "Load" + }, + "id": "ModbusSequentialDataBlock", + "lineno": 80 + }, + "keywords": [], + "lineno": 80 + } + }, + { + "_type": "keyword", + "arg": "ir", + "value": { + "_type": "Call", + "args": [ + { + "_type": "Num", + "col_offset": 37, + "lineno": 81, + "n": 0 + }, + { + "_type": "BinOp", + "col_offset": 40, + "left": { + "_type": "List", + "col_offset": 40, + "ctx": { + "_type": "Load" + }, + "elts": [ + { + "_type": "Num", + "col_offset": 41, + "lineno": 81, + "n": 17 + } + ], + "lineno": 81 + }, + "lineno": 81, + "op": { + "_type": "Mult" + }, + "right": { + "_type": "Num", + "col_offset": 47, + "lineno": 81, + "n": 100 + } + } + ], + "col_offset": 11, + "func": { + "_type": "Name", + "col_offset": 11, + "ctx": { + "_type": "Load" + }, + "id": "ModbusSequentialDataBlock", + "lineno": 81 + }, + "keywords": [], + "lineno": 81 + } + } + ], + "lineno": 77 + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 83, + "targets": [ + { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "id": "context", + "lineno": 83 + } + ], + "value": { + "_type": "Call", + "args": [], + "col_offset": 14, + "func": { + "_type": "Name", + "col_offset": 14, + "ctx": { + "_type": "Load" + }, + "id": "ModbusServerContext", + "lineno": 83 + }, + "keywords": [ + { + "_type": "keyword", + "arg": "slaves", + "value": { + "_type": "Name", + "col_offset": 41, + "ctx": { + "_type": "Load" + }, + "id": "store", + "lineno": 83 + } + }, + { + "_type": "keyword", + "arg": "single", + "value": { + "_type": "NameConstant", + "col_offset": 55, + "lineno": 83, + "value": true + } + } + ], + "lineno": 83 + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 90, + "targets": [ + { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "id": "identity", + "lineno": 90 + } + ], + "value": { + "_type": "Call", + "args": [], + "col_offset": 15, + "func": { + "_type": "Name", + "col_offset": 15, + "ctx": { + "_type": "Load" + }, + "id": "ModbusDeviceIdentification", + "lineno": 90 + }, + "keywords": [], + "lineno": 90 + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 91, + "targets": [ + { + "_type": "Attribute", + "attr": "VendorName", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "lineno": 91, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "identity", + "lineno": 91 + } + } + ], + "value": { + "_type": "Str", + "col_offset": 26, + "lineno": 91, + "s": "Pymodbus" + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 92, + "targets": [ + { + "_type": "Attribute", + "attr": "ProductCode", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "lineno": 92, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "identity", + "lineno": 92 + } + } + ], + "value": { + "_type": "Str", + "col_offset": 27, + "lineno": 92, + "s": "PM" + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 93, + "targets": [ + { + "_type": "Attribute", + "attr": "VendorUrl", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "lineno": 93, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "identity", + "lineno": 93 + } + } + ], + "value": { + "_type": "Str", + "col_offset": 25, + "lineno": 93, + "s": "http://github.com/riptideio/pymodbus/" + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 94, + "targets": [ + { + "_type": "Attribute", + "attr": "ProductName", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "lineno": 94, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "identity", + "lineno": 94 + } + } + ], + "value": { + "_type": "Str", + "col_offset": 27, + "lineno": 94, + "s": "Pymodbus Server" + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 95, + "targets": [ + { + "_type": "Attribute", + "attr": "ModelName", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "lineno": 95, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "identity", + "lineno": 95 + } + } + ], + "value": { + "_type": "Str", + "col_offset": 25, + "lineno": 95, + "s": "Pymodbus Server" + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 96, + "targets": [ + { + "_type": "Attribute", + "attr": "MajorMinorRevision", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "lineno": 96, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "identity", + "lineno": 96 + } + } + ], + "value": { + "_type": "Str", + "col_offset": 34, + "lineno": 96, + "s": "2.1.0" + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 102, + "targets": [ + { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "id": "server", + "lineno": 102 + } + ], + "value": { + "_type": "Call", + "args": [ + { + "_type": "Name", + "col_offset": 29, + "ctx": { + "_type": "Load" + }, + "id": "context", + "lineno": 102 + } + ], + "col_offset": 13, + "func": { + "_type": "Name", + "col_offset": 13, + "ctx": { + "_type": "Load" + }, + "id": "ModbusTcpServer", + "lineno": 102 + }, + "keywords": [ + { + "_type": "keyword", + "arg": "identity", + "value": { + "_type": "Name", + "col_offset": 47, + "ctx": { + "_type": "Load" + }, + "id": "identity", + "lineno": 102 + } + }, + { + "_type": "keyword", + "arg": "address", + "value": { + "_type": "Tuple", + "col_offset": 66, + "ctx": { + "_type": "Load" + }, + "elts": [ + { + "_type": "Str", + "col_offset": 66, + "lineno": 102, + "s": "localhost" + }, + { + "_type": "Num", + "col_offset": 79, + "lineno": 102, + "n": 5020 + } + ], + "lineno": 102 + } + } + ], + "lineno": 102 + } + }, + { + "_type": "Assign", + "col_offset": 4, + "lineno": 104, + "targets": [ + { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Store" + }, + "id": "drv", + "lineno": 104 + } + ], + "value": { + "_type": "Call", + "args": [ + { + "_type": "Call", + "args": [], + "col_offset": 24, + "func": { + "_type": "Name", + "col_offset": 24, + "ctx": { + "_type": "Load" + }, + "id": "DummyProtocol", + "lineno": 104 + }, + "keywords": [], + "lineno": 104 + } + ], + "col_offset": 10, + "func": { + "_type": "Name", + "col_offset": 10, + "ctx": { + "_type": "Load" + }, + "id": "ExampleDriver", + "lineno": 104 + }, + "keywords": [], + "lineno": 104 + } + }, + { + "_type": "Expr", + "col_offset": 4, + "lineno": 105, + "value": { + "_type": "Call", + "args": [], + "col_offset": 4, + "func": { + "_type": "Attribute", + "attr": "connect", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "lineno": 105, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "drv", + "lineno": 105 + } + }, + "keywords": [], + "lineno": 105 + } + }, + { + "_type": "Expr", + "col_offset": 4, + "lineno": 107, + "value": { + "_type": "Call", + "args": [], + "col_offset": 4, + "func": { + "_type": "Attribute", + "attr": "server_close", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "lineno": 107, + "value": { + "_type": "Name", + "col_offset": 4, + "ctx": { + "_type": "Load" + }, + "id": "server", + "lineno": 107 + } + }, + "keywords": [], + "lineno": 107 + } + } + ], + "col_offset": 0, + "lineno": 75, + "orelse": [], + "test": { + "_type": "Compare", + "col_offset": 3, + "comparators": [ + { + "_type": "Str", + "col_offset": 15, + "lineno": 75, + "s": "__main__" + } + ], + "left": { + "_type": "Name", + "col_offset": 3, + "ctx": { + "_type": "Load" + }, + "id": "__name__", + "lineno": 75 + }, + "lineno": 75, + "ops": [ + { + "_type": "Eq" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ModuleNodeTest.java b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ModuleNodeTest.java new file mode 100755 index 00000000000..ac9b6bf0acf --- /dev/null +++ b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ModuleNodeTest.java @@ -0,0 +1,199 @@ +/* + * 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.codegen; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.plc4x.codegen.python.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.io.IOException; +import java.util.Collections; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +class ModuleNodeTest { + + private ObjectMapper mapper; + + @BeforeEach + void setUp() { + mapper = new ObjectMapper(); + mapper.registerSubtypes(ModuleNode.class); + mapper.registerSubtypes(ClassDefNode.class); + mapper.registerSubtypes(PassNode.class); + mapper.registerSubtypes(FunctionDefNode.class); + mapper.registerSubtypes(ArgumentsNode.class); + mapper.registerSubtypes(ExprNode.class); + mapper.registerSubtypes(CallNode.class); + mapper.registerSubtypes(StrNode.class); + mapper.registerSubtypes(NameNode.class); + mapper.registerSubtypes(LoadNode.class); + mapper.registerSubtypes(AnnAssignerNode.class); + mapper.registerSubtypes(StoreNode.class); + mapper.registerSubtypes(NumNode.class); + mapper.registerSubtypes(AugAssignNode.class); + mapper.registerSubtypes(AddNode.class); + mapper.registerSubtypes(ImportFromNode.class); + mapper.registerSubtypes(AliasNode.class); + mapper.registerSubtypes(ArgNode.class); + mapper.registerSubtypes(AssignNode.class); + mapper.registerSubtypes(AttributeNode.class); + mapper.registerSubtypes(WhileNode.class); + mapper.registerSubtypes(CompareNode.class); + mapper.registerSubtypes(NotEqNode.class); + mapper.registerSubtypes(ReturnNode.class); + mapper.registerSubtypes(IfNode.class); + mapper.registerSubtypes(KeywordNode.class); + mapper.registerSubtypes(BinOpNode.class); + mapper.registerSubtypes(ListNode.class); + mapper.registerSubtypes(MultNode.class); + mapper.registerSubtypes(NameConstantNode.class); + mapper.registerSubtypes(TupleNode.class); + mapper.registerSubtypes(EqNode.class); + } + + @Test + void serialize() throws IOException { + final ModuleNode node = new ModuleNode(); + node.setBody(Collections.singletonList(new ClassDefNode())); + + final String s = mapper.writeValueAsString(node); + + System.out.println(s); + + // Reread + final Node root = mapper.readValue(s, Node.class); + + System.out.println(root); + } + + @Test + void deserializeExample() throws IOException { + final Node root = mapper.readValue(new File("src/main/resources/example.json"), Node.class); + + assertTrue(root instanceof ModuleNode); + assertTrue(((ModuleNode) root).getBody().get(0) instanceof ClassDefNode); + + // Print the node again + System.out.println(mapper.writeValueAsString(root)); + } + + @Test + void deserializeExample2() throws IOException { + final Node root = mapper.readValue(new File("src/main/resources/example2.json"), Node.class); + + assertTrue(root instanceof ModuleNode); + + // Print the node again + System.out.println(mapper.writeValueAsString(root)); + } + + @Test + void visitMinimalTree() throws IOException { + final Node root = mapper.readValue(new File("src/main/resources/example2.json"), Node.class); + + CodePrinter printer = new CodePrinter(4); + + NodeVisitor toString = new AbstractNodeVisitor() { + + + @Override + public String visit(CompareNode compareNode) { + assert compareNode.getComparators().size() == 1; + return compareNode.getLeft().accept(this) + " " + compareNode.getOps().get(0).accept(this) + " " + compareNode.getComparators().get(0).accept(this); + } + + @Override + public String visit(EqNode eqNode) { + return "=="; + } + + @Override + public String visit(NotEqNode notEqNode) { + return "!="; + } + + @Override + public String visit(NumNode numNode) { + return Double.toString(numNode.getN()); + } + + @Override + public String visit(StrNode strNode) { + return strNode.getS(); + } + + @Override + public String visit(NameNode nameNode) { + return nameNode.getId(); + } + + @Override + public String visit(AttributeNode attributeNode) { + return attributeNode.getAttr(); + } + + @Override + public String visit(CallNode callNode) { + final String function = callNode.getFunc().accept(this); + + String s = function + "("; + for (Node arg : callNode.getArgs()) { + s += arg.accept(this) + ", "; + } + for (Node keyword : callNode.getKeywords()) { + s += keyword.accept(this); + } + s += ")"; + return s; + } + + @Override + public String visit(KeywordNode keywordNode) { + return keywordNode.getArg() + " = " + keywordNode.getValue().accept(this); + } + + @Override + public String visit(AssignNode assignNode) { + assert assignNode.getTargets().size() == 1; + printer.writeLine(String.format("%s = %s;", assignNode.getTargets().get(0).accept(this), assignNode.getValue().accept(this))); ; + return super.visit(assignNode); + } + + @Override + public String visit(IfNode ifNode) { + printer.writeLine(String.format("If (%s) {", ifNode.getTest().accept(this))); + printer.startBlock(); + for (Node node : ifNode.getBody()) { + node.accept(this); + } + printer.endBlock(); + printer.writeLine("}"); + return null; + } + }; + + + root.accept(toString); + + System.out.println(printer.getCode()); + } +} \ No newline at end of file diff --git a/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ast/JavaGeneratorTest.java b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ast/JavaGeneratorTest.java new file mode 100755 index 00000000000..bc9618a488c --- /dev/null +++ b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ast/JavaGeneratorTest.java @@ -0,0 +1,314 @@ +/* + * 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.codegen.ast; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class JavaGeneratorTest { + + private CodeWriter writer; + private JavaGenerator generator; + + @BeforeEach + public void setUp() { + writer = new CodeWriter(4); + generator = new JavaGenerator(writer); + } + + @Test + public void writeDeclaration() { + final DeclarationStatement stmt = new DeclarationStatement(new ParameterExpression(Primitive.DOUBLE, "a"), new ConstantExpression(5.0)); + stmt.write(generator); + + final String code = writer.getCode(); + + assertEquals("Double a = 5.0", code); + } + + @Test + public void ifStatement() { + final Statement stmt = new IfStatement( + new BinaryExpression(Primitive.DOUBLE, new ParameterExpression(Primitive.DOUBLE, "a"), + new ConstantExpression(10.0), + BinaryExpression.Operation.EQ), + new Block(new DeclarationStatement(new ParameterExpression(Primitive.DOUBLE, "b"), new ConstantExpression(5.0))), + new Block(new DeclarationStatement(new ParameterExpression(Primitive.DOUBLE, "b"), new ConstantExpression(3.0))) + ); + + stmt.write(generator); + + final String code = writer.getCode(); + + assertEquals("if (a == 10.0) {\n" + + " Double b = 5.0;\n" + + "} else {\n" + + " Double b = 3.0;\n" + + "}\n", code); + } + + @Test + public void IfIf() { + final Statement stmt = new Block(Arrays.asList( + new DeclarationStatement(new ParameterExpression(Primitive.DOUBLE, "c"), null), + new IfStatement( + new BinaryExpression(Primitive.DOUBLE, new ParameterExpression(Primitive.DOUBLE, "a"), + new ConstantExpression(10.0), + BinaryExpression.Operation.EQ), + new Block( + new IfStatement( + new BinaryExpression(Primitive.DOUBLE, new ParameterExpression(Primitive.DOUBLE, "b"), + new ConstantExpression(10.0), + BinaryExpression.Operation.EQ), + new Block( + new AssignementExpression(new ParameterExpression(Primitive.DOUBLE, "c"), new ConstantExpression(5.0)), + new DeclarationStatement(new ParameterExpression(Primitive.DOUBLE, "d"), new ConstantExpression(100.0)) + ), + null + ) + ), + null + ))); + + stmt.write(generator); + + final String code = writer.getCode(); + + assertEquals(" Double c;\n" + + " if (a == 10.0) {\n" + + " if (b == 10.0) {\n" + + " c = 5.0;\n" + + " Double d = 100.0;\n" + + " }\n" + + " }\n", code); + } + + @Test + public void callStaticMethod() { + final TypeDefinition myClazz = new TypeDefinition("MyClazz"); + Expression expr = new CallExpression(new Method(myClazz, "toString", Primitive.VOID, Collections.singletonList(Primitive.DOUBLE), Collections.EMPTY_LIST), null, new ConstantExpression(5.0)); + + expr.write(generator); + + final String code = writer.getCode(); + + assertEquals("MyClazz.toString(5.0)", code); + } + + @Test + public void callMethod() { + final TypeDefinition myClazz = new TypeDefinition("MyClazz"); + Expression expr = new CallExpression(new Method(myClazz, "toString", Primitive.VOID, Collections.singletonList(Primitive.DOUBLE), Collections.EMPTY_LIST), new ParameterExpression(myClazz, "a"), new ConstantExpression(5.0)); + + expr.write(generator); + + final String code = writer.getCode(); + + assertEquals("a.toString(5.0)", code); + } + + @Test + public void complexCallAssignment() { + final TypeDefinition myClazz = new TypeDefinition("MyClazz"); + final ParameterExpression instance = new ParameterExpression(myClazz, "instance"); + final Method getNumberMethod = new Method(myClazz, "getNumber", Primitive.DOUBLE, Collections.emptyList(), Collections.emptyList()); + final Method staticMethod = new Method(myClazz, "staticMethod", Primitive.DOUBLE, Collections.emptyList(), Collections.emptyList()); + Statement stmt = new Block(Arrays.asList( + new DeclarationStatement(instance, null), + new AssignementExpression(instance, new NewExpression(myClazz)), + new AssignementExpression(instance, new NewExpression(myClazz, new NewExpression(myClazz))), + new DeclarationStatement(new ParameterExpression(Primitive.DOUBLE, "a"), new CallExpression(getNumberMethod, instance)), + new DeclarationStatement(new ParameterExpression(Primitive.DOUBLE, "b"), new CallExpression(staticMethod, null)) + )); + + stmt.write(generator); + final String code = writer.getCode(); + assertEquals(" MyClazz instance;\n" + + " instance = new MyClazz();\n" + + " instance = new MyClazz(new MyClazz());\n" + + " Double a = instance.getNumber();\n" + + " Double b = MyClazz.staticMethod();\n", code); + } + + @Test + public void writeMethodDefinition() { + final ParameterExpression a = new ParameterExpression(Primitive.DOUBLE, "a"); + final ParameterExpression b = new ParameterExpression(Primitive.DOUBLE, "b"); + final MethodDefinition decl = new MethodDefinition("add", Primitive.DOUBLE, + Arrays.asList( + a, + b + ), + new Block( + new ReturnStatement( + new BinaryExpression(a.getType(), a, b, BinaryExpression.Operation.PLUS) + ) + ) + ); + + decl.write(generator); + final String code = writer.getCode(); + assertEquals("public Double add(Double a, Double b) {\n" + + " return a + b;\n" + + "}\n", code); + } + + @Test + public void defineClass() { + final FieldDeclaration current = new FieldDeclaration(Primitive.DOUBLE, "current"); + final FieldReference currentRef = new FieldReference(Primitive.DOUBLE, "current"); + + final ParameterExpression a = new ParameterExpression(Primitive.DOUBLE, "a"); + final ParameterExpression b = new ParameterExpression(Primitive.DOUBLE, "b"); + final MethodDefinition decl = new MethodDefinition("add", Primitive.DOUBLE, + Arrays.asList( + a, + b + ), + new Block( + new ReturnStatement( + new BinaryExpression(a.getType(), a, b, BinaryExpression.Operation.PLUS) + ) + ) + ); + final MethodDefinition inc = new MethodDefinition("inc", Primitive.VOID, + Collections.EMPTY_LIST, + new Block( + new AssignementExpression( + currentRef, + new BinaryExpression(currentRef.getType(), currentRef, new ConstantExpression(1.0), BinaryExpression.Operation.PLUS) + ) + ) + ); + + final ClassDeclaration clazz = new ClassDeclaration("org.apache.plc4x", "MyClazz", Arrays.asList(current), Collections.emptyList(), Arrays.asList(inc, decl), null); + + clazz.write(generator); + final String code = writer.getCode(); + assertEquals("public class MyClazz {\n" + + " \n" + + " public Double current;\n" + + " \n" + + " public void inc() {\n" + + " this.current = this.current + 1.0;\n" + + " }\n" + + " \n" + + " public Double add(Double a, Double b) {\n" + + " return a + b;\n" + + " }\n" + + " \n" + + "}\n", code); + } + + @Test + public void defineClassWithConstructor() { + final FieldDeclaration current = new FieldDeclaration(Primitive.DOUBLE, "current"); + + final FieldReference currentRef = new FieldReference(Primitive.DOUBLE, "current"); + + final ParameterExpression value = new ParameterExpression(Primitive.DOUBLE, "value"); + final ClassDeclaration clazz = new ClassDeclaration("org.apache.plc4x", + "MyClazz", + Arrays.asList(current), + Arrays.asList( + new ConstructorDeclaration( + Collections.singletonList(value), + new Block(new AssignementExpression(currentRef, value)) + ) + ), + Collections.emptyList(), null); + + clazz.write(generator); + final String code = writer.getCode(); + assertEquals("public class MyClazz {\n" + + " \n" + + " public Double current;\n" + + " \n" + + " public MyClazz(Double value) {\n" + + " this.current = value;\n" + + " }\n" + + " \n" + + "}\n", code); + } + + @Test + public void defineClassWithInnerClass() { + final FieldDeclaration current = new FieldDeclaration(Primitive.DOUBLE, "current"); + + final FieldReference currentRef = new FieldReference(Primitive.DOUBLE, "current"); + + final ParameterExpression value = new ParameterExpression(Primitive.DOUBLE, "value"); + + // Define Inner Class + final ClassDeclaration innerClass = new ClassDeclaration("", "MyInnerClazz", Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null); + + final ClassDeclaration clazz = new ClassDeclaration("org.apache.plc4x", + "MyClazz", + Arrays.asList(current), + Arrays.asList( + new ConstructorDeclaration( + Collections.singletonList(value), + new Block(new AssignementExpression(currentRef, value)) + ) + ), + Collections.emptyList(), + Collections.singletonList(innerClass)); + + clazz.write(generator); + final String code = writer.getCode(); + assertEquals("public class MyClazz {\n" + + " \n" + + " public Double current;\n" + + " \n" + + " public MyClazz(Double value) {\n" + + " this.current = value;\n" + + " }\n" + + " \n" + + " public static class MyInnerClazz {\n" + + " \n" + + " }\n" + + "}\n", code); + } + + @Test + public void ifMultipleElse() { + final IfStatement stmt = new IfStatement( + Arrays.asList( + new BinaryExpression(Primitive.DOUBLE, new ParameterExpression(Primitive.DOUBLE, "a"), new ConstantExpression(10.0), BinaryExpression.Operation.EQ), + new BinaryExpression(Primitive.DOUBLE, new ParameterExpression(Primitive.DOUBLE, "a"), new ConstantExpression(5.0), BinaryExpression.Operation.EQ) + ), + Arrays.asList( + new Block(), + new Block(), + new Block() + )); + + stmt.write(generator); + final String code = writer.getCode(); + assertEquals("if (a == 10.0) {\n" + + "} else if (a == 5.0) {\n" + + "} else {\n" + + "}\n", code); + } +} \ No newline at end of file diff --git a/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ast/PythonGeneratorTest.java b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ast/PythonGeneratorTest.java new file mode 100755 index 00000000000..a3bdff0a38b --- /dev/null +++ b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/ast/PythonGeneratorTest.java @@ -0,0 +1,99 @@ +/* + * 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.codegen.ast; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class PythonGeneratorTest { + + public Generator generator; + public CodeWriter writer; + + @BeforeEach + public void setUp() { + this.writer = new CodeWriter(4); + this.generator = new PythonGenerator(writer); + } + + @Test + public void generateCode() { + final FieldDeclaration current = new FieldDeclaration(Primitive.DOUBLE, "current"); + + final FieldReference currentRef = new FieldReference(Primitive.DOUBLE, "current"); + + final ParameterExpression value = new ParameterExpression(Primitive.DOUBLE, "value"); + + // Define Inner Class + final ClassDeclaration innerClass = new ClassDeclaration("", "MyInnerClazz", Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null); + + final ClassDeclaration clazz = new ClassDeclaration("org.apache.plc4x", + "MyClazz", + Arrays.asList(current), + Arrays.asList( + new ConstructorDeclaration( + Collections.singletonList(value), + new Block(new AssignementExpression(currentRef, value)) + ) + ), + Collections.emptyList(), + Collections.singletonList(innerClass)); + + clazz.write(generator); + final String code = writer.getCode(); + assertEquals("class MyClazz:\n" + + " \n" + + " current: float\n" + + " \n" + + " def __init__(float value):\n" + + " self.current = value\n" + + " \n" + + " class MyInnerClazz:\n" + + " pass\n" + + " \n", code); + } + + @Test + public void ifMultipleElse() { + final IfStatement stmt = new IfStatement( + Arrays.asList( + new BinaryExpression(Primitive.DOUBLE, new ParameterExpression(Primitive.DOUBLE, "a"), new ConstantExpression(10.0), BinaryExpression.Operation.EQ), + new BinaryExpression(Primitive.DOUBLE, new ParameterExpression(Primitive.DOUBLE, "a"), new ConstantExpression(5.0), BinaryExpression.Operation.EQ) + ), + Arrays.asList( + new Block(), + new Block(), + new Block() + )); + + stmt.write(generator); + final String code = writer.getCode(); + assertEquals("if a == 10.0:\n" + + " pass\n" + + "elif a == 5.0:\n" + + " pass\n" + + "else:\n" + + " pass\n", code); + } +} \ No newline at end of file diff --git a/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/EnumFactoryTest.java b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/EnumFactoryTest.java new file mode 100755 index 00000000000..d9fcf571596 --- /dev/null +++ b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/EnumFactoryTest.java @@ -0,0 +1,89 @@ +/* + * 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.codegen.util; + +import org.apache.plc4x.codegen.ast.*; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; + +public class EnumFactoryTest { + + @Test + public void createEnums() { + System.out.println("Java:"); + System.out.println("----------"); + final ClassDeclaration MyEnum = newEnum(); + + final CodeWriter writer = new CodeWriter(4); + final JavaGenerator generator = new JavaGenerator(writer); + + MyEnum.write(generator); + + System.out.println(writer.getCode()); + } + + @Test + public void createEnumsInPython() { + System.out.println("Python:"); + System.out.println("----------"); + final ClassDeclaration MyEnum = newEnum(); + + final CodeWriter writer = new CodeWriter(4); + final PythonGenerator generator = new PythonGenerator(writer); + + MyEnum.write(generator); + + System.out.println(writer.getCode()); + } + + private ClassDeclaration newEnum() { + final EnumFactory factory = new EnumFactory(); + final EnumFactory.PojoDescription description = new EnumFactory.PojoDescription("MyPojo", + new EnumFactory.Field(Primitive.DOUBLE, "field1"), + new EnumFactory.Field(Primitive.DOUBLE, "field2"), + new EnumFactory.Field(Primitive.DOUBLE, "field3") + ); + return factory.create(description, + Arrays.asList( + new EnumFactory.EnumEntry("alternative1", Arrays.asList( + new ConstantExpression(1.0), + new ConstantExpression(2.0), + new ConstantExpression(3.0) + )), + new EnumFactory.EnumEntry("alternative2", Arrays.asList( + new ConstantExpression(1.0), + new ConstantExpression(2.0), + new ConstantExpression(3.0) + )), + new EnumFactory.EnumEntry("alternative3", Arrays.asList( + new ConstantExpression(1.0), + new ConstantExpression(2.0), + new ConstantExpression(3.0) + )), + new EnumFactory.EnumEntry("alternative4", Arrays.asList( + new ConstantExpression(1.0), + new ConstantExpression(2.0), + new ConstantExpression(3.0) + )) + ) + ); + } + +} \ No newline at end of file diff --git a/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/MyPojo.java b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/MyPojo.java new file mode 100755 index 00000000000..8d80408306d --- /dev/null +++ b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/MyPojo.java @@ -0,0 +1,65 @@ +/* + * 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.codegen.util; + +public class MyPojo { + + private Double field1; + + private Double field2; + + private Double field3; + + public MyPojo() { + } + + public Double getField1() { + return this.field1; + } + + public Double getField2() { + return this.field2; + } + + public Double getField3() { + return this.field3; + } + + public void setField1(Double field1) { + this.field1 = field1; + } + + public void setField2(Double field2) { + this.field2 = field2; + } + + public void setField3(Double field3) { + this.field3 = field3; + } + + public void encode(org.apache.plc4x.codegen.api.Buffer buffer) { + } + + public static MyPojo decode(org.apache.plc4x.codegen.api.Buffer buffer) { + MyPojo instance = new MyPojo(); + buffer.readUint8(); + return instance; + } + +} \ No newline at end of file diff --git a/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/PojoFactoryTest.java b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/PojoFactoryTest.java new file mode 100755 index 00000000000..ee7b09e7c8e --- /dev/null +++ b/sandbox/code-gen/src/test/java/org/apache/plc4x/codegen/util/PojoFactoryTest.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.codegen.util; + +import org.apache.plc4x.codegen.ast.*; +import org.junit.jupiter.api.Test; + +public class PojoFactoryTest { + + @Test + public void createPojoJava() { + System.out.println("Java:"); + System.out.println("----------"); + final ClassDeclaration pojo = newPojo(); + + final CodeWriter writer = new CodeWriter(4); + final JavaGenerator generator = new JavaGenerator(writer); + + pojo.write(generator); + + System.out.println(writer.getCode()); + } + + @Test + public void createPojoPython() { + System.out.println("Python:"); + System.out.println("----------"); + final ClassDeclaration pojo = newPojo(); + + final CodeWriter writer = new CodeWriter(4); + final PythonGenerator generator = new PythonGenerator(writer); + + pojo.write(generator); + + System.out.println(writer.getCode()); + } + + private ClassDeclaration newPojo() { + final PojoFactory factory = new PojoFactory(); + final PojoFactory.PojoDescription description = new PojoFactory.PojoDescription("MyPojo", + new PojoFactory.Field(Primitive.DOUBLE, "field1"), + new PojoFactory.Field(Primitive.DOUBLE, "field2"), + new PojoFactory.Field(Primitive.DOUBLE, "field3") + ); + return factory.create(description); + } +} \ No newline at end of file diff --git a/sandbox/code-gen/src/test/resources/protocol.dfdl.xsd b/sandbox/code-gen/src/test/resources/protocol.dfdl.xsd new file mode 100755 index 00000000000..ae22f15f669 --- /dev/null +++ b/sandbox/code-gen/src/test/resources/protocol.dfdl.xsd @@ -0,0 +1,909 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ConnectionRequest + + + + + ConnectionResponse + + + + + DisconnectRequest + + + + + DisconnectResponse + + + + + Error + + + + + Data + + + + + + + + + + TpduSize + + + + + CallingTsap + + + + + CalledTsap + + + + + Checksum + + + + + DisconnectAdditionalInformation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/discovery/pom.xml b/sandbox/discovery/pom.xml old mode 100644 new mode 100755 diff --git a/sandbox/discovery/src/main/java/org/apache/plc4x/java/discovery/DiscoveryConnection.java b/sandbox/discovery/src/main/java/org/apache/plc4x/java/discovery/DiscoveryConnection.java old mode 100644 new mode 100755 diff --git a/sandbox/discovery/src/main/java/org/apache/plc4x/java/discovery/DiscoveryDriver.java b/sandbox/discovery/src/main/java/org/apache/plc4x/java/discovery/DiscoveryDriver.java old mode 100644 new mode 100755 diff --git a/sandbox/discovery/src/main/java/org/apache/plc4x/java/discovery/DiscoveryTagHandler.java b/sandbox/discovery/src/main/java/org/apache/plc4x/java/discovery/DiscoveryTagHandler.java old mode 100644 new mode 100755 diff --git a/sandbox/discovery/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver b/sandbox/discovery/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver old mode 100644 new mode 100755 diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/filter.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/filter.h new file mode 100755 index 00000000000..1775d9fe1fd --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/filter.h @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_FILTER_H_ +#define PLC4C_MQTT_READ_WRITE_FILTER_H_ + +#include +#include +#include +#include +#include +#include +#include "mqt_t__retain_handling.h" +#include "mqt_t__string.h" +#include "mqt_t__qos.h" + +// Code generated by code-generation. DO NOT EDIT. + +#ifdef __cplusplus +extern "C" { +#endif + + +struct plc4c_mqtt_read_write_filter { + /* Properties */ + plc4c_mqtt_read_write_mqt_t__string* filter; + plc4c_mqtt_read_write_mqt_t__retain_handling retain_handling; + bool retain : 1; + bool no_local : 1; + plc4c_mqtt_read_write_mqt_t__qos max_qos; +}; +typedef struct plc4c_mqtt_read_write_filter plc4c_mqtt_read_write_filter; + +// Create an empty NULL-struct +plc4c_mqtt_read_write_filter plc4c_mqtt_read_write_filter_null(); + +plc4c_return_code plc4c_mqtt_read_write_filter_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_filter** message); + +plc4c_return_code plc4c_mqtt_read_write_filter_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_filter* message); + +uint16_t plc4c_mqtt_read_write_filter_length_in_bytes(plc4c_mqtt_read_write_filter* message); + +uint16_t plc4c_mqtt_read_write_filter_length_in_bits(plc4c_mqtt_read_write_filter* message); + +#ifdef __cplusplus +} +#endif +#endif // PLC4C_MQTT_READ_WRITE_FILTER_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__control_packet.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__control_packet.h new file mode 100755 index 00000000000..1534633bbc8 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__control_packet.h @@ -0,0 +1,201 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_MQT_T__CONTROL_PACKET_H_ +#define PLC4C_MQTT_READ_WRITE_MQT_T__CONTROL_PACKET_H_ + +#include +#include +#include +#include +#include +#include +#include "mqt_t__reason_code.h" +#include "filter.h" +#include "mqt_t__string.h" +#include "mqt_t__qos.h" +#include "mqt_t__property.h" +#include "mqt_t__control_packet_type.h" + +// Code generated by code-generation. DO NOT EDIT. + +#ifdef __cplusplus +extern "C" { +#endif + + +// Structure used to contain the discriminator values for discriminated types using this as a parent +struct plc4c_mqtt_read_write_mqt_t__control_packet_discriminator { + enum plc4c_mqtt_read_write_mqt_t__control_packet_type packetType; +}; +typedef struct plc4c_mqtt_read_write_mqt_t__control_packet_discriminator plc4c_mqtt_read_write_mqt_t__control_packet_discriminator; + +// Enum assigning each sub-type an individual id. +enum plc4c_mqtt_read_write_mqt_t__control_packet_type { + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connect = 0, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connack = 1, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__publish = 2, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__puback = 3, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrec = 4, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrel = 5, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubcomp = 6, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__subscribe = 7, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__suback = 8, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsubscribe = 9, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsuback = 10, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingreq = 11, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingresp = 12, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__disconnect = 13, + plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__auth = 14}; +typedef enum plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type; + +// Function to get the discriminator values for a given type. +plc4c_mqtt_read_write_mqt_t__control_packet_discriminator plc4c_mqtt_read_write_mqt_t__control_packet_get_discriminator(plc4c_mqtt_read_write_mqt_t__control_packet_type type); + +struct plc4c_mqtt_read_write_mqt_t__control_packet { + /* This is an abstract type so this property saves the type of this typed union */ + plc4c_mqtt_read_write_mqt_t__control_packet_type _type; + /* Properties */ + union { + struct { /* MQTT_ControlPacket_CONNECT */ + uint8_t mqt_t__control_packet__connect_remaining_length; + plc4c_mqtt_read_write_mqt_t__string* mqt_t__control_packet__connect_protocol_name; + uint8_t mqt_t__control_packet__connect_protocol_version; + bool mqt_t__control_packet__connect_user_name_flag_set : 1; + bool mqt_t__control_packet__connect_password_flag_set : 1; + bool mqt_t__control_packet__connect_will_retain_flag_set : 1; + uint8_t mqt_t__control_packet__connect_will_qos_level : 2; + bool mqt_t__control_packet__connect_will_flag_set : 1; + bool mqt_t__control_packet__connect_clean_start_flag_set : 1; + uint16_t mqt_t__control_packet__connect_keep_alive; + uint32_t mqt_t__control_packet__connect_property_length; + plc4c_list* mqt_t__control_packet__connect_properties; + plc4c_mqtt_read_write_mqt_t__string* mqt_t__control_packet__connect_client_id; + plc4c_mqtt_read_write_mqt_t__string* mqt_t__control_packet__connect_username; + plc4c_mqtt_read_write_mqt_t__string* mqt_t__control_packet__connect_password; + }; + struct { /* MQTT_ControlPacket_CONNACK */ + uint8_t mqt_t__control_packet__connack_remaining_length; + bool mqt_t__control_packet__connack_session_present_flag_set : 1; + plc4c_mqtt_read_write_mqt_t__reason_code mqt_t__control_packet__connack_reason_code; + uint32_t* mqt_t__control_packet__connack_property_length; + plc4c_list* mqt_t__control_packet__connack_properties; + }; + struct { /* MQTT_ControlPacket_PUBLISH */ + bool mqt_t__control_packet__publish_dup : 1; + plc4c_mqtt_read_write_mqt_t__qos mqt_t__control_packet__publish_qos; + bool mqt_t__control_packet__publish_retain : 1; + uint8_t mqt_t__control_packet__publish_remaining_length; + plc4c_mqtt_read_write_mqt_t__string* mqt_t__control_packet__publish_topic_name; + uint16_t* mqt_t__control_packet__publish_packet_identifier; + uint32_t* mqt_t__control_packet__publish_property_length; + plc4c_list* mqt_t__control_packet__publish_properties; + plc4c_list* mqt_t__control_packet__publish_payload; + }; + struct { /* MQTT_ControlPacket_PUBACK */ + uint8_t mqt_t__control_packet__puback_remaining_length; + uint16_t mqt_t__control_packet__puback_packet_identifier; + plc4c_mqtt_read_write_mqt_t__reason_code* mqt_t__control_packet__puback_reason_code; + uint32_t* mqt_t__control_packet__puback_property_length; + plc4c_list* mqt_t__control_packet__puback_properties; + }; + struct { /* MQTT_ControlPacket_PUBREC */ + uint8_t mqt_t__control_packet__pubrec_remaining_length; + uint16_t mqt_t__control_packet__pubrec_packet_identifier; + plc4c_mqtt_read_write_mqt_t__reason_code* mqt_t__control_packet__pubrec_reason_code; + uint32_t* mqt_t__control_packet__pubrec_property_length; + plc4c_list* mqt_t__control_packet__pubrec_properties; + }; + struct { /* MQTT_ControlPacket_PUBREL */ + uint8_t mqt_t__control_packet__pubrel_remaining_length; + uint16_t mqt_t__control_packet__pubrel_packet_identifier; + plc4c_mqtt_read_write_mqt_t__reason_code* mqt_t__control_packet__pubrel_reason_code; + uint32_t* mqt_t__control_packet__pubrel_property_length; + plc4c_list* mqt_t__control_packet__pubrel_properties; + }; + struct { /* MQTT_ControlPacket_PUBCOMP */ + uint8_t mqt_t__control_packet__pubcomp_remaining_length; + uint16_t mqt_t__control_packet__pubcomp_packet_identifier; + plc4c_mqtt_read_write_mqt_t__reason_code* mqt_t__control_packet__pubcomp_reason_code; + uint32_t* mqt_t__control_packet__pubcomp_property_length; + plc4c_list* mqt_t__control_packet__pubcomp_properties; + }; + struct { /* MQTT_ControlPacket_SUBSCRIBE */ + uint8_t mqt_t__control_packet__subscribe_remaining_length; + uint16_t mqt_t__control_packet__subscribe_packet_identifier; + uint32_t* mqt_t__control_packet__subscribe_property_length; + plc4c_list* mqt_t__control_packet__subscribe_properties; + plc4c_list* mqt_t__control_packet__subscribe_filters; + }; + struct { /* MQTT_ControlPacket_SUBACK */ + uint8_t mqt_t__control_packet__suback_remaining_length; + uint16_t mqt_t__control_packet__suback_packet_identifier; + uint32_t* mqt_t__control_packet__suback_property_length; + plc4c_list* mqt_t__control_packet__suback_properties; + plc4c_list* mqt_t__control_packet__suback_results; + }; + struct { /* MQTT_ControlPacket_UNSUBSCRIBE */ + uint8_t mqt_t__control_packet__unsubscribe_remaining_length; + uint16_t mqt_t__control_packet__unsubscribe_packet_identifier; + uint32_t* mqt_t__control_packet__unsubscribe_property_length; + plc4c_list* mqt_t__control_packet__unsubscribe_properties; + plc4c_list* mqt_t__control_packet__unsubscribe_filters; + }; + struct { /* MQTT_ControlPacket_UNSUBACK */ + uint8_t mqt_t__control_packet__unsuback_remaining_length; + uint16_t mqt_t__control_packet__unsuback_packet_identifier; + uint32_t* mqt_t__control_packet__unsuback_property_length; + plc4c_list* mqt_t__control_packet__unsuback_properties; + plc4c_list* mqt_t__control_packet__unsuback_results; + }; + struct { /* MQTT_ControlPacket_PINGREQ */ + uint8_t mqt_t__control_packet__pingreq_remaining_length; + }; + struct { /* MQTT_ControlPacket_PINGRESP */ + uint8_t mqt_t__control_packet__pingresp_remaining_length; + }; + struct { /* MQTT_ControlPacket_DISCONNECT */ + uint8_t mqt_t__control_packet__disconnect_remaining_length; + plc4c_mqtt_read_write_mqt_t__reason_code mqt_t__control_packet__disconnect_reason; + }; + struct { /* MQTT_ControlPacket_AUTH */ + uint8_t mqt_t__control_packet__auth_remaining_length; + plc4c_mqtt_read_write_mqt_t__reason_code mqt_t__control_packet__auth_reason; + uint32_t* mqt_t__control_packet__auth_property_length; + plc4c_list* mqt_t__control_packet__auth_properties; + }; + }; +}; +typedef struct plc4c_mqtt_read_write_mqt_t__control_packet plc4c_mqtt_read_write_mqt_t__control_packet; + +// Create an empty NULL-struct +plc4c_mqtt_read_write_mqt_t__control_packet plc4c_mqtt_read_write_mqt_t__control_packet_null(); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__control_packet** message); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__control_packet* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_length_in_bytes(plc4c_mqtt_read_write_mqt_t__control_packet* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_length_in_bits(plc4c_mqtt_read_write_mqt_t__control_packet* message); + +#ifdef __cplusplus +} +#endif +#endif // PLC4C_MQTT_READ_WRITE_MQT_T__CONTROL_PACKET_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__control_packet_type.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__control_packet_type.h new file mode 100755 index 00000000000..768897bb1eb --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__control_packet_type.h @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_MQT_T__CONTROL_PACKET_TYPE_H_ +#define PLC4C_MQTT_READ_WRITE_MQT_T__CONTROL_PACKET_TYPE_H_ + +#include +#include +#include +#include +#include + +// Code generated by code-generation. DO NOT EDIT. + + +#ifdef __cplusplus +extern "C" { +#endif + +enum plc4c_mqtt_read_write_mqt_t__control_packet_type { + plc4c_mqtt_read_write_mqt_t__control_packet_type_RESERVED = 0x0, + plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNECT = 0x1, + plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNACK = 0x2, + plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBLISH = 0x3, + plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBACK = 0x4, + plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREC = 0x5, + plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREL = 0x6, + plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBCOMP = 0x7, + plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBSCRIBE = 0x8, + plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBACK = 0x9, + plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBSCRIBE = 0xA, + plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBACK = 0xB, + plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGREQ = 0xC, + plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGRESP = 0xD, + plc4c_mqtt_read_write_mqt_t__control_packet_type_DISCONNECT = 0xE, + plc4c_mqtt_read_write_mqt_t__control_packet_type_AUTH = 0xF +}; +typedef enum plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type; + +// Get an empty NULL-struct +plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type_null(); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_type_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__control_packet_type** message); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_type_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__control_packet_type* message); + +plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type_value_of(char* value_string); + +int plc4c_mqtt_read_write_mqt_t__control_packet_type_num_values(); + +plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type_value_for_index(int index); + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_type_length_in_bytes(plc4c_mqtt_read_write_mqt_t__control_packet_type* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_type_length_in_bits(plc4c_mqtt_read_write_mqt_t__control_packet_type* message); + +#ifdef __cplusplus +} +#endif + +#endif // PLC4C_MQTT_READ_WRITE_MQT_T__CONTROL_PACKET_TYPE_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__property.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__property.h new file mode 100755 index 00000000000..fde6d53011a --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__property.h @@ -0,0 +1,180 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_MQT_T__PROPERTY_H_ +#define PLC4C_MQTT_READ_WRITE_MQT_T__PROPERTY_H_ + +#include +#include +#include +#include +#include +#include +#include "mqt_t__string.h" +#include "mqt_t__property_type.h" +#include "mqt_t__property_type.h" + +// Code generated by code-generation. DO NOT EDIT. + +#ifdef __cplusplus +extern "C" { +#endif + + +// Structure used to contain the discriminator values for discriminated types using this as a parent +struct plc4c_mqtt_read_write_mqt_t__property_discriminator { + enum plc4c_mqtt_read_write_mqt_t__property_type propertyType; +}; +typedef struct plc4c_mqtt_read_write_mqt_t__property_discriminator plc4c_mqtt_read_write_mqt_t__property_discriminator; + +// Enum assigning each sub-type an individual id. +enum plc4c_mqtt_read_write_mqt_t__property_type { + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__payloa_d__forma_t__indicator = 0, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__messag_e__expir_y__interval = 1, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__conten_t__type = 2, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__topic = 3, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__correlatio_n__data = 4, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifier = 5, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__expir_y__interval = 6, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__assigne_d__clien_t__identifier = 7, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__kee_p__alive = 8, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__method = 9, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__data = 10, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__proble_m__information = 11, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wil_l__dela_y__interval = 12, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__respons_e__information = 13, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__information = 14, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__reference = 15, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reaso_n__string = 16, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__receiv_e__maximum = 17, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alia_s__maximum = 18, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alias = 19, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__qos = 20, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__retai_n__available = 21, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__use_r__property = 22, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__packe_t__size = 23, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wildcar_d__subscriptio_n__available = 24, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifie_r__available = 25, + plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__share_d__subscriptio_n__available = 26}; +typedef enum plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type; + +// Function to get the discriminator values for a given type. +plc4c_mqtt_read_write_mqt_t__property_discriminator plc4c_mqtt_read_write_mqt_t__property_get_discriminator(plc4c_mqtt_read_write_mqt_t__property_type type); + +struct plc4c_mqtt_read_write_mqt_t__property { + /* This is an abstract type so this property saves the type of this typed union */ + plc4c_mqtt_read_write_mqt_t__property_type _type; + /* Properties */ + plc4c_mqtt_read_write_mqt_t__property_type property_type; + union { + struct { /* MQTT_Property_PAYLOAD_FORMAT_INDICATOR */ + uint8_t mqt_t__property__payloa_d__forma_t__indicator_value; + }; + struct { /* MQTT_Property_MESSAGE_EXPIRY_INTERVAL */ + uint32_t mqt_t__property__messag_e__expir_y__interval_value; + }; + struct { /* MQTT_Property_CONTENT_TYPE */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__conten_t__type_value; + }; + struct { /* MQTT_Property_RESPONSE_TOPIC */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__respons_e__topic_value; + }; + struct { /* MQTT_Property_SUBSCRIPTION_IDENTIFIER */ + uint32_t mqt_t__property__subscriptio_n__identifier_value; + }; + struct { /* MQTT_Property_EXPIRY_INTERVAL */ + uint32_t mqt_t__property__expir_y__interval_value; + }; + struct { /* MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__assigne_d__clien_t__identifier_value; + }; + struct { /* MQTT_Property_SERVER_KEEP_ALIVE */ + uint16_t mqt_t__property__serve_r__kee_p__alive_value; + }; + struct { /* MQTT_Property_AUTHENTICATION_METHOD */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__authenticatio_n__method_value; + }; + struct { /* MQTT_Property_REQUEST_PROBLEM_INFORMATION */ + uint8_t mqt_t__property__reques_t__proble_m__information_value; + }; + struct { /* MQTT_Property_WILL_DELAY_INTERVAL */ + uint32_t mqt_t__property__wil_l__dela_y__interval_value; + }; + struct { /* MQTT_Property_REQUEST_RESPONSE_INFORMATION */ + uint8_t mqt_t__property__reques_t__respons_e__information_value; + }; + struct { /* MQTT_Property_RESPONSE_INFORMATION */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__respons_e__information_value; + }; + struct { /* MQTT_Property_SERVER_REFERENCE */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__serve_r__reference_value; + }; + struct { /* MQTT_Property_REASON_STRING */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__reaso_n__string_value; + }; + struct { /* MQTT_Property_RECEIVE_MAXIMUM */ + uint16_t mqt_t__property__receiv_e__maximum_value; + }; + struct { /* MQTT_Property_TOPIC_ALIAS_MAXIMUM */ + uint16_t mqt_t__property__topi_c__alia_s__maximum_value; + }; + struct { /* MQTT_Property_TOPIC_ALIAS */ + uint16_t mqt_t__property__topi_c__alias_value; + }; + struct { /* MQTT_Property_MAXIMUM_QOS */ + uint8_t mqt_t__property__maximu_m__qos_value; + }; + struct { /* MQTT_Property_RETAIN_AVAILABLE */ + uint8_t mqt_t__property__retai_n__available_value; + }; + struct { /* MQTT_Property_USER_PROPERTY */ + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__use_r__property_name; + plc4c_mqtt_read_write_mqt_t__string* mqt_t__property__use_r__property_value; + }; + struct { /* MQTT_Property_MAXIMUM_PACKET_SIZE */ + uint32_t mqt_t__property__maximu_m__packe_t__size_value; + }; + struct { /* MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE */ + uint8_t mqt_t__property__wildcar_d__subscriptio_n__available_value; + }; + struct { /* MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE */ + uint8_t mqt_t__property__subscriptio_n__identifie_r__available_value; + }; + struct { /* MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE */ + uint8_t mqt_t__property__share_d__subscriptio_n__available_value; + }; + }; +}; +typedef struct plc4c_mqtt_read_write_mqt_t__property plc4c_mqtt_read_write_mqt_t__property; + +// Create an empty NULL-struct +plc4c_mqtt_read_write_mqt_t__property plc4c_mqtt_read_write_mqt_t__property_null(); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__property** message); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__property* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__property_length_in_bytes(plc4c_mqtt_read_write_mqt_t__property* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__property_length_in_bits(plc4c_mqtt_read_write_mqt_t__property* message); + +#ifdef __cplusplus +} +#endif +#endif // PLC4C_MQTT_READ_WRITE_MQT_T__PROPERTY_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__property_type.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__property_type.h new file mode 100755 index 00000000000..dd379d8dee8 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__property_type.h @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_MQT_T__PROPERTY_TYPE_H_ +#define PLC4C_MQTT_READ_WRITE_MQT_T__PROPERTY_TYPE_H_ + +#include +#include +#include +#include +#include + +// Code generated by code-generation. DO NOT EDIT. + + +#ifdef __cplusplus +extern "C" { +#endif + +enum plc4c_mqtt_read_write_mqt_t__property_type { + plc4c_mqtt_read_write_mqt_t__property_type_PAYLOAD_FORMAT_INDICATOR = 0x01, + plc4c_mqtt_read_write_mqt_t__property_type_MESSAGE_EXPIRY_INTERVAL = 0x02, + plc4c_mqtt_read_write_mqt_t__property_type_CONTENT_TYPE = 0x03, + plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_TOPIC = 0x08, + plc4c_mqtt_read_write_mqt_t__property_type_CORRELATION_DATA = 0x09, + plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER = 0x0B, + plc4c_mqtt_read_write_mqt_t__property_type_SESSION_EXPIRY_INTERVAL = 0x11, + plc4c_mqtt_read_write_mqt_t__property_type_ASSIGNED_CLIENT_IDENTIFIER = 0x12, + plc4c_mqtt_read_write_mqt_t__property_type_SERVER_KEEP_ALIVE = 0x13, + plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_METHOD = 0x15, + plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_DATA = 0x16, + plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_PROBLEM_INFORMATION = 0x17, + plc4c_mqtt_read_write_mqt_t__property_type_WILL_DELAY_INTERVAL = 0x18, + plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_RESPONSE_INFORMATION = 0x19, + plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_INFORMATION = 0x1A, + plc4c_mqtt_read_write_mqt_t__property_type_SERVER_REFERENCE = 0x1C, + plc4c_mqtt_read_write_mqt_t__property_type_REASON_STRING = 0x1F, + plc4c_mqtt_read_write_mqt_t__property_type_RECEIVE_MAXIMUM = 0x21, + plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS_MAXIMUM = 0x22, + plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS = 0x23, + plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_QOS = 0x24, + plc4c_mqtt_read_write_mqt_t__property_type_RETAIN_AVAILABLE = 0x25, + plc4c_mqtt_read_write_mqt_t__property_type_USER_PROPERTY = 0x26, + plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_PACKET_SIZE = 0x27, + plc4c_mqtt_read_write_mqt_t__property_type_WILDCARD_SUBSCRIPTION_AVAILABLE = 0x28, + plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER_AVAILABLE = 0x29, + plc4c_mqtt_read_write_mqt_t__property_type_SHARED_SUBSCRIPTION_AVAILABLE = 0x2A +}; +typedef enum plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type; + +// Get an empty NULL-struct +plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type_null(); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_type_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__property_type** message); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_type_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__property_type* message); + +plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type_value_of(char* value_string); + +int plc4c_mqtt_read_write_mqt_t__property_type_num_values(); + +plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type_value_for_index(int index); + +uint16_t plc4c_mqtt_read_write_mqt_t__property_type_length_in_bytes(plc4c_mqtt_read_write_mqt_t__property_type* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__property_type_length_in_bits(plc4c_mqtt_read_write_mqt_t__property_type* message); + +#ifdef __cplusplus +} +#endif + +#endif // PLC4C_MQTT_READ_WRITE_MQT_T__PROPERTY_TYPE_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__qos.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__qos.h new file mode 100755 index 00000000000..47a554b1665 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__qos.h @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_MQT_T__QOS_H_ +#define PLC4C_MQTT_READ_WRITE_MQT_T__QOS_H_ + +#include +#include +#include +#include +#include + +// Code generated by code-generation. DO NOT EDIT. + + +#ifdef __cplusplus +extern "C" { +#endif + +enum plc4c_mqtt_read_write_mqt_t__qos { + plc4c_mqtt_read_write_mqt_t__qos_AT_MOST_ONCE = 0x0, + plc4c_mqtt_read_write_mqt_t__qos_AT_LEAST_ONCE = 0x1, + plc4c_mqtt_read_write_mqt_t__qos_EXACTLY_ONCE = 0x2 +}; +typedef enum plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos; + +// Get an empty NULL-struct +plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos_null(); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__qos_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__qos** message); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__qos_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__qos* message); + +plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos_value_of(char* value_string); + +int plc4c_mqtt_read_write_mqt_t__qos_num_values(); + +plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos_value_for_index(int index); + +uint16_t plc4c_mqtt_read_write_mqt_t__qos_length_in_bytes(plc4c_mqtt_read_write_mqt_t__qos* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__qos_length_in_bits(plc4c_mqtt_read_write_mqt_t__qos* message); + +#ifdef __cplusplus +} +#endif + +#endif // PLC4C_MQTT_READ_WRITE_MQT_T__QOS_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__reason_code.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__reason_code.h new file mode 100755 index 00000000000..1cdce73e90f --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__reason_code.h @@ -0,0 +1,125 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_MQT_T__REASON_CODE_H_ +#define PLC4C_MQTT_READ_WRITE_MQT_T__REASON_CODE_H_ + +#include +#include +#include +#include +#include + +// Code generated by code-generation. DO NOT EDIT. + + +#ifdef __cplusplus +extern "C" { +#endif + +enum plc4c_mqtt_read_write_mqt_t__reason_code { + plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS = 0X00, + plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1 = 0X01, + plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2 = 0X02, + plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE = 0X04, + plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS = 0x10, + plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED = 0x11, + plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION = 0X18, + plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE = 0X19, + plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR = 0X80, + plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET = 0X81, + plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR = 0X82, + plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR = 0X83, + plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION = 0X84, + plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID = 0X85, + plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD = 0X86, + plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED = 0X87, + plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE = 0X88, + plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY = 0X89, + plc4c_mqtt_read_write_mqt_t__reason_code_BANNED = 0X8A, + plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN = 0X8B, + plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD = 0X8C, + plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT = 0X8D, + plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER = 0X8E, + plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID = 0X8F, + plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID = 0X90, + plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE = 0X91, + plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND = 0X92, + plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED = 0X93, + plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID = 0X94, + plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE = 0X95, + plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH = 0X96, + plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED = 0X97, + plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION = 0X98, + plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID = 0X99, + plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED = 0X9A, + plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED = 0X9B, + plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER = 0X9C, + plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED = 0X9D, + plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED = 0X9E, + plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED = 0X9F, + plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME = 0XA0, + plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED = 0XA1, + plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED = 0XA2 +}; +typedef enum plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code; + +// Get an empty NULL-struct +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_null(); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__reason_code_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__reason_code** message); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__reason_code_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__reason_code* message); + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_value_of(char* value_string); + +int plc4c_mqtt_read_write_mqt_t__reason_code_num_values(); + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_value_for_index(int index); + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_disconnect_reason(plc4c_mqtt_read_write_mqt_t__reason_code value); +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_disconnect_reason(bool value); + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_unsuback_response(plc4c_mqtt_read_write_mqt_t__reason_code value); +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_unsuback_response(bool value); + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_suback_response(plc4c_mqtt_read_write_mqt_t__reason_code value); +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_suback_response(bool value); + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_auth_reason(plc4c_mqtt_read_write_mqt_t__reason_code value); +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_auth_reason(bool value); + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_pubrel_pubcomp_response(plc4c_mqtt_read_write_mqt_t__reason_code value); +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_pubrel_pubcomp_response(bool value); + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_puback_pubrec_response(plc4c_mqtt_read_write_mqt_t__reason_code value); +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_puback_pubrec_response(bool value); + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_connack_response(plc4c_mqtt_read_write_mqt_t__reason_code value); +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_connack_response(bool value); + +uint16_t plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bytes(plc4c_mqtt_read_write_mqt_t__reason_code* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(plc4c_mqtt_read_write_mqt_t__reason_code* message); + +#ifdef __cplusplus +} +#endif + +#endif // PLC4C_MQTT_READ_WRITE_MQT_T__REASON_CODE_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__retain_handling.h b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__retain_handling.h new file mode 100755 index 00000000000..6c34e4b959a --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/include/mqt_t__retain_handling.h @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifndef PLC4C_MQTT_READ_WRITE_MQT_T__RETAIN_HANDLING_H_ +#define PLC4C_MQTT_READ_WRITE_MQT_T__RETAIN_HANDLING_H_ + +#include +#include +#include +#include +#include + +// Code generated by code-generation. DO NOT EDIT. + + +#ifdef __cplusplus +extern "C" { +#endif + +enum plc4c_mqtt_read_write_mqt_t__retain_handling { + plc4c_mqtt_read_write_mqt_t__retain_handling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE = 0x0, + plc4c_mqtt_read_write_mqt_t__retain_handling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST = 0x1, + plc4c_mqtt_read_write_mqt_t__retain_handling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE = 0x2 +}; +typedef enum plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling; + +// Get an empty NULL-struct +plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling_null(); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__retain_handling_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__retain_handling** message); + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__retain_handling_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__retain_handling* message); + +plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling_value_of(char* value_string); + +int plc4c_mqtt_read_write_mqt_t__retain_handling_num_values(); + +plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling_value_for_index(int index); + +uint16_t plc4c_mqtt_read_write_mqt_t__retain_handling_length_in_bytes(plc4c_mqtt_read_write_mqt_t__retain_handling* message); + +uint16_t plc4c_mqtt_read_write_mqt_t__retain_handling_length_in_bits(plc4c_mqtt_read_write_mqt_t__retain_handling* message); + +#ifdef __cplusplus +} +#endif + +#endif // PLC4C_MQTT_READ_WRITE_MQT_T__RETAIN_HANDLING_H_ diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/filter.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/filter.c new file mode 100755 index 00000000000..5c102a71588 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/filter.c @@ -0,0 +1,162 @@ +/* + * 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. + */ + +#include +#include +#include "filter.h" + +// Code generated by code-generation. DO NOT EDIT. + + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_filter_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_filter** _message) { + uint16_t startPos = plc4c_spi_read_get_pos(readBuffer); + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_filter)); + if(*_message == NULL) { + return NO_MEMORY; + } + + // Simple Field (filter) + plc4c_mqtt_read_write_mqt_t__string* filter; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &filter); + if(_res != OK) { + return _res; + } + (*_message)->filter = filter; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 2, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + // Simple Field (retainHandling) + plc4c_mqtt_read_write_mqt_t__retain_handling* retainHandling; + _res = plc4c_mqtt_read_write_mqt_t__retain_handling_parse(readBuffer, (void*) &retainHandling); + if(_res != OK) { + return _res; + } + (*_message)->retain_handling = *retainHandling; + + // Simple Field (retain) + bool retain = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &retain); + if(_res != OK) { + return _res; + } + (*_message)->retain = retain; + + // Simple Field (noLocal) + bool noLocal = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &noLocal); + if(_res != OK) { + return _res; + } + (*_message)->no_local = noLocal; + + // Simple Field (maxQos) + plc4c_mqtt_read_write_mqt_t__qos* maxQos; + _res = plc4c_mqtt_read_write_mqt_t__qos_parse(readBuffer, (void*) &maxQos); + if(_res != OK) { + return _res; + } + (*_message)->max_qos = *maxQos; + + return OK; +} + +plc4c_return_code plc4c_mqtt_read_write_filter_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_filter* _message) { + plc4c_return_code _res = OK; + + // Simple Field (filter) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->filter); + if(_res != OK) { + return _res; + } + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 2, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (retainHandling) + _res = plc4c_mqtt_read_write_mqt_t__retain_handling_serialize(writeBuffer, &_message->retain_handling); + if(_res != OK) { + return _res; + } + + // Simple Field (retain) + _res = plc4c_spi_write_bit(writeBuffer, _message->retain); + if(_res != OK) { + return _res; + } + + // Simple Field (noLocal) + _res = plc4c_spi_write_bit(writeBuffer, _message->no_local); + if(_res != OK) { + return _res; + } + + // Simple Field (maxQos) + _res = plc4c_mqtt_read_write_mqt_t__qos_serialize(writeBuffer, &_message->max_qos); + if(_res != OK) { + return _res; + } + + return OK; +} + +uint16_t plc4c_mqtt_read_write_filter_length_in_bytes(plc4c_mqtt_read_write_filter* _message) { + return plc4c_mqtt_read_write_filter_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_filter_length_in_bits(plc4c_mqtt_read_write_filter* _message) { + uint16_t lengthInBits = 0; + + // Simple field (filter) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->filter); + + // Reserved Field (reserved) + lengthInBits += 2; + + // Simple field (retainHandling) + lengthInBits += plc4c_mqtt_read_write_mqt_t__retain_handling_length_in_bits(&_message->retain_handling); + + // Simple field (retain) + lengthInBits += 1; + + // Simple field (noLocal) + lengthInBits += 1; + + // Simple field (maxQos) + lengthInBits += plc4c_mqtt_read_write_mqt_t__qos_length_in_bits(&_message->max_qos); + + return lengthInBits; +} + diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__control_packet.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__control_packet.c new file mode 100755 index 00000000000..40caf405ae4 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__control_packet.c @@ -0,0 +1,2823 @@ +/* + * 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. + */ + +#include +#include +#include "mqt_t__control_packet.h" + +// Code generated by code-generation. DO NOT EDIT. + +// Array of discriminator values that match the enum type constants. +// (The order is identical to the enum constants so we can use the +// enum constant to directly access a given types discriminator values) +const plc4c_mqtt_read_write_mqt_t__control_packet_discriminator plc4c_mqtt_read_write_mqt_t__control_packet_discriminators[] = { + {/* plc4c_mqtt_read_write_mqt_t__control_packet__connect */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNECT }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__connack */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNACK }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__publish */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBLISH }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__puback */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBACK }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__pubrec */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREC }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__pubrel */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREL }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__pubcomp */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBCOMP }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__subscribe */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBSCRIBE }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__suback */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBACK }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__unsubscribe */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBSCRIBE }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__unsuback */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBACK }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__pingreq */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGREQ }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__pingresp */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGRESP }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__disconnect */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_DISCONNECT }, + {/* plc4c_mqtt_read_write_mqt_t__control_packet__auth */ + .packetType = plc4c_mqtt_read_write_mqt_t__control_packet_type_AUTH } + +}; + +// Function returning the discriminator values for a given type constant. +plc4c_mqtt_read_write_mqt_t__control_packet_discriminator plc4c_mqtt_read_write_mqt_t__control_packet_get_discriminator(plc4c_mqtt_read_write_mqt_t__control_packet_type type) { + return plc4c_mqtt_read_write_mqt_t__control_packet_discriminators[type]; +} + +// Create an empty NULL-struct +static const plc4c_mqtt_read_write_mqt_t__control_packet plc4c_mqtt_read_write_mqt_t__control_packet_null_const; + +plc4c_mqtt_read_write_mqt_t__control_packet plc4c_mqtt_read_write_mqt_t__control_packet_null() { + return plc4c_mqtt_read_write_mqt_t__control_packet_null_const; +} + + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__control_packet** _message) { + uint16_t startPos = plc4c_spi_read_get_pos(readBuffer); + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__control_packet)); + if(*_message == NULL) { + return NO_MEMORY; + } + // Discriminator Field (packetType) + enum plc4c_mqtt_read_write_mqt_t__control_packet_type packetType; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &packetType); + if(_res != OK) { + return _res; + } + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNECT) { /* MQTT_ControlPacket_CONNECT */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connect; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_remaining_length = remainingLength; + + + + // Simple Field (protocolName) + plc4c_mqtt_read_write_mqt_t__string* protocolName; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &protocolName); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_protocol_name = protocolName; + + + + // Simple Field (protocolVersion) + uint8_t protocolVersion = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &protocolVersion); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_protocol_version = protocolVersion; + + + + // Simple Field (userNameFlagSet) + bool userNameFlagSet = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &userNameFlagSet); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_user_name_flag_set = userNameFlagSet; + + + + // Simple Field (passwordFlagSet) + bool passwordFlagSet = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &passwordFlagSet); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_password_flag_set = passwordFlagSet; + + + + // Simple Field (willRetainFlagSet) + bool willRetainFlagSet = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &willRetainFlagSet); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_will_retain_flag_set = willRetainFlagSet; + + + + // Simple Field (willQosLevel) + uint8_t willQosLevel = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 2, (uint8_t*) &willQosLevel); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_will_qos_level = willQosLevel; + + + + // Simple Field (willFlagSet) + bool willFlagSet = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &willFlagSet); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_will_flag_set = willFlagSet; + + + + // Simple Field (cleanStartFlagSet) + bool cleanStartFlagSet = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &cleanStartFlagSet); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_clean_start_flag_set = cleanStartFlagSet; + + + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + bool _reserved = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != false) { + printf("Expected constant value '%d' but got '%d' for reserved field.", false, _reserved); + } + } + + + + // Simple Field (keepAlive) + uint16_t keepAlive = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &keepAlive); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_keep_alive = keepAlive; + + + + // Simple Field (propertyLength) + uint32_t propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) &propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_property_length = propertyLength; + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = propertyLength; + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__connect_properties = properties; + + + + // Simple Field (clientId) + plc4c_mqtt_read_write_mqt_t__string* clientId; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &clientId); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_client_id = clientId; + + + + // Optional Field (username) (Can be skipped, if a given expression evaluates to false) + plc4c_mqtt_read_write_mqt_t__string* username = NULL; + if(userNameFlagSet) { + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, &username); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_username = username; + } else { + (*_message)->mqt_t__control_packet__connect_username = NULL; + } + + + + // Optional Field (password) (Can be skipped, if a given expression evaluates to false) + plc4c_mqtt_read_write_mqt_t__string* password = NULL; + if(passwordFlagSet) { + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, &password); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connect_password = password; + } else { + (*_message)->mqt_t__control_packet__connect_password = NULL; + } + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNACK) { /* MQTT_ControlPacket_CONNACK */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connack; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connack_remaining_length = remainingLength; + + + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 7, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x00) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x00, _reserved); + } + } + + + + // Simple Field (sessionPresentFlagSet) + bool sessionPresentFlagSet = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &sessionPresentFlagSet); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connack_session_present_flag_set = sessionPresentFlagSet; + + + + // Simple Field (reasonCode) + plc4c_mqtt_read_write_mqt_t__reason_code* reasonCode; + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, (void*) &reasonCode); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connack_reason_code = *reasonCode; + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__connack_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__connack_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__connack_properties = properties; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBLISH) { /* MQTT_ControlPacket_PUBLISH */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__publish; + + // Simple Field (dup) + bool dup = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &dup); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__publish_dup = dup; + + + + // Simple Field (qos) + plc4c_mqtt_read_write_mqt_t__qos* qos; + _res = plc4c_mqtt_read_write_mqt_t__qos_parse(readBuffer, (void*) &qos); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__publish_qos = *qos; + + + + // Simple Field (retain) + bool retain = false; + _res = plc4c_spi_read_bit(readBuffer, (bool*) &retain); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__publish_retain = retain; + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__publish_remaining_length = remainingLength; + + + + // Simple Field (topicName) + plc4c_mqtt_read_write_mqt_t__string* topicName; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &topicName); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__publish_topic_name = topicName; + + + + // Optional Field (packetIdentifier) (Can be skipped, if a given expression evaluates to false) + uint16_t* packetIdentifier = NULL; + if((qos) != (plc4c_mqtt_read_write_mqt_t__qos_AT_MOST_ONCE)) { + packetIdentifier = malloc(sizeof(uint16_t)); + if(packetIdentifier == NULL) { + return NO_MEMORY; + } + *packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__publish_packet_identifier = packetIdentifier; + } else { + (*_message)->mqt_t__control_packet__publish_packet_identifier = NULL; + } + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__publish_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__publish_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__publish_properties = properties; + + + + // Array field (payload) + plc4c_list* payload = NULL; + plc4c_utils_list_create(&payload); + if(payload == NULL) { + return NO_MEMORY; + } + { + // Count array + uint16_t itemCount = (uint16_t) (remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos)); + for(int curItem = 0; curItem < itemCount; curItem++) { + + char* _value = malloc(sizeof(char)); + _res = plc4c_spi_read_char(readBuffer, (char*) _value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(payload, _value); + } + } + (*_message)->mqt_t__control_packet__publish_payload = payload; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBACK) { /* MQTT_ControlPacket_PUBACK */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__puback; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__puback_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__puback_packet_identifier = packetIdentifier; + + + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + plc4c_mqtt_read_write_mqt_t__reason_code* reasonCode = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (3)) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, &reasonCode); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__puback_reason_code = reasonCode; + } else { + (*_message)->mqt_t__control_packet__puback_reason_code = NULL; + } + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__puback_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__puback_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__puback_properties = properties; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREC) { /* MQTT_ControlPacket_PUBREC */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrec; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrec_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrec_packet_identifier = packetIdentifier; + + + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + plc4c_mqtt_read_write_mqt_t__reason_code* reasonCode = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (3)) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, &reasonCode); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrec_reason_code = reasonCode; + } else { + (*_message)->mqt_t__control_packet__pubrec_reason_code = NULL; + } + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrec_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__pubrec_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__pubrec_properties = properties; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREL) { /* MQTT_ControlPacket_PUBREL */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrel; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrel_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrel_packet_identifier = packetIdentifier; + + + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + plc4c_mqtt_read_write_mqt_t__reason_code* reasonCode = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (3)) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, &reasonCode); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrel_reason_code = reasonCode; + } else { + (*_message)->mqt_t__control_packet__pubrel_reason_code = NULL; + } + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubrel_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__pubrel_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__pubrel_properties = properties; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBCOMP) { /* MQTT_ControlPacket_PUBCOMP */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubcomp; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubcomp_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubcomp_packet_identifier = packetIdentifier; + + + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + plc4c_mqtt_read_write_mqt_t__reason_code* reasonCode = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (3)) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, &reasonCode); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubcomp_reason_code = reasonCode; + } else { + (*_message)->mqt_t__control_packet__pubcomp_reason_code = NULL; + } + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pubcomp_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__pubcomp_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__pubcomp_properties = properties; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBSCRIBE) { /* MQTT_ControlPacket_SUBSCRIBE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__subscribe; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__subscribe_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__subscribe_packet_identifier = packetIdentifier; + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__subscribe_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__subscribe_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__subscribe_properties = properties; + + + + // Array field (filters) + plc4c_list* filters = NULL; + plc4c_utils_list_create(&filters); + if(filters == NULL) { + return NO_MEMORY; + } + { + // Count array + uint16_t itemCount = (uint16_t) (remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos)); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_filter* _value = NULL; + _res = plc4c_mqtt_read_write_filter_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(filters, _value); + } + } + (*_message)->mqt_t__control_packet__subscribe_filters = filters; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBACK) { /* MQTT_ControlPacket_SUBACK */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__suback; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__suback_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__suback_packet_identifier = packetIdentifier; + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__suback_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__suback_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__suback_properties = properties; + + + + // Array field (results) + plc4c_list* results = NULL; + plc4c_utils_list_create(&results); + if(results == NULL) { + return NO_MEMORY; + } + { + // Count array + uint16_t itemCount = (uint16_t) (remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos)); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__reason_code* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(results, _value); + } + } + (*_message)->mqt_t__control_packet__suback_results = results; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBSCRIBE) { /* MQTT_ControlPacket_UNSUBSCRIBE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsubscribe; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__unsubscribe_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__unsubscribe_packet_identifier = packetIdentifier; + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__unsubscribe_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__unsubscribe_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__unsubscribe_properties = properties; + + + + // Array field (filters) + plc4c_list* filters = NULL; + plc4c_utils_list_create(&filters); + if(filters == NULL) { + return NO_MEMORY; + } + { + // Count array + uint16_t itemCount = (uint16_t) (remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos)); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__string* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(filters, _value); + } + } + (*_message)->mqt_t__control_packet__unsubscribe_filters = filters; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBACK) { /* MQTT_ControlPacket_UNSUBACK */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsuback; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__unsuback_remaining_length = remainingLength; + + + + // Simple Field (packetIdentifier) + uint16_t packetIdentifier = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &packetIdentifier); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__unsuback_packet_identifier = packetIdentifier; + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__unsuback_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__unsuback_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__unsuback_properties = properties; + + + + // Array field (results) + plc4c_list* results = NULL; + plc4c_utils_list_create(&results); + if(results == NULL) { + return NO_MEMORY; + } + { + // Count array + uint16_t itemCount = (uint16_t) (remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos)); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__reason_code* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(results, _value); + } + } + (*_message)->mqt_t__control_packet__unsuback_results = results; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGREQ) { /* MQTT_ControlPacket_PINGREQ */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingreq; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pingreq_remaining_length = remainingLength; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGRESP) { /* MQTT_ControlPacket_PINGRESP */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingresp; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__pingresp_remaining_length = remainingLength; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_DISCONNECT) { /* MQTT_ControlPacket_DISCONNECT */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__disconnect; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__disconnect_remaining_length = remainingLength; + + + + // Simple Field (reason) + plc4c_mqtt_read_write_mqt_t__reason_code* reason; + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, (void*) &reason); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__disconnect_reason = *reason; + + } else + if(packetType == plc4c_mqtt_read_write_mqt_t__control_packet_type_AUTH) { /* MQTT_ControlPacket_AUTH */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__auth; + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + uint8_t _reserved = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) &_reserved); + if(_res != OK) { + return _res; + } + if(_reserved != 0x0) { + printf("Expected constant value '%d' but got '%d' for reserved field.", 0x0, _reserved); + } + } + + + + // Simple Field (remainingLength) + uint8_t remainingLength = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &remainingLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__auth_remaining_length = remainingLength; + + + + // Simple Field (reason) + plc4c_mqtt_read_write_mqt_t__reason_code* reason; + _res = plc4c_mqtt_read_write_mqt_t__reason_code_parse(readBuffer, (void*) &reason); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__auth_reason = *reason; + + + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + uint32_t* propertyLength = NULL; + if(((remainingLength) - ((plc4c_spi_read_get_pos(readBuffer) - startPos))) < (4)) { + propertyLength = malloc(sizeof(uint32_t)); + if(propertyLength == NULL) { + return NO_MEMORY; + } + *propertyLength = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) propertyLength); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__control_packet__auth_property_length = propertyLength; + } else { + (*_message)->mqt_t__control_packet__auth_property_length = NULL; + } + + + + // Array field (properties) + plc4c_list* properties = NULL; + plc4c_utils_list_create(&properties); + if(properties == NULL) { + return NO_MEMORY; + } + { + // Length array + uint8_t _propertiesLength = ((((propertyLength) != (NULL))) ? propertyLength : 0); + uint8_t propertiesEndPos = plc4c_spi_read_get_pos(readBuffer) + _propertiesLength; + while(plc4c_spi_read_get_pos(readBuffer) < propertiesEndPos) { + plc4c_mqtt_read_write_mqt_t__property* _value = NULL; + _res = plc4c_mqtt_read_write_mqt_t__property_parse(readBuffer, (void*) &_value); + if(_res != OK) { + return _res; + } + plc4c_utils_list_insert_head_value(properties, _value); + } + } + (*_message)->mqt_t__control_packet__auth_properties = properties; + + } + + return OK; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__control_packet* _message) { + plc4c_return_code _res = OK; + + // Enumerated Discriminator Field (packetType) + plc4c_spi_write_unsigned_byte(writeBuffer, 4, plc4c_mqtt_read_write_mqt_t__control_packet_get_discriminator(_message->_type).packetType); + + // Switch Field (Depending of the current type, serialize the sub-type elements) + switch(_message->_type) { + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connect: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__connect_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (protocolName) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__control_packet__connect_protocol_name); + if(_res != OK) { + return _res; + } + + // Simple Field (protocolVersion) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__connect_protocol_version); + if(_res != OK) { + return _res; + } + + // Simple Field (userNameFlagSet) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__connect_user_name_flag_set); + if(_res != OK) { + return _res; + } + + // Simple Field (passwordFlagSet) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__connect_password_flag_set); + if(_res != OK) { + return _res; + } + + // Simple Field (willRetainFlagSet) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__connect_will_retain_flag_set); + if(_res != OK) { + return _res; + } + + // Simple Field (willQosLevel) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 2, _message->mqt_t__control_packet__connect_will_qos_level); + if(_res != OK) { + return _res; + } + + // Simple Field (willFlagSet) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__connect_will_flag_set); + if(_res != OK) { + return _res; + } + + // Simple Field (cleanStartFlagSet) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__connect_clean_start_flag_set); + if(_res != OK) { + return _res; + } + + // Reserved Field + _res = plc4c_spi_write_bit(writeBuffer, false); + if(_res != OK) { + return _res; + } + + // Simple Field (keepAlive) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__connect_keep_alive); + if(_res != OK) { + return _res; + } + + // Simple Field (propertyLength) + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, _message->mqt_t__control_packet__connect_property_length); + if(_res != OK) { + return _res; + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__connect_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__connect_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + // Simple Field (clientId) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__control_packet__connect_client_id); + if(_res != OK) { + return _res; + } + + // Optional Field (username) + if(_message->mqt_t__control_packet__connect_username != NULL) { + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__control_packet__connect_username); + if(_res != OK) { + return _res; + } + } + + // Optional Field (password) + if(_message->mqt_t__control_packet__connect_password != NULL) { + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__control_packet__connect_password); + if(_res != OK) { + return _res; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connack: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__connack_remaining_length); + if(_res != OK) { + return _res; + } + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 7, 0x00); + if(_res != OK) { + return _res; + } + + // Simple Field (sessionPresentFlagSet) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__connack_session_present_flag_set); + if(_res != OK) { + return _res; + } + + // Simple Field (reasonCode) + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, &_message->mqt_t__control_packet__connack_reason_code); + if(_res != OK) { + return _res; + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__connack_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__connack_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__connack_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__connack_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__publish: { + + // Simple Field (dup) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__publish_dup); + if(_res != OK) { + return _res; + } + + // Simple Field (qos) + _res = plc4c_mqtt_read_write_mqt_t__qos_serialize(writeBuffer, &_message->mqt_t__control_packet__publish_qos); + if(_res != OK) { + return _res; + } + + // Simple Field (retain) + _res = plc4c_spi_write_bit(writeBuffer, _message->mqt_t__control_packet__publish_retain); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__publish_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (topicName) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__control_packet__publish_topic_name); + if(_res != OK) { + return _res; + } + + // Optional Field (packetIdentifier) + if(_message->mqt_t__control_packet__publish_packet_identifier != NULL) { + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, *_message->mqt_t__control_packet__publish_packet_identifier); + if(_res != OK) { + return _res; + } + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__publish_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__publish_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__publish_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__publish_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + // Array field (payload) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__publish_payload); + for(int curItem = 0; curItem < itemCount; curItem++) { + + char* _value = (char*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__publish_payload, curItem); + plc4c_spi_write_char(writeBuffer, *_value); + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__puback: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__puback_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__puback_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__puback_reason_code != NULL) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, _message->mqt_t__control_packet__puback_reason_code); + if(_res != OK) { + return _res; + } + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__puback_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__puback_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__puback_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__puback_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrec: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__pubrec_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__pubrec_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__pubrec_reason_code != NULL) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, _message->mqt_t__control_packet__pubrec_reason_code); + if(_res != OK) { + return _res; + } + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__pubrec_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__pubrec_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__pubrec_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__pubrec_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrel: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__pubrel_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__pubrel_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__pubrel_reason_code != NULL) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, _message->mqt_t__control_packet__pubrel_reason_code); + if(_res != OK) { + return _res; + } + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__pubrel_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__pubrel_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__pubrel_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__pubrel_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubcomp: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__pubcomp_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__pubcomp_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__pubcomp_reason_code != NULL) { + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, _message->mqt_t__control_packet__pubcomp_reason_code); + if(_res != OK) { + return _res; + } + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__pubcomp_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__pubcomp_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__pubcomp_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__pubcomp_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__subscribe: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__subscribe_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__subscribe_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__subscribe_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__subscribe_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__subscribe_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__subscribe_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + // Array field (filters) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__subscribe_filters); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_filter* _value = (plc4c_mqtt_read_write_filter*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__subscribe_filters, curItem); + _res = plc4c_mqtt_read_write_filter_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__suback: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__suback_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__suback_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__suback_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__suback_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__suback_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__suback_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + // Array field (results) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__suback_results); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__reason_code* _value = (plc4c_mqtt_read_write_mqt_t__reason_code*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__suback_results, curItem); + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsubscribe: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__unsubscribe_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__unsubscribe_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__unsubscribe_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__unsubscribe_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__unsubscribe_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__unsubscribe_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + // Array field (filters) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__unsubscribe_filters); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__string* _value = (plc4c_mqtt_read_write_mqt_t__string*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__unsubscribe_filters, curItem); + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsuback: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__unsuback_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (packetIdentifier) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__control_packet__unsuback_packet_identifier); + if(_res != OK) { + return _res; + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__unsuback_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__unsuback_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__unsuback_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__unsuback_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + // Array field (results) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__unsuback_results); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__reason_code* _value = (plc4c_mqtt_read_write_mqt_t__reason_code*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__unsuback_results, curItem); + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingreq: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__pingreq_remaining_length); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingresp: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__pingresp_remaining_length); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__disconnect: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__disconnect_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (reason) + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, &_message->mqt_t__control_packet__disconnect_reason); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__auth: { + + // Reserved Field + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, 0x0); + if(_res != OK) { + return _res; + } + + // Simple Field (remainingLength) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__control_packet__auth_remaining_length); + if(_res != OK) { + return _res; + } + + // Simple Field (reason) + _res = plc4c_mqtt_read_write_mqt_t__reason_code_serialize(writeBuffer, &_message->mqt_t__control_packet__auth_reason); + if(_res != OK) { + return _res; + } + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__auth_property_length != NULL) { + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, *_message->mqt_t__control_packet__auth_property_length); + if(_res != OK) { + return _res; + } + } + + // Array field (properties) + { + uint8_t itemCount = plc4c_utils_list_size(_message->mqt_t__control_packet__auth_properties); + for(int curItem = 0; curItem < itemCount; curItem++) { + bool lastItem = curItem == (itemCount - 1); + plc4c_mqtt_read_write_mqt_t__property* _value = (plc4c_mqtt_read_write_mqt_t__property*) plc4c_utils_list_get_value(_message->mqt_t__control_packet__auth_properties, curItem); + _res = plc4c_mqtt_read_write_mqt_t__property_serialize(writeBuffer, (void*) _value); + if(_res != OK) { + return _res; + } + } + } + + break; + } + } + + return OK; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_length_in_bytes(plc4c_mqtt_read_write_mqt_t__control_packet* _message) { + return plc4c_mqtt_read_write_mqt_t__control_packet_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_length_in_bits(plc4c_mqtt_read_write_mqt_t__control_packet* _message) { + uint16_t lengthInBits = 0; + + // Discriminator Field (packetType) + lengthInBits += 4; + + // Depending of the current type, add the length of sub-type elements ... + switch(_message->_type) { + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connect: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (protocolName) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__control_packet__connect_protocol_name); + + + // Simple field (protocolVersion) + lengthInBits += 8; + + + // Simple field (userNameFlagSet) + lengthInBits += 1; + + + // Simple field (passwordFlagSet) + lengthInBits += 1; + + + // Simple field (willRetainFlagSet) + lengthInBits += 1; + + + // Simple field (willQosLevel) + lengthInBits += 2; + + + // Simple field (willFlagSet) + lengthInBits += 1; + + + // Simple field (cleanStartFlagSet) + lengthInBits += 1; + + + // Reserved Field (reserved) + lengthInBits += 1; + + + // Simple field (keepAlive) + lengthInBits += 16; + + + // Simple field (propertyLength) + lengthInBits += 32; + + + // Array field + if(_message->mqt_t__control_packet__connect_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__connect_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + + // Simple field (clientId) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__control_packet__connect_client_id); + + + // Optional Field (username) + if(_message->mqt_t__control_packet__connect_username != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__control_packet__connect_username); + } + + + // Optional Field (password) + if(_message->mqt_t__control_packet__connect_password != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__control_packet__connect_password); + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__connack: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Reserved Field (reserved) + lengthInBits += 7; + + + // Simple field (sessionPresentFlagSet) + lengthInBits += 1; + + + // Simple field (reasonCode) + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(&_message->mqt_t__control_packet__connack_reason_code); + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__connack_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__connack_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__connack_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__publish: { + + // Simple field (dup) + lengthInBits += 1; + + + // Simple field (qos) + lengthInBits += plc4c_mqtt_read_write_mqt_t__qos_length_in_bits(&_message->mqt_t__control_packet__publish_qos); + + + // Simple field (retain) + lengthInBits += 1; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (topicName) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__control_packet__publish_topic_name); + + + // Optional Field (packetIdentifier) + if(_message->mqt_t__control_packet__publish_packet_identifier != NULL) { + lengthInBits += 16; + } + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__publish_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__publish_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__publish_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + + // Array field + lengthInBits += 8 * plc4c_utils_list_size(_message->mqt_t__control_packet__publish_payload); + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__puback: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__puback_reason_code != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(_message->mqt_t__control_packet__puback_reason_code); + } + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__puback_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__puback_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__puback_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrec: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__pubrec_reason_code != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(_message->mqt_t__control_packet__pubrec_reason_code); + } + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__pubrec_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__pubrec_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__pubrec_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubrel: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__pubrel_reason_code != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(_message->mqt_t__control_packet__pubrel_reason_code); + } + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__pubrel_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__pubrel_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__pubrel_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pubcomp: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (reasonCode) + if(_message->mqt_t__control_packet__pubcomp_reason_code != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(_message->mqt_t__control_packet__pubcomp_reason_code); + } + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__pubcomp_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__pubcomp_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__pubcomp_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__subscribe: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__subscribe_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__subscribe_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__subscribe_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + + // Array field + if(_message->mqt_t__control_packet__subscribe_filters != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__subscribe_filters->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_filter_length_in_bits((plc4c_mqtt_read_write_filter*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__suback: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__suback_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__suback_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__suback_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + + // Array field + if(_message->mqt_t__control_packet__suback_results != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__suback_results->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits((plc4c_mqtt_read_write_mqt_t__reason_code*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsubscribe: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__unsubscribe_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__unsubscribe_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__unsubscribe_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + + // Array field + if(_message->mqt_t__control_packet__unsubscribe_filters != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__unsubscribe_filters->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits((plc4c_mqtt_read_write_mqt_t__string*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__unsuback: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (packetIdentifier) + lengthInBits += 16; + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__unsuback_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__unsuback_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__unsuback_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + + // Array field + if(_message->mqt_t__control_packet__unsuback_results != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__unsuback_results->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits((plc4c_mqtt_read_write_mqt_t__reason_code*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingreq: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__pingresp: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__disconnect: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (reason) + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(&_message->mqt_t__control_packet__disconnect_reason); + + break; + } + case plc4c_mqtt_read_write_mqt_t__control_packet_type_plc4c_mqtt_read_write_mqt_t__control_packet__auth: { + + // Reserved Field (reserved) + lengthInBits += 4; + + + // Simple field (remainingLength) + lengthInBits += 8; + + + // Simple field (reason) + lengthInBits += plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(&_message->mqt_t__control_packet__auth_reason); + + + // Optional Field (propertyLength) + if(_message->mqt_t__control_packet__auth_property_length != NULL) { + lengthInBits += 32; + } + + + // Array field + if(_message->mqt_t__control_packet__auth_properties != NULL) { + plc4c_list_element* curElement = _message->mqt_t__control_packet__auth_properties->tail; + while (curElement != NULL) { + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_length_in_bits((plc4c_mqtt_read_write_mqt_t__property*) curElement->value); + curElement = curElement->next; + } + } + + break; + } + } + + return lengthInBits; +} + diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__control_packet_type.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__control_packet_type.c new file mode 100755 index 00000000000..a11822cca74 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__control_packet_type.c @@ -0,0 +1,174 @@ +/* + * 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. + */ + +#include "mqt_t__control_packet_type.h" +#include + +// Code generated by code-generation. DO NOT EDIT. + + +// Create an empty NULL-struct +static const plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type_null_const; + +plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type_null() { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_null_const; +} + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_type_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__control_packet_type** _message) { + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__control_packet_type)); + if(*_message == NULL) { + return NO_MEMORY; + } + + _res = plc4c_spi_read_unsigned_byte(readBuffer, 4, (uint8_t*) *_message); + + return _res; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__control_packet_type_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__control_packet_type* _message) { + plc4c_return_code _res = OK; + + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 4, *_message); + + return _res; +} + +plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type_value_of(char* value_string) { + if(strcmp(value_string, "RESERVED") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_RESERVED; + } + if(strcmp(value_string, "CONNECT") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNECT; + } + if(strcmp(value_string, "CONNACK") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNACK; + } + if(strcmp(value_string, "PUBLISH") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBLISH; + } + if(strcmp(value_string, "PUBACK") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBACK; + } + if(strcmp(value_string, "PUBREC") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREC; + } + if(strcmp(value_string, "PUBREL") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREL; + } + if(strcmp(value_string, "PUBCOMP") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBCOMP; + } + if(strcmp(value_string, "SUBSCRIBE") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBSCRIBE; + } + if(strcmp(value_string, "SUBACK") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBACK; + } + if(strcmp(value_string, "UNSUBSCRIBE") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBSCRIBE; + } + if(strcmp(value_string, "UNSUBACK") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBACK; + } + if(strcmp(value_string, "PINGREQ") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGREQ; + } + if(strcmp(value_string, "PINGRESP") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGRESP; + } + if(strcmp(value_string, "DISCONNECT") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_DISCONNECT; + } + if(strcmp(value_string, "AUTH") == 0) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_AUTH; + } + return -1; +} + +int plc4c_mqtt_read_write_mqt_t__control_packet_type_num_values() { + return 16; +} + +plc4c_mqtt_read_write_mqt_t__control_packet_type plc4c_mqtt_read_write_mqt_t__control_packet_type_value_for_index(int index) { + switch(index) { + case 0: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_RESERVED; + } + case 1: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNECT; + } + case 2: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_CONNACK; + } + case 3: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBLISH; + } + case 4: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBACK; + } + case 5: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREC; + } + case 6: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBREL; + } + case 7: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PUBCOMP; + } + case 8: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBSCRIBE; + } + case 9: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_SUBACK; + } + case 10: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBSCRIBE; + } + case 11: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_UNSUBACK; + } + case 12: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGREQ; + } + case 13: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_PINGRESP; + } + case 14: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_DISCONNECT; + } + case 15: { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_AUTH; + } + default: { + return -1; + } + } +} + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_type_length_in_bytes(plc4c_mqtt_read_write_mqt_t__control_packet_type* _message) { + return plc4c_mqtt_read_write_mqt_t__control_packet_type_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__control_packet_type_length_in_bits(plc4c_mqtt_read_write_mqt_t__control_packet_type* _message) { + return 4; +} diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__property.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__property.c new file mode 100755 index 00000000000..7f4ea21ea25 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__property.c @@ -0,0 +1,923 @@ +/* + * 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. + */ + +#include +#include +#include "mqt_t__property.h" + +// Code generated by code-generation. DO NOT EDIT. + +// Array of discriminator values that match the enum type constants. +// (The order is identical to the enum constants so we can use the +// enum constant to directly access a given types discriminator values) +const plc4c_mqtt_read_write_mqt_t__property_discriminator plc4c_mqtt_read_write_mqt_t__property_discriminators[] = { + {/* plc4c_mqtt_read_write_mqt_t__property__payloa_d__forma_t__indicator */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_PAYLOAD_FORMAT_INDICATOR }, + {/* plc4c_mqtt_read_write_mqt_t__property__messag_e__expir_y__interval */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_MESSAGE_EXPIRY_INTERVAL }, + {/* plc4c_mqtt_read_write_mqt_t__property__conten_t__type */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_CONTENT_TYPE }, + {/* plc4c_mqtt_read_write_mqt_t__property__respons_e__topic */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_TOPIC }, + {/* plc4c_mqtt_read_write_mqt_t__property__correlatio_n__data */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_CORRELATION_DATA }, + {/* plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifier */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER }, + {/* plc4c_mqtt_read_write_mqt_t__property__expir_y__interval */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_SESSION_EXPIRY_INTERVAL }, + {/* plc4c_mqtt_read_write_mqt_t__property__assigne_d__clien_t__identifier */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_ASSIGNED_CLIENT_IDENTIFIER }, + {/* plc4c_mqtt_read_write_mqt_t__property__serve_r__kee_p__alive */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_SERVER_KEEP_ALIVE }, + {/* plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__method */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_METHOD }, + {/* plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__data */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_DATA }, + {/* plc4c_mqtt_read_write_mqt_t__property__reques_t__proble_m__information */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_PROBLEM_INFORMATION }, + {/* plc4c_mqtt_read_write_mqt_t__property__wil_l__dela_y__interval */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_WILL_DELAY_INTERVAL }, + {/* plc4c_mqtt_read_write_mqt_t__property__reques_t__respons_e__information */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_RESPONSE_INFORMATION }, + {/* plc4c_mqtt_read_write_mqt_t__property__respons_e__information */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_INFORMATION }, + {/* plc4c_mqtt_read_write_mqt_t__property__serve_r__reference */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_SERVER_REFERENCE }, + {/* plc4c_mqtt_read_write_mqt_t__property__reaso_n__string */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_REASON_STRING }, + {/* plc4c_mqtt_read_write_mqt_t__property__receiv_e__maximum */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_RECEIVE_MAXIMUM }, + {/* plc4c_mqtt_read_write_mqt_t__property__topi_c__alia_s__maximum */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS_MAXIMUM }, + {/* plc4c_mqtt_read_write_mqt_t__property__topi_c__alias */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS }, + {/* plc4c_mqtt_read_write_mqt_t__property__maximu_m__qos */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_QOS }, + {/* plc4c_mqtt_read_write_mqt_t__property__retai_n__available */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_RETAIN_AVAILABLE }, + {/* plc4c_mqtt_read_write_mqt_t__property__use_r__property */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_USER_PROPERTY }, + {/* plc4c_mqtt_read_write_mqt_t__property__maximu_m__packe_t__size */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_PACKET_SIZE }, + {/* plc4c_mqtt_read_write_mqt_t__property__wildcar_d__subscriptio_n__available */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_WILDCARD_SUBSCRIPTION_AVAILABLE }, + {/* plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifie_r__available */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER_AVAILABLE }, + {/* plc4c_mqtt_read_write_mqt_t__property__share_d__subscriptio_n__available */ + .propertyType = plc4c_mqtt_read_write_mqt_t__property_type_SHARED_SUBSCRIPTION_AVAILABLE } + +}; + +// Function returning the discriminator values for a given type constant. +plc4c_mqtt_read_write_mqt_t__property_discriminator plc4c_mqtt_read_write_mqt_t__property_get_discriminator(plc4c_mqtt_read_write_mqt_t__property_type type) { + return plc4c_mqtt_read_write_mqt_t__property_discriminators[type]; +} + +// Create an empty NULL-struct +static const plc4c_mqtt_read_write_mqt_t__property plc4c_mqtt_read_write_mqt_t__property_null_const; + +plc4c_mqtt_read_write_mqt_t__property plc4c_mqtt_read_write_mqt_t__property_null() { + return plc4c_mqtt_read_write_mqt_t__property_null_const; +} + + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__property** _message) { + uint16_t startPos = plc4c_spi_read_get_pos(readBuffer); + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__property)); + if(*_message == NULL) { + return NO_MEMORY; + } + + // Simple Field (propertyType) + plc4c_mqtt_read_write_mqt_t__property_type* propertyType; + _res = plc4c_mqtt_read_write_mqt_t__property_type_parse(readBuffer, (void*) &propertyType); + if(_res != OK) { + return _res; + } + (*_message)->property_type = *propertyType; + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_PAYLOAD_FORMAT_INDICATOR) { /* MQTT_Property_PAYLOAD_FORMAT_INDICATOR */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__payloa_d__forma_t__indicator; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__payloa_d__forma_t__indicator_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_MESSAGE_EXPIRY_INTERVAL) { /* MQTT_Property_MESSAGE_EXPIRY_INTERVAL */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__messag_e__expir_y__interval; + + // Simple Field (value) + uint32_t value = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__messag_e__expir_y__interval_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_CONTENT_TYPE) { /* MQTT_Property_CONTENT_TYPE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__conten_t__type; + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__conten_t__type_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_TOPIC) { /* MQTT_Property_RESPONSE_TOPIC */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__topic; + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__respons_e__topic_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_CORRELATION_DATA) { /* MQTT_Property_CORRELATION_DATA */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__correlatio_n__data; + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER) { /* MQTT_Property_SUBSCRIPTION_IDENTIFIER */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifier; + + // Simple Field (value) + uint32_t value = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__subscriptio_n__identifier_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_SESSION_EXPIRY_INTERVAL) { /* MQTT_Property_EXPIRY_INTERVAL */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__expir_y__interval; + + // Simple Field (value) + uint32_t value = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__expir_y__interval_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_ASSIGNED_CLIENT_IDENTIFIER) { /* MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__assigne_d__clien_t__identifier; + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__assigne_d__clien_t__identifier_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_SERVER_KEEP_ALIVE) { /* MQTT_Property_SERVER_KEEP_ALIVE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__kee_p__alive; + + // Simple Field (value) + uint16_t value = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__serve_r__kee_p__alive_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_METHOD) { /* MQTT_Property_AUTHENTICATION_METHOD */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__method; + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__authenticatio_n__method_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_DATA) { /* MQTT_Property_AUTHENTICATION_DATA */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__data; + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_PROBLEM_INFORMATION) { /* MQTT_Property_REQUEST_PROBLEM_INFORMATION */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__proble_m__information; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__reques_t__proble_m__information_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_WILL_DELAY_INTERVAL) { /* MQTT_Property_WILL_DELAY_INTERVAL */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wil_l__dela_y__interval; + + // Simple Field (value) + uint32_t value = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__wil_l__dela_y__interval_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_RESPONSE_INFORMATION) { /* MQTT_Property_REQUEST_RESPONSE_INFORMATION */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__respons_e__information; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__reques_t__respons_e__information_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_INFORMATION) { /* MQTT_Property_RESPONSE_INFORMATION */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__information; + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__respons_e__information_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_SERVER_REFERENCE) { /* MQTT_Property_SERVER_REFERENCE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__reference; + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__serve_r__reference_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_REASON_STRING) { /* MQTT_Property_REASON_STRING */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reaso_n__string; + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__reaso_n__string_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_RECEIVE_MAXIMUM) { /* MQTT_Property_RECEIVE_MAXIMUM */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__receiv_e__maximum; + + // Simple Field (value) + uint16_t value = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__receiv_e__maximum_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS_MAXIMUM) { /* MQTT_Property_TOPIC_ALIAS_MAXIMUM */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alia_s__maximum; + + // Simple Field (value) + uint16_t value = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__topi_c__alia_s__maximum_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS) { /* MQTT_Property_TOPIC_ALIAS */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alias; + + // Simple Field (value) + uint16_t value = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__topi_c__alias_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_QOS) { /* MQTT_Property_MAXIMUM_QOS */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__qos; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__maximu_m__qos_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_RETAIN_AVAILABLE) { /* MQTT_Property_RETAIN_AVAILABLE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__retai_n__available; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__retai_n__available_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_USER_PROPERTY) { /* MQTT_Property_USER_PROPERTY */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__use_r__property; + + // Simple Field (name) + plc4c_mqtt_read_write_mqt_t__string* name; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &name); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__use_r__property_name = name; + + + + // Simple Field (value) + plc4c_mqtt_read_write_mqt_t__string* value; + _res = plc4c_mqtt_read_write_mqt_t__string_parse(readBuffer, (void*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__use_r__property_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_PACKET_SIZE) { /* MQTT_Property_MAXIMUM_PACKET_SIZE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__packe_t__size; + + // Simple Field (value) + uint32_t value = 0; + _res = plc4c_spi_read_unsigned_int(readBuffer, 32, (uint32_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__maximu_m__packe_t__size_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_WILDCARD_SUBSCRIPTION_AVAILABLE) { /* MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wildcar_d__subscriptio_n__available; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__wildcar_d__subscriptio_n__available_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER_AVAILABLE) { /* MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifie_r__available; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__subscriptio_n__identifie_r__available_value = value; + + } else + if(propertyType == plc4c_mqtt_read_write_mqt_t__property_type_SHARED_SUBSCRIPTION_AVAILABLE) { /* MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE */ + (*_message)->_type = plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__share_d__subscriptio_n__available; + + // Simple Field (value) + uint8_t value = 0; + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value); + if(_res != OK) { + return _res; + } + (*_message)->mqt_t__property__share_d__subscriptio_n__available_value = value; + + } + + return OK; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__property* _message) { + plc4c_return_code _res = OK; + + // Simple Field (propertyType) + _res = plc4c_mqtt_read_write_mqt_t__property_type_serialize(writeBuffer, &_message->property_type); + if(_res != OK) { + return _res; + } + + // Switch Field (Depending of the current type, serialize the sub-type elements) + switch(_message->_type) { + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__payloa_d__forma_t__indicator: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__payloa_d__forma_t__indicator_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__messag_e__expir_y__interval: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, _message->mqt_t__property__messag_e__expir_y__interval_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__conten_t__type: { + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__conten_t__type_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__topic: { + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__respons_e__topic_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__correlatio_n__data: { + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifier: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, _message->mqt_t__property__subscriptio_n__identifier_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__expir_y__interval: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, _message->mqt_t__property__expir_y__interval_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__assigne_d__clien_t__identifier: { + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__assigne_d__clien_t__identifier_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__kee_p__alive: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__property__serve_r__kee_p__alive_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__method: { + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__authenticatio_n__method_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__data: { + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__proble_m__information: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__reques_t__proble_m__information_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wil_l__dela_y__interval: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, _message->mqt_t__property__wil_l__dela_y__interval_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__respons_e__information: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__reques_t__respons_e__information_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__information: { + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__respons_e__information_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__reference: { + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__serve_r__reference_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reaso_n__string: { + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__reaso_n__string_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__receiv_e__maximum: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__property__receiv_e__maximum_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alia_s__maximum: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__property__topi_c__alia_s__maximum_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alias: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, _message->mqt_t__property__topi_c__alias_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__qos: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__maximu_m__qos_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__retai_n__available: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__retai_n__available_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__use_r__property: { + + // Simple Field (name) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__use_r__property_name); + if(_res != OK) { + return _res; + } + + // Simple Field (value) + _res = plc4c_mqtt_read_write_mqt_t__string_serialize(writeBuffer, _message->mqt_t__property__use_r__property_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__packe_t__size: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_int(writeBuffer, 32, _message->mqt_t__property__maximu_m__packe_t__size_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wildcar_d__subscriptio_n__available: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__wildcar_d__subscriptio_n__available_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifie_r__available: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__subscriptio_n__identifie_r__available_value); + if(_res != OK) { + return _res; + } + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__share_d__subscriptio_n__available: { + + // Simple Field (value) + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, _message->mqt_t__property__share_d__subscriptio_n__available_value); + if(_res != OK) { + return _res; + } + + break; + } + } + + return OK; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__property_length_in_bytes(plc4c_mqtt_read_write_mqt_t__property* _message) { + return plc4c_mqtt_read_write_mqt_t__property_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__property_length_in_bits(plc4c_mqtt_read_write_mqt_t__property* _message) { + uint16_t lengthInBits = 0; + + // Simple field (propertyType) + lengthInBits += plc4c_mqtt_read_write_mqt_t__property_type_length_in_bits(&_message->property_type); + + // Depending of the current type, add the length of sub-type elements ... + switch(_message->_type) { + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__payloa_d__forma_t__indicator: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__messag_e__expir_y__interval: { + + // Simple field (value) + lengthInBits += 32; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__conten_t__type: { + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__conten_t__type_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__topic: { + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__respons_e__topic_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__correlatio_n__data: { + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifier: { + + // Simple field (value) + lengthInBits += 32; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__expir_y__interval: { + + // Simple field (value) + lengthInBits += 32; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__assigne_d__clien_t__identifier: { + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__assigne_d__clien_t__identifier_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__kee_p__alive: { + + // Simple field (value) + lengthInBits += 16; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__method: { + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__authenticatio_n__method_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__authenticatio_n__data: { + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__proble_m__information: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wil_l__dela_y__interval: { + + // Simple field (value) + lengthInBits += 32; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reques_t__respons_e__information: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__respons_e__information: { + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__respons_e__information_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__serve_r__reference: { + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__serve_r__reference_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__reaso_n__string: { + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__reaso_n__string_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__receiv_e__maximum: { + + // Simple field (value) + lengthInBits += 16; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alia_s__maximum: { + + // Simple field (value) + lengthInBits += 16; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__topi_c__alias: { + + // Simple field (value) + lengthInBits += 16; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__qos: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__retai_n__available: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__use_r__property: { + + // Simple field (name) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__use_r__property_name); + + + // Simple field (value) + lengthInBits += plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message->mqt_t__property__use_r__property_value); + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__maximu_m__packe_t__size: { + + // Simple field (value) + lengthInBits += 32; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__wildcar_d__subscriptio_n__available: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__subscriptio_n__identifie_r__available: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + case plc4c_mqtt_read_write_mqt_t__property_type_plc4c_mqtt_read_write_mqt_t__property__share_d__subscriptio_n__available: { + + // Simple field (value) + lengthInBits += 8; + + break; + } + } + + return lengthInBits; +} + diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__property_type.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__property_type.c new file mode 100755 index 00000000000..eaec1a29132 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__property_type.c @@ -0,0 +1,240 @@ +/* + * 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. + */ + +#include "mqt_t__property_type.h" +#include + +// Code generated by code-generation. DO NOT EDIT. + + +// Create an empty NULL-struct +static const plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type_null_const; + +plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type_null() { + return plc4c_mqtt_read_write_mqt_t__property_type_null_const; +} + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_type_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__property_type** _message) { + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__property_type)); + if(*_message == NULL) { + return NO_MEMORY; + } + + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) *_message); + + return _res; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__property_type_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__property_type* _message) { + plc4c_return_code _res = OK; + + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, *_message); + + return _res; +} + +plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type_value_of(char* value_string) { + if(strcmp(value_string, "PAYLOAD_FORMAT_INDICATOR") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_PAYLOAD_FORMAT_INDICATOR; + } + if(strcmp(value_string, "MESSAGE_EXPIRY_INTERVAL") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_MESSAGE_EXPIRY_INTERVAL; + } + if(strcmp(value_string, "CONTENT_TYPE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_CONTENT_TYPE; + } + if(strcmp(value_string, "RESPONSE_TOPIC") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_TOPIC; + } + if(strcmp(value_string, "CORRELATION_DATA") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_CORRELATION_DATA; + } + if(strcmp(value_string, "SUBSCRIPTION_IDENTIFIER") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER; + } + if(strcmp(value_string, "SESSION_EXPIRY_INTERVAL") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_SESSION_EXPIRY_INTERVAL; + } + if(strcmp(value_string, "ASSIGNED_CLIENT_IDENTIFIER") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_ASSIGNED_CLIENT_IDENTIFIER; + } + if(strcmp(value_string, "SERVER_KEEP_ALIVE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_SERVER_KEEP_ALIVE; + } + if(strcmp(value_string, "AUTHENTICATION_METHOD") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_METHOD; + } + if(strcmp(value_string, "AUTHENTICATION_DATA") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_DATA; + } + if(strcmp(value_string, "REQUEST_PROBLEM_INFORMATION") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_PROBLEM_INFORMATION; + } + if(strcmp(value_string, "WILL_DELAY_INTERVAL") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_WILL_DELAY_INTERVAL; + } + if(strcmp(value_string, "REQUEST_RESPONSE_INFORMATION") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_RESPONSE_INFORMATION; + } + if(strcmp(value_string, "RESPONSE_INFORMATION") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_INFORMATION; + } + if(strcmp(value_string, "SERVER_REFERENCE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_SERVER_REFERENCE; + } + if(strcmp(value_string, "REASON_STRING") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_REASON_STRING; + } + if(strcmp(value_string, "RECEIVE_MAXIMUM") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_RECEIVE_MAXIMUM; + } + if(strcmp(value_string, "TOPIC_ALIAS_MAXIMUM") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS_MAXIMUM; + } + if(strcmp(value_string, "TOPIC_ALIAS") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS; + } + if(strcmp(value_string, "MAXIMUM_QOS") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_QOS; + } + if(strcmp(value_string, "RETAIN_AVAILABLE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_RETAIN_AVAILABLE; + } + if(strcmp(value_string, "USER_PROPERTY") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_USER_PROPERTY; + } + if(strcmp(value_string, "MAXIMUM_PACKET_SIZE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_PACKET_SIZE; + } + if(strcmp(value_string, "WILDCARD_SUBSCRIPTION_AVAILABLE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_WILDCARD_SUBSCRIPTION_AVAILABLE; + } + if(strcmp(value_string, "SUBSCRIPTION_IDENTIFIER_AVAILABLE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER_AVAILABLE; + } + if(strcmp(value_string, "SHARED_SUBSCRIPTION_AVAILABLE") == 0) { + return plc4c_mqtt_read_write_mqt_t__property_type_SHARED_SUBSCRIPTION_AVAILABLE; + } + return -1; +} + +int plc4c_mqtt_read_write_mqt_t__property_type_num_values() { + return 27; +} + +plc4c_mqtt_read_write_mqt_t__property_type plc4c_mqtt_read_write_mqt_t__property_type_value_for_index(int index) { + switch(index) { + case 0: { + return plc4c_mqtt_read_write_mqt_t__property_type_PAYLOAD_FORMAT_INDICATOR; + } + case 1: { + return plc4c_mqtt_read_write_mqt_t__property_type_MESSAGE_EXPIRY_INTERVAL; + } + case 2: { + return plc4c_mqtt_read_write_mqt_t__property_type_CONTENT_TYPE; + } + case 3: { + return plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_TOPIC; + } + case 4: { + return plc4c_mqtt_read_write_mqt_t__property_type_CORRELATION_DATA; + } + case 5: { + return plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER; + } + case 6: { + return plc4c_mqtt_read_write_mqt_t__property_type_SESSION_EXPIRY_INTERVAL; + } + case 7: { + return plc4c_mqtt_read_write_mqt_t__property_type_ASSIGNED_CLIENT_IDENTIFIER; + } + case 8: { + return plc4c_mqtt_read_write_mqt_t__property_type_SERVER_KEEP_ALIVE; + } + case 9: { + return plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_METHOD; + } + case 10: { + return plc4c_mqtt_read_write_mqt_t__property_type_AUTHENTICATION_DATA; + } + case 11: { + return plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_PROBLEM_INFORMATION; + } + case 12: { + return plc4c_mqtt_read_write_mqt_t__property_type_WILL_DELAY_INTERVAL; + } + case 13: { + return plc4c_mqtt_read_write_mqt_t__property_type_REQUEST_RESPONSE_INFORMATION; + } + case 14: { + return plc4c_mqtt_read_write_mqt_t__property_type_RESPONSE_INFORMATION; + } + case 15: { + return plc4c_mqtt_read_write_mqt_t__property_type_SERVER_REFERENCE; + } + case 16: { + return plc4c_mqtt_read_write_mqt_t__property_type_REASON_STRING; + } + case 17: { + return plc4c_mqtt_read_write_mqt_t__property_type_RECEIVE_MAXIMUM; + } + case 18: { + return plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS_MAXIMUM; + } + case 19: { + return plc4c_mqtt_read_write_mqt_t__property_type_TOPIC_ALIAS; + } + case 20: { + return plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_QOS; + } + case 21: { + return plc4c_mqtt_read_write_mqt_t__property_type_RETAIN_AVAILABLE; + } + case 22: { + return plc4c_mqtt_read_write_mqt_t__property_type_USER_PROPERTY; + } + case 23: { + return plc4c_mqtt_read_write_mqt_t__property_type_MAXIMUM_PACKET_SIZE; + } + case 24: { + return plc4c_mqtt_read_write_mqt_t__property_type_WILDCARD_SUBSCRIPTION_AVAILABLE; + } + case 25: { + return plc4c_mqtt_read_write_mqt_t__property_type_SUBSCRIPTION_IDENTIFIER_AVAILABLE; + } + case 26: { + return plc4c_mqtt_read_write_mqt_t__property_type_SHARED_SUBSCRIPTION_AVAILABLE; + } + default: { + return -1; + } + } +} + +uint16_t plc4c_mqtt_read_write_mqt_t__property_type_length_in_bytes(plc4c_mqtt_read_write_mqt_t__property_type* _message) { + return plc4c_mqtt_read_write_mqt_t__property_type_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__property_type_length_in_bits(plc4c_mqtt_read_write_mqt_t__property_type* _message) { + return 8; +} diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__qos.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__qos.c new file mode 100755 index 00000000000..558ebbbcd57 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__qos.c @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#include "mqt_t__qos.h" +#include + +// Code generated by code-generation. DO NOT EDIT. + + +// Create an empty NULL-struct +static const plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos_null_const; + +plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos_null() { + return plc4c_mqtt_read_write_mqt_t__qos_null_const; +} + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__qos_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__qos** _message) { + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__qos)); + if(*_message == NULL) { + return NO_MEMORY; + } + + _res = plc4c_spi_read_unsigned_byte(readBuffer, 2, (uint8_t*) *_message); + + return _res; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__qos_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__qos* _message) { + plc4c_return_code _res = OK; + + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 2, *_message); + + return _res; +} + +plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos_value_of(char* value_string) { + if(strcmp(value_string, "AT_MOST_ONCE") == 0) { + return plc4c_mqtt_read_write_mqt_t__qos_AT_MOST_ONCE; + } + if(strcmp(value_string, "AT_LEAST_ONCE") == 0) { + return plc4c_mqtt_read_write_mqt_t__qos_AT_LEAST_ONCE; + } + if(strcmp(value_string, "EXACTLY_ONCE") == 0) { + return plc4c_mqtt_read_write_mqt_t__qos_EXACTLY_ONCE; + } + return -1; +} + +int plc4c_mqtt_read_write_mqt_t__qos_num_values() { + return 3; +} + +plc4c_mqtt_read_write_mqt_t__qos plc4c_mqtt_read_write_mqt_t__qos_value_for_index(int index) { + switch(index) { + case 0: { + return plc4c_mqtt_read_write_mqt_t__qos_AT_MOST_ONCE; + } + case 1: { + return plc4c_mqtt_read_write_mqt_t__qos_AT_LEAST_ONCE; + } + case 2: { + return plc4c_mqtt_read_write_mqt_t__qos_EXACTLY_ONCE; + } + default: { + return -1; + } + } +} + +uint16_t plc4c_mqtt_read_write_mqt_t__qos_length_in_bytes(plc4c_mqtt_read_write_mqt_t__qos* _message) { + return plc4c_mqtt_read_write_mqt_t__qos_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__qos_length_in_bits(plc4c_mqtt_read_write_mqt_t__qos* _message) { + return 2; +} diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__reason_code.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__reason_code.c new file mode 100755 index 00000000000..a9bbd0938d8 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__reason_code.c @@ -0,0 +1,1393 @@ +/* + * 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. + */ + +#include "mqt_t__reason_code.h" +#include + +// Code generated by code-generation. DO NOT EDIT. + + +// Create an empty NULL-struct +static const plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_null_const; + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_null() { + return plc4c_mqtt_read_write_mqt_t__reason_code_null_const; +} + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__reason_code_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__reason_code** _message) { + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__reason_code)); + if(*_message == NULL) { + return NO_MEMORY; + } + + _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) *_message); + + return _res; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__reason_code_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__reason_code* _message) { + plc4c_return_code _res = OK; + + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, *_message); + + return _res; +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_value_of(char* value_string) { + if(strcmp(value_string, "SUCCESS") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + if(strcmp(value_string, "GRANTED_QOS_1") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + if(strcmp(value_string, "GRANTED_QOS_2") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2; + } + if(strcmp(value_string, "DISCONNECT_WITH_WILL_MESSAGE") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE; + } + if(strcmp(value_string, "NO_MATCHING_SUBSCRIBERS") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS; + } + if(strcmp(value_string, "NO_SUBSCRIPTION_EXISTED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED; + } + if(strcmp(value_string, "CONTINUE_AUTHENTICATION") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION; + } + if(strcmp(value_string, "RE_AUTHENTICATE") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE; + } + if(strcmp(value_string, "UNSPECIFIED_ERROR") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR; + } + if(strcmp(value_string, "MALFORMED_PACKET") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET; + } + if(strcmp(value_string, "PROTOCOL_ERROR") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR; + } + if(strcmp(value_string, "IMPLEMENTATION_SPECIFIC_ERROR") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR; + } + if(strcmp(value_string, "UNSUPPORTED_PROTOCOL_VERSION") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION; + } + if(strcmp(value_string, "CLIENT_IDENTIFIER_NOT_VALID") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID; + } + if(strcmp(value_string, "BAD_USER_NAME_OR_PASSWORD") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD; + } + if(strcmp(value_string, "NOT_AUTHORIZED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED; + } + if(strcmp(value_string, "SERVER_UNAVAILABLE") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE; + } + if(strcmp(value_string, "SERVER_BUSY") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY; + } + if(strcmp(value_string, "BANNED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_BANNED; + } + if(strcmp(value_string, "SERVER_SHUTTING_DOWN") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN; + } + if(strcmp(value_string, "BAD_AUTHENTICATION_METHOD") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD; + } + if(strcmp(value_string, "KEEP_ALIVE_TIMEOUT") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT; + } + if(strcmp(value_string, "SESSION_TAKEN_OVER") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER; + } + if(strcmp(value_string, "TOPIC_FILTER_INVALID") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID; + } + if(strcmp(value_string, "TOPIC_NAME_INVALID") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID; + } + if(strcmp(value_string, "PACKET_IDENTIFIER_IN_USE") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE; + } + if(strcmp(value_string, "PACKET_IDENTIFIER_NOT_FOUND") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND; + } + if(strcmp(value_string, "RECEIVE_MAXIMUM_EXCEEDED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED; + } + if(strcmp(value_string, "TOPIC_ALIAS_INVALID") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID; + } + if(strcmp(value_string, "PACKET_TOO_LARGE") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE; + } + if(strcmp(value_string, "MESSAGE_RATE_TO_HIGH") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH; + } + if(strcmp(value_string, "QUOTA_EXCEEDED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED; + } + if(strcmp(value_string, "ADMINISTRATIVE_ACTION") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION; + } + if(strcmp(value_string, "PAYLOAD_FORMAT_INVALID") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID; + } + if(strcmp(value_string, "RETAIN_NOT_SUPPORTED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED; + } + if(strcmp(value_string, "QOS_NOT_SUPPORTED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED; + } + if(strcmp(value_string, "USE_ANOTHER_SERVER") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER; + } + if(strcmp(value_string, "SERVER_MOVED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED; + } + if(strcmp(value_string, "SHARED_SUBSCRIPTIONS_NOT_SUPPORTED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED; + } + if(strcmp(value_string, "CONNECTION_RATE_EXCEEDED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED; + } + if(strcmp(value_string, "MAXIMUM_CONNECT_TIME") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME; + } + if(strcmp(value_string, "SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED; + } + if(strcmp(value_string, "WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED") == 0) { + return plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED; + } + return -1; +} + +int plc4c_mqtt_read_write_mqt_t__reason_code_num_values() { + return 43; +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_value_for_index(int index) { + switch(index) { + case 0: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + case 1: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + case 2: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2; + } + case 3: { + return plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE; + } + case 4: { + return plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS; + } + case 5: { + return plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED; + } + case 6: { + return plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION; + } + case 7: { + return plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE; + } + case 8: { + return plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR; + } + case 9: { + return plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET; + } + case 10: { + return plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR; + } + case 11: { + return plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR; + } + case 12: { + return plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION; + } + case 13: { + return plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID; + } + case 14: { + return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD; + } + case 15: { + return plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED; + } + case 16: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE; + } + case 17: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY; + } + case 18: { + return plc4c_mqtt_read_write_mqt_t__reason_code_BANNED; + } + case 19: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN; + } + case 20: { + return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD; + } + case 21: { + return plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT; + } + case 22: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER; + } + case 23: { + return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID; + } + case 24: { + return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID; + } + case 25: { + return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE; + } + case 26: { + return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND; + } + case 27: { + return plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED; + } + case 28: { + return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID; + } + case 29: { + return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE; + } + case 30: { + return plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH; + } + case 31: { + return plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED; + } + case 32: { + return plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION; + } + case 33: { + return plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID; + } + case 34: { + return plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED; + } + case 35: { + return plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED; + } + case 36: { + return plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER; + } + case 37: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED; + } + case 38: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED; + } + case 39: { + return plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED; + } + case 40: { + return plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME; + } + case 41: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED; + } + case 42: { + return plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED; + } + default: { + return -1; + } + } +} + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_disconnect_reason(plc4c_mqtt_read_write_mqt_t__reason_code value) { + switch(value) { + case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return 0; + } + } +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_disconnect_reason(bool value) { + switch(value) { + case false: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + case true: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + default: { + return -1; + } + } +} + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_unsuback_response(plc4c_mqtt_read_write_mqt_t__reason_code value) { + switch(value) { + case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return true; + } + default: { + return 0; + } + } +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_unsuback_response(bool value) { + switch(value) { + case false: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + case true: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + default: { + return -1; + } + } +} + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_suback_response(plc4c_mqtt_read_write_mqt_t__reason_code value) { + switch(value) { + case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return 0; + } + } +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_suback_response(bool value) { + switch(value) { + case false: { + return plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE; + } + case true: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + default: { + return -1; + } + } +} + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_auth_reason(plc4c_mqtt_read_write_mqt_t__reason_code value) { + switch(value) { + case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return 0; + } + } +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_auth_reason(bool value) { + switch(value) { + case false: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + case true: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + default: { + return -1; + } + } +} + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_pubrel_pubcomp_response(plc4c_mqtt_read_write_mqt_t__reason_code value) { + switch(value) { + case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return 0; + } + } +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_pubrel_pubcomp_response(bool value) { + switch(value) { + case false: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + case true: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + default: { + return -1; + } + } +} + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_puback_pubrec_response(plc4c_mqtt_read_write_mqt_t__reason_code value) { + switch(value) { + case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return 0; + } + } +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_puback_pubrec_response(bool value) { + switch(value) { + case false: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + case true: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + default: { + return -1; + } + } +} + +bool plc4c_mqtt_read_write_mqt_t__reason_code_get_connack_response(plc4c_mqtt_read_write_mqt_t__reason_code value) { + switch(value) { + case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return true; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return 0; + } + } +} + +plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_connack_response(bool value) { + switch(value) { + case false: { + return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1; + } + case true: { + return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS; + } + default: { + return -1; + } + } +} + +uint16_t plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bytes(plc4c_mqtt_read_write_mqt_t__reason_code* _message) { + return plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(plc4c_mqtt_read_write_mqt_t__reason_code* _message) { + return 8; +} diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__retain_handling.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__retain_handling.c new file mode 100755 index 00000000000..8c7ef3c52cf --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__retain_handling.c @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#include "mqt_t__retain_handling.h" +#include + +// Code generated by code-generation. DO NOT EDIT. + + +// Create an empty NULL-struct +static const plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling_null_const; + +plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling_null() { + return plc4c_mqtt_read_write_mqt_t__retain_handling_null_const; +} + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__retain_handling_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__retain_handling** _message) { + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__retain_handling)); + if(*_message == NULL) { + return NO_MEMORY; + } + + _res = plc4c_spi_read_unsigned_byte(readBuffer, 2, (uint8_t*) *_message); + + return _res; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__retain_handling_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__retain_handling* _message) { + plc4c_return_code _res = OK; + + _res = plc4c_spi_write_unsigned_byte(writeBuffer, 2, *_message); + + return _res; +} + +plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling_value_of(char* value_string) { + if(strcmp(value_string, "SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE") == 0) { + return plc4c_mqtt_read_write_mqt_t__retain_handling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE; + } + if(strcmp(value_string, "SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST") == 0) { + return plc4c_mqtt_read_write_mqt_t__retain_handling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST; + } + if(strcmp(value_string, "DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE") == 0) { + return plc4c_mqtt_read_write_mqt_t__retain_handling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE; + } + return -1; +} + +int plc4c_mqtt_read_write_mqt_t__retain_handling_num_values() { + return 3; +} + +plc4c_mqtt_read_write_mqt_t__retain_handling plc4c_mqtt_read_write_mqt_t__retain_handling_value_for_index(int index) { + switch(index) { + case 0: { + return plc4c_mqtt_read_write_mqt_t__retain_handling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE; + } + case 1: { + return plc4c_mqtt_read_write_mqt_t__retain_handling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST; + } + case 2: { + return plc4c_mqtt_read_write_mqt_t__retain_handling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE; + } + default: { + return -1; + } + } +} + +uint16_t plc4c_mqtt_read_write_mqt_t__retain_handling_length_in_bytes(plc4c_mqtt_read_write_mqt_t__retain_handling* _message) { + return plc4c_mqtt_read_write_mqt_t__retain_handling_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__retain_handling_length_in_bits(plc4c_mqtt_read_write_mqt_t__retain_handling* _message) { + return 2; +} diff --git a/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__string.c b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__string.c new file mode 100755 index 00000000000..8bf0f5875f5 --- /dev/null +++ b/sandbox/mqtt/mqtt-c/generated-sources/mqtt/src/mqt_t__string.c @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#include +#include +#include "mqt_t__string.h" + +// Code generated by code-generation. DO NOT EDIT. + + +// Parse function. +plc4c_return_code plc4c_mqtt_read_write_mqt_t__string_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__string** _message) { + uint16_t startPos = plc4c_spi_read_get_pos(readBuffer); + plc4c_return_code _res = OK; + + // Allocate enough memory to contain this data structure. + (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__string)); + if(*_message == NULL) { + return NO_MEMORY; + } + + // Implicit Field (stringLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content) + uint16_t stringLength = 0; + _res = plc4c_spi_read_unsigned_short(readBuffer, 16, (uint16_t*) &stringLength); + if(_res != OK) { + return _res; + } + + // Simple Field (value) + char* value = ""; + _res = plc4c_spi_read_string(readBuffer, -1, "UTF-8", (char**) &value); + if(_res != OK) { + return _res; + } + (*_message)->value = value; + + return OK; +} + +plc4c_return_code plc4c_mqtt_read_write_mqt_t__string_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__string* _message) { + plc4c_return_code _res = OK; + + // Implicit Field (stringLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content) + _res = plc4c_spi_write_unsigned_short(writeBuffer, 16, plc4c_spi_evaluation_helper_str_len(_message->value)); + if(_res != OK) { + return _res; + } + + // Simple Field (value) + _res = plc4c_spi_write_string(writeBuffer, -1, "UTF-8", _message->value); + if(_res != OK) { + return _res; + } + + return OK; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__string_length_in_bytes(plc4c_mqtt_read_write_mqt_t__string* _message) { + return plc4c_mqtt_read_write_mqt_t__string_length_in_bits(_message) / 8; +} + +uint16_t plc4c_mqtt_read_write_mqt_t__string_length_in_bits(plc4c_mqtt_read_write_mqt_t__string* _message) { + uint16_t lengthInBits = 0; + + // Implicit Field (stringLength) + lengthInBits += 16; + + // Simple field (value) + lengthInBits += -1; + + return lengthInBits; +} + diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/resources/protocols/mqtt/ParserSerializerTestsuite.xml b/sandbox/mqtt/mqtt-cs/drivers/mqtt/resources/protocols/mqtt/ParserSerializerTestsuite.xml new file mode 100755 index 00000000000..1a662e9645e --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/resources/protocols/mqtt/ParserSerializerTestsuite.xml @@ -0,0 +1,81 @@ + + + + + MQTT5 + + mqtt + read-write + + + MQTT Connection Request + 101d00044d51545405c200050000066c776d71747400037472790003747279 + MQTT_ControlPacket + + + + 1 + + + 0 + 29 + + + 4 + MQTT + + + 5 + true + true + false + 0 + false + true + false + 5 + 0 + + + + + 6 + lwmqtt + + + + + 3 + try + + + + + 3 + try + + + + + + + + \ No newline at end of file diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket.cs new file mode 100755 index 00000000000..0632d170315 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket.cs @@ -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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public abstract class MQTT_ControlPacket + { + + // Abstract accessors for discriminator values. + public abstract MQTT_ControlPacketType PacketType { get; } + + public MQTT_ControlPacket() + { + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacketType.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacketType.cs new file mode 100755 index 00000000000..3f74f4851b7 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacketType.cs @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public enum MQTT_ControlPacketType + { + RESERVED = 0x0, + CONNECT = 0x1, + CONNACK = 0x2, + PUBLISH = 0x3, + PUBACK = 0x4, + PUBREC = 0x5, + PUBREL = 0x6, + PUBCOMP = 0x7, + SUBSCRIBE = 0x8, + SUBACK = 0x9, + UNSUBSCRIBE = 0xA, + UNSUBACK = 0xB, + PINGREQ = 0xC, + PINGRESP = 0xD, + DISCONNECT = 0xE, + AUTH = 0xF, + } + +} + diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_AUTH.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_AUTH.cs new file mode 100755 index 00000000000..35dafa6375c --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_AUTH.cs @@ -0,0 +1,53 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_AUTH : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.AUTH; + + // Properties. + public byte RemainingLength { get; } + public MQTT_ReasonCode Reason { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + + public MQTT_ControlPacket_AUTH(byte remainingLength, MQTT_ReasonCode reason, uint propertyLength, MQTT_Property[] properties) + { + RemainingLength = remainingLength; + Reason = reason; + PropertyLength = propertyLength; + Properties = properties; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_CONNACK.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_CONNACK.cs new file mode 100755 index 00000000000..1a9dff765e0 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_CONNACK.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_CONNACK : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.CONNACK; + + // Properties. + public byte RemainingLength { get; } + public bool SessionPresentFlagSet { get; } + public MQTT_ReasonCode ReasonCode { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + + public MQTT_ControlPacket_CONNACK(byte remainingLength, bool sessionPresentFlagSet, MQTT_ReasonCode reasonCode, uint propertyLength, MQTT_Property[] properties) + { + RemainingLength = remainingLength; + SessionPresentFlagSet = sessionPresentFlagSet; + ReasonCode = reasonCode; + PropertyLength = propertyLength; + Properties = properties; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_CONNECT.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_CONNECT.cs new file mode 100755 index 00000000000..c561bf99379 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_CONNECT.cs @@ -0,0 +1,75 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_CONNECT : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.CONNECT; + + // Properties. + public byte RemainingLength { get; } + public MQTT_String ProtocolName { get; } + public byte ProtocolVersion { get; } + public bool UserNameFlagSet { get; } + public bool PasswordFlagSet { get; } + public bool WillRetainFlagSet { get; } + public byte WillQosLevel { get; } + public bool WillFlagSet { get; } + public bool CleanStartFlagSet { get; } + public ushort KeepAlive { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + public MQTT_String ClientId { get; } + public MQTT_String Username { get; } + public MQTT_String Password { get; } + + public MQTT_ControlPacket_CONNECT(byte remainingLength, MQTT_String protocolName, byte protocolVersion, bool userNameFlagSet, bool passwordFlagSet, bool willRetainFlagSet, byte willQosLevel, bool willFlagSet, bool cleanStartFlagSet, ushort keepAlive, uint propertyLength, MQTT_Property[] properties, MQTT_String clientId, MQTT_String username, MQTT_String password) + { + RemainingLength = remainingLength; + ProtocolName = protocolName; + ProtocolVersion = protocolVersion; + UserNameFlagSet = userNameFlagSet; + PasswordFlagSet = passwordFlagSet; + WillRetainFlagSet = willRetainFlagSet; + WillQosLevel = willQosLevel; + WillFlagSet = willFlagSet; + CleanStartFlagSet = cleanStartFlagSet; + KeepAlive = keepAlive; + PropertyLength = propertyLength; + Properties = properties; + ClientId = clientId; + Username = username; + Password = password; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBACK.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBACK.cs new file mode 100755 index 00000000000..55158021bd9 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBACK.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_PUBACK : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.PUBACK; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public MQTT_ReasonCode ReasonCode { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + + public MQTT_ControlPacket_PUBACK(byte remainingLength, ushort packetIdentifier, MQTT_ReasonCode reasonCode, uint propertyLength, MQTT_Property[] properties) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + ReasonCode = reasonCode; + PropertyLength = propertyLength; + Properties = properties; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBCOMP.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBCOMP.cs new file mode 100755 index 00000000000..f941f231f19 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBCOMP.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_PUBCOMP : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.PUBCOMP; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public MQTT_ReasonCode ReasonCode { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + + public MQTT_ControlPacket_PUBCOMP(byte remainingLength, ushort packetIdentifier, MQTT_ReasonCode reasonCode, uint propertyLength, MQTT_Property[] properties) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + ReasonCode = reasonCode; + PropertyLength = propertyLength; + Properties = properties; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBLISH.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBLISH.cs new file mode 100755 index 00000000000..f64d514d335 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBLISH.cs @@ -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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_PUBLISH : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.PUBLISH; + + // Properties. + public bool Dup { get; } + public MQTT_QOS Qos { get; } + public bool Retain { get; } + public byte RemainingLength { get; } + public MQTT_String TopicName { get; } + public ushort PacketIdentifier { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + public byte[] Payload { get; } + + public MQTT_ControlPacket_PUBLISH(bool dup, MQTT_QOS qos, bool retain, byte remainingLength, MQTT_String topicName, ushort packetIdentifier, uint propertyLength, MQTT_Property[] properties, byte[] payload) + { + Dup = dup; + Qos = qos; + Retain = retain; + RemainingLength = remainingLength; + TopicName = topicName; + PacketIdentifier = packetIdentifier; + PropertyLength = propertyLength; + Properties = properties; + Payload = payload; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBREC.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBREC.cs new file mode 100755 index 00000000000..2cd8ae4e04c --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBREC.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_PUBREC : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.PUBREC; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public MQTT_ReasonCode ReasonCode { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + + public MQTT_ControlPacket_PUBREC(byte remainingLength, ushort packetIdentifier, MQTT_ReasonCode reasonCode, uint propertyLength, MQTT_Property[] properties) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + ReasonCode = reasonCode; + PropertyLength = propertyLength; + Properties = properties; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBREL.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBREL.cs new file mode 100755 index 00000000000..37d54432985 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_PUBREL.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_PUBREL : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.PUBREL; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public MQTT_ReasonCode ReasonCode { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + + public MQTT_ControlPacket_PUBREL(byte remainingLength, ushort packetIdentifier, MQTT_ReasonCode reasonCode, uint propertyLength, MQTT_Property[] properties) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + ReasonCode = reasonCode; + PropertyLength = propertyLength; + Properties = properties; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_SUBACK.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_SUBACK.cs new file mode 100755 index 00000000000..5dabe3e34f7 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_SUBACK.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_SUBACK : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.SUBACK; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + public MQTT_ReasonCode[] Results { get; } + + public MQTT_ControlPacket_SUBACK(byte remainingLength, ushort packetIdentifier, uint propertyLength, MQTT_Property[] properties, MQTT_ReasonCode[] results) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + PropertyLength = propertyLength; + Properties = properties; + Results = results; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_SUBSCRIBE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_SUBSCRIBE.cs new file mode 100755 index 00000000000..b1169ad4709 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_SUBSCRIBE.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_SUBSCRIBE : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.SUBSCRIBE; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + public Filter[] Filters { get; } + + public MQTT_ControlPacket_SUBSCRIBE(byte remainingLength, ushort packetIdentifier, uint propertyLength, MQTT_Property[] properties, Filter[] filters) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + PropertyLength = propertyLength; + Properties = properties; + Filters = filters; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBACK.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBACK.cs new file mode 100755 index 00000000000..7b530f48f34 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBACK.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_UNSUBACK : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.UNSUBACK; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + public MQTT_ReasonCode[] Results { get; } + + public MQTT_ControlPacket_UNSUBACK(byte remainingLength, ushort packetIdentifier, uint propertyLength, MQTT_Property[] properties, MQTT_ReasonCode[] results) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + PropertyLength = propertyLength; + Properties = properties; + Results = results; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBSCRIBE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBSCRIBE.cs new file mode 100755 index 00000000000..358d4e9bec6 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBSCRIBE.cs @@ -0,0 +1,55 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_ControlPacket_UNSUBSCRIBE : MQTT_ControlPacket + { + + // Accessors for discriminator values. + public override MQTT_ControlPacketType PacketType => MQTT_ControlPacketType.UNSUBSCRIBE; + + // Properties. + public byte RemainingLength { get; } + public ushort PacketIdentifier { get; } + public uint PropertyLength { get; } + public MQTT_Property[] Properties { get; } + public MQTT_String[] Filters { get; } + + public MQTT_ControlPacket_UNSUBSCRIBE(byte remainingLength, ushort packetIdentifier, uint propertyLength, MQTT_Property[] properties, MQTT_String[] filters) + { + RemainingLength = remainingLength; + PacketIdentifier = packetIdentifier; + PropertyLength = propertyLength; + Properties = properties; + Filters = filters; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_PropertyType.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_PropertyType.cs new file mode 100755 index 00000000000..1e03958ef19 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_PropertyType.cs @@ -0,0 +1,57 @@ +/* + * 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. + */ + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public enum MQTT_PropertyType + { + PAYLOAD_FORMAT_INDICATOR = 0x01, + MESSAGE_EXPIRY_INTERVAL = 0x02, + CONTENT_TYPE = 0x03, + RESPONSE_TOPIC = 0x08, + CORRELATION_DATA = 0x09, + SUBSCRIPTION_IDENTIFIER = 0x0B, + SESSION_EXPIRY_INTERVAL = 0x11, + ASSIGNED_CLIENT_IDENTIFIER = 0x12, + SERVER_KEEP_ALIVE = 0x13, + AUTHENTICATION_METHOD = 0x15, + AUTHENTICATION_DATA = 0x16, + REQUEST_PROBLEM_INFORMATION = 0x17, + WILL_DELAY_INTERVAL = 0x18, + REQUEST_RESPONSE_INFORMATION = 0x19, + RESPONSE_INFORMATION = 0x1A, + SERVER_REFERENCE = 0x1C, + REASON_STRING = 0x1F, + RECEIVE_MAXIMUM = 0x21, + TOPIC_ALIAS_MAXIMUM = 0x22, + TOPIC_ALIAS = 0x23, + MAXIMUM_QOS = 0x24, + RETAIN_AVAILABLE = 0x25, + USER_PROPERTY = 0x26, + MAXIMUM_PACKET_SIZE = 0x27, + WILDCARD_SUBSCRIPTION_AVAILABLE = 0x28, + SUBSCRIPTION_IDENTIFIER_AVAILABLE = 0x29, + SHARED_SUBSCRIPTION_AVAILABLE = 0x2A, + } + +} + diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_DATA.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_DATA.cs new file mode 100755 index 00000000000..e5069476966 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_DATA.cs @@ -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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_AUTHENTICATION_DATA : MQTT_Property + { + + // Accessors for discriminator values. + + public MQTT_Property_AUTHENTICATION_DATA(MQTT_PropertyType propertyType) + : base(propertyType) + { + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_CONTENT_TYPE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_CONTENT_TYPE.cs new file mode 100755 index 00000000000..3c3530106f5 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_CONTENT_TYPE.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_CONTENT_TYPE : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public MQTT_String Value { get; } + + public MQTT_Property_CONTENT_TYPE(MQTT_PropertyType propertyType, MQTT_String value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_CORRELATION_DATA.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_CORRELATION_DATA.cs new file mode 100755 index 00000000000..07744d86bae --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_CORRELATION_DATA.cs @@ -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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_CORRELATION_DATA : MQTT_Property + { + + // Accessors for discriminator values. + + public MQTT_Property_CORRELATION_DATA(MQTT_PropertyType propertyType) + : base(propertyType) + { + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_EXPIRY_INTERVAL.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_EXPIRY_INTERVAL.cs new file mode 100755 index 00000000000..415f1e4074c --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_EXPIRY_INTERVAL.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_EXPIRY_INTERVAL : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public uint Value { get; } + + public MQTT_Property_EXPIRY_INTERVAL(MQTT_PropertyType propertyType, uint value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MAXIMUM_PACKET_SIZE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MAXIMUM_PACKET_SIZE.cs new file mode 100755 index 00000000000..3ce79227838 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MAXIMUM_PACKET_SIZE.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_MAXIMUM_PACKET_SIZE : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public uint Value { get; } + + public MQTT_Property_MAXIMUM_PACKET_SIZE(MQTT_PropertyType propertyType, uint value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MAXIMUM_QOS.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MAXIMUM_QOS.cs new file mode 100755 index 00000000000..8d8528b9d6d --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MAXIMUM_QOS.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_MAXIMUM_QOS : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_MAXIMUM_QOS(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MESSAGE_EXPIRY_INTERVAL.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MESSAGE_EXPIRY_INTERVAL.cs new file mode 100755 index 00000000000..c00f7131931 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_MESSAGE_EXPIRY_INTERVAL.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_MESSAGE_EXPIRY_INTERVAL : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public uint Value { get; } + + public MQTT_Property_MESSAGE_EXPIRY_INTERVAL(MQTT_PropertyType propertyType, uint value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_PAYLOAD_FORMAT_INDICATOR.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_PAYLOAD_FORMAT_INDICATOR.cs new file mode 100755 index 00000000000..3b21f8e951f --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_PAYLOAD_FORMAT_INDICATOR.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_PAYLOAD_FORMAT_INDICATOR : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_PAYLOAD_FORMAT_INDICATOR(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REASON_STRING.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REASON_STRING.cs new file mode 100755 index 00000000000..7ea0ef16e05 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REASON_STRING.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_REASON_STRING : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public MQTT_String Value { get; } + + public MQTT_Property_REASON_STRING(MQTT_PropertyType propertyType, MQTT_String value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RECEIVE_MAXIMUM.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RECEIVE_MAXIMUM.cs new file mode 100755 index 00000000000..b602b6005db --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RECEIVE_MAXIMUM.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_RECEIVE_MAXIMUM : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public ushort Value { get; } + + public MQTT_Property_RECEIVE_MAXIMUM(MQTT_PropertyType propertyType, ushort value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REQUEST_PROBLEM_INFORMATION.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REQUEST_PROBLEM_INFORMATION.cs new file mode 100755 index 00000000000..41f6ee171ef --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REQUEST_PROBLEM_INFORMATION.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_REQUEST_PROBLEM_INFORMATION : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_REQUEST_PROBLEM_INFORMATION(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REQUEST_RESPONSE_INFORMATION.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REQUEST_RESPONSE_INFORMATION.cs new file mode 100755 index 00000000000..dcdce2dc9da --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_REQUEST_RESPONSE_INFORMATION.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_REQUEST_RESPONSE_INFORMATION : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_REQUEST_RESPONSE_INFORMATION(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RESPONSE_INFORMATION.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RESPONSE_INFORMATION.cs new file mode 100755 index 00000000000..c202e937375 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RESPONSE_INFORMATION.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_RESPONSE_INFORMATION : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public MQTT_String Value { get; } + + public MQTT_Property_RESPONSE_INFORMATION(MQTT_PropertyType propertyType, MQTT_String value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RESPONSE_TOPIC.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RESPONSE_TOPIC.cs new file mode 100755 index 00000000000..841884e4fa7 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RESPONSE_TOPIC.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_RESPONSE_TOPIC : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public MQTT_String Value { get; } + + public MQTT_Property_RESPONSE_TOPIC(MQTT_PropertyType propertyType, MQTT_String value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RETAIN_AVAILABLE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RETAIN_AVAILABLE.cs new file mode 100755 index 00000000000..18057b707d9 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_RETAIN_AVAILABLE.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_RETAIN_AVAILABLE : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_RETAIN_AVAILABLE(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SERVER_REFERENCE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SERVER_REFERENCE.cs new file mode 100755 index 00000000000..65db959ae25 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SERVER_REFERENCE.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_SERVER_REFERENCE : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public MQTT_String Value { get; } + + public MQTT_Property_SERVER_REFERENCE(MQTT_PropertyType propertyType, MQTT_String value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE.cs new file mode 100755 index 00000000000..7e05153dbac --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE.cs new file mode 100755 index 00000000000..f9823208a54 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS.cs new file mode 100755 index 00000000000..8c34867c4ec --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_TOPIC_ALIAS : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public ushort Value { get; } + + public MQTT_Property_TOPIC_ALIAS(MQTT_PropertyType propertyType, ushort value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS_MAXIMUM.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS_MAXIMUM.cs new file mode 100755 index 00000000000..9d626c1fc7c --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS_MAXIMUM.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_TOPIC_ALIAS_MAXIMUM : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public ushort Value { get; } + + public MQTT_Property_TOPIC_ALIAS_MAXIMUM(MQTT_PropertyType propertyType, ushort value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_USER_PROPERTY.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_USER_PROPERTY.cs new file mode 100755 index 00000000000..052e2df7e0d --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_USER_PROPERTY.cs @@ -0,0 +1,49 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_USER_PROPERTY : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public MQTT_String Name { get; } + public MQTT_String Value { get; } + + public MQTT_Property_USER_PROPERTY(MQTT_PropertyType propertyType, MQTT_String name, MQTT_String value) + : base(propertyType) + { + Name = name; + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE.cs new file mode 100755 index 00000000000..7d071b0c5dd --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public byte Value { get; } + + public MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE(MQTT_PropertyType propertyType, byte value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_WILL_DELAY_INTERVAL.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_WILL_DELAY_INTERVAL.cs new file mode 100755 index 00000000000..5f83a077a0f --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_Property_WILL_DELAY_INTERVAL.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_Property_WILL_DELAY_INTERVAL : MQTT_Property + { + + // Accessors for discriminator values. + + // Properties. + public uint Value { get; } + + public MQTT_Property_WILL_DELAY_INTERVAL(MQTT_PropertyType propertyType, uint value) + : base(propertyType) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ReasonCode.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ReasonCode.cs new file mode 100755 index 00000000000..cfb1504d19e --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_ReasonCode.cs @@ -0,0 +1,1050 @@ +/* + * 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. + */ + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public enum MQTT_ReasonCode + { + SUCCESS = 0X00, + GRANTED_QOS_1 = 0X01, + GRANTED_QOS_2 = 0X02, + DISCONNECT_WITH_WILL_MESSAGE = 0X04, + NO_MATCHING_SUBSCRIBERS = 0x10, + NO_SUBSCRIPTION_EXISTED = 0x11, + CONTINUE_AUTHENTICATION = 0X18, + RE_AUTHENTICATE = 0X19, + UNSPECIFIED_ERROR = 0X80, + MALFORMED_PACKET = 0X81, + PROTOCOL_ERROR = 0X82, + IMPLEMENTATION_SPECIFIC_ERROR = 0X83, + UNSUPPORTED_PROTOCOL_VERSION = 0X84, + CLIENT_IDENTIFIER_NOT_VALID = 0X85, + BAD_USER_NAME_OR_PASSWORD = 0X86, + NOT_AUTHORIZED = 0X87, + SERVER_UNAVAILABLE = 0X88, + SERVER_BUSY = 0X89, + BANNED = 0X8A, + SERVER_SHUTTING_DOWN = 0X8B, + BAD_AUTHENTICATION_METHOD = 0X8C, + KEEP_ALIVE_TIMEOUT = 0X8D, + SESSION_TAKEN_OVER = 0X8E, + TOPIC_FILTER_INVALID = 0X8F, + TOPIC_NAME_INVALID = 0X90, + PACKET_IDENTIFIER_IN_USE = 0X91, + PACKET_IDENTIFIER_NOT_FOUND = 0X92, + RECEIVE_MAXIMUM_EXCEEDED = 0X93, + TOPIC_ALIAS_INVALID = 0X94, + PACKET_TOO_LARGE = 0X95, + MESSAGE_RATE_TO_HIGH = 0X96, + QUOTA_EXCEEDED = 0X97, + ADMINISTRATIVE_ACTION = 0X98, + PAYLOAD_FORMAT_INVALID = 0X99, + RETAIN_NOT_SUPPORTED = 0X9A, + QOS_NOT_SUPPORTED = 0X9B, + USE_ANOTHER_SERVER = 0X9C, + SERVER_MOVED = 0X9D, + SHARED_SUBSCRIPTIONS_NOT_SUPPORTED = 0X9E, + CONNECTION_RATE_EXCEEDED = 0X9F, + MAXIMUM_CONNECT_TIME = 0XA0, + SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED = 0XA1, + WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED = 0XA2, + } + + public static class MQTT_ReasonCodeInfo + { + + public static bool? DisconnectReason(this MQTT_ReasonCode value) + { + switch (value) + { + case MQTT_ReasonCode.SUCCESS: { /* '0X00' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case MQTT_ReasonCode.GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case MQTT_ReasonCode.DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return true; + } + case MQTT_ReasonCode.CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case MQTT_ReasonCode.RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case MQTT_ReasonCode.UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case MQTT_ReasonCode.MALFORMED_PACKET: { /* '0X81' */ + return true; + } + case MQTT_ReasonCode.PROTOCOL_ERROR: { /* '0X82' */ + return true; + } + case MQTT_ReasonCode.IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case MQTT_ReasonCode.UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case MQTT_ReasonCode.CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case MQTT_ReasonCode.BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case MQTT_ReasonCode.NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case MQTT_ReasonCode.SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case MQTT_ReasonCode.SERVER_BUSY: { /* '0X89' */ + return true; + } + case MQTT_ReasonCode.BANNED: { /* '0X8A' */ + return false; + } + case MQTT_ReasonCode.SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return true; + } + case MQTT_ReasonCode.BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case MQTT_ReasonCode.KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return true; + } + case MQTT_ReasonCode.SESSION_TAKEN_OVER: { /* '0X8E' */ + return true; + } + case MQTT_ReasonCode.TOPIC_FILTER_INVALID: { /* '0X8F' */ + return true; + } + case MQTT_ReasonCode.TOPIC_NAME_INVALID: { /* '0X90' */ + return true; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case MQTT_ReasonCode.RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return true; + } + case MQTT_ReasonCode.TOPIC_ALIAS_INVALID: { /* '0X94' */ + return true; + } + case MQTT_ReasonCode.PACKET_TOO_LARGE: { /* '0X95' */ + return true; + } + case MQTT_ReasonCode.MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return true; + } + case MQTT_ReasonCode.QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case MQTT_ReasonCode.ADMINISTRATIVE_ACTION: { /* '0X98' */ + return true; + } + case MQTT_ReasonCode.PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return true; + } + case MQTT_ReasonCode.RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return true; + } + case MQTT_ReasonCode.QOS_NOT_SUPPORTED: { /* '0X9B' */ + return true; + } + case MQTT_ReasonCode.USE_ANOTHER_SERVER: { /* '0X9C' */ + return true; + } + case MQTT_ReasonCode.SERVER_MOVED: { /* '0X9D' */ + return true; + } + case MQTT_ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return true; + } + case MQTT_ReasonCode.CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return true; + } + case MQTT_ReasonCode.MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return true; + } + case MQTT_ReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return true; + } + case MQTT_ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return true; + } + case MQTT_ReasonCode.NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case MQTT_ReasonCode.NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return false; + } + } + } + + public static bool? UnsubackResponse(this MQTT_ReasonCode value) + { + switch (value) + { + case MQTT_ReasonCode.SUCCESS: { /* '0X00' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case MQTT_ReasonCode.GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case MQTT_ReasonCode.DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case MQTT_ReasonCode.CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case MQTT_ReasonCode.RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case MQTT_ReasonCode.UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case MQTT_ReasonCode.MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case MQTT_ReasonCode.PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case MQTT_ReasonCode.IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case MQTT_ReasonCode.UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case MQTT_ReasonCode.CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case MQTT_ReasonCode.BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case MQTT_ReasonCode.NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case MQTT_ReasonCode.SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case MQTT_ReasonCode.SERVER_BUSY: { /* '0X89' */ + return false; + } + case MQTT_ReasonCode.BANNED: { /* '0X8A' */ + return false; + } + case MQTT_ReasonCode.SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case MQTT_ReasonCode.BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case MQTT_ReasonCode.KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case MQTT_ReasonCode.SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case MQTT_ReasonCode.TOPIC_FILTER_INVALID: { /* '0X8F' */ + return true; + } + case MQTT_ReasonCode.TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return true; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case MQTT_ReasonCode.RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case MQTT_ReasonCode.TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case MQTT_ReasonCode.PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case MQTT_ReasonCode.MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case MQTT_ReasonCode.QUOTA_EXCEEDED: { /* '0X97' */ + return false; + } + case MQTT_ReasonCode.ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case MQTT_ReasonCode.PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case MQTT_ReasonCode.RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case MQTT_ReasonCode.QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case MQTT_ReasonCode.USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case MQTT_ReasonCode.SERVER_MOVED: { /* '0X9D' */ + return false; + } + case MQTT_ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case MQTT_ReasonCode.CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case MQTT_ReasonCode.MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case MQTT_ReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case MQTT_ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case MQTT_ReasonCode.NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case MQTT_ReasonCode.NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return true; + } + default: { + return false; + } + } + } + + public static bool? SubackResponse(this MQTT_ReasonCode value) + { + switch (value) + { + case MQTT_ReasonCode.SUCCESS: { /* '0X00' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_1: { /* '0X01' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_2: { /* '0X02' */ + return true; + } + case MQTT_ReasonCode.DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case MQTT_ReasonCode.CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case MQTT_ReasonCode.RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case MQTT_ReasonCode.UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case MQTT_ReasonCode.MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case MQTT_ReasonCode.PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case MQTT_ReasonCode.IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case MQTT_ReasonCode.UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case MQTT_ReasonCode.CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case MQTT_ReasonCode.BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case MQTT_ReasonCode.NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case MQTT_ReasonCode.SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case MQTT_ReasonCode.SERVER_BUSY: { /* '0X89' */ + return false; + } + case MQTT_ReasonCode.BANNED: { /* '0X8A' */ + return false; + } + case MQTT_ReasonCode.SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case MQTT_ReasonCode.BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case MQTT_ReasonCode.KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case MQTT_ReasonCode.SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case MQTT_ReasonCode.TOPIC_FILTER_INVALID: { /* '0X8F' */ + return true; + } + case MQTT_ReasonCode.TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return true; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case MQTT_ReasonCode.RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case MQTT_ReasonCode.TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case MQTT_ReasonCode.PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case MQTT_ReasonCode.MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case MQTT_ReasonCode.QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case MQTT_ReasonCode.ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case MQTT_ReasonCode.PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case MQTT_ReasonCode.RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case MQTT_ReasonCode.QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case MQTT_ReasonCode.USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case MQTT_ReasonCode.SERVER_MOVED: { /* '0X9D' */ + return false; + } + case MQTT_ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return true; + } + case MQTT_ReasonCode.CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case MQTT_ReasonCode.MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case MQTT_ReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return true; + } + case MQTT_ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return true; + } + case MQTT_ReasonCode.NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case MQTT_ReasonCode.NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return false; + } + } + } + + public static bool? AuthReason(this MQTT_ReasonCode value) + { + switch (value) + { + case MQTT_ReasonCode.SUCCESS: { /* '0X00' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case MQTT_ReasonCode.GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case MQTT_ReasonCode.DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case MQTT_ReasonCode.CONTINUE_AUTHENTICATION: { /* '0X18' */ + return true; + } + case MQTT_ReasonCode.RE_AUTHENTICATE: { /* '0X19' */ + return true; + } + case MQTT_ReasonCode.UNSPECIFIED_ERROR: { /* '0X80' */ + return false; + } + case MQTT_ReasonCode.MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case MQTT_ReasonCode.PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case MQTT_ReasonCode.IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return false; + } + case MQTT_ReasonCode.UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case MQTT_ReasonCode.CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case MQTT_ReasonCode.BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case MQTT_ReasonCode.NOT_AUTHORIZED: { /* '0X87' */ + return false; + } + case MQTT_ReasonCode.SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case MQTT_ReasonCode.SERVER_BUSY: { /* '0X89' */ + return false; + } + case MQTT_ReasonCode.BANNED: { /* '0X8A' */ + return false; + } + case MQTT_ReasonCode.SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case MQTT_ReasonCode.BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case MQTT_ReasonCode.KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case MQTT_ReasonCode.SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case MQTT_ReasonCode.TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case MQTT_ReasonCode.TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case MQTT_ReasonCode.RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case MQTT_ReasonCode.TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case MQTT_ReasonCode.PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case MQTT_ReasonCode.MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case MQTT_ReasonCode.QUOTA_EXCEEDED: { /* '0X97' */ + return false; + } + case MQTT_ReasonCode.ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case MQTT_ReasonCode.PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case MQTT_ReasonCode.RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case MQTT_ReasonCode.QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case MQTT_ReasonCode.USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case MQTT_ReasonCode.SERVER_MOVED: { /* '0X9D' */ + return false; + } + case MQTT_ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case MQTT_ReasonCode.CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case MQTT_ReasonCode.MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case MQTT_ReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case MQTT_ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case MQTT_ReasonCode.NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case MQTT_ReasonCode.NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return false; + } + } + } + + public static bool? PubrelPubcompResponse(this MQTT_ReasonCode value) + { + switch (value) + { + case MQTT_ReasonCode.SUCCESS: { /* '0X00' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case MQTT_ReasonCode.GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case MQTT_ReasonCode.DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case MQTT_ReasonCode.CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case MQTT_ReasonCode.RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case MQTT_ReasonCode.UNSPECIFIED_ERROR: { /* '0X80' */ + return false; + } + case MQTT_ReasonCode.MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case MQTT_ReasonCode.PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case MQTT_ReasonCode.IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return false; + } + case MQTT_ReasonCode.UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case MQTT_ReasonCode.CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case MQTT_ReasonCode.BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case MQTT_ReasonCode.NOT_AUTHORIZED: { /* '0X87' */ + return false; + } + case MQTT_ReasonCode.SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case MQTT_ReasonCode.SERVER_BUSY: { /* '0X89' */ + return false; + } + case MQTT_ReasonCode.BANNED: { /* '0X8A' */ + return false; + } + case MQTT_ReasonCode.SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case MQTT_ReasonCode.BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case MQTT_ReasonCode.KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case MQTT_ReasonCode.SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case MQTT_ReasonCode.TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case MQTT_ReasonCode.TOPIC_NAME_INVALID: { /* '0X90' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return true; + } + case MQTT_ReasonCode.RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case MQTT_ReasonCode.TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case MQTT_ReasonCode.PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case MQTT_ReasonCode.MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case MQTT_ReasonCode.QUOTA_EXCEEDED: { /* '0X97' */ + return false; + } + case MQTT_ReasonCode.ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case MQTT_ReasonCode.PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return false; + } + case MQTT_ReasonCode.RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case MQTT_ReasonCode.QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case MQTT_ReasonCode.USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case MQTT_ReasonCode.SERVER_MOVED: { /* '0X9D' */ + return false; + } + case MQTT_ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case MQTT_ReasonCode.CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case MQTT_ReasonCode.MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case MQTT_ReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case MQTT_ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case MQTT_ReasonCode.NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case MQTT_ReasonCode.NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return false; + } + } + } + + public static bool? PubackPubrecResponse(this MQTT_ReasonCode value) + { + switch (value) + { + case MQTT_ReasonCode.SUCCESS: { /* '0X00' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case MQTT_ReasonCode.GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case MQTT_ReasonCode.DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case MQTT_ReasonCode.CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case MQTT_ReasonCode.RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case MQTT_ReasonCode.UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case MQTT_ReasonCode.MALFORMED_PACKET: { /* '0X81' */ + return false; + } + case MQTT_ReasonCode.PROTOCOL_ERROR: { /* '0X82' */ + return false; + } + case MQTT_ReasonCode.IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case MQTT_ReasonCode.UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return false; + } + case MQTT_ReasonCode.CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return false; + } + case MQTT_ReasonCode.BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return false; + } + case MQTT_ReasonCode.NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case MQTT_ReasonCode.SERVER_UNAVAILABLE: { /* '0X88' */ + return false; + } + case MQTT_ReasonCode.SERVER_BUSY: { /* '0X89' */ + return false; + } + case MQTT_ReasonCode.BANNED: { /* '0X8A' */ + return false; + } + case MQTT_ReasonCode.SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case MQTT_ReasonCode.BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return false; + } + case MQTT_ReasonCode.KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case MQTT_ReasonCode.SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case MQTT_ReasonCode.TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case MQTT_ReasonCode.TOPIC_NAME_INVALID: { /* '0X90' */ + return true; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return true; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case MQTT_ReasonCode.RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case MQTT_ReasonCode.TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case MQTT_ReasonCode.PACKET_TOO_LARGE: { /* '0X95' */ + return false; + } + case MQTT_ReasonCode.MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case MQTT_ReasonCode.QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case MQTT_ReasonCode.ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case MQTT_ReasonCode.PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return true; + } + case MQTT_ReasonCode.RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return false; + } + case MQTT_ReasonCode.QOS_NOT_SUPPORTED: { /* '0X9B' */ + return false; + } + case MQTT_ReasonCode.USE_ANOTHER_SERVER: { /* '0X9C' */ + return false; + } + case MQTT_ReasonCode.SERVER_MOVED: { /* '0X9D' */ + return false; + } + case MQTT_ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case MQTT_ReasonCode.CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return false; + } + case MQTT_ReasonCode.MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case MQTT_ReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case MQTT_ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case MQTT_ReasonCode.NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return true; + } + case MQTT_ReasonCode.NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return false; + } + } + } + + public static bool? ConnackResponse(this MQTT_ReasonCode value) + { + switch (value) + { + case MQTT_ReasonCode.SUCCESS: { /* '0X00' */ + return true; + } + case MQTT_ReasonCode.GRANTED_QOS_1: { /* '0X01' */ + return false; + } + case MQTT_ReasonCode.GRANTED_QOS_2: { /* '0X02' */ + return false; + } + case MQTT_ReasonCode.DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */ + return false; + } + case MQTT_ReasonCode.CONTINUE_AUTHENTICATION: { /* '0X18' */ + return false; + } + case MQTT_ReasonCode.RE_AUTHENTICATE: { /* '0X19' */ + return false; + } + case MQTT_ReasonCode.UNSPECIFIED_ERROR: { /* '0X80' */ + return true; + } + case MQTT_ReasonCode.MALFORMED_PACKET: { /* '0X81' */ + return true; + } + case MQTT_ReasonCode.PROTOCOL_ERROR: { /* '0X82' */ + return true; + } + case MQTT_ReasonCode.IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */ + return true; + } + case MQTT_ReasonCode.UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */ + return true; + } + case MQTT_ReasonCode.CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */ + return true; + } + case MQTT_ReasonCode.BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */ + return true; + } + case MQTT_ReasonCode.NOT_AUTHORIZED: { /* '0X87' */ + return true; + } + case MQTT_ReasonCode.SERVER_UNAVAILABLE: { /* '0X88' */ + return true; + } + case MQTT_ReasonCode.SERVER_BUSY: { /* '0X89' */ + return true; + } + case MQTT_ReasonCode.BANNED: { /* '0X8A' */ + return true; + } + case MQTT_ReasonCode.SERVER_SHUTTING_DOWN: { /* '0X8B' */ + return false; + } + case MQTT_ReasonCode.BAD_AUTHENTICATION_METHOD: { /* '0X8C' */ + return true; + } + case MQTT_ReasonCode.KEEP_ALIVE_TIMEOUT: { /* '0X8D' */ + return false; + } + case MQTT_ReasonCode.SESSION_TAKEN_OVER: { /* '0X8E' */ + return false; + } + case MQTT_ReasonCode.TOPIC_FILTER_INVALID: { /* '0X8F' */ + return false; + } + case MQTT_ReasonCode.TOPIC_NAME_INVALID: { /* '0X90' */ + return true; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_IN_USE: { /* '0X91' */ + return false; + } + case MQTT_ReasonCode.PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */ + return false; + } + case MQTT_ReasonCode.RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */ + return false; + } + case MQTT_ReasonCode.TOPIC_ALIAS_INVALID: { /* '0X94' */ + return false; + } + case MQTT_ReasonCode.PACKET_TOO_LARGE: { /* '0X95' */ + return true; + } + case MQTT_ReasonCode.MESSAGE_RATE_TO_HIGH: { /* '0X96' */ + return false; + } + case MQTT_ReasonCode.QUOTA_EXCEEDED: { /* '0X97' */ + return true; + } + case MQTT_ReasonCode.ADMINISTRATIVE_ACTION: { /* '0X98' */ + return false; + } + case MQTT_ReasonCode.PAYLOAD_FORMAT_INVALID: { /* '0X99' */ + return true; + } + case MQTT_ReasonCode.RETAIN_NOT_SUPPORTED: { /* '0X9A' */ + return true; + } + case MQTT_ReasonCode.QOS_NOT_SUPPORTED: { /* '0X9B' */ + return true; + } + case MQTT_ReasonCode.USE_ANOTHER_SERVER: { /* '0X9C' */ + return true; + } + case MQTT_ReasonCode.SERVER_MOVED: { /* '0X9D' */ + return true; + } + case MQTT_ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */ + return false; + } + case MQTT_ReasonCode.CONNECTION_RATE_EXCEEDED: { /* '0X9F' */ + return true; + } + case MQTT_ReasonCode.MAXIMUM_CONNECT_TIME: { /* '0XA0' */ + return false; + } + case MQTT_ReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */ + return false; + } + case MQTT_ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */ + return false; + } + case MQTT_ReasonCode.NO_MATCHING_SUBSCRIBERS: { /* '0x10' */ + return false; + } + case MQTT_ReasonCode.NO_SUBSCRIPTION_EXISTED: { /* '0x11' */ + return false; + } + default: { + return false; + } + } + } + } + +} + diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_RetainHandling.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_RetainHandling.cs new file mode 100755 index 00000000000..c935f957f03 --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_RetainHandling.cs @@ -0,0 +1,33 @@ +/* + * 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. + */ + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public enum MQTT_RetainHandling + { + SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE = 0x0, + SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST = 0x1, + DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE = 0x2, + } + +} + diff --git a/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_String.cs b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_String.cs new file mode 100755 index 00000000000..e0578b361fa --- /dev/null +++ b/sandbox/mqtt/mqtt-cs/drivers/mqtt/src/drivers/mqtt/readwrite/model/MQTT_String.cs @@ -0,0 +1,45 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using org.apache.plc4net.api.value; +using org.apache.plc4net.spi.generation; +using org.apache.plc4net.spi.model.values; + +// Code generated by code-generation. DO NOT EDIT. + +namespace org.apache.plc4net.drivers.mqtt.readwrite.model +{ + + public class MQTT_String + { + + + // Properties. + public string Value { get; } + + public MQTT_String(string value) + { + Value = value; + } + + } +} diff --git a/sandbox/mqtt/mqtt-go/assets/testing/protocols/mqtt/ParserSerializerTestsuite.xml b/sandbox/mqtt/mqtt-go/assets/testing/protocols/mqtt/ParserSerializerTestsuite.xml new file mode 100755 index 00000000000..1a662e9645e --- /dev/null +++ b/sandbox/mqtt/mqtt-go/assets/testing/protocols/mqtt/ParserSerializerTestsuite.xml @@ -0,0 +1,81 @@ + + + + + MQTT5 + + mqtt + read-write + + + MQTT Connection Request + 101d00044d51545405c200050000066c776d71747400037472790003747279 + MQTT_ControlPacket + + + + 1 + + + 0 + 29 + + + 4 + MQTT + + + 5 + true + true + false + 0 + false + true + false + 5 + 0 + + + + + 6 + lwmqtt + + + + + 3 + try + + + + + 3 + try + + + + + + + + \ No newline at end of file diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/Filter.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/Filter.go new file mode 100755 index 00000000000..5c0dfea4cce --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/Filter.go @@ -0,0 +1,261 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type Filter struct { + Filter *MQTT_String + RetainHandling MQTT_RetainHandling + Retain bool + NoLocal bool + MaxQos MQTT_QOS +} + +// The corresponding interface +type IFilter interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +func NewFilter(filter *MQTT_String, retainHandling MQTT_RetainHandling, retain bool, noLocal bool, maxQos MQTT_QOS) *Filter { + return &Filter{Filter: filter, RetainHandling: retainHandling, Retain: retain, NoLocal: noLocal, MaxQos: maxQos} +} + +func CastFilter(structType interface{}) *Filter { + castFunc := func(typ interface{}) *Filter { + if casted, ok := typ.(Filter); ok { + return &casted + } + if casted, ok := typ.(*Filter); ok { + return casted + } + return nil + } + return castFunc(structType) +} + +func (m *Filter) GetTypeName() string { + return "Filter" +} + +func (m *Filter) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *Filter) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (filter) + lengthInBits += m.Filter.LengthInBits() + + // Reserved Field (reserved) + lengthInBits += 2 + + // Simple field (retainHandling) + lengthInBits += 2 + + // Simple field (retain) + lengthInBits += 1; + + // Simple field (noLocal) + lengthInBits += 1; + + // Simple field (maxQos) + lengthInBits += 2 + + return lengthInBits +} + + +func (m *Filter) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func FilterParse(readBuffer utils.ReadBuffer) (*Filter, error) { + if pullErr := readBuffer.PullContext("Filter"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (filter) + if pullErr := readBuffer.PullContext("filter"); pullErr != nil { + return nil, pullErr + } +_filter, _filterErr := MQTT_StringParse(readBuffer) + if _filterErr != nil { + return nil, errors.Wrap(_filterErr, "Error parsing 'filter' field") + } + filter := CastMQTT_String(_filter) + if closeErr := readBuffer.CloseContext("filter"); closeErr != nil { + return nil, closeErr + } + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 2) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (retainHandling) + if pullErr := readBuffer.PullContext("retainHandling"); pullErr != nil { + return nil, pullErr + } +_retainHandling, _retainHandlingErr := MQTT_RetainHandlingParse(readBuffer) + if _retainHandlingErr != nil { + return nil, errors.Wrap(_retainHandlingErr, "Error parsing 'retainHandling' field") + } + retainHandling := _retainHandling + if closeErr := readBuffer.CloseContext("retainHandling"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (retain) +_retain, _retainErr := readBuffer.ReadBit("retain") + if _retainErr != nil { + return nil, errors.Wrap(_retainErr, "Error parsing 'retain' field") + } + retain := _retain + + // Simple Field (noLocal) +_noLocal, _noLocalErr := readBuffer.ReadBit("noLocal") + if _noLocalErr != nil { + return nil, errors.Wrap(_noLocalErr, "Error parsing 'noLocal' field") + } + noLocal := _noLocal + + // Simple Field (maxQos) + if pullErr := readBuffer.PullContext("maxQos"); pullErr != nil { + return nil, pullErr + } +_maxQos, _maxQosErr := MQTT_QOSParse(readBuffer) + if _maxQosErr != nil { + return nil, errors.Wrap(_maxQosErr, "Error parsing 'maxQos' field") + } + maxQos := _maxQos + if closeErr := readBuffer.CloseContext("maxQos"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("Filter"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewFilter(filter, retainHandling, retain, noLocal, maxQos), nil +} + +func (m *Filter) Serialize(writeBuffer utils.WriteBuffer) error { + if pushErr :=writeBuffer.PushContext("Filter"); pushErr != nil { + return pushErr + } + + // Simple Field (filter) + if pushErr := writeBuffer.PushContext("filter"); pushErr != nil { + return pushErr + } + _filterErr := m.Filter.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("filter"); popErr != nil { + return popErr + } + if _filterErr != nil { + return errors.Wrap(_filterErr, "Error serializing 'filter' field") + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 2, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (retainHandling) + if pushErr := writeBuffer.PushContext("retainHandling"); pushErr != nil { + return pushErr + } + _retainHandlingErr := m.RetainHandling.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("retainHandling"); popErr != nil { + return popErr + } + if _retainHandlingErr != nil { + return errors.Wrap(_retainHandlingErr, "Error serializing 'retainHandling' field") + } + + // Simple Field (retain) + retain := bool(m.Retain) + _retainErr := writeBuffer.WriteBit("retain", (retain)) + if _retainErr != nil { + return errors.Wrap(_retainErr, "Error serializing 'retain' field") + } + + // Simple Field (noLocal) + noLocal := bool(m.NoLocal) + _noLocalErr := writeBuffer.WriteBit("noLocal", (noLocal)) + if _noLocalErr != nil { + return errors.Wrap(_noLocalErr, "Error serializing 'noLocal' field") + } + + // Simple Field (maxQos) + if pushErr := writeBuffer.PushContext("maxQos"); pushErr != nil { + return pushErr + } + _maxQosErr := m.MaxQos.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("maxQos"); popErr != nil { + return popErr + } + if _maxQosErr != nil { + return errors.Wrap(_maxQosErr, "Error serializing 'maxQos' field") + } + + if popErr := writeBuffer.PopContext("Filter"); popErr != nil { + return popErr + } + return nil +} + +func (m *Filter) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket.go new file mode 100755 index 00000000000..dbd61853b36 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket.go @@ -0,0 +1,198 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket struct { + Child IMQTT_ControlPacketChild +} + +// The corresponding interface +type IMQTT_ControlPacket interface { + PacketType() MQTT_ControlPacketType + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +type IMQTT_ControlPacketParent interface { + SerializeParent(writeBuffer utils.WriteBuffer, child IMQTT_ControlPacket, serializeChildFunction func() error) error + GetTypeName() string +} + +type IMQTT_ControlPacketChild interface { + Serialize(writeBuffer utils.WriteBuffer) error + InitializeParent(parent *MQTT_ControlPacket) + GetTypeName() string + IMQTT_ControlPacket +} + +func NewMQTT_ControlPacket() *MQTT_ControlPacket { + return &MQTT_ControlPacket{} +} + +func CastMQTT_ControlPacket(structType interface{}) *MQTT_ControlPacket { + castFunc := func(typ interface{}) *MQTT_ControlPacket { + if casted, ok := typ.(MQTT_ControlPacket); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return casted + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket) GetTypeName() string { + return "MQTT_ControlPacket" +} + +func (m *MQTT_ControlPacket) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket) LengthInBitsConditional(lastItem bool) uint16 { + return m.Child.LengthInBits() +} + +func (m *MQTT_ControlPacket) ParentLengthInBits() uint16 { + lengthInBits := uint16(0) + // Discriminator Field (packetType) + lengthInBits += 4; + + return lengthInBits +} + +func (m *MQTT_ControlPacket) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacketParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket"); pullErr != nil { + return nil, pullErr + } + + // Discriminator Field (packetType) (Used as input to a switch field) + packetType_temp, _packetTypeErr := MQTT_ControlPacketTypeParse(readBuffer) + var packetType MQTT_ControlPacketType = packetType_temp + if _packetTypeErr != nil { + return nil, errors.Wrap(_packetTypeErr, "Error parsing 'packetType' field") + } + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + var _parent *MQTT_ControlPacket + var typeSwitchError error + switch { +case packetType == MQTT_ControlPacketType_CONNECT : // MQTT_ControlPacket_CONNECT + _parent, typeSwitchError = MQTT_ControlPacket_CONNECTParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_CONNACK : // MQTT_ControlPacket_CONNACK + _parent, typeSwitchError = MQTT_ControlPacket_CONNACKParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_PUBLISH : // MQTT_ControlPacket_PUBLISH + _parent, typeSwitchError = MQTT_ControlPacket_PUBLISHParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_PUBACK : // MQTT_ControlPacket_PUBACK + _parent, typeSwitchError = MQTT_ControlPacket_PUBACKParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_PUBREC : // MQTT_ControlPacket_PUBREC + _parent, typeSwitchError = MQTT_ControlPacket_PUBRECParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_PUBREL : // MQTT_ControlPacket_PUBREL + _parent, typeSwitchError = MQTT_ControlPacket_PUBRELParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_PUBCOMP : // MQTT_ControlPacket_PUBCOMP + _parent, typeSwitchError = MQTT_ControlPacket_PUBCOMPParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_SUBSCRIBE : // MQTT_ControlPacket_SUBSCRIBE + _parent, typeSwitchError = MQTT_ControlPacket_SUBSCRIBEParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_SUBACK : // MQTT_ControlPacket_SUBACK + _parent, typeSwitchError = MQTT_ControlPacket_SUBACKParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_UNSUBSCRIBE : // MQTT_ControlPacket_UNSUBSCRIBE + _parent, typeSwitchError = MQTT_ControlPacket_UNSUBSCRIBEParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_UNSUBACK : // MQTT_ControlPacket_UNSUBACK + _parent, typeSwitchError = MQTT_ControlPacket_UNSUBACKParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_PINGREQ : // MQTT_ControlPacket_PINGREQ + _parent, typeSwitchError = MQTT_ControlPacket_PINGREQParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_PINGRESP : // MQTT_ControlPacket_PINGRESP + _parent, typeSwitchError = MQTT_ControlPacket_PINGRESPParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_DISCONNECT : // MQTT_ControlPacket_DISCONNECT + _parent, typeSwitchError = MQTT_ControlPacket_DISCONNECTParse(readBuffer, ) +case packetType == MQTT_ControlPacketType_AUTH : // MQTT_ControlPacket_AUTH + _parent, typeSwitchError = MQTT_ControlPacket_AUTHParse(readBuffer, ) + default: + // TODO: return actual type + typeSwitchError = errors.New("Unmapped type") + } + if typeSwitchError != nil { + return nil, errors.Wrap(typeSwitchError, "Error parsing sub-type for type-switch.") + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket"); closeErr != nil { + return nil, closeErr + } + + // Finish initializing + _parent.Child.InitializeParent(_parent) + return _parent, nil +} + +func (m *MQTT_ControlPacket) Serialize(writeBuffer utils.WriteBuffer) error { + return m.Child.Serialize(writeBuffer) +} + +func (m *MQTT_ControlPacket) SerializeParent(writeBuffer utils.WriteBuffer, child IMQTT_ControlPacket, serializeChildFunction func() error) error { + if pushErr :=writeBuffer.PushContext("MQTT_ControlPacket"); pushErr != nil { + return pushErr + } + + // Discriminator Field (packetType) (Used as input to a switch field) + packetType := MQTT_ControlPacketType(child.PacketType()) + _packetTypeErr := packetType.Serialize(writeBuffer) + + if _packetTypeErr != nil { + return errors.Wrap(_packetTypeErr, "Error serializing 'packetType' field") + } + + // Switch field (Depending on the discriminator values, passes the serialization to a sub-type) + if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil { + return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field") + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket"); popErr != nil { + return popErr + } + return nil +} + +func (m *MQTT_ControlPacket) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacketType.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacketType.go new file mode 100755 index 00000000000..9ff55b265a9 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacketType.go @@ -0,0 +1,225 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +type MQTT_ControlPacketType uint8 + +type IMQTT_ControlPacketType interface { + Serialize(writeBuffer utils.WriteBuffer) error +} + +const( + MQTT_ControlPacketType_RESERVED MQTT_ControlPacketType = 0x0 + MQTT_ControlPacketType_CONNECT MQTT_ControlPacketType = 0x1 + MQTT_ControlPacketType_CONNACK MQTT_ControlPacketType = 0x2 + MQTT_ControlPacketType_PUBLISH MQTT_ControlPacketType = 0x3 + MQTT_ControlPacketType_PUBACK MQTT_ControlPacketType = 0x4 + MQTT_ControlPacketType_PUBREC MQTT_ControlPacketType = 0x5 + MQTT_ControlPacketType_PUBREL MQTT_ControlPacketType = 0x6 + MQTT_ControlPacketType_PUBCOMP MQTT_ControlPacketType = 0x7 + MQTT_ControlPacketType_SUBSCRIBE MQTT_ControlPacketType = 0x8 + MQTT_ControlPacketType_SUBACK MQTT_ControlPacketType = 0x9 + MQTT_ControlPacketType_UNSUBSCRIBE MQTT_ControlPacketType = 0xA + MQTT_ControlPacketType_UNSUBACK MQTT_ControlPacketType = 0xB + MQTT_ControlPacketType_PINGREQ MQTT_ControlPacketType = 0xC + MQTT_ControlPacketType_PINGRESP MQTT_ControlPacketType = 0xD + MQTT_ControlPacketType_DISCONNECT MQTT_ControlPacketType = 0xE + MQTT_ControlPacketType_AUTH MQTT_ControlPacketType = 0xF +) + +var MQTT_ControlPacketTypeValues []MQTT_ControlPacketType + +func init() { + _ = errors.New + MQTT_ControlPacketTypeValues = []MQTT_ControlPacketType { + MQTT_ControlPacketType_RESERVED, + MQTT_ControlPacketType_CONNECT, + MQTT_ControlPacketType_CONNACK, + MQTT_ControlPacketType_PUBLISH, + MQTT_ControlPacketType_PUBACK, + MQTT_ControlPacketType_PUBREC, + MQTT_ControlPacketType_PUBREL, + MQTT_ControlPacketType_PUBCOMP, + MQTT_ControlPacketType_SUBSCRIBE, + MQTT_ControlPacketType_SUBACK, + MQTT_ControlPacketType_UNSUBSCRIBE, + MQTT_ControlPacketType_UNSUBACK, + MQTT_ControlPacketType_PINGREQ, + MQTT_ControlPacketType_PINGRESP, + MQTT_ControlPacketType_DISCONNECT, + MQTT_ControlPacketType_AUTH, + } +} + +func MQTT_ControlPacketTypeByValue(value uint8) MQTT_ControlPacketType { + switch value { + case 0x0: + return MQTT_ControlPacketType_RESERVED + case 0x1: + return MQTT_ControlPacketType_CONNECT + case 0x2: + return MQTT_ControlPacketType_CONNACK + case 0x3: + return MQTT_ControlPacketType_PUBLISH + case 0x4: + return MQTT_ControlPacketType_PUBACK + case 0x5: + return MQTT_ControlPacketType_PUBREC + case 0x6: + return MQTT_ControlPacketType_PUBREL + case 0x7: + return MQTT_ControlPacketType_PUBCOMP + case 0x8: + return MQTT_ControlPacketType_SUBSCRIBE + case 0x9: + return MQTT_ControlPacketType_SUBACK + case 0xA: + return MQTT_ControlPacketType_UNSUBSCRIBE + case 0xB: + return MQTT_ControlPacketType_UNSUBACK + case 0xC: + return MQTT_ControlPacketType_PINGREQ + case 0xD: + return MQTT_ControlPacketType_PINGRESP + case 0xE: + return MQTT_ControlPacketType_DISCONNECT + case 0xF: + return MQTT_ControlPacketType_AUTH + } + return 0 +} + +func MQTT_ControlPacketTypeByName(value string) MQTT_ControlPacketType { + switch value { + case "RESERVED": + return MQTT_ControlPacketType_RESERVED + case "CONNECT": + return MQTT_ControlPacketType_CONNECT + case "CONNACK": + return MQTT_ControlPacketType_CONNACK + case "PUBLISH": + return MQTT_ControlPacketType_PUBLISH + case "PUBACK": + return MQTT_ControlPacketType_PUBACK + case "PUBREC": + return MQTT_ControlPacketType_PUBREC + case "PUBREL": + return MQTT_ControlPacketType_PUBREL + case "PUBCOMP": + return MQTT_ControlPacketType_PUBCOMP + case "SUBSCRIBE": + return MQTT_ControlPacketType_SUBSCRIBE + case "SUBACK": + return MQTT_ControlPacketType_SUBACK + case "UNSUBSCRIBE": + return MQTT_ControlPacketType_UNSUBSCRIBE + case "UNSUBACK": + return MQTT_ControlPacketType_UNSUBACK + case "PINGREQ": + return MQTT_ControlPacketType_PINGREQ + case "PINGRESP": + return MQTT_ControlPacketType_PINGRESP + case "DISCONNECT": + return MQTT_ControlPacketType_DISCONNECT + case "AUTH": + return MQTT_ControlPacketType_AUTH + } + return 0 +} + +func CastMQTT_ControlPacketType(structType interface{}) MQTT_ControlPacketType { + castFunc := func(typ interface{}) MQTT_ControlPacketType { + if sMQTT_ControlPacketType, ok := typ.(MQTT_ControlPacketType); ok { + return sMQTT_ControlPacketType + } + return 0 + } + return castFunc(structType) +} + +func (m MQTT_ControlPacketType) LengthInBits() uint16 { + return 4 +} + +func (m MQTT_ControlPacketType) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacketTypeParse(readBuffer utils.ReadBuffer) (MQTT_ControlPacketType, error) { + val, err := readBuffer.ReadUint8("MQTT_ControlPacketType", 4) + if err != nil { + return 0, nil + } + return MQTT_ControlPacketTypeByValue(val), nil +} + +func (e MQTT_ControlPacketType) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteUint8("MQTT_ControlPacketType", 4, uint8(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e MQTT_ControlPacketType) name() string { + switch e { + case MQTT_ControlPacketType_RESERVED: + return "RESERVED" + case MQTT_ControlPacketType_CONNECT: + return "CONNECT" + case MQTT_ControlPacketType_CONNACK: + return "CONNACK" + case MQTT_ControlPacketType_PUBLISH: + return "PUBLISH" + case MQTT_ControlPacketType_PUBACK: + return "PUBACK" + case MQTT_ControlPacketType_PUBREC: + return "PUBREC" + case MQTT_ControlPacketType_PUBREL: + return "PUBREL" + case MQTT_ControlPacketType_PUBCOMP: + return "PUBCOMP" + case MQTT_ControlPacketType_SUBSCRIBE: + return "SUBSCRIBE" + case MQTT_ControlPacketType_SUBACK: + return "SUBACK" + case MQTT_ControlPacketType_UNSUBSCRIBE: + return "UNSUBSCRIBE" + case MQTT_ControlPacketType_UNSUBACK: + return "UNSUBACK" + case MQTT_ControlPacketType_PINGREQ: + return "PINGREQ" + case MQTT_ControlPacketType_PINGRESP: + return "PINGRESP" + case MQTT_ControlPacketType_DISCONNECT: + return "DISCONNECT" + case MQTT_ControlPacketType_AUTH: + return "AUTH" + } + return "" +} + +func (e MQTT_ControlPacketType) String() string { + return e.name() +} + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_AUTH.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_AUTH.go new file mode 100755 index 00000000000..745d717ca1b --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_AUTH.go @@ -0,0 +1,296 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_AUTH struct { + *MQTT_ControlPacket + RemainingLength uint8 + Reason MQTT_ReasonCode + PropertyLength *uint32 + Properties []*MQTT_Property +} + +// The corresponding interface +type IMQTT_ControlPacket_AUTH interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_AUTH) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_AUTH +} + + +func (m *MQTT_ControlPacket_AUTH) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_AUTH(remainingLength uint8, reason MQTT_ReasonCode, propertyLength *uint32, properties []*MQTT_Property) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_AUTH{ + RemainingLength: remainingLength, + Reason: reason, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_AUTH(structType interface{}) *MQTT_ControlPacket_AUTH { + castFunc := func(typ interface{}) *MQTT_ControlPacket_AUTH { + if casted, ok := typ.(MQTT_ControlPacket_AUTH); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_AUTH); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_AUTH(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_AUTH(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_AUTH) GetTypeName() string { + return "MQTT_ControlPacket_AUTH" +} + +func (m *MQTT_ControlPacket_AUTH) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_AUTH) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (reason) + lengthInBits += 8 + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_AUTH) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_AUTHParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_AUTH"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (reason) + if pullErr := readBuffer.PullContext("reason"); pullErr != nil { + return nil, pullErr + } +_reason, _reasonErr := MQTT_ReasonCodeParse(readBuffer) + if _reasonErr != nil { + return nil, errors.Wrap(_reasonErr, "Error parsing 'reason' field") + } + reason := _reason + if closeErr := readBuffer.CloseContext("reason"); closeErr != nil { + return nil, closeErr + } + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_AUTH"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_AUTH{ + RemainingLength: remainingLength, + Reason: reason, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_AUTH) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_AUTH"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (reason) + if pushErr := writeBuffer.PushContext("reason"); pushErr != nil { + return pushErr + } + _reasonErr := m.Reason.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("reason"); popErr != nil { + return popErr + } + if _reasonErr != nil { + return errors.Wrap(_reasonErr, "Error serializing 'reason' field") + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_AUTH"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_AUTH) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_CONNACK.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_CONNACK.go new file mode 100755 index 00000000000..9c2405f0a96 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_CONNACK.go @@ -0,0 +1,341 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_CONNACK struct { + *MQTT_ControlPacket + RemainingLength uint8 + SessionPresentFlagSet bool + ReasonCode MQTT_ReasonCode + PropertyLength *uint32 + Properties []*MQTT_Property +} + +// The corresponding interface +type IMQTT_ControlPacket_CONNACK interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_CONNACK) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_CONNACK +} + + +func (m *MQTT_ControlPacket_CONNACK) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_CONNACK(remainingLength uint8, sessionPresentFlagSet bool, reasonCode MQTT_ReasonCode, propertyLength *uint32, properties []*MQTT_Property) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_CONNACK{ + RemainingLength: remainingLength, + SessionPresentFlagSet: sessionPresentFlagSet, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_CONNACK(structType interface{}) *MQTT_ControlPacket_CONNACK { + castFunc := func(typ interface{}) *MQTT_ControlPacket_CONNACK { + if casted, ok := typ.(MQTT_ControlPacket_CONNACK); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_CONNACK); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_CONNACK(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_CONNACK(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_CONNACK) GetTypeName() string { + return "MQTT_ControlPacket_CONNACK" +} + +func (m *MQTT_ControlPacket_CONNACK) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_CONNACK) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Reserved Field (reserved) + lengthInBits += 7 + + // Simple field (sessionPresentFlagSet) + lengthInBits += 1; + + // Simple field (reasonCode) + lengthInBits += 8 + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_CONNACK) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_CONNACKParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_CONNACK"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 7) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x00) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x00), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (sessionPresentFlagSet) +_sessionPresentFlagSet, _sessionPresentFlagSetErr := readBuffer.ReadBit("sessionPresentFlagSet") + if _sessionPresentFlagSetErr != nil { + return nil, errors.Wrap(_sessionPresentFlagSetErr, "Error parsing 'sessionPresentFlagSet' field") + } + sessionPresentFlagSet := _sessionPresentFlagSet + + // Simple Field (reasonCode) + if pullErr := readBuffer.PullContext("reasonCode"); pullErr != nil { + return nil, pullErr + } +_reasonCode, _reasonCodeErr := MQTT_ReasonCodeParse(readBuffer) + if _reasonCodeErr != nil { + return nil, errors.Wrap(_reasonCodeErr, "Error parsing 'reasonCode' field") + } + reasonCode := _reasonCode + if closeErr := readBuffer.CloseContext("reasonCode"); closeErr != nil { + return nil, closeErr + } + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_CONNACK"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_CONNACK{ + RemainingLength: remainingLength, + SessionPresentFlagSet: sessionPresentFlagSet, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_CONNACK) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_CONNACK"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 7, uint8(0x00)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (sessionPresentFlagSet) + sessionPresentFlagSet := bool(m.SessionPresentFlagSet) + _sessionPresentFlagSetErr := writeBuffer.WriteBit("sessionPresentFlagSet", (sessionPresentFlagSet)) + if _sessionPresentFlagSetErr != nil { + return errors.Wrap(_sessionPresentFlagSetErr, "Error serializing 'sessionPresentFlagSet' field") + } + + // Simple Field (reasonCode) + if pushErr := writeBuffer.PushContext("reasonCode"); pushErr != nil { + return pushErr + } + _reasonCodeErr := m.ReasonCode.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("reasonCode"); popErr != nil { + return popErr + } + if _reasonCodeErr != nil { + return errors.Wrap(_reasonCodeErr, "Error serializing 'reasonCode' field") + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_CONNACK"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_CONNACK) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_CONNECT.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_CONNECT.go new file mode 100755 index 00000000000..fceef31e0b5 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_CONNECT.go @@ -0,0 +1,591 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_CONNECT struct { + *MQTT_ControlPacket + RemainingLength uint8 + ProtocolName *MQTT_String + ProtocolVersion uint8 + UserNameFlagSet bool + PasswordFlagSet bool + WillRetainFlagSet bool + WillQosLevel uint8 + WillFlagSet bool + CleanStartFlagSet bool + KeepAlive uint16 + PropertyLength uint32 + Properties []*MQTT_Property + ClientId *MQTT_String + Username *MQTT_String + Password *MQTT_String +} + +// The corresponding interface +type IMQTT_ControlPacket_CONNECT interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_CONNECT) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_CONNECT +} + + +func (m *MQTT_ControlPacket_CONNECT) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_CONNECT(remainingLength uint8, protocolName *MQTT_String, protocolVersion uint8, userNameFlagSet bool, passwordFlagSet bool, willRetainFlagSet bool, willQosLevel uint8, willFlagSet bool, cleanStartFlagSet bool, keepAlive uint16, propertyLength uint32, properties []*MQTT_Property, clientId *MQTT_String, username *MQTT_String, password *MQTT_String) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_CONNECT{ + RemainingLength: remainingLength, + ProtocolName: protocolName, + ProtocolVersion: protocolVersion, + UserNameFlagSet: userNameFlagSet, + PasswordFlagSet: passwordFlagSet, + WillRetainFlagSet: willRetainFlagSet, + WillQosLevel: willQosLevel, + WillFlagSet: willFlagSet, + CleanStartFlagSet: cleanStartFlagSet, + KeepAlive: keepAlive, + PropertyLength: propertyLength, + Properties: properties, + ClientId: clientId, + Username: username, + Password: password, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_CONNECT(structType interface{}) *MQTT_ControlPacket_CONNECT { + castFunc := func(typ interface{}) *MQTT_ControlPacket_CONNECT { + if casted, ok := typ.(MQTT_ControlPacket_CONNECT); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_CONNECT); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_CONNECT(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_CONNECT(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_CONNECT) GetTypeName() string { + return "MQTT_ControlPacket_CONNECT" +} + +func (m *MQTT_ControlPacket_CONNECT) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_CONNECT) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (protocolName) + lengthInBits += m.ProtocolName.LengthInBits() + + // Simple field (protocolVersion) + lengthInBits += 8; + + // Simple field (userNameFlagSet) + lengthInBits += 1; + + // Simple field (passwordFlagSet) + lengthInBits += 1; + + // Simple field (willRetainFlagSet) + lengthInBits += 1; + + // Simple field (willQosLevel) + lengthInBits += 2; + + // Simple field (willFlagSet) + lengthInBits += 1; + + // Simple field (cleanStartFlagSet) + lengthInBits += 1; + + // Reserved Field (reserved) + lengthInBits += 1 + + // Simple field (keepAlive) + lengthInBits += 16; + + // Simple field (propertyLength) + lengthInBits += 32; + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + // Simple field (clientId) + lengthInBits += m.ClientId.LengthInBits() + + // Optional Field (username) + if m.Username != nil { + lengthInBits += (*m.Username).LengthInBits() + } + + // Optional Field (password) + if m.Password != nil { + lengthInBits += (*m.Password).LengthInBits() + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_CONNECT) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_CONNECTParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_CONNECT"); pullErr != nil { + return nil, pullErr + } + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (protocolName) + if pullErr := readBuffer.PullContext("protocolName"); pullErr != nil { + return nil, pullErr + } +_protocolName, _protocolNameErr := MQTT_StringParse(readBuffer) + if _protocolNameErr != nil { + return nil, errors.Wrap(_protocolNameErr, "Error parsing 'protocolName' field") + } + protocolName := CastMQTT_String(_protocolName) + if closeErr := readBuffer.CloseContext("protocolName"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (protocolVersion) +_protocolVersion, _protocolVersionErr := readBuffer.ReadUint8("protocolVersion", 8) + if _protocolVersionErr != nil { + return nil, errors.Wrap(_protocolVersionErr, "Error parsing 'protocolVersion' field") + } + protocolVersion := _protocolVersion + + // Simple Field (userNameFlagSet) +_userNameFlagSet, _userNameFlagSetErr := readBuffer.ReadBit("userNameFlagSet") + if _userNameFlagSetErr != nil { + return nil, errors.Wrap(_userNameFlagSetErr, "Error parsing 'userNameFlagSet' field") + } + userNameFlagSet := _userNameFlagSet + + // Simple Field (passwordFlagSet) +_passwordFlagSet, _passwordFlagSetErr := readBuffer.ReadBit("passwordFlagSet") + if _passwordFlagSetErr != nil { + return nil, errors.Wrap(_passwordFlagSetErr, "Error parsing 'passwordFlagSet' field") + } + passwordFlagSet := _passwordFlagSet + + // Simple Field (willRetainFlagSet) +_willRetainFlagSet, _willRetainFlagSetErr := readBuffer.ReadBit("willRetainFlagSet") + if _willRetainFlagSetErr != nil { + return nil, errors.Wrap(_willRetainFlagSetErr, "Error parsing 'willRetainFlagSet' field") + } + willRetainFlagSet := _willRetainFlagSet + + // Simple Field (willQosLevel) +_willQosLevel, _willQosLevelErr := readBuffer.ReadUint8("willQosLevel", 2) + if _willQosLevelErr != nil { + return nil, errors.Wrap(_willQosLevelErr, "Error parsing 'willQosLevel' field") + } + willQosLevel := _willQosLevel + + // Simple Field (willFlagSet) +_willFlagSet, _willFlagSetErr := readBuffer.ReadBit("willFlagSet") + if _willFlagSetErr != nil { + return nil, errors.Wrap(_willFlagSetErr, "Error parsing 'willFlagSet' field") + } + willFlagSet := _willFlagSet + + // Simple Field (cleanStartFlagSet) +_cleanStartFlagSet, _cleanStartFlagSetErr := readBuffer.ReadBit("cleanStartFlagSet") + if _cleanStartFlagSetErr != nil { + return nil, errors.Wrap(_cleanStartFlagSetErr, "Error parsing 'cleanStartFlagSet' field") + } + cleanStartFlagSet := _cleanStartFlagSet + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadBit("reserved") + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != bool(false) { + log.Info().Fields(map[string]interface{}{ + "expected value": bool(false), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (keepAlive) +_keepAlive, _keepAliveErr := readBuffer.ReadUint16("keepAlive", 16) + if _keepAliveErr != nil { + return nil, errors.Wrap(_keepAliveErr, "Error parsing 'keepAlive' field") + } + keepAlive := _keepAlive + + // Simple Field (propertyLength) +_propertyLength, _propertyLengthErr := readBuffer.ReadUint32("propertyLength", 32) + if _propertyLengthErr != nil { + return nil, errors.Wrap(_propertyLengthErr, "Error parsing 'propertyLength' field") + } + propertyLength := _propertyLength + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := propertyLength + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + // Simple Field (clientId) + if pullErr := readBuffer.PullContext("clientId"); pullErr != nil { + return nil, pullErr + } +_clientId, _clientIdErr := MQTT_StringParse(readBuffer) + if _clientIdErr != nil { + return nil, errors.Wrap(_clientIdErr, "Error parsing 'clientId' field") + } + clientId := CastMQTT_String(_clientId) + if closeErr := readBuffer.CloseContext("clientId"); closeErr != nil { + return nil, closeErr + } + + // Optional Field (username) (Can be skipped, if a given expression evaluates to false) + var username *MQTT_String = nil + if userNameFlagSet { + currentPos := readBuffer.GetPos() + if pullErr := readBuffer.PullContext("username"); pullErr != nil { + return nil, pullErr + } +_val, _err := MQTT_StringParse(readBuffer) + switch { + case _err != nil && _err != utils.ParseAssertError: + return nil, errors.Wrap(_err, "Error parsing 'username' field") + case _err == utils.ParseAssertError: + readBuffer.SetPos(currentPos) + default: + username = CastMQTT_String(_val) + if closeErr := readBuffer.CloseContext("username"); closeErr != nil { + return nil, closeErr + } + } + } + + // Optional Field (password) (Can be skipped, if a given expression evaluates to false) + var password *MQTT_String = nil + if passwordFlagSet { + currentPos := readBuffer.GetPos() + if pullErr := readBuffer.PullContext("password"); pullErr != nil { + return nil, pullErr + } +_val, _err := MQTT_StringParse(readBuffer) + switch { + case _err != nil && _err != utils.ParseAssertError: + return nil, errors.Wrap(_err, "Error parsing 'password' field") + case _err == utils.ParseAssertError: + readBuffer.SetPos(currentPos) + default: + password = CastMQTT_String(_val) + if closeErr := readBuffer.CloseContext("password"); closeErr != nil { + return nil, closeErr + } + } + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_CONNECT"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_CONNECT{ + RemainingLength: remainingLength, + ProtocolName: CastMQTT_String(protocolName), + ProtocolVersion: protocolVersion, + UserNameFlagSet: userNameFlagSet, + PasswordFlagSet: passwordFlagSet, + WillRetainFlagSet: willRetainFlagSet, + WillQosLevel: willQosLevel, + WillFlagSet: willFlagSet, + CleanStartFlagSet: cleanStartFlagSet, + KeepAlive: keepAlive, + PropertyLength: propertyLength, + Properties: properties, + ClientId: CastMQTT_String(clientId), + Username: CastMQTT_String(username), + Password: CastMQTT_String(password), + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_CONNECT) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_CONNECT"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (protocolName) + if pushErr := writeBuffer.PushContext("protocolName"); pushErr != nil { + return pushErr + } + _protocolNameErr := m.ProtocolName.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("protocolName"); popErr != nil { + return popErr + } + if _protocolNameErr != nil { + return errors.Wrap(_protocolNameErr, "Error serializing 'protocolName' field") + } + + // Simple Field (protocolVersion) + protocolVersion := uint8(m.ProtocolVersion) + _protocolVersionErr := writeBuffer.WriteUint8("protocolVersion", 8, (protocolVersion)) + if _protocolVersionErr != nil { + return errors.Wrap(_protocolVersionErr, "Error serializing 'protocolVersion' field") + } + + // Simple Field (userNameFlagSet) + userNameFlagSet := bool(m.UserNameFlagSet) + _userNameFlagSetErr := writeBuffer.WriteBit("userNameFlagSet", (userNameFlagSet)) + if _userNameFlagSetErr != nil { + return errors.Wrap(_userNameFlagSetErr, "Error serializing 'userNameFlagSet' field") + } + + // Simple Field (passwordFlagSet) + passwordFlagSet := bool(m.PasswordFlagSet) + _passwordFlagSetErr := writeBuffer.WriteBit("passwordFlagSet", (passwordFlagSet)) + if _passwordFlagSetErr != nil { + return errors.Wrap(_passwordFlagSetErr, "Error serializing 'passwordFlagSet' field") + } + + // Simple Field (willRetainFlagSet) + willRetainFlagSet := bool(m.WillRetainFlagSet) + _willRetainFlagSetErr := writeBuffer.WriteBit("willRetainFlagSet", (willRetainFlagSet)) + if _willRetainFlagSetErr != nil { + return errors.Wrap(_willRetainFlagSetErr, "Error serializing 'willRetainFlagSet' field") + } + + // Simple Field (willQosLevel) + willQosLevel := uint8(m.WillQosLevel) + _willQosLevelErr := writeBuffer.WriteUint8("willQosLevel", 2, (willQosLevel)) + if _willQosLevelErr != nil { + return errors.Wrap(_willQosLevelErr, "Error serializing 'willQosLevel' field") + } + + // Simple Field (willFlagSet) + willFlagSet := bool(m.WillFlagSet) + _willFlagSetErr := writeBuffer.WriteBit("willFlagSet", (willFlagSet)) + if _willFlagSetErr != nil { + return errors.Wrap(_willFlagSetErr, "Error serializing 'willFlagSet' field") + } + + // Simple Field (cleanStartFlagSet) + cleanStartFlagSet := bool(m.CleanStartFlagSet) + _cleanStartFlagSetErr := writeBuffer.WriteBit("cleanStartFlagSet", (cleanStartFlagSet)) + if _cleanStartFlagSetErr != nil { + return errors.Wrap(_cleanStartFlagSetErr, "Error serializing 'cleanStartFlagSet' field") + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteBit("reserved", bool(false)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (keepAlive) + keepAlive := uint16(m.KeepAlive) + _keepAliveErr := writeBuffer.WriteUint16("keepAlive", 16, (keepAlive)) + if _keepAliveErr != nil { + return errors.Wrap(_keepAliveErr, "Error serializing 'keepAlive' field") + } + + // Simple Field (propertyLength) + propertyLength := uint32(m.PropertyLength) + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, (propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // Simple Field (clientId) + if pushErr := writeBuffer.PushContext("clientId"); pushErr != nil { + return pushErr + } + _clientIdErr := m.ClientId.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("clientId"); popErr != nil { + return popErr + } + if _clientIdErr != nil { + return errors.Wrap(_clientIdErr, "Error serializing 'clientId' field") + } + + // Optional Field (username) (Can be skipped, if the value is null) + var username *MQTT_String = nil + if m.Username != nil { + if pushErr := writeBuffer.PushContext("username"); pushErr != nil { + return pushErr + } + username = m.Username + _usernameErr := username.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("username"); popErr != nil { + return popErr + } + if _usernameErr != nil { + return errors.Wrap(_usernameErr, "Error serializing 'username' field") + } + } + + // Optional Field (password) (Can be skipped, if the value is null) + var password *MQTT_String = nil + if m.Password != nil { + if pushErr := writeBuffer.PushContext("password"); pushErr != nil { + return pushErr + } + password = m.Password + _passwordErr := password.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("password"); popErr != nil { + return popErr + } + if _passwordErr != nil { + return errors.Wrap(_passwordErr, "Error serializing 'password' field") + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_CONNECT"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_CONNECT) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_DISCONNECT.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_DISCONNECT.go new file mode 100755 index 00000000000..3d2475e0adc --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_DISCONNECT.go @@ -0,0 +1,218 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_DISCONNECT struct { + *MQTT_ControlPacket + RemainingLength uint8 + Reason MQTT_ReasonCode +} + +// The corresponding interface +type IMQTT_ControlPacket_DISCONNECT interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_DISCONNECT) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_DISCONNECT +} + + +func (m *MQTT_ControlPacket_DISCONNECT) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_DISCONNECT(remainingLength uint8, reason MQTT_ReasonCode) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_DISCONNECT{ + RemainingLength: remainingLength, + Reason: reason, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_DISCONNECT(structType interface{}) *MQTT_ControlPacket_DISCONNECT { + castFunc := func(typ interface{}) *MQTT_ControlPacket_DISCONNECT { + if casted, ok := typ.(MQTT_ControlPacket_DISCONNECT); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_DISCONNECT); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_DISCONNECT(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_DISCONNECT(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_DISCONNECT) GetTypeName() string { + return "MQTT_ControlPacket_DISCONNECT" +} + +func (m *MQTT_ControlPacket_DISCONNECT) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_DISCONNECT) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (reason) + lengthInBits += 8 + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_DISCONNECT) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_DISCONNECTParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_DISCONNECT"); pullErr != nil { + return nil, pullErr + } + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (reason) + if pullErr := readBuffer.PullContext("reason"); pullErr != nil { + return nil, pullErr + } +_reason, _reasonErr := MQTT_ReasonCodeParse(readBuffer) + if _reasonErr != nil { + return nil, errors.Wrap(_reasonErr, "Error parsing 'reason' field") + } + reason := _reason + if closeErr := readBuffer.CloseContext("reason"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_DISCONNECT"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_DISCONNECT{ + RemainingLength: remainingLength, + Reason: reason, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_DISCONNECT) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_DISCONNECT"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (reason) + if pushErr := writeBuffer.PushContext("reason"); pushErr != nil { + return pushErr + } + _reasonErr := m.Reason.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("reason"); popErr != nil { + return popErr + } + if _reasonErr != nil { + return errors.Wrap(_reasonErr, "Error serializing 'reason' field") + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_DISCONNECT"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_DISCONNECT) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PINGREQ.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PINGREQ.go new file mode 100755 index 00000000000..42bdbbb72bf --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PINGREQ.go @@ -0,0 +1,187 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_PINGREQ struct { + *MQTT_ControlPacket + RemainingLength uint8 +} + +// The corresponding interface +type IMQTT_ControlPacket_PINGREQ interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_PINGREQ) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_PINGREQ +} + + +func (m *MQTT_ControlPacket_PINGREQ) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_PINGREQ(remainingLength uint8) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_PINGREQ{ + RemainingLength: remainingLength, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_PINGREQ(structType interface{}) *MQTT_ControlPacket_PINGREQ { + castFunc := func(typ interface{}) *MQTT_ControlPacket_PINGREQ { + if casted, ok := typ.(MQTT_ControlPacket_PINGREQ); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_PINGREQ); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PINGREQ(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PINGREQ(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_PINGREQ) GetTypeName() string { + return "MQTT_ControlPacket_PINGREQ" +} + +func (m *MQTT_ControlPacket_PINGREQ) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_PINGREQ) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_PINGREQ) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_PINGREQParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_PINGREQ"); pullErr != nil { + return nil, pullErr + } + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_PINGREQ"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_PINGREQ{ + RemainingLength: remainingLength, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_PINGREQ) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_PINGREQ"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_PINGREQ"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_PINGREQ) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PINGRESP.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PINGRESP.go new file mode 100755 index 00000000000..048a539c2bd --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PINGRESP.go @@ -0,0 +1,187 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_PINGRESP struct { + *MQTT_ControlPacket + RemainingLength uint8 +} + +// The corresponding interface +type IMQTT_ControlPacket_PINGRESP interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_PINGRESP) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_PINGRESP +} + + +func (m *MQTT_ControlPacket_PINGRESP) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_PINGRESP(remainingLength uint8) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_PINGRESP{ + RemainingLength: remainingLength, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_PINGRESP(structType interface{}) *MQTT_ControlPacket_PINGRESP { + castFunc := func(typ interface{}) *MQTT_ControlPacket_PINGRESP { + if casted, ok := typ.(MQTT_ControlPacket_PINGRESP); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_PINGRESP); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PINGRESP(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PINGRESP(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_PINGRESP) GetTypeName() string { + return "MQTT_ControlPacket_PINGRESP" +} + +func (m *MQTT_ControlPacket_PINGRESP) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_PINGRESP) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_PINGRESP) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_PINGRESPParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_PINGRESP"); pullErr != nil { + return nil, pullErr + } + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_PINGRESP"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_PINGRESP{ + RemainingLength: remainingLength, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_PINGRESP) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_PINGRESP"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_PINGRESP"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_PINGRESP) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBACK.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBACK.go new file mode 100755 index 00000000000..9c425be4113 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBACK.go @@ -0,0 +1,326 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_PUBACK struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + ReasonCode *MQTT_ReasonCode + PropertyLength *uint32 + Properties []*MQTT_Property +} + +// The corresponding interface +type IMQTT_ControlPacket_PUBACK interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_PUBACK) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_PUBACK +} + + +func (m *MQTT_ControlPacket_PUBACK) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_PUBACK(remainingLength uint8, packetIdentifier uint16, reasonCode *MQTT_ReasonCode, propertyLength *uint32, properties []*MQTT_Property) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_PUBACK{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_PUBACK(structType interface{}) *MQTT_ControlPacket_PUBACK { + castFunc := func(typ interface{}) *MQTT_ControlPacket_PUBACK { + if casted, ok := typ.(MQTT_ControlPacket_PUBACK); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_PUBACK); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBACK(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBACK(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_PUBACK) GetTypeName() string { + return "MQTT_ControlPacket_PUBACK" +} + +func (m *MQTT_ControlPacket_PUBACK) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_PUBACK) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (reasonCode) + if m.ReasonCode != nil { + lengthInBits += 8 + } + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_PUBACK) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_PUBACKParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_PUBACK"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var reasonCode *MQTT_ReasonCode = nil + if bool(((remainingLength) - (curPos)) < ((3))) { + if pullErr := readBuffer.PullContext("reasonCode"); pullErr != nil { + return nil, pullErr + } + _val, _err := MQTT_ReasonCodeParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reasonCode' field") + } + reasonCode = &_val + if closeErr := readBuffer.CloseContext("reasonCode"); closeErr != nil { + return nil, closeErr + } + } + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_PUBACK"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_PUBACK{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_PUBACK) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_PUBACK"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (reasonCode) (Can be skipped, if the value is null) + var reasonCode *MQTT_ReasonCode = nil + if m.ReasonCode != nil { + if pushErr := writeBuffer.PushContext("reasonCode"); pushErr != nil { + return pushErr + } + reasonCode = m.ReasonCode + _reasonCodeErr := reasonCode.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("reasonCode"); popErr != nil { + return popErr + } + if _reasonCodeErr != nil { + return errors.Wrap(_reasonCodeErr, "Error serializing 'reasonCode' field") + } + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_PUBACK"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_PUBACK) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBCOMP.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBCOMP.go new file mode 100755 index 00000000000..690142b5465 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBCOMP.go @@ -0,0 +1,326 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_PUBCOMP struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + ReasonCode *MQTT_ReasonCode + PropertyLength *uint32 + Properties []*MQTT_Property +} + +// The corresponding interface +type IMQTT_ControlPacket_PUBCOMP interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_PUBCOMP) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_PUBCOMP +} + + +func (m *MQTT_ControlPacket_PUBCOMP) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_PUBCOMP(remainingLength uint8, packetIdentifier uint16, reasonCode *MQTT_ReasonCode, propertyLength *uint32, properties []*MQTT_Property) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_PUBCOMP{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_PUBCOMP(structType interface{}) *MQTT_ControlPacket_PUBCOMP { + castFunc := func(typ interface{}) *MQTT_ControlPacket_PUBCOMP { + if casted, ok := typ.(MQTT_ControlPacket_PUBCOMP); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_PUBCOMP); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBCOMP(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBCOMP(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_PUBCOMP) GetTypeName() string { + return "MQTT_ControlPacket_PUBCOMP" +} + +func (m *MQTT_ControlPacket_PUBCOMP) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_PUBCOMP) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (reasonCode) + if m.ReasonCode != nil { + lengthInBits += 8 + } + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_PUBCOMP) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_PUBCOMPParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_PUBCOMP"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var reasonCode *MQTT_ReasonCode = nil + if bool(((remainingLength) - (curPos)) < ((3))) { + if pullErr := readBuffer.PullContext("reasonCode"); pullErr != nil { + return nil, pullErr + } + _val, _err := MQTT_ReasonCodeParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reasonCode' field") + } + reasonCode = &_val + if closeErr := readBuffer.CloseContext("reasonCode"); closeErr != nil { + return nil, closeErr + } + } + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_PUBCOMP"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_PUBCOMP{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_PUBCOMP) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_PUBCOMP"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (reasonCode) (Can be skipped, if the value is null) + var reasonCode *MQTT_ReasonCode = nil + if m.ReasonCode != nil { + if pushErr := writeBuffer.PushContext("reasonCode"); pushErr != nil { + return pushErr + } + reasonCode = m.ReasonCode + _reasonCodeErr := reasonCode.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("reasonCode"); popErr != nil { + return popErr + } + if _reasonCodeErr != nil { + return errors.Wrap(_reasonCodeErr, "Error serializing 'reasonCode' field") + } + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_PUBCOMP"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_PUBCOMP) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBLISH.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBLISH.go new file mode 100755 index 00000000000..b81a0525139 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBLISH.go @@ -0,0 +1,392 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_PUBLISH struct { + *MQTT_ControlPacket + Dup bool + Qos MQTT_QOS + Retain bool + RemainingLength uint8 + TopicName *MQTT_String + PacketIdentifier *uint16 + PropertyLength *uint32 + Properties []*MQTT_Property + Payload []byte +} + +// The corresponding interface +type IMQTT_ControlPacket_PUBLISH interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_PUBLISH) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_PUBLISH +} + + +func (m *MQTT_ControlPacket_PUBLISH) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_PUBLISH(dup bool, qos MQTT_QOS, retain bool, remainingLength uint8, topicName *MQTT_String, packetIdentifier *uint16, propertyLength *uint32, properties []*MQTT_Property, payload []byte) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_PUBLISH{ + Dup: dup, + Qos: qos, + Retain: retain, + RemainingLength: remainingLength, + TopicName: topicName, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Payload: payload, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_PUBLISH(structType interface{}) *MQTT_ControlPacket_PUBLISH { + castFunc := func(typ interface{}) *MQTT_ControlPacket_PUBLISH { + if casted, ok := typ.(MQTT_ControlPacket_PUBLISH); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_PUBLISH); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBLISH(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBLISH(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_PUBLISH) GetTypeName() string { + return "MQTT_ControlPacket_PUBLISH" +} + +func (m *MQTT_ControlPacket_PUBLISH) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_PUBLISH) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (dup) + lengthInBits += 1; + + // Simple field (qos) + lengthInBits += 2 + + // Simple field (retain) + lengthInBits += 1; + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (topicName) + lengthInBits += m.TopicName.LengthInBits() + + // Optional Field (packetIdentifier) + if m.PacketIdentifier != nil { + lengthInBits += 16 + } + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + // Array field + if len(m.Payload) > 0 { + lengthInBits += 8 * uint16(len(m.Payload)) + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_PUBLISH) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_PUBLISHParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_PUBLISH"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Simple Field (dup) +_dup, _dupErr := readBuffer.ReadBit("dup") + if _dupErr != nil { + return nil, errors.Wrap(_dupErr, "Error parsing 'dup' field") + } + dup := _dup + + // Simple Field (qos) + if pullErr := readBuffer.PullContext("qos"); pullErr != nil { + return nil, pullErr + } +_qos, _qosErr := MQTT_QOSParse(readBuffer) + if _qosErr != nil { + return nil, errors.Wrap(_qosErr, "Error parsing 'qos' field") + } + qos := _qos + if closeErr := readBuffer.CloseContext("qos"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (retain) +_retain, _retainErr := readBuffer.ReadBit("retain") + if _retainErr != nil { + return nil, errors.Wrap(_retainErr, "Error parsing 'retain' field") + } + retain := _retain + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (topicName) + if pullErr := readBuffer.PullContext("topicName"); pullErr != nil { + return nil, pullErr + } +_topicName, _topicNameErr := MQTT_StringParse(readBuffer) + if _topicNameErr != nil { + return nil, errors.Wrap(_topicNameErr, "Error parsing 'topicName' field") + } + topicName := CastMQTT_String(_topicName) + if closeErr := readBuffer.CloseContext("topicName"); closeErr != nil { + return nil, closeErr + } + + // Optional Field (packetIdentifier) (Can be skipped, if a given expression evaluates to false) + var packetIdentifier *uint16 = nil + if bool((qos) != (MQTT_QOS_AT_MOST_ONCE)) { + _val, _err := readBuffer.ReadUint16("packetIdentifier", 16) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'packetIdentifier' field") + } + packetIdentifier = &_val + } + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + // Byte Array field (payload) + numberOfBytespayload := int(uint16(remainingLength) - uint16(curPos)) + payload, _readArrayErr := readBuffer.ReadByteArray("payload", numberOfBytespayload) + if _readArrayErr != nil { + return nil, errors.Wrap(_readArrayErr, "Error parsing 'payload' field") + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_PUBLISH"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_PUBLISH{ + Dup: dup, + Qos: qos, + Retain: retain, + RemainingLength: remainingLength, + TopicName: CastMQTT_String(topicName), + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Payload: payload, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_PUBLISH) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_PUBLISH"); pushErr != nil { + return pushErr + } + + // Simple Field (dup) + dup := bool(m.Dup) + _dupErr := writeBuffer.WriteBit("dup", (dup)) + if _dupErr != nil { + return errors.Wrap(_dupErr, "Error serializing 'dup' field") + } + + // Simple Field (qos) + if pushErr := writeBuffer.PushContext("qos"); pushErr != nil { + return pushErr + } + _qosErr := m.Qos.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("qos"); popErr != nil { + return popErr + } + if _qosErr != nil { + return errors.Wrap(_qosErr, "Error serializing 'qos' field") + } + + // Simple Field (retain) + retain := bool(m.Retain) + _retainErr := writeBuffer.WriteBit("retain", (retain)) + if _retainErr != nil { + return errors.Wrap(_retainErr, "Error serializing 'retain' field") + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (topicName) + if pushErr := writeBuffer.PushContext("topicName"); pushErr != nil { + return pushErr + } + _topicNameErr := m.TopicName.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("topicName"); popErr != nil { + return popErr + } + if _topicNameErr != nil { + return errors.Wrap(_topicNameErr, "Error serializing 'topicName' field") + } + + // Optional Field (packetIdentifier) (Can be skipped, if the value is null) + var packetIdentifier *uint16 = nil + if m.PacketIdentifier != nil { + packetIdentifier = m.PacketIdentifier + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, *(packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // Array Field (payload) + if m.Payload != nil { + // Byte Array field (payload) + _writeArrayErr := writeBuffer.WriteByteArray("payload", m.Payload) + if _writeArrayErr != nil { + return errors.Wrap(_writeArrayErr, "Error serializing 'payload' field") + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_PUBLISH"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_PUBLISH) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBREC.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBREC.go new file mode 100755 index 00000000000..58ef0c785bc --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBREC.go @@ -0,0 +1,326 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_PUBREC struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + ReasonCode *MQTT_ReasonCode + PropertyLength *uint32 + Properties []*MQTT_Property +} + +// The corresponding interface +type IMQTT_ControlPacket_PUBREC interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_PUBREC) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_PUBREC +} + + +func (m *MQTT_ControlPacket_PUBREC) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_PUBREC(remainingLength uint8, packetIdentifier uint16, reasonCode *MQTT_ReasonCode, propertyLength *uint32, properties []*MQTT_Property) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_PUBREC{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_PUBREC(structType interface{}) *MQTT_ControlPacket_PUBREC { + castFunc := func(typ interface{}) *MQTT_ControlPacket_PUBREC { + if casted, ok := typ.(MQTT_ControlPacket_PUBREC); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_PUBREC); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBREC(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBREC(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_PUBREC) GetTypeName() string { + return "MQTT_ControlPacket_PUBREC" +} + +func (m *MQTT_ControlPacket_PUBREC) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_PUBREC) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (reasonCode) + if m.ReasonCode != nil { + lengthInBits += 8 + } + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_PUBREC) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_PUBRECParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_PUBREC"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var reasonCode *MQTT_ReasonCode = nil + if bool(((remainingLength) - (curPos)) < ((3))) { + if pullErr := readBuffer.PullContext("reasonCode"); pullErr != nil { + return nil, pullErr + } + _val, _err := MQTT_ReasonCodeParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reasonCode' field") + } + reasonCode = &_val + if closeErr := readBuffer.CloseContext("reasonCode"); closeErr != nil { + return nil, closeErr + } + } + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_PUBREC"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_PUBREC{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_PUBREC) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_PUBREC"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (reasonCode) (Can be skipped, if the value is null) + var reasonCode *MQTT_ReasonCode = nil + if m.ReasonCode != nil { + if pushErr := writeBuffer.PushContext("reasonCode"); pushErr != nil { + return pushErr + } + reasonCode = m.ReasonCode + _reasonCodeErr := reasonCode.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("reasonCode"); popErr != nil { + return popErr + } + if _reasonCodeErr != nil { + return errors.Wrap(_reasonCodeErr, "Error serializing 'reasonCode' field") + } + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_PUBREC"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_PUBREC) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBREL.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBREL.go new file mode 100755 index 00000000000..ed1ea74f9bf --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_PUBREL.go @@ -0,0 +1,326 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_PUBREL struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + ReasonCode *MQTT_ReasonCode + PropertyLength *uint32 + Properties []*MQTT_Property +} + +// The corresponding interface +type IMQTT_ControlPacket_PUBREL interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_PUBREL) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_PUBREL +} + + +func (m *MQTT_ControlPacket_PUBREL) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_PUBREL(remainingLength uint8, packetIdentifier uint16, reasonCode *MQTT_ReasonCode, propertyLength *uint32, properties []*MQTT_Property) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_PUBREL{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_PUBREL(structType interface{}) *MQTT_ControlPacket_PUBREL { + castFunc := func(typ interface{}) *MQTT_ControlPacket_PUBREL { + if casted, ok := typ.(MQTT_ControlPacket_PUBREL); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_PUBREL); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBREL(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_PUBREL(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_PUBREL) GetTypeName() string { + return "MQTT_ControlPacket_PUBREL" +} + +func (m *MQTT_ControlPacket_PUBREL) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_PUBREL) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (reasonCode) + if m.ReasonCode != nil { + lengthInBits += 8 + } + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_PUBREL) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_PUBRELParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_PUBREL"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (reasonCode) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var reasonCode *MQTT_ReasonCode = nil + if bool(((remainingLength) - (curPos)) < ((3))) { + if pullErr := readBuffer.PullContext("reasonCode"); pullErr != nil { + return nil, pullErr + } + _val, _err := MQTT_ReasonCodeParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reasonCode' field") + } + reasonCode = &_val + if closeErr := readBuffer.CloseContext("reasonCode"); closeErr != nil { + return nil, closeErr + } + } + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_PUBREL"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_PUBREL{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + ReasonCode: reasonCode, + PropertyLength: propertyLength, + Properties: properties, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_PUBREL) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_PUBREL"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (reasonCode) (Can be skipped, if the value is null) + var reasonCode *MQTT_ReasonCode = nil + if m.ReasonCode != nil { + if pushErr := writeBuffer.PushContext("reasonCode"); pushErr != nil { + return pushErr + } + reasonCode = m.ReasonCode + _reasonCodeErr := reasonCode.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("reasonCode"); popErr != nil { + return popErr + } + if _reasonCodeErr != nil { + return errors.Wrap(_reasonCodeErr, "Error serializing 'reasonCode' field") + } + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_PUBREL"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_PUBREL) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_SUBACK.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_SUBACK.go new file mode 100755 index 00000000000..4f5b684a152 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_SUBACK.go @@ -0,0 +1,332 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_SUBACK struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + PropertyLength *uint32 + Properties []*MQTT_Property + Results []MQTT_ReasonCode +} + +// The corresponding interface +type IMQTT_ControlPacket_SUBACK interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_SUBACK) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_SUBACK +} + + +func (m *MQTT_ControlPacket_SUBACK) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_SUBACK(remainingLength uint8, packetIdentifier uint16, propertyLength *uint32, properties []*MQTT_Property, results []MQTT_ReasonCode) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_SUBACK{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Results: results, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_SUBACK(structType interface{}) *MQTT_ControlPacket_SUBACK { + castFunc := func(typ interface{}) *MQTT_ControlPacket_SUBACK { + if casted, ok := typ.(MQTT_ControlPacket_SUBACK); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_SUBACK); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_SUBACK(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_SUBACK(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_SUBACK) GetTypeName() string { + return "MQTT_ControlPacket_SUBACK" +} + +func (m *MQTT_ControlPacket_SUBACK) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_SUBACK) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + // Array field + if len(m.Results) > 0 { + for i, element := range m.Results { + last := i == len(m.Results) -1 + lengthInBits += element.LengthInBitsConditional(last) + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_SUBACK) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_SUBACKParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_SUBACK"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + // Array field (results) + if pullErr := readBuffer.PullContext("results", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + curPos = readBuffer.GetPos() - startPos + // Count array + results := make([]*MQTT_ReasonCode, uint16(remainingLength) - uint16(curPos)) + { + for curItem := uint16(0); curItem < uint16(uint16(remainingLength) - uint16(curPos)); curItem++ { + _item, _err := MQTT_ReasonCodeParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'results' field") + } + results[curItem] = _item + } + } + if closeErr := readBuffer.CloseContext("results", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_SUBACK"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_SUBACK{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Results: results, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_SUBACK) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_SUBACK"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // Array Field (results) + if m.Results != nil { + if pushErr := writeBuffer.PushContext("results", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Results { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'results' field") + } + } + if popErr := writeBuffer.PopContext("results", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_SUBACK"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_SUBACK) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_SUBSCRIBE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_SUBSCRIBE.go new file mode 100755 index 00000000000..5749c58ea55 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_SUBSCRIBE.go @@ -0,0 +1,332 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_SUBSCRIBE struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + PropertyLength *uint32 + Properties []*MQTT_Property + Filters []*Filter +} + +// The corresponding interface +type IMQTT_ControlPacket_SUBSCRIBE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_SUBSCRIBE) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_SUBSCRIBE +} + + +func (m *MQTT_ControlPacket_SUBSCRIBE) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_SUBSCRIBE(remainingLength uint8, packetIdentifier uint16, propertyLength *uint32, properties []*MQTT_Property, filters []*Filter) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_SUBSCRIBE{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Filters: filters, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_SUBSCRIBE(structType interface{}) *MQTT_ControlPacket_SUBSCRIBE { + castFunc := func(typ interface{}) *MQTT_ControlPacket_SUBSCRIBE { + if casted, ok := typ.(MQTT_ControlPacket_SUBSCRIBE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_SUBSCRIBE); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_SUBSCRIBE(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_SUBSCRIBE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_SUBSCRIBE) GetTypeName() string { + return "MQTT_ControlPacket_SUBSCRIBE" +} + +func (m *MQTT_ControlPacket_SUBSCRIBE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_SUBSCRIBE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + // Array field + if len(m.Filters) > 0 { + for i, element := range m.Filters { + last := i == len(m.Filters) -1 + lengthInBits += element.LengthInBitsConditional(last) + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_SUBSCRIBE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_SUBSCRIBEParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_SUBSCRIBE"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + // Array field (filters) + if pullErr := readBuffer.PullContext("filters", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + curPos = readBuffer.GetPos() - startPos + // Count array + filters := make([]*Filter, uint16(remainingLength) - uint16(curPos)) + { + for curItem := uint16(0); curItem < uint16(uint16(remainingLength) - uint16(curPos)); curItem++ { + _item, _err := FilterParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'filters' field") + } + filters[curItem] = _item + } + } + if closeErr := readBuffer.CloseContext("filters", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_SUBSCRIBE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_SUBSCRIBE{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Filters: filters, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_SUBSCRIBE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_SUBSCRIBE"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // Array Field (filters) + if m.Filters != nil { + if pushErr := writeBuffer.PushContext("filters", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Filters { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'filters' field") + } + } + if popErr := writeBuffer.PopContext("filters", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_SUBSCRIBE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_SUBSCRIBE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBACK.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBACK.go new file mode 100755 index 00000000000..a1a85be9951 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBACK.go @@ -0,0 +1,332 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_UNSUBACK struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + PropertyLength *uint32 + Properties []*MQTT_Property + Results []MQTT_ReasonCode +} + +// The corresponding interface +type IMQTT_ControlPacket_UNSUBACK interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_UNSUBACK) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_UNSUBACK +} + + +func (m *MQTT_ControlPacket_UNSUBACK) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_UNSUBACK(remainingLength uint8, packetIdentifier uint16, propertyLength *uint32, properties []*MQTT_Property, results []MQTT_ReasonCode) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_UNSUBACK{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Results: results, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_UNSUBACK(structType interface{}) *MQTT_ControlPacket_UNSUBACK { + castFunc := func(typ interface{}) *MQTT_ControlPacket_UNSUBACK { + if casted, ok := typ.(MQTT_ControlPacket_UNSUBACK); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_UNSUBACK); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_UNSUBACK(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_UNSUBACK(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_UNSUBACK) GetTypeName() string { + return "MQTT_ControlPacket_UNSUBACK" +} + +func (m *MQTT_ControlPacket_UNSUBACK) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_UNSUBACK) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + // Array field + if len(m.Results) > 0 { + for i, element := range m.Results { + last := i == len(m.Results) -1 + lengthInBits += element.LengthInBitsConditional(last) + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_UNSUBACK) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_UNSUBACKParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_UNSUBACK"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + // Array field (results) + if pullErr := readBuffer.PullContext("results", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + curPos = readBuffer.GetPos() - startPos + // Count array + results := make([]*MQTT_ReasonCode, uint16(remainingLength) - uint16(curPos)) + { + for curItem := uint16(0); curItem < uint16(uint16(remainingLength) - uint16(curPos)); curItem++ { + _item, _err := MQTT_ReasonCodeParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'results' field") + } + results[curItem] = _item + } + } + if closeErr := readBuffer.CloseContext("results", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_UNSUBACK"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_UNSUBACK{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Results: results, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_UNSUBACK) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_UNSUBACK"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // Array Field (results) + if m.Results != nil { + if pushErr := writeBuffer.PushContext("results", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Results { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'results' field") + } + } + if popErr := writeBuffer.PopContext("results", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_UNSUBACK"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_UNSUBACK) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBSCRIBE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBSCRIBE.go new file mode 100755 index 00000000000..19a71a48c09 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ControlPacket_UNSUBSCRIBE.go @@ -0,0 +1,332 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_ControlPacket_UNSUBSCRIBE struct { + *MQTT_ControlPacket + RemainingLength uint8 + PacketIdentifier uint16 + PropertyLength *uint32 + Properties []*MQTT_Property + Filters []*MQTT_String +} + +// The corresponding interface +type IMQTT_ControlPacket_UNSUBSCRIBE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// +func (m *MQTT_ControlPacket_UNSUBSCRIBE) PacketType() MQTT_ControlPacketType { + return MQTT_ControlPacketType_UNSUBSCRIBE +} + + +func (m *MQTT_ControlPacket_UNSUBSCRIBE) InitializeParent(parent *MQTT_ControlPacket) { +} + +func NewMQTT_ControlPacket_UNSUBSCRIBE(remainingLength uint8, packetIdentifier uint16, propertyLength *uint32, properties []*MQTT_Property, filters []*MQTT_String) *MQTT_ControlPacket { + child := &MQTT_ControlPacket_UNSUBSCRIBE{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Filters: filters, + MQTT_ControlPacket: NewMQTT_ControlPacket(), + } + child.Child = child + return child.MQTT_ControlPacket +} + +func CastMQTT_ControlPacket_UNSUBSCRIBE(structType interface{}) *MQTT_ControlPacket_UNSUBSCRIBE { + castFunc := func(typ interface{}) *MQTT_ControlPacket_UNSUBSCRIBE { + if casted, ok := typ.(MQTT_ControlPacket_UNSUBSCRIBE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_ControlPacket_UNSUBSCRIBE); ok { + return casted + } + if casted, ok := typ.(MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_UNSUBSCRIBE(casted.Child) + } + if casted, ok := typ.(*MQTT_ControlPacket); ok { + return CastMQTT_ControlPacket_UNSUBSCRIBE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_ControlPacket_UNSUBSCRIBE) GetTypeName() string { + return "MQTT_ControlPacket_UNSUBSCRIBE" +} + +func (m *MQTT_ControlPacket_UNSUBSCRIBE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_ControlPacket_UNSUBSCRIBE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Reserved Field (reserved) + lengthInBits += 4 + + // Simple field (remainingLength) + lengthInBits += 8; + + // Simple field (packetIdentifier) + lengthInBits += 16; + + // Optional Field (propertyLength) + if m.PropertyLength != nil { + lengthInBits += 32 + } + + // Array field + if len(m.Properties) > 0 { + for _, element := range m.Properties { + lengthInBits += element.LengthInBits() + } + } + + // Array field + if len(m.Filters) > 0 { + for i, element := range m.Filters { + last := i == len(m.Filters) -1 + lengthInBits += element.LengthInBitsConditional(last) + } + } + + return lengthInBits +} + + +func (m *MQTT_ControlPacket_UNSUBSCRIBE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ControlPacket_UNSUBSCRIBEParse(readBuffer utils.ReadBuffer) (*MQTT_ControlPacket, error) { + if pullErr := readBuffer.PullContext("MQTT_ControlPacket_UNSUBSCRIBE"); pullErr != nil { + return nil, pullErr + } + var startPos = readBuffer.GetPos() + var curPos uint16 + + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 4) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x0) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x0), + "got value": reserved, + }).Msg("Got unexpected response.") + } + } + + // Simple Field (remainingLength) +_remainingLength, _remainingLengthErr := readBuffer.ReadUint8("remainingLength", 8) + if _remainingLengthErr != nil { + return nil, errors.Wrap(_remainingLengthErr, "Error parsing 'remainingLength' field") + } + remainingLength := _remainingLength + + // Simple Field (packetIdentifier) +_packetIdentifier, _packetIdentifierErr := readBuffer.ReadUint16("packetIdentifier", 16) + if _packetIdentifierErr != nil { + return nil, errors.Wrap(_packetIdentifierErr, "Error parsing 'packetIdentifier' field") + } + packetIdentifier := _packetIdentifier + + // Optional Field (propertyLength) (Can be skipped, if a given expression evaluates to false) + curPos = readBuffer.GetPos() - startPos + var propertyLength *uint32 = nil + if bool(((remainingLength) - (curPos)) < ((4))) { + _val, _err := readBuffer.ReadUint32("propertyLength", 32) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'propertyLength' field") + } + propertyLength = &_val + } + + // Array field (properties) + if pullErr := readBuffer.PullContext("properties", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Length array + properties := make([]*MQTT_Property, 0) + { + _propertiesLength := utils.InlineIf(bool(bool(((propertyLength)) != (nil))), func() interface{} {return uint16((*propertyLength))}, func() interface{} {return uint16(uint16(0))}).(uint16) + _propertiesEndPos := readBuffer.GetPos() + uint16(_propertiesLength) + for ;readBuffer.GetPos() < _propertiesEndPos; { + _item, _err := MQTT_PropertyParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'properties' field") + } + properties = append(properties, _item) + } + } + if closeErr := readBuffer.CloseContext("properties", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + // Array field (filters) + if pullErr := readBuffer.PullContext("filters", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + curPos = readBuffer.GetPos() - startPos + // Count array + filters := make([]*MQTT_String, uint16(remainingLength) - uint16(curPos)) + { + for curItem := uint16(0); curItem < uint16(uint16(remainingLength) - uint16(curPos)); curItem++ { + _item, _err := MQTT_StringParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'filters' field") + } + filters[curItem] = _item + } + } + if closeErr := readBuffer.CloseContext("filters", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_ControlPacket_UNSUBSCRIBE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_ControlPacket_UNSUBSCRIBE{ + RemainingLength: remainingLength, + PacketIdentifier: packetIdentifier, + PropertyLength: propertyLength, + Properties: properties, + Filters: filters, + MQTT_ControlPacket: &MQTT_ControlPacket{}, + } + _child.MQTT_ControlPacket.Child = _child + return _child.MQTT_ControlPacket, nil +} + +func (m *MQTT_ControlPacket_UNSUBSCRIBE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_ControlPacket_UNSUBSCRIBE"); pushErr != nil { + return pushErr + } + + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 4, uint8(0x0)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (remainingLength) + remainingLength := uint8(m.RemainingLength) + _remainingLengthErr := writeBuffer.WriteUint8("remainingLength", 8, (remainingLength)) + if _remainingLengthErr != nil { + return errors.Wrap(_remainingLengthErr, "Error serializing 'remainingLength' field") + } + + // Simple Field (packetIdentifier) + packetIdentifier := uint16(m.PacketIdentifier) + _packetIdentifierErr := writeBuffer.WriteUint16("packetIdentifier", 16, (packetIdentifier)) + if _packetIdentifierErr != nil { + return errors.Wrap(_packetIdentifierErr, "Error serializing 'packetIdentifier' field") + } + + // Optional Field (propertyLength) (Can be skipped, if the value is null) + var propertyLength *uint32 = nil + if m.PropertyLength != nil { + propertyLength = m.PropertyLength + _propertyLengthErr := writeBuffer.WriteUint32("propertyLength", 32, *(propertyLength)) + if _propertyLengthErr != nil { + return errors.Wrap(_propertyLengthErr, "Error serializing 'propertyLength' field") + } + } + + // Array Field (properties) + if m.Properties != nil { + if pushErr := writeBuffer.PushContext("properties", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Properties { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'properties' field") + } + } + if popErr := writeBuffer.PopContext("properties", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // Array Field (filters) + if m.Filters != nil { + if pushErr := writeBuffer.PushContext("filters", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.Filters { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'filters' field") + } + } + if popErr := writeBuffer.PopContext("filters", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("MQTT_ControlPacket_UNSUBSCRIBE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_ControlPacket_UNSUBSCRIBE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property.go new file mode 100755 index 00000000000..1b5e6d85cf9 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property.go @@ -0,0 +1,233 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property struct { + PropertyType MQTT_PropertyType + Child IMQTT_PropertyChild +} + +// The corresponding interface +type IMQTT_Property interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +type IMQTT_PropertyParent interface { + SerializeParent(writeBuffer utils.WriteBuffer, child IMQTT_Property, serializeChildFunction func() error) error + GetTypeName() string +} + +type IMQTT_PropertyChild interface { + Serialize(writeBuffer utils.WriteBuffer) error + InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) + GetTypeName() string + IMQTT_Property +} + +func NewMQTT_Property(propertyType MQTT_PropertyType) *MQTT_Property { + return &MQTT_Property{PropertyType: propertyType} +} + +func CastMQTT_Property(structType interface{}) *MQTT_Property { + castFunc := func(typ interface{}) *MQTT_Property { + if casted, ok := typ.(MQTT_Property); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property); ok { + return casted + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property) GetTypeName() string { + return "MQTT_Property" +} + +func (m *MQTT_Property) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property) LengthInBitsConditional(lastItem bool) uint16 { + return m.Child.LengthInBits() +} + +func (m *MQTT_Property) ParentLengthInBits() uint16 { + lengthInBits := uint16(0) + + // Simple field (propertyType) + lengthInBits += 8 + + return lengthInBits +} + +func (m *MQTT_Property) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_PropertyParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (propertyType) + if pullErr := readBuffer.PullContext("propertyType"); pullErr != nil { + return nil, pullErr + } +_propertyType, _propertyTypeErr := MQTT_PropertyTypeParse(readBuffer) + if _propertyTypeErr != nil { + return nil, errors.Wrap(_propertyTypeErr, "Error parsing 'propertyType' field") + } + propertyType := _propertyType + if closeErr := readBuffer.CloseContext("propertyType"); closeErr != nil { + return nil, closeErr + } + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + var _parent *MQTT_Property + var typeSwitchError error + switch { +case propertyType == MQTT_PropertyType_PAYLOAD_FORMAT_INDICATOR : // MQTT_Property_PAYLOAD_FORMAT_INDICATOR + _parent, typeSwitchError = MQTT_Property_PAYLOAD_FORMAT_INDICATORParse(readBuffer, ) +case propertyType == MQTT_PropertyType_MESSAGE_EXPIRY_INTERVAL : // MQTT_Property_MESSAGE_EXPIRY_INTERVAL + _parent, typeSwitchError = MQTT_Property_MESSAGE_EXPIRY_INTERVALParse(readBuffer, ) +case propertyType == MQTT_PropertyType_CONTENT_TYPE : // MQTT_Property_CONTENT_TYPE + _parent, typeSwitchError = MQTT_Property_CONTENT_TYPEParse(readBuffer, ) +case propertyType == MQTT_PropertyType_RESPONSE_TOPIC : // MQTT_Property_RESPONSE_TOPIC + _parent, typeSwitchError = MQTT_Property_RESPONSE_TOPICParse(readBuffer, ) +case propertyType == MQTT_PropertyType_CORRELATION_DATA : // MQTT_Property_CORRELATION_DATA + _parent, typeSwitchError = MQTT_Property_CORRELATION_DATAParse(readBuffer, ) +case propertyType == MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER : // MQTT_Property_SUBSCRIPTION_IDENTIFIER + _parent, typeSwitchError = MQTT_Property_SUBSCRIPTION_IDENTIFIERParse(readBuffer, ) +case propertyType == MQTT_PropertyType_SESSION_EXPIRY_INTERVAL : // MQTT_Property_EXPIRY_INTERVAL + _parent, typeSwitchError = MQTT_Property_EXPIRY_INTERVALParse(readBuffer, ) +case propertyType == MQTT_PropertyType_ASSIGNED_CLIENT_IDENTIFIER : // MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER + _parent, typeSwitchError = MQTT_Property_ASSIGNED_CLIENT_IDENTIFIERParse(readBuffer, ) +case propertyType == MQTT_PropertyType_SERVER_KEEP_ALIVE : // MQTT_Property_SERVER_KEEP_ALIVE + _parent, typeSwitchError = MQTT_Property_SERVER_KEEP_ALIVEParse(readBuffer, ) +case propertyType == MQTT_PropertyType_AUTHENTICATION_METHOD : // MQTT_Property_AUTHENTICATION_METHOD + _parent, typeSwitchError = MQTT_Property_AUTHENTICATION_METHODParse(readBuffer, ) +case propertyType == MQTT_PropertyType_AUTHENTICATION_DATA : // MQTT_Property_AUTHENTICATION_DATA + _parent, typeSwitchError = MQTT_Property_AUTHENTICATION_DATAParse(readBuffer, ) +case propertyType == MQTT_PropertyType_REQUEST_PROBLEM_INFORMATION : // MQTT_Property_REQUEST_PROBLEM_INFORMATION + _parent, typeSwitchError = MQTT_Property_REQUEST_PROBLEM_INFORMATIONParse(readBuffer, ) +case propertyType == MQTT_PropertyType_WILL_DELAY_INTERVAL : // MQTT_Property_WILL_DELAY_INTERVAL + _parent, typeSwitchError = MQTT_Property_WILL_DELAY_INTERVALParse(readBuffer, ) +case propertyType == MQTT_PropertyType_REQUEST_RESPONSE_INFORMATION : // MQTT_Property_REQUEST_RESPONSE_INFORMATION + _parent, typeSwitchError = MQTT_Property_REQUEST_RESPONSE_INFORMATIONParse(readBuffer, ) +case propertyType == MQTT_PropertyType_RESPONSE_INFORMATION : // MQTT_Property_RESPONSE_INFORMATION + _parent, typeSwitchError = MQTT_Property_RESPONSE_INFORMATIONParse(readBuffer, ) +case propertyType == MQTT_PropertyType_SERVER_REFERENCE : // MQTT_Property_SERVER_REFERENCE + _parent, typeSwitchError = MQTT_Property_SERVER_REFERENCEParse(readBuffer, ) +case propertyType == MQTT_PropertyType_REASON_STRING : // MQTT_Property_REASON_STRING + _parent, typeSwitchError = MQTT_Property_REASON_STRINGParse(readBuffer, ) +case propertyType == MQTT_PropertyType_RECEIVE_MAXIMUM : // MQTT_Property_RECEIVE_MAXIMUM + _parent, typeSwitchError = MQTT_Property_RECEIVE_MAXIMUMParse(readBuffer, ) +case propertyType == MQTT_PropertyType_TOPIC_ALIAS_MAXIMUM : // MQTT_Property_TOPIC_ALIAS_MAXIMUM + _parent, typeSwitchError = MQTT_Property_TOPIC_ALIAS_MAXIMUMParse(readBuffer, ) +case propertyType == MQTT_PropertyType_TOPIC_ALIAS : // MQTT_Property_TOPIC_ALIAS + _parent, typeSwitchError = MQTT_Property_TOPIC_ALIASParse(readBuffer, ) +case propertyType == MQTT_PropertyType_MAXIMUM_QOS : // MQTT_Property_MAXIMUM_QOS + _parent, typeSwitchError = MQTT_Property_MAXIMUM_QOSParse(readBuffer, ) +case propertyType == MQTT_PropertyType_RETAIN_AVAILABLE : // MQTT_Property_RETAIN_AVAILABLE + _parent, typeSwitchError = MQTT_Property_RETAIN_AVAILABLEParse(readBuffer, ) +case propertyType == MQTT_PropertyType_USER_PROPERTY : // MQTT_Property_USER_PROPERTY + _parent, typeSwitchError = MQTT_Property_USER_PROPERTYParse(readBuffer, ) +case propertyType == MQTT_PropertyType_MAXIMUM_PACKET_SIZE : // MQTT_Property_MAXIMUM_PACKET_SIZE + _parent, typeSwitchError = MQTT_Property_MAXIMUM_PACKET_SIZEParse(readBuffer, ) +case propertyType == MQTT_PropertyType_WILDCARD_SUBSCRIPTION_AVAILABLE : // MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE + _parent, typeSwitchError = MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLEParse(readBuffer, ) +case propertyType == MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER_AVAILABLE : // MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE + _parent, typeSwitchError = MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLEParse(readBuffer, ) +case propertyType == MQTT_PropertyType_SHARED_SUBSCRIPTION_AVAILABLE : // MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE + _parent, typeSwitchError = MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLEParse(readBuffer, ) + default: + // TODO: return actual type + typeSwitchError = errors.New("Unmapped type") + } + if typeSwitchError != nil { + return nil, errors.Wrap(typeSwitchError, "Error parsing sub-type for type-switch.") + } + + if closeErr := readBuffer.CloseContext("MQTT_Property"); closeErr != nil { + return nil, closeErr + } + + // Finish initializing + _parent.Child.InitializeParent(_parent, propertyType) + return _parent, nil +} + +func (m *MQTT_Property) Serialize(writeBuffer utils.WriteBuffer) error { + return m.Child.Serialize(writeBuffer) +} + +func (m *MQTT_Property) SerializeParent(writeBuffer utils.WriteBuffer, child IMQTT_Property, serializeChildFunction func() error) error { + if pushErr :=writeBuffer.PushContext("MQTT_Property"); pushErr != nil { + return pushErr + } + + // Simple Field (propertyType) + if pushErr := writeBuffer.PushContext("propertyType"); pushErr != nil { + return pushErr + } + _propertyTypeErr := m.PropertyType.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("propertyType"); popErr != nil { + return popErr + } + if _propertyTypeErr != nil { + return errors.Wrap(_propertyTypeErr, "Error serializing 'propertyType' field") + } + + // Switch field (Depending on the discriminator values, passes the serialization to a sub-type) + if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil { + return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property"); popErr != nil { + return popErr + } + return nil +} + +func (m *MQTT_Property) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_PropertyType.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_PropertyType.go new file mode 100755 index 00000000000..15435e3caca --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_PropertyType.go @@ -0,0 +1,313 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +type MQTT_PropertyType uint8 + +type IMQTT_PropertyType interface { + Serialize(writeBuffer utils.WriteBuffer) error +} + +const( + MQTT_PropertyType_PAYLOAD_FORMAT_INDICATOR MQTT_PropertyType = 0x01 + MQTT_PropertyType_MESSAGE_EXPIRY_INTERVAL MQTT_PropertyType = 0x02 + MQTT_PropertyType_CONTENT_TYPE MQTT_PropertyType = 0x03 + MQTT_PropertyType_RESPONSE_TOPIC MQTT_PropertyType = 0x08 + MQTT_PropertyType_CORRELATION_DATA MQTT_PropertyType = 0x09 + MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER MQTT_PropertyType = 0x0B + MQTT_PropertyType_SESSION_EXPIRY_INTERVAL MQTT_PropertyType = 0x11 + MQTT_PropertyType_ASSIGNED_CLIENT_IDENTIFIER MQTT_PropertyType = 0x12 + MQTT_PropertyType_SERVER_KEEP_ALIVE MQTT_PropertyType = 0x13 + MQTT_PropertyType_AUTHENTICATION_METHOD MQTT_PropertyType = 0x15 + MQTT_PropertyType_AUTHENTICATION_DATA MQTT_PropertyType = 0x16 + MQTT_PropertyType_REQUEST_PROBLEM_INFORMATION MQTT_PropertyType = 0x17 + MQTT_PropertyType_WILL_DELAY_INTERVAL MQTT_PropertyType = 0x18 + MQTT_PropertyType_REQUEST_RESPONSE_INFORMATION MQTT_PropertyType = 0x19 + MQTT_PropertyType_RESPONSE_INFORMATION MQTT_PropertyType = 0x1A + MQTT_PropertyType_SERVER_REFERENCE MQTT_PropertyType = 0x1C + MQTT_PropertyType_REASON_STRING MQTT_PropertyType = 0x1F + MQTT_PropertyType_RECEIVE_MAXIMUM MQTT_PropertyType = 0x21 + MQTT_PropertyType_TOPIC_ALIAS_MAXIMUM MQTT_PropertyType = 0x22 + MQTT_PropertyType_TOPIC_ALIAS MQTT_PropertyType = 0x23 + MQTT_PropertyType_MAXIMUM_QOS MQTT_PropertyType = 0x24 + MQTT_PropertyType_RETAIN_AVAILABLE MQTT_PropertyType = 0x25 + MQTT_PropertyType_USER_PROPERTY MQTT_PropertyType = 0x26 + MQTT_PropertyType_MAXIMUM_PACKET_SIZE MQTT_PropertyType = 0x27 + MQTT_PropertyType_WILDCARD_SUBSCRIPTION_AVAILABLE MQTT_PropertyType = 0x28 + MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER_AVAILABLE MQTT_PropertyType = 0x29 + MQTT_PropertyType_SHARED_SUBSCRIPTION_AVAILABLE MQTT_PropertyType = 0x2A +) + +var MQTT_PropertyTypeValues []MQTT_PropertyType + +func init() { + _ = errors.New + MQTT_PropertyTypeValues = []MQTT_PropertyType { + MQTT_PropertyType_PAYLOAD_FORMAT_INDICATOR, + MQTT_PropertyType_MESSAGE_EXPIRY_INTERVAL, + MQTT_PropertyType_CONTENT_TYPE, + MQTT_PropertyType_RESPONSE_TOPIC, + MQTT_PropertyType_CORRELATION_DATA, + MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER, + MQTT_PropertyType_SESSION_EXPIRY_INTERVAL, + MQTT_PropertyType_ASSIGNED_CLIENT_IDENTIFIER, + MQTT_PropertyType_SERVER_KEEP_ALIVE, + MQTT_PropertyType_AUTHENTICATION_METHOD, + MQTT_PropertyType_AUTHENTICATION_DATA, + MQTT_PropertyType_REQUEST_PROBLEM_INFORMATION, + MQTT_PropertyType_WILL_DELAY_INTERVAL, + MQTT_PropertyType_REQUEST_RESPONSE_INFORMATION, + MQTT_PropertyType_RESPONSE_INFORMATION, + MQTT_PropertyType_SERVER_REFERENCE, + MQTT_PropertyType_REASON_STRING, + MQTT_PropertyType_RECEIVE_MAXIMUM, + MQTT_PropertyType_TOPIC_ALIAS_MAXIMUM, + MQTT_PropertyType_TOPIC_ALIAS, + MQTT_PropertyType_MAXIMUM_QOS, + MQTT_PropertyType_RETAIN_AVAILABLE, + MQTT_PropertyType_USER_PROPERTY, + MQTT_PropertyType_MAXIMUM_PACKET_SIZE, + MQTT_PropertyType_WILDCARD_SUBSCRIPTION_AVAILABLE, + MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER_AVAILABLE, + MQTT_PropertyType_SHARED_SUBSCRIPTION_AVAILABLE, + } +} + +func MQTT_PropertyTypeByValue(value uint8) MQTT_PropertyType { + switch value { + case 0x01: + return MQTT_PropertyType_PAYLOAD_FORMAT_INDICATOR + case 0x02: + return MQTT_PropertyType_MESSAGE_EXPIRY_INTERVAL + case 0x03: + return MQTT_PropertyType_CONTENT_TYPE + case 0x08: + return MQTT_PropertyType_RESPONSE_TOPIC + case 0x09: + return MQTT_PropertyType_CORRELATION_DATA + case 0x0B: + return MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER + case 0x11: + return MQTT_PropertyType_SESSION_EXPIRY_INTERVAL + case 0x12: + return MQTT_PropertyType_ASSIGNED_CLIENT_IDENTIFIER + case 0x13: + return MQTT_PropertyType_SERVER_KEEP_ALIVE + case 0x15: + return MQTT_PropertyType_AUTHENTICATION_METHOD + case 0x16: + return MQTT_PropertyType_AUTHENTICATION_DATA + case 0x17: + return MQTT_PropertyType_REQUEST_PROBLEM_INFORMATION + case 0x18: + return MQTT_PropertyType_WILL_DELAY_INTERVAL + case 0x19: + return MQTT_PropertyType_REQUEST_RESPONSE_INFORMATION + case 0x1A: + return MQTT_PropertyType_RESPONSE_INFORMATION + case 0x1C: + return MQTT_PropertyType_SERVER_REFERENCE + case 0x1F: + return MQTT_PropertyType_REASON_STRING + case 0x21: + return MQTT_PropertyType_RECEIVE_MAXIMUM + case 0x22: + return MQTT_PropertyType_TOPIC_ALIAS_MAXIMUM + case 0x23: + return MQTT_PropertyType_TOPIC_ALIAS + case 0x24: + return MQTT_PropertyType_MAXIMUM_QOS + case 0x25: + return MQTT_PropertyType_RETAIN_AVAILABLE + case 0x26: + return MQTT_PropertyType_USER_PROPERTY + case 0x27: + return MQTT_PropertyType_MAXIMUM_PACKET_SIZE + case 0x28: + return MQTT_PropertyType_WILDCARD_SUBSCRIPTION_AVAILABLE + case 0x29: + return MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER_AVAILABLE + case 0x2A: + return MQTT_PropertyType_SHARED_SUBSCRIPTION_AVAILABLE + } + return 0 +} + +func MQTT_PropertyTypeByName(value string) MQTT_PropertyType { + switch value { + case "PAYLOAD_FORMAT_INDICATOR": + return MQTT_PropertyType_PAYLOAD_FORMAT_INDICATOR + case "MESSAGE_EXPIRY_INTERVAL": + return MQTT_PropertyType_MESSAGE_EXPIRY_INTERVAL + case "CONTENT_TYPE": + return MQTT_PropertyType_CONTENT_TYPE + case "RESPONSE_TOPIC": + return MQTT_PropertyType_RESPONSE_TOPIC + case "CORRELATION_DATA": + return MQTT_PropertyType_CORRELATION_DATA + case "SUBSCRIPTION_IDENTIFIER": + return MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER + case "SESSION_EXPIRY_INTERVAL": + return MQTT_PropertyType_SESSION_EXPIRY_INTERVAL + case "ASSIGNED_CLIENT_IDENTIFIER": + return MQTT_PropertyType_ASSIGNED_CLIENT_IDENTIFIER + case "SERVER_KEEP_ALIVE": + return MQTT_PropertyType_SERVER_KEEP_ALIVE + case "AUTHENTICATION_METHOD": + return MQTT_PropertyType_AUTHENTICATION_METHOD + case "AUTHENTICATION_DATA": + return MQTT_PropertyType_AUTHENTICATION_DATA + case "REQUEST_PROBLEM_INFORMATION": + return MQTT_PropertyType_REQUEST_PROBLEM_INFORMATION + case "WILL_DELAY_INTERVAL": + return MQTT_PropertyType_WILL_DELAY_INTERVAL + case "REQUEST_RESPONSE_INFORMATION": + return MQTT_PropertyType_REQUEST_RESPONSE_INFORMATION + case "RESPONSE_INFORMATION": + return MQTT_PropertyType_RESPONSE_INFORMATION + case "SERVER_REFERENCE": + return MQTT_PropertyType_SERVER_REFERENCE + case "REASON_STRING": + return MQTT_PropertyType_REASON_STRING + case "RECEIVE_MAXIMUM": + return MQTT_PropertyType_RECEIVE_MAXIMUM + case "TOPIC_ALIAS_MAXIMUM": + return MQTT_PropertyType_TOPIC_ALIAS_MAXIMUM + case "TOPIC_ALIAS": + return MQTT_PropertyType_TOPIC_ALIAS + case "MAXIMUM_QOS": + return MQTT_PropertyType_MAXIMUM_QOS + case "RETAIN_AVAILABLE": + return MQTT_PropertyType_RETAIN_AVAILABLE + case "USER_PROPERTY": + return MQTT_PropertyType_USER_PROPERTY + case "MAXIMUM_PACKET_SIZE": + return MQTT_PropertyType_MAXIMUM_PACKET_SIZE + case "WILDCARD_SUBSCRIPTION_AVAILABLE": + return MQTT_PropertyType_WILDCARD_SUBSCRIPTION_AVAILABLE + case "SUBSCRIPTION_IDENTIFIER_AVAILABLE": + return MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER_AVAILABLE + case "SHARED_SUBSCRIPTION_AVAILABLE": + return MQTT_PropertyType_SHARED_SUBSCRIPTION_AVAILABLE + } + return 0 +} + +func CastMQTT_PropertyType(structType interface{}) MQTT_PropertyType { + castFunc := func(typ interface{}) MQTT_PropertyType { + if sMQTT_PropertyType, ok := typ.(MQTT_PropertyType); ok { + return sMQTT_PropertyType + } + return 0 + } + return castFunc(structType) +} + +func (m MQTT_PropertyType) LengthInBits() uint16 { + return 8 +} + +func (m MQTT_PropertyType) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_PropertyTypeParse(readBuffer utils.ReadBuffer) (MQTT_PropertyType, error) { + val, err := readBuffer.ReadUint8("MQTT_PropertyType", 8) + if err != nil { + return 0, nil + } + return MQTT_PropertyTypeByValue(val), nil +} + +func (e MQTT_PropertyType) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteUint8("MQTT_PropertyType", 8, uint8(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e MQTT_PropertyType) name() string { + switch e { + case MQTT_PropertyType_PAYLOAD_FORMAT_INDICATOR: + return "PAYLOAD_FORMAT_INDICATOR" + case MQTT_PropertyType_MESSAGE_EXPIRY_INTERVAL: + return "MESSAGE_EXPIRY_INTERVAL" + case MQTT_PropertyType_CONTENT_TYPE: + return "CONTENT_TYPE" + case MQTT_PropertyType_RESPONSE_TOPIC: + return "RESPONSE_TOPIC" + case MQTT_PropertyType_CORRELATION_DATA: + return "CORRELATION_DATA" + case MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER: + return "SUBSCRIPTION_IDENTIFIER" + case MQTT_PropertyType_SESSION_EXPIRY_INTERVAL: + return "SESSION_EXPIRY_INTERVAL" + case MQTT_PropertyType_ASSIGNED_CLIENT_IDENTIFIER: + return "ASSIGNED_CLIENT_IDENTIFIER" + case MQTT_PropertyType_SERVER_KEEP_ALIVE: + return "SERVER_KEEP_ALIVE" + case MQTT_PropertyType_AUTHENTICATION_METHOD: + return "AUTHENTICATION_METHOD" + case MQTT_PropertyType_AUTHENTICATION_DATA: + return "AUTHENTICATION_DATA" + case MQTT_PropertyType_REQUEST_PROBLEM_INFORMATION: + return "REQUEST_PROBLEM_INFORMATION" + case MQTT_PropertyType_WILL_DELAY_INTERVAL: + return "WILL_DELAY_INTERVAL" + case MQTT_PropertyType_REQUEST_RESPONSE_INFORMATION: + return "REQUEST_RESPONSE_INFORMATION" + case MQTT_PropertyType_RESPONSE_INFORMATION: + return "RESPONSE_INFORMATION" + case MQTT_PropertyType_SERVER_REFERENCE: + return "SERVER_REFERENCE" + case MQTT_PropertyType_REASON_STRING: + return "REASON_STRING" + case MQTT_PropertyType_RECEIVE_MAXIMUM: + return "RECEIVE_MAXIMUM" + case MQTT_PropertyType_TOPIC_ALIAS_MAXIMUM: + return "TOPIC_ALIAS_MAXIMUM" + case MQTT_PropertyType_TOPIC_ALIAS: + return "TOPIC_ALIAS" + case MQTT_PropertyType_MAXIMUM_QOS: + return "MAXIMUM_QOS" + case MQTT_PropertyType_RETAIN_AVAILABLE: + return "RETAIN_AVAILABLE" + case MQTT_PropertyType_USER_PROPERTY: + return "USER_PROPERTY" + case MQTT_PropertyType_MAXIMUM_PACKET_SIZE: + return "MAXIMUM_PACKET_SIZE" + case MQTT_PropertyType_WILDCARD_SUBSCRIPTION_AVAILABLE: + return "WILDCARD_SUBSCRIPTION_AVAILABLE" + case MQTT_PropertyType_SUBSCRIPTION_IDENTIFIER_AVAILABLE: + return "SUBSCRIPTION_IDENTIFIER_AVAILABLE" + case MQTT_PropertyType_SHARED_SUBSCRIPTION_AVAILABLE: + return "SHARED_SUBSCRIPTION_AVAILABLE" + } + return "" +} + +func (e MQTT_PropertyType) String() string { + return e.name() +} + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER.go new file mode 100755 index 00000000000..ea088b3d4b2 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER.go @@ -0,0 +1,169 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER struct { + *MQTT_Property + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_ASSIGNED_CLIENT_IDENTIFIER interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_ASSIGNED_CLIENT_IDENTIFIER(value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_ASSIGNED_CLIENT_IDENTIFIER(structType interface{}) *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER { + castFunc := func(typ interface{}) *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER { + if casted, ok := typ.(MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_ASSIGNED_CLIENT_IDENTIFIER(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_ASSIGNED_CLIENT_IDENTIFIER(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER) GetTypeName() string { + return "MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER" +} + +func (m *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_ASSIGNED_CLIENT_IDENTIFIERParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER{ + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_ASSIGNED_CLIENT_IDENTIFIER) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_DATA.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_DATA.go new file mode 100755 index 00000000000..7c2ad6f84dc --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_DATA.go @@ -0,0 +1,137 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_AUTHENTICATION_DATA struct { + *MQTT_Property +} + +// The corresponding interface +type IMQTT_Property_AUTHENTICATION_DATA interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_AUTHENTICATION_DATA) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_AUTHENTICATION_DATA(propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_AUTHENTICATION_DATA{ + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_AUTHENTICATION_DATA(structType interface{}) *MQTT_Property_AUTHENTICATION_DATA { + castFunc := func(typ interface{}) *MQTT_Property_AUTHENTICATION_DATA { + if casted, ok := typ.(MQTT_Property_AUTHENTICATION_DATA); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_AUTHENTICATION_DATA); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_AUTHENTICATION_DATA(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_AUTHENTICATION_DATA(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_AUTHENTICATION_DATA) GetTypeName() string { + return "MQTT_Property_AUTHENTICATION_DATA" +} + +func (m *MQTT_Property_AUTHENTICATION_DATA) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_AUTHENTICATION_DATA) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + return lengthInBits +} + + +func (m *MQTT_Property_AUTHENTICATION_DATA) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_AUTHENTICATION_DATAParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_AUTHENTICATION_DATA"); pullErr != nil { + return nil, pullErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_AUTHENTICATION_DATA"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_AUTHENTICATION_DATA{ + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_AUTHENTICATION_DATA) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_AUTHENTICATION_DATA"); pushErr != nil { + return pushErr + } + + if popErr := writeBuffer.PopContext("MQTT_Property_AUTHENTICATION_DATA"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_AUTHENTICATION_DATA) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_METHOD.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_METHOD.go new file mode 100755 index 00000000000..08f645766eb --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_AUTHENTICATION_METHOD.go @@ -0,0 +1,169 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_AUTHENTICATION_METHOD struct { + *MQTT_Property + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_AUTHENTICATION_METHOD interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_AUTHENTICATION_METHOD) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_AUTHENTICATION_METHOD(value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_AUTHENTICATION_METHOD{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_AUTHENTICATION_METHOD(structType interface{}) *MQTT_Property_AUTHENTICATION_METHOD { + castFunc := func(typ interface{}) *MQTT_Property_AUTHENTICATION_METHOD { + if casted, ok := typ.(MQTT_Property_AUTHENTICATION_METHOD); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_AUTHENTICATION_METHOD); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_AUTHENTICATION_METHOD(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_AUTHENTICATION_METHOD(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_AUTHENTICATION_METHOD) GetTypeName() string { + return "MQTT_Property_AUTHENTICATION_METHOD" +} + +func (m *MQTT_Property_AUTHENTICATION_METHOD) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_AUTHENTICATION_METHOD) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_AUTHENTICATION_METHOD) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_AUTHENTICATION_METHODParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_AUTHENTICATION_METHOD"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_AUTHENTICATION_METHOD"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_AUTHENTICATION_METHOD{ + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_AUTHENTICATION_METHOD) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_AUTHENTICATION_METHOD"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_AUTHENTICATION_METHOD"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_AUTHENTICATION_METHOD) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_CONTENT_TYPE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_CONTENT_TYPE.go new file mode 100755 index 00000000000..bcb093afcef --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_CONTENT_TYPE.go @@ -0,0 +1,169 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_CONTENT_TYPE struct { + *MQTT_Property + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_CONTENT_TYPE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_CONTENT_TYPE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_CONTENT_TYPE(value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_CONTENT_TYPE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_CONTENT_TYPE(structType interface{}) *MQTT_Property_CONTENT_TYPE { + castFunc := func(typ interface{}) *MQTT_Property_CONTENT_TYPE { + if casted, ok := typ.(MQTT_Property_CONTENT_TYPE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_CONTENT_TYPE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_CONTENT_TYPE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_CONTENT_TYPE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_CONTENT_TYPE) GetTypeName() string { + return "MQTT_Property_CONTENT_TYPE" +} + +func (m *MQTT_Property_CONTENT_TYPE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_CONTENT_TYPE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_CONTENT_TYPE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_CONTENT_TYPEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_CONTENT_TYPE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_CONTENT_TYPE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_CONTENT_TYPE{ + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_CONTENT_TYPE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_CONTENT_TYPE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_CONTENT_TYPE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_CONTENT_TYPE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_CORRELATION_DATA.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_CORRELATION_DATA.go new file mode 100755 index 00000000000..f482dd3152e --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_CORRELATION_DATA.go @@ -0,0 +1,137 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_CORRELATION_DATA struct { + *MQTT_Property +} + +// The corresponding interface +type IMQTT_Property_CORRELATION_DATA interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_CORRELATION_DATA) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_CORRELATION_DATA(propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_CORRELATION_DATA{ + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_CORRELATION_DATA(structType interface{}) *MQTT_Property_CORRELATION_DATA { + castFunc := func(typ interface{}) *MQTT_Property_CORRELATION_DATA { + if casted, ok := typ.(MQTT_Property_CORRELATION_DATA); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_CORRELATION_DATA); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_CORRELATION_DATA(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_CORRELATION_DATA(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_CORRELATION_DATA) GetTypeName() string { + return "MQTT_Property_CORRELATION_DATA" +} + +func (m *MQTT_Property_CORRELATION_DATA) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_CORRELATION_DATA) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + return lengthInBits +} + + +func (m *MQTT_Property_CORRELATION_DATA) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_CORRELATION_DATAParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_CORRELATION_DATA"); pullErr != nil { + return nil, pullErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_CORRELATION_DATA"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_CORRELATION_DATA{ + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_CORRELATION_DATA) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_CORRELATION_DATA"); pushErr != nil { + return pushErr + } + + if popErr := writeBuffer.PopContext("MQTT_Property_CORRELATION_DATA"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_CORRELATION_DATA) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_EXPIRY_INTERVAL.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_EXPIRY_INTERVAL.go new file mode 100755 index 00000000000..609c87e87ca --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_EXPIRY_INTERVAL.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_EXPIRY_INTERVAL struct { + *MQTT_Property + Value uint32 +} + +// The corresponding interface +type IMQTT_Property_EXPIRY_INTERVAL interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_EXPIRY_INTERVAL) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_EXPIRY_INTERVAL(value uint32, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_EXPIRY_INTERVAL{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_EXPIRY_INTERVAL(structType interface{}) *MQTT_Property_EXPIRY_INTERVAL { + castFunc := func(typ interface{}) *MQTT_Property_EXPIRY_INTERVAL { + if casted, ok := typ.(MQTT_Property_EXPIRY_INTERVAL); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_EXPIRY_INTERVAL); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_EXPIRY_INTERVAL(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_EXPIRY_INTERVAL(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_EXPIRY_INTERVAL) GetTypeName() string { + return "MQTT_Property_EXPIRY_INTERVAL" +} + +func (m *MQTT_Property_EXPIRY_INTERVAL) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_EXPIRY_INTERVAL) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 32; + + return lengthInBits +} + + +func (m *MQTT_Property_EXPIRY_INTERVAL) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_EXPIRY_INTERVALParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_EXPIRY_INTERVAL"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint32("value", 32) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_EXPIRY_INTERVAL"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_EXPIRY_INTERVAL{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_EXPIRY_INTERVAL) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_EXPIRY_INTERVAL"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint32(m.Value) + _valueErr := writeBuffer.WriteUint32("value", 32, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_EXPIRY_INTERVAL"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_EXPIRY_INTERVAL) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MAXIMUM_PACKET_SIZE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MAXIMUM_PACKET_SIZE.go new file mode 100755 index 00000000000..c2c367aa8df --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MAXIMUM_PACKET_SIZE.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_MAXIMUM_PACKET_SIZE struct { + *MQTT_Property + Value uint32 +} + +// The corresponding interface +type IMQTT_Property_MAXIMUM_PACKET_SIZE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_MAXIMUM_PACKET_SIZE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_MAXIMUM_PACKET_SIZE(value uint32, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_MAXIMUM_PACKET_SIZE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_MAXIMUM_PACKET_SIZE(structType interface{}) *MQTT_Property_MAXIMUM_PACKET_SIZE { + castFunc := func(typ interface{}) *MQTT_Property_MAXIMUM_PACKET_SIZE { + if casted, ok := typ.(MQTT_Property_MAXIMUM_PACKET_SIZE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_MAXIMUM_PACKET_SIZE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_MAXIMUM_PACKET_SIZE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_MAXIMUM_PACKET_SIZE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_MAXIMUM_PACKET_SIZE) GetTypeName() string { + return "MQTT_Property_MAXIMUM_PACKET_SIZE" +} + +func (m *MQTT_Property_MAXIMUM_PACKET_SIZE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_MAXIMUM_PACKET_SIZE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 32; + + return lengthInBits +} + + +func (m *MQTT_Property_MAXIMUM_PACKET_SIZE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_MAXIMUM_PACKET_SIZEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_MAXIMUM_PACKET_SIZE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint32("value", 32) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_MAXIMUM_PACKET_SIZE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_MAXIMUM_PACKET_SIZE{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_MAXIMUM_PACKET_SIZE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_MAXIMUM_PACKET_SIZE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint32(m.Value) + _valueErr := writeBuffer.WriteUint32("value", 32, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_MAXIMUM_PACKET_SIZE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_MAXIMUM_PACKET_SIZE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MAXIMUM_QOS.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MAXIMUM_QOS.go new file mode 100755 index 00000000000..9753efd04df --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MAXIMUM_QOS.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_MAXIMUM_QOS struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_MAXIMUM_QOS interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_MAXIMUM_QOS) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_MAXIMUM_QOS(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_MAXIMUM_QOS{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_MAXIMUM_QOS(structType interface{}) *MQTT_Property_MAXIMUM_QOS { + castFunc := func(typ interface{}) *MQTT_Property_MAXIMUM_QOS { + if casted, ok := typ.(MQTT_Property_MAXIMUM_QOS); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_MAXIMUM_QOS); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_MAXIMUM_QOS(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_MAXIMUM_QOS(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_MAXIMUM_QOS) GetTypeName() string { + return "MQTT_Property_MAXIMUM_QOS" +} + +func (m *MQTT_Property_MAXIMUM_QOS) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_MAXIMUM_QOS) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_MAXIMUM_QOS) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_MAXIMUM_QOSParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_MAXIMUM_QOS"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_MAXIMUM_QOS"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_MAXIMUM_QOS{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_MAXIMUM_QOS) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_MAXIMUM_QOS"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_MAXIMUM_QOS"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_MAXIMUM_QOS) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MESSAGE_EXPIRY_INTERVAL.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MESSAGE_EXPIRY_INTERVAL.go new file mode 100755 index 00000000000..64fc25958b1 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_MESSAGE_EXPIRY_INTERVAL.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_MESSAGE_EXPIRY_INTERVAL struct { + *MQTT_Property + Value uint32 +} + +// The corresponding interface +type IMQTT_Property_MESSAGE_EXPIRY_INTERVAL interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_MESSAGE_EXPIRY_INTERVAL) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_MESSAGE_EXPIRY_INTERVAL(value uint32, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_MESSAGE_EXPIRY_INTERVAL{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_MESSAGE_EXPIRY_INTERVAL(structType interface{}) *MQTT_Property_MESSAGE_EXPIRY_INTERVAL { + castFunc := func(typ interface{}) *MQTT_Property_MESSAGE_EXPIRY_INTERVAL { + if casted, ok := typ.(MQTT_Property_MESSAGE_EXPIRY_INTERVAL); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_MESSAGE_EXPIRY_INTERVAL); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_MESSAGE_EXPIRY_INTERVAL(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_MESSAGE_EXPIRY_INTERVAL(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_MESSAGE_EXPIRY_INTERVAL) GetTypeName() string { + return "MQTT_Property_MESSAGE_EXPIRY_INTERVAL" +} + +func (m *MQTT_Property_MESSAGE_EXPIRY_INTERVAL) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_MESSAGE_EXPIRY_INTERVAL) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 32; + + return lengthInBits +} + + +func (m *MQTT_Property_MESSAGE_EXPIRY_INTERVAL) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_MESSAGE_EXPIRY_INTERVALParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_MESSAGE_EXPIRY_INTERVAL"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint32("value", 32) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_MESSAGE_EXPIRY_INTERVAL"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_MESSAGE_EXPIRY_INTERVAL{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_MESSAGE_EXPIRY_INTERVAL) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_MESSAGE_EXPIRY_INTERVAL"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint32(m.Value) + _valueErr := writeBuffer.WriteUint32("value", 32, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_MESSAGE_EXPIRY_INTERVAL"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_MESSAGE_EXPIRY_INTERVAL) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_PAYLOAD_FORMAT_INDICATOR.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_PAYLOAD_FORMAT_INDICATOR.go new file mode 100755 index 00000000000..6178a9e58d1 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_PAYLOAD_FORMAT_INDICATOR.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_PAYLOAD_FORMAT_INDICATOR struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_PAYLOAD_FORMAT_INDICATOR interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_PAYLOAD_FORMAT_INDICATOR) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_PAYLOAD_FORMAT_INDICATOR(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_PAYLOAD_FORMAT_INDICATOR{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_PAYLOAD_FORMAT_INDICATOR(structType interface{}) *MQTT_Property_PAYLOAD_FORMAT_INDICATOR { + castFunc := func(typ interface{}) *MQTT_Property_PAYLOAD_FORMAT_INDICATOR { + if casted, ok := typ.(MQTT_Property_PAYLOAD_FORMAT_INDICATOR); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_PAYLOAD_FORMAT_INDICATOR); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_PAYLOAD_FORMAT_INDICATOR(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_PAYLOAD_FORMAT_INDICATOR(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_PAYLOAD_FORMAT_INDICATOR) GetTypeName() string { + return "MQTT_Property_PAYLOAD_FORMAT_INDICATOR" +} + +func (m *MQTT_Property_PAYLOAD_FORMAT_INDICATOR) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_PAYLOAD_FORMAT_INDICATOR) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_PAYLOAD_FORMAT_INDICATOR) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_PAYLOAD_FORMAT_INDICATORParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_PAYLOAD_FORMAT_INDICATOR"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_PAYLOAD_FORMAT_INDICATOR"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_PAYLOAD_FORMAT_INDICATOR{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_PAYLOAD_FORMAT_INDICATOR) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_PAYLOAD_FORMAT_INDICATOR"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_PAYLOAD_FORMAT_INDICATOR"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_PAYLOAD_FORMAT_INDICATOR) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REASON_STRING.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REASON_STRING.go new file mode 100755 index 00000000000..1745577e465 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REASON_STRING.go @@ -0,0 +1,169 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_REASON_STRING struct { + *MQTT_Property + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_REASON_STRING interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_REASON_STRING) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_REASON_STRING(value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_REASON_STRING{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_REASON_STRING(structType interface{}) *MQTT_Property_REASON_STRING { + castFunc := func(typ interface{}) *MQTT_Property_REASON_STRING { + if casted, ok := typ.(MQTT_Property_REASON_STRING); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_REASON_STRING); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_REASON_STRING(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_REASON_STRING(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_REASON_STRING) GetTypeName() string { + return "MQTT_Property_REASON_STRING" +} + +func (m *MQTT_Property_REASON_STRING) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_REASON_STRING) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_REASON_STRING) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_REASON_STRINGParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_REASON_STRING"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_REASON_STRING"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_REASON_STRING{ + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_REASON_STRING) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_REASON_STRING"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_REASON_STRING"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_REASON_STRING) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RECEIVE_MAXIMUM.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RECEIVE_MAXIMUM.go new file mode 100755 index 00000000000..8efc9b0d77e --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RECEIVE_MAXIMUM.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_RECEIVE_MAXIMUM struct { + *MQTT_Property + Value uint16 +} + +// The corresponding interface +type IMQTT_Property_RECEIVE_MAXIMUM interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_RECEIVE_MAXIMUM) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_RECEIVE_MAXIMUM(value uint16, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_RECEIVE_MAXIMUM{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_RECEIVE_MAXIMUM(structType interface{}) *MQTT_Property_RECEIVE_MAXIMUM { + castFunc := func(typ interface{}) *MQTT_Property_RECEIVE_MAXIMUM { + if casted, ok := typ.(MQTT_Property_RECEIVE_MAXIMUM); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_RECEIVE_MAXIMUM); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_RECEIVE_MAXIMUM(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_RECEIVE_MAXIMUM(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_RECEIVE_MAXIMUM) GetTypeName() string { + return "MQTT_Property_RECEIVE_MAXIMUM" +} + +func (m *MQTT_Property_RECEIVE_MAXIMUM) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_RECEIVE_MAXIMUM) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 16; + + return lengthInBits +} + + +func (m *MQTT_Property_RECEIVE_MAXIMUM) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_RECEIVE_MAXIMUMParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_RECEIVE_MAXIMUM"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint16("value", 16) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_RECEIVE_MAXIMUM"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_RECEIVE_MAXIMUM{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_RECEIVE_MAXIMUM) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_RECEIVE_MAXIMUM"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint16(m.Value) + _valueErr := writeBuffer.WriteUint16("value", 16, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_RECEIVE_MAXIMUM"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_RECEIVE_MAXIMUM) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REQUEST_PROBLEM_INFORMATION.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REQUEST_PROBLEM_INFORMATION.go new file mode 100755 index 00000000000..3bd79e2e728 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REQUEST_PROBLEM_INFORMATION.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_REQUEST_PROBLEM_INFORMATION struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_REQUEST_PROBLEM_INFORMATION interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_REQUEST_PROBLEM_INFORMATION) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_REQUEST_PROBLEM_INFORMATION(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_REQUEST_PROBLEM_INFORMATION{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_REQUEST_PROBLEM_INFORMATION(structType interface{}) *MQTT_Property_REQUEST_PROBLEM_INFORMATION { + castFunc := func(typ interface{}) *MQTT_Property_REQUEST_PROBLEM_INFORMATION { + if casted, ok := typ.(MQTT_Property_REQUEST_PROBLEM_INFORMATION); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_REQUEST_PROBLEM_INFORMATION); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_REQUEST_PROBLEM_INFORMATION(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_REQUEST_PROBLEM_INFORMATION(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_REQUEST_PROBLEM_INFORMATION) GetTypeName() string { + return "MQTT_Property_REQUEST_PROBLEM_INFORMATION" +} + +func (m *MQTT_Property_REQUEST_PROBLEM_INFORMATION) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_REQUEST_PROBLEM_INFORMATION) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_REQUEST_PROBLEM_INFORMATION) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_REQUEST_PROBLEM_INFORMATIONParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_REQUEST_PROBLEM_INFORMATION"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_REQUEST_PROBLEM_INFORMATION"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_REQUEST_PROBLEM_INFORMATION{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_REQUEST_PROBLEM_INFORMATION) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_REQUEST_PROBLEM_INFORMATION"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_REQUEST_PROBLEM_INFORMATION"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_REQUEST_PROBLEM_INFORMATION) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REQUEST_RESPONSE_INFORMATION.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REQUEST_RESPONSE_INFORMATION.go new file mode 100755 index 00000000000..9022e65aad2 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_REQUEST_RESPONSE_INFORMATION.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_REQUEST_RESPONSE_INFORMATION struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_REQUEST_RESPONSE_INFORMATION interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_REQUEST_RESPONSE_INFORMATION) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_REQUEST_RESPONSE_INFORMATION(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_REQUEST_RESPONSE_INFORMATION{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_REQUEST_RESPONSE_INFORMATION(structType interface{}) *MQTT_Property_REQUEST_RESPONSE_INFORMATION { + castFunc := func(typ interface{}) *MQTT_Property_REQUEST_RESPONSE_INFORMATION { + if casted, ok := typ.(MQTT_Property_REQUEST_RESPONSE_INFORMATION); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_REQUEST_RESPONSE_INFORMATION); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_REQUEST_RESPONSE_INFORMATION(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_REQUEST_RESPONSE_INFORMATION(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_REQUEST_RESPONSE_INFORMATION) GetTypeName() string { + return "MQTT_Property_REQUEST_RESPONSE_INFORMATION" +} + +func (m *MQTT_Property_REQUEST_RESPONSE_INFORMATION) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_REQUEST_RESPONSE_INFORMATION) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_REQUEST_RESPONSE_INFORMATION) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_REQUEST_RESPONSE_INFORMATIONParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_REQUEST_RESPONSE_INFORMATION"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_REQUEST_RESPONSE_INFORMATION"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_REQUEST_RESPONSE_INFORMATION{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_REQUEST_RESPONSE_INFORMATION) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_REQUEST_RESPONSE_INFORMATION"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_REQUEST_RESPONSE_INFORMATION"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_REQUEST_RESPONSE_INFORMATION) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RESPONSE_INFORMATION.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RESPONSE_INFORMATION.go new file mode 100755 index 00000000000..b4ed4e53ff0 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RESPONSE_INFORMATION.go @@ -0,0 +1,169 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_RESPONSE_INFORMATION struct { + *MQTT_Property + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_RESPONSE_INFORMATION interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_RESPONSE_INFORMATION) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_RESPONSE_INFORMATION(value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_RESPONSE_INFORMATION{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_RESPONSE_INFORMATION(structType interface{}) *MQTT_Property_RESPONSE_INFORMATION { + castFunc := func(typ interface{}) *MQTT_Property_RESPONSE_INFORMATION { + if casted, ok := typ.(MQTT_Property_RESPONSE_INFORMATION); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_RESPONSE_INFORMATION); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_RESPONSE_INFORMATION(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_RESPONSE_INFORMATION(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_RESPONSE_INFORMATION) GetTypeName() string { + return "MQTT_Property_RESPONSE_INFORMATION" +} + +func (m *MQTT_Property_RESPONSE_INFORMATION) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_RESPONSE_INFORMATION) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_RESPONSE_INFORMATION) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_RESPONSE_INFORMATIONParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_RESPONSE_INFORMATION"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_RESPONSE_INFORMATION"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_RESPONSE_INFORMATION{ + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_RESPONSE_INFORMATION) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_RESPONSE_INFORMATION"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_RESPONSE_INFORMATION"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_RESPONSE_INFORMATION) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RESPONSE_TOPIC.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RESPONSE_TOPIC.go new file mode 100755 index 00000000000..c7621c6be05 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RESPONSE_TOPIC.go @@ -0,0 +1,169 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_RESPONSE_TOPIC struct { + *MQTT_Property + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_RESPONSE_TOPIC interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_RESPONSE_TOPIC) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_RESPONSE_TOPIC(value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_RESPONSE_TOPIC{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_RESPONSE_TOPIC(structType interface{}) *MQTT_Property_RESPONSE_TOPIC { + castFunc := func(typ interface{}) *MQTT_Property_RESPONSE_TOPIC { + if casted, ok := typ.(MQTT_Property_RESPONSE_TOPIC); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_RESPONSE_TOPIC); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_RESPONSE_TOPIC(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_RESPONSE_TOPIC(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_RESPONSE_TOPIC) GetTypeName() string { + return "MQTT_Property_RESPONSE_TOPIC" +} + +func (m *MQTT_Property_RESPONSE_TOPIC) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_RESPONSE_TOPIC) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_RESPONSE_TOPIC) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_RESPONSE_TOPICParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_RESPONSE_TOPIC"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_RESPONSE_TOPIC"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_RESPONSE_TOPIC{ + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_RESPONSE_TOPIC) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_RESPONSE_TOPIC"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_RESPONSE_TOPIC"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_RESPONSE_TOPIC) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RETAIN_AVAILABLE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RETAIN_AVAILABLE.go new file mode 100755 index 00000000000..fefe7ca262e --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_RETAIN_AVAILABLE.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_RETAIN_AVAILABLE struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_RETAIN_AVAILABLE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_RETAIN_AVAILABLE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_RETAIN_AVAILABLE(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_RETAIN_AVAILABLE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_RETAIN_AVAILABLE(structType interface{}) *MQTT_Property_RETAIN_AVAILABLE { + castFunc := func(typ interface{}) *MQTT_Property_RETAIN_AVAILABLE { + if casted, ok := typ.(MQTT_Property_RETAIN_AVAILABLE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_RETAIN_AVAILABLE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_RETAIN_AVAILABLE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_RETAIN_AVAILABLE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_RETAIN_AVAILABLE) GetTypeName() string { + return "MQTT_Property_RETAIN_AVAILABLE" +} + +func (m *MQTT_Property_RETAIN_AVAILABLE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_RETAIN_AVAILABLE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_RETAIN_AVAILABLE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_RETAIN_AVAILABLEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_RETAIN_AVAILABLE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_RETAIN_AVAILABLE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_RETAIN_AVAILABLE{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_RETAIN_AVAILABLE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_RETAIN_AVAILABLE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_RETAIN_AVAILABLE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_RETAIN_AVAILABLE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SERVER_KEEP_ALIVE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SERVER_KEEP_ALIVE.go new file mode 100755 index 00000000000..075c2fc94e9 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SERVER_KEEP_ALIVE.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_SERVER_KEEP_ALIVE struct { + *MQTT_Property + Value uint16 +} + +// The corresponding interface +type IMQTT_Property_SERVER_KEEP_ALIVE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_SERVER_KEEP_ALIVE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_SERVER_KEEP_ALIVE(value uint16, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_SERVER_KEEP_ALIVE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_SERVER_KEEP_ALIVE(structType interface{}) *MQTT_Property_SERVER_KEEP_ALIVE { + castFunc := func(typ interface{}) *MQTT_Property_SERVER_KEEP_ALIVE { + if casted, ok := typ.(MQTT_Property_SERVER_KEEP_ALIVE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_SERVER_KEEP_ALIVE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_SERVER_KEEP_ALIVE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_SERVER_KEEP_ALIVE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_SERVER_KEEP_ALIVE) GetTypeName() string { + return "MQTT_Property_SERVER_KEEP_ALIVE" +} + +func (m *MQTT_Property_SERVER_KEEP_ALIVE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_SERVER_KEEP_ALIVE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 16; + + return lengthInBits +} + + +func (m *MQTT_Property_SERVER_KEEP_ALIVE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_SERVER_KEEP_ALIVEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_SERVER_KEEP_ALIVE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint16("value", 16) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_SERVER_KEEP_ALIVE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_SERVER_KEEP_ALIVE{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_SERVER_KEEP_ALIVE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_SERVER_KEEP_ALIVE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint16(m.Value) + _valueErr := writeBuffer.WriteUint16("value", 16, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_SERVER_KEEP_ALIVE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_SERVER_KEEP_ALIVE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SERVER_REFERENCE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SERVER_REFERENCE.go new file mode 100755 index 00000000000..c3a52b84168 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SERVER_REFERENCE.go @@ -0,0 +1,169 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_SERVER_REFERENCE struct { + *MQTT_Property + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_SERVER_REFERENCE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_SERVER_REFERENCE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_SERVER_REFERENCE(value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_SERVER_REFERENCE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_SERVER_REFERENCE(structType interface{}) *MQTT_Property_SERVER_REFERENCE { + castFunc := func(typ interface{}) *MQTT_Property_SERVER_REFERENCE { + if casted, ok := typ.(MQTT_Property_SERVER_REFERENCE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_SERVER_REFERENCE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_SERVER_REFERENCE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_SERVER_REFERENCE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_SERVER_REFERENCE) GetTypeName() string { + return "MQTT_Property_SERVER_REFERENCE" +} + +func (m *MQTT_Property_SERVER_REFERENCE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_SERVER_REFERENCE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_SERVER_REFERENCE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_SERVER_REFERENCEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_SERVER_REFERENCE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_SERVER_REFERENCE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_SERVER_REFERENCE{ + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_SERVER_REFERENCE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_SERVER_REFERENCE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_SERVER_REFERENCE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_SERVER_REFERENCE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE.go new file mode 100755 index 00000000000..fc7772d1875 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE(structType interface{}) *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE { + castFunc := func(typ interface{}) *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE { + if casted, ok := typ.(MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE) GetTypeName() string { + return "MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE" +} + +func (m *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_SHARED_SUBSCRIPTION_AVAILABLE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER.go new file mode 100755 index 00000000000..93f17b1a18a --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_SUBSCRIPTION_IDENTIFIER struct { + *MQTT_Property + Value uint32 +} + +// The corresponding interface +type IMQTT_Property_SUBSCRIPTION_IDENTIFIER interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_SUBSCRIPTION_IDENTIFIER(value uint32, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_SUBSCRIPTION_IDENTIFIER{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_SUBSCRIPTION_IDENTIFIER(structType interface{}) *MQTT_Property_SUBSCRIPTION_IDENTIFIER { + castFunc := func(typ interface{}) *MQTT_Property_SUBSCRIPTION_IDENTIFIER { + if casted, ok := typ.(MQTT_Property_SUBSCRIPTION_IDENTIFIER); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_SUBSCRIPTION_IDENTIFIER); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_SUBSCRIPTION_IDENTIFIER(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_SUBSCRIPTION_IDENTIFIER(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER) GetTypeName() string { + return "MQTT_Property_SUBSCRIPTION_IDENTIFIER" +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 32; + + return lengthInBits +} + + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_SUBSCRIPTION_IDENTIFIERParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint32("value", 32) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_SUBSCRIPTION_IDENTIFIER{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint32(m.Value) + _valueErr := writeBuffer.WriteUint32("value", 32, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE.go new file mode 100755 index 00000000000..5f6ff57eadc --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE(structType interface{}) *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE { + castFunc := func(typ interface{}) *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE { + if casted, ok := typ.(MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE) GetTypeName() string { + return "MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE" +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_SUBSCRIPTION_IDENTIFIER_AVAILABLE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS.go new file mode 100755 index 00000000000..8f9f553c0e3 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_TOPIC_ALIAS struct { + *MQTT_Property + Value uint16 +} + +// The corresponding interface +type IMQTT_Property_TOPIC_ALIAS interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_TOPIC_ALIAS) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_TOPIC_ALIAS(value uint16, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_TOPIC_ALIAS{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_TOPIC_ALIAS(structType interface{}) *MQTT_Property_TOPIC_ALIAS { + castFunc := func(typ interface{}) *MQTT_Property_TOPIC_ALIAS { + if casted, ok := typ.(MQTT_Property_TOPIC_ALIAS); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_TOPIC_ALIAS); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_TOPIC_ALIAS(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_TOPIC_ALIAS(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_TOPIC_ALIAS) GetTypeName() string { + return "MQTT_Property_TOPIC_ALIAS" +} + +func (m *MQTT_Property_TOPIC_ALIAS) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_TOPIC_ALIAS) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 16; + + return lengthInBits +} + + +func (m *MQTT_Property_TOPIC_ALIAS) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_TOPIC_ALIASParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_TOPIC_ALIAS"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint16("value", 16) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_TOPIC_ALIAS"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_TOPIC_ALIAS{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_TOPIC_ALIAS) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_TOPIC_ALIAS"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint16(m.Value) + _valueErr := writeBuffer.WriteUint16("value", 16, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_TOPIC_ALIAS"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_TOPIC_ALIAS) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS_MAXIMUM.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS_MAXIMUM.go new file mode 100755 index 00000000000..0fd108f490d --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_TOPIC_ALIAS_MAXIMUM.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_TOPIC_ALIAS_MAXIMUM struct { + *MQTT_Property + Value uint16 +} + +// The corresponding interface +type IMQTT_Property_TOPIC_ALIAS_MAXIMUM interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_TOPIC_ALIAS_MAXIMUM) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_TOPIC_ALIAS_MAXIMUM(value uint16, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_TOPIC_ALIAS_MAXIMUM{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_TOPIC_ALIAS_MAXIMUM(structType interface{}) *MQTT_Property_TOPIC_ALIAS_MAXIMUM { + castFunc := func(typ interface{}) *MQTT_Property_TOPIC_ALIAS_MAXIMUM { + if casted, ok := typ.(MQTT_Property_TOPIC_ALIAS_MAXIMUM); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_TOPIC_ALIAS_MAXIMUM); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_TOPIC_ALIAS_MAXIMUM(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_TOPIC_ALIAS_MAXIMUM(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_TOPIC_ALIAS_MAXIMUM) GetTypeName() string { + return "MQTT_Property_TOPIC_ALIAS_MAXIMUM" +} + +func (m *MQTT_Property_TOPIC_ALIAS_MAXIMUM) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_TOPIC_ALIAS_MAXIMUM) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 16; + + return lengthInBits +} + + +func (m *MQTT_Property_TOPIC_ALIAS_MAXIMUM) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_TOPIC_ALIAS_MAXIMUMParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_TOPIC_ALIAS_MAXIMUM"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint16("value", 16) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_TOPIC_ALIAS_MAXIMUM"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_TOPIC_ALIAS_MAXIMUM{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_TOPIC_ALIAS_MAXIMUM) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_TOPIC_ALIAS_MAXIMUM"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint16(m.Value) + _valueErr := writeBuffer.WriteUint16("value", 16, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_TOPIC_ALIAS_MAXIMUM"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_TOPIC_ALIAS_MAXIMUM) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_USER_PROPERTY.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_USER_PROPERTY.go new file mode 100755 index 00000000000..81036be42d2 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_USER_PROPERTY.go @@ -0,0 +1,200 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_USER_PROPERTY struct { + *MQTT_Property + Name *MQTT_String + Value *MQTT_String +} + +// The corresponding interface +type IMQTT_Property_USER_PROPERTY interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_USER_PROPERTY) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_USER_PROPERTY(name *MQTT_String, value *MQTT_String, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_USER_PROPERTY{ + Name: name, + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_USER_PROPERTY(structType interface{}) *MQTT_Property_USER_PROPERTY { + castFunc := func(typ interface{}) *MQTT_Property_USER_PROPERTY { + if casted, ok := typ.(MQTT_Property_USER_PROPERTY); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_USER_PROPERTY); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_USER_PROPERTY(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_USER_PROPERTY(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_USER_PROPERTY) GetTypeName() string { + return "MQTT_Property_USER_PROPERTY" +} + +func (m *MQTT_Property_USER_PROPERTY) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_USER_PROPERTY) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (name) + lengthInBits += m.Name.LengthInBits() + + // Simple field (value) + lengthInBits += m.Value.LengthInBits() + + return lengthInBits +} + + +func (m *MQTT_Property_USER_PROPERTY) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_USER_PROPERTYParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_USER_PROPERTY"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (name) + if pullErr := readBuffer.PullContext("name"); pullErr != nil { + return nil, pullErr + } +_name, _nameErr := MQTT_StringParse(readBuffer) + if _nameErr != nil { + return nil, errors.Wrap(_nameErr, "Error parsing 'name' field") + } + name := CastMQTT_String(_name) + if closeErr := readBuffer.CloseContext("name"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } +_value, _valueErr := MQTT_StringParse(readBuffer) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastMQTT_String(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("MQTT_Property_USER_PROPERTY"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_USER_PROPERTY{ + Name: CastMQTT_String(name), + Value: CastMQTT_String(value), + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_USER_PROPERTY) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_USER_PROPERTY"); pushErr != nil { + return pushErr + } + + // Simple Field (name) + if pushErr := writeBuffer.PushContext("name"); pushErr != nil { + return pushErr + } + _nameErr := m.Name.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("name"); popErr != nil { + return popErr + } + if _nameErr != nil { + return errors.Wrap(_nameErr, "Error serializing 'name' field") + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_USER_PROPERTY"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_USER_PROPERTY) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE.go new file mode 100755 index 00000000000..a504fd5c339 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE struct { + *MQTT_Property + Value uint8 +} + +// The corresponding interface +type IMQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE(value uint8, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE(structType interface{}) *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE { + castFunc := func(typ interface{}) *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE { + if casted, ok := typ.(MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE) GetTypeName() string { + return "MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE" +} + +func (m *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 8; + + return lengthInBits +} + + +func (m *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLEParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint8("value", 8) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint8(m.Value) + _valueErr := writeBuffer.WriteUint8("value", 8, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_WILDCARD_SUBSCRIPTION_AVAILABLE) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_WILL_DELAY_INTERVAL.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_WILL_DELAY_INTERVAL.go new file mode 100755 index 00000000000..e984aaa1208 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_Property_WILL_DELAY_INTERVAL.go @@ -0,0 +1,158 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_Property_WILL_DELAY_INTERVAL struct { + *MQTT_Property + Value uint32 +} + +// The corresponding interface +type IMQTT_Property_WILL_DELAY_INTERVAL interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +// Accessors for discriminator values. +/////////////////////////////////////////////////////////// + +func (m *MQTT_Property_WILL_DELAY_INTERVAL) InitializeParent(parent *MQTT_Property, propertyType MQTT_PropertyType) { + m.PropertyType = propertyType +} + +func NewMQTT_Property_WILL_DELAY_INTERVAL(value uint32, propertyType MQTT_PropertyType) *MQTT_Property { + child := &MQTT_Property_WILL_DELAY_INTERVAL{ + Value: value, + MQTT_Property: NewMQTT_Property(propertyType), + } + child.Child = child + return child.MQTT_Property +} + +func CastMQTT_Property_WILL_DELAY_INTERVAL(structType interface{}) *MQTT_Property_WILL_DELAY_INTERVAL { + castFunc := func(typ interface{}) *MQTT_Property_WILL_DELAY_INTERVAL { + if casted, ok := typ.(MQTT_Property_WILL_DELAY_INTERVAL); ok { + return &casted + } + if casted, ok := typ.(*MQTT_Property_WILL_DELAY_INTERVAL); ok { + return casted + } + if casted, ok := typ.(MQTT_Property); ok { + return CastMQTT_Property_WILL_DELAY_INTERVAL(casted.Child) + } + if casted, ok := typ.(*MQTT_Property); ok { + return CastMQTT_Property_WILL_DELAY_INTERVAL(casted.Child) + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_Property_WILL_DELAY_INTERVAL) GetTypeName() string { + return "MQTT_Property_WILL_DELAY_INTERVAL" +} + +func (m *MQTT_Property_WILL_DELAY_INTERVAL) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_Property_WILL_DELAY_INTERVAL) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.ParentLengthInBits()) + + // Simple field (value) + lengthInBits += 32; + + return lengthInBits +} + + +func (m *MQTT_Property_WILL_DELAY_INTERVAL) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_Property_WILL_DELAY_INTERVALParse(readBuffer utils.ReadBuffer) (*MQTT_Property, error) { + if pullErr := readBuffer.PullContext("MQTT_Property_WILL_DELAY_INTERVAL"); pullErr != nil { + return nil, pullErr + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadUint32("value", 32) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_Property_WILL_DELAY_INTERVAL"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &MQTT_Property_WILL_DELAY_INTERVAL{ + Value: value, + MQTT_Property: &MQTT_Property{}, + } + _child.MQTT_Property.Child = _child + return _child.MQTT_Property, nil +} + +func (m *MQTT_Property_WILL_DELAY_INTERVAL) Serialize(writeBuffer utils.WriteBuffer) error { + ser := func() error { + if pushErr := writeBuffer.PushContext("MQTT_Property_WILL_DELAY_INTERVAL"); pushErr != nil { + return pushErr + } + + // Simple Field (value) + value := uint32(m.Value) + _valueErr := writeBuffer.WriteUint32("value", 32, (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_Property_WILL_DELAY_INTERVAL"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *MQTT_Property_WILL_DELAY_INTERVAL) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_QOS.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_QOS.go new file mode 100755 index 00000000000..c2052249f7e --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_QOS.go @@ -0,0 +1,121 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +type MQTT_QOS uint8 + +type IMQTT_QOS interface { + Serialize(writeBuffer utils.WriteBuffer) error +} + +const( + MQTT_QOS_AT_MOST_ONCE MQTT_QOS = 0x0 + MQTT_QOS_AT_LEAST_ONCE MQTT_QOS = 0x1 + MQTT_QOS_EXACTLY_ONCE MQTT_QOS = 0x2 +) + +var MQTT_QOSValues []MQTT_QOS + +func init() { + _ = errors.New + MQTT_QOSValues = []MQTT_QOS { + MQTT_QOS_AT_MOST_ONCE, + MQTT_QOS_AT_LEAST_ONCE, + MQTT_QOS_EXACTLY_ONCE, + } +} + +func MQTT_QOSByValue(value uint8) MQTT_QOS { + switch value { + case 0x0: + return MQTT_QOS_AT_MOST_ONCE + case 0x1: + return MQTT_QOS_AT_LEAST_ONCE + case 0x2: + return MQTT_QOS_EXACTLY_ONCE + } + return 0 +} + +func MQTT_QOSByName(value string) MQTT_QOS { + switch value { + case "AT_MOST_ONCE": + return MQTT_QOS_AT_MOST_ONCE + case "AT_LEAST_ONCE": + return MQTT_QOS_AT_LEAST_ONCE + case "EXACTLY_ONCE": + return MQTT_QOS_EXACTLY_ONCE + } + return 0 +} + +func CastMQTT_QOS(structType interface{}) MQTT_QOS { + castFunc := func(typ interface{}) MQTT_QOS { + if sMQTT_QOS, ok := typ.(MQTT_QOS); ok { + return sMQTT_QOS + } + return 0 + } + return castFunc(structType) +} + +func (m MQTT_QOS) LengthInBits() uint16 { + return 2 +} + +func (m MQTT_QOS) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_QOSParse(readBuffer utils.ReadBuffer) (MQTT_QOS, error) { + val, err := readBuffer.ReadUint8("MQTT_QOS", 2) + if err != nil { + return 0, nil + } + return MQTT_QOSByValue(val), nil +} + +func (e MQTT_QOS) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteUint8("MQTT_QOS", 2, uint8(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e MQTT_QOS) name() string { + switch e { + case MQTT_QOS_AT_MOST_ONCE: + return "AT_MOST_ONCE" + case MQTT_QOS_AT_LEAST_ONCE: + return "AT_LEAST_ONCE" + case MQTT_QOS_EXACTLY_ONCE: + return "EXACTLY_ONCE" + } + return "" +} + +func (e MQTT_QOS) String() string { + return e.name() +} + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ReasonCode.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ReasonCode.go new file mode 100755 index 00000000000..05d64deb53a --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_ReasonCode.go @@ -0,0 +1,1470 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +type MQTT_ReasonCode uint8 + +type IMQTT_ReasonCode interface { + DisconnectReason() bool + UnsubackResponse() bool + SubackResponse() bool + AuthReason() bool + PubrelPubcompResponse() bool + PubackPubrecResponse() bool + ConnackResponse() bool + Serialize(writeBuffer utils.WriteBuffer) error +} + +const( + MQTT_ReasonCode_SUCCESS MQTT_ReasonCode = 0X00 + MQTT_ReasonCode_GRANTED_QOS_1 MQTT_ReasonCode = 0X01 + MQTT_ReasonCode_GRANTED_QOS_2 MQTT_ReasonCode = 0X02 + MQTT_ReasonCode_DISCONNECT_WITH_WILL_MESSAGE MQTT_ReasonCode = 0X04 + MQTT_ReasonCode_NO_MATCHING_SUBSCRIBERS MQTT_ReasonCode = 0x10 + MQTT_ReasonCode_NO_SUBSCRIPTION_EXISTED MQTT_ReasonCode = 0x11 + MQTT_ReasonCode_CONTINUE_AUTHENTICATION MQTT_ReasonCode = 0X18 + MQTT_ReasonCode_RE_AUTHENTICATE MQTT_ReasonCode = 0X19 + MQTT_ReasonCode_UNSPECIFIED_ERROR MQTT_ReasonCode = 0X80 + MQTT_ReasonCode_MALFORMED_PACKET MQTT_ReasonCode = 0X81 + MQTT_ReasonCode_PROTOCOL_ERROR MQTT_ReasonCode = 0X82 + MQTT_ReasonCode_IMPLEMENTATION_SPECIFIC_ERROR MQTT_ReasonCode = 0X83 + MQTT_ReasonCode_UNSUPPORTED_PROTOCOL_VERSION MQTT_ReasonCode = 0X84 + MQTT_ReasonCode_CLIENT_IDENTIFIER_NOT_VALID MQTT_ReasonCode = 0X85 + MQTT_ReasonCode_BAD_USER_NAME_OR_PASSWORD MQTT_ReasonCode = 0X86 + MQTT_ReasonCode_NOT_AUTHORIZED MQTT_ReasonCode = 0X87 + MQTT_ReasonCode_SERVER_UNAVAILABLE MQTT_ReasonCode = 0X88 + MQTT_ReasonCode_SERVER_BUSY MQTT_ReasonCode = 0X89 + MQTT_ReasonCode_BANNED MQTT_ReasonCode = 0X8A + MQTT_ReasonCode_SERVER_SHUTTING_DOWN MQTT_ReasonCode = 0X8B + MQTT_ReasonCode_BAD_AUTHENTICATION_METHOD MQTT_ReasonCode = 0X8C + MQTT_ReasonCode_KEEP_ALIVE_TIMEOUT MQTT_ReasonCode = 0X8D + MQTT_ReasonCode_SESSION_TAKEN_OVER MQTT_ReasonCode = 0X8E + MQTT_ReasonCode_TOPIC_FILTER_INVALID MQTT_ReasonCode = 0X8F + MQTT_ReasonCode_TOPIC_NAME_INVALID MQTT_ReasonCode = 0X90 + MQTT_ReasonCode_PACKET_IDENTIFIER_IN_USE MQTT_ReasonCode = 0X91 + MQTT_ReasonCode_PACKET_IDENTIFIER_NOT_FOUND MQTT_ReasonCode = 0X92 + MQTT_ReasonCode_RECEIVE_MAXIMUM_EXCEEDED MQTT_ReasonCode = 0X93 + MQTT_ReasonCode_TOPIC_ALIAS_INVALID MQTT_ReasonCode = 0X94 + MQTT_ReasonCode_PACKET_TOO_LARGE MQTT_ReasonCode = 0X95 + MQTT_ReasonCode_MESSAGE_RATE_TO_HIGH MQTT_ReasonCode = 0X96 + MQTT_ReasonCode_QUOTA_EXCEEDED MQTT_ReasonCode = 0X97 + MQTT_ReasonCode_ADMINISTRATIVE_ACTION MQTT_ReasonCode = 0X98 + MQTT_ReasonCode_PAYLOAD_FORMAT_INVALID MQTT_ReasonCode = 0X99 + MQTT_ReasonCode_RETAIN_NOT_SUPPORTED MQTT_ReasonCode = 0X9A + MQTT_ReasonCode_QOS_NOT_SUPPORTED MQTT_ReasonCode = 0X9B + MQTT_ReasonCode_USE_ANOTHER_SERVER MQTT_ReasonCode = 0X9C + MQTT_ReasonCode_SERVER_MOVED MQTT_ReasonCode = 0X9D + MQTT_ReasonCode_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED MQTT_ReasonCode = 0X9E + MQTT_ReasonCode_CONNECTION_RATE_EXCEEDED MQTT_ReasonCode = 0X9F + MQTT_ReasonCode_MAXIMUM_CONNECT_TIME MQTT_ReasonCode = 0XA0 + MQTT_ReasonCode_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED MQTT_ReasonCode = 0XA1 + MQTT_ReasonCode_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED MQTT_ReasonCode = 0XA2 +) + +var MQTT_ReasonCodeValues []MQTT_ReasonCode + +func init() { + _ = errors.New + MQTT_ReasonCodeValues = []MQTT_ReasonCode { + MQTT_ReasonCode_SUCCESS, + MQTT_ReasonCode_GRANTED_QOS_1, + MQTT_ReasonCode_GRANTED_QOS_2, + MQTT_ReasonCode_DISCONNECT_WITH_WILL_MESSAGE, + MQTT_ReasonCode_NO_MATCHING_SUBSCRIBERS, + MQTT_ReasonCode_NO_SUBSCRIPTION_EXISTED, + MQTT_ReasonCode_CONTINUE_AUTHENTICATION, + MQTT_ReasonCode_RE_AUTHENTICATE, + MQTT_ReasonCode_UNSPECIFIED_ERROR, + MQTT_ReasonCode_MALFORMED_PACKET, + MQTT_ReasonCode_PROTOCOL_ERROR, + MQTT_ReasonCode_IMPLEMENTATION_SPECIFIC_ERROR, + MQTT_ReasonCode_UNSUPPORTED_PROTOCOL_VERSION, + MQTT_ReasonCode_CLIENT_IDENTIFIER_NOT_VALID, + MQTT_ReasonCode_BAD_USER_NAME_OR_PASSWORD, + MQTT_ReasonCode_NOT_AUTHORIZED, + MQTT_ReasonCode_SERVER_UNAVAILABLE, + MQTT_ReasonCode_SERVER_BUSY, + MQTT_ReasonCode_BANNED, + MQTT_ReasonCode_SERVER_SHUTTING_DOWN, + MQTT_ReasonCode_BAD_AUTHENTICATION_METHOD, + MQTT_ReasonCode_KEEP_ALIVE_TIMEOUT, + MQTT_ReasonCode_SESSION_TAKEN_OVER, + MQTT_ReasonCode_TOPIC_FILTER_INVALID, + MQTT_ReasonCode_TOPIC_NAME_INVALID, + MQTT_ReasonCode_PACKET_IDENTIFIER_IN_USE, + MQTT_ReasonCode_PACKET_IDENTIFIER_NOT_FOUND, + MQTT_ReasonCode_RECEIVE_MAXIMUM_EXCEEDED, + MQTT_ReasonCode_TOPIC_ALIAS_INVALID, + MQTT_ReasonCode_PACKET_TOO_LARGE, + MQTT_ReasonCode_MESSAGE_RATE_TO_HIGH, + MQTT_ReasonCode_QUOTA_EXCEEDED, + MQTT_ReasonCode_ADMINISTRATIVE_ACTION, + MQTT_ReasonCode_PAYLOAD_FORMAT_INVALID, + MQTT_ReasonCode_RETAIN_NOT_SUPPORTED, + MQTT_ReasonCode_QOS_NOT_SUPPORTED, + MQTT_ReasonCode_USE_ANOTHER_SERVER, + MQTT_ReasonCode_SERVER_MOVED, + MQTT_ReasonCode_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED, + MQTT_ReasonCode_CONNECTION_RATE_EXCEEDED, + MQTT_ReasonCode_MAXIMUM_CONNECT_TIME, + MQTT_ReasonCode_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED, + MQTT_ReasonCode_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED, + } +} + + +func (e MQTT_ReasonCode) DisconnectReason() bool { + switch e { + case 0X00: { /* '0X00' */ + return true + } + case 0X01: { /* '0X01' */ + return false + } + case 0X02: { /* '0X02' */ + return false + } + case 0X04: { /* '0X04' */ + return true + } + case 0X18: { /* '0X18' */ + return false + } + case 0X19: { /* '0X19' */ + return false + } + case 0X80: { /* '0X80' */ + return true + } + case 0X81: { /* '0X81' */ + return true + } + case 0X82: { /* '0X82' */ + return true + } + case 0X83: { /* '0X83' */ + return true + } + case 0X84: { /* '0X84' */ + return false + } + case 0X85: { /* '0X85' */ + return false + } + case 0X86: { /* '0X86' */ + return false + } + case 0X87: { /* '0X87' */ + return true + } + case 0X88: { /* '0X88' */ + return false + } + case 0X89: { /* '0X89' */ + return true + } + case 0X8A: { /* '0X8A' */ + return false + } + case 0X8B: { /* '0X8B' */ + return true + } + case 0X8C: { /* '0X8C' */ + return false + } + case 0X8D: { /* '0X8D' */ + return true + } + case 0X8E: { /* '0X8E' */ + return true + } + case 0X8F: { /* '0X8F' */ + return true + } + case 0X90: { /* '0X90' */ + return true + } + case 0X91: { /* '0X91' */ + return false + } + case 0X92: { /* '0X92' */ + return false + } + case 0X93: { /* '0X93' */ + return true + } + case 0X94: { /* '0X94' */ + return true + } + case 0X95: { /* '0X95' */ + return true + } + case 0X96: { /* '0X96' */ + return true + } + case 0X97: { /* '0X97' */ + return true + } + case 0X98: { /* '0X98' */ + return true + } + case 0X99: { /* '0X99' */ + return true + } + case 0X9A: { /* '0X9A' */ + return true + } + case 0X9B: { /* '0X9B' */ + return true + } + case 0X9C: { /* '0X9C' */ + return true + } + case 0X9D: { /* '0X9D' */ + return true + } + case 0X9E: { /* '0X9E' */ + return true + } + case 0X9F: { /* '0X9F' */ + return true + } + case 0XA0: { /* '0XA0' */ + return true + } + case 0XA1: { /* '0XA1' */ + return true + } + case 0XA2: { /* '0XA2' */ + return true + } + case 0x10: { /* '0x10' */ + return false + } + case 0x11: { /* '0x11' */ + return false + } + default: { + return false + } + } +} + +func MQTT_ReasonCodeFirstEnumForFieldDisconnectReason(value bool) (MQTT_ReasonCode, error) { + for _, sizeValue := range MQTT_ReasonCodeValues { + if sizeValue.DisconnectReason() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing DisconnectReason not found", value) +} + +func (e MQTT_ReasonCode) UnsubackResponse() bool { + switch e { + case 0X00: { /* '0X00' */ + return true + } + case 0X01: { /* '0X01' */ + return false + } + case 0X02: { /* '0X02' */ + return false + } + case 0X04: { /* '0X04' */ + return false + } + case 0X18: { /* '0X18' */ + return false + } + case 0X19: { /* '0X19' */ + return false + } + case 0X80: { /* '0X80' */ + return true + } + case 0X81: { /* '0X81' */ + return false + } + case 0X82: { /* '0X82' */ + return false + } + case 0X83: { /* '0X83' */ + return true + } + case 0X84: { /* '0X84' */ + return false + } + case 0X85: { /* '0X85' */ + return false + } + case 0X86: { /* '0X86' */ + return false + } + case 0X87: { /* '0X87' */ + return true + } + case 0X88: { /* '0X88' */ + return false + } + case 0X89: { /* '0X89' */ + return false + } + case 0X8A: { /* '0X8A' */ + return false + } + case 0X8B: { /* '0X8B' */ + return false + } + case 0X8C: { /* '0X8C' */ + return false + } + case 0X8D: { /* '0X8D' */ + return false + } + case 0X8E: { /* '0X8E' */ + return false + } + case 0X8F: { /* '0X8F' */ + return true + } + case 0X90: { /* '0X90' */ + return false + } + case 0X91: { /* '0X91' */ + return true + } + case 0X92: { /* '0X92' */ + return false + } + case 0X93: { /* '0X93' */ + return false + } + case 0X94: { /* '0X94' */ + return false + } + case 0X95: { /* '0X95' */ + return false + } + case 0X96: { /* '0X96' */ + return false + } + case 0X97: { /* '0X97' */ + return false + } + case 0X98: { /* '0X98' */ + return false + } + case 0X99: { /* '0X99' */ + return false + } + case 0X9A: { /* '0X9A' */ + return false + } + case 0X9B: { /* '0X9B' */ + return false + } + case 0X9C: { /* '0X9C' */ + return false + } + case 0X9D: { /* '0X9D' */ + return false + } + case 0X9E: { /* '0X9E' */ + return false + } + case 0X9F: { /* '0X9F' */ + return false + } + case 0XA0: { /* '0XA0' */ + return false + } + case 0XA1: { /* '0XA1' */ + return false + } + case 0XA2: { /* '0XA2' */ + return false + } + case 0x10: { /* '0x10' */ + return false + } + case 0x11: { /* '0x11' */ + return true + } + default: { + return false + } + } +} + +func MQTT_ReasonCodeFirstEnumForFieldUnsubackResponse(value bool) (MQTT_ReasonCode, error) { + for _, sizeValue := range MQTT_ReasonCodeValues { + if sizeValue.UnsubackResponse() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing UnsubackResponse not found", value) +} + +func (e MQTT_ReasonCode) SubackResponse() bool { + switch e { + case 0X00: { /* '0X00' */ + return true + } + case 0X01: { /* '0X01' */ + return true + } + case 0X02: { /* '0X02' */ + return true + } + case 0X04: { /* '0X04' */ + return false + } + case 0X18: { /* '0X18' */ + return false + } + case 0X19: { /* '0X19' */ + return false + } + case 0X80: { /* '0X80' */ + return true + } + case 0X81: { /* '0X81' */ + return false + } + case 0X82: { /* '0X82' */ + return false + } + case 0X83: { /* '0X83' */ + return true + } + case 0X84: { /* '0X84' */ + return false + } + case 0X85: { /* '0X85' */ + return false + } + case 0X86: { /* '0X86' */ + return false + } + case 0X87: { /* '0X87' */ + return true + } + case 0X88: { /* '0X88' */ + return false + } + case 0X89: { /* '0X89' */ + return false + } + case 0X8A: { /* '0X8A' */ + return false + } + case 0X8B: { /* '0X8B' */ + return false + } + case 0X8C: { /* '0X8C' */ + return false + } + case 0X8D: { /* '0X8D' */ + return false + } + case 0X8E: { /* '0X8E' */ + return false + } + case 0X8F: { /* '0X8F' */ + return true + } + case 0X90: { /* '0X90' */ + return false + } + case 0X91: { /* '0X91' */ + return true + } + case 0X92: { /* '0X92' */ + return false + } + case 0X93: { /* '0X93' */ + return false + } + case 0X94: { /* '0X94' */ + return false + } + case 0X95: { /* '0X95' */ + return false + } + case 0X96: { /* '0X96' */ + return false + } + case 0X97: { /* '0X97' */ + return true + } + case 0X98: { /* '0X98' */ + return false + } + case 0X99: { /* '0X99' */ + return false + } + case 0X9A: { /* '0X9A' */ + return false + } + case 0X9B: { /* '0X9B' */ + return false + } + case 0X9C: { /* '0X9C' */ + return false + } + case 0X9D: { /* '0X9D' */ + return false + } + case 0X9E: { /* '0X9E' */ + return true + } + case 0X9F: { /* '0X9F' */ + return false + } + case 0XA0: { /* '0XA0' */ + return false + } + case 0XA1: { /* '0XA1' */ + return true + } + case 0XA2: { /* '0XA2' */ + return true + } + case 0x10: { /* '0x10' */ + return false + } + case 0x11: { /* '0x11' */ + return false + } + default: { + return false + } + } +} + +func MQTT_ReasonCodeFirstEnumForFieldSubackResponse(value bool) (MQTT_ReasonCode, error) { + for _, sizeValue := range MQTT_ReasonCodeValues { + if sizeValue.SubackResponse() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing SubackResponse not found", value) +} + +func (e MQTT_ReasonCode) AuthReason() bool { + switch e { + case 0X00: { /* '0X00' */ + return true + } + case 0X01: { /* '0X01' */ + return false + } + case 0X02: { /* '0X02' */ + return false + } + case 0X04: { /* '0X04' */ + return false + } + case 0X18: { /* '0X18' */ + return true + } + case 0X19: { /* '0X19' */ + return true + } + case 0X80: { /* '0X80' */ + return false + } + case 0X81: { /* '0X81' */ + return false + } + case 0X82: { /* '0X82' */ + return false + } + case 0X83: { /* '0X83' */ + return false + } + case 0X84: { /* '0X84' */ + return false + } + case 0X85: { /* '0X85' */ + return false + } + case 0X86: { /* '0X86' */ + return false + } + case 0X87: { /* '0X87' */ + return false + } + case 0X88: { /* '0X88' */ + return false + } + case 0X89: { /* '0X89' */ + return false + } + case 0X8A: { /* '0X8A' */ + return false + } + case 0X8B: { /* '0X8B' */ + return false + } + case 0X8C: { /* '0X8C' */ + return false + } + case 0X8D: { /* '0X8D' */ + return false + } + case 0X8E: { /* '0X8E' */ + return false + } + case 0X8F: { /* '0X8F' */ + return false + } + case 0X90: { /* '0X90' */ + return false + } + case 0X91: { /* '0X91' */ + return false + } + case 0X92: { /* '0X92' */ + return false + } + case 0X93: { /* '0X93' */ + return false + } + case 0X94: { /* '0X94' */ + return false + } + case 0X95: { /* '0X95' */ + return false + } + case 0X96: { /* '0X96' */ + return false + } + case 0X97: { /* '0X97' */ + return false + } + case 0X98: { /* '0X98' */ + return false + } + case 0X99: { /* '0X99' */ + return false + } + case 0X9A: { /* '0X9A' */ + return false + } + case 0X9B: { /* '0X9B' */ + return false + } + case 0X9C: { /* '0X9C' */ + return false + } + case 0X9D: { /* '0X9D' */ + return false + } + case 0X9E: { /* '0X9E' */ + return false + } + case 0X9F: { /* '0X9F' */ + return false + } + case 0XA0: { /* '0XA0' */ + return false + } + case 0XA1: { /* '0XA1' */ + return false + } + case 0XA2: { /* '0XA2' */ + return false + } + case 0x10: { /* '0x10' */ + return false + } + case 0x11: { /* '0x11' */ + return false + } + default: { + return false + } + } +} + +func MQTT_ReasonCodeFirstEnumForFieldAuthReason(value bool) (MQTT_ReasonCode, error) { + for _, sizeValue := range MQTT_ReasonCodeValues { + if sizeValue.AuthReason() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing AuthReason not found", value) +} + +func (e MQTT_ReasonCode) PubrelPubcompResponse() bool { + switch e { + case 0X00: { /* '0X00' */ + return true + } + case 0X01: { /* '0X01' */ + return false + } + case 0X02: { /* '0X02' */ + return false + } + case 0X04: { /* '0X04' */ + return false + } + case 0X18: { /* '0X18' */ + return false + } + case 0X19: { /* '0X19' */ + return false + } + case 0X80: { /* '0X80' */ + return false + } + case 0X81: { /* '0X81' */ + return false + } + case 0X82: { /* '0X82' */ + return false + } + case 0X83: { /* '0X83' */ + return false + } + case 0X84: { /* '0X84' */ + return false + } + case 0X85: { /* '0X85' */ + return false + } + case 0X86: { /* '0X86' */ + return false + } + case 0X87: { /* '0X87' */ + return false + } + case 0X88: { /* '0X88' */ + return false + } + case 0X89: { /* '0X89' */ + return false + } + case 0X8A: { /* '0X8A' */ + return false + } + case 0X8B: { /* '0X8B' */ + return false + } + case 0X8C: { /* '0X8C' */ + return false + } + case 0X8D: { /* '0X8D' */ + return false + } + case 0X8E: { /* '0X8E' */ + return false + } + case 0X8F: { /* '0X8F' */ + return false + } + case 0X90: { /* '0X90' */ + return false + } + case 0X91: { /* '0X91' */ + return false + } + case 0X92: { /* '0X92' */ + return true + } + case 0X93: { /* '0X93' */ + return false + } + case 0X94: { /* '0X94' */ + return false + } + case 0X95: { /* '0X95' */ + return false + } + case 0X96: { /* '0X96' */ + return false + } + case 0X97: { /* '0X97' */ + return false + } + case 0X98: { /* '0X98' */ + return false + } + case 0X99: { /* '0X99' */ + return false + } + case 0X9A: { /* '0X9A' */ + return false + } + case 0X9B: { /* '0X9B' */ + return false + } + case 0X9C: { /* '0X9C' */ + return false + } + case 0X9D: { /* '0X9D' */ + return false + } + case 0X9E: { /* '0X9E' */ + return false + } + case 0X9F: { /* '0X9F' */ + return false + } + case 0XA0: { /* '0XA0' */ + return false + } + case 0XA1: { /* '0XA1' */ + return false + } + case 0XA2: { /* '0XA2' */ + return false + } + case 0x10: { /* '0x10' */ + return false + } + case 0x11: { /* '0x11' */ + return false + } + default: { + return false + } + } +} + +func MQTT_ReasonCodeFirstEnumForFieldPubrelPubcompResponse(value bool) (MQTT_ReasonCode, error) { + for _, sizeValue := range MQTT_ReasonCodeValues { + if sizeValue.PubrelPubcompResponse() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing PubrelPubcompResponse not found", value) +} + +func (e MQTT_ReasonCode) PubackPubrecResponse() bool { + switch e { + case 0X00: { /* '0X00' */ + return true + } + case 0X01: { /* '0X01' */ + return false + } + case 0X02: { /* '0X02' */ + return false + } + case 0X04: { /* '0X04' */ + return false + } + case 0X18: { /* '0X18' */ + return false + } + case 0X19: { /* '0X19' */ + return false + } + case 0X80: { /* '0X80' */ + return true + } + case 0X81: { /* '0X81' */ + return false + } + case 0X82: { /* '0X82' */ + return false + } + case 0X83: { /* '0X83' */ + return true + } + case 0X84: { /* '0X84' */ + return false + } + case 0X85: { /* '0X85' */ + return false + } + case 0X86: { /* '0X86' */ + return false + } + case 0X87: { /* '0X87' */ + return true + } + case 0X88: { /* '0X88' */ + return false + } + case 0X89: { /* '0X89' */ + return false + } + case 0X8A: { /* '0X8A' */ + return false + } + case 0X8B: { /* '0X8B' */ + return false + } + case 0X8C: { /* '0X8C' */ + return false + } + case 0X8D: { /* '0X8D' */ + return false + } + case 0X8E: { /* '0X8E' */ + return false + } + case 0X8F: { /* '0X8F' */ + return false + } + case 0X90: { /* '0X90' */ + return true + } + case 0X91: { /* '0X91' */ + return true + } + case 0X92: { /* '0X92' */ + return false + } + case 0X93: { /* '0X93' */ + return false + } + case 0X94: { /* '0X94' */ + return false + } + case 0X95: { /* '0X95' */ + return false + } + case 0X96: { /* '0X96' */ + return false + } + case 0X97: { /* '0X97' */ + return true + } + case 0X98: { /* '0X98' */ + return false + } + case 0X99: { /* '0X99' */ + return true + } + case 0X9A: { /* '0X9A' */ + return false + } + case 0X9B: { /* '0X9B' */ + return false + } + case 0X9C: { /* '0X9C' */ + return false + } + case 0X9D: { /* '0X9D' */ + return false + } + case 0X9E: { /* '0X9E' */ + return false + } + case 0X9F: { /* '0X9F' */ + return false + } + case 0XA0: { /* '0XA0' */ + return false + } + case 0XA1: { /* '0XA1' */ + return false + } + case 0XA2: { /* '0XA2' */ + return false + } + case 0x10: { /* '0x10' */ + return true + } + case 0x11: { /* '0x11' */ + return false + } + default: { + return false + } + } +} + +func MQTT_ReasonCodeFirstEnumForFieldPubackPubrecResponse(value bool) (MQTT_ReasonCode, error) { + for _, sizeValue := range MQTT_ReasonCodeValues { + if sizeValue.PubackPubrecResponse() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing PubackPubrecResponse not found", value) +} + +func (e MQTT_ReasonCode) ConnackResponse() bool { + switch e { + case 0X00: { /* '0X00' */ + return true + } + case 0X01: { /* '0X01' */ + return false + } + case 0X02: { /* '0X02' */ + return false + } + case 0X04: { /* '0X04' */ + return false + } + case 0X18: { /* '0X18' */ + return false + } + case 0X19: { /* '0X19' */ + return false + } + case 0X80: { /* '0X80' */ + return true + } + case 0X81: { /* '0X81' */ + return true + } + case 0X82: { /* '0X82' */ + return true + } + case 0X83: { /* '0X83' */ + return true + } + case 0X84: { /* '0X84' */ + return true + } + case 0X85: { /* '0X85' */ + return true + } + case 0X86: { /* '0X86' */ + return true + } + case 0X87: { /* '0X87' */ + return true + } + case 0X88: { /* '0X88' */ + return true + } + case 0X89: { /* '0X89' */ + return true + } + case 0X8A: { /* '0X8A' */ + return true + } + case 0X8B: { /* '0X8B' */ + return false + } + case 0X8C: { /* '0X8C' */ + return true + } + case 0X8D: { /* '0X8D' */ + return false + } + case 0X8E: { /* '0X8E' */ + return false + } + case 0X8F: { /* '0X8F' */ + return false + } + case 0X90: { /* '0X90' */ + return true + } + case 0X91: { /* '0X91' */ + return false + } + case 0X92: { /* '0X92' */ + return false + } + case 0X93: { /* '0X93' */ + return false + } + case 0X94: { /* '0X94' */ + return false + } + case 0X95: { /* '0X95' */ + return true + } + case 0X96: { /* '0X96' */ + return false + } + case 0X97: { /* '0X97' */ + return true + } + case 0X98: { /* '0X98' */ + return false + } + case 0X99: { /* '0X99' */ + return true + } + case 0X9A: { /* '0X9A' */ + return true + } + case 0X9B: { /* '0X9B' */ + return true + } + case 0X9C: { /* '0X9C' */ + return true + } + case 0X9D: { /* '0X9D' */ + return true + } + case 0X9E: { /* '0X9E' */ + return false + } + case 0X9F: { /* '0X9F' */ + return true + } + case 0XA0: { /* '0XA0' */ + return false + } + case 0XA1: { /* '0XA1' */ + return false + } + case 0XA2: { /* '0XA2' */ + return false + } + case 0x10: { /* '0x10' */ + return false + } + case 0x11: { /* '0x11' */ + return false + } + default: { + return false + } + } +} + +func MQTT_ReasonCodeFirstEnumForFieldConnackResponse(value bool) (MQTT_ReasonCode, error) { + for _, sizeValue := range MQTT_ReasonCodeValues { + if sizeValue.ConnackResponse() == value { + return sizeValue, nil + } + } + return 0, errors.Errorf("enum for %v describing ConnackResponse not found", value) +} +func MQTT_ReasonCodeByValue(value uint8) MQTT_ReasonCode { + switch value { + case 0X00: + return MQTT_ReasonCode_SUCCESS + case 0X01: + return MQTT_ReasonCode_GRANTED_QOS_1 + case 0X02: + return MQTT_ReasonCode_GRANTED_QOS_2 + case 0X04: + return MQTT_ReasonCode_DISCONNECT_WITH_WILL_MESSAGE + case 0X18: + return MQTT_ReasonCode_CONTINUE_AUTHENTICATION + case 0X19: + return MQTT_ReasonCode_RE_AUTHENTICATE + case 0X80: + return MQTT_ReasonCode_UNSPECIFIED_ERROR + case 0X81: + return MQTT_ReasonCode_MALFORMED_PACKET + case 0X82: + return MQTT_ReasonCode_PROTOCOL_ERROR + case 0X83: + return MQTT_ReasonCode_IMPLEMENTATION_SPECIFIC_ERROR + case 0X84: + return MQTT_ReasonCode_UNSUPPORTED_PROTOCOL_VERSION + case 0X85: + return MQTT_ReasonCode_CLIENT_IDENTIFIER_NOT_VALID + case 0X86: + return MQTT_ReasonCode_BAD_USER_NAME_OR_PASSWORD + case 0X87: + return MQTT_ReasonCode_NOT_AUTHORIZED + case 0X88: + return MQTT_ReasonCode_SERVER_UNAVAILABLE + case 0X89: + return MQTT_ReasonCode_SERVER_BUSY + case 0X8A: + return MQTT_ReasonCode_BANNED + case 0X8B: + return MQTT_ReasonCode_SERVER_SHUTTING_DOWN + case 0X8C: + return MQTT_ReasonCode_BAD_AUTHENTICATION_METHOD + case 0X8D: + return MQTT_ReasonCode_KEEP_ALIVE_TIMEOUT + case 0X8E: + return MQTT_ReasonCode_SESSION_TAKEN_OVER + case 0X8F: + return MQTT_ReasonCode_TOPIC_FILTER_INVALID + case 0X90: + return MQTT_ReasonCode_TOPIC_NAME_INVALID + case 0X91: + return MQTT_ReasonCode_PACKET_IDENTIFIER_IN_USE + case 0X92: + return MQTT_ReasonCode_PACKET_IDENTIFIER_NOT_FOUND + case 0X93: + return MQTT_ReasonCode_RECEIVE_MAXIMUM_EXCEEDED + case 0X94: + return MQTT_ReasonCode_TOPIC_ALIAS_INVALID + case 0X95: + return MQTT_ReasonCode_PACKET_TOO_LARGE + case 0X96: + return MQTT_ReasonCode_MESSAGE_RATE_TO_HIGH + case 0X97: + return MQTT_ReasonCode_QUOTA_EXCEEDED + case 0X98: + return MQTT_ReasonCode_ADMINISTRATIVE_ACTION + case 0X99: + return MQTT_ReasonCode_PAYLOAD_FORMAT_INVALID + case 0X9A: + return MQTT_ReasonCode_RETAIN_NOT_SUPPORTED + case 0X9B: + return MQTT_ReasonCode_QOS_NOT_SUPPORTED + case 0X9C: + return MQTT_ReasonCode_USE_ANOTHER_SERVER + case 0X9D: + return MQTT_ReasonCode_SERVER_MOVED + case 0X9E: + return MQTT_ReasonCode_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED + case 0X9F: + return MQTT_ReasonCode_CONNECTION_RATE_EXCEEDED + case 0XA0: + return MQTT_ReasonCode_MAXIMUM_CONNECT_TIME + case 0XA1: + return MQTT_ReasonCode_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED + case 0XA2: + return MQTT_ReasonCode_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED + case 0x10: + return MQTT_ReasonCode_NO_MATCHING_SUBSCRIBERS + case 0x11: + return MQTT_ReasonCode_NO_SUBSCRIPTION_EXISTED + } + return 0 +} + +func MQTT_ReasonCodeByName(value string) MQTT_ReasonCode { + switch value { + case "SUCCESS": + return MQTT_ReasonCode_SUCCESS + case "GRANTED_QOS_1": + return MQTT_ReasonCode_GRANTED_QOS_1 + case "GRANTED_QOS_2": + return MQTT_ReasonCode_GRANTED_QOS_2 + case "DISCONNECT_WITH_WILL_MESSAGE": + return MQTT_ReasonCode_DISCONNECT_WITH_WILL_MESSAGE + case "CONTINUE_AUTHENTICATION": + return MQTT_ReasonCode_CONTINUE_AUTHENTICATION + case "RE_AUTHENTICATE": + return MQTT_ReasonCode_RE_AUTHENTICATE + case "UNSPECIFIED_ERROR": + return MQTT_ReasonCode_UNSPECIFIED_ERROR + case "MALFORMED_PACKET": + return MQTT_ReasonCode_MALFORMED_PACKET + case "PROTOCOL_ERROR": + return MQTT_ReasonCode_PROTOCOL_ERROR + case "IMPLEMENTATION_SPECIFIC_ERROR": + return MQTT_ReasonCode_IMPLEMENTATION_SPECIFIC_ERROR + case "UNSUPPORTED_PROTOCOL_VERSION": + return MQTT_ReasonCode_UNSUPPORTED_PROTOCOL_VERSION + case "CLIENT_IDENTIFIER_NOT_VALID": + return MQTT_ReasonCode_CLIENT_IDENTIFIER_NOT_VALID + case "BAD_USER_NAME_OR_PASSWORD": + return MQTT_ReasonCode_BAD_USER_NAME_OR_PASSWORD + case "NOT_AUTHORIZED": + return MQTT_ReasonCode_NOT_AUTHORIZED + case "SERVER_UNAVAILABLE": + return MQTT_ReasonCode_SERVER_UNAVAILABLE + case "SERVER_BUSY": + return MQTT_ReasonCode_SERVER_BUSY + case "BANNED": + return MQTT_ReasonCode_BANNED + case "SERVER_SHUTTING_DOWN": + return MQTT_ReasonCode_SERVER_SHUTTING_DOWN + case "BAD_AUTHENTICATION_METHOD": + return MQTT_ReasonCode_BAD_AUTHENTICATION_METHOD + case "KEEP_ALIVE_TIMEOUT": + return MQTT_ReasonCode_KEEP_ALIVE_TIMEOUT + case "SESSION_TAKEN_OVER": + return MQTT_ReasonCode_SESSION_TAKEN_OVER + case "TOPIC_FILTER_INVALID": + return MQTT_ReasonCode_TOPIC_FILTER_INVALID + case "TOPIC_NAME_INVALID": + return MQTT_ReasonCode_TOPIC_NAME_INVALID + case "PACKET_IDENTIFIER_IN_USE": + return MQTT_ReasonCode_PACKET_IDENTIFIER_IN_USE + case "PACKET_IDENTIFIER_NOT_FOUND": + return MQTT_ReasonCode_PACKET_IDENTIFIER_NOT_FOUND + case "RECEIVE_MAXIMUM_EXCEEDED": + return MQTT_ReasonCode_RECEIVE_MAXIMUM_EXCEEDED + case "TOPIC_ALIAS_INVALID": + return MQTT_ReasonCode_TOPIC_ALIAS_INVALID + case "PACKET_TOO_LARGE": + return MQTT_ReasonCode_PACKET_TOO_LARGE + case "MESSAGE_RATE_TO_HIGH": + return MQTT_ReasonCode_MESSAGE_RATE_TO_HIGH + case "QUOTA_EXCEEDED": + return MQTT_ReasonCode_QUOTA_EXCEEDED + case "ADMINISTRATIVE_ACTION": + return MQTT_ReasonCode_ADMINISTRATIVE_ACTION + case "PAYLOAD_FORMAT_INVALID": + return MQTT_ReasonCode_PAYLOAD_FORMAT_INVALID + case "RETAIN_NOT_SUPPORTED": + return MQTT_ReasonCode_RETAIN_NOT_SUPPORTED + case "QOS_NOT_SUPPORTED": + return MQTT_ReasonCode_QOS_NOT_SUPPORTED + case "USE_ANOTHER_SERVER": + return MQTT_ReasonCode_USE_ANOTHER_SERVER + case "SERVER_MOVED": + return MQTT_ReasonCode_SERVER_MOVED + case "SHARED_SUBSCRIPTIONS_NOT_SUPPORTED": + return MQTT_ReasonCode_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED + case "CONNECTION_RATE_EXCEEDED": + return MQTT_ReasonCode_CONNECTION_RATE_EXCEEDED + case "MAXIMUM_CONNECT_TIME": + return MQTT_ReasonCode_MAXIMUM_CONNECT_TIME + case "SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED": + return MQTT_ReasonCode_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED + case "WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED": + return MQTT_ReasonCode_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED + case "NO_MATCHING_SUBSCRIBERS": + return MQTT_ReasonCode_NO_MATCHING_SUBSCRIBERS + case "NO_SUBSCRIPTION_EXISTED": + return MQTT_ReasonCode_NO_SUBSCRIPTION_EXISTED + } + return 0 +} + +func CastMQTT_ReasonCode(structType interface{}) MQTT_ReasonCode { + castFunc := func(typ interface{}) MQTT_ReasonCode { + if sMQTT_ReasonCode, ok := typ.(MQTT_ReasonCode); ok { + return sMQTT_ReasonCode + } + return 0 + } + return castFunc(structType) +} + +func (m MQTT_ReasonCode) LengthInBits() uint16 { + return 8 +} + +func (m MQTT_ReasonCode) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_ReasonCodeParse(readBuffer utils.ReadBuffer) (MQTT_ReasonCode, error) { + val, err := readBuffer.ReadUint8("MQTT_ReasonCode", 8) + if err != nil { + return 0, nil + } + return MQTT_ReasonCodeByValue(val), nil +} + +func (e MQTT_ReasonCode) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteUint8("MQTT_ReasonCode", 8, uint8(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e MQTT_ReasonCode) name() string { + switch e { + case MQTT_ReasonCode_SUCCESS: + return "SUCCESS" + case MQTT_ReasonCode_GRANTED_QOS_1: + return "GRANTED_QOS_1" + case MQTT_ReasonCode_GRANTED_QOS_2: + return "GRANTED_QOS_2" + case MQTT_ReasonCode_DISCONNECT_WITH_WILL_MESSAGE: + return "DISCONNECT_WITH_WILL_MESSAGE" + case MQTT_ReasonCode_CONTINUE_AUTHENTICATION: + return "CONTINUE_AUTHENTICATION" + case MQTT_ReasonCode_RE_AUTHENTICATE: + return "RE_AUTHENTICATE" + case MQTT_ReasonCode_UNSPECIFIED_ERROR: + return "UNSPECIFIED_ERROR" + case MQTT_ReasonCode_MALFORMED_PACKET: + return "MALFORMED_PACKET" + case MQTT_ReasonCode_PROTOCOL_ERROR: + return "PROTOCOL_ERROR" + case MQTT_ReasonCode_IMPLEMENTATION_SPECIFIC_ERROR: + return "IMPLEMENTATION_SPECIFIC_ERROR" + case MQTT_ReasonCode_UNSUPPORTED_PROTOCOL_VERSION: + return "UNSUPPORTED_PROTOCOL_VERSION" + case MQTT_ReasonCode_CLIENT_IDENTIFIER_NOT_VALID: + return "CLIENT_IDENTIFIER_NOT_VALID" + case MQTT_ReasonCode_BAD_USER_NAME_OR_PASSWORD: + return "BAD_USER_NAME_OR_PASSWORD" + case MQTT_ReasonCode_NOT_AUTHORIZED: + return "NOT_AUTHORIZED" + case MQTT_ReasonCode_SERVER_UNAVAILABLE: + return "SERVER_UNAVAILABLE" + case MQTT_ReasonCode_SERVER_BUSY: + return "SERVER_BUSY" + case MQTT_ReasonCode_BANNED: + return "BANNED" + case MQTT_ReasonCode_SERVER_SHUTTING_DOWN: + return "SERVER_SHUTTING_DOWN" + case MQTT_ReasonCode_BAD_AUTHENTICATION_METHOD: + return "BAD_AUTHENTICATION_METHOD" + case MQTT_ReasonCode_KEEP_ALIVE_TIMEOUT: + return "KEEP_ALIVE_TIMEOUT" + case MQTT_ReasonCode_SESSION_TAKEN_OVER: + return "SESSION_TAKEN_OVER" + case MQTT_ReasonCode_TOPIC_FILTER_INVALID: + return "TOPIC_FILTER_INVALID" + case MQTT_ReasonCode_TOPIC_NAME_INVALID: + return "TOPIC_NAME_INVALID" + case MQTT_ReasonCode_PACKET_IDENTIFIER_IN_USE: + return "PACKET_IDENTIFIER_IN_USE" + case MQTT_ReasonCode_PACKET_IDENTIFIER_NOT_FOUND: + return "PACKET_IDENTIFIER_NOT_FOUND" + case MQTT_ReasonCode_RECEIVE_MAXIMUM_EXCEEDED: + return "RECEIVE_MAXIMUM_EXCEEDED" + case MQTT_ReasonCode_TOPIC_ALIAS_INVALID: + return "TOPIC_ALIAS_INVALID" + case MQTT_ReasonCode_PACKET_TOO_LARGE: + return "PACKET_TOO_LARGE" + case MQTT_ReasonCode_MESSAGE_RATE_TO_HIGH: + return "MESSAGE_RATE_TO_HIGH" + case MQTT_ReasonCode_QUOTA_EXCEEDED: + return "QUOTA_EXCEEDED" + case MQTT_ReasonCode_ADMINISTRATIVE_ACTION: + return "ADMINISTRATIVE_ACTION" + case MQTT_ReasonCode_PAYLOAD_FORMAT_INVALID: + return "PAYLOAD_FORMAT_INVALID" + case MQTT_ReasonCode_RETAIN_NOT_SUPPORTED: + return "RETAIN_NOT_SUPPORTED" + case MQTT_ReasonCode_QOS_NOT_SUPPORTED: + return "QOS_NOT_SUPPORTED" + case MQTT_ReasonCode_USE_ANOTHER_SERVER: + return "USE_ANOTHER_SERVER" + case MQTT_ReasonCode_SERVER_MOVED: + return "SERVER_MOVED" + case MQTT_ReasonCode_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: + return "SHARED_SUBSCRIPTIONS_NOT_SUPPORTED" + case MQTT_ReasonCode_CONNECTION_RATE_EXCEEDED: + return "CONNECTION_RATE_EXCEEDED" + case MQTT_ReasonCode_MAXIMUM_CONNECT_TIME: + return "MAXIMUM_CONNECT_TIME" + case MQTT_ReasonCode_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: + return "SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED" + case MQTT_ReasonCode_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: + return "WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED" + case MQTT_ReasonCode_NO_MATCHING_SUBSCRIBERS: + return "NO_MATCHING_SUBSCRIBERS" + case MQTT_ReasonCode_NO_SUBSCRIPTION_EXISTED: + return "NO_SUBSCRIPTION_EXISTED" + } + return "" +} + +func (e MQTT_ReasonCode) String() string { + return e.name() +} + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_RetainHandling.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_RetainHandling.go new file mode 100755 index 00000000000..37e671d92be --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_RetainHandling.go @@ -0,0 +1,121 @@ +/* + * 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 model + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +type MQTT_RetainHandling uint8 + +type IMQTT_RetainHandling interface { + Serialize(writeBuffer utils.WriteBuffer) error +} + +const( + MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE MQTT_RetainHandling = 0x0 + MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST MQTT_RetainHandling = 0x1 + MQTT_RetainHandling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE MQTT_RetainHandling = 0x2 +) + +var MQTT_RetainHandlingValues []MQTT_RetainHandling + +func init() { + _ = errors.New + MQTT_RetainHandlingValues = []MQTT_RetainHandling { + MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE, + MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST, + MQTT_RetainHandling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE, + } +} + +func MQTT_RetainHandlingByValue(value uint8) MQTT_RetainHandling { + switch value { + case 0x0: + return MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE + case 0x1: + return MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST + case 0x2: + return MQTT_RetainHandling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE + } + return 0 +} + +func MQTT_RetainHandlingByName(value string) MQTT_RetainHandling { + switch value { + case "SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE": + return MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE + case "SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST": + return MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST + case "DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE": + return MQTT_RetainHandling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE + } + return 0 +} + +func CastMQTT_RetainHandling(structType interface{}) MQTT_RetainHandling { + castFunc := func(typ interface{}) MQTT_RetainHandling { + if sMQTT_RetainHandling, ok := typ.(MQTT_RetainHandling); ok { + return sMQTT_RetainHandling + } + return 0 + } + return castFunc(structType) +} + +func (m MQTT_RetainHandling) LengthInBits() uint16 { + return 2 +} + +func (m MQTT_RetainHandling) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_RetainHandlingParse(readBuffer utils.ReadBuffer) (MQTT_RetainHandling, error) { + val, err := readBuffer.ReadUint8("MQTT_RetainHandling", 2) + if err != nil { + return 0, nil + } + return MQTT_RetainHandlingByValue(val), nil +} + +func (e MQTT_RetainHandling) Serialize(writeBuffer utils.WriteBuffer) error { + return writeBuffer.WriteUint8("MQTT_RetainHandling", 2, uint8(e), utils.WithAdditionalStringRepresentation(e.name())) +} + +func (e MQTT_RetainHandling) name() string { + switch e { + case MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE: + return "SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_THE_SUBSCRIBE" + case MQTT_RetainHandling_SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST: + return "SEND_RETAINED_MESSAGES_AT_SUBSCRIBE_ONLY_IF_THE_SUBSCRIPTION_DOES_NOT_CURRENTLY_EXIST" + case MQTT_RetainHandling_DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE: + return "DO_NOT_SEND_RETAINED_MESSAGES_AT_THE_TIME_OF_SUBSCRIBE" + } + return "" +} + +func (e MQTT_RetainHandling) String() string { + return e.name() +} + diff --git a/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_String.go b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_String.go new file mode 100755 index 00000000000..88be95c8bf1 --- /dev/null +++ b/sandbox/mqtt/mqtt-go/internal/plc4go/mqtt/readwrite/model/MQTT_String.go @@ -0,0 +1,147 @@ +/* + * 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 model + + +import ( + "github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils" + "github.com/pkg/errors" +) + + // Code generated by code-generation. DO NOT EDIT. + + +// The data-structure of this message +type MQTT_String struct { + Value string +} + +// The corresponding interface +type IMQTT_String interface { + LengthInBytes() uint16 + LengthInBits() uint16 + Serialize(writeBuffer utils.WriteBuffer) error +} + +func NewMQTT_String(value string) *MQTT_String { + return &MQTT_String{Value: value} +} + +func CastMQTT_String(structType interface{}) *MQTT_String { + castFunc := func(typ interface{}) *MQTT_String { + if casted, ok := typ.(MQTT_String); ok { + return &casted + } + if casted, ok := typ.(*MQTT_String); ok { + return casted + } + return nil + } + return castFunc(structType) +} + +func (m *MQTT_String) GetTypeName() string { + return "MQTT_String" +} + +func (m *MQTT_String) LengthInBits() uint16 { + return m.LengthInBitsConditional(false) +} + +func (m *MQTT_String) LengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Implicit Field (stringLength) + lengthInBits += 16 + + // Simple field (value) + lengthInBits += uint16(int32(STR_LEN(m.Value)) * int32(int32(8))) + + return lengthInBits +} + + +func (m *MQTT_String) LengthInBytes() uint16 { + return m.LengthInBits() / 8 +} + +func MQTT_StringParse(readBuffer utils.ReadBuffer) (*MQTT_String, error) { + if pullErr := readBuffer.PullContext("MQTT_String"); pullErr != nil { + return nil, pullErr + } + + // Implicit Field (stringLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content) + stringLength, _stringLengthErr := readBuffer.ReadUint16("stringLength", 16) + _ = stringLength + if _stringLengthErr != nil { + return nil, errors.Wrap(_stringLengthErr, "Error parsing 'stringLength' field") + } + + // Simple Field (value) +_value, _valueErr := readBuffer.ReadString("value", uint32(string(stringLength) * string((8)))) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := _value + + if closeErr := readBuffer.CloseContext("MQTT_String"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewMQTT_String(value), nil +} + +func (m *MQTT_String) Serialize(writeBuffer utils.WriteBuffer) error { + if pushErr :=writeBuffer.PushContext("MQTT_String"); pushErr != nil { + return pushErr + } + + // Implicit Field (stringLength) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content) + stringLength := uint16(STR_LEN(m.Value)) + _stringLengthErr := writeBuffer.WriteUint16("stringLength", 16, (stringLength)) + if _stringLengthErr != nil { + return errors.Wrap(_stringLengthErr, "Error serializing 'stringLength' field") + } + + // Simple Field (value) + value := string(m.Value) + _valueErr := writeBuffer.WriteString("value", uint32(string(STR_LEN(m.Value)) * string((8))), "UTF-8", (value)) + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("MQTT_String"); popErr != nil { + return popErr + } + return nil +} + +func (m *MQTT_String) String() string { + if m == nil { + return "" + } + buffer := utils.NewBoxedWriteBufferWithOptions(true, true) + m.Serialize(buffer) + return buffer.GetBox().String() +} + + + diff --git a/sandbox/plc4cpp/CMakeLists.txt b/sandbox/plc4cpp/CMakeLists.txt new file mode 100755 index 00000000000..ab33612c02b --- /dev/null +++ b/sandbox/plc4cpp/CMakeLists.txt @@ -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. +]] + +cmake_minimum_required(VERSION 3.7) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# Save the root directory +set(PLC4CPP_ROOT_DIR ${CMAKE_SOURCE_DIR}) +# Define some user-defined profiles +set(WITH_PROXIES OFF CACHE BOOL "Enable building Thrift based proxy driver") + +# Tell the tooling where to find our Boost installation +set(BOOST_INCLUDEDIR "${PLC4CPP_ROOT_DIR}/target/lib/boost/include") +set(BOOST_LIBRARYDIR "${PLC4CPP_ROOT_DIR}/target/lib/boost/lib") + +# Disable usage of Boost-CMake +set(Boost_NO_BOOST_CMAKE ON) +# Force CMake to use the boost version provided in BOOST_ROOT +set(Boost_NO_SYSTEM_PATHS ON) +set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_MULTITHREADED ON) +set(Boost_ARCHITECTURE "-x64") + +# Ensure the listed modules are found and environment variables for boost are set. +find_package(Boost COMPONENTS thread date_time system regex log) + +# Trace all CMAKE Variables +get_cmake_property(_variableNames VARIABLES) +list (SORT _variableNames) +foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") +endforeach() + +#[[ + Build all the modules of PLC4Cpp +]] +add_subdirectory(api) +add_subdirectory(protocols) +add_subdirectory(drivers) +add_subdirectory(utils) +add_subdirectory(examples) \ No newline at end of file diff --git a/sandbox/plc4cpp/Makefile b/sandbox/plc4cpp/Makefile new file mode 100755 index 00000000000..f2c61f74405 --- /dev/null +++ b/sandbox/plc4cpp/Makefile @@ -0,0 +1,75 @@ +# 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. +-include .env + +#VERSION := $(shell git describe --tags) +#BUILD := $(shell git rev-parse --short HEAD) +PROJECTNAME := $(shell basename "$(PWD)") + +# CPP related variables. + +# Mvn related variables +MVNBIN := ../../mvnw + +# Use linker flags to provide version/build settings +#LDFLAGS=-ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD)" + +# Redirect error output to a file, so we can show it in development mode. +STDERR := /tmp/.$(PROJECTNAME)-stderr.txt + +# Make is verbose in Linux. Make it silent. +MAKEFLAGS += --silent + +## install: Install missing dependencies. Runs `mvn verify` internally. +install: cpp-get + +## compile: Compile the binary. +compile: target + @-touch $(STDERR) + @-rm $(STDERR) + @-$(MAKE) -s cpp-compile 2> $(STDERR) + @cat $(STDERR) | sed -e '1s/.*/\nError:\n/' | sed 's/make\[.*/ /' | sed "/^/s/^/ /" 1>&2 + +## test: Runs test. Runs `mvn test` internally. +test: compile + $(MVNBIN) test + +## clean: Clean build files. Runs `mvn clean` internally. +clean: + @-$(MAKE) cpp-clean + +cpp-compile: cpp-get cpp-build + +cpp-get: + @echo " > Checking if there is any missing dependencies..." + $(MVNBIN) verify + +cpp-install: cpp-build + $(MVNBIN) install + +cpp-clean: + @echo " > Cleaning build cache" + $(MVNBIN) clean + +.PHONY: help +all: help +help: Makefile + @echo + @echo " Choose a command run in "$(PROJECTNAME)":" + @echo + @sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' + @echo diff --git a/sandbox/plc4cpp/README.md b/sandbox/plc4cpp/README.md new file mode 100755 index 00000000000..1680bfde34f --- /dev/null +++ b/sandbox/plc4cpp/README.md @@ -0,0 +1,47 @@ + +# Building PLC4CPP + +On mac and linux machines there should not be a requirement to install any prerequisites. +In general the build requires `gcc` being installed. + +On Windows machines, you might need to install it manually. +He have tested everything with the bundle of +http://win-builds.org/doku.php/download_and_installation_from_windows +When running the installer, make sure to select the options: +- Native Windows +- x86_64 +Not quite sure which elements are really needed, better just install all of them. +Make sure the `bin` directory containing the executable `mingw32-make.exe` is on your systems `PATH`. + +## Building PLC4CPP in Visual Studio + +1. Open Visual Studio (Tested with 2017 and 2019) +2. Open Local Directory +3. Select the `plc4cpp` subdirectory +4. Wait till the IDE is ready (little icon in the lower left corner) +5. Build everything by selecting the menu `Build/Build All` (or similar) + +## Building PLC4CPP in CLion + +1. Open CLion +2. Open Local Directory +3. Select the `plc4cpp` subdirectory +4. Wait till the IDE is ready (little icon in the lower center) +5. Build everything by selecting the menu `Build/Build All in Debug` (or similar) \ No newline at end of file diff --git a/sandbox/plc4cpp/api/CMakeLists.txt b/sandbox/plc4cpp/api/CMakeLists.txt new file mode 100755 index 00000000000..863384e098e --- /dev/null +++ b/sandbox/plc4cpp/api/CMakeLists.txt @@ -0,0 +1,71 @@ +#[[ + 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. +]] + +add_library(plc4cpp-api + src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp + src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp + src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp + src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcFieldRangeException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcNotImplementedException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/REQUEST.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.cpp + src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.cpp + src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.cpp + src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.cpp + src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.cpp + src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.cpp + src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.cpp + src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.cpp + src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.cpp + src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.cpp + src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.cpp + ) + +target_include_directories (plc4cpp-api PUBLIC ${Boost_INCLUDE_DIRS}) +target_include_directories (plc4cpp-api PUBLIC ../utils/logger/src/main/cpp) + +target_link_libraries (plc4cpp-api ${CMAKE_DL_LIBS}) \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcConnection.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcConnection.cpp new file mode 100755 index 00000000000..9c8a59f082b --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcConnection.cpp @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#include "PlcConnection.h" +#include "Logger.h" + +org.apache.plc4x.java.api + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + + PlcConnection::PlcConnection() : + _bOpen(false), + _pSendBuffer(NULL), + _pRecvBuffer(NULL), + _iSendBufferSize(0), + _iRecvBufferSize(0), + { + setSendBufferSize(DEFAULT_BUFFER_SIZE); + setRecvBufferSize(DEFAULT_BUFFER_SIZE); + _strErrorMessage = ""; + } + + PlcConnection::~PlcConnection() + { + if (_pSendBuffer != NULL) delete[] _pSendBuffer; + if (_pRecvBuffer != NULL) delete[] _pRecvBuffer; + } + + PlcField PlcConnection::prepareField(String fieldQuery) throws PlcInvalidFieldException + { + BOOST_THROW_EXCEPTION(PlcRuntimeException("Parse method is not implemented for this connection / driver")); + } + + void PlcConnection::setSendBufferSize(int iBufferSize) + { + if (iBlockSize != _iSendBufferSize) + { + _iSendBufferSize = iBlockSize; + if (_pSendBuffer != NULL) delete[] _pSendBuffer; + _pSendBuffer = new unsigned char[_iBlockSizeSend]; + } + } + + void PlcConnection::setRecvBufferSize(int iBufferSize) + { + if (iBlockSize != _iRecvBufferSize) + { + _iRecvBufferSize = iBufferSize; + if (_pRecvBuffer != NULL) delete[] _pRecvBuffer; + _pRecvBuffer = new unsigned char[_iBlockSizeReceive]; + } + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcConnection.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcConnection.h new file mode 100755 index 00000000000..95ed32c368a --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcConnection.h @@ -0,0 +1,169 @@ +/* + * 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. + */ +#ifndef _PLC_CONNECTION +#define _PLC_CONNECTION + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#define DEFAULT_BUFFER_SIZE 16384 + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + using namespace org::apache::plc4x::cpp::api::metadata; + using namespace org::apache::plc4x::cpp::api::messages; + using namespace org::apache::plc4x::cpp::utils; + + /** + * Interface defining the most basic methods a PLC4X connection should support. + * This generally handles the connection establishment itself and the parsing of + * field address strings to the platform dependent PlcField instances. + */ + class Message + { + public: + vector vecBuffer; + }; + + typedef shared_ptr type_shpMessage; + + typedef boost::signals2::signal type_sigConMessage; + typedef boost::signals2::signal type_sigConEventException; + + + class PlcConnection + { + public: + + PlcConnection(); + ~PlcConnection(); + + + /** + * Establishes the connection to the remote PLC. + * @throws PlcConnectionException if the connection attempt failed + */ + virtual void connect() = 0; + + /** + * Indicates if the connection is established to a remote PLC. + * @return {@code true} if connected, {@code false} otherwise + */ + + inline bool isConnected() const { return _bConnected; } + + /** + * Closes the connection to the remote PLC. + * @throws Exception if shutting down the connection failed + */ + virtual void close() = 0; + + /** + * Parse a fieldQuery for the given connection type. + * + * @throws PlcRuntimeException If the string cannot be parsed + */ + PlcField prepareField(std::string fieldQuery); + + /** + * Provides connection metadata. + */ + virtual PlcConnectionMetadata* getMetadata() = 0; + + /** + * Execute a ping query against a remote device to check the availability of the connection. + * + * @return CompletableFuture that is completed successfully (Void) or unsuccessfully with an PlcException. + */ + virtual void ping() = 0; + + /** + * Obtain read request builder. + * @throws PlcUnsupportedOperationException if the connection does not support reading + */ + virtual PlcReadRequest::Builder* readRequestBuilder() = 0; + + /** + * Obtain write request builder. + * @throws PlcUnsupportedOperationException if the connection does not support writing + */ + //virtual Builder* writeRequestBuilder() = 0; + + /** + * Obtain subscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + */ + //virtual Builder* subscriptionRequestBuilder() = 0; + + /** + * Obtain unsubscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + */ + //virtual Builder* unsubscriptionRequestBuilder() = 0; + + + virtual bool send(unsigned char* pBytesToSend, int iNumBytesToSend) = 0; + + inline int getSendBufferSize() const { return _iSendBufferSize; } + void setSendBufferSize(int iBufferSize); + + inline int getRecvBufferSize() const { return _iRecvBufferSize; } + void setRecvBufferSize(int iBlockSize); + + protected: + + virtual void onReceive(const boost::system::error_code& errorCode, std::size_t szRecvBytes) = 0; + + protected: + bool _bConnected; + unsigned char* _pSendBuffer; + int _iSendBufferSize; + unsigned char* _pRecvBuffer; + int _iRecvBufferSize; + std::string _strErrorMessage; + + boost::mutex _mtxComLock; + boost::condition_variable _condComHandler; + + DatDmp _dump; + + }; + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp new file mode 100755 index 00000000000..b28625395e9 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp @@ -0,0 +1,187 @@ +/* + * 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. + */ + +#include "PlcDriverManager.h" +#if defined (_WIN32) + #include +#elif (__linux__) || (defined (__APPLE__) && defined (__MACH__)) + #include +#endif + +#include +#include +#include + +namespace fs = boost::filesystem; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + PlcDriverManager::PlcDriverManager() + { + findDrivers(); + } + + PlcDriverManager::~PlcDriverManager() + { + } + + /** + * Connects to a PLC using the given plc connection string. + * + * @param url plc connection string. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + */ + PlcConnection* PlcDriverManager::getConnection(std::string url) + { + PlcDriver* pPlcDriver = NULL; + PlcConnection* pPlcConnection = NULL; + + pPlcDriver = getDriver(url); + if (pPlcDriver != NULL) + { + pPlcConnection = pPlcDriver->connect(url); + } + + return pPlcConnection; + } + + /** + * Connects to a PLC using the given plc connection string using given authentication credentials. + * + * @param url plc connection string. + * @param authentication authentication credentials. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + **/ + PlcConnection* PlcDriverManager::getConnection(std::string url, PlcAuthentication& authentication) + { + PlcDriver* pPlcDriver = NULL; + PlcConnection* pPlcConnection = NULL; + + pPlcDriver = getDriver(url); + if (pPlcDriver != NULL) + { + pPlcConnection = pPlcDriver->connect(url, authentication); + } + + return pPlcConnection; + } + + PlcDriver* PlcDriverManager::getDriver(std::string url) + { + PlcDriver* pPlcDriver = NULL; + std::string strProtocol = ""; + + try + { + boost::regex exFilter(REGEX_PROTOCOL.c_str()); + boost::smatch what; + + if (boost::regex_search(url, what, exFilter)) + { + if (what.size() > 1) + { + strProtocol = what[1].str(); + pPlcDriver = _mapDrivers[strProtocol]; + } + } + + if (pPlcDriver == NULL) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Unable to find driver for protocol '" + strProtocol + "'")); + } + } + catch (std::exception& ex) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Invalid plc4; connection string '" + url + "'", ex)); + } + + return pPlcDriver; + } + + void PlcDriverManager::findDrivers() + { + typedef PlcDriver* (*pfCreatePlcDriver)(); + pfCreatePlcDriver CreatePlcDriver; + + boost::regex exFilter(PLC_DRIVER_TEMPLATE); + boost::smatch what; + + for (fs::recursive_directory_iterator itDirFiles("./"); itDirFiles != fs::recursive_directory_iterator(); itDirFiles++) + { + if (boost::filesystem::is_regular_file(*itDirFiles)) + { + std::string strFilename = itDirFiles->path().filename().string(); + + if (boost::regex_search(strFilename, what, exFilter)) + { + std::string strDriverName = what[1].str(); + + try + { +#if defined (_WIN32) + HINSTANCE hdll = NULL; + hdll = LoadLibrary((itDirFiles->path().string().c_str())); + if (hdll != NULL) + { + CreatePlcDriver = (pfCreatePlcDriver)GetProcAddress(hdll, PLC_CREATE_DRIVER_INSTANCE.c_str()); +#elif defined (__linux__) || (defined (__APPLE__) && defined (__MACH__)) + void *hdll = NULL; + hdll = dlopen((itDirFiles->path().string().c_str()),RTLD_NOW); + if (hdll != NULL) + { + CreatePlcDriver = (pfCreatePlcDriver)dlsym(hdll, PLC_CREATE_DRIVER_INSTANCE.c_str()); +#endif + if (CreatePlcDriver != NULL) + { + PlcDriver* pPlcDriver = NULL; + + pPlcDriver = CreatePlcDriver(); + if (pPlcDriver != NULL) + { + _mapDrivers.insert(std::pair(pPlcDriver->getProtocolCode(), pPlcDriver)); + } + } + } + } + catch (...) + { + } + } + } + } + + if (_mapDrivers.size() == 0) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Unable to find drivers")); + } + + return; + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.h new file mode 100755 index 00000000000..3d9d1b3aed7 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifndef _PLC_DRIVER_MANAGER +#define _PLC_DRIVER_MANAGER +#include +#include +#include +#include +#include "./api/PlcConnection.h" +#include "./spi/PlcDriver.h" +#include "./api/exceptions/PlcConnectionException.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace org::apache::plc4x::cpp::spi; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + class PlcDriverManager + { + + public: + PlcDriverManager(); + + ~PlcDriverManager(); + + PlcConnection* getConnection(std::string url); + PlcConnection* getConnection(std::string url, PlcAuthentication& authentication); + + protected: + + private: + std::map _mapDrivers; + PlcDriver* getDriver(std::string url); + + void findDrivers(); + + const std::string PLC_DRIVER_TEMPLATE = "plc4cpp-driver-(.*)(.dll|.so)"; + const std::string PLC_CREATE_DRIVER_INSTANCE = "_CreatePlcDriverInstance"; + const std::string REGEX_PROTOCOL = "^(?.*)://"; + + + }; + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp new file mode 100755 index 00000000000..7c1320452d7 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#include "PlcConnection.h" +#include "exceptions/PlcRuntimeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + using namespace org::apache::plc4x::cpp::api::exceptions; + + PlcConnection::PlcConnection() : + _bConnected(false), + _pSendBuffer(nullptr), + _pRecvBuffer(nullptr), + _iSendBufferSize(0), + _iRecvBufferSize(0) + { + setSendBufferSize(DEFAULT_BUFFER_SIZE); + setRecvBufferSize(DEFAULT_BUFFER_SIZE); + _strErrorMessage = ""; + } + + PlcConnection::~PlcConnection() + { + if (_pSendBuffer != NULL) delete[] _pSendBuffer; + if (_pRecvBuffer != NULL) delete[] _pRecvBuffer; + } + + PlcField* PlcConnection::prepareField(std::string strFieldQuery) + { + BOOST_THROW_EXCEPTION(PlcRuntimeException("Parse method is not implemented for this connection / driver")); + } + + void PlcConnection::setSendBufferSize(int iBufferSize) + { + if (iBufferSize != _iSendBufferSize) + { + _iSendBufferSize = iBufferSize; + if (_pSendBuffer != NULL) delete[] _pSendBuffer; + _pSendBuffer = new unsigned char[_iSendBufferSize]; + } + } + + void PlcConnection::setRecvBufferSize(int iBufferSize) + { + if (iBufferSize != _iRecvBufferSize) + { + _iRecvBufferSize = iBufferSize; + if (_pRecvBuffer != NULL) delete[] _pRecvBuffer; + _pRecvBuffer = new unsigned char[_iRecvBufferSize]; + } + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h new file mode 100755 index 00000000000..707dac4063e --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h @@ -0,0 +1,160 @@ +/* + * 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. + */ +#ifndef _PLC_CONNECTION +#define _PLC_CONNECTION + +#include "metadata/PlcConnectionMetadata.h" +#include "../api/messages/PlcReadRequest.h" +#include "../api/messages/PlcWriteRequest.h" +#include "../api/messages/PlcSubscriptionRequest.h" +#include "../api/messages/PlcUnsubscriptionRequest.h" + +#include +#include +#include + +#define DEFAULT_BUFFER_SIZE 16384 + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + + using namespace boost::signals2; + using namespace org::apache::plc4x::cpp::api::metadata; + using namespace org::apache::plc4x::cpp::api::messages; + using namespace org::apache::plc4x::cpp::utils; + + /** + * Interface defining the most basic methods a PLC4X connection should support. + * This generally handles the connection establishment itself and the parsing of + * field address strings to the platform dependent PlcField instances. + */ + + class PlcConnection + { + public: + + PlcConnection(); + ~PlcConnection(); + + + /** + * Establishes the connection to the remote PLC. + * @throws PlcConnectionException if the connection attempt failed + */ + virtual void connect() = 0; + + /** + * Indicates if the connection is established to a remote PLC. + * @return {@code true} if connected, {@code false} otherwise + */ + + inline bool isConnected() const { return _bConnected; } + + /** + * Closes the connection to the remote PLC. + * @throws Exception if shutting down the connection failed + */ + virtual void close() = 0; + + /** + * Parse a fieldQuery for the given connection type. + * + * @throws PlcRuntimeException If the string cannot be parsed + */ + PlcField* prepareField(std::string strFieldQuery); + + /** + * Provides connection metadata. + */ + virtual PlcConnectionMetadata* getMetadata() = 0; + + /** + * Execute a ping query against a remote device to check the availability of the connection. + * + * @return CompletableFuture that is completed successfully (Void) or unsuccessfully with an PlcException. + */ + virtual void ping() = 0; + + /** + * Obtain read request builder. + * @throws PlcUnsupportedOperationException if the connection does not support reading + */ + virtual PlcReadRequest::Builder* readRequestBuilder() = 0; + + /** + * Obtain write request builder. + * @throws PlcUnsupportedOperationException if the connection does not support writing + */ + //virtual void Builder* writeRequestBuilder() = 0; + + /** + * Obtain subscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + */ + //virtual void Builder* subscriptionRequestBuilder() = 0; + + /** + * Obtain unsubscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + */ + //virtual void Builder* unsubscriptionRequestBuilder() = 0; + + + virtual bool send(unsigned char* pBytesToSend, int iNumBytesToSend) = 0; + + + inline int getSendBufferSize() const { return _iSendBufferSize; } + void setSendBufferSize(int iBufferSize); + + inline int getRecvBufferSize() const { return _iRecvBufferSize; } + void setRecvBufferSize(int iBlockSize); + + protected: + + virtual void onReceive(const boost::system::error_code& errorCode, std::size_t szRecvBytes) = 0; + + protected: + bool _bConnected; + unsigned char* _pSendBuffer; + int _iSendBufferSize; + unsigned char* _pRecvBuffer; + int _iRecvBufferSize; + std::string _strErrorMessage; + + boost::mutex _mtxComLock; + boost::condition_variable _condComHandler; + + DatDmp _dump; + + }; + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp new file mode 100755 index 00000000000..2e8b3c61c4c --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#include "PlcAuthentication.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace authentication + { + + /**--------------------------------------------------------------------- + * ctor + *---------------------------------------------------------------------*/ + PlcAuthentication::PlcAuthentication() + { + } + + PlcAuthentication::~PlcAuthentication() + { + // do nothing + } + } + } + } + } + } +} \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.h new file mode 100755 index 00000000000..ad378310adb --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#ifndef _PLC_AUTHENTICATION +#define _PLC_AUTHENTICATION + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace authentication + { + class PlcAuthentication + { + public: + PlcAuthentication(); + ~PlcAuthentication(); + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp new file mode 100755 index 00000000000..8b0f7387f25 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp @@ -0,0 +1,97 @@ +/* + * 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. + */ + +#include +#include "PlcUsernamePasswordAuthentication.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace authentication + { + /**--------------------------------------------------------------------- + * ctor + *---------------------------------------------------------------------*/ + PlcUsernamePasswordAuthentication::PlcUsernamePasswordAuthentication(std::string username, std::string password) + { + // Check isNull (Java) not required, is every time a valid string + this->_strUsername = username; + this->_strPassword = password; + } + PlcUsernamePasswordAuthentication::~PlcUsernamePasswordAuthentication() + { + // do nothing + } + /**--------------------------------------------------------------------- + * returns username + *---------------------------------------------------------------------*/ + std::string PlcUsernamePasswordAuthentication::getUsername() + { + return _strUsername; + } + + /**--------------------------------------------------------------------- + * returns password + *---------------------------------------------------------------------*/ + std::string PlcUsernamePasswordAuthentication::getPassword() + { + return _strPassword; + } + /**--------------------------------------------------------------------- + * Check for equality (identical object or identical values) + *---------------------------------------------------------------------*/ + bool PlcUsernamePasswordAuthentication::equals(PlcUsernamePasswordAuthentication& auth) + { + bool bResult = false; + + if ( (this == &auth) || ( (_strUsername.compare(auth.getUsername()) == 0) && (_strPassword.compare(auth.getPassword()) == 0) )) + { + return true; + } + + return bResult; + } + + std::string PlcUsernamePasswordAuthentication::toString() + { + return "PlcUsernamePasswordAuthentication{ username='" + _strUsername + '\'' + + ", password='" + "*****************" + '\'' + + '}'; + } + + int PlcUsernamePasswordAuthentication::hashCode() + { + boost::hash string_hash; + + return string_hash(_strUsername + _strPassword); + } + + } + } + } + } + } +} \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.h new file mode 100755 index 00000000000..6ecd182e842 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.h @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#ifndef _PLC_USERNAME_PASSWORD_AUTHENTICATION +#define _PLC_USERNAME_PASSWORD_AUTHENTICATION + +#include + +#include "PlcAuthentication.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace authentication + { + + class PlcUsernamePasswordAuthentication : public PlcAuthentication + { + public: + PlcUsernamePasswordAuthentication(std::string, std::string); + ~PlcUsernamePasswordAuthentication(); + + std::string getUsername(); + std::string getPassword(); + + bool equals(PlcUsernamePasswordAuthentication&); + std::string toString(); + int hashCode(); + + + protected: + std::string _strUsername; + std::string _strPassword; + }; + } + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp new file mode 100755 index 00000000000..f7243635922 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcConnectionException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + } + } + } + } + } +} \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.h new file mode 100755 index 00000000000..cf14aa7a0a2 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _PLC_CONNECTION_EXCEPTION +#define _PLC_CONNECTION_EXCEPTION + +#include "PlcException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + class PlcConnectionException : public PlcException + { + public: + PlcConnectionException(): PlcException() {} + explicit PlcConnectionException(const std::string& strMessage): PlcException(strMessage){} + PlcConnectionException(const std::string& strMessage, const std::exception& exException): PlcException(strMessage, exException){} + explicit PlcConnectionException(const std::exception& exException): PlcException(exException){} + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.cpp new file mode 100755 index 00000000000..63eaf1bcef9 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.cpp @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#include "PlcException.h" +#include "PlcNotImplementedException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + PlcException::PlcException() : + logic_error("error") + { + } + + PlcException::PlcException(const std::string& strMessage, const std::exception& exException) : + logic_error(strMessage) // message suppressed, as no matching constructor is available + { + } + + PlcException::PlcException(const std::exception& ex) : + logic_error("error") + { + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.h new file mode 100755 index 00000000000..2d76d47565e --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.h @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#ifndef _PLC_EXCEPTION +#define _PLC_EXCEPTION + +#include +#include +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + /** + * Most generic type of plc4x exception. All plc4x exceptions are derived from + * PlcException. + */ + class PlcException : public std::logic_error + { + public: + PlcException(); + explicit PlcException(const std::string& strMessage): std::logic_error(strMessage.c_str()) {} + PlcException(const std::string& strMessage, const std::exception& exException); + explicit PlcException(const std::exception& exException); + }; + } + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcFieldRangeException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcFieldRangeException.cpp new file mode 100755 index 00000000000..6c769723c87 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcFieldRangeException.cpp @@ -0,0 +1,45 @@ +/* + * 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. + */ + +#include "PlcFieldRangeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + PlcFieldRangeException::PlcFieldRangeException(int iMaxIndex, int iRequestedIndex) : + PlcRuntimeException("requested index of " + std::to_string(iRequestedIndex) + " is outside the valid range of 0 -" + std::to_string(iMaxIndex)) + { + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.cpp new file mode 100755 index 00000000000..f38f877f2fd --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.cpp @@ -0,0 +1,45 @@ +/* + * 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. + */ + +#include "PlcIncompatibleDatatypeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + PlcIncompatibleDatatypeException::PlcIncompatibleDatatypeException(const std::string& strDataTypeName, int iIndex) : + PlcRuntimeException("Incompatible Datatype" + strDataTypeName + " at index " + std::to_string(iIndex)) + { + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.h new file mode 100755 index 00000000000..709fc280cbf --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.h @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#ifndef _PLC_INCOMPATIBLE_DATATYPE_EXCEPTION +#define _PLC_INCOMPATIBLE_DATATYPE_EXCEPTION + +#include "PlcRuntimeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + class PlcIncompatibleDatatypeException : public PlcRuntimeException + { + public: + PlcIncompatibleDatatypeException(const std::string&, int); + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.cpp new file mode 100755 index 00000000000..413b3988662 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.cpp @@ -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. + */ + +#include "PlcInvalidFieldException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + PlcInvalidFieldException::PlcInvalidFieldException(const std::string& strFieldToBeParsed) : + PlcRuntimeException(strFieldToBeParsed + " invalid") + { + _strFieldToBeParsed = strFieldToBeParsed; + } + + PlcInvalidFieldException::PlcInvalidFieldException(const std::string& strFieldToBeParsed, const std::string& strPattern) : + PlcRuntimeException(strFieldToBeParsed + " doesn't match " + strPattern) + { + _strFieldToBeParsed = strFieldToBeParsed; + } + + PlcInvalidFieldException::PlcInvalidFieldException(const std::string& strFieldToBeParsed, const std::string& strPattern, const std::string& strReadablePattern) : + PlcRuntimeException(strFieldToBeParsed + " doesn't match " + strReadablePattern + '(' + strPattern + ')') + { + _strFieldToBeParsed = strFieldToBeParsed; + } + + std::string PlcInvalidFieldException::getFieldToBeParsed() + { + return _strFieldToBeParsed; + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.h new file mode 100755 index 00000000000..a47f1218d49 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.h @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#ifndef _PLC_INVALID_FIELD_EXCEPTION +#define _PLC_INVALID_FIELD_EXCEPTION + +#include "PlcRuntimeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + class PlcInvalidFieldException : public PlcRuntimeException + { + public: + explicit PlcInvalidFieldException(const std::string& strFieldToBeParsed); + PlcInvalidFieldException(const std::string& strFieldToBeParsed, const std::string& strPattern); + PlcInvalidFieldException(const std::string& strFieldToBeParsed, const std::string& strPattern, const std::string &strReadablePattern); + + std::string getFieldToBeParsed(); + + private: + std::string _strFieldToBeParsed; + }; + + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.cpp new file mode 100755 index 00000000000..3f5a9415cc7 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.cpp @@ -0,0 +1,41 @@ +/* + * 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. + */ + +#include "PlcIoException.h" +#include "PlcNotImplementedException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + } + } + } + } + } +} \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.h new file mode 100755 index 00000000000..101f2dad0be --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifndef _PLC_IO_EXCEPTION +#define _PLC_IO_EXCEPTION + +#include "PlcException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + /** + * Base exception for all IO related exceptions. + */ + class PlcIoException : public PlcException + { + public: + explicit PlcIoException(const std::string& strMessage): PlcException(strMessage) {} + PlcIoException(const std::string& strMessage, const std::exception &exException): PlcException(strMessage, exException){} + explicit PlcIoException(const std::exception& exException): PlcException(exException){} + }; + + } + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcNotImplementedException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcNotImplementedException.h new file mode 100755 index 00000000000..234c344d2f5 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcNotImplementedException.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _PLC_NOT_IMPLEMENTED_EXCEPTION +#define _PLC_NOT_IMPLEMENTED_EXCEPTION + +#include "PlcRuntimeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + /** + * indicates that a functionality is not implemented yet. + */ + class PlcNotImplementedException : public PlcRuntimeException + { + public: + explicit PlcNotImplementedException(const std::string& strMessage): PlcRuntimeException(strMessage){} + }; + } + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.cpp new file mode 100755 index 00000000000..87ace0d88cc --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcProtocolException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.h new file mode 100755 index 00000000000..d1acf03f525 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.h @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#ifndef _PLC_PROTOCOL_EXCEPTION +#define _PLC_PROTOCOL_EXCEPTION + +#include "PlcException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + /** + * Base exception for all protocol related exceptions. + * This is usually if the messages themselves are malformed, contain incorrect information or + * any other problems occur which are related to the protocol being implemented. + */ + class PlcProtocolException : public PlcException + { + public: + explicit PlcProtocolException(const std::string& strMessage): PlcException(strMessage){} + PlcProtocolException(const std::string& strMessage, const std::exception& exException): PlcException(strMessage, exException){}; + explicit PlcProtocolException(const std::exception& exException): PlcException(exException){} + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.cpp new file mode 100755 index 00000000000..11ba7aa691a --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.cpp @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#include "PlcProtocolPayloadTooBigException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + PlcProtocolPayloadTooBigException::PlcProtocolPayloadTooBigException(const std::string& strProtocolName, int iMaxSize, int iActualSize, std::vector vecPayload) : + PlcProtocolException("Payload for protocol '" + strProtocolName + "' with size " + std::to_string(iActualSize) + " exceeded allowed maximum of " + std::to_string(iMaxSize)) + { + _strProtocolName = strProtocolName; + _iMaxSize = iMaxSize; + _iActualSize = iActualSize; + _vecPayload = vecPayload; + } + + std::string PlcProtocolPayloadTooBigException::getProtocolName() + { + return _strProtocolName; + } + + int PlcProtocolPayloadTooBigException::getMaxSize() + { + return _iMaxSize; + } + + int PlcProtocolPayloadTooBigException::getActualSize() + { + return _iActualSize; + } + + std::vector PlcProtocolPayloadTooBigException::getPayload() + { + return _vecPayload; + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.h new file mode 100755 index 00000000000..e9c37a3da51 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.h @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifndef _PLC_PROTOCOL_PAYLOAD_TOO_BIG_EXCEPTION +#define _PLC_PROTOCOL_PAYLOAD_TOO_BIG_EXCEPTION + +#include +#include + +#include "PlcProtocolException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + class PlcProtocolPayloadTooBigException : public PlcProtocolException + { + public: + PlcProtocolPayloadTooBigException(const std::string& strProtocolName, int iMaxSize, int iActualSize, std::vector vecPayload); + + std::string getProtocolName(); + int getMaxSize(); + int getActualSize(); + std::vector getPayload(); + + private: + std::string _strProtocolName; + int _iMaxSize; + int _iActualSize; + std::vector _vecPayload; + }; + + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.cpp new file mode 100755 index 00000000000..b79422aad8c --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.cpp @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#include "PlcRuntimeException.h" +#include "PlcNotImplementedException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + PlcRuntimeException::PlcRuntimeException(const std::string& strMessage, const std::exception& exException) : + runtime_error(strMessage) // message suppressed, as no matching constructor is available + { + } + + PlcRuntimeException::PlcRuntimeException(const std::exception& exException) : + runtime_error("error") + { + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.h new file mode 100755 index 00000000000..00b12966b88 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.h @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#ifndef _PLC_RUNTIME_EXCEPTION +#define _PLC_RUNTIME_EXCEPTION + +#include +#include +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + /** + * Most generic type of plc4x runtime exception. All plc4x exceptions are derived from + * PlcException. + */ + class PlcRuntimeException : public std::runtime_error + { + public: + explicit PlcRuntimeException(const std::string& strMessage): std::runtime_error(strMessage.c_str()){} + PlcRuntimeException(const std::string& strMessage, const std::exception &exException); + explicit PlcRuntimeException(const std::exception& exException); + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.cpp new file mode 100755 index 00000000000..33fe8c773d2 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.cpp @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#include "PlcTimeoutException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + PlcTimeoutException::PlcTimeoutException(long lTimeout) : + PlcRuntimeException("Timeout reached after " + std::to_string(lTimeout) + "ns") + { + _lTimeout = lTimeout; + } + + long PlcTimeoutException::getTimeout() + { + return _lTimeout; + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.h new file mode 100755 index 00000000000..3ea11f9ccf9 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.h @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifndef _PLC_TIMEOUT_EXCEPTION +#define _PLC_TIMEOUT_EXCEPTION + +#include +#include + +#include "PlcRuntimeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + /** + * Can be thrown when something times out. + */ + class PlcTimeoutException : public PlcRuntimeException + { + public: + /** + * Indicates something timed out. + * + * @param timeout in nanoseconds. + */ + explicit PlcTimeoutException(long lTimeout); + + long getTimeout(); + + private: + /** + * @return the timeout in nanoseconds. + */ + long _lTimeout; + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.cpp new file mode 100755 index 00000000000..0aa7c05850a --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcUnsupportedDataTypeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.h new file mode 100755 index 00000000000..9f57ccb56af --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef _PLC_UNSUPPORTED_DATATYPE_EXCEPTION +#define _PLC_UNSUPPORTED_DATATYPE_EXCEPTION + +#include "PlcRuntimeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + /** + * Indicate that a data type ({@link Class}) is not supported by Plc4x. + */ + class PlcUnsupportedDataTypeException : public PlcRuntimeException + { + public: + explicit PlcUnsupportedDataTypeException(const std::string& strMessage): PlcRuntimeException(strMessage){} + PlcUnsupportedDataTypeException(const std::string& strMessage, const std::exception &exException): PlcRuntimeException(strMessage, exException){} + explicit PlcUnsupportedDataTypeException(const std::exception &exException): PlcRuntimeException(exException){} + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.cpp new file mode 100755 index 00000000000..6d8706f4553 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcUnsupportedOperationException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.h new file mode 100755 index 00000000000..aa3e4a688c6 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifndef _PLC_UNSUPPORTED_OPERATION_EXCEPTION +#define _PLC_UNSUPPORTED_OPERATION_EXCEPTION + +#include "PlcRuntimeException.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace exceptions + { + /** + * Indicate that a data type ({@link Class}) is not supported by Plc4x. + */ + class PlcUnsupportedOperationException : public PlcRuntimeException + { + public: + explicit PlcUnsupportedOperationException(const std::string& strMessage): PlcRuntimeException(strMessage) {} + PlcUnsupportedOperationException(const std::string& strMessage, const std::exception& exException): PlcRuntimeException(strMessage, exException){} + explicit PlcUnsupportedOperationException(const std::exception& exException): PlcRuntimeException(exException){} + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.cpp new file mode 100755 index 00000000000..dbc213c4232 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcFieldRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h new file mode 100755 index 00000000000..3862c67cdf5 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h @@ -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. + */ + +#ifndef _PLC_FIELD_REQUEST +#define _PLC_FIELD_REQUEST + +#include "../model/PlcField.h" +#include "PlcFieldResponse.h" + +#include +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Base type for all messages sent from the plc4x system to a connected plc. + */ + class PlcFieldRequest : public PlcRequest + { + public: + virtual int getNumberOfFields() = 0; + virtual std::vector getFieldNames(); + virtual PlcField* getField(std::string) = 0; + virtual std::vector getFields() = 0; + virtual std::map getNamedFields() = 0; + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp new file mode 100755 index 00000000000..a547f979ca7 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcFieldResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.h new file mode 100755 index 00000000000..fd688e8c5fc --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.h @@ -0,0 +1,67 @@ +/* + * 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. + */ + +#ifndef _PLC_FIELD_RESPONSE +#define _PLC_FIELD_RESPONSE + +#include "PlcResponse.h" +#include "../types/PlcResponseCode.h" +#include "../model/PlcField.h" + +#include +#include + +using namespace org::apache::plc4x::cpp::api::model; +using namespace org::apache::plc4x::cpp::api::types; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Base type for all response messages sent as response for a prior request + * from a plc to the plc4x system. + */ + class PlcFieldResponse : public PlcResponse + { + public: + virtual std::vector* getFieldNames() = 0; + virtual PlcField* getField(std::string& strName) = 0; + virtual PlcResponseCode* getresponseCode(std::string& strName) = 0; + virtual PlcRequest* getRequest() = 0; + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.cpp new file mode 100755 index 00000000000..eb95064685f --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcMessage.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.h new file mode 100755 index 00000000000..0c22620be44 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.h @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#ifndef _PLC_MESSAGE +#define _PLC_MESSAGE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Base type for all forms of messages passed between plc and plc4x system. + */ + class PlcMessage + { + public: + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp new file mode 100755 index 00000000000..5bad946e74b --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#include "PlcReadRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + PlcReadRequest::PlcReadRequest() + { + } + + PlcReadRequest::~PlcReadRequest() + { + // TODO Free Pointer eg. use Smartpointer ? + } + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h new file mode 100755 index 00000000000..66e906fbaee --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h @@ -0,0 +1,67 @@ +/* + * 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. + */ + +#ifndef _PLC_READ_REQUEST +#define _PLC_READ_REQUEST + +#include "PlcFieldRequest.h" +#include "PlcRequestBuilder.h" + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Request to read one or more values from a plc. + */ + class PlcReadRequest : public PlcFieldRequest + { + public: + PlcReadRequest(); + ~PlcReadRequest(); + + class Builder : public PlcRequestBuilder + { + public: + virtual PlcReadRequest* build() = 0; + virtual Builder* addItem(std::string& strName, std::string& strFieldQuery) = 0; + }; + + private: + + }; + + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp new file mode 100755 index 00000000000..197ec6964ed --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcReadRequestBuilder.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.h new file mode 100755 index 00000000000..bd1c0bf42f2 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.h @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#ifndef _PLC_READ_REQUEST_BUILDER +#define _PLC_READ_REQUEST_BUILDER + +#include "PlcRequestBuilder.h" + +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Base type for all forms of messages passed between plc and plc4x system. + */ + class PlcReadRequestBuilder : public PlcRequestBuilder + { + public: + virtual PlcReadRequestBuilder* addItem(std::string& strName, std::string& strFieldQuery) = 0; + + }; + + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp new file mode 100755 index 00000000000..c74e83fbf2c --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcReadResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.h new file mode 100755 index 00000000000..0c966bcb561 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.h @@ -0,0 +1,136 @@ +/* + * 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. + */ + +#ifndef _PLC_READ_RESPONSE +#define _PLC_READ_RESPONSE + +#include "PlcFieldResponse.h" +#include "PlcReadRequest.h" + +#include +#include "../types/ValueTypeObject.h" +#include + +using namespace boost::multiprecision; +using namespace org::apache::plc4x::cpp::api::types; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Response to a {@link PlcReadRequest}. + */ + class PlcReadResponse : PlcFieldResponse + { + public: + virtual PlcRequest* getRequest() = 0; + virtual int getNumberOfValues(std::string& strName) = 0; + virtual ValueTypeObject* getObject(std::string& strName) = 0; + virtual ValueTypeObject* getObject(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllObjects(std::string& strName) = 0; + virtual bool isValidBoolean(std::string& strName) = 0; + virtual bool isValidBoolean(std::string& strName, int& iIndex) = 0; + virtual bool getBoolean(std::string& strName) = 0; + virtual bool getBoolean(std::string& strName, int iIndex) = 0; + virtual std::vector* getAllBooleans(std::string& strName) = 0; + virtual bool isValidByte(std::string& strName) = 0; + virtual bool isValidByte(std::string& strName, int iIndex) = 0; + virtual char getByte(std::string& strName) = 0; + virtual char getByte(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllBytes(std::string& strName) = 0; + virtual bool isValidShort(std::string& strName) = 0; + virtual bool isValidShort(std::string& strName, int iIndex) = 0; + virtual short getShort(std::string& strName) = 0; + virtual short getShort(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllShorts(std::string& strName) = 0; + virtual bool isValidInteger(std::string& strName) = 0; + virtual bool isValidInteger(std::string& strName, int& iIndex) = 0; + virtual int getInteger(std::string& strName) = 0; + virtual int getInteger(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllIntegers(std::string& strName) = 0; + virtual bool isValidBigInteger(std::string& strName) = 0; + virtual bool isValidBigInteger(std::string& strName, int& iIndex) = 0; + virtual long long* getBigInteger(std::string& strName) = 0; + virtual long long* getBigInteger(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllBigIntegers(std::string& strName) = 0; + virtual bool isValidLong(std::string& strName) = 0; + virtual bool isValidLong(std::string& strName, int& iIndex) = 0; + virtual long getLong(std::string& strName) = 0; + virtual long getLong(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllLongs(std::string& strName) = 0; + virtual bool isValidFloat(std::string& strName) = 0; + virtual bool isValidFloat(std::string& strName, int& iIndex) = 0; + virtual float getFloat(std::string& strName) = 0; + virtual float getFloat(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllFloats(std::string& strName) = 0; + virtual bool isValidDouble(std::string& strName) = 0; + virtual double getDouble(std::string& strName) = 0; + virtual double getDouble(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllDoubles(std::string& strName) = 0; + virtual bool isValidBigDecimal(std::string& strName) = 0; + virtual cpp_dec_float_100 getBigDecimal(std::string& strName) = 0; + virtual cpp_dec_float_100 getBigDecimal(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllBigDecimals(std::string& strName) = 0; + virtual bool isValidString(std::string& strName) = 0; + virtual bool isValidString(std::string& strName, int& iIndex) = 0; + virtual std::string getString(std::string& strName) = 0; + virtual std::string getString(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllStrings(std::string& strName) = 0; + virtual bool isValidTime(std::string& strName) = 0; + virtual bool isValidTime(std::string& strName, int& iIndex) = 0; + virtual std::time_t getTime(std::string& strName) = 0; + virtual std::time_t getTime(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllTimes(std::string& strName) = 0; + virtual bool isValidDate(std::string& strName) = 0; + virtual bool isValidDate(std::string& strName, int& iIndex) = 0; + virtual tm& getDate(std::string& strName) = 0; + virtual tm& getDate(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllDates(std::string& strName)= 0; + virtual bool isValidDateTime(std::string& strName) = 0; + virtual bool isValidDateTime(std::string& strName, int& iIndex) = 0; + virtual tm* getDateTime(std::string& strName) = 0; + virtual tm* getDateTime(std::string& strName, int& iIndex) = 0; + virtual std::vector* getAllDateTimes(std::string& strName) = 0; + virtual bool isValidByteArray(std::string& strName) = 0; + virtual bool isValidByteArray(std::string& strName, int& iIndex) = 0; + virtual std::vector* getByteArray(std::string& strName) = 0; // Todo: Pointer to byte-array ??? + virtual std::vector* getByteArray(std::string& strName, int& iIndex) = 0; // Todo: Pointer to byte-array ??? + virtual std::vector*>* getAllByteArrays(std::string& strName) = 0; + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.cpp new file mode 100755 index 00000000000..dc7370dc8d8 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.h new file mode 100755 index 00000000000..f6c3e9bed81 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifndef _PLC_REQUEST +#define _PLC_REQUEST + +#include "PlcMessage.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Base type for all messages sent from the plc4x system to a connected plc. + */ + + class PlcRequest : PlcMessage + { + public: + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp new file mode 100755 index 00000000000..64a6e9e3a93 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcRequestBuilder.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h new file mode 100755 index 00000000000..9f9560dda7e --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef _PLC_REQUEST_BUILDER +#define _PLC_REQUEST_BUILDER + +#include "PlcRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Base type for all forms of messages passed between plc and plc4x system. + */ + class PlcRequestBuilder + { + public: + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.cpp new file mode 100755 index 00000000000..da1cfc289ea --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.h new file mode 100755 index 00000000000..831450fe275 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.h @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#ifndef _PLC_RESPONSE +#define _PLC_RESPONSE + +#include "PlcMessage.h" +#include "PlcRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * Base type for all response messages sent as response for a prior request + * from a plc to the plc4x system. + */ + class PlcResponse : PlcMessage + { + public: + virtual PlcRequest* getRequest() = 0; + + private: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.cpp new file mode 100755 index 00000000000..a8151fb19e6 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcSubscriptionEvent.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.h new file mode 100755 index 00000000000..41216944491 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.h @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#ifndef _PLC_SUBSCRIPTION_EVENT +#define _PLC_SUBSCRIPTION_EVENT + +#include "PlcReadResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * @return the timestamp at which this event occurred. + */ + class PlcSubscriptionEvent : public PlcReadResponse + { + public: + /** + * @return the timestamp at which this event occurred. + */ + virtual tm* getTimestamp() const = 0; + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.cpp new file mode 100755 index 00000000000..ec35e2bf13b --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcSubscriptionRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.h new file mode 100755 index 00000000000..c489b13781c --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.h @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifndef _PLC_SUBSCRIPTION_REQUEST +#define _PLC_SUBSCRIPTION_REQUEST + +#include "PlcReadResponse.h" +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * @return the timestamp at which this event occurred. + */ + class PlcSubscriptionRequest : public PlcRequestBuilder + { + public: + virtual PlcRequest* build() = 0; + + /** + * Adds a new field to the to be constructed request which should be polled cyclically. + * + * @param name alias of the field. + * @param fieldQuery field query string for accessing the field. + * @param pollingInterval interval, in which the field should be polled. + * @return builder. + */ + virtual void addCyclicField(std::string name, std::string fieldQuery, std::chrono::milliseconds pollingInterval) = 0; // Todo: check translation: Duration pollingInterval + + /** + * Adds a new field to the to be constructed request which should be updated as soon as + * a value changes in the PLC. + * + * @param name alias of the field. + * @param fieldQuery field query string for accessing the field. + * @return builder. + */ + virtual void addChangeOfStateField(std::string name, std::string fieldQuery) = 0; + + /** + * Adds a new subscription to the to be constructed request which should be updated + * as soon as an event occurs. + *

+ * REMARK: We will have to see if this signature is correct as soon as we start using this type of subscription. + * + * @param name alias of the field. + * @param fieldQuery field query string for accessing the field. + * @return builder. + */ + virtual void addEventField(std::string, std::string fieldQuery) = 0; + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.cpp new file mode 100755 index 00000000000..b12855e66e5 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcSubscriptionResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.h new file mode 100755 index 00000000000..27e2b09334a --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.h @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#ifndef _PLC_SUBSCRIPTION_RESPONSE +#define _PLC_SUBSCRIPTION_RESPONSE + +#include "PlcReadResponse.h" +#include "PlcSubscriptionRequest.h" +#include "../model/PlcSubscriptionHandle.h" +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + /** + * @return the timestamp at which this event occurred. + */ + class PlcSubscriptionResponse : public PlcReadResponse + { + public: + virtual PlcSubscriptionRequest* getRequest() const = 0; + + virtual PlcSubscriptionHandle* getSubscriptionHandle(std::string name) const = 0; + + virtual std::vector* getSubscriptionHandles() const = 0; + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.cpp new file mode 100755 index 00000000000..0dc2744ba54 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcUnsubscriptionRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.h new file mode 100755 index 00000000000..e4aab09c2f9 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.h @@ -0,0 +1,61 @@ +/* + * 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. + */ + +#ifndef _PLC_UNSUBSCRIPTION_REQUEST +#define _PLC_UNSUBSCRIPTION_REQUEST + +#include +#include "PlcRequest.h" +#include "../model/PlcSubscriptionHandle.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + class PlcUnsubscriptionRequest : public PlcRequest + { + + public: + virtual PlcRequest* build() = 0; + + // 1st approach to migrate builder pattern: Instead of Builder-object simple methods are used to handle inside the given parameters. + virtual void addHandles(PlcSubscriptionHandle* plcSubscriptionHandle) = 0; + + virtual void addHandles(PlcSubscriptionHandle* plcSubscriptionHandle1, std::vector plcSubscriptionHandles) = 0; + + virtual void addHandles(std::vector plcSubscriptionHandle) = 0; + + private: + }; + } + } + } + } + } +} +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.cpp new file mode 100755 index 00000000000..af8eacc9170 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcUnsubscriptionResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.h new file mode 100755 index 00000000000..99aeb4a7ad3 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef _PLC_UNSUBSCRIPTION_RESPONSE +#define _PLC_UNSUBSCRIPTION_RESPONSE + +#include "PlcUnsubscriptionRequest.h" +#include "PlcRequestBuilder.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + class PlcUnsubscriptionResponse : public PlcRequestBuilder + { + public: + + virtual PlcUnsubscriptionRequest* getRequest() const = 0; + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.cpp new file mode 100755 index 00000000000..a3531a15950 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcWriteRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.h new file mode 100755 index 00000000000..f29ad0a3d66 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.h @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#ifndef _PLC_WRITE_REQUEST +#define _PLC_WRITE_REQUEST + +#include "PlcFieldRequest.h" +#include +#include +#include + +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + class PlcWriteRequest : public PlcFieldRequest + { + // Todo: @override CompletableFuture execute(); + public: + virtual PlcWriteRequest* build() = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; + + virtual void addItem(std::string name, std::string fieldQuery, std::vector > values) = 0; + + //Todo: PlcWriteRequest.Builder addItem(String name, String fieldQuery, T... values); + /*template + virtual void addItem(std::string name, std::string fieldQuery, std::vector values) = 0; */ + + private: + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.cpp new file mode 100755 index 00000000000..a0a71ae0a36 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcWriteResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.h new file mode 100755 index 00000000000..32ed381424e --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _PLC_WRITE_RESPONSE +#define _PLC_WRITE_RESPONSE + +#include "PlcFieldResponse.h" +#include "PlcWriteRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + class PlcWriteResponse : PlcFieldResponse + { + public: + virtual PlcRequest* getRequest() = 0; + + private: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/REQUEST.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/REQUEST.cpp new file mode 100755 index 00000000000..68a6454a039 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/REQUEST.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "REQUEST.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.cpp new file mode 100755 index 00000000000..1688d00b8f1 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "RESPONSE.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.h new file mode 100755 index 00000000000..92747d7b1b3 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#ifndef _GENERIC_RESPONSE +#define _GENERIC_RESPONSE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + + class RESPONSE + { + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.cpp new file mode 100755 index 00000000000..c11071536af --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "RequestTemplate.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.h new file mode 100755 index 00000000000..a7fa9f62525 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#ifndef _PLC_REQUEST_TEMPLATE +#define _PLC_REQUEST_TEMPLATE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + template class RequestTemplate + { + public: + + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.cpp new file mode 100755 index 00000000000..2ed360763e6 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "ResponseTemplate.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.h new file mode 100755 index 00000000000..0f906e69843 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#ifndef _PLC_RESPONSE_TEMPLATE +#define _PLC_RESPONSE_TEMPLATE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace messages + { + template class ResponseTemplate + { + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.cpp new file mode 100755 index 00000000000..75f0cd2cab2 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "PlcConnectionMetadata.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace metadata + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.h new file mode 100755 index 00000000000..09b4d7824a9 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifndef _PLC_CONNECTION_META_DATA +#define _PLC_CONNECTION_META_DATA + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace metadata + { + + /** + * Information about connection capabilities. + * This includes connection and driver specific metadata. + */ + class PlcConnectionMetadata + { + public: + /** + * Indicates that the connection supports reading. + */ + virtual bool canRead() = 0; + + /** + * Indicates that the connection supports writing. + */ + virtual bool canWrite() = 0; + + /** + * Indicates that the connection supports subscription. + */ + virtual bool canSubscribe() = 0; + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.cpp new file mode 100755 index 00000000000..8852e785efe --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "Consumer.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.h new file mode 100755 index 00000000000..9b909970676 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.h @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#ifndef _PLC_CONSUMER +#define _PLC_CONSUMER + +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + /** + * helper class that implements java.util.function.Consumer + */ + template class Consumer + { + + public: + template + Consumer(consumer consume) : consume_(consume) {}; + + inline void Accept(T t) { consume_(t); }; + //inline void andthen(consumer c) {c.Accept(T)}; //TODO + private: + T innerType; + std::function consume_; + + }; + + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.cpp new file mode 100755 index 00000000000..772c75afcc5 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcConsumerRegistration.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.h new file mode 100755 index 00000000000..0fbc66c1272 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.h @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#ifndef _PLC_CONSUMER_REGISTRATION +#define _PLC_CONSUMER_REGISTRATION + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + class PlcConsumerRegistration + { + public: + virtual void unregister() = 0; + + private: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.cpp new file mode 100755 index 00000000000..abaff2c996a --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcField.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.h new file mode 100755 index 00000000000..4141aa368b1 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.h @@ -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. + */ + +#ifndef _PLC_FIELD +#define _PLC_FIELD + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + /** + * Base type for all field types. + * Typically every driver provides an implementation of this interface in order + * to be able to describe the fields of a resource. As this is completely tied to + * the implemented protocol, this base interface makes absolutely no assumption to + * any information it should provide. + * + * In order to stay platform and protocol independent every driver connection implementation + * provides a prepareField(String) method that is able to parse a string representation of + * a resource into it's individual field type. Manually constructing PlcField objects + * manually makes the solution less independent from the protocol, but might be faster. + */ + class PlcField + { + public: + + private: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.cpp new file mode 100755 index 00000000000..3bfcc45dfce --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcSubscriptionHandle.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.h new file mode 100755 index 00000000000..340fb686dc9 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.h @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#ifndef _PLC_SUBSCRIPTION_HANDLE +#define _PLC_SUBSCRIPTION_HANDLE + +#include "PlcConsumerRegistration.h" +#include "../messages/PlcSubscriptionEvent.h" +#include "Consumer.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace model + { + /** + * When subscribing to remote resources, depending on the used protocol + * different data is used to identify a subscription. This interface is + * to be implemented in the individual Driver implementations to contain + * all information needed to pull or unsubscribe any form of subscription. + *

+ * For every subscribed item, a separate {@link PlcSubscriptionHandle} object is + * returned in order to allow fine granular unsubscriptions. + */ + class PlcSubscriptionHandle + { + public: + virtual PlcConsumerRegistration* Register(Consumer consumer) = 0; + + private: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.cpp new file mode 100755 index 00000000000..a1a865af046 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcClientDataType.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace types + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.h new file mode 100755 index 00000000000..aeb927ca11e --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.h @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#ifndef _PLC_CLIENT_DATA_TYPE +#define _PLC_CLIENT_DATA_TYPE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace types + { + enum PlcClientDataType + { + BOOLEAN, + BYTE, + SHORT, + INTEGER, + LONG, + FLOAT, + DOUBLE, + STRING, + TIME, + DATE, + DATE_TIME + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.cpp new file mode 100755 index 00000000000..b4e2ecfa0eb --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcResponseCode.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace types + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.h new file mode 100755 index 00000000000..b58cf922178 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#ifndef _PLC_RESPONSE_CODE +#define _PLC_RESPONSE_CODE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace types + { + enum PlcResponseCode + { + OK, + NOT_FOUND, + INVALID_ADDRESS, + INVALID_DATATYPE, + INTERNAL_ERROR, + RESPONSE_PENDING + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.cpp new file mode 100755 index 00000000000..7f58beae72d --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcSubscriptionType.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace types + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.h new file mode 100755 index 00000000000..dd3b265296f --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.h @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#ifndef _PLC_SUBSCRIPTION_TYPE +#define _PLC_SUBSCRIPTION_TYPE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace types + { + enum PlcSubscriptionType + { + /** + * A cyclic subscription where a value is sent no matter if it's value changed in a given interval. + */ + CYCLIC, + + /** + * Only send data, if a value in the PLC changed. + */ + CHANGE_OF_STATE, + + /** + * Subscribe to events created by the PLC which usually are defined in the PLCs application (Alarms). + */ + EVENT + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.cpp new file mode 100755 index 00000000000..bc840ede271 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.cpp @@ -0,0 +1,41 @@ +/* + * 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. + */ + +#include "ValueTypeObject.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + + namespace types + { + } + + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.h new file mode 100755 index 00000000000..99725ee41bd --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.h @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#ifndef _PLC_VALUE_TYPE_OBJECT +#define _PLC_VALUE_TYPE_OBJECT + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace api + { + namespace types + { + // Base class vor value type objects + class ValueTypeObject + { + + public: + + }; + } + + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.cpp b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.cpp new file mode 100755 index 00000000000..ed985907d06 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.cpp @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#include "PlcDriver.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace spi + { + } + } + } + } +} diff --git a/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.h b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.h new file mode 100755 index 00000000000..d0fd7aefef0 --- /dev/null +++ b/sandbox/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.h @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifndef _PLC_DRIVER +#define _PLC_DRIVER + +#include "../api/PlcConnection.h" +#include "../api/authentication/PlcAuthentication.h" +#include + +using namespace org::apache::plc4x::cpp::api::authentication; +using namespace org::apache::plc4x::cpp::api; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace spi + { + /** + * Interface defining the most basic methods a PLC4X connection should support. + * This generally handles the connection establishment itself and the parsing of + * field address strings to the platform dependent PlcField instances. + */ + class PlcDriver + { + + public: + /** + * @return code of the implemented protocol. This is usually a lot shorter than the String returned by @see #getProtocolName(). + */ + virtual std::string getProtocolCode() = 0; + + /** + * @return name of the implemented protocol. + */ + virtual std::string getProtocolName() = 0; + + /** + * Connects to a PLC using the given plc connection string. + * @param url plc connection string. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + */ + virtual PlcConnection* connect(std::string url) = 0; + + /** + * Connects to a PLC using the given plc connection string using given authentication credentials. + * @param url plc connection string. + * @param authentication authentication credentials. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + */ + virtual PlcConnection* connect(std::string url, PlcAuthentication authentication) = 0; + + private: + }; + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/drivers/CMakeLists.txt b/sandbox/plc4cpp/drivers/CMakeLists.txt new file mode 100755 index 00000000000..f328136edae --- /dev/null +++ b/sandbox/plc4cpp/drivers/CMakeLists.txt @@ -0,0 +1,26 @@ +#[[ + 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. +]] + +# Only build the proxy module, if the "with-proxies" profile is enabled. +message(STATUS "With proxy = ${WITH_PROXIES}") +if(WITH_PROXIES) + add_subdirectory(proxy) +endif() + +add_subdirectory(s7) diff --git a/sandbox/plc4cpp/drivers/proxy/CMakeLists.txt b/sandbox/plc4cpp/drivers/proxy/CMakeLists.txt new file mode 100755 index 00000000000..5e023eb7d65 --- /dev/null +++ b/sandbox/plc4cpp/drivers/proxy/CMakeLists.txt @@ -0,0 +1,47 @@ +#[[ + 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. +]] + +# Collect all the generated files +aux_source_directory(../../target/generated-sources/drivers/proxy PROXY_GENERATED_SOURCES) + +message(STATUS "Found generated sources: ${PROXY_GENERATED_SOURCES}") + +add_library(plc4cpp-driver-proxy SHARED + src/main/cpp/org/apache/plc4x/cpp/proxy/dllexports.cpp + src/main/cpp/org/apache/plc4x/cpp/proxy/ProxyDriver.cpp + src/main/cpp/org/apache/plc4x/cpp/proxy/connection/ProxyConnection.cpp + ${PROXY_GENERATED_SOURCES} + ) + +target_include_directories (plc4cpp-driver-proxy PUBLIC ${Boost_INCLUDE_DIRS}) +target_include_directories (plc4cpp-driver-proxy PUBLIC ${PLC4CPP_ROOT_DIR}/target/lib/thrift/include/) +target_include_directories (plc4cpp-driver-proxy PUBLIC ../../api/src/main/cpp) +target_include_directories (plc4cpp-driver-proxy PUBLIC ../../protocols/driver-bases/base/src/main/cpp) +target_include_directories (plc4cpp-driver-proxy PUBLIC ../../protocols/s7/src/main/cpp) +target_include_directories (plc4cpp-driver-proxy PUBLIC ../../utils/logger/src/main/cpp) +target_include_directories (plc4cpp-driver-proxy PUBLIC ../../utils/systemconfig/src/main/cpp) + +target_link_libraries (plc4cpp-driver-proxy + ${Boost_LIBRARIES} + ${PLC4CPP_ROOT_DIR}/target/lib/thrift/lib/libparse.a ${PLC4CPP_ROOT_DIR}/target/lib/thrift/lib/libthrift.a ${PLC4CPP_ROOT_DIR}/target/lib/thrift/lib/libthriftz.a ${PLC4CPP_ROOT_DIR}/target/lib/thrift/lib/libtutorialgencpp.a + plc4cpp-utils-logger + plc4cpp-api + plc4cpp-protocols-driver-base-base + plc4cpp-utils-systemconfig + ) diff --git a/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/ProxyDriver.cpp b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/ProxyDriver.cpp new file mode 100755 index 00000000000..5af2ecd4bd2 --- /dev/null +++ b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/ProxyDriver.cpp @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#include "ProxyDriver.h" +#include "connection/ProxyConnection.h" +#include +#include + +using namespace std; +using namespace org::apache::plc4x::cpp::api::exceptions; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace proxy + { + string ProxyDriver::getProtocolCode() + { + return std::string("proxy"); + } + + + string ProxyDriver::getProtocolName() { + return "Proxy"; + } + + PlcConnection* ProxyDriver::connect(std::string url) + { + boost::regex exFilter(PROXY_URI_PATTERN.c_str()); + boost::smatch what; + + std::string strHost = ""; + std::string strParams = ""; + ProxyConnection* pProxyConnection = NULL; + + try + { + if (!boost::regex_search(url, what, exFilter)) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Connection url doesn't match the format 'proxy://{host|ip}'")); + } + + strHost = what[1].str(); // Host + strParams = what[2].str(); // Params + + // Resolve from Hostname to implements PlcConnection + pProxyConnection = new ProxyConnection(strHost, strParams); + } + catch (exception ex) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Error connecting to host", ex)); + } + + return pProxyConnection; + } + + + PlcConnection* ProxyDriver::connect(std::string url, PlcAuthentication authentication) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Proxy connections don't support authentication.")); + } + + + } + } + } + } +} diff --git a/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/ProxyDriver.h b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/ProxyDriver.h new file mode 100755 index 00000000000..d8f744118f8 --- /dev/null +++ b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/ProxyDriver.h @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#ifndef _PROXY_DRIVER +#define _PROXY_DRIVER + +#include +#include +#include + +using namespace org::apache::plc4x::cpp::spi; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace proxy + { + /** + * Interface defining the most basic methods a PLC4X connection should support. + * This generally handles the connection establishment itself and the parsing of + * field address strings to the platform dependent PlcField instances. + */ + class ProxyDriver : public PlcDriver + { + + public: + /** + * @return code of the implemented protocol. This is usually a lot shorter than the String returned by @see #getProtocolName(). + */ + virtual std::string getProtocolCode(); + + /** + * @return name of the implemented protocol. + */ + virtual std::string getProtocolName(); + + /** + * Connects to a PLC using the given plc connection string. + * @param url plc connection string. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + */ + virtual PlcConnection* connect(std::string url); + + /** + * Connects to a PLC using the given plc connection string using given authentication credentials. + * @param url plc connection string. + * @param authentication authentication credentials. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + */ + virtual PlcConnection* connect(std::string url, PlcAuthentication authentication); + + private: + + const std::string PROXY_URI_PATTERN="proxy://(?.*)(?\\?.*)?"; + + }; + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/connection/ProxyConnection.cpp b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/connection/ProxyConnection.cpp new file mode 100755 index 00000000000..be1de6c9db2 --- /dev/null +++ b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/connection/ProxyConnection.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#include "ProxyConnection.h" +#include +#include + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace proxy + { + ProxyConnection::ProxyConnection() + { + _lCloseDeviceTimeoutMS = CONF.getLong("plc4x.s7connection.close.device,timeout", 1000); + }; + + ProxyConnection::~ProxyConnection() + { + + }; + + ProxyConnection::ProxyConnection(std::string strHost, string strParams) + { + setIPAddress(strHost); + + string strMessage = "Setting up ProxyConnection with: host-name " + strHost; + LOG_INFO(strMessage); + + return; + } + + } + } + } + } +} diff --git a/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/connection/ProxyConnection.h b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/connection/ProxyConnection.h new file mode 100755 index 00000000000..c9b6ba77563 --- /dev/null +++ b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/connection/ProxyConnection.h @@ -0,0 +1,137 @@ +/* + * 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. + */ + +#ifndef _PROXY_CONNECTION +#define _PROXY_CONNECTION + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/** + * Class implementing the Connection handling for Siemens S7. + * The adressing of Values in S7 works as follows: + *

+ * For adressing values from Datablocks the following syntax is used: + *

+ *     DATA_BLOCKS/{blockNumer}/{byteOffset}
+ * 
+ *

+ * For adressing data from other memory segments like I/O, Markers, ... + *

+ *     {memory area}/{byte offset}
+ *     or
+ *     {memory area}/{byte offset}/{bit offset}
+ * 
+ * where the {bit-offset} is optional. + * All Available Memory Areas for this mode are defined in the {@link MemoryArea} enum. + */ + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace proxy + { + + using namespace org::apache::plc4x::cpp::api::metadata; + using namespace org::apache::plc4x::cpp::api::messages; + using namespace org::apache::plc4x::cpp::api; + using namespace org::apache::plc4x::cpp::base::connection; + using namespace org::apache::plc4x::cpp::utils; + + /** + * Interface defining the most basic methods a PLC4X connection should support. + * This generally handles the connection establishment itself and the parsing of + * field address strings to the platform dependent PlcField instances. + */ + class ProxyConnection : public BoostConnection + { + public: + + ProxyConnection(); + ProxyConnection(std::string strHost, string strParams); + + ~ProxyConnection(); + + void connect() {}; + + /** + * Provides connection metadata. + */ + PlcConnectionMetadata* getMetadata() { return NULL; }; + + /** + * Obtain read request builder. + * @throws PlcUnsupportedOperationException if the connection does not support reading + * Todo: implement pendant for java Builder pattern + */ + PlcReadRequest::Builder* readRequestBuilder() { return NULL; }; + + /** + * Obtain write request builder. + * @throws PlcUnsupportedOperationException if the connection does not support writing + * Todo: implement pendant for java Builder pattern (PlcWriteRequest.Builder) + */ + PlcWriteRequest* writeRequestBuilder() { return NULL; }; + + /** + * Obtain subscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder) + */ + PlcSubscriptionRequest* subscriptionRequestBuilder() { return NULL; }; + + /** + * Obtain unsubscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder) + + */ + PlcUnsubscriptionRequest* unsubscriptionRequestBuilder() { return NULL; }; + + void ping() {}; + + bool send(unsigned char* pBytesToSend, int iNumBytesToSend) { return true;}; + + void onReceive(const boost::system::error_code& errorCode, std::size_t szRecvBytes) {}; + + private: + + SystemConfiguration CONF; + + }; + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/dllexports.cpp b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/dllexports.cpp new file mode 100755 index 00000000000..78fc50ab08e --- /dev/null +++ b/sandbox/plc4cpp/drivers/proxy/src/main/cpp/org/apache/plc4x/cpp/proxy/dllexports.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +//-------- DllMain.cpp --------// +#include "dllexports.h" +#include "ProxyDriver.h" +#if defined (_WIN32) + #include +#endif + +using namespace org::apache::plc4x::cpp::proxy; +using namespace org::apache::plc4x::cpp::spi; + +#if defined (_WIN32) +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +#endif + +extern "C" PlcDriver* _CreatePlcDriverInstance() +{ + return new ProxyDriver; +} \ No newline at end of file diff --git a/sandbox/plc4cpp/drivers/s7/CMakeLists.txt b/sandbox/plc4cpp/drivers/s7/CMakeLists.txt new file mode 100755 index 00000000000..fc3289ee3be --- /dev/null +++ b/sandbox/plc4cpp/drivers/s7/CMakeLists.txt @@ -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. +]] + +add_library(plc4cpp-driver-s7 SHARED + src/main/cpp/org/apache/plc4x/cpp/s7/dllexports.cpp + src/main/cpp/org/apache/plc4x/cpp/s7/S7PlcDriver.cpp + src/main/cpp/org/apache/plc4x/cpp/s7/connection/S7PlcConnection.cpp + ) + +target_include_directories (plc4cpp-driver-s7 PUBLIC ${Boost_INCLUDE_DIRS}) +target_include_directories (plc4cpp-driver-s7 PUBLIC ../../api/src/main/cpp) +target_include_directories (plc4cpp-driver-s7 PUBLIC ../../protocols/driver-bases/base/src/main/cpp) +target_include_directories (plc4cpp-driver-s7 PUBLIC ../../protocols/s7/src/main/cpp) +target_include_directories (plc4cpp-driver-s7 PUBLIC ../../utils/logger/src/main/cpp) +target_include_directories (plc4cpp-driver-s7 PUBLIC ../../utils/systemconfig/src/main/cpp) + +target_link_libraries (plc4cpp-driver-s7 + ${Boost_LIBRARIES} + plc4cpp-utils-logger + plc4cpp-api + plc4cpp-protocols-driver-base-base + plc4cpp-utils-systemconfig + ) + +if(MINGW) + target_link_libraries (plc4cpp-driver-s7 ws2_32) +endif() diff --git a/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/S7PlcDriver.cpp b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/S7PlcDriver.cpp new file mode 100755 index 00000000000..f64a24b12a1 --- /dev/null +++ b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/S7PlcDriver.cpp @@ -0,0 +1,93 @@ +/* + * 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. + */ + +#include "S7PlcDriver.h" +#include "connection/S7PlcConnection.h" +#include +#include + +using namespace std; +using namespace org::apache::plc4x::cpp::api::exceptions; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace s7 + { + string S7PlcDriver::getProtocolCode() + { + return std::string("s7"); + } + + + string S7PlcDriver::getProtocolName() { + return "Siemens S7 (Basic)"; + } + + PlcConnection* S7PlcDriver::connect(std::string url) + { + boost::regex exFilter(S7_URI_PATTERN.c_str()); + boost::smatch what; + + std::string strHost = ""; + int iRack = -1; + int iSlot = -1; + std::string strParams = ""; + S7PlcConnection* pS7PlcConnection = NULL; + + try + { + if (!boost::regex_search(url, what, exFilter)) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Connection url doesn't match the format 's7://{host|ip}/{rack}/{slot}'")); + } + + strHost = what[1].str(); // Host + iRack = std::stoi(what[2].str()); // Rack + iSlot = std::stoi(what[3].str()); // Slot + strParams = what[4].str(); // Params + + // Resolve from Hostname to implements PlcConnection + pS7PlcConnection = new S7PlcConnection(strHost, iRack, iSlot, strParams); + } + catch (exception ex) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Error connecting to host", ex)); + } + + return pS7PlcConnection; + } + + + PlcConnection* S7PlcDriver::connect(std::string url, PlcAuthentication authentication) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Basic S7 connections don't support authentication.")); + } + + + } + } + } + } +} diff --git a/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/S7PlcDriver.h b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/S7PlcDriver.h new file mode 100755 index 00000000000..4baf9ae7612 --- /dev/null +++ b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/S7PlcDriver.h @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#ifndef _S7_PLC_DRIVER +#define _S7_PLC_DRIVER + +#include +#include +#include + +using namespace org::apache::plc4x::cpp::spi; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace s7 + { + /** + * Interface defining the most basic methods a PLC4X connection should support. + * This generally handles the connection establishment itself and the parsing of + * field address strings to the platform dependent PlcField instances. + */ + class S7PlcDriver : public PlcDriver + { + + public: + /** + * @return code of the implemented protocol. This is usually a lot shorter than the String returned by @see #getProtocolName(). + */ + virtual std::string getProtocolCode(); + + /** + * @return name of the implemented protocol. + */ + virtual std::string getProtocolName(); + + /** + * Connects to a PLC using the given plc connection string. + * @param url plc connection string. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + */ + virtual PlcConnection* connect(std::string url); + + /** + * Connects to a PLC using the given plc connection string using given authentication credentials. + * @param url plc connection string. + * @param authentication authentication credentials. + * @return PlcConnection object. + * @throws PlcConnectionException an exception if the connection attempt failed. + */ + virtual PlcConnection* connect(std::string url, PlcAuthentication authentication); + + private: + + const std::string S7_URI_PATTERN="s7://(?.*)/(?\\d{1,4})/(?\\d{1,4})(?\\?.*)?"; + + }; + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/connection/S7PlcConnection.cpp b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/connection/S7PlcConnection.cpp new file mode 100755 index 00000000000..c2d095cd0e2 --- /dev/null +++ b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/connection/S7PlcConnection.cpp @@ -0,0 +1,133 @@ +/* + * 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. + */ + +#include "S7PlcConnection.h" +#include +#include + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace s7 + { + S7PlcConnection::S7PlcConnection() + { + _lCloseDeviceTimeoutMS = CONF.getLong("plc4x.s7connection.close.device,timeout", 1000); + }; + + S7PlcConnection::~S7PlcConnection() + { + + }; + + S7PlcConnection::S7PlcConnection(std::string strHost, int iRack, int iSlot, string strParams) + { + setIPAddress(strHost); + setPort(_ISO_ON_TCP_PORT); + + _iRack = iRack; + _iSlot = iSlot; + + short sCurParamPduSize = 1024; + short sCurParamMaxAmqCaller = 8; + short sCurParamMaxAmqCallee = 8; + S7ControllerType curParamControllerType = S7ControllerType::ANY; + + if (strParams.length() > 0) + { + vector vecParams; + boost::split(vecParams, strParams, boost::is_any_of("&"), boost::token_compress_on); + for (vector::iterator itParams= vecParams.begin(); itParams < vecParams.end(); itParams++) + { + vector vecParamElements; + boost::split(vecParamElements, *itParams, boost::is_any_of("="), boost::token_compress_on); + string strParamName = vecParamElements[0]; + if (vecParamElements.size() == 2) + { + string strParamValue = vecParamElements[1]; + boost::algorithm::to_lower(strParamValue); + + if (strParamValue == "pdu-size") + { + sCurParamPduSize = boost::lexical_cast(strParamValue); + } + else if (strParamValue == "max-amq-caller") + { + sCurParamMaxAmqCaller = boost::lexical_cast(strParamValue); + } + else if (strParamValue == "max-amq-callee") + { + sCurParamMaxAmqCallee = boost::lexical_cast(strParamValue); + } + else if (strParamValue == "controller-type") + { + S7ControllerTypeMap s7ControllerTypeMap; + curParamControllerType = s7ControllerTypeMap[strParamValue]; + } + else + { + string strMessage = "Unknown parameter " + strParamName + " with value " + strParamValue; + LOG_DEBUG(strMessage); + } + } + else { + string strMessage = "Unknown no-value parameter " + strParamName; + LOG_DEBUG(strMessage); + } + } + } + + // It seems that the LOGO devices are a little picky about the pdu-size. + // Instead of handling this out, they just hang up without any error message. + // So in case of a LOGO controller, set this to a known working value. + if (curParamControllerType == S7ControllerType::LOGO && sCurParamPduSize == 1024) + { + sCurParamPduSize = 480; + } + + // IsoTP uses pre defined sizes. Find the smallest box, + // that would be able to contain the requested pdu size. + _sParamPduSize = sCurParamPduSize; + _sParamMaxAmqCaller = sCurParamMaxAmqCaller; + _sParamMaxAmqCallee = sCurParamMaxAmqCallee; + paramControllerType = curParamControllerType; + + string strMessage = "Setting up S7cConnection with: host-name " + strHost + + " rack " + std::to_string(_iRack) + " slot " + std::to_string(_iSlot) + + " pdu-size " + std::to_string(_sParamPduSize) + " slot " + std::to_string(_iSlot) + + " max-amq-caller " + std::to_string(_sParamMaxAmqCaller) + + " max-amq-callee " + std::to_string(_sParamMaxAmqCallee); + LOG_INFO(strMessage); + + return; + } + + + + } + } + } + } +} diff --git a/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/connection/S7PlcConnection.h b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/connection/S7PlcConnection.h new file mode 100755 index 00000000000..f3c89150f68 --- /dev/null +++ b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/connection/S7PlcConnection.h @@ -0,0 +1,149 @@ +/* + * 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. + */ + +#ifndef _S7_PLC_CONNECTION +#define _S7_PLC_CONNECTION + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/** + * Class implementing the Connection handling for Siemens S7. + * The adressing of Values in S7 works as follows: + *

+ * For adressing values from Datablocks the following syntax is used: + *

+ *     DATA_BLOCKS/{blockNumer}/{byteOffset}
+ * 
+ *

+ * For adressing data from other memory segments like I/O, Markers, ... + *

+ *     {memory area}/{byte offset}
+ *     or
+ *     {memory area}/{byte offset}/{bit offset}
+ * 
+ * where the {bit-offset} is optional. + * All Available Memory Areas for this mode are defined in the {@link MemoryArea} enum. + */ + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace s7 + { + + using namespace org::apache::plc4x::cpp::api::metadata; + using namespace org::apache::plc4x::cpp::api::messages; + using namespace org::apache::plc4x::cpp::api; + using namespace org::apache::plc4x::cpp::base::connection; + using namespace org::apache::plc4x::cpp::s7::types; + using namespace org::apache::plc4x::cpp::utils; + + /** + * Interface defining the most basic methods a PLC4X connection should support. + * This generally handles the connection establishment itself and the parsing of + * field address strings to the platform dependent PlcField instances. + */ + class S7PlcConnection : public BoostConnection + { + public: + + S7PlcConnection(); + S7PlcConnection(std::string strHost, int iRack, int iSlot, string strParams); + + ~S7PlcConnection(); + + void connect() {}; + + /** + * Provides connection metadata. + */ + PlcConnectionMetadata* getMetadata() { return NULL; }; + + /** + * Obtain read request builder. + * @throws PlcUnsupportedOperationException if the connection does not support reading + * Todo: implement pendant for java Builder pattern + */ + PlcReadRequest::Builder* readRequestBuilder() { return NULL; }; + + /** + * Obtain write request builder. + * @throws PlcUnsupportedOperationException if the connection does not support writing + * Todo: implement pendant for java Builder pattern (PlcWriteRequest.Builder) + */ + PlcWriteRequest* writeRequestBuilder() { return NULL; }; + + /** + * Obtain subscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder) + */ + PlcSubscriptionRequest* subscriptionRequestBuilder() { return NULL; }; + + /** + * Obtain unsubscription request builder. + * @throws PlcUnsupportedOperationException if the connection does not support subscription + * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder) + + */ + PlcUnsubscriptionRequest* unsubscriptionRequestBuilder() { return NULL; }; + + void ping() {}; + + bool send(unsigned char* pBytesToSend, int iNumBytesToSend) { return true;}; + + void onReceive(const boost::system::error_code& errorCode, std::size_t szRecvBytes) {}; + + private: + + const int _ISO_ON_TCP_PORT = 102; + + SystemConfiguration CONF; + + int _iRack; + int _iSlot; + + short _sParamPduSize; + short _sParamMaxAmqCaller; + short _sParamMaxAmqCallee; + S7ControllerType paramControllerType; + + }; + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/dllexports.cpp b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/dllexports.cpp new file mode 100755 index 00000000000..8ce1a76e0a4 --- /dev/null +++ b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/dllexports.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +//-------- DllMain.cpp --------// +#include "dllexports.h" +#include "S7PlcDriver.h" +#if defined (_WIN32) + #include +#endif + +using namespace org::apache::plc4x::cpp::s7; +using namespace org::apache::plc4x::cpp::spi; + +#if defined (_WIN32) +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +#endif + +extern "C" PlcDriver* _CreatePlcDriverInstance() +{ + return new S7PlcDriver; +} \ No newline at end of file diff --git a/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/dllexports.h b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/dllexports.h new file mode 100755 index 00000000000..f92b9053f2f --- /dev/null +++ b/sandbox/plc4cpp/drivers/s7/src/main/cpp/org/apache/plc4x/cpp/s7/dllexports.h @@ -0,0 +1,29 @@ +/* + * 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. + */ + +//-------- DllExports.h --------// +#ifndef _DLLEXPORTS_H +#define _DLLEXPORTS_H + +#include + +extern "C" /*__declspec(dllexport)*/ org::apache::plc4x::cpp::spi::PlcDriver* _CreatePlcDriverInstance(); + + +#endif // DLLEXPORTS_H \ No newline at end of file diff --git a/sandbox/plc4cpp/examples/CMakeLists.txt b/sandbox/plc4cpp/examples/CMakeLists.txt new file mode 100755 index 00000000000..e57acc600ca --- /dev/null +++ b/sandbox/plc4cpp/examples/CMakeLists.txt @@ -0,0 +1,20 @@ +#[[ + 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. +]] + +#add_subdirectory(hello-world-plc4x) diff --git a/sandbox/plc4cpp/examples/hello-world-plc4x/CMakeLists.txt b/sandbox/plc4cpp/examples/hello-world-plc4x/CMakeLists.txt new file mode 100755 index 00000000000..89c9041dbca --- /dev/null +++ b/sandbox/plc4cpp/examples/hello-world-plc4x/CMakeLists.txt @@ -0,0 +1,27 @@ +#[[ + 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. +]] + +add_executable(helloplc4x + src/main/cpp/org/apache/plc4x/cpp/examples/helloplc4x/helloplc4x.cpp) + +target_include_directories (helloplc4x PUBLIC ${Boost_INCLUDE_DIRS}) +target_include_directories (helloplc4x PUBLIC ../../api/src/main/cpp) +target_include_directories (helloplc4x PUBLIC ../../utils/logger/src/main/cpp) + +target_link_libraries (helloplc4x ${Boost_LIBRARIES} plc4cpp-driver-s7 plc4cpp-utils-logger plc4cpp-api) diff --git a/sandbox/plc4cpp/examples/hello-world-plc4x/src/main/cpp/org/apache/plc4x/cpp/examples/helloplc4x/helloplc4x.cpp b/sandbox/plc4cpp/examples/hello-world-plc4x/src/main/cpp/org/apache/plc4x/cpp/examples/helloplc4x/helloplc4x.cpp new file mode 100755 index 00000000000..565382dccde --- /dev/null +++ b/sandbox/plc4cpp/examples/hello-world-plc4x/src/main/cpp/org/apache/plc4x/cpp/examples/helloplc4x/helloplc4x.cpp @@ -0,0 +1,122 @@ +/* + * 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.examples.helloplc4x; +#include + +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace org::apache::plc4x::cpp; + +/** + * Example code do demonstrate using PLC4X. + * + * @param args ignored. + */ +int main(int argc, char *argv[]) +{ + /* CliOptions options = CliOptions.fromArgs(args); + if (options == null) { + CliOptions.printHelp(); + // Could not parse. + System.exit(1); + }*/ + + // Establish a connection to the plc using the url provided as first argument + try + { + + PlcDriverManager plcDriverManager; + //options.getConnectionString() + + PlcConnection* plcConnection = plcDriverManager.getConnection("s7://10.10.64.20/0/1"); + + // Check if this connection support reading of data. + /*if (!plcConnection.getMetadata().canRead()) { + logger.error("This connection doesn't support reading."); + return; + }*/ + + // Create a new read request: + // - Give the single item requested the alias name "value" + /*PlcReadRequest::Builder builder = plcConnection.readRequestBuilder(); + for (int i = 0; i < options.getFieldAddress().length; i++) { + builder.addItem("value-" + i, options.getFieldAddress()[i]); + } + PlcReadRequest readRequest = builder.build();*/ + + ////////////////////////////////////////////////////////// + // Read synchronously ... + // NOTICE: the ".get()" immediately lets this thread pause until + // the response is processed and available.*/ + LOG_INFO("Synchronous request ..."); + /*PlcReadResponse syncResponse = readRequest.execute().get(); + // Simply iterating over the field names returned in the response. + printResponse(syncResponse); + + ////////////////////////////////////////////////////////// + // Read asynchronously ... + // Register a callback executed as soon as a response arrives. + logger.info("Asynchronous request ..."); + CompletableFuture asyncResponse = readRequest.execute(); + asyncResponse.whenComplete((readResponse, throwable) -> { + if (readResponse != null) { + printResponse(readResponse); + } else { + logger.error("An error occurred: " + throwable.getMessage(), throwable); + } + }*/ + } + catch (...) + { + + } + + return 0; +} + +/*private static void printResponse(PlcReadResponse response) { + for (String fieldName : response.getFieldNames()) { + if(response.getResponseCode(fieldName) == PlcResponseCode.OK) { + int numValues = response.getNumberOfValues(fieldName); + // If it's just one element, output just one single line. + if(numValues == 1) { + logger.info("Value[" + fieldName + "]: " + response.getObject(fieldName)); + } + // If it's more than one element, output each in a single row. + else { + logger.info("Value[" + fieldName + "]:"); + for(int i = 0; i < numValues; i++) { + logger.info(" - " + response.getObject(fieldName, i)); + } + } + } + // Something went wrong, to output an error message instead. + else { + logger.error("Error[" + fieldName + "]: " + response.getResponseCode(fieldName).name()); + } + } +}*/ + + diff --git a/sandbox/plc4cpp/integrations/CMakeLists.txt b/sandbox/plc4cpp/integrations/CMakeLists.txt new file mode 100755 index 00000000000..d31743f4ddc --- /dev/null +++ b/sandbox/plc4cpp/integrations/CMakeLists.txt @@ -0,0 +1,21 @@ +#[[ + 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. +]] + +add_subdirectory(apache-mynewt) +add_subdirectory(edgex-foundry) \ No newline at end of file diff --git a/sandbox/plc4cpp/integrations/apache-mynewt/CMakeLists.txt b/sandbox/plc4cpp/integrations/apache-mynewt/CMakeLists.txt new file mode 100755 index 00000000000..693f98468f9 --- /dev/null +++ b/sandbox/plc4cpp/integrations/apache-mynewt/CMakeLists.txt @@ -0,0 +1,20 @@ +#[[ + 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. +]] + +# [[add_subdirectory(module-name) ]] diff --git a/sandbox/plc4cpp/integrations/edgex-foundry/CMakeLists.txt b/sandbox/plc4cpp/integrations/edgex-foundry/CMakeLists.txt new file mode 100755 index 00000000000..693f98468f9 --- /dev/null +++ b/sandbox/plc4cpp/integrations/edgex-foundry/CMakeLists.txt @@ -0,0 +1,20 @@ +#[[ + 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. +]] + +# [[add_subdirectory(module-name) ]] diff --git a/sandbox/plc4cpp/pom.xml b/sandbox/plc4cpp/pom.xml new file mode 100755 index 00000000000..d5cd0edd380 --- /dev/null +++ b/sandbox/plc4cpp/pom.xml @@ -0,0 +1,249 @@ + + + + + 4.0.0 + + + org.apache.plc4x.sandbox + plc4x-sandbox + 0.10.0-SNAPSHOT + + + plc4cpp + pom + + Sandbox: PLC4Cpp + Implementation of the protocol adapters for usage as C++ library. + + + + api/src/main/cpp,drivers/proxy/src/main/cpp,drivers/s7/src/main/cpp,protocols/driver-bases/base/src/main/cpp,protocols/s7/src/main/cpp,utils/logger/src/main/cpp,utils/systemconfig/src/main/cpp + OFF + + + + + + + + os-unix + + + unix + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + make-cmake-executable + process-sources + + exec + + + ${cmake.root} + chmod + + +x + cmake + + + + + + + + + + + os-mac + + + mac + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + make-cmake-executable + process-sources + + exec + + + ${cmake.root} + chmod + + +x + cmake + + + + + + + + + + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + + + get-cmake + generate-sources + + wget + + + ${cmake.url} + true + ${project.build.directory} + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + get-boost + generate-sources + + unpack + + + + + + org.apache.plc4x + plc4x-tools-boost + ${project.version} + zip + lib-${os.classifier} + ${project.build.directory}/lib/boost + + + + + + + + + com.googlecode.cmake-maven-project + cmake-maven-plugin + + + + cmake-generate + compile + + generate + + + + false + ${cmake.root} + + ${project.basedir} + + ${project.build.directory}/build + + ${cmake.generator} + + + + + + + + cmake-compile + compile + + compile + + + + false + ${cmake.root} + + ${project.build.directory}/build + + + + + + + + + + + org.apache.plc4x + plc4x-tools-boost + 0.10.0-SNAPSHOT + pom + provided + + + + \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/CMakeLists.txt b/sandbox/plc4cpp/protocols/CMakeLists.txt new file mode 100755 index 00000000000..2033f7646cf --- /dev/null +++ b/sandbox/plc4cpp/protocols/CMakeLists.txt @@ -0,0 +1,20 @@ +#[[ + 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. +]] + +add_subdirectory(driver-bases) diff --git a/sandbox/plc4cpp/protocols/driver-bases/CMakeLists.txt b/sandbox/plc4cpp/protocols/driver-bases/CMakeLists.txt new file mode 100755 index 00000000000..ef09343e535 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/CMakeLists.txt @@ -0,0 +1,20 @@ +#[[ + 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. +]] + +add_subdirectory(base) diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/CMakeLists.txt b/sandbox/plc4cpp/protocols/driver-bases/base/CMakeLists.txt new file mode 100755 index 00000000000..466a79b5a27 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/CMakeLists.txt @@ -0,0 +1,68 @@ +#[[ + 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. +]] + +add_library(plc4cpp-protocols-driver-base-base + src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp + src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.cpp + src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.cpp + src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.cpp + src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.cpp + src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectedEvent.cpp + src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectEvent.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/BaseDefaultFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigDecimalFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigIntegerFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBooleanFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteArrayFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultDoubleFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultFloatFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultIntegerFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateTimeFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalTimeFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLongFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultShortFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultStringFieldItem.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcReadRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcWriteRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryRequest.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryResponse.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcReader.cpp + src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcWriter.cpp + ) + +target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ${Boost_INCLUDE_DIRS}) +target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ../../../api/src/main/cpp) +target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ../../../protocols/driver-bases/base/src/main/cpp) +target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ../../../utils/logger/src/main/cpp) + +target_link_libraries (plc4cpp-protocols-driver-base-base + ${Boost_LIBRARIES} + plc4cpp-utils-logger + plc4cpp-api + ) diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp new file mode 100755 index 00000000000..364f4a4e14f --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#include "AbstractPlcConnection.h" +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + using namespace org::apache::plc4x::cpp::api::exceptions; + + PlcConnectionMetadata* AbstractPlcConnection::getMetadata() + { + return this; + } + bool AbstractPlcConnection::canRead() + { + return false; + } + bool AbstractPlcConnection::canWrite() + { + return false; + } + bool AbstractPlcConnection::canSubscribe() + { + return false; + } + + PlcReadRequest::Builder* AbstractPlcConnection::readRequestBuilder() + { + BOOST_THROW_EXCEPTION(PlcUnsupportedOperationException("The connection does not support reading")); + } + + + + /*@Override + public PlcWriteRequest.Builder writeRequestBuilder() { + throw new PlcUnsupportedOperationException("The connection does not support writing"); + } + + @Override + public PlcSubscriptionRequest.Builder subscriptionRequestBuilder() { + throw new PlcUnsupportedOperationException("The connection does not support subscription"); + } + + @Override + public PlcUnsubscriptionRequest.Builder unsubscriptionRequestBuilder() { + throw new PlcUnsupportedOperationException("The connection does not support subscription"); + }*/ + + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h new file mode 100755 index 00000000000..c6dc55c91e4 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#ifndef _ABSTRCT_PLC_HANDLER +#define _ABSTRCT_PLC_HANDLER + +#include +#include +#include + +using namespace org::apache::plc4x::cpp::api; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + /** + * Base class for implementing connections. + * Per default, all operations (read, write, subscribe) are unsupported. + * Concrete implementations should override the methods indicating connection capabilities + * and for obtaining respective request builders. + */ + class AbstractPlcConnection : public PlcConnection, PlcConnectionMetadata + { + + public: + PlcConnectionMetadata* getMetadata(); + bool canRead(); + bool canWrite(); + bool canSubscribe(); + + virtual void open() = 0; + virtual void close() = 0; + virtual bool send(unsigned char* pBytesToSend, int iNumBytesToSend) = 0; + + PlcReadRequest::Builder* readRequestBuilder(); + // PlcWriteRequest.Builder writeRequestBuilder(); + // PlcSubscriptionRequest.Builder subscriptionRequestBuilder(); + // PlcUnsubscriptionRequest.Builder nsubscriptionRequestBuilder(); + + protected: + virtual void onReceive(const boost::system::error_code& errorCode, std::size_t bytes_transferred) = 0; + private: + + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.cpp new file mode 100755 index 00000000000..54946b55cdd --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.cpp @@ -0,0 +1,504 @@ +/* + * 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. + */ + +#include "BoostConnection.h" +#include +#include +#include +#include +#include +#include + +#define CON_DEFAULT_IPADDRESS "127.0.0.1" +#define CON_DEFAULT_PORT_ 0 +#define CON_DEFAULT_TIMEOUT 2000 // Milliseconds + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + + using namespace boost; + using namespace boost::signals2; + using namespace org::apache::plc4x::cpp::utils; + using namespace org::apache::plc4x::cpp::api::exceptions; + + BoostConnection::BoostConnection() : + _pSocket(NULL), + _pWorker(NULL), + _pReceiveDispatcher_Thread(NULL), + _isReceiving(false), + _pClientThread(NULL), + _uiConnectionTimeout(CON_DEFAULT_TIMEOUT) + { + } + + BoostConnection::~BoostConnection() + { + if (_pSocket != NULL) + { + try + { + this->close(); + } + catch (std::exception& ex) + { + ExLog(1, ex, "BoostConnection::~BoostConnection() failed"); + } + } + } + + void BoostConnection::setIPAddress(string strIPAddress) + { + if (strIPAddress != _strIPAddress) + { + if (_bConnected) + { + _strErrorMessage = "Attempt to change the IP-Address " + strIPAddress + "of an already open connection"; + BOOST_THROW_EXCEPTION(PlcConnectionException(_strErrorMessage)); + } + else + { + try + { + if ((strIPAddress.length() >= 7) && (strIPAddress != _strIPAddress)) + { + _strIPAddress = strIPAddress; + resolveEndpoint(); + + ip::tcp::endpoint ep(ip::address::from_string(strIPAddress), _usPort); + _endpoint = ep; + } + } + catch (std::exception& ex) + { + BOOST_THROW_EXCEPTION(ExLog(1, ex, "BoostConnection::setIP_Address(string strIP_Address) failed")); + } + } + } + } + + void BoostConnection::setPort(unsigned short usPort) + { + if (_usPort != usPort) + { + if (_bConnected) + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Attempt to change the port of an already open communication")); + } + else + { + try + { + _usPort = usPort; + resolveEndpoint(); + + ip::tcp::endpoint ep(ip::address::from_string(_strIPAddress), _usPort); + _endpoint = ep; + } + catch (std::exception& ex) + { + BOOST_THROW_EXCEPTION(ExLog(1, ex, "BoostConnection::setPort(unsigned short port) failed")); + } + } + } + } + + void BoostConnection::setEndpoint(tcp::endpoint endpoint) + { + if (endpoint != _endpoint) + { + if (_bConnected) + { + _strErrorMessage = "Attempt to change the endpoint of an already open communication"; + _strErrorMessage = _strErrorMessage + "Setting Endpoint " + endpoint.address().to_string() + ":" + boost::lexical_cast((unsigned int)endpoint.port()) + " for BoostConnection object failed"; + BOOST_THROW_EXCEPTION(PlcConnectionException(_strErrorMessage)); + } + else + { + try + { + _endpoint = endpoint; + resolveEndpoint(); + } + catch (std::exception& ex) + { + BOOST_THROW_EXCEPTION(ExLog(1, ex, "BoostConnection::setEndpoint(tcp::endpoint endpoint) failed")); + } + } + } + } + + /**--------------------------------------------------------------------- + * Service Callback receive TCP Packets + *---------------------------------------------------------------------*/ + void BoostConnection::dispatchReceive() + { + _strErrorMessage = "Attempt to use BoostConnection::dispatchReceive of BoostConnection"; + LOG_INFO(_strErrorMessage); DEBUG_TRACE1("%s\n", _strErrorMessage.c_str()); + BOOST_THROW_EXCEPTION(PlcConnectionException(_strErrorMessage)); + } + + /**--------------------------------------------------------------------- + Connect TCP Socket + *---------------------------------------------------------------------*/ + void BoostConnection::connect() + { + try + { + + resolveEndpoint(); + + _endpoint = *_iterEndPoint; + + BoostConnection::close(); + + _io_service.reset(); + + if (_pSocket == NULL) _pSocket = new tcp::socket(_io_service); + + _pSocket->async_connect(_endpoint, boost::bind(&BoostConnection::onConnect, this, asio::placeholders::error, _iterEndPoint)); + + _pWorker = new io_service::work(_io_service); + _pClientThread = new boost::thread(boost::bind(&asio::io_service::run, &_io_service)); + + boost::mutex::scoped_lock lock(_mtxComLock); + _condComHandler.timed_wait(lock, boost::posix_time::milliseconds(_uiConnectionTimeout)); + + LOG_BOOL("Open BoostCommunication", _bConnected); + + if (_bConnected) + { + _pReceiveDispatcher_Thread = new boost::thread(boost::bind(&BoostConnection::dispatchReceive, this)); + } + else + { + BOOST_THROW_EXCEPTION(PlcConnectionException("Timeout while opening BoostConnection")); + } + + } + catch (std::exception& ex) + { + BoostConnection::close(); + + BOOST_THROW_EXCEPTION(ExLog(1, ex, "BoostConnection::connect() failed")); + } + } + + /**--------------------------------------------------------------------- + Close TCP Socket + *---------------------------------------------------------------------*/ + void BoostConnection::close() + { + + try + { + _bConnected = false; + + if ((_pClientThread != NULL) && (boost::this_thread::get_id() != _pClientThread->get_id())) + { + if (_pSocket != NULL) + { + _io_service.post(boost::bind(&asio::ip::tcp::socket::close, _pSocket)); + } + _io_service.post(boost::bind(&io_service::stop, &_io_service)); + + } + else + { + if (_pSocket != NULL) + { + _pSocket->close(); + } + _io_service.stop(); + } + + clearRessources(); + + } + catch (std::exception& ex) + { + clearRessources(); + + _bConnected = false; + + BOOST_THROW_EXCEPTION(ExLog(1, ex, "BoostConnection::close() failed")); + } + + return; + } + + /**--------------------------------------------------------------------- + Send Bytes via TCP Socket + *---------------------------------------------------------------------*/ + bool BoostConnection::send(unsigned char* pBytesToSend, int iBytesToSend) + { + bool bSuccess = false; + + boost::lock_guard lock(_mutexSend); + + if (_bConnected) + { + try + { + _pSocket->async_send(asio::buffer(pBytesToSend, iBytesToSend), + boost::bind(&BoostConnection::onSend, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred) + ); + + _dump.setLeadingNewLine(true); + std::string strTelegram = "\nBoostConnection TCP Telegram Send" + _dump.Show(pBytesToSend, iBytesToSend, " ** "); + LOG_TRACE(strTelegram.c_str()); DEBUG_TRACE1("%s", strTelegram.c_str()); + + bSuccess = true; + } + catch (std::exception& ex) + { + bSuccess = false; + BOOST_THROW_EXCEPTION(ExLog(1, ex, "BoostConnection::send() failed")); + } + } + return bSuccess; + } + + + void BoostConnection::ping() + { + try + { + /*(Socket s = new Socket()) + s.connect(address, PING_TIMEOUT_MS); + // TODO keep the address for a (timely) next request??? + s.setReuseAddress(true);*/ + } + catch (std::exception ex) + { + BOOST_THROW_EXCEPTION(ExLog(1, ex, "Unable to ping remote host")); + } + } + /**--------------------------------------------------------------------- + Free Ressources + *---------------------------------------------------------------------*/ + void BoostConnection::clearRessources() + { + try + { + + _io_service.reset(); + + if (_pReceiveDispatcher_Thread != NULL) + { + if (boost::this_thread::get_id() != _pReceiveDispatcher_Thread->get_id()) + { + _pReceiveDispatcher_Thread->interrupt(); + _pReceiveDispatcher_Thread->join(); + delete _pReceiveDispatcher_Thread; _pReceiveDispatcher_Thread = NULL; + } + } + + if (_pClientThread != NULL) + { + if (boost::this_thread::get_id() != _pClientThread->get_id()) + { + _pClientThread->interrupt(); + _pClientThread->join(); + delete _pClientThread; _pClientThread = NULL; + } + } + + if (_pWorker != NULL) + { + delete _pWorker; _pWorker = NULL; + } + + if (_pSocket != NULL) + { + delete _pSocket; _pSocket = NULL; + } + + } + catch (std::exception&) + { + + } + + return; + } + + /**--------------------------------------------------------------------- + Recieve next TCP Packets + *---------------------------------------------------------------------*/ + void BoostConnection::continueReceive() + { + _pSocket->async_receive( + asio::buffer(_pRecvBuffer, _iRecvBufferSize), + bind(&BoostConnection::onReceive, this, asio::placeholders::error, asio::placeholders::bytes_transferred) + ); + } + + /**--------------------------------------------------------------------- + Convert endpoint to String + *---------------------------------------------------------------------*/ + string BoostConnection::endPointToString(tcp::endpoint ep) + { + return string(ep.address().to_string() + ":" + boost::lexical_cast((unsigned short)ep.port())); + } + + /**--------------------------------------------------------------------- + Service Callback for Async-Send Result by OnSend + *---------------------------------------------------------------------*/ + void BoostConnection::onSend(const system::error_code& errorCode, std::size_t bytes_transferred) + { + if (errorCode != system::errc::success) + { + int iErrCode = errorCode.value(); + /*if (iErrCode != NO_ERROR) + { + // WSAECONNRESET = 10054, WSAECONNABORTED = 10053, EPIPE, ECONNABORTED indicates "broken Connection" + if (iErrCode == WSAECONNRESET || iErrCode == WSAECONNABORTED || iErrCode == EPIPE) + { + BoostConnection::close(); + } + + std::stringstream stm; + stm << boost::format("BoostConnection Send Error %i: %s") % iErrCode % errorCode.message(); + _strErrorMessage = stm.str(); + LOG_TRACE(_strErrorMessage.c_str()); DEBUG_TRACE1("%s", _strErrorMessage.c_str()); + // TODO: Signal + }*/ + } + } + + /**--------------------------------------------------------------------- + Service Callback , Receive Data via TCP + *---------------------------------------------------------------------*/ + void BoostConnection::onReceive(const system::error_code& errorCode, std::size_t bytes_transferred) + { + DEBUG_TRACE0("BoostConnection::onReceive() called\n"); + if (errorCode != system::errc::success && errorCode.value() != ENOENT) + { + int iErrCode = errorCode.value(); + /*if (iErrCode != NO_ERROR) + { + // WSAECONNRESET = 10054, WSAECONNABORTED = 10053, EPIPE, ECONNABORTED indicates "broken Connection" + if (iErrCode == WSAECONNRESET || iErrCode == WSAECONNABORTED || iErrCode == EPIPE) + { + BoostConnection::close(); + } + + std::stringstream stm; + stm << boost::format("BoostConnection Receive Error %i: %s") % iErrCode % errorCode.message(); + _strErrorMessage = stm.str(); + LOG_TRACE(_strErrorMessage.c_str()); DEBUG_TRACE1("%s", _strErrorMessage.c_str()); + // TODO: Signal + }*/ + } + } + + /**--------------------------------------------------------------------- + Resolve Endpoint + *---------------------------------------------------------------------*/ + void BoostConnection::resolveEndpoint() + { + try + { + tcp::resolver Resolver(_io_service); + tcp::resolver::query EndpointQuery(_strIPAddress, std::to_string(_usPort)); + _iterEndPoint = Resolver.resolve(EndpointQuery); + } + catch (std::exception& ex) + { + BOOST_THROW_EXCEPTION(ExLog(1, ex, "BoostConnection::resolveEndpoint() failed")); + } + } + + /**--------------------------------------------------------------------- + Service Callback open Connection Result + *---------------------------------------------------------------------*/ + void BoostConnection::onConnect(const system::error_code& errorCode, tcp::resolver::iterator endpointIterator) + { + + // Setzen des IsOpen auf true oder false + _bConnected = errorCode == system::errc::success; + + ++endpointIterator; + + if (!_bConnected && endpointIterator != tcp::resolver::iterator()) // connection failed, .. + { + try + { + // .. try the next endpoint in the list. + _pSocket->close(); + _endpoint = *endpointIterator; + _pSocket->async_connect(_endpoint, boost::bind(&BoostConnection::onConnect, this, asio::placeholders::error, endpointIterator)); + } + catch (std::exception& ex) + { + ExLog(1, ex, "BoostConnection::onConnect() Handler failed"); + } + } + else if (errorCode == system::errc::success) + { + bool bServiceStopped = _io_service.stopped(); + + try + { + _pSocket->async_receive( + asio::buffer(_pRecvBuffer, _iRecvBufferSize), + bind(&BoostConnection::onReceive, this, asio::placeholders::error, asio::placeholders::bytes_transferred) + ); + + } + catch (std::exception& ex) + { + ExLog(1, ex, "BoostConnection::onConnect() async_receive failed"); + } + + if (bServiceStopped) + { + LOG_INFO("Restarting Client Thread for BoostConnection OnConnect"); + + try + { + if (_pClientThread != NULL) delete _pClientThread; + _pClientThread = new boost::thread(bind(&asio::io_service::run, &_io_service)); + } + catch (std::exception& ex) + { + ExLog(1, ex, "BoostConnection::onConnect() failed"); + } + } + } + + _condComHandler.notify_all(); + + } + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.h new file mode 100755 index 00000000000..d73214d13d6 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.h @@ -0,0 +1,120 @@ +/* + * 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. + */ + +#ifndef _BOOST_COMMUNICATION +#define _BOOST_COMMUNICATION + +#include +#include +#include +#include +#include + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + using namespace boost::asio; + using namespace boost::asio::ip; + using namespace org::apache::plc4x::cpp::api; + + class BoostConnection: public PlcConnection + { + public: + + BoostConnection(); + + ~BoostConnection(); + + inline unsigned short getPort() { return _endpoint.port(); } + void setPort(unsigned short usPort); + + inline string getIPAddress() { return _strIPAddress; } + void setIPAddress(string strIPAddress); + + inline int getConnectionTimeout() { return _uiConnectionTimeout; } + void setConnectionTimeout(int uiConnectionTimeout) { _uiConnectionTimeout = uiConnectionTimeout; } + + inline tcp::endpoint getEndpoint() { return _endpoint; } + void setEndpoint(tcp::endpoint endpoint); + + inline bool getIsReceiving() { return _isReceiving; } + + virtual void connect(); + virtual void close(); + virtual bool send(unsigned char* pBytesToSend, int iBytesToSend); + + void ping(); + + protected: + + void clearRessources(); + + void resolveEndpoint(); + + virtual void onConnect(const boost::system::error_code& errorCode, tcp::resolver::iterator endpointIterator); + virtual void onSend(const boost::system::error_code& ErrorCode, std::size_t bytes_transferred); + virtual void onReceive(const boost::system::error_code& ErrorCode, std::size_t bytes_transferred); + virtual void dispatchReceive(); + + virtual void continueReceive(); + + string endPointToString(tcp::endpoint ep); + + protected: + io_service _io_service; + io_service::work* _pWorker; + boost::thread* _pReceiveDispatcher_Thread; + + tcp::endpoint _endpoint; + tcp::resolver::iterator _iterEndPoint; + tcp::socket* _pSocket; + address _ipAddress; + string _strIPAddress; + unsigned short _usPort; + unsigned int _uiConnectionTimeout; + long _lCloseDeviceTimeoutMS; + + boost::mutex _mutexSend; + boost::atomic _isReceiving; + + // General Properties + bool _bWriteInProgress; + boost::thread* _pClientThread; + + private: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.cpp new file mode 100755 index 00000000000..c34305dad10 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "ChannelFactory.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.h new file mode 100755 index 00000000000..0c21cbc2d76 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.h @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#ifndef _CHANNEL_FACTORY +#define _CHANNEL_FACTORY + +#include +#include +#include +#include + +#include + +using namespace boost::asio; +using namespace boost::asio::ip; +using boost::asio::ip::address; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + class ChannelFactory + { + + public: + virtual tcp::socket* createChannel() = 0; + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.cpp new file mode 100755 index 00000000000..3ed35e9c606 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.cpp @@ -0,0 +1,111 @@ +/* + * 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. + */ + +#include "DefaultPlcFieldHandler.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeBoolean(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/*Todo: +std::string((field)*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeByte(PlcField field, std::vector) + { + throw new PlcRuntimeException("Invalid encoder for type "/* Todo: + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeShort(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeInteger(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeBigInteger(PlcField field, std::vector) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeLong(PlcField field, std::vector) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeFloat(PlcField field, std::vector) + { + throw new PlcRuntimeException("Invalid encoder for type " /*+ field*/); + + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeBigDecimal(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeDouble(PlcField field, std::vector) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeString(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeTime(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeDate(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeDateTime(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + + BaseDefaultFieldItem* DefaultPlcFieldhandler::encodeByteArray(PlcField field, std::vector values) + { + throw new PlcRuntimeException("Invalid encoder for type "/* + field*/); + } + } + } + } + } + } +} + + diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.h new file mode 100755 index 00000000000..074a31b7ff4 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.h @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_PLC_FIELD_HANDLER +#define _DEFAULT_PLC_FIELD_HANDLER + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "PlcFieldHandler.h" +#include "../messages/items/BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::model; +using namespace org::apache::plc4x::cpp::base::messages::items; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + /** + * Base Implementation of {@link PlcFieldHandler} which throws a {@link PlcRuntimeException} for all + * encodeXXX methods. + */ + class DefaultPlcFieldhandler : public PlcFieldHandler + { + + public: + + BaseDefaultFieldItem* encodeBoolean(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeByte(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeShort(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeInteger(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeBigInteger(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeLong(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeFloat(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeBigDecimal(PlcField plcField,std::vector pValues) override; + + BaseDefaultFieldItem* encodeDouble(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeString(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeTime(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeDate(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeDateTime(PlcField plcField, std::vector pValues) override; + + BaseDefaultFieldItem* encodeByteArray(PlcField plcField, std::vector pValues) override; + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.cpp new file mode 100755 index 00000000000..43134ea1dad --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "PlcFieldHandler.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h new file mode 100755 index 00000000000..a0d5228b9ce --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h @@ -0,0 +1,99 @@ +/* + * 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. + */ + +#ifndef _PLC_FIELD_HANDLER +#define _PLC_FIELD_HANDLER + +#include +#include +#include +#include +#include + +#include +#include "../messages/items/BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::model; +using namespace org::apache::plc4x::cpp::base::messages; +using namespace org::apache::plc4x::cpp::base::messages::items; +using namespace boost::multiprecision; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace connection + { + /** + * Base class for implementing connections. + * Per default, all operations (read, write, subscribe) are unsupported. + * Concrete implementations should override the methods indicating connection capabilities + * and for obtaining respective request builders. + */ + class PlcFieldHandler + { + + public: + + virtual PlcField* createField(std::string strFieldQuery) = 0; + + virtual BaseDefaultFieldItem* encodeBoolean(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeByte(PlcField plcField, std::vector pValues)= 0; + + virtual BaseDefaultFieldItem* encodeShort(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeInteger(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeBigInteger(PlcField plcField,std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeLong(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeFloat(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem< cpp_dec_float_100>* encodeBigDecimal(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeDouble(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeString(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeTime(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeDate(PlcField plcField, std::vector pValues) = 0; + + virtual BaseDefaultFieldItem* encodeDateTime(PlcField plcField, std::vector pValues)= 0; + + virtual BaseDefaultFieldItem* encodeByteArray(PlcField fieplcFieldld,std::vector pValues) = 0; + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectEvent.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectEvent.cpp new file mode 100755 index 00000000000..c71803cb83a --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectEvent.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "ConnectEvent.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace events + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectEvent.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectEvent.h new file mode 100755 index 00000000000..a9c5494edc4 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectEvent.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#ifndef _CONNECT_EVENT +#define _CONNECT_EVENT + +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace events + { + + class ConnectEvent + { + }; + } + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectedEvent.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectedEvent.cpp new file mode 100755 index 00000000000..44e75aae573 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectedEvent.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "ConnectedEvent.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace events + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectedEvent.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectedEvent.h new file mode 100755 index 00000000000..45ea3f5514b --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/events/ConnectedEvent.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#ifndef _CONNECTED_EVENT +#define _CONNECTED_EVENT + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace events + { + + class ConnectedEvent + { + }; + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp new file mode 100755 index 00000000000..70fc764c11a --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp @@ -0,0 +1,144 @@ +/* + * 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. + */ + +#include "DefaultPlcReadRequest.h" + +using namespace org::apache::plc4x::cpp::api::model; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + // ========================================================= + DefaultPlcReadRequest::DefaultPlcReadRequest() + { + } + + // ========================================================= + DefaultPlcReadRequest::DefaultPlcReadRequest(PlcReader* plcReader, std::map mplcFields) + { + _plcReader = plcReader; + _mplcFields = mplcFields; + } + + // ==================================================== + PlcReader* DefaultPlcReadRequest::getReader() + { + return _plcReader; + } + + // ========================================================== + int DefaultPlcReadRequest::getNumberOfFields() + { + return _mplcFields.size(); + } + + // ========================================================= + PlcField* DefaultPlcReadRequest::getField(std::string strName) + { + PlcField* plcField = nullptr; + + std::map::iterator iterator = _mplcFields.find(strName); + + if (iterator != _mplcFields.end()) + { + plcField = iterator->second; + } + + return plcField; + } + + // ====================================================== + std::map DefaultPlcReadRequest::getNamedFields() + { + return std::map(); + } + + // ===================================================== + std::vector DefaultPlcReadRequest::getFields() + { + std::pair me; + std::vector vplcFields; + + BOOST_FOREACH(me, _mplcFields) + { + vplcFields.push_back(me.second); + } + + return vplcFields; + } + + // ========================================================= + std::vector DefaultPlcReadRequest::getFieldNames() + { + // TODO: check if already exists... + std::pair me; + std::vector vstrNames; + + BOOST_FOREACH(me, _mplcFields) + { + vstrNames.push_back(me.first); + } + + return vstrNames; + } + + DefaultPlcReadRequest::Builder::Builder(PlcReader* plcReader, PlcFieldHandler* plcFieldHandler) + { + _plcReader = plcReader; + _plcFieldHandler = plcFieldHandler; + } + + DefaultPlcReadRequest::Builder* DefaultPlcReadRequest::Builder::addItem(std::string strName, std::string strFieldQuery) + { + std::map::iterator iterator = _mFields.find(strName); + if (iterator != _mFields.end()) + { + BOOST_THROW_EXCEPTION(PlcRuntimeException("Duplicate field definition '" + strName + "'")); + } + _mFields.insert(std::pair(strName, strFieldQuery)); + return this; + } + + PlcReadRequest* DefaultPlcReadRequest::Builder::build() + { + std::map mParsedFields; + std::pair me; + + BOOST_FOREACH(me, _mFields) + { + PlcField* parsedField = _plcFieldHandler->createField(me.second); + mParsedFields.insert(std::pair(me.first, parsedField)); + } + return new DefaultPlcReadRequest(_plcReader, mParsedFields); + } + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h new file mode 100755 index 00000000000..1797425dacc --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h @@ -0,0 +1,100 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_PLC_READ_REQUEST +#define _DEFAULT_PLC_READ_REQUEST + +#include "InternalPlcReadRequest.h" +#include "InternalPlcFieldRequest.h" +#include "PlcReader.h" +#include +#include "../connection/PlcFieldHandler.h" + +#include +#include + + + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + using namespace org::apache::plc4x::cpp::api::messages; + using namespace org::apache::plc4x::cpp::base::connection; + + class DefaultPlcReadRequest : public InternalPlcReadRequest + { + public: + // Todo: + /*CompletableFuture execute() + { + return reader.read(this); + }*/ + + // Todo: implement java Builder-pattern for C++ + + DefaultPlcReadRequest(PlcReader* plcReader, std::map mplcFields); + int getNumberOfFields(); + std::vector getFieldNames(); + PlcField* getField(std::string name); + std::vector getFields(); + std::map getNamedFields(); + + class Builder + { + public: + Builder(PlcReader* plcReader, PlcFieldHandler* plcFieldHandler); + Builder* addItem(std::string strName, std::string strFieldQuery); + PlcReadRequest* build(); + + private: + PlcReader* _plcReader; + PlcFieldHandler* _plcFieldHandler; + std::map _mFields; + }; + + + protected: + + PlcReader* getReader(); + + + private: + + DefaultPlcReadRequest(); + PlcReader* _plcReader; + std::map _mplcFields; + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp new file mode 100755 index 00000000000..dedd609ce34 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp @@ -0,0 +1,117 @@ +/* + * 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. + */ + +#include "DefaultPlcWriteRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + // ========================================================= + DefaultPlcWriteRequest::DefaultPlcWriteRequest() + { + } + + // ========================================================= + DefaultPlcWriteRequest::DefaultPlcWriteRequest(PlcWriter* plcWriter, std::map mplcFields) + { + _plcWriter = plcWriter; + _mplcFields = mplcFields; + } + + // ==================================================== + PlcWriter* DefaultPlcWriteRequest::getWriter() + { + return _plcWriter; + } + + // ========================================================== + int DefaultPlcWriteRequest::getNumberOfFields() + { + return _mplcFields.size(); + } + + // ========================================================= + PlcField* DefaultPlcWriteRequest::getField(std::string strName) + { + PlcField* plcField = nullptr; + + std::map::iterator iterator = _mplcFields.find(strName); + + if (iterator != _mplcFields.end()) + { + plcField = iterator->second; + } + + return plcField; + + } + + // ====================================================== + std::map DefaultPlcWriteRequest::getNamedFields() + { + return std::map(); + } + + // ===================================================== + std::vector DefaultPlcWriteRequest::getFields() + { + std::pair me; + std::vector vplcFields; + + BOOST_FOREACH(me, _mplcFields) + { + vplcFields.push_back(me.second); + } + + return vplcFields; + } + + // ========================================================= + std::vector DefaultPlcWriteRequest::getFieldNames() + { + // TODO: check if already exists... + std::pair me; + std::vector vstrNames; + + BOOST_FOREACH(me, _mplcFields) + { + vstrNames.push_back(me.first); + } + + return vstrNames; + } + + + + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h new file mode 100755 index 00000000000..bdef5ffa594 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h @@ -0,0 +1,80 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_PLC_WRITE_REQUEST +#define _DEFAULT_PLC_WRITE_REQUEST + +#include "InternalPlcWriteRequest.h" +#include "InternalPlcFieldRequest.h" +#include "PlcWriter.h" + +#include +#include + +using namespace org::apache::plc4x::cpp::api::messages; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class DefaultPlcWriteRequest : public InternalPlcWriteRequest + { + public: + // Todo: + /*CompletableFuture execute() + { + return reader.read(this); + }*/ + + // Todo: implement java Builder-pattern for C++ + + DefaultPlcWriteRequest(PlcWriter* writer, std::map fields); + int getNumberOfFields(); + std::vector getFieldNames(); + PlcField* getField(std::string name); + std::vector getFields(); + std::map getNamedFields(); + // Todo: implement callback to: execute() { _writer.write(this); } + + protected: + PlcWriter* getWriter(); + + private: + DefaultPlcWriteRequest(); + PlcWriter* _plcWriter; + std::map _mplcFields; + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.cpp new file mode 100755 index 00000000000..14a82f7a5cb --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.cpp @@ -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. + */ + +#include "InternalPlcFieldRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + InternalPlcFieldRequest::InternalPlcFieldRequest() + { + } + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h new file mode 100755 index 00000000000..0dbafede528 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef _INTERNAL_PLC_FIELD_REQUEST +#define _INTERNAL_PLC_FIELD_REQUEST + +#include "InternalPlcRequest.h" +#include + +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class InternalPlcFieldRequest : public InternalPlcRequest, PlcFieldRequest + { + public: + virtual std::map getNamedFields() = 0; + InternalPlcFieldRequest(); + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldResponse.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldResponse.cpp new file mode 100755 index 00000000000..687a6ba64b3 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "InternalPlcFieldResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldResponse.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldResponse.h new file mode 100755 index 00000000000..4834dd873b5 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldResponse.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _INTERNAL_PLC_FIELD_RESPONSE +#define _INTERNAL_PLC_FIELD_RESPONSE + +#include + +using namespace org::apache::plc4x::cpp::api::messages; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class InternalPlcFieldResponse : public PlcFieldResponse + { + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryRequest.cpp new file mode 100755 index 00000000000..2a4d6d6c579 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryRequest.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "InternalPlcProprietaryRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryRequest.h new file mode 100755 index 00000000000..03c3073b5cd --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryRequest.h @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#ifndef _INTERNAL_PLC_PROPRIETARY_REQUEST +#define _INTERNAL_PLC_PROPRIETARY_REQUEST + +#include "PlcProprietaryRequest.h" +#include "InternalPlcRequest.h" + +using namespace org::apache::plc4x::cpp::api::messages; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + //template + class InternalPlcProprietaryRequest : public PlcProprietaryRequest, public InternalPlcRequest + { + public: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryResponse.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryResponse.cpp new file mode 100755 index 00000000000..a6ab62daf2f --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "InternalPlcProprietaryResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryResponse.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryResponse.h new file mode 100755 index 00000000000..780ee1bcd5e --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcProprietaryResponse.h @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#ifndef _INTERNAL_PLC_PROPRIETARY_RESPONSE +#define _INTERNAL_PLC_PROPRIETARY_RESPONSE + +#include "PlcProprietaryResponse.h" +#include "InternalPlcRequest.h" + +using namespace org::apache::plc4x::cpp::api::messages; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + //template + class InternalPlcProprietaryResponse : public PlcProprietaryResponse, public InternalPlcRequest + { + public: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcReadRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcReadRequest.cpp new file mode 100755 index 00000000000..9ff12e9a08f --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcReadRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "InternalPlcReadRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcReadRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcReadRequest.h new file mode 100755 index 00000000000..0a43b62e396 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcReadRequest.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef _INTERNAL_PLC_READ_REQUEST +#define _INTERNAL_PLC_READ_REQUEST + +#include +#include "InternalPlcFieldRequest.h" + +using namespace org::apache::plc4x::cpp::api::messages; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class InternalPlcReadRequest : public PlcReadRequest, public InternalPlcFieldRequest + { + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcRequest.cpp new file mode 100755 index 00000000000..af9340c1947 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "InternalPlcRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcRequest.h new file mode 100755 index 00000000000..98347213f3a --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcRequest.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _INTERNAL_PLC_REQUEST +#define _INTERNAL_PLC_REQUEST + +#include + +using namespace org::apache::plc4x::cpp::api::messages; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class InternalPlcRequest : public PlcRequest + { + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcResponse.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcResponse.cpp new file mode 100755 index 00000000000..75c6e01bc04 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "InternalPlcResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcResponse.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcResponse.h new file mode 100755 index 00000000000..1f494a2a75e --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcResponse.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _INTERNAL_PLC_RESPONSE +#define _INTERNAL_PLC_RESPONSE + +#include + +using namespace org::apache::plc4x::cpp::api::messages; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class InternalPlcResponse : public PlcResponse + { + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcWriteRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcWriteRequest.cpp new file mode 100755 index 00000000000..e5bfed1b44a --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcWriteRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "InternalPlcWriteRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcWriteRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcWriteRequest.h new file mode 100755 index 00000000000..a24df3eb76a --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcWriteRequest.h @@ -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. + */ + +#ifndef _INTERNAL_PLC_WRITE_REQUEST +#define _INTERNAL_PLC_WRITE_REQUEST + +#include +#include "./items/BaseDefaultFieldItem.h" +#include "InternalPlcFieldRequest.h" +#include +#include + +using namespace org::apache::plc4x::cpp::api::messages; +using namespace org::apache::plc4x::cpp::base::messages::items; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class InternalPlcWriteRequest : public PlcWriteRequest, public InternalPlcFieldRequest + { + public: + virtual ValueTypeObject getFieldItem(std::string name) = 0; + virtual std::vector getFieldItems(std::string name)= 0; + virtual std::tuple getNamedFieldTriples() = 0; + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryRequest.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryRequest.cpp new file mode 100755 index 00000000000..32dd6bab80a --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "PlcProprietaryRequest.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryRequest.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryRequest.h new file mode 100755 index 00000000000..65c12cd726e --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryRequest.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef _PLC_PROPRIETARY_REQUEST +#define _PLC_PROPRIETARY_REQUEST + +#include +#include +#include + +using namespace org::apache::plc4x::cpp::api::messages; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class PlcProprietaryRequest : public PlcRequest, public RequestTemplate + { + public: + virtual REQUEST getProprietaryRequest() = 0; + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryResponse.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryResponse.cpp new file mode 100755 index 00000000000..d4bfa2bf254 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryResponse.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include "PlcProprietaryResponse.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryResponse.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryResponse.h new file mode 100755 index 00000000000..b0a8121d6ed --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcProprietaryResponse.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef _PLC_PROPRIETARY_RESPONSE +#define _PLC_PROPRIETARY_RESPONSE + +#include +#include +#include + +using namespace org::apache::plc4x::cpp::api::messages; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + //template + class PlcProprietaryResponse : public PlcResponse, public ResponseTemplate + { + public: + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcReader.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcReader.cpp new file mode 100755 index 00000000000..45c62ebc64f --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcReader.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "PlcReader.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcReader.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcReader.h new file mode 100755 index 00000000000..b6b6e5c9a82 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcReader.h @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#ifndef _PLC_READER +#define _PLC_READER + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class PlcReader + { + // Todo: implement java-CompletableFuture + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcWriter.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcWriter.cpp new file mode 100755 index 00000000000..74c07afd9fe --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcWriter.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "PlcWriter.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcWriter.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcWriter.h new file mode 100755 index 00000000000..c6a9ccf066e --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/PlcWriter.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifndef _PLC_WRITER +#define _PLC_WRITER + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + + class PlcWriter + { + /** + * Writes a given value to a PLC. + * + * @param writeRequest object describing the type, location and value that whould be written. + * @return a {@link CompletableFuture} giving async access to the response of the write operation. + */ + // Todo: CompletableFuture write(PlcWriteRequest writeRequest); + public: + + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/BaseDefaultFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/BaseDefaultFieldItem.cpp new file mode 100755 index 00000000000..5f0d10043b3 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/BaseDefaultFieldItem.cpp @@ -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. + */ + +#include "BaseDefaultFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/BaseDefaultFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/BaseDefaultFieldItem.h new file mode 100755 index 00000000000..82f5c6f39bd --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/BaseDefaultFieldItem.h @@ -0,0 +1,136 @@ +/* + * 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. + */ + +#ifndef _BASE_DEFAULT_FIELD_ITEM +#define _BASE_DEFAULT_FIELD_ITEM + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace org::apache::plc4x::cpp::api::types; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + template + class BaseDefaultFieldItem : public ValueTypeObject + { + + public: + inline int getNumberOfValues() { return _values.length; } + virtual T getObject(int index) = 0; + inline bool isValidBoolean(int index) { return false; } + inline bool getBoolean(int index) { throw new PlcIncompatibleDatatypeException("bool", index); } + inline bool isValidByte(int index) { return false; } + inline char getByte(int index) { throw new PlcIncompatibleDatatypeException("byte", index); } + inline bool isValidShort(int index) { return false; } + inline short getShort(int index) { throw new PlcIncompatibleDatatypeException("short", index); } + inline bool isValidInteger(int index) { return false; } + inline int getInteger(int index) { throw new PlcIncompatibleDatatypeException("int", index); } + inline bool isValidLong(int index) { return false; } + inline long getLong(int index) { throw new PlcIncompatibleDatatypeException("long", index); } + inline bool isValidBigInteger(int index) { return false; } + inline long long getBigInteger(int index) { throw new PlcIncompatibleDatatypeException("long long", index); } + inline bool isValidFloat(int index) { return false; } + inline float getFloat(int index) { throw new PlcIncompatibleDatatypeException("float", index); } + inline bool isValidDouble(int index) { return false; } + inline double getDouble(int index) { throw new PlcIncompatibleDatatypeException("double", index); } + inline bool isValidBigDecimal(int index) { return false; } + inline long long getBigDecimal(int index) { throw new PlcIncompatibleDatatypeException("long long", index); } + inline bool isValidString(int index) { return false; } + inline std::string getString(int index) { throw new PlcIncompatibleDatatypeException("string", index); } + inline bool isValidTime(int index) { return false; } + inline tm* getTime(int index) { throw new PlcIncompatibleDatatypeException("tm*", index); } + inline bool isValidDate(int index) { return false; } + inline tm* getDate(int index) { throw new PlcIncompatibleDatatypeException("tm*", index); } + inline bool isValidDateTime(int index) { return false; } + inline tm* getDateTime(int index) { throw new PlcIncompatibleDatatypeException("tm*", index); } + inline bool isValidByteArray(int index) { return false; } + inline char* getByteArray(int index) { throw new PlcIncompatibleDatatypeException("char", index); } + inline std::vector* getValues() { return &_values; } + inline int hashCode() { return int_hash(_values); } // Todo: @Override + inline std::string toString() // Todo: @Override + { + return "BaseDefaultFielditem { values=" + std::string(_values) + "}"; + }; + + // Todo: add methods for unsigned data types? + + /* Todo: + @Override + bool equals(Object o) + { + if (this == o) + { + return true; + } + if (!(o instanceof BaseDefaultFieldItem)) + { + return false; + } + BaseDefaultFieldItem< ? > fieldItem = (BaseDefaultFieldItem< ? >) o; + return Arrays.equals(values, fieldItem.values); + }*/ + + protected: + //BaseDefaultFieldItem() { this._values = new array(0); } + inline BaseDefaultFieldItem(T* values) { _values = values; } + inline T getValue(unsigned int index) + { + if ((index < 0 || (index >= _values.size()))) + { + throw new PlcFieldRangeException((_values.size() == 0) ? -1 : _values.size() - 1, index); + } + return _values[index]; + } + + std::vector _values; + }; + } + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigDecimalFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigDecimalFieldItem.cpp new file mode 100755 index 00000000000..91ca3723e04 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigDecimalFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultBigDecimalFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultBigDecimalFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index) == 1; + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidByte(int index) + { + cpp_dec_float_100 value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultBigDecimalFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidShort(int index) + { + cpp_dec_float_100 value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultBigDecimalFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidInteger(int index) + { + cpp_dec_float_100 value = getValue(index); + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultBigDecimalFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidLong(int index) + { + cpp_dec_float_100 value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultBigDecimalFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultBigDecimalFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidFloat(int index) + { + cpp_dec_float_100 value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultBigDecimalFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidDouble(int index) + { + cpp_dec_float_100 value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultBigDecimalFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultBigDecimalFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultBigDecimalFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigDecimalFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigDecimalFieldItem.h new file mode 100755 index 00000000000..7d205ca4009 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigDecimalFieldItem.h @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_BIG_DECIMAL_FIELD_ITEM +#define _DEFAULT_BIG_DECIMAL_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + + class DefaultBigDecimalFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultBigDecimalFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return getValue(index) <= 1 && getValue(index) >= 0; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigIntegerFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigIntegerFieldItem.cpp new file mode 100755 index 00000000000..f2e129ce906 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigIntegerFieldItem.cpp @@ -0,0 +1,201 @@ +/* + * 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. + */ + +#include "DefaultBigIntegerFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultBigIntegerFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index) == 1; + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidByte(int index) + { + long long value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultBigIntegerFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + + long long value = getValue(index); + + return (char) getValue(index); + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidShort(int index) + { + long long value = getValue(index); + + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultBigIntegerFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidInteger(int index) + { + long long value = getValue(index); + + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultBigIntegerFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidLong(int index) + { + long long value = getValue(index); + + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultBigIntegerFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultBigIntegerFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO InfInt + return (long)getValue(index); + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidFloat(int index) + { + long long value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultBigIntegerFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidDouble(int index) + { + long long value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultBigIntegerFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultBigIntegerFieldItem::isValidBigDecimal(int index) + { + return true; + } + + // =================================================== + cpp_dec_float_100 DefaultBigIntegerFieldItem::getBigDecimal(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigIntegerFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigIntegerFieldItem.h new file mode 100755 index 00000000000..7bc6759b0c6 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBigIntegerFieldItem.h @@ -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. + */ + +#ifndef _DEFAULT_BIG_INTEGER_FIELD_ITEM +#define _DEFAULT_BIG_INTEGER_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + + class DefaultBigIntegerFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultBigIntegerFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + + inline bool isValidBoolean(int index) { return getValue(index) <= 1 && getValue(index) >= 0; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif + diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBooleanFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBooleanFieldItem.cpp new file mode 100755 index 00000000000..b36300cca1d --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBooleanFieldItem.cpp @@ -0,0 +1,189 @@ +/* + * 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. + */ + +#include "DefaultBooleanFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultBooleanFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidByte(int index) + { + return true; + } + + // =================================================== + char DefaultBooleanFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidShort(int index) + { + return true; + } + + // =================================================== + short DefaultBooleanFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidInteger(int index) + { + return true; + } + + // =================================================== + int DefaultBooleanFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidLong(int index) + { + return true; + } + + // =================================================== + long DefaultBooleanFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultBooleanFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidFloat(int index) + { + return true; + } + + // =================================================== + float DefaultBooleanFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidDouble(int index) + { + return true; + } + + // =================================================== + double DefaultBooleanFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultBooleanFieldItem::isValidBigDecimal(int index) + { + return true; + } + + // =================================================== + cpp_dec_float_100 DefaultBooleanFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBooleanFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBooleanFieldItem.h new file mode 100755 index 00000000000..5047c9f3df3 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultBooleanFieldItem.h @@ -0,0 +1,80 @@ +/* + * 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. + */ +#ifndef _DEFAULT_BIG_BOOLEAN_FIELD_ITEM +#define _DEFAULT_BIG_BOOLEAN_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultBooleanFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultBooleanFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteArrayFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteArrayFieldItem.cpp new file mode 100755 index 00000000000..3e65021a674 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteArrayFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultByteArrayFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultByteArrayFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidByte(int index) + { + char value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultByteArrayFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidShort(int index) + { + char value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultByteArrayFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidInteger(int index) + { + char value = getValue(index); + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultByteArrayFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidLong(int index) + { + char value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultByteArrayFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultByteArrayFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO InfInt + return (long)getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidFloat(int index) + { + char value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultByteArrayFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidDouble(int index) + { + char value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultByteArrayFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultByteArrayFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultByteArrayFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteArrayFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteArrayFieldItem.h new file mode 100755 index 00000000000..3f38223bd2e --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteArrayFieldItem.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_BYTE_ARRAY_FIELD_ITEM +#define _DEFAULT_BYTE_ARRAY_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultByteArrayFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultByteArrayFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteFieldItem.cpp new file mode 100755 index 00000000000..7d3e0ab7f36 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteFieldItem.cpp @@ -0,0 +1,195 @@ +/* + * 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. + */ + +#include "DefaultByteFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultByteFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidByte(int index) + { + char value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultByteFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidShort(int index) + { + return true; + } + + // =================================================== + short DefaultByteFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidInteger(int index) + { + char value = getValue(index); + return value >= 0; + } + + // =================================================== + int DefaultByteFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidLong(int index) + { + char value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultByteFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultByteFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidFloat(int index) + { + char value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultByteFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidDouble(int index) + { + char value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultByteFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultByteFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultByteFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteFieldItem.h new file mode 100755 index 00000000000..6604d00848c --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultByteFieldItem.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_BYTE_FIELD_ITEM +#define _DEFAULT_BYTE_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultByteFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultByteFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultDoubleFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultDoubleFieldItem.cpp new file mode 100755 index 00000000000..ad037db81c0 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultDoubleFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultDoubleFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultDoubleFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidByte(int index) + { + double value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultDoubleFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidShort(int index) + { + double value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultDoubleFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidInteger(int index) + { + double value = getValue(index); + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultDoubleFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidLong(int index) + { + double value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultDoubleFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultDoubleFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidFloat(int index) + { + double value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultDoubleFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidDouble(int index) + { + double value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultDoubleFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultDoubleFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultDoubleFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultDoubleFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultDoubleFieldItem.h new file mode 100755 index 00000000000..5df3f133076 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultDoubleFieldItem.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_DOUBLE_FIELD_ITEM +#define _DEFAULT_DOUBLE_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultDoubleFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultDoubleFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultFloatFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultFloatFieldItem.cpp new file mode 100755 index 00000000000..72438dd01d5 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultFloatFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultFloatFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultFloatFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidByte(int index) + { + float value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultFloatFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidShort(int index) + { + float value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultFloatFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidInteger(int index) + { + float value = getValue(index); + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultFloatFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidLong(int index) + { + float value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultFloatFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultFloatFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidFloat(int index) + { + float value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultFloatFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidDouble(int index) + { + double value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultFloatFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultFloatFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultFloatFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultFloatFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultFloatFieldItem.h new file mode 100755 index 00000000000..0798e00e031 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultFloatFieldItem.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_FLOAT_FIELD_ITEM +#define _DEFAULT_FLOAT_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultFloatFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultFloatFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultIntegerFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultIntegerFieldItem.cpp new file mode 100755 index 00000000000..8e4f2f582ed --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultIntegerFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultIntegerFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultIntegerFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidByte(int index) + { + int value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultIntegerFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidShort(int index) + { + int value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultIntegerFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidInteger(int index) + { + int value = getValue(index); + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultIntegerFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidLong(int index) + { + int value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultIntegerFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultIntegerFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidFloat(int index) + { + int value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultIntegerFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidDouble(int index) + { + int value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultIntegerFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultIntegerFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultIntegerFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultIntegerFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultIntegerFieldItem.h new file mode 100755 index 00000000000..9d680032906 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultIntegerFieldItem.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_INTEGER_FIELD_ITEM +#define _DEFAULT_INTEGER_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultIntegerFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultIntegerFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateFieldItem.cpp new file mode 100755 index 00000000000..7e1af80a5b7 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultLocalDateFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultLocalDateFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidByte(int index) + { + data_type value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultLocalDateFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidShort(int index) + { + data_type value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultLocalDateFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidInteger(int index) + { + data_type value = getValue(index); + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultLocalDateFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidLong(int index) + { + data_type value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultLocalDateFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultLocalDateFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidFloat(int index) + { + data_type value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultLocalDateFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidDouble(int index) + { + data_type value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultLocalDateFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultLocalDateFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultLocalDateFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateFieldItem.h new file mode 100755 index 00000000000..717ab5c66d7 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateFieldItem.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_LOCAL_DATE_FIELD_ITEM +#define _DEFAULT_LOCAL_DATE_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultLocalDateFieldItem : public BaseDefaultFieldItem + { + typedef time_t data_type; + public: + template + DefaultLocalDateFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateTimeFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateTimeFieldItem.cpp new file mode 100755 index 00000000000..2ed605dd8a5 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateTimeFieldItem.cpp @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#include "DefaultLocalDateTimeFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultLocalDateTimeFieldItem::isValidTime(int index) + { + return true; + } + + // =================================================== + time_t DefaultLocalDateTimeFieldItem::getTime(int index) + { + return getValue(index); + } + + // =================================================== + bool DefaultLocalDateTimeFieldItem::isValidDateTime(int index) + { + return isValidTime(index); + } + + // =================================================== + time_t DefaultLocalDateTimeFieldItem::getDateTime(int index) + { + if (!isValidDateTime(index)) + { + throw new PlcIncompatibleDatatypeException("time_t", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultLocalDateTimeFieldItem::isValidDate(int index) + { + return true; + } + + // =================================================== + tm DefaultLocalDateTimeFieldItem::getDate(int index) + { + if (!isValidDateTime(index)) + { + throw new PlcIncompatibleDatatypeException("time_t", index); + } + + time_t time = getValue(index); + + #pragma warning(suppress : 4996) + tm* date = gmtime(&time); + + return *date; + } + + + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateTimeFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateTimeFieldItem.h new file mode 100755 index 00000000000..d25d26acece --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalDateTimeFieldItem.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_LOCAL_DATE_TIME_FIELD_ITEM +#define _DEFAULT_LOCAL_DATE_TIME_FIELD_ITEM + +#include +#include +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; +using namespace boost::posix_time; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultLocalDateTimeFieldItem : public BaseDefaultFieldItem + { + typedef time_t data_type; + public: + template + DefaultLocalDateTimeFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + bool isValidTime(int index); + time_t getTime(int index); + bool isValidDate(int index); + tm getDate(int index); + bool isValidDateTime(int index); + time_t getDateTime(int index); + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalTimeFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalTimeFieldItem.cpp new file mode 100755 index 00000000000..932165419ba --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalTimeFieldItem.cpp @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#include "DefaultLocalTimeFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultLocalTimeFieldItem::isValidTime(int index) + { + return true; + } + + // =================================================== + time_t DefaultLocalTimeFieldItem::getTime(int index) + { + return getValue(index); + } + + // =================================================== + bool DefaultLocalTimeFieldItem::isValidDateTime(int index) + { + return isValidTime(index); + } + + // =================================================== + time_t DefaultLocalTimeFieldItem::getDateTime(int index) + { + if (!isValidDateTime(index)) + { + throw new PlcIncompatibleDatatypeException("time_t", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultLocalTimeFieldItem::isValidDate(int index) + { + return true; + } + + // =================================================== + tm DefaultLocalTimeFieldItem::getDate(int index) + { + if (!isValidDateTime(index)) + { + throw new PlcIncompatibleDatatypeException("time_t", index); + } + + time_t time = getValue(index); + + #pragma warning(suppress : 4996) + tm* date = gmtime(&time); + + return *date; + } + + + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalTimeFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalTimeFieldItem.h new file mode 100755 index 00000000000..d5e15dd6767 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLocalTimeFieldItem.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_LOCAL_TIME_FIELD_ITEM +#define _DEFAULT_LOCAL_TIME_FIELD_ITEM + +#include +#include +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; +using namespace boost::posix_time; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultLocalTimeFieldItem : public BaseDefaultFieldItem + { + typedef time_t data_type; + public: + template + DefaultLocalTimeFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + bool isValidTime(int index); + time_t getTime(int index); + bool isValidDate(int index); + tm getDate(int index); + bool isValidDateTime(int index); + time_t getDateTime(int index); + private: + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLongFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLongFieldItem.cpp new file mode 100755 index 00000000000..a48be4c6ee5 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLongFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultLongFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultLongFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidByte(int index) + { + data_type value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultLongFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidShort(int index) + { + data_type value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultLongFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidInteger(int index) + { + data_type value = getValue(index); + return value >= 0 && value <= 2147483647; + } + + // =================================================== + int DefaultLongFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidLong(int index) + { + data_type value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultLongFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultLongFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidFloat(int index) + { + data_type value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultLongFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidDouble(int index) + { + data_type value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultLongFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultLongFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultLongFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLongFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLongFieldItem.h new file mode 100755 index 00000000000..e335081a9cf --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultLongFieldItem.h @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_LONG_FIELD_ITEM +#define _DEFAULT_LONG_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultLongFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultLongFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + typedef long data_type; + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultShortFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultShortFieldItem.cpp new file mode 100755 index 00000000000..6a95b2a09d9 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultShortFieldItem.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "DefaultShortFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + bool DefaultShortFieldItem::getBoolean(int index) + { + if (!isValidBoolean(index)) + { + throw new PlcIncompatibleDatatypeException("bool", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidByte(int index) + { + data_type value = getValue(index); + return value <= -127 && value >= -128; + } + + // =================================================== + char DefaultShortFieldItem::getByte(int index) + { + if (!isValidByte(index)) + { + throw new PlcIncompatibleDatatypeException("char", index); + } + return (char) getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidShort(int index) + { + data_type value = getValue(index); + return value >= -32768 && value <= 32767; + } + + // =================================================== + short DefaultShortFieldItem::getShort(int index) + { + if (!isValidShort(index)) + { + throw new PlcIncompatibleDatatypeException("short", index); + } + + return (short)getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidInteger(int index) + { + data_type value = getValue(index); + return value >= 0; + } + + // =================================================== + int DefaultShortFieldItem::getInteger(int index) + { + if (!isValidInteger(index)) + { + throw new PlcIncompatibleDatatypeException("int", index); + } + + return (int)getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidLong(int index) + { + data_type value = getValue(index); + return value >= -(2 ^ 63) && value <= (2 ^ 63) - 1; + } + + // =================================================== + long DefaultShortFieldItem::getLong(int index) + { + if (!isValidLong(index)) + { + throw new PlcIncompatibleDatatypeException("long", index); + } + + return (long)getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidBigInteger(int index) + { + return true; + } + + // =================================================== + long long DefaultShortFieldItem::getBigInteger(int index) + { + if (!isValidBigInteger(index)) + { + throw new PlcIncompatibleDatatypeException("long long", index); + } + + // Todo: add conversion from cpp_dec_float_100 TO long long + return (long)getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidFloat(int index) + { + data_type value = getValue(index); + return value >= -3.4e38 && value <= 3.4e38; + } + + // =================================================== + float DefaultShortFieldItem::getFloat(int index) + { + if (!isValidFloat(index)) + { + throw new PlcIncompatibleDatatypeException("float", index); + } + + return (float)getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidDouble(int index) + { + data_type value = getValue(index); + return value >= -1.7e308 && value <= 1.7e308; + } + + // =================================================== + double DefaultShortFieldItem::getDouble(int index) + { + if (!isValidDouble(index)) + { + throw new PlcIncompatibleDatatypeException("double", index); + } + + return (double)getValue(index); + } + + // =================================================== + bool DefaultShortFieldItem::isValidBigDecimal(int index) + { + // same limits but higher precision + return isValidDouble(index); + } + + // =================================================== + cpp_dec_float_100 DefaultShortFieldItem::getBigDecimal(int index) + { + if (!isValidBigDecimal(index)) + { + throw new PlcIncompatibleDatatypeException("cpp_dec_float_100", index); + } + + return (cpp_dec_float_100)getValue(index); + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultShortFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultShortFieldItem.h new file mode 100755 index 00000000000..0606f317b2b --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultShortFieldItem.h @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_SHORT_FIELD_ITEM +#define _DEFAULT_SHORT_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultShortFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultShortFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidBoolean(int index) { return true; } + bool getBoolean(int index); + bool isValidByte(int index); + char getByte(int index); + bool isValidShort(int index); + short getShort(int index); + bool isValidInteger(int index); + int getInteger(int index); + bool isValidLong(int index); + long getLong(int index); + bool isValidBigInteger(int index); + long long getBigInteger(int index); + bool isValidFloat(int index); + float getFloat(int index); + bool isValidDouble(int index); + double getDouble(int index); + bool isValidBigDecimal(int index); + cpp_dec_float_100 getBigDecimal(int index); + + private: + typedef short data_type; + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultStringFieldItem.cpp b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultStringFieldItem.cpp new file mode 100755 index 00000000000..936acbdf545 --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultStringFieldItem.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#include "DefaultStringFieldItem.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + // ================================================== + std::string DefaultStringFieldItem::getString(int index) + { + if (!isValidString(index)) + { + throw new PlcIncompatibleDatatypeException("std::string", index); + } + + return getValue(index); + } + + // =================================================== + bool DefaultStringFieldItem::isValidString(int index) + { + return true; + } + } + + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultStringFieldItem.h b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultStringFieldItem.h new file mode 100755 index 00000000000..a71bd7ffb5d --- /dev/null +++ b/sandbox/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/items/DefaultStringFieldItem.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifndef _DEFAULT_STRING_FIELD_ITEM +#define _DEFAULT_STRING_FIELD_ITEM + +#include +#include "BaseDefaultFieldItem.h" + +using namespace org::apache::plc4x::cpp::api::exceptions; +using namespace boost::multiprecision; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace base + { + namespace messages + { + namespace items + { + class DefaultStringFieldItem : public BaseDefaultFieldItem + { + + public: + template + DefaultStringFieldItem(std::vector values); + + template + inline T getObject(int index) { return BaseDefaultFieldItem::getValue(index); } + inline bool isValidString(int index); + std::string getString(int index); + + private: + typedef std::string data_type; + }; + } + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/protocols/s7/src/main/cpp/org/apache/plc4x/cpp/s7/types/S7ControllerType.h b/sandbox/plc4cpp/protocols/s7/src/main/cpp/org/apache/plc4x/cpp/s7/types/S7ControllerType.h new file mode 100755 index 00000000000..2036daa2019 --- /dev/null +++ b/sandbox/plc4cpp/protocols/s7/src/main/cpp/org/apache/plc4x/cpp/s7/types/S7ControllerType.h @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#ifndef _S7_CONTROLLER_TYPE +#define _S7_CONTROLLER_TYPE + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace s7 + { + namespace types + { + enum S7ControllerType { + + ANY, + S7_300, + S7_400, + S7_1200, + S7_1500, + LOGO + }; + + struct S7ControllerTypeMap : public std::map + { + S7ControllerTypeMap() + { + this->operator[]("any") = S7ControllerType::ANY; + this->operator[]("s7_300") = S7ControllerType::S7_300; + this->operator[]("s7_400") = S7ControllerType::S7_400; + this->operator[]("s7_1200") = S7ControllerType::S7_1200; + this->operator[]("s7_1500") = S7ControllerType::S7_1500; + this->operator[]("logo") = S7ControllerType::LOGO; + }; + ~S7ControllerTypeMap() {} + }; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/utils/CMakeLists.txt b/sandbox/plc4cpp/utils/CMakeLists.txt new file mode 100755 index 00000000000..504a0b8c133 --- /dev/null +++ b/sandbox/plc4cpp/utils/CMakeLists.txt @@ -0,0 +1,22 @@ +#[[ + 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. +]] + +add_subdirectory(logger) +add_subdirectory(systemconfig) + diff --git a/sandbox/plc4cpp/utils/logger/CMakeLists.txt b/sandbox/plc4cpp/utils/logger/CMakeLists.txt new file mode 100755 index 00000000000..58904cf1970 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/CMakeLists.txt @@ -0,0 +1,31 @@ +#[[ + 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. +]] + +add_library(plc4cpp-utils-logger + src/main/cpp/org/apache/plc4x/cpp/utils/logger/BLogger.cpp + src/main/cpp/org/apache/plc4x/cpp/utils/logger/DatDmp.cpp + src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp + src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorCategory.cpp + src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorInfoException.cpp + src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp + ) + +target_include_directories (plc4cpp-utils-logger PUBLIC ${Boost_INCLUDE_DIRS}) + +target_link_libraries (plc4cpp-utils-logger ${Boost_LIBRARIES}) diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/BLogger.cpp b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/BLogger.cpp new file mode 100755 index 00000000000..7cc8fa0fe4e --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/BLogger.cpp @@ -0,0 +1,475 @@ +/* + * 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. + */ + +#include "BLogger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + namespace fs = boost::filesystem; + namespace logging = boost::log; + namespace attrs = boost::log::attributes; + + const char* BLogger::_pDefaultFileTitle = "plc4x"; + const char* BLogger::_pDefaultFileExtension = ".log"; + + BLogger* BLogger::m_pInstance = NULL; + + BLogger* BLogger::Instance() + { + if (!m_pInstance) + { + m_pInstance = new BLogger; + } + + return m_pInstance; + } + + void BLogger::Release() + { + if (m_pInstance != NULL) + { + delete m_pInstance; + m_pInstance = NULL; + } + + return; + } + + BLogger::BLogger() : + _iMaxFileSize(10 * 1024 * 1024), /* default max. filesize = 10 MB */ + _uiMaxNumberOfFiles(5), + _strFileTitle(_pDefaultFileTitle), + _strFileExtension(_pDefaultFileExtension), + _logFilter (BoostLogger::trivial::severity >= BoostLogger::trivial::trace), + _severityLevel(BoostLogger::trivial::trace), + _uiFlushCounter(0) + { + _iSeverityLevelNumber=getNumberfromSeverityLevel(_severityLevel); + + _uiMaxFlushEntrys[0] = 20 ; // trace + _uiMaxFlushEntrys[1] = 10 ; // debug + _uiMaxFlushEntrys[2] = 20 ; // info // 0 -> write once + _uiMaxFlushEntrys[3] = 0 ; // warning // 0 -> write once + _uiMaxFlushEntrys[4] = 0 ; // error // 0 -> write once + _uiMaxFlushEntrys[5] = 0 ; // fatal // 0 -> write once + + Initialize(); + + return; + } + + BLogger::~BLogger() + { + _uiFlushCounter = _uiMaxFlushEntrys[_iSeverityLevelNumber]; + FlushLog(); + + return; + } + + void BLogger::setFileTitle(string strFileTitle) + { + if (strFileTitle != _strFileTitle) + { + _strFileTitle = strFileTitle; + } + + return; + } + + void BLogger::setFileExtension(string strFileExtension) + { + if (strFileExtension != _strFileExtension) + { + _strFileExtension = strFileExtension; + } + + return; + } + + void BLogger::setMaxFileSize(int iMaxFileSize) + { + if (iMaxFileSize != _iMaxFileSize) + { + _iMaxFileSize = iMaxFileSize; /* MB */ + } + + return; + } + + void BLogger::setMaxNumberOfFiles(unsigned int uiMaxNumberOfFiles) + { + if (uiMaxNumberOfFiles != _uiMaxNumberOfFiles) + { + _uiMaxNumberOfFiles = uiMaxNumberOfFiles; + } + + return; + } + + void BLogger::setSeverityLogLevel(severity_level severityLevel) + { + _severityLevel = severityLevel; + + _iSeverityLevelNumber = getNumberfromSeverityLevel(_severityLevel); + + _logFilter = BoostLogger::trivial::severity >= severityLevel; + + BoostLogger::core::get()->set_filter(_logFilter); + + return; + } + + + void BLogger::clearLogDir() + { + const boost::regex logFilter( "(.*\\" + _strFileExtension + ")" ); + + fs::path phPathFile(_strFileTitle); + fs::path phDir = phPathFile.parent_path(); + if (fs::exists(phDir)) + { + fs::directory_iterator it{phDir}; + while (it != boost::filesystem::directory_iterator{}) + { + if (fs::is_regular_file(*it)) + { + std::string logFilename = it->path().filename().string(); + + if( boost::regex_match( logFilename, logFilter ) ) + { + boost::filesystem::remove(it->path()); + } + } + it++; + } + } + + return; + } + + void BLogger::Initialize() + { + + if (_strFileTitle.length() == 0) _strFileTitle = _pDefaultFileTitle; + if (_strFileExtension.length() == 0) _strFileExtension = _pDefaultFileExtension; + string strLogFileName = _strFileTitle + "_%m%d%Y_%H%M%S_%N" + _strFileExtension; + + boost::shared_ptr< logging::core > core = logging::core::get(); + core->flush(); + core->remove_all_sinks(); + core->add_global_attribute("TimeStamp", attrs::local_clock()); + + boost::shared_ptr< sinks::text_file_backend > backend = + boost::make_shared< sinks::text_file_backend > + ( + keywords::file_name = strLogFileName.c_str(), + keywords::rotation_size = _iMaxFileSize * 1024 * 1024, + keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0) + ); + + fs::path phDirPath(strLogFileName); + + backend->set_file_collector(sinks::file::make_collector + ( + keywords::target = phDirPath.parent_path().c_str(), + keywords::max_size = (_uiMaxNumberOfFiles - 1) * _iMaxFileSize * 1024 * 1024, + keywords::min_free_space = 50 * 1024 * 1024 + )); + + typedef sinks::synchronous_sink< sinks::text_file_backend > sink_t; + boost::shared_ptr< sink_t > sink(new sink_t(backend)); + + sink->set_formatter + ( + expr::stream + << expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "[%d.%m. %H:%M:%S.%f] ") + << " <" << BoostLogger::trivial::severity + << "> : " << expr::message + ); + + core->add_sink(sink); + + return; + } + + void BLogger::Log(const char* pMessage, severity_level logLevel /*= info*/) + { + try + { + if (isLog(logLevel)) + { + _mtxLock.lock(); + + BOOST_LOG_SEV(_lg, severity_level::info) << "ThreadID 0x" << boost::this_thread::get_id() << " " << pMessage; + + if(logLevel == severity_level::fatal) + ForceFlushLog(); + else + FlushLog(); + + _mtxLock.unlock(); + } + } + catch(...) + { + _mtxLock.unlock(); + } + + return; + } + + void BLogger::Log(string strMessage, severity_level logLevel /* = info */) + { + try + { + if (isLog(logLevel)) + { + _mtxLock.lock(); + + BOOST_LOG_SEV(_lg, logLevel) << "ThreadID 0x" << boost::this_thread::get_id() << " " << strMessage; + + if(logLevel == severity_level::fatal) + ForceFlushLog(); + else + FlushLog(); + + _mtxLock.unlock(); + } + } + catch(...) + { + _mtxLock.unlock(); + } + + return; + } + + void BLogger::LogBool(bool b, severity_level logLevel /*= info*/) + { + + try + { + if (isLog(logLevel)) + { + _mtxLock.lock(); + + string strBoolMessage = b ? _strTrueMessage : _strFalseMessage; + BOOST_LOG_SEV(_lg, logLevel) << "ThreadID 0x" << boost::this_thread::get_id() << " " << strBoolMessage; + + if(logLevel == severity_level::fatal) + ForceFlushLog(); + else + FlushLog(); + + _mtxLock.unlock(); + } + } + catch(...) + { + _mtxLock.unlock(); + } + + return; + } + + void BLogger::LogBool(string strMessage, bool b, severity_level logLevel /*= info*/) + { + try + { + if (isLog(logLevel)) + { + _mtxLock.lock(); + + string strBoolMessage = b ? _strTrueMessage : _strFalseMessage; + BOOST_LOG_SEV(_lg, logLevel) << "ThreadID 0x" << boost::this_thread::get_id() << " " << strMessage << ' ' << strBoolMessage; + + if(logLevel == severity_level::fatal) + ForceFlushLog(); + else + FlushLog(); + + _mtxLock.unlock(); + } + } + catch(...) + { + _mtxLock.unlock(); + } + + return; + } + + void BLogger::LogHexDump(unsigned char* pBinaryData, unsigned int uiNumBytes, const char* pDumpPrefix /*= NULL*/, severity_level logLevel /*= info*/) + { + try + { + if (isLog(logLevel)) + { + _mtxLock.lock(); + + DatDmp dump; + dump.setLeadingNewLine(true); + dump.setPrefix(pDumpPrefix); + string strDumpMessage = dump.Show(pBinaryData, uiNumBytes); + BOOST_LOG_SEV(_lg, logLevel) << "ThreadID 0x" << boost::this_thread::get_id() << " " << strDumpMessage; + + if (logLevel == severity_level::fatal) + { + ForceFlushLog(); + } + else + { + FlushLog(); + } + + _mtxLock.unlock(); + } + } + catch(...) + { + _mtxLock.unlock(); + } + + return; + } + + void BLogger::FlushLog(void) + { + if(_uiFlushCounter >= _uiMaxFlushEntrys[_iSeverityLevelNumber]) + { + BOOST_LOG_SEV(_lg, boost::log::trivial::severity_level::info) << "ThreadID 0x" << boost::this_thread::get_id() << " Flush LogEntries"; + logging::core::get()->flush(); + _uiFlushCounter = 0; + } + else + { + _uiFlushCounter++; + } + + return; + } + + void BLogger::ForceFlushLog(void) + { + unsigned int ui = _uiMaxFlushEntrys[_iSeverityLevelNumber]; + _uiMaxFlushEntrys[_iSeverityLevelNumber] = 0; + FlushLog(); + _uiMaxFlushEntrys[_iSeverityLevelNumber] = ui; + + return; + } + + void BLogger::setSeverityLogLevelNumber(int iSeverityLevelNumber) + { + + _iSeverityLevelNumber = iSeverityLevelNumber; + + _severityLevel = getSeverityLevelfromNumber(_iSeverityLevelNumber); + + setSeverityLogLevel(_severityLevel); + + return; + } + + bool BLogger::isLog(severity_level logLevel) + { + bool bResult = false; + + try + { + int ilogLevel = getNumberfromSeverityLevel(logLevel); + + if (_iSeverityLevelNumber <= ilogLevel) + { + bResult = true; + } + } + catch(...) + { + } + + return bResult; + } + + severity_level BLogger::getSeverityLevelfromNumber(int iSeverityLevelNumber) + { + severity_level logLevel = boost::log::trivial::severity_level::trace; + + switch (iSeverityLevelNumber) + { + case 0: logLevel = boost::log::trivial::severity_level::trace; break; + case 1: logLevel = boost::log::trivial::severity_level::debug; break; + case 2: logLevel = boost::log::trivial::severity_level::info; break; + case 3: logLevel = boost::log::trivial::severity_level::warning; break; + case 4: logLevel = boost::log::trivial::severity_level::error; break; + case 5: logLevel = boost::log::trivial::severity_level::fatal; break; + default: logLevel = boost::log::trivial::severity_level::trace; break; + } + + return logLevel; + } + + int BLogger::getNumberfromSeverityLevel(severity_level severityLevel) + { + int iSeverityLevelNumber = 0; + + switch (severityLevel) + { + case boost::log::trivial::severity_level::trace: iSeverityLevelNumber = 0; break; + case boost::log::trivial::severity_level::debug: iSeverityLevelNumber = 1; break; + case boost::log::trivial::severity_level::info: iSeverityLevelNumber = 2; break; + case boost::log::trivial::severity_level::warning: iSeverityLevelNumber = 3; break; + case boost::log::trivial::severity_level::error: iSeverityLevelNumber = 4; break; + case boost::log::trivial::severity_level::fatal: iSeverityLevelNumber = 5; break; + } + + return iSeverityLevelNumber; + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/BLogger.h b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/BLogger.h new file mode 100755 index 00000000000..6f836a0eed6 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/BLogger.h @@ -0,0 +1,157 @@ +/* + * 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. + */ + +#ifndef _B_LOGGER_H_ +#define _B_LOGGER_H_ + +#include +#include +#include +#include +#include +#include "ExLog.h" + +#include "DatDmp.h" + +#define LOG_TRACE(x) org::apache::plc4x::cpp::utils::BLogger::Instance()->Log(x,boost::log::trivial::severity_level::trace) +#define LOG_DEBUG(x) org::apache::plc4x::cpp::utils::BLogger::Instance()->Log(x,boost::log::trivial::severity_level::debug) +#define LOG_INFO(x) org::apache::plc4x::cpp::utils::BLogger::Instance()->Log(x,boost::log::trivial::severity_level::info) +#define LOG_WARNING(x) org::apache::plc4x::cpp::utils::BLogger::Instance()->Log(x, boost::log::trivial::severity_level::warning) +#define LOG_ERROR(x) org::apache::plc4x::cpp::utils::BLogger::Instance()->Log(x, boost::log::trivial::severity_level::error) +#define LOG_FATAL(x) org::apache::plc4x::cpp::utils::BLogger::Instance()->Log(x, boost::log::trivial::severity_level::fatal) +#define LOG_BOOL(x,y) org::apache::plc4x::cpp::utils::BLogger::Instance()->LogBool(x,y) + +#define IS_LOG(x) org::apache::plc4x::cpp::utils::BLogger::Instance()->isLog(x) + + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + namespace src = boost::log::sources; + namespace expr = boost::log::expressions; + namespace sinks = boost::log::sinks; + namespace keywords = boost::log::keywords; + namespace BoostLogger = boost::log; + + using namespace BoostLogger::trivial; + using namespace std; + + + class BLogger + { + + public: + + static BLogger* Instance(); + void Release(); + + ~BLogger(); + + void Initialize(); + + void Log(const char* strMessage, severity_level logLevel = boost::log::trivial::severity_level::info); + + void Log(string strMessage, severity_level logLevel = boost::log::trivial::severity_level::info); + + void LogBool(bool b, severity_level logLevel = boost::log::trivial::severity_level::info); + + void LogBool(string strMessage, bool b, severity_level logLevel = boost::log::trivial::severity_level::info); + + void LogHexDump(unsigned char* pBinaryData, unsigned int nNumBytes, const char* szDumpPrefix = NULL, severity_level logLevel = boost::log::trivial::severity_level::info); + + string getFileExtension() { return _strFileExtension; } + void setFileExtension(string strExtension); + + string getFileTitle() { return _strFileTitle; } + void setFileTitle(string strFileTitle); + + int getMaxFileSize() const { return _iMaxFileSize; } + void setMaxFileSize(int maxFileSize); + + unsigned int getMaxNumberOfFiles() { return _uiMaxNumberOfFiles; } + void setMaxNumberOfFiles(unsigned int uiMaxNumberOfFiles); + + severity_level getSeverityLogLevel() { return _severityLevel; } + void setSeverityLogLevel(severity_level severityLevel); + + int getSeverityLogLevelNumber() { return getNumberfromSeverityLevel(_severityLevel); } + void setSeverityLogLevelNumber(int iSeverityLevelNumber); + + bool isLog(severity_level logLevel); + + string getTrueMessage() const { return _strTrueMessage; } + void setTrueMessage(string strTrueMessage) { _strTrueMessage = strTrueMessage; } + + string getFalseMessage() const { return _strFalseMessage; } + void setFalseMessage(string strFalseMessage) { _strFalseMessage = strFalseMessage; } + + void clearLogDir(); + void ForceFlushLog(void); + + private: + + BLogger(); // Private so that it can not be called + BLogger(BLogger const&){}; // copy constructor is private + BLogger& operator=(BLogger const&){ }; // assignment operator is private + + int getNumberfromSeverityLevel(severity_level severityLevel); + severity_level getSeverityLevelfromNumber(int iSeverityLevelNumber); + + void FlushLog(void); + + static BLogger* m_pInstance; + + int _iMaxFileSize; + unsigned int _uiMaxNumberOfFiles; + + unsigned int _uiFlushCounter; + + unsigned int _uiMaxFlushEntrys[6]; + + severity_level _severityLevel; + int _iSeverityLevelNumber; + + boost::log::filter _logFilter; + + src::severity_logger_mt _lg; + + boost::mutex _mtxLock; + + string _strFileTitle; + string _strFileExtension; + + string _strTrueMessage; + string _strFalseMessage; + + static const char* _pDefaultFileTitle; + static const char* _pDefaultFileExtension; + }; + } + } + } + } +} +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DatDmp.cpp b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DatDmp.cpp new file mode 100755 index 00000000000..d2d51e89fa0 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DatDmp.cpp @@ -0,0 +1,143 @@ +/* + * 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. + */ + +#include "DatDmp.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + + char DatDmp::achHex[3] = { '\0', '\0', '\0' }; + + DatDmp::DatDmp() : + _strHexDump(""), + _strPrefix(""), + _uiBytesPerLine(16), + _bLeadingNewLine(false) + { + } + + DatDmp::DatDmp(unsigned int uiBytesPerLine) : + _strHexDump(""), + _strPrefix(""), + _uiBytesPerLine(uiBytesPerLine), + _bLeadingNewLine(false) + { + } + + string DatDmp::Show(unsigned char* pStream, unsigned int uiNumbersBytes, const char* pLinePrefix /*= NULL*/) + { + _strHexDump = ""; + if (_bLeadingNewLine) + { + _bLeadingNewLine = false; + _strHexDump += '\n'; + } + + for (unsigned int uiByteCounter = 0, iStopByte = _uiBytesPerLine; + uiByteCounter < uiNumbersBytes; + uiByteCounter += _uiBytesPerLine, iStopByte += _uiBytesPerLine + ) + { + if (pLinePrefix != NULL) _strHexDump += pLinePrefix; + _strHexDump += _strPrefix; + + int nBoundaryBytes = 0; + if (iStopByte > uiNumbersBytes) + { + nBoundaryBytes = iStopByte - uiNumbersBytes; + iStopByte = uiNumbersBytes; + } + + for (unsigned int uiByteLine = uiByteCounter; uiByteLine < iStopByte; uiByteLine++) + { + unsigned char byte = pStream[uiByteLine]; + _strHexDump += Hex(byte); + _strHexDump += ' '; + } + if (nBoundaryBytes > 0) _strHexDump += std::string(3 * nBoundaryBytes, ' '); + _strHexDump += "| "; + + for (unsigned int uiByteLine = uiByteCounter; uiByteLine < iStopByte; uiByteLine++) + { + char ch = (char)pStream[uiByteCounter]; + if (ch >= 0) + { + if (!isprint(ch)) ch = '.'; + } + else + { + ch = '.'; + } + _strHexDump += ch; + } + _strHexDump += "\n"; + } + return _strHexDump; + } + + string DatDmp::HexByte(unsigned char ucByte) + { + return string(Hex(ucByte)); + } + + string DatDmp::HexWord(unsigned short usWord) + { + return string(Hex((unsigned char)(usWord >> 8))) + string(Hex((unsigned char)(usWord & 0xff))); + } + + string DatDmp::HexDWord(unsigned int uiDWord) + { + return string(Hex((unsigned char)((uiDWord & 0xff000000) >> 24))) + + string(Hex((unsigned char)((uiDWord & 0x00ff0000) >> 16))) + + string(Hex((unsigned char)((uiDWord & 0x0000ff00) >> 8))) + + string(Hex((unsigned char)((uiDWord & 0x000000ff)))); + } + + const char* DatDmp::Hex(unsigned char ucByte) + { + achHex[0] = HexNibbleHigh(ucByte); + achHex[1] = HexNibbleLow(ucByte); + achHex[2] = '\0'; + return (const char*)achHex; + } + + char DatDmp::HexNibbleHigh(unsigned char ucByte) + { + unsigned char btNibble = (unsigned char)(ucByte >> 4); + return btNibble <= (unsigned char)9 ? '0' + btNibble : 'A' + btNibble - (unsigned char)10; + } + + char DatDmp::HexNibbleLow(unsigned char ucByte) + { + unsigned char btNibble = (unsigned char)(ucByte & 0x0f); + return btNibble <= (unsigned char)9 ? '0' + btNibble : 'A' + btNibble - (unsigned char)10; + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DatDmp.h b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DatDmp.h new file mode 100755 index 00000000000..9c5e1661e39 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DatDmp.h @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifndef _DATDMP_H_ +#define _DATDMP_H_ + +#include +#include +#include + +using namespace std; + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + class DatDmp + { + public: + + DatDmp(); + DatDmp(unsigned int uiBytesPerLine); + + string Show(unsigned char* pStream, unsigned int uiNumbersBytes, const char* pLinePrefix = NULL); + + string getPrefix() { return _strPrefix; } + void setPrefix(string strPrefix) { _strPrefix = strPrefix; } + + void setPrefix(const char* pPrefix) { _strPrefix.clear(); + if (pPrefix != NULL) { _strPrefix = pPrefix; }; + } + + inline unsigned getBytesPerLine() const { return _uiBytesPerLine; } + void setBytesPerLine(unsigned int uiBytesPerLine) { _uiBytesPerLine = uiBytesPerLine; } + + inline bool getLeadingNewLine() const { return _bLeadingNewLine; } + void setLeadingNewLine(bool bLeadingNewLine) { _bLeadingNewLine = bLeadingNewLine; } + + static string HexByte(unsigned char ucByte); + static string HexWord(unsigned short usWord); + static string HexDWord(unsigned int uiDword); + + protected: + + static const char* Hex(unsigned char ucByte); + static char HexNibbleHigh(unsigned char ucByte); + static char HexNibbleLow(unsigned char ucByte); + + protected: + + string _strHexDump; + string _strPrefix; + unsigned int _uiBytesPerLine; + bool _bLeadingNewLine; + + private: + + static char achHex[3]; + }; + } + } + } + } +} + +#endif diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp new file mode 100755 index 00000000000..da657725bcb --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#define TRACE_BUFFERSIZE 0x1000000 + +#if defined(_DEBUG) + +#include +#include +#include +#include +#include + + +void TracerW(const wchar_t* formatStr, ...) +{ + static wchar_t arcBuffer[TRACE_BUFFERSIZE]; + va_list args; + va_start(args, formatStr); + swprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args); + va_end(args); + ::OutputDebugStringW(arcBuffer); +} + + +void Tracer(const char* formatStr, ...) +{ + static char arcBuffer[TRACE_BUFFERSIZE]; + va_list args; + va_start(args, formatStr); + vsprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args); + va_end(args); + ::OutputDebugStringA(arcBuffer); +} + +#endif diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.h b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.h new file mode 100755 index 00000000000..07a5513004c --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef _DBG_TRACE_H_ +#define _DBG_TRACE_H_ + +#define TRACE_BUFFERSIZE 0x1000000 + +// TRACE MACROS to main header file +#if defined(_DEBUG) + +#define DEBUG_TRACE_0(f) TracerW(f) +#define DEBUG_TRACE_1(f,a) TracerW(f,a) +#define DEBUG_TRACE_2(f,a,b) TracerW(f,a,b) +#define DEBUG_TRACE_3(f,a,b,c) TracerW(f,a,b,c) +void TracerW(const wchar_t* formatStr, ...); + +#define DEBUG_TRACE0(f) Tracer(f) +#define DEBUG_TRACE1(f,a) Tracer(f,a) +#define DEBUG_TRACE2(f,a,b) Tracer(f,a,b) +#define DEBUG_TRACE3(f,a,b,c) Tracer(f,a,b,c) +void Tracer(const char* formatStr, ...); + +#else + +#define DEBUG_TRACE_0(f) ((void)NULL) +#define DEBUG_TRACE_1(f,a) ((void)NULL) +#define DEBUG_TRACE_2(f,a,b) ((void)NULL) +#define DEBUG_TRACE_3(f,a,b,c) ((void)NULL) + +#define DEBUG_TRACE0(f) ((void)NULL) +#define DEBUG_TRACE1(f,a) ((void)NULL) +#define DEBUG_TRACE2(f,a,b) ((void)NULL) +#define DEBUG_TRACE3(f,a,b,c) ((void)NULL) + +#endif + +#endif diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorCategory.cpp b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorCategory.cpp new file mode 100755 index 00000000000..6af21752bd6 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorCategory.cpp @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#include "ErrorCategory.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + + const char* Error_Category::_paErrorMessage[] = + { + "success", + "err0", + "err1", + "err2", + "err3", + "err4", + "err5", + "err6" + }; + + + std::string Error_Category::message(int iEv) const + { + std::string strMessage = ""; + if (IsValidMessageIndex(iEv)) + { + strMessage = _paErrorMessage[iEv]; + } + else + { + strMessage = DefaultMessage(iEv); + } + + return strMessage; + } + + std::string Error_Category::DefaultMessage(int iEv) const + { + boost::system::error_code ecCode(iEv, boost::system::system_category()); + + return ecCode.message(); + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorCategory.h b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorCategory.h new file mode 100755 index 00000000000..5402f2479a9 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorCategory.h @@ -0,0 +1,125 @@ +/* + * 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. + */ + +#ifndef _ERRORCATEGORY_H_ +#define _ERRORCATEGORY_H_ + +#include +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + class IError_Category + { + public: + + virtual const char* name() const = 0; + virtual inline std::string getName() const = 0; + + virtual std::string message(int iEv) const = 0; + + protected: + virtual bool IsValidMessageIndex(int iEv) const = 0; + }; + + + class Error_Category : IError_Category + { + public: + enum Category + { + System = 0, + Application, + max_category = Application, + num_categories + }; + + Error_Category() : + _Category(System), + _strName("System"), + _iMsgOffset(0) + { + } + + virtual const char* name() const { return _strName.c_str(); } + + virtual std::string message(int ev) const; + + virtual inline std::string getName() const { return _strName; } + + protected: + + std::string DefaultMessage(int ev) const; + + virtual bool IsValidMessageIndex(int ev) const { return false; } + + protected: + std::string _strName; + Category _Category; + int _iMsgOffset; + + static const char* _paErrorMessage[]; + }; + + class Error_Category_Application : public Error_Category + { + public: + + enum errc_t + { + success = 0, + err1, + err2, + err3, + err4, + err5, + err6, + max_err = err6, + num_codes + }; + + Error_Category_Application() + { + _Category = Application; + _strName = "Application"; + _iMsgOffset = 0; // Start-Offset to error message index, to be set .. + } // .. individually for each derivation of Error_Category! + // Provide messages in array Error_Category::_aszErrorMessage[]! + protected: + + virtual bool IsValidMessageIndex(int iEv) const + { + return iEv >= (int)success && iEv <= _iMsgOffset + (int)max_err; + } + + }; + } + } + } + } +} +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorInfoException.cpp b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorInfoException.cpp new file mode 100755 index 00000000000..da9c44d24cd --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorInfoException.cpp @@ -0,0 +1,171 @@ +/* + * 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. + */ + +#include +#include +#include +#include "ErrorInfoException.h" +#include "ExLog.h" +#include "DbgTrace.h" +#include "BLogger.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + + ErrorInfoException::ErrorInfoException() : + _uiUserMessageID(-1), + pCategory(NULL), + _iEv(-1) + { + std::string strErrorMessage = " ErrorInfoException no Message"; + LOG_ERROR(strErrorMessage); + DEBUG_TRACE1("%s\n", strErrorMessage.c_str()); + + return; + } + + ErrorInfoException::ErrorInfoException(unsigned int uiUserMessageID, std::string strErrorInfo) : + _uiUserMessageID(uiUserMessageID), + _strWhat(strErrorInfo), + pCategory(NULL), + _iEv(-1) + { + LOG_ERROR(strErrorInfo); + DEBUG_TRACE1("%s\n", strErrorInfo.c_str()); + + return; + } + + ErrorInfoException::ErrorInfoException(unsigned int uiUserMessageID, std::exception& ex) : + _uiUserMessageID(uiUserMessageID), + _strWhat(ex.what()), + pCategory(NULL), + _iEv(-1) + { + LOG_ERROR(ex.what()); + DEBUG_TRACE1("%s\n", ex.what()); + + return; + } + + ErrorInfoException::ErrorInfoException(unsigned int uiUserMessageID, boost::exception& ex) : + _uiUserMessageID(uiUserMessageID), + _strWhat(*boost::get_error_info(ex)), + pCategory(NULL), + _iEv(-1) + { + LOG_ERROR(*boost::get_error_info(ex)); + DEBUG_TRACE1("%s\n", _strWhat.c_str()); + + return; + } + + ErrorInfoException::ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue) : + _uiUserMessageID(uiUserMessageID), + pCategory(CreateErrorCategory(cat)), + _iEv(iErrorValue) + { + std::string strMessage = boost::lexical_cast(iErrorValue); + LOG_ERROR(strMessage.c_str()); + DEBUG_TRACE1("ErrorValue:%i\n", iErrorValue); + + return; + } + + ErrorInfoException::ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue, std::string strErrorInfo) : + _uiUserMessageID(uiUserMessageID), + _strWhat(strErrorInfo), + pCategory(CreateErrorCategory(cat)), + _iEv(iErrorValue) + { + LOG_ERROR(strErrorInfo); + DEBUG_TRACE1("%s\n", strErrorInfo.c_str()); + + return; + } + + + ErrorInfoException::ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue, std::exception& ex) : + _uiUserMessageID(uiUserMessageID), + _strWhat(ex.what()), + pCategory(CreateErrorCategory(cat)), + _iEv(iErrorValue) + { + LOG_ERROR(ex.what()); + DEBUG_TRACE1("%s\n", ex.what()); + + return; + } + + ErrorInfoException::ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue, boost::exception& ex) : + _uiUserMessageID(uiUserMessageID), + _strWhat(*boost::get_error_info(ex)), + pCategory(CreateErrorCategory(cat)), + _iEv(iErrorValue) + { + LOG_ERROR(*boost::get_error_info(ex)); + DEBUG_TRACE1("%s\n", _strWhat.c_str()); + + return; + } + + ErrorInfoException::~ErrorInfoException() + { + if (pCategory != NULL) { delete pCategory; }; + + return; + } + + Error_Category* ErrorInfoException::CreateErrorCategory(Error_Category::Category cat) throw() + { + Error_Category* pCat = NULL; + try + { + switch (cat) + { + case Error_Category::Category::System: + default: + pCat = new Error_Category(); + break; + + case Error_Category::Category::Application: + pCat = new Error_Category_Application(); + break; + } + } + catch (...) + { + pCat = NULL; + } + + return pCat; + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorInfoException.h b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorInfoException.h new file mode 100755 index 00000000000..79934b12442 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ErrorInfoException.h @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#ifndef _ERROR_INFO_EXCEPTION_H_ +#define _ERROR_INFO_EXCEPTION_H_ + +#include +#include +#include "ErrorCategory.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + + class ErrorInfoException : public boost::exception, public std::exception + { + public: + ErrorInfoException(); + + virtual ~ErrorInfoException(); + + ErrorInfoException(unsigned int uiUserMessageID, std::string strErrorInfo); + + ErrorInfoException(unsigned int uiUserMessageID, std::exception& ex); + + ErrorInfoException(unsigned int uiUserMessageID, boost::exception& ex); + + ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue); + + ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue, std::string strErrorInfo); + + ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue, std::exception& ex); + + ErrorInfoException(unsigned int uiUserMessageID, Error_Category::Category cat, int iErrorValue, boost::exception& ex); + + inline unsigned int getUserMessageID() const { return _uiUserMessageID; } + + virtual const char* what() const throw() { return _strWhat.c_str(); } + + Error_Category* pCategory; + + inline int getErrorValue() const { return _iEv; } + + protected: + + Error_Category* CreateErrorCategory(Error_Category::Category cat) throw(); + + protected: + + std::string _strWhat; + int _iEv; + unsigned int _uiUserMessageID; + + }; + } + } + } + } +} +#endif \ No newline at end of file diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp new file mode 100755 index 00000000000..aa7515579eb --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp @@ -0,0 +1,143 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include "ErrorInfoException.h" + +#include "DbgTrace.h" +#include "BLogger.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + using namespace std; + using namespace boost; + + ExLog::ExLog() + { + + } + + ExLog::ExLog(unsigned int uiUserMessageID, std::exception& ex, const char* pError) : + _strWhat(ex.what()) + { + string strExceptionClassName = typeid(ex).name(); + + if (strExceptionClassName.find(typeid(ExLog).name()) != std::string::npos) + { + _uiUserMessageID = (reinterpret_cast(ex)).getUserMessageID(); + } + else if (strExceptionClassName.find(typeid(ErrorInfoException).name()) != std::string::npos) + { + _uiUserMessageID = (reinterpret_cast(ex)).getUserMessageID(); + } + else + { + _uiUserMessageID = uiUserMessageID; + } + + std::stringstream strStream; + + _strLastErrorMessage = std::string(pError) + '\n'; + + _strLastErrorMessage = _strLastErrorMessage + std::string("MessageID: ") + lexical_cast(_uiUserMessageID) + '\n'; + + strStream << diagnostic_information(ex) << std::endl; + _strLastErrorMessage = _strLastErrorMessage + strStream.str(); + + _strLastErrorMessage = _strLastErrorMessage + printStackTrace(); + + DEBUG_TRACE1("%s\n", _strLastErrorMessage.c_str()); + LOG_ERROR(_strLastErrorMessage); + + return; + } + + ExLog::ExLog(unsigned int uiUserMessageID, boost::exception& ex, const char* pError) : + _strWhat(*get_error_info(ex)) + { + string strExceptionClassName = typeid(ex).name(); + + if (strExceptionClassName.find(typeid(ExLog).name()) != std::string::npos) + { + _uiUserMessageID = (reinterpret_cast(ex)).getUserMessageID(); + } + else if (strExceptionClassName.find(typeid(ErrorInfoException).name()) != std::string::npos) + { + _uiUserMessageID = (reinterpret_cast(ex)).getUserMessageID(); + } + else + { + _uiUserMessageID = uiUserMessageID; + } + + std::stringstream strStream; + + _strLastErrorMessage = std::string(pError) + '\n'; + + _strLastErrorMessage = _strLastErrorMessage + std::string("MessageID: ") + lexical_cast(_uiUserMessageID) + '\n'; + + strStream << diagnostic_information(ex) << std::endl; + _strLastErrorMessage = _strLastErrorMessage + strStream.str(); + + _strLastErrorMessage = _strLastErrorMessage + printStackTrace(); + + DEBUG_TRACE1("%s\n", _strLastErrorMessage.c_str()); + LOG_ERROR(_strLastErrorMessage); + + return; + } + + ExLog::~ExLog() + { + } + + void ExLog::logInfo(std::string strInfo) + { + LOG_INFO(strInfo); + DEBUG_TRACE1("%s\n", strInfo.c_str()); + + return; + } + + std::string ExLog::printStackTrace(unsigned int uiMaxFrame /* = 63 */) + { + /* TODO: Implement Stackwalker */ + + std::string strTrace; + + strTrace = "Stack Trace\n"; + + return strTrace; + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.h b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.h new file mode 100755 index 00000000000..cb79f22d9a4 --- /dev/null +++ b/sandbox/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifndef _EX_LOG_H_ +#define _EX_LOG_H_ + +#include +#include +#include + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + typedef boost::error_info errmsg_info; + + class ExLog : public boost::exception, public std::exception + { + + public: + ExLog(); + + virtual ~ExLog() throw(); + + ExLog(unsigned int uiUserMessageID, std::exception& ex, const char* pError); + + ExLog(unsigned int uiUserMessageID, boost::exception& ex, const char* pError); + + void logInfo(std::string strInfo); + + inline unsigned int getUserMessageID() const { return _uiUserMessageID; } + virtual const char* what() const throw() { return _strWhat.c_str(); } + + protected: + + std::string printStackTrace(unsigned int max_frames = 63); + + protected: + + std::string _strWhat; + std::string _strLastErrorMessage; + unsigned int _uiUserMessageID; + }; + } + } + } + } +} +#endif diff --git a/sandbox/plc4cpp/utils/systemconfig/CMakeLists.txt b/sandbox/plc4cpp/utils/systemconfig/CMakeLists.txt new file mode 100755 index 00000000000..445d482bc9f --- /dev/null +++ b/sandbox/plc4cpp/utils/systemconfig/CMakeLists.txt @@ -0,0 +1,24 @@ +#[[ + 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. +]] + +add_library(plc4cpp-utils-systemconfig + src/main/cpp/org/apache/plc4x/cpp/utils/systemconfig/SystemConfiguration.cpp + ) + +target_include_directories (plc4cpp-utils-systemconfig PUBLIC ${Boost_INCLUDE_DIRS}) diff --git a/sandbox/plc4cpp/utils/systemconfig/src/main/cpp/org/apache/plc4x/cpp/utils/systemconfig/SystemConfiguration.cpp b/sandbox/plc4cpp/utils/systemconfig/src/main/cpp/org/apache/plc4x/cpp/utils/systemconfig/SystemConfiguration.cpp new file mode 100755 index 00000000000..37ac37056cb --- /dev/null +++ b/sandbox/plc4cpp/utils/systemconfig/src/main/cpp/org/apache/plc4x/cpp/utils/systemconfig/SystemConfiguration.cpp @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#include "SystemConfiguration.h" + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + SystemConfiguration::SystemConfiguration() + { + Load(); + + return; + } + + SystemConfiguration::~SystemConfiguration() + { + return; + } + + void SystemConfiguration::Load() + { + try + { + //pt::read_xml(CONFIGFILE.c_str(), initpTree); + } + catch(...) + { + } + return; + } + + long SystemConfiguration::getLong(std::string strPath, long lDefaultValue) + { + return lDefaultValue; + } + } + } + } + } +} diff --git a/sandbox/plc4cpp/utils/systemconfig/src/main/cpp/org/apache/plc4x/cpp/utils/systemconfig/SystemConfiguration.h b/sandbox/plc4cpp/utils/systemconfig/src/main/cpp/org/apache/plc4x/cpp/utils/systemconfig/SystemConfiguration.h new file mode 100755 index 00000000000..dfaa5d2254e --- /dev/null +++ b/sandbox/plc4cpp/utils/systemconfig/src/main/cpp/org/apache/plc4x/cpp/utils/systemconfig/SystemConfiguration.h @@ -0,0 +1,70 @@ +/* + * 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. + */ + +#ifndef _SYSTEMCONFIGURATION_H_ +#define _SYSTEMCONFIGURATION_H_ + +#include +#include +#include +#include +#include +#include +#include + +// TODO: Implementation SystemConfiguration + +namespace org +{ + namespace apache + { + namespace plc4x + { + namespace cpp + { + namespace utils + { + namespace pt = boost::property_tree; + + class SystemConfiguration : public pt::ptree + { + + public: + + SystemConfiguration(); + + ~SystemConfiguration(); + + void Load(); + + long getLong(std::string strPath, long lDefaultValue); + + private: + + const std::string CONFIGFILE = "./ Config/Config.xml"; + + pt::ptree initpTree; + + }; + } + } + } + } +} +#endif \ No newline at end of file diff --git a/sandbox/plc4py/.gitignore b/sandbox/plc4py/.gitignore old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/.pre-commit-config.yaml b/sandbox/plc4py/.pre-commit-config.yaml old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/PlcDriverManager.py b/sandbox/plc4py/plc4py/PlcDriverManager.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/__init__.py b/sandbox/plc4py/plc4py/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/PlcConnection.py b/sandbox/plc4py/plc4py/api/PlcConnection.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/PlcDriver.py b/sandbox/plc4py/plc4py/api/PlcDriver.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/__init__.py b/sandbox/plc4py/plc4py/api/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/authentication/PlcAuthentication.py b/sandbox/plc4py/plc4py/api/authentication/PlcAuthentication.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/authentication/__init__.py b/sandbox/plc4py/plc4py/api/authentication/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/exceptions/__init__.py b/sandbox/plc4py/plc4py/api/exceptions/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/exceptions/exceptions.py b/sandbox/plc4py/plc4py/api/exceptions/exceptions.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/messages/PlcDiscovery.py b/sandbox/plc4py/plc4py/api/messages/PlcDiscovery.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/messages/PlcField.py b/sandbox/plc4py/plc4py/api/messages/PlcField.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/messages/PlcMessage.py b/sandbox/plc4py/plc4py/api/messages/PlcMessage.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/messages/PlcRequest.py b/sandbox/plc4py/plc4py/api/messages/PlcRequest.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/messages/PlcResponse.py b/sandbox/plc4py/plc4py/api/messages/PlcResponse.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/messages/__init__.py b/sandbox/plc4py/plc4py/api/messages/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/value/PlcValue.py b/sandbox/plc4py/plc4py/api/value/PlcValue.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/api/value/__init__.py b/sandbox/plc4py/plc4py/api/value/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/drivers/PlcDriverLoader.py b/sandbox/plc4py/plc4py/drivers/PlcDriverLoader.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/drivers/__init__.py b/sandbox/plc4py/plc4py/drivers/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/drivers/mock/MockConnection.py b/sandbox/plc4py/plc4py/drivers/mock/MockConnection.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/drivers/mock/MockReadRequestBuilder.py b/sandbox/plc4py/plc4py/drivers/mock/MockReadRequestBuilder.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/drivers/mock/__init__.py b/sandbox/plc4py/plc4py/drivers/mock/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/drivers/modbus/ModbusConnection.py b/sandbox/plc4py/plc4py/drivers/modbus/ModbusConnection.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/drivers/modbus/__init__.py b/sandbox/plc4py/plc4py/drivers/modbus/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/PlcDriverClassLoader.py b/sandbox/plc4py/plc4py/spi/PlcDriverClassLoader.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/__init__.py b/sandbox/plc4py/plc4py/spi/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/messages/PlcReader.py b/sandbox/plc4py/plc4py/spi/messages/PlcReader.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/messages/__init__.py b/sandbox/plc4py/plc4py/spi/messages/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/messages/utils/ResponseItem.py b/sandbox/plc4py/plc4py/spi/messages/utils/ResponseItem.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/messages/utils/__init__.py b/sandbox/plc4py/plc4py/spi/messages/utils/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/values/PlcBOOL.py b/sandbox/plc4py/plc4py/spi/values/PlcBOOL.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/values/PlcINT.py b/sandbox/plc4py/plc4py/spi/values/PlcINT.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/spi/values/__init__.py b/sandbox/plc4py/plc4py/spi/values/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/utils/ConnectionStringHandling.py b/sandbox/plc4py/plc4py/utils/ConnectionStringHandling.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/utils/GenericTypes.py b/sandbox/plc4py/plc4py/utils/GenericTypes.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/plc4py/utils/__init__.py b/sandbox/plc4py/plc4py/utils/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/pom.xml b/sandbox/plc4py/pom.xml old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/setup.cfg b/sandbox/plc4py/setup.cfg old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/setup.py b/sandbox/plc4py/setup.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/tests/__init__.py b/sandbox/plc4py/tests/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/tests/test_plc4py.py b/sandbox/plc4py/tests/test_plc4py.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/tests/unit/__init__.py b/sandbox/plc4py/tests/unit/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/tests/unit/plc4py/__init__.py b/sandbox/plc4py/tests/unit/plc4py/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/tests/unit/plc4py/api/__init__.py b/sandbox/plc4py/tests/unit/plc4py/api/__init__.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/tests/unit/plc4py/api/test_PlcRequest.py b/sandbox/plc4py/tests/unit/plc4py/api/test_PlcRequest.py old mode 100644 new mode 100755 diff --git a/sandbox/plc4py/tests/unit/plc4py/drivers/modbus/test_modbus_connection.py b/sandbox/plc4py/tests/unit/plc4py/drivers/modbus/test_modbus_connection.py old mode 100644 new mode 100755 diff --git a/sandbox/pom.xml b/sandbox/pom.xml old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/README.adoc b/sandbox/test-java-df1-driver/README.adoc old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/pom.xml b/sandbox/test-java-df1-driver/pom.xml old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/DF1PlcDriver.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/DF1PlcDriver.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/configuration/Df1Configuration.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/configuration/Df1Configuration.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/field/Df1Tag.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/field/Df1Tag.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/field/Df1TagHandler.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/field/Df1TagHandler.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1Protocol.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1Protocol.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1ProtocolLogic.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1ProtocolLogic.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Plc4XDf1Protocol.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Plc4XDf1Protocol.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/readwrite/utils/StaticHelper.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/readwrite/utils/StaticHelper.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/types/DataType.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/types/DataType.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver b/sandbox/test-java-df1-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkGeneratedDf1.java b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkGeneratedDf1.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkManualDf1.java b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkManualDf1.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/Df1ParserSerializerTest.java b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/Df1ParserSerializerTest.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/EndToEndTest.java b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/EndToEndTest.java old mode 100644 new mode 100755 diff --git a/sandbox/test-java-df1-driver/src/test/resources/logback-test.xml b/sandbox/test-java-df1-driver/src/test/resources/logback-test.xml old mode 100644 new mode 100755 diff --git a/src/main/script/preSiteGeneration.groovy b/src/main/script/preSiteGeneration.groovy old mode 100644 new mode 100755 diff --git a/src/main/script/prerequisiteCheck.groovy b/src/main/script/prerequisiteCheck.groovy old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/apache/index.adoc b/src/site/asciidoc/apache/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/building.adoc b/src/site/asciidoc/developers/building.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/code-gen/index.adoc b/src/site/asciidoc/developers/code-gen/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/code-gen/language/freemarker.adoc b/src/site/asciidoc/developers/code-gen/language/freemarker.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/code-gen/protocol/df1.adoc b/src/site/asciidoc/developers/code-gen/protocol/df1.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/code-gen/protocol/mspec.adoc b/src/site/asciidoc/developers/code-gen/protocol/mspec.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/conferences.adoc b/src/site/asciidoc/developers/conferences.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/contributing.adoc b/src/site/asciidoc/developers/contributing.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/decisions.adoc b/src/site/asciidoc/developers/decisions.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/index.adoc b/src/site/asciidoc/developers/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/ci.adoc b/src/site/asciidoc/developers/infrastructure/ci.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/index.adoc b/src/site/asciidoc/developers/infrastructure/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/issues.adoc b/src/site/asciidoc/developers/infrastructure/issues.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/sonar.adoc b/src/site/asciidoc/developers/infrastructure/sonar.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/vm.adoc b/src/site/asciidoc/developers/infrastructure/vm.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/vpn.adoc b/src/site/asciidoc/developers/infrastructure/vpn.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/website.adoc b/src/site/asciidoc/developers/infrastructure/website.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/infrastructure/wiki.adoc b/src/site/asciidoc/developers/infrastructure/wiki.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/jqassistant.adoc b/src/site/asciidoc/developers/jqassistant.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/maturity.adoc b/src/site/asciidoc/developers/maturity.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/preparing/index.adoc b/src/site/asciidoc/developers/preparing/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/preparing/linux.adoc b/src/site/asciidoc/developers/preparing/linux.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/preparing/macos.adoc b/src/site/asciidoc/developers/preparing/macos.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/preparing/windows.adoc b/src/site/asciidoc/developers/preparing/windows.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/release/build-tools.adoc b/src/site/asciidoc/developers/release/build-tools.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/release/index.adoc b/src/site/asciidoc/developers/release/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/release/release.adoc b/src/site/asciidoc/developers/release/release.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/release/validation.adoc b/src/site/asciidoc/developers/release/validation.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/team.adoc b/src/site/asciidoc/developers/team.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/tools.adoc b/src/site/asciidoc/developers/tools.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/tutorials/index.adoc b/src/site/asciidoc/developers/tutorials/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/tutorials/testing-serializers-and-parsers.adoc b/src/site/asciidoc/developers/tutorials/testing-serializers-and-parsers.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/developers/tutorials/writing-driver.adoc b/src/site/asciidoc/developers/tutorials/writing-driver.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/index.adoc b/src/site/asciidoc/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/plc4go/index.adoc b/src/site/asciidoc/plc4go/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/plc4j/index.adoc b/src/site/asciidoc/plc4j/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/ab-eth/index.adoc b/src/site/asciidoc/protocols/ab-eth/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/ads/index.adoc b/src/site/asciidoc/protocols/ads/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/canopen/index.adoc b/src/site/asciidoc/protocols/canopen/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/delta-v/index.adoc b/src/site/asciidoc/protocols/delta-v/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/delta-v/read-data.adoc b/src/site/asciidoc/protocols/delta-v/read-data.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/delta-v/reverse-engineering.adoc b/src/site/asciidoc/protocols/delta-v/reverse-engineering.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/ehtercat/index.adoc b/src/site/asciidoc/protocols/ehtercat/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/ethernet-ip/index.adoc b/src/site/asciidoc/protocols/ethernet-ip/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/features.adoc b/src/site/asciidoc/protocols/features.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/index.adoc b/src/site/asciidoc/protocols/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/modbus/index.adoc b/src/site/asciidoc/protocols/modbus/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/opc-ua/index.adoc b/src/site/asciidoc/protocols/opc-ua/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/s7/index.adoc b/src/site/asciidoc/protocols/s7/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/s7/s7comm-plus.adoc b/src/site/asciidoc/protocols/s7/s7comm-plus.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/protocols/s7/s7comm.adoc b/src/site/asciidoc/protocols/s7/s7comm.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/adopters.adoc b/src/site/asciidoc/users/adopters.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/blogs-videos-and-slides.adoc b/src/site/asciidoc/users/blogs-videos-and-slides.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/commercial-support.adoc b/src/site/asciidoc/users/commercial-support.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/download.adoc b/src/site/asciidoc/users/download.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/getting-started/general-concepts.adoc b/src/site/asciidoc/users/getting-started/general-concepts.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/getting-started/plc4go.adoc b/src/site/asciidoc/users/getting-started/plc4go.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/getting-started/plc4j.adoc b/src/site/asciidoc/users/getting-started/plc4j.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/getting-started/using-snapshots.adoc b/src/site/asciidoc/users/getting-started/using-snapshots.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/getting-started/virtual-modbus.adoc b/src/site/asciidoc/users/getting-started/virtual-modbus.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/gettingstarted.adoc b/src/site/asciidoc/users/gettingstarted.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/index.adoc b/src/site/asciidoc/users/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/industry40.adoc b/src/site/asciidoc/users/industry40.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/apache-calcite.adoc b/src/site/asciidoc/users/integrations/apache-calcite.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/apache-camel.adoc b/src/site/asciidoc/users/integrations/apache-camel.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/apache-edgent.adoc b/src/site/asciidoc/users/integrations/apache-edgent.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/apache-iotdb.adoc b/src/site/asciidoc/users/integrations/apache-iotdb.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/apache-kafka.adoc b/src/site/asciidoc/users/integrations/apache-kafka.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/apache-nifi.adoc b/src/site/asciidoc/users/integrations/apache-nifi.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/apache-streampipes.adoc b/src/site/asciidoc/users/integrations/apache-streampipes.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/eclipse-ditto.adoc b/src/site/asciidoc/users/integrations/eclipse-ditto.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/eclipse-milo.adoc b/src/site/asciidoc/users/integrations/eclipse-milo.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/integrations/index.adoc b/src/site/asciidoc/users/integrations/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/preparing-issues.adoc b/src/site/asciidoc/users/preparing-issues.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/ab-eth.adoc b/src/site/asciidoc/users/protocols/ab-eth.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/ads.adoc b/src/site/asciidoc/users/protocols/ads.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/bacnetip.adoc b/src/site/asciidoc/users/protocols/bacnetip.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/can.adoc b/src/site/asciidoc/users/protocols/can.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/canopen.adoc b/src/site/asciidoc/users/protocols/canopen.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/deltav.adoc b/src/site/asciidoc/users/protocols/deltav.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/df1.adoc b/src/site/asciidoc/users/protocols/df1.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/ethernet-ip.adoc b/src/site/asciidoc/users/protocols/ethernet-ip.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/firmata.adoc b/src/site/asciidoc/users/protocols/firmata.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/genericcan.adoc b/src/site/asciidoc/users/protocols/genericcan.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/index.adoc b/src/site/asciidoc/users/protocols/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/knxnetip.adoc b/src/site/asciidoc/users/protocols/knxnetip.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/modbus.adoc b/src/site/asciidoc/users/protocols/modbus.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/opc-ua.adoc b/src/site/asciidoc/users/protocols/opc-ua.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/s7.adoc b/src/site/asciidoc/users/protocols/s7.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/protocols/simulated.adoc b/src/site/asciidoc/users/protocols/simulated.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/security.adoc b/src/site/asciidoc/users/security.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/tools/capture-replay.adoc b/src/site/asciidoc/users/tools/capture-replay.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/tools/connection-cache.adoc b/src/site/asciidoc/users/tools/connection-cache.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/tools/connection-pool.adoc b/src/site/asciidoc/users/tools/connection-pool.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/tools/index.adoc b/src/site/asciidoc/users/tools/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/tools/opm.adoc b/src/site/asciidoc/users/tools/opm.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/tools/scraper.adoc b/src/site/asciidoc/users/tools/scraper.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/tools/testing.adoc b/src/site/asciidoc/users/tools/testing.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/can.adoc b/src/site/asciidoc/users/transports/can.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/index.adoc b/src/site/asciidoc/users/transports/index.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/pcap-replay.adoc b/src/site/asciidoc/users/transports/pcap-replay.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/raw-socket.adoc b/src/site/asciidoc/users/transports/raw-socket.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/serial.adoc b/src/site/asciidoc/users/transports/serial.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/socketcan.adoc b/src/site/asciidoc/users/transports/socketcan.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/tcp.adoc b/src/site/asciidoc/users/transports/tcp.adoc old mode 100644 new mode 100755 diff --git a/src/site/asciidoc/users/transports/udp.adoc b/src/site/asciidoc/users/transports/udp.adoc old mode 100644 new mode 100755 diff --git a/src/site/resources-filtered/plc4x-doap.rdf b/src/site/resources-filtered/plc4x-doap.rdf old mode 100644 new mode 100755 diff --git a/src/site/resources/.asf.yaml b/src/site/resources/.asf.yaml old mode 100644 new mode 100755 diff --git a/src/site/resources/.htaccess b/src/site/resources/.htaccess old mode 100644 new mode 100755 diff --git a/src/site/resources/css/bootstrap-responsive.min.css b/src/site/resources/css/bootstrap-responsive.min.css old mode 100644 new mode 100755 diff --git a/src/site/resources/css/site.css b/src/site/resources/css/site.css old mode 100644 new mode 100755 diff --git a/src/site/resources/images/apache_brooklyn_logo.png b/src/site/resources/images/apache_brooklyn_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/apache_logo.png b/src/site/resources/images/apache_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/apache_logo_small.png b/src/site/resources/images/apache_logo_small.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/apache_mynewt_logo.png b/src/site/resources/images/apache_mynewt_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/apache_plc4x_logo.png b/src/site/resources/images/apache_plc4x_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/apache_plc4x_logo_small.png b/src/site/resources/images/apache_plc4x_logo_small.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/background-index-3.png b/src/site/resources/images/background-index-3.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/community-contribute-fork.png b/src/site/resources/images/community-contribute-fork.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/contributing-github-create-pull-request.png b/src/site/resources/images/contributing-github-create-pull-request.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/contributing-github-fork.png b/src/site/resources/images/contributing-github-fork.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/apache_calcite_logo.svg b/src/site/resources/images/integrations/apache_calcite_logo.svg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/apache_camel_logo.png b/src/site/resources/images/integrations/apache_camel_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/apache_edgent_logo.png b/src/site/resources/images/integrations/apache_edgent_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/apache_iotdb_logo.png b/src/site/resources/images/integrations/apache_iotdb_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/apache_kafka_logo.png b/src/site/resources/images/integrations/apache_kafka_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/apache_nifi_logo.svg b/src/site/resources/images/integrations/apache_nifi_logo.svg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/apache_streampipes_logo.png b/src/site/resources/images/integrations/apache_streampipes_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/eclipse_ditto_logo.png b/src/site/resources/images/integrations/eclipse_ditto_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/elastic_logstash_logo.png b/src/site/resources/images/integrations/elastic_logstash_logo.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/add-processor.png b/src/site/resources/images/integrations/nifi/add-processor.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/configure-processor-properties.png b/src/site/resources/images/integrations/nifi/configure-processor-properties.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/configure-scheduling.png b/src/site/resources/images/integrations/nifi/configure-scheduling.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/configured-flow.png b/src/site/resources/images/integrations/nifi/configured-flow.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/configured-log-processor.png b/src/site/resources/images/integrations/nifi/configured-log-processor.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/configured-plc4x-source-processor.png b/src/site/resources/images/integrations/nifi/configured-plc4x-source-processor.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/configuring-connection.png b/src/site/resources/images/integrations/nifi/configuring-connection.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/empty-nifi-flow.png b/src/site/resources/images/integrations/nifi/empty-nifi-flow.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/list-of-plc4x-processors.png b/src/site/resources/images/integrations/nifi/list-of-plc4x-processors.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/integrations/nifi/running-flow.png b/src/site/resources/images/integrations/nifi/running-flow.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/iot-lab.jpg b/src/site/resources/images/iot-lab.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/neo4j-intellij-database-connections-view.png b/src/site/resources/images/neo4j-intellij-database-connections-view.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/neo4j-intellij-query-results.png b/src/site/resources/images/neo4j-intellij-query-results.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/neo4j-intellij-settings.png b/src/site/resources/images/neo4j-intellij-settings.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/neo4j-web-console.png b/src/site/resources/images/neo4j-web-console.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-beckhoff-route-1.png b/src/site/resources/images/plcs/plc4x-vpn-beckhoff-route-1.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-beckhoff-route-2.png b/src/site/resources/images/plcs/plc4x-vpn-beckhoff-route-2.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-beckhoff-route-3.png b/src/site/resources/images/plcs/plc4x-vpn-beckhoff-route-3.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-beckhoff.jpg b/src/site/resources/images/plcs/plc4x-vpn-beckhoff.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-client-download.png b/src/site/resources/images/plcs/plc4x-vpn-client-download.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-fatek.jpg b/src/site/resources/images/plcs/plc4x-vpn-fatek.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-siemens-hmi.jpg b/src/site/resources/images/plcs/plc4x-vpn-siemens-hmi.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-siemens-s7.jpg b/src/site/resources/images/plcs/plc4x-vpn-siemens-s7.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/plcs/plc4x-vpn-wago.jpg b/src/site/resources/images/plcs/plc4x-vpn-wago.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/protocols/ads-ams.png b/src/site/resources/images/protocols/ads-ams.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/protocols/bacnet-ip.gif b/src/site/resources/images/protocols/bacnet-ip.gif old mode 100644 new mode 100755 diff --git a/src/site/resources/images/release-git-diff-next-development-iteration.png b/src/site/resources/images/release-git-diff-next-development-iteration.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/release-git-diff-prepare-release.png b/src/site/resources/images/release-git-diff-prepare-release.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/release-git-history.png b/src/site/resources/images/release-git-history.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/team/cdutz.png b/src/site/resources/images/team/cdutz.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/team/jfeinauer.jpg b/src/site/resources/images/team/jfeinauer.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/team/ldywicki.jpg b/src/site/resources/images/team/ldywicki.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/team/mstrljic.jpg b/src/site/resources/images/team/mstrljic.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/team/sruehl.jpg b/src/site/resources/images/team/sruehl.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/team/tmitsch.png b/src/site/resources/images/team/tmitsch.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/toddy-loves-apache.png b/src/site/resources/images/toddy-loves-apache.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-1.png b/src/site/resources/images/tutorials/modbus/ModbusPal-1.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-2.png b/src/site/resources/images/tutorials/modbus/ModbusPal-2.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-3.png b/src/site/resources/images/tutorials/modbus/ModbusPal-3.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-4.png b/src/site/resources/images/tutorials/modbus/ModbusPal-4.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-5.png b/src/site/resources/images/tutorials/modbus/ModbusPal-5.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-6.png b/src/site/resources/images/tutorials/modbus/ModbusPal-6.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-7.png b/src/site/resources/images/tutorials/modbus/ModbusPal-7.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-8.png b/src/site/resources/images/tutorials/modbus/ModbusPal-8.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/tutorials/modbus/ModbusPal-9.png b/src/site/resources/images/tutorials/modbus/ModbusPal-9.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-c-ware.png b/src/site/resources/images/users/companies/logo-c-ware.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-codecentric.png b/src/site/resources/images/users/companies/logo-codecentric.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-connectorio.png b/src/site/resources/images/users/companies/logo-connectorio.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-industryfusion.png b/src/site/resources/images/users/companies/logo-industryfusion.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-lebbing-automation-drives.png b/src/site/resources/images/users/companies/logo-lebbing-automation-drives.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-pietrorimoldi.jpg b/src/site/resources/images/users/companies/logo-pietrorimoldi.jpg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-pragmatic-industries.svg b/src/site/resources/images/users/companies/logo-pragmatic-industries.svg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo-pragmatic-minds.svg b/src/site/resources/images/users/companies/logo-pragmatic-minds.svg old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo_record_evolution_single_dark_bgfont.png b/src/site/resources/images/users/companies/logo_record_evolution_single_dark_bgfont.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/companies/logo_unistuttgart_isw.png b/src/site/resources/images/users/companies/logo_unistuttgart_isw.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7-tia-device-settings.png b/src/site/resources/images/users/protocols/s7-tia-device-settings.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7-tia-io-settings.png b/src/site/resources/images/users/protocols/s7-tia-io-settings.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7.png b/src/site/resources/images/users/protocols/s7.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_alert.png b/src/site/resources/images/users/protocols/s7_alert.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_banner.png b/src/site/resources/images/users/protocols/s7_banner.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_caution.png b/src/site/resources/images/users/protocols/s7_caution.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_danger.png b/src/site/resources/images/users/protocols/s7_danger.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_dont.png b/src/site/resources/images/users/protocols/s7_dont.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_ex.png b/src/site/resources/images/users/protocols/s7_ex.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_important.png b/src/site/resources/images/users/protocols/s7_important.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_note.png b/src/site/resources/images/users/protocols/s7_note.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_tip.png b/src/site/resources/images/users/protocols/s7_tip.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_toddy.png b/src/site/resources/images/users/protocols/s7_toddy.png old mode 100644 new mode 100755 diff --git a/src/site/resources/images/users/protocols/s7_warning.png b/src/site/resources/images/users/protocols/s7_warning.png old mode 100644 new mode 100755 diff --git a/src/site/resources/plc4go.html b/src/site/resources/plc4go.html old mode 100644 new mode 100755 diff --git a/src/site/resources/plc4x-pmc.rdf b/src/site/resources/plc4x-pmc.rdf old mode 100644 new mode 100755 diff --git a/src/site/site.xml b/src/site/site.xml old mode 100644 new mode 100755 diff --git a/tools/README.md b/tools/README.md new file mode 100755 index 00000000000..80634ba7f1a --- /dev/null +++ b/tools/README.md @@ -0,0 +1,72 @@ + +# Linux + +On a clean Ubuntu 18.04 the following software needs to be installed: + + sudo apt install bison flex python-dev + +If you're building a source-distribution and haven't installed git yet, be sure to do so: + + sudo get install git + +# MAC + +Make sure `Homebrew` is installed in order to update `Bison` to a newer version (the version 2.3 installed per default is too old) + + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + +Then update `Bison`: + + brew install bison + brew link bison --force + echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile + +Install `Python 2.7`: + + brew install python@2 + +Be sure to re-open the command window or the changes will not apply. + +# Windows + +Some tools need to be installed before being able to build on Windows: + +- WinBuilds +- Bison +- Flex +- Python 2.7 + +He have tested WinBuilds with the bundle of: http://win-builds.org/doku.php/download_and_installation_from_windows +When running the installer, make sure to select the options: +- Native Windows +- x86_64 +Not quite sure which elements are really needed, better just install all of them. + +For Bison, please download the Setup installer version from here: http://gnuwin32.sourceforge.net/packages/bison.htm (When using the zip version the bison.exe couldn't find some DLL files) +It seems the official 2.4.1 version has issues when installed in a directory which's path contains spaces. Please make sure you replace the exe with a patched version form here: http://marin.jb.free.fr/bison/bison-2.4.1-modified.zip +(More infos on this issue here: https://sourceforge.net/p/gnuwin32/bugs/473/) + +Please download the Flex compiler from here: http://gnuwin32.sourceforge.net/packages/flex.htm (Ideally download the binary zip distribution) + +You can get Python from here: https://www.python.org/downloads/release/python-2716/ + +Make sure the `bin` directories of containing the executables `mingw32-make.exe`, `bison.exe` and `flex.exe` are all on your systems `PATH`. + +If you're building a source-distribution and haven't installed git yet, be sure to do so. diff --git a/tools/boost/pom.xml b/tools/boost/pom.xml new file mode 100755 index 00000000000..9c312d35f95 --- /dev/null +++ b/tools/boost/pom.xml @@ -0,0 +1,141 @@ + + + + + 4.0.0 + + + org.apache.plc4x + plc4x-tools + 0.10.0-SNAPSHOT + + + plc4x-tools-boost + pom + + Tools: Boost + Building of the Boost library. + + + + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + + + get-boost + generate-sources + + wget + + + ${boost.url} + true + ${project.build.directory} + + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + bootstrap-boost + process-sources + + exec + + + ${boost.bootstrap.executable} + + + --with-toolset=clang + + ${project.build.directory}/boost_${boost.version.underline} + + + + compile-boost + process-sources + + exec + + + ${boost.build.executable} + + + install + + --prefix=${project.build.directory}/lib/boost + + --with-system + --with-thread + --with-date_time + --with-regex + --with-log + + address-model=64 + + cxxflags=-fPIC + + ${project.build.directory}/boost_${boost.version.underline} + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package-boost-library + package + + single + + + ${project.artifactId}-${project.version} + + src/assembly/bundle.xml + + + + + + + + + \ No newline at end of file diff --git a/tools/boost/src/assembly/bundle.xml b/tools/boost/src/assembly/bundle.xml new file mode 100755 index 00000000000..ae94f4299d0 --- /dev/null +++ b/tools/boost/src/assembly/bundle.xml @@ -0,0 +1,40 @@ + + + + lib-${os.classifier} + + + zip + + + false + + + + ${project.build.directory}/lib/boost + + ** + + + + + \ No newline at end of file