You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/06/10 12:37:43 UTC

[plc4x] branch develop updated: fix: fix issues

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 43227e086d fix: fix issues
43227e086d is described below

commit 43227e086d74a991b1cb6dd98db84fdccdb5d209
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Jun 10 14:37:36 2022 +0200

    fix: fix issues
---
 .../eip/readwrite/model/CIPStructTypeCode.go       | 114 +++++++++++++++++++++
 .../plc4x/java/bacnetip/RandomPackagesTest.java    |   2 +-
 .../java/spi/generation/ReadBufferXmlBased.java    |   1 +
 3 files changed, 116 insertions(+), 1 deletion(-)

diff --git a/plc4go/protocols/eip/readwrite/model/CIPStructTypeCode.go b/plc4go/protocols/eip/readwrite/model/CIPStructTypeCode.go
new file mode 100644
index 0000000000..1328381cc9
--- /dev/null
+++ b/plc4go/protocols/eip/readwrite/model/CIPStructTypeCode.go
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package model
+
+import (
+	"github.com/apache/plc4x/plc4go/internal/spi/utils"
+	"github.com/pkg/errors"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// CIPStructTypeCode is an enum
+type CIPStructTypeCode uint16
+
+type ICIPStructTypeCode interface {
+	Serialize(writeBuffer utils.WriteBuffer) error
+}
+
+const (
+	CIPStructTypeCode_STRING CIPStructTypeCode = 0x0FCE
+)
+
+var CIPStructTypeCodeValues []CIPStructTypeCode
+
+func init() {
+	_ = errors.New
+	CIPStructTypeCodeValues = []CIPStructTypeCode{
+		CIPStructTypeCode_STRING,
+	}
+}
+
+func CIPStructTypeCodeByValue(value uint16) CIPStructTypeCode {
+	switch value {
+	case 0x0FCE:
+		return CIPStructTypeCode_STRING
+	}
+	return 0
+}
+
+func CIPStructTypeCodeByName(value string) CIPStructTypeCode {
+	switch value {
+	case "STRING":
+		return CIPStructTypeCode_STRING
+	}
+	return 0
+}
+
+func CIPStructTypeCodeKnows(value uint16) bool {
+	for _, typeValue := range CIPStructTypeCodeValues {
+		if uint16(typeValue) == value {
+			return true
+		}
+	}
+	return false
+}
+
+func CastCIPStructTypeCode(structType interface{}) CIPStructTypeCode {
+	castFunc := func(typ interface{}) CIPStructTypeCode {
+		if sCIPStructTypeCode, ok := typ.(CIPStructTypeCode); ok {
+			return sCIPStructTypeCode
+		}
+		return 0
+	}
+	return castFunc(structType)
+}
+
+func (m CIPStructTypeCode) GetLengthInBits() uint16 {
+	return 16
+}
+
+func (m CIPStructTypeCode) GetLengthInBytes() uint16 {
+	return m.GetLengthInBits() / 8
+}
+
+func CIPStructTypeCodeParse(readBuffer utils.ReadBuffer) (CIPStructTypeCode, error) {
+	val, err := readBuffer.ReadUint16("CIPStructTypeCode", 16)
+	if err != nil {
+		return 0, nil
+	}
+	return CIPStructTypeCodeByValue(val), nil
+}
+
+func (e CIPStructTypeCode) Serialize(writeBuffer utils.WriteBuffer) error {
+	return writeBuffer.WriteUint16("CIPStructTypeCode", 16, uint16(e), utils.WithAdditionalStringRepresentation(e.name()))
+}
+
+func (e CIPStructTypeCode) name() string {
+	switch e {
+	case CIPStructTypeCode_STRING:
+		return "STRING"
+	}
+	return ""
+}
+
+func (e CIPStructTypeCode) String() string {
+	return e.name()
+}
diff --git a/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java
index 8eea94e89c..66b6361b07 100644
--- a/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java
+++ b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java
@@ -1272,7 +1272,7 @@ public class RandomPackagesTest {
     Collection<DynamicNode> RPM_ALL_Allobjecttypes1() throws Exception {
         TestPcapEvaluator pcapEvaluator = pcapEvaluator("RPM_ALL_Allobjecttypes1.pcap");
         return List.of(pcapEvaluator.parseEmAll(
-            skip(31, "set point reference looks completly broken")
+            skip(31, "set point reference looks completely broken")
         ));
     }
 
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferXmlBased.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferXmlBased.java
index 15b6d685d2..285c9e41eb 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferXmlBased.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferXmlBased.java
@@ -39,6 +39,7 @@ public class ReadBufferXmlBased implements ReadBuffer, BufferCommons {
 
     public ReadBufferXmlBased(InputStream is) {
         XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+        xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
         try {
             reader = xmlInputFactory.createXMLEventReader(is);
         } catch (XMLStreamException e) {