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/05/19 13:19:35 UTC
[plc4x] branch develop updated: feat(bacnet): implemented improved generic method to handle enums which can have extended values
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 34e26f171e feat(bacnet): implemented improved generic method to handle enums which can have extended values
34e26f171e is described below
commit 34e26f171eb220769e41704ca502030e9b048088
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu May 19 15:19:27 2022 +0200
feat(bacnet): implemented improved generic method to handle enums which can have extended values
+ fix(plc4go/codegen): Added pre-emptive cast to manual fields
---
.../language/go/GoLanguageTemplateHelper.java | 20 +-
.../templates/go/complex-type-template.go.ftlh | 3 +-
.../plc4go/bacnetip/readwrite/ParserHelper.go | 9 +-
.../plc4go/bacnetip/readwrite/XmlParserHelper.go | 10 +-
.../model/BACnetConstructedDataReliability.go | 14 +-
.../model/BACnetConstructedDataReliabilityEntry.go | 220 ------------------
.../readwrite/model/BACnetContextTagEventState.go | 6 +-
.../readwrite/model/BACnetContextTagEventType.go | 6 +-
.../model/BACnetContextTagPropertyIdentifier.go | 6 +-
.../readwrite/model/BACnetPropertyStates.go | 2 +
...ility.go => BACnetPropertyStatesReliability.go} | 96 ++++----
.../bacnetip/readwrite/model/BACnetReliability.go | 8 +
.../readwrite/model/BACnetReliabilityTagged.go | 246 +++++++++++++++++++++
.../model/BACnetTagPayloadObjectIdentifier.go | 6 +-
.../bacnetip/readwrite/model/StaticHelper.go | 114 +++++++++-
.../s7/readwrite/model/AssociatedValueType.go | 3 +-
.../plc4go/s7/readwrite/model/DateAndTime.go | 21 +-
.../plc4go/s7/readwrite/model/StaticHelper.go | 12 +-
.../bacnetip/readwrite/utils/StaticHelper.java | 154 ++++++++++++-
.../plc4x/java/bacnetip/RandomPackagesTest.java | 2 +-
.../resources/protocols/bacnetip/bacnetip.mspec | 53 +++--
21 files changed, 660 insertions(+), 351 deletions(-)
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
index e4c6f6aad1..1609219dbc 100644
--- 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
@@ -94,22 +94,22 @@ public class GoLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelp
// TODO: shouldn't this be an error case
return "";
}
- if (typeReference instanceof ArrayTypeReference) {
+ if (typeReference.isArrayTypeReference()) {
final ArrayTypeReference arrayTypeReference = (ArrayTypeReference) typeReference;
TypeReference elementTypeReference = arrayTypeReference.getElementTypeReference();
return "[]" + (elementTypeReference.isNonSimpleTypeReference() && !elementTypeReference.isEnumTypeReference() ? "*" : "") + getLanguageTypeNameForTypeReference(elementTypeReference);
}
- if (!(typeReference instanceof SimpleTypeReference)) {
- return ((NonSimpleTypeReference) typeReference).getName();
+ if (typeReference.isNonSimpleTypeReference()) {
+ return typeReference.asNonSimpleTypeReference().orElseThrow().getName();
}
- SimpleTypeReference simpleTypeReference = (SimpleTypeReference) typeReference;
+ SimpleTypeReference simpleTypeReference = typeReference.asSimpleTypeReference().orElseThrow();
switch (simpleTypeReference.getBaseType()) {
case BIT:
return "bool";
case BYTE:
return "byte";
case UINT:
- IntegerTypeReference unsignedIntegerTypeReference = (IntegerTypeReference) simpleTypeReference;
+ IntegerTypeReference unsignedIntegerTypeReference = simpleTypeReference.asIntegerTypeReference().orElseThrow();
if (unsignedIntegerTypeReference.getSizeInBits() <= 8) {
return "uint8";
}
@@ -125,7 +125,7 @@ public class GoLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelp
emitRequiredImport("math/big");
return "*big.Int";
case INT:
- IntegerTypeReference integerTypeReference = (IntegerTypeReference) simpleTypeReference;
+ IntegerTypeReference integerTypeReference = simpleTypeReference.asIntegerTypeReference().orElseThrow();
if (integerTypeReference.getSizeInBits() <= 8) {
return "int8";
}
@@ -142,7 +142,7 @@ public class GoLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelp
return "*big.Int";
case FLOAT:
case UFLOAT:
- FloatTypeReference floatTypeReference = (FloatTypeReference) simpleTypeReference;
+ FloatTypeReference floatTypeReference = simpleTypeReference.asFloatTypeReference().orElseThrow();
int sizeInBits = floatTypeReference.getSizeInBits();
if (sizeInBits <= 32) {
return "float32";
@@ -729,8 +729,10 @@ public class GoLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelp
.filter(OptionalField.class::isInstance)
.isPresent()
) {
+ tracer = tracer.dive("non serialize optional fields");
return toOptionalVariableExpression(field, typeReference, variableLiteral, parserArguments, serializerArguments, suppressPointerAccess, tracer);
- } // If we are accessing optional fields, (we might need to use pointer-access).
+ }
+ // If we are accessing optional fields, (we might need to use pointer-access).
else if (thisType.isComplexTypeDefinition()
&& thisType.asComplexTypeDefinition()
.orElseThrow(IllegalStateException::new)
@@ -738,7 +740,7 @@ public class GoLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelp
.filter(OptionalField.class::isInstance)
.isPresent()
) {
- tracer = tracer.dive("optional fields 2");
+ tracer = tracer.dive("optional fields");
return tracer + "(" + (suppressPointerAccess ? "" : "*") + "m.Get" + capitalize(variableLiteral.getName()) + "())" +
variableLiteral.getChild().map(child -> "." + capitalize(toVariableExpression(field, typeReference, child, parserArguments, serializerArguments, false, suppressPointerAccess, true))).orElse("");
}
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
index 205cfe57ac..919ea44183 100644
--- 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
@@ -1071,10 +1071,11 @@ func ${type.name}Parse(readBuffer utils.ReadBuffer<#if hasParserArguments>, ${pa
<#assign manualField = field.asManualField().orElseThrow()>
// Manual Field (${manualField.name})
- ${manualField.name}, _${manualField.name}Err := ${helper.toParseExpression(manualField, manualField.type, manualField.parseExpression, parserArguments)}
+ _${manualField.name}, _${manualField.name}Err := ${helper.toParseExpression(manualField, manualField.type, manualField.parseExpression, parserArguments)}
if _${manualField.name}Err != nil {
return nil, errors.Wrap(_${manualField.name}Err, "Error parsing '${manualField.name}' field")<@emitImport import="github.com/pkg/errors" />
}
+ ${manualField.name} := _${manualField.name}.(${helper.getLanguageTypeNameForField(manualField)})
<#break>
<#case "optional">
<#assign optionalField = field.asOptionalField().orElseThrow()>
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go b/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go
index 101a2295d0..cf116f65af 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go
@@ -81,6 +81,13 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util
return model.NLMParse(io, apduLength)
case "BACnetActionCommand":
return model.BACnetActionCommandParse(io)
+ case "BACnetReliabilityTagged":
+ tagClass := model.TagClassByName(arguments[0])
+ tagNumber, err := utils.StrToUint8(arguments[1])
+ if err != nil {
+ return nil, errors.Wrap(err, "Error parsing")
+ }
+ return model.BACnetReliabilityTaggedParse(io, tagClass, tagNumber)
case "BACnetTagPayloadDate":
return model.BACnetTagPayloadDateParse(io)
case "BACnetNotificationParametersExtendedParameters":
@@ -203,8 +210,6 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util
case "ListOfCovNotificationsValue":
objectType := model.BACnetObjectTypeByName(arguments[0])
return model.ListOfCovNotificationsValueParse(io, objectType)
- case "BACnetConstructedDataReliabilityEntry":
- return model.BACnetConstructedDataReliabilityEntryParse(io)
case "BACnetDateTime":
return model.BACnetDateTimeParse(io)
case "ErrorEnclosed":
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/XmlParserHelper.go b/plc4go/internal/plc4go/bacnetip/readwrite/XmlParserHelper.go
index fd82d0b74b..346425c1a4 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/XmlParserHelper.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/XmlParserHelper.go
@@ -98,6 +98,14 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser
return model.NLMParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), apduLength)
case "BACnetActionCommand":
return model.BACnetActionCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "BACnetReliabilityTagged":
+ tagClass := model.TagClassByName(parserArguments[0])
+ parsedUint1, err := strconv.ParseUint(parserArguments[1], 10, 8)
+ if err != nil {
+ return nil, err
+ }
+ tagNumber := uint8(parsedUint1)
+ return model.BACnetReliabilityTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagClass, tagNumber)
case "BACnetTagPayloadDate":
return model.BACnetTagPayloadDateParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "BACnetNotificationParametersExtendedParameters":
@@ -235,8 +243,6 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser
case "ListOfCovNotificationsValue":
objectType := model.BACnetObjectTypeByName(parserArguments[0])
return model.ListOfCovNotificationsValueParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), objectType)
- case "BACnetConstructedDataReliabilityEntry":
- return model.BACnetConstructedDataReliabilityEntryParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "BACnetDateTime":
return model.BACnetDateTimeParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "ErrorEnclosed":
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go
index 1303f4e4ff..b65c3e4c2a 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go
@@ -29,7 +29,7 @@ import (
// BACnetConstructedDataReliability is the data-structure of this message
type BACnetConstructedDataReliability struct {
*BACnetConstructedData
- Reliability *BACnetConstructedDataReliabilityEntry
+ Reliability *BACnetReliabilityTagged
// Arguments.
TagNumber uint8
@@ -40,7 +40,7 @@ type BACnetConstructedDataReliability struct {
type IBACnetConstructedDataReliability interface {
IBACnetConstructedData
// GetReliability returns Reliability (property field)
- GetReliability() *BACnetConstructedDataReliabilityEntry
+ GetReliability() *BACnetReliabilityTagged
// GetLengthInBytes returns the length in bytes
GetLengthInBytes() uint16
// GetLengthInBits returns the length in bits
@@ -77,7 +77,7 @@ func (m *BACnetConstructedDataReliability) GetParent() *BACnetConstructedData {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *BACnetConstructedDataReliability) GetReliability() *BACnetConstructedDataReliabilityEntry {
+func (m *BACnetConstructedDataReliability) GetReliability() *BACnetReliabilityTagged {
return m.Reliability
}
@@ -87,7 +87,7 @@ func (m *BACnetConstructedDataReliability) GetReliability() *BACnetConstructedDa
///////////////////////////////////////////////////////////
// NewBACnetConstructedDataReliability factory function for BACnetConstructedDataReliability
-func NewBACnetConstructedDataReliability(reliability *BACnetConstructedDataReliabilityEntry, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8, propertyIdentifierArgument BACnetContextTagPropertyIdentifier) *BACnetConstructedDataReliability {
+func NewBACnetConstructedDataReliability(reliability *BACnetReliabilityTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8, propertyIdentifierArgument BACnetContextTagPropertyIdentifier) *BACnetConstructedDataReliability {
_result := &BACnetConstructedDataReliability{
Reliability: reliability,
BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber, propertyIdentifierArgument),
@@ -146,11 +146,11 @@ func BACnetConstructedDataReliabilityParse(readBuffer utils.ReadBuffer, tagNumbe
if pullErr := readBuffer.PullContext("reliability"); pullErr != nil {
return nil, pullErr
}
- _reliability, _reliabilityErr := BACnetConstructedDataReliabilityEntryParse(readBuffer)
+ _reliability, _reliabilityErr := BACnetReliabilityTaggedParse(readBuffer, TagClass(TagClass_APPLICATION_TAGS), uint8(uint8(0)))
if _reliabilityErr != nil {
return nil, errors.Wrap(_reliabilityErr, "Error parsing 'reliability' field")
}
- reliability := CastBACnetConstructedDataReliabilityEntry(_reliability)
+ reliability := CastBACnetReliabilityTagged(_reliability)
if closeErr := readBuffer.CloseContext("reliability"); closeErr != nil {
return nil, closeErr
}
@@ -161,7 +161,7 @@ func BACnetConstructedDataReliabilityParse(readBuffer utils.ReadBuffer, tagNumbe
// Create a partially initialized instance
_child := &BACnetConstructedDataReliability{
- Reliability: CastBACnetConstructedDataReliabilityEntry(reliability),
+ Reliability: CastBACnetReliabilityTagged(reliability),
BACnetConstructedData: &BACnetConstructedData{},
}
_child.BACnetConstructedData.Child = _child
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliabilityEntry.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliabilityEntry.go
deleted file mode 100644
index ad22ebb210..0000000000
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliabilityEntry.go
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * 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/plc4go/spi/utils"
- "github.com/pkg/errors"
-)
-
-// Code generated by code-generation. DO NOT EDIT.
-
-// BACnetConstructedDataReliabilityEntry is the data-structure of this message
-type BACnetConstructedDataReliabilityEntry struct {
- RawData *BACnetApplicationTagEnumerated
-}
-
-// IBACnetConstructedDataReliabilityEntry is the corresponding interface of BACnetConstructedDataReliabilityEntry
-type IBACnetConstructedDataReliabilityEntry interface {
- // GetRawData returns RawData (property field)
- GetRawData() *BACnetApplicationTagEnumerated
- // GetIsBACnetReliabilityProprietary returns IsBACnetReliabilityProprietary (virtual field)
- GetIsBACnetReliabilityProprietary() bool
- // GetReliability returns Reliability (virtual field)
- GetReliability() BACnetReliability
- // GetReliabilityProprietary returns ReliabilityProprietary (virtual field)
- GetReliabilityProprietary() uint16
- // GetLengthInBytes returns the length in bytes
- GetLengthInBytes() uint16
- // GetLengthInBits returns the length in bits
- GetLengthInBits() uint16
- // Serialize serializes this type
- Serialize(writeBuffer utils.WriteBuffer) error
-}
-
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for property fields.
-///////////////////////
-
-func (m *BACnetConstructedDataReliabilityEntry) GetRawData() *BACnetApplicationTagEnumerated {
- return m.RawData
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for virtual fields.
-///////////////////////
-
-func (m *BACnetConstructedDataReliabilityEntry) GetIsBACnetReliabilityProprietary() bool {
- return bool(bool((m.GetRawData().GetActualValue()) > (255)))
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) GetReliability() BACnetReliability {
- return BACnetReliability(MapBACnetReliability(m.GetRawData(), m.GetIsBACnetReliabilityProprietary()))
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) GetReliabilityProprietary() uint16 {
- return uint16(utils.InlineIf(m.GetIsBACnetReliabilityProprietary(), func() interface{} { return uint16(m.GetRawData().GetActualValue()) }, func() interface{} { return uint16(uint16(0)) }).(uint16))
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-
-// NewBACnetConstructedDataReliabilityEntry factory function for BACnetConstructedDataReliabilityEntry
-func NewBACnetConstructedDataReliabilityEntry(rawData *BACnetApplicationTagEnumerated) *BACnetConstructedDataReliabilityEntry {
- return &BACnetConstructedDataReliabilityEntry{RawData: rawData}
-}
-
-func CastBACnetConstructedDataReliabilityEntry(structType interface{}) *BACnetConstructedDataReliabilityEntry {
- if casted, ok := structType.(BACnetConstructedDataReliabilityEntry); ok {
- return &casted
- }
- if casted, ok := structType.(*BACnetConstructedDataReliabilityEntry); ok {
- return casted
- }
- return nil
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) GetTypeName() string {
- return "BACnetConstructedDataReliabilityEntry"
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) GetLengthInBits() uint16 {
- return m.GetLengthInBitsConditional(false)
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) GetLengthInBitsConditional(lastItem bool) uint16 {
- lengthInBits := uint16(0)
-
- // Simple field (rawData)
- lengthInBits += m.RawData.GetLengthInBits()
-
- // A virtual field doesn't have any in- or output.
-
- // A virtual field doesn't have any in- or output.
-
- // A virtual field doesn't have any in- or output.
-
- return lengthInBits
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) GetLengthInBytes() uint16 {
- return m.GetLengthInBits() / 8
-}
-
-func BACnetConstructedDataReliabilityEntryParse(readBuffer utils.ReadBuffer) (*BACnetConstructedDataReliabilityEntry, error) {
- positionAware := readBuffer
- _ = positionAware
- if pullErr := readBuffer.PullContext("BACnetConstructedDataReliabilityEntry"); pullErr != nil {
- return nil, pullErr
- }
- currentPos := positionAware.GetPos()
- _ = currentPos
-
- // Simple Field (rawData)
- if pullErr := readBuffer.PullContext("rawData"); pullErr != nil {
- return nil, pullErr
- }
- _rawData, _rawDataErr := BACnetApplicationTagParse(readBuffer)
- if _rawDataErr != nil {
- return nil, errors.Wrap(_rawDataErr, "Error parsing 'rawData' field")
- }
- rawData := CastBACnetApplicationTagEnumerated(_rawData)
- if closeErr := readBuffer.CloseContext("rawData"); closeErr != nil {
- return nil, closeErr
- }
-
- // Virtual field
- _isBACnetReliabilityProprietary := bool((rawData.GetActualValue()) > (255))
- isBACnetReliabilityProprietary := bool(_isBACnetReliabilityProprietary)
- _ = isBACnetReliabilityProprietary
-
- // Virtual field
- _reliability := MapBACnetReliability(rawData, isBACnetReliabilityProprietary)
- reliability := BACnetReliability(_reliability)
- _ = reliability
-
- // Virtual field
- _reliabilityProprietary := utils.InlineIf(isBACnetReliabilityProprietary, func() interface{} { return uint16(rawData.GetActualValue()) }, func() interface{} { return uint16(uint16(0)) }).(uint16)
- reliabilityProprietary := uint16(_reliabilityProprietary)
- _ = reliabilityProprietary
-
- if closeErr := readBuffer.CloseContext("BACnetConstructedDataReliabilityEntry"); closeErr != nil {
- return nil, closeErr
- }
-
- // Create the instance
- return NewBACnetConstructedDataReliabilityEntry(rawData), nil
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) Serialize(writeBuffer utils.WriteBuffer) error {
- positionAware := writeBuffer
- _ = positionAware
- if pushErr := writeBuffer.PushContext("BACnetConstructedDataReliabilityEntry"); pushErr != nil {
- return pushErr
- }
-
- // Simple Field (rawData)
- if pushErr := writeBuffer.PushContext("rawData"); pushErr != nil {
- return pushErr
- }
- _rawDataErr := m.RawData.Serialize(writeBuffer)
- if popErr := writeBuffer.PopContext("rawData"); popErr != nil {
- return popErr
- }
- if _rawDataErr != nil {
- return errors.Wrap(_rawDataErr, "Error serializing 'rawData' field")
- }
- // Virtual field
- if _isBACnetReliabilityProprietaryErr := writeBuffer.WriteVirtual("isBACnetReliabilityProprietary", m.GetIsBACnetReliabilityProprietary()); _isBACnetReliabilityProprietaryErr != nil {
- return errors.Wrap(_isBACnetReliabilityProprietaryErr, "Error serializing 'isBACnetReliabilityProprietary' field")
- }
- // Virtual field
- if _reliabilityErr := writeBuffer.WriteVirtual("reliability", m.GetReliability()); _reliabilityErr != nil {
- return errors.Wrap(_reliabilityErr, "Error serializing 'reliability' field")
- }
- // Virtual field
- if _reliabilityProprietaryErr := writeBuffer.WriteVirtual("reliabilityProprietary", m.GetReliabilityProprietary()); _reliabilityProprietaryErr != nil {
- return errors.Wrap(_reliabilityProprietaryErr, "Error serializing 'reliabilityProprietary' field")
- }
-
- if popErr := writeBuffer.PopContext("BACnetConstructedDataReliabilityEntry"); popErr != nil {
- return popErr
- }
- return nil
-}
-
-func (m *BACnetConstructedDataReliabilityEntry) String() string {
- if m == nil {
- return "<nil>"
- }
- buffer := utils.NewBoxedWriteBufferWithOptions(true, true)
- if err := m.Serialize(buffer); err != nil {
- return err.Error()
- }
- return buffer.GetBox().String()
-}
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventState.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventState.go
index 5302cc5ab4..8ac444e8a7 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventState.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventState.go
@@ -176,16 +176,18 @@ func BACnetContextTagEventStateParse(readBuffer utils.ReadBuffer, tagNumberArgum
}
// Manual Field (eventState)
- eventState, _eventStateErr := ReadEventState(readBuffer, actualLength)
+ _eventState, _eventStateErr := ReadEventState(readBuffer, actualLength)
if _eventStateErr != nil {
return nil, errors.Wrap(_eventStateErr, "Error parsing 'eventState' field")
}
+ eventState := _eventState.(BACnetEventState)
// Manual Field (proprietaryValue)
- proprietaryValue, _proprietaryValueErr := ReadProprietaryEventState(readBuffer, eventState, actualLength)
+ _proprietaryValue, _proprietaryValueErr := ReadProprietaryEventState(readBuffer, eventState, actualLength)
if _proprietaryValueErr != nil {
return nil, errors.Wrap(_proprietaryValueErr, "Error parsing 'proprietaryValue' field")
}
+ proprietaryValue := _proprietaryValue.(uint32)
// Virtual field
_isProprietary := bool((eventState) == (BACnetEventState_VENDOR_PROPRIETARY_VALUE))
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventType.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventType.go
index c9bb085b9b..4b1f4af961 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventType.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagEventType.go
@@ -176,16 +176,18 @@ func BACnetContextTagEventTypeParse(readBuffer utils.ReadBuffer, tagNumberArgume
}
// Manual Field (eventType)
- eventType, _eventTypeErr := ReadEventType(readBuffer, actualLength)
+ _eventType, _eventTypeErr := ReadEventType(readBuffer, actualLength)
if _eventTypeErr != nil {
return nil, errors.Wrap(_eventTypeErr, "Error parsing 'eventType' field")
}
+ eventType := _eventType.(BACnetEventType)
// Manual Field (proprietaryValue)
- proprietaryValue, _proprietaryValueErr := ReadProprietaryEventType(readBuffer, eventType, actualLength)
+ _proprietaryValue, _proprietaryValueErr := ReadProprietaryEventType(readBuffer, eventType, actualLength)
if _proprietaryValueErr != nil {
return nil, errors.Wrap(_proprietaryValueErr, "Error parsing 'proprietaryValue' field")
}
+ proprietaryValue := _proprietaryValue.(uint32)
// Virtual field
_isProprietary := bool((eventType) == (BACnetEventType_VENDOR_PROPRIETARY_VALUE))
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagPropertyIdentifier.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagPropertyIdentifier.go
index 47f300cf39..9a04c80ad9 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagPropertyIdentifier.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetContextTagPropertyIdentifier.go
@@ -176,16 +176,18 @@ func BACnetContextTagPropertyIdentifierParse(readBuffer utils.ReadBuffer, tagNum
}
// Manual Field (propertyIdentifier)
- propertyIdentifier, _propertyIdentifierErr := ReadPropertyIdentifier(readBuffer, actualLength)
+ _propertyIdentifier, _propertyIdentifierErr := ReadPropertyIdentifier(readBuffer, actualLength)
if _propertyIdentifierErr != nil {
return nil, errors.Wrap(_propertyIdentifierErr, "Error parsing 'propertyIdentifier' field")
}
+ propertyIdentifier := _propertyIdentifier.(BACnetPropertyIdentifier)
// Manual Field (proprietaryValue)
- proprietaryValue, _proprietaryValueErr := ReadProprietaryPropertyIdentifier(readBuffer, propertyIdentifier, actualLength)
+ _proprietaryValue, _proprietaryValueErr := ReadProprietaryPropertyIdentifier(readBuffer, propertyIdentifier, actualLength)
if _proprietaryValueErr != nil {
return nil, errors.Wrap(_proprietaryValueErr, "Error parsing 'proprietaryValue' field")
}
+ proprietaryValue := _proprietaryValue.(uint32)
// Virtual field
_isProprietary := bool((propertyIdentifier) == (BACnetPropertyIdentifier_VENDOR_PROPRIETARY_VALUE))
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetPropertyStates.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetPropertyStates.go
index 2a0308f863..ad15a02dd2 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetPropertyStates.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetPropertyStates.go
@@ -199,6 +199,8 @@ func BACnetPropertyStatesParse(readBuffer utils.ReadBuffer, tagNumber uint8) (*B
_child, typeSwitchError = BACnetPropertyStatesBooleanParse(readBuffer, tagNumber, peekedTagNumber)
case peekedTagNumber == uint8(1): // BACnetPropertyStatesBinaryValue
_child, typeSwitchError = BACnetPropertyStatesBinaryValueParse(readBuffer, tagNumber, peekedTagNumber)
+ case peekedTagNumber == uint8(7): // BACnetPropertyStatesReliability
+ _child, typeSwitchError = BACnetPropertyStatesReliabilityParse(readBuffer, tagNumber, peekedTagNumber)
case peekedTagNumber == uint8(16): // BACnetPropertyStatesAction
_child, typeSwitchError = BACnetPropertyStatesActionParse(readBuffer, tagNumber, peekedTagNumber)
case true: // BACnetPropertyStateActionUnmapped
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetPropertyStatesReliability.go
similarity index 51%
copy from plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go
copy to plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetPropertyStatesReliability.go
index 1303f4e4ff..e45a3e8e83 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetPropertyStatesReliability.go
@@ -26,21 +26,20 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// BACnetConstructedDataReliability is the data-structure of this message
-type BACnetConstructedDataReliability struct {
- *BACnetConstructedData
- Reliability *BACnetConstructedDataReliabilityEntry
+// BACnetPropertyStatesReliability is the data-structure of this message
+type BACnetPropertyStatesReliability struct {
+ *BACnetPropertyStates
+ Reliability *BACnetReliabilityTagged
// Arguments.
- TagNumber uint8
- PropertyIdentifierArgument BACnetContextTagPropertyIdentifier
+ TagNumber uint8
}
-// IBACnetConstructedDataReliability is the corresponding interface of BACnetConstructedDataReliability
-type IBACnetConstructedDataReliability interface {
- IBACnetConstructedData
+// IBACnetPropertyStatesReliability is the corresponding interface of BACnetPropertyStatesReliability
+type IBACnetPropertyStatesReliability interface {
+ IBACnetPropertyStates
// GetReliability returns Reliability (property field)
- GetReliability() *BACnetConstructedDataReliabilityEntry
+ GetReliability() *BACnetReliabilityTagged
// GetLengthInBytes returns the length in bytes
GetLengthInBytes() uint16
// GetLengthInBits returns the length in bits
@@ -54,22 +53,19 @@ type IBACnetConstructedDataReliability interface {
/////////////////////// Accessors for discriminator values.
///////////////////////
-func (m *BACnetConstructedDataReliability) GetObjectType() BACnetObjectType {
- return 0
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *BACnetConstructedDataReliability) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) {
- m.BACnetConstructedData.OpeningTag = openingTag
- m.BACnetConstructedData.ClosingTag = closingTag
+func (m *BACnetPropertyStatesReliability) InitializeParent(parent *BACnetPropertyStates, openingTag *BACnetOpeningTag, peekedTagHeader *BACnetTagHeader, closingTag *BACnetClosingTag) {
+ m.BACnetPropertyStates.OpeningTag = openingTag
+ m.BACnetPropertyStates.PeekedTagHeader = peekedTagHeader
+ m.BACnetPropertyStates.ClosingTag = closingTag
}
-func (m *BACnetConstructedDataReliability) GetParent() *BACnetConstructedData {
- return m.BACnetConstructedData
+func (m *BACnetPropertyStatesReliability) GetParent() *BACnetPropertyStates {
+ return m.BACnetPropertyStates
}
///////////////////////////////////////////////////////////
@@ -77,7 +73,7 @@ func (m *BACnetConstructedDataReliability) GetParent() *BACnetConstructedData {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *BACnetConstructedDataReliability) GetReliability() *BACnetConstructedDataReliabilityEntry {
+func (m *BACnetPropertyStatesReliability) GetReliability() *BACnetReliabilityTagged {
return m.Reliability
}
@@ -86,41 +82,41 @@ func (m *BACnetConstructedDataReliability) GetReliability() *BACnetConstructedDa
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-// NewBACnetConstructedDataReliability factory function for BACnetConstructedDataReliability
-func NewBACnetConstructedDataReliability(reliability *BACnetConstructedDataReliabilityEntry, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8, propertyIdentifierArgument BACnetContextTagPropertyIdentifier) *BACnetConstructedDataReliability {
- _result := &BACnetConstructedDataReliability{
- Reliability: reliability,
- BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber, propertyIdentifierArgument),
+// NewBACnetPropertyStatesReliability factory function for BACnetPropertyStatesReliability
+func NewBACnetPropertyStatesReliability(reliability *BACnetReliabilityTagged, openingTag *BACnetOpeningTag, peekedTagHeader *BACnetTagHeader, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetPropertyStatesReliability {
+ _result := &BACnetPropertyStatesReliability{
+ Reliability: reliability,
+ BACnetPropertyStates: NewBACnetPropertyStates(openingTag, peekedTagHeader, closingTag, tagNumber),
}
_result.Child = _result
return _result
}
-func CastBACnetConstructedDataReliability(structType interface{}) *BACnetConstructedDataReliability {
- if casted, ok := structType.(BACnetConstructedDataReliability); ok {
+func CastBACnetPropertyStatesReliability(structType interface{}) *BACnetPropertyStatesReliability {
+ if casted, ok := structType.(BACnetPropertyStatesReliability); ok {
return &casted
}
- if casted, ok := structType.(*BACnetConstructedDataReliability); ok {
+ if casted, ok := structType.(*BACnetPropertyStatesReliability); ok {
return casted
}
- if casted, ok := structType.(BACnetConstructedData); ok {
- return CastBACnetConstructedDataReliability(casted.Child)
+ if casted, ok := structType.(BACnetPropertyStates); ok {
+ return CastBACnetPropertyStatesReliability(casted.Child)
}
- if casted, ok := structType.(*BACnetConstructedData); ok {
- return CastBACnetConstructedDataReliability(casted.Child)
+ if casted, ok := structType.(*BACnetPropertyStates); ok {
+ return CastBACnetPropertyStatesReliability(casted.Child)
}
return nil
}
-func (m *BACnetConstructedDataReliability) GetTypeName() string {
- return "BACnetConstructedDataReliability"
+func (m *BACnetPropertyStatesReliability) GetTypeName() string {
+ return "BACnetPropertyStatesReliability"
}
-func (m *BACnetConstructedDataReliability) GetLengthInBits() uint16 {
+func (m *BACnetPropertyStatesReliability) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *BACnetConstructedDataReliability) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *BACnetPropertyStatesReliability) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
// Simple field (reliability)
@@ -129,14 +125,14 @@ func (m *BACnetConstructedDataReliability) GetLengthInBitsConditional(lastItem b
return lengthInBits
}
-func (m *BACnetConstructedDataReliability) GetLengthInBytes() uint16 {
+func (m *BACnetPropertyStatesReliability) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func BACnetConstructedDataReliabilityParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectType BACnetObjectType, propertyIdentifierArgument *BACnetContextTagPropertyIdentifier) (*BACnetConstructedDataReliability, error) {
+func BACnetPropertyStatesReliabilityParse(readBuffer utils.ReadBuffer, tagNumber uint8, peekedTagNumber uint8) (*BACnetPropertyStatesReliability, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("BACnetConstructedDataReliability"); pullErr != nil {
+ if pullErr := readBuffer.PullContext("BACnetPropertyStatesReliability"); pullErr != nil {
return nil, pullErr
}
currentPos := positionAware.GetPos()
@@ -146,33 +142,33 @@ func BACnetConstructedDataReliabilityParse(readBuffer utils.ReadBuffer, tagNumbe
if pullErr := readBuffer.PullContext("reliability"); pullErr != nil {
return nil, pullErr
}
- _reliability, _reliabilityErr := BACnetConstructedDataReliabilityEntryParse(readBuffer)
+ _reliability, _reliabilityErr := BACnetReliabilityTaggedParse(readBuffer, TagClass(TagClass_CONTEXT_SPECIFIC_TAGS), uint8(uint8(0)))
if _reliabilityErr != nil {
return nil, errors.Wrap(_reliabilityErr, "Error parsing 'reliability' field")
}
- reliability := CastBACnetConstructedDataReliabilityEntry(_reliability)
+ reliability := CastBACnetReliabilityTagged(_reliability)
if closeErr := readBuffer.CloseContext("reliability"); closeErr != nil {
return nil, closeErr
}
- if closeErr := readBuffer.CloseContext("BACnetConstructedDataReliability"); closeErr != nil {
+ if closeErr := readBuffer.CloseContext("BACnetPropertyStatesReliability"); closeErr != nil {
return nil, closeErr
}
// Create a partially initialized instance
- _child := &BACnetConstructedDataReliability{
- Reliability: CastBACnetConstructedDataReliabilityEntry(reliability),
- BACnetConstructedData: &BACnetConstructedData{},
+ _child := &BACnetPropertyStatesReliability{
+ Reliability: CastBACnetReliabilityTagged(reliability),
+ BACnetPropertyStates: &BACnetPropertyStates{},
}
- _child.BACnetConstructedData.Child = _child
+ _child.BACnetPropertyStates.Child = _child
return _child, nil
}
-func (m *BACnetConstructedDataReliability) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *BACnetPropertyStatesReliability) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("BACnetConstructedDataReliability"); pushErr != nil {
+ if pushErr := writeBuffer.PushContext("BACnetPropertyStatesReliability"); pushErr != nil {
return pushErr
}
@@ -188,7 +184,7 @@ func (m *BACnetConstructedDataReliability) Serialize(writeBuffer utils.WriteBuff
return errors.Wrap(_reliabilityErr, "Error serializing 'reliability' field")
}
- if popErr := writeBuffer.PopContext("BACnetConstructedDataReliability"); popErr != nil {
+ if popErr := writeBuffer.PopContext("BACnetPropertyStatesReliability"); popErr != nil {
return popErr
}
return nil
@@ -196,7 +192,7 @@ func (m *BACnetConstructedDataReliability) Serialize(writeBuffer utils.WriteBuff
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *BACnetConstructedDataReliability) String() string {
+func (m *BACnetPropertyStatesReliability) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliability.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliability.go
index 34a16db1ae..cd81d0ee3e 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliability.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliability.go
@@ -57,6 +57,7 @@ const (
BACnetReliability_PROPRIETARY_COMMAND_FAILURE BACnetReliability = 22
BACnetReliability_FAULTS_LISTED BACnetReliability = 23
BACnetReliability_REFERENCED_OBJECT_FAULT BACnetReliability = 24
+ BACnetReliability_VENDOR_PROPRIETARY_VALUE BACnetReliability = 0xFFFF
)
var BACnetReliabilityValues []BACnetReliability
@@ -88,6 +89,7 @@ func init() {
BACnetReliability_PROPRIETARY_COMMAND_FAILURE,
BACnetReliability_FAULTS_LISTED,
BACnetReliability_REFERENCED_OBJECT_FAULT,
+ BACnetReliability_VENDOR_PROPRIETARY_VALUE,
}
}
@@ -95,6 +97,8 @@ func BACnetReliabilityByValue(value uint16) BACnetReliability {
switch value {
case 0:
return BACnetReliability_NO_FAULT_DETECTED
+ case 0xFFFF:
+ return BACnetReliability_VENDOR_PROPRIETARY_VALUE
case 1:
return BACnetReliability_NO_SENSOR
case 10:
@@ -149,6 +153,8 @@ func BACnetReliabilityByName(value string) BACnetReliability {
switch value {
case "NO_FAULT_DETECTED":
return BACnetReliability_NO_FAULT_DETECTED
+ case "VENDOR_PROPRIETARY_VALUE":
+ return BACnetReliability_VENDOR_PROPRIETARY_VALUE
case "NO_SENSOR":
return BACnetReliability_NO_SENSOR
case "CONFIGURATION_ERROR":
@@ -242,6 +248,8 @@ func (e BACnetReliability) name() string {
switch e {
case BACnetReliability_NO_FAULT_DETECTED:
return "NO_FAULT_DETECTED"
+ case BACnetReliability_VENDOR_PROPRIETARY_VALUE:
+ return "VENDOR_PROPRIETARY_VALUE"
case BACnetReliability_NO_SENSOR:
return "NO_SENSOR"
case BACnetReliability_CONFIGURATION_ERROR:
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliabilityTagged.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliabilityTagged.go
new file mode 100644
index 0000000000..5b7b38b553
--- /dev/null
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliabilityTagged.go
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.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/plc4go/spi/utils"
+ "github.com/pkg/errors"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// BACnetReliabilityTagged is the data-structure of this message
+type BACnetReliabilityTagged struct {
+ Header *BACnetTagHeader
+ Value BACnetReliability
+ ProprietaryValue uint32
+
+ // Arguments.
+ TagClass TagClass
+ TagNumber uint8
+}
+
+// IBACnetReliabilityTagged is the corresponding interface of BACnetReliabilityTagged
+type IBACnetReliabilityTagged interface {
+ // GetHeader returns Header (property field)
+ GetHeader() *BACnetTagHeader
+ // GetValue returns Value (property field)
+ GetValue() BACnetReliability
+ // GetProprietaryValue returns ProprietaryValue (property field)
+ GetProprietaryValue() uint32
+ // GetIsProprietary returns IsProprietary (virtual field)
+ GetIsProprietary() bool
+ // GetLengthInBytes returns the length in bytes
+ GetLengthInBytes() uint16
+ // GetLengthInBits returns the length in bits
+ GetLengthInBits() uint16
+ // Serialize serializes this type
+ Serialize(writeBuffer utils.WriteBuffer) error
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *BACnetReliabilityTagged) GetHeader() *BACnetTagHeader {
+ return m.Header
+}
+
+func (m *BACnetReliabilityTagged) GetValue() BACnetReliability {
+ return m.Value
+}
+
+func (m *BACnetReliabilityTagged) GetProprietaryValue() uint32 {
+ return m.ProprietaryValue
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *BACnetReliabilityTagged) GetIsProprietary() bool {
+ return bool(bool((m.GetValue()) == (BACnetReliability_VENDOR_PROPRIETARY_VALUE)))
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewBACnetReliabilityTagged factory function for BACnetReliabilityTagged
+func NewBACnetReliabilityTagged(header *BACnetTagHeader, value BACnetReliability, proprietaryValue uint32, tagClass TagClass, tagNumber uint8) *BACnetReliabilityTagged {
+ return &BACnetReliabilityTagged{Header: header, Value: value, ProprietaryValue: proprietaryValue, TagClass: tagClass, TagNumber: tagNumber}
+}
+
+func CastBACnetReliabilityTagged(structType interface{}) *BACnetReliabilityTagged {
+ if casted, ok := structType.(BACnetReliabilityTagged); ok {
+ return &casted
+ }
+ if casted, ok := structType.(*BACnetReliabilityTagged); ok {
+ return casted
+ }
+ return nil
+}
+
+func (m *BACnetReliabilityTagged) GetTypeName() string {
+ return "BACnetReliabilityTagged"
+}
+
+func (m *BACnetReliabilityTagged) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *BACnetReliabilityTagged) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (header)
+ lengthInBits += m.Header.GetLengthInBits()
+
+ // Manual Field (value)
+ lengthInBits += uint16(int32(m.GetHeader().GetActualLength()) * int32(int32(8)))
+
+ // A virtual field doesn't have any in- or output.
+
+ // Manual Field (proprietaryValue)
+ lengthInBits += uint16(int32(m.GetHeader().GetActualLength()) * int32(int32(8)))
+
+ return lengthInBits
+}
+
+func (m *BACnetReliabilityTagged) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetReliabilityTaggedParse(readBuffer utils.ReadBuffer, tagClass TagClass, tagNumber uint8) (*BACnetReliabilityTagged, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("BACnetReliabilityTagged"); pullErr != nil {
+ return nil, pullErr
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (header)
+ if pullErr := readBuffer.PullContext("header"); pullErr != nil {
+ return nil, pullErr
+ }
+ _header, _headerErr := BACnetTagHeaderParse(readBuffer)
+ if _headerErr != nil {
+ return nil, errors.Wrap(_headerErr, "Error parsing 'header' field")
+ }
+ header := CastBACnetTagHeader(_header)
+ if closeErr := readBuffer.CloseContext("header"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Validation
+ if !(bool((header.GetTagClass()) == (tagClass))) {
+ return nil, utils.ParseValidationError{"tag doesn't match"}
+ }
+
+ // Validation
+ if !(bool(bool(bool((header.GetTagClass()) == (TagClass_APPLICATION_TAGS)))) || bool(bool(bool((header.GetActualTagNumber()) == (tagNumber))))) {
+ return nil, utils.ParseAssertError{"tagnumber doesn't match"}
+ }
+
+ // Manual Field (value)
+ _value, _valueErr := ReadEnumGeneric(readBuffer, header.GetActualLength(), BACnetReliability_VENDOR_PROPRIETARY_VALUE)
+ if _valueErr != nil {
+ return nil, errors.Wrap(_valueErr, "Error parsing 'value' field")
+ }
+ value := _value.(BACnetReliability)
+
+ // Virtual field
+ _isProprietary := bool((value) == (BACnetReliability_VENDOR_PROPRIETARY_VALUE))
+ isProprietary := bool(_isProprietary)
+ _ = isProprietary
+
+ // Manual Field (proprietaryValue)
+ _proprietaryValue, _proprietaryValueErr := ReadProprietaryEnumGeneric(readBuffer, header.GetActualLength(), isProprietary)
+ if _proprietaryValueErr != nil {
+ return nil, errors.Wrap(_proprietaryValueErr, "Error parsing 'proprietaryValue' field")
+ }
+ proprietaryValue := _proprietaryValue.(uint32)
+
+ if closeErr := readBuffer.CloseContext("BACnetReliabilityTagged"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Create the instance
+ return NewBACnetReliabilityTagged(header, value, proprietaryValue, tagClass, tagNumber), nil
+}
+
+func (m *BACnetReliabilityTagged) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("BACnetReliabilityTagged"); pushErr != nil {
+ return pushErr
+ }
+
+ // Simple Field (header)
+ if pushErr := writeBuffer.PushContext("header"); pushErr != nil {
+ return pushErr
+ }
+ _headerErr := m.Header.Serialize(writeBuffer)
+ if popErr := writeBuffer.PopContext("header"); popErr != nil {
+ return popErr
+ }
+ if _headerErr != nil {
+ return errors.Wrap(_headerErr, "Error serializing 'header' field")
+ }
+
+ // Manual Field (value)
+ _valueErr := WriteEnumGeneric(writeBuffer, m.GetValue())
+ if _valueErr != nil {
+ return errors.Wrap(_valueErr, "Error serializing 'value' field")
+ }
+ // Virtual field
+ if _isProprietaryErr := writeBuffer.WriteVirtual("isProprietary", m.GetIsProprietary()); _isProprietaryErr != nil {
+ return errors.Wrap(_isProprietaryErr, "Error serializing 'isProprietary' field")
+ }
+
+ // Manual Field (proprietaryValue)
+ _proprietaryValueErr := WriteProprietaryEnumGeneric(writeBuffer, m.GetProprietaryValue(), m.GetIsProprietary())
+ if _proprietaryValueErr != nil {
+ return errors.Wrap(_proprietaryValueErr, "Error serializing 'proprietaryValue' field")
+ }
+
+ if popErr := writeBuffer.PopContext("BACnetReliabilityTagged"); popErr != nil {
+ return popErr
+ }
+ return nil
+}
+
+func (m *BACnetReliabilityTagged) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ buffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := m.Serialize(buffer); err != nil {
+ return err.Error()
+ }
+ return buffer.GetBox().String()
+}
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetTagPayloadObjectIdentifier.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetTagPayloadObjectIdentifier.go
index 4e7dd92989..bd1821d601 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetTagPayloadObjectIdentifier.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetTagPayloadObjectIdentifier.go
@@ -140,16 +140,18 @@ func BACnetTagPayloadObjectIdentifierParse(readBuffer utils.ReadBuffer) (*BACnet
_ = currentPos
// Manual Field (objectType)
- objectType, _objectTypeErr := ReadObjectType(readBuffer)
+ _objectType, _objectTypeErr := ReadObjectType(readBuffer)
if _objectTypeErr != nil {
return nil, errors.Wrap(_objectTypeErr, "Error parsing 'objectType' field")
}
+ objectType := _objectType.(BACnetObjectType)
// Manual Field (proprietaryValue)
- proprietaryValue, _proprietaryValueErr := ReadProprietaryObjectType(readBuffer, objectType)
+ _proprietaryValue, _proprietaryValueErr := ReadProprietaryObjectType(readBuffer, objectType)
if _proprietaryValueErr != nil {
return nil, errors.Wrap(_proprietaryValueErr, "Error parsing 'proprietaryValue' field")
}
+ proprietaryValue := _proprietaryValue.(uint16)
// Virtual field
_isProprietary := bool((objectType) == (BACnetObjectType_VENDOR_PROPRIETARY_VALUE))
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go
index 75ff642d6b..7eba5b3a5b 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go
@@ -20,12 +20,78 @@
package model
import (
+ "fmt"
"github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils"
"github.com/pkg/errors"
"math/big"
)
-func ReadPropertyIdentifier(readBuffer utils.ReadBuffer, actualLength uint32) (BACnetPropertyIdentifier, error) {
+func ReadEnumGeneric(readBuffer utils.ReadBuffer, actualLength uint32, template interface{}) (interface{}, error) {
+ bitsToRead := (uint8)(actualLength * 8)
+ rawValue, err := readBuffer.ReadUint32("value", bitsToRead)
+ if err != nil {
+ return nil, err
+ }
+ switch template.(type) {
+ case BACnetReliability:
+ return BACnetReliability(rawValue), nil
+ default:
+ return rawValue, nil
+ }
+}
+
+func ReadProprietaryEnumGeneric(readBuffer utils.ReadBuffer, actualLength uint32, shouldRead bool) (interface{}, error) {
+ if !shouldRead {
+ return 0, nil
+ }
+ // We need to reset our reader to the position we read before
+ readBuffer.Reset(uint16(readBuffer.GetPos() - uint16(actualLength)))
+ bitsToRead := (uint8)(actualLength * 8)
+ return readBuffer.ReadUint32("proprietaryValue", bitsToRead)
+}
+
+func WriteEnumGeneric(writeBuffer utils.WriteBuffer, value interface{}) error {
+ if value == nil {
+ return nil
+ }
+ bitsToWrite := uint8(0)
+ var valueValue = value.(uint32)
+
+ if valueValue <= 0xff {
+ bitsToWrite = 8
+ } else if valueValue <= 0xffff {
+ bitsToWrite = 16
+ } else if valueValue <= 0xffffffff {
+ bitsToWrite = 32
+ } else {
+ bitsToWrite = 32
+ }
+ var withWriterArgs []utils.WithWriterArgs
+ if stringer, ok := value.(fmt.Stringer); ok {
+ withWriterArgs = append(withWriterArgs, utils.WithAdditionalStringRepresentation(stringer.String()))
+ }
+ return writeBuffer.WriteUint32("value", bitsToWrite, valueValue, withWriterArgs...)
+}
+
+func WriteProprietaryEnumGeneric(writeBuffer utils.WriteBuffer, value uint32, shouldWrite bool) error {
+ if !shouldWrite {
+ return nil
+ }
+ bitsToWrite := uint8(0)
+ if value <= 0xff {
+ bitsToWrite = 8
+ } else if value <= 0xffff {
+ bitsToWrite = 16
+ } else if value <= 0xffffffff {
+ bitsToWrite = 32
+ } else {
+ bitsToWrite = 32
+ }
+ return writeBuffer.WriteUint32("proprietaryValue", bitsToWrite, value, utils.WithAdditionalStringRepresentation("VENDOR_PROPRIETARY_VALUE"))
+}
+
+// Deprecated: use generic above
+func ReadPropertyIdentifier(readBuffer utils.ReadBuffer, actualLength uint32) (interface{}, error) {
bitsToRead := actualLength * 8
var readUnsignedLong uint32
var err error
@@ -51,6 +117,7 @@ func ReadPropertyIdentifier(readBuffer utils.ReadBuffer, actualLength uint32) (B
return BACnetPropertyIdentifier(readUnsignedLong), nil
}
+// Deprecated: use generic above
func WritePropertyIdentifier(writeBuffer utils.WriteBuffer, value BACnetPropertyIdentifier) error {
if value == BACnetPropertyIdentifier_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -69,6 +136,7 @@ func WritePropertyIdentifier(writeBuffer utils.WriteBuffer, value BACnetProperty
return writeBuffer.WriteUint32("propertyIdentifier", bitsToWrite, uint32(value), utils.WithAdditionalStringRepresentation(value.name()))
}
+// Deprecated: use generic above
func WriteProprietaryPropertyIdentifier(writeBuffer utils.WriteBuffer, baCnetPropertyIdentifier BACnetPropertyIdentifier, value uint32) error {
if baCnetPropertyIdentifier != BACnetPropertyIdentifier_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -86,9 +154,10 @@ func WriteProprietaryPropertyIdentifier(writeBuffer utils.WriteBuffer, baCnetPro
return writeBuffer.WriteUint32("proprietaryPropertyIdentifier", bitsToWrite, value, utils.WithAdditionalStringRepresentation(BACnetPropertyIdentifier_VENDOR_PROPRIETARY_VALUE.name()))
}
-func ReadProprietaryPropertyIdentifier(readBuffer utils.ReadBuffer, value BACnetPropertyIdentifier, actualLength uint32) (uint32, error) {
+// Deprecated: use generic above
+func ReadProprietaryPropertyIdentifier(readBuffer utils.ReadBuffer, value BACnetPropertyIdentifier, actualLength uint32) (interface{}, error) {
if value != BACnetPropertyIdentifier_VENDOR_PROPRIETARY_VALUE {
- return 0, nil
+ return uint32(0), nil
}
// We need to reset our reader to the position we read before
readBuffer.Reset(readBuffer.GetPos() - uint16(actualLength))
@@ -96,7 +165,8 @@ func ReadProprietaryPropertyIdentifier(readBuffer utils.ReadBuffer, value BACnet
return readBuffer.ReadUint32("proprietaryPropertyIdentifier", bitsToRead)
}
-func ReadEventState(readBuffer utils.ReadBuffer, actualLength uint32) (BACnetEventState, error) {
+// Deprecated: use generic above
+func ReadEventState(readBuffer utils.ReadBuffer, actualLength uint32) (interface{}, error) {
bitsToRead := actualLength * 8
var readUnsignedLong uint32
var err error
@@ -122,6 +192,7 @@ func ReadEventState(readBuffer utils.ReadBuffer, actualLength uint32) (BACnetEve
return BACnetEventState(readUnsignedLong), nil
}
+// Deprecated: use generic above
func WriteEventState(writeBuffer utils.WriteBuffer, value BACnetEventState) error {
if value == BACnetEventState_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -140,6 +211,7 @@ func WriteEventState(writeBuffer utils.WriteBuffer, value BACnetEventState) erro
return writeBuffer.WriteUint32("eventState", bitsToWrite, uint32(value), utils.WithAdditionalStringRepresentation(value.name()))
}
+// Deprecated: use generic above
func WriteProprietaryEventState(writeBuffer utils.WriteBuffer, baCnetEventState BACnetEventState, value uint32) error {
if baCnetEventState != BACnetEventState_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -157,9 +229,10 @@ func WriteProprietaryEventState(writeBuffer utils.WriteBuffer, baCnetEventState
return writeBuffer.WriteUint32("proprietaryEventState", bitsToWrite, value, utils.WithAdditionalStringRepresentation(BACnetEventState_VENDOR_PROPRIETARY_VALUE.name()))
}
-func ReadProprietaryEventState(readBuffer utils.ReadBuffer, value BACnetEventState, actualLength uint32) (uint32, error) {
+// Deprecated: use generic above
+func ReadProprietaryEventState(readBuffer utils.ReadBuffer, value BACnetEventState, actualLength uint32) (interface{}, error) {
if value != BACnetEventState_VENDOR_PROPRIETARY_VALUE {
- return 0, nil
+ return uint32(0), nil
}
// We need to reset our reader to the position we read before
readBuffer.Reset(readBuffer.GetPos() - uint16(actualLength))
@@ -167,7 +240,8 @@ func ReadProprietaryEventState(readBuffer utils.ReadBuffer, value BACnetEventSta
return readBuffer.ReadUint32("proprietaryEventState", bitsToRead)
}
-func ReadEventType(readBuffer utils.ReadBuffer, actualLength uint32) (BACnetEventType, error) {
+// Deprecated: use generic above
+func ReadEventType(readBuffer utils.ReadBuffer, actualLength uint32) (interface{}, error) {
bitsToRead := actualLength * 8
var readUnsignedLong uint32
var err error
@@ -193,6 +267,7 @@ func ReadEventType(readBuffer utils.ReadBuffer, actualLength uint32) (BACnetEven
return BACnetEventType(readUnsignedLong), nil
}
+// Deprecated: use generic above
func WriteEventType(writeBuffer utils.WriteBuffer, value BACnetEventType) error {
if value == BACnetEventType_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -211,6 +286,7 @@ func WriteEventType(writeBuffer utils.WriteBuffer, value BACnetEventType) error
return writeBuffer.WriteUint32("eventType", bitsToWrite, uint32(value), utils.WithAdditionalStringRepresentation(value.name()))
}
+// Deprecated: use generic above
func WriteProprietaryEventType(writeBuffer utils.WriteBuffer, baCnetEventType BACnetEventType, value uint32) error {
if baCnetEventType != BACnetEventType_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -228,16 +304,19 @@ func WriteProprietaryEventType(writeBuffer utils.WriteBuffer, baCnetEventType BA
return writeBuffer.WriteUint32("proprietaryEventType", bitsToWrite, value, utils.WithAdditionalStringRepresentation(BACnetEventType_VENDOR_PROPRIETARY_VALUE.name()))
}
-func ReadProprietaryEventType(readBuffer utils.ReadBuffer, value BACnetEventType, actualLength uint32) (uint32, error) {
+// Deprecated: use generic above
+func ReadProprietaryEventType(readBuffer utils.ReadBuffer, value BACnetEventType, actualLength uint32) (interface{}, error) {
if value != BACnetEventType_VENDOR_PROPRIETARY_VALUE {
- return 0, nil
+ return uint32(0), nil
}
// We need to reset our reader to the position we read before
readBuffer.Reset(readBuffer.GetPos() - uint16(actualLength))
bitsToRead := (uint8)(actualLength * 8)
return readBuffer.ReadUint32("proprietaryEventType", bitsToRead)
}
-func ReadObjectType(readBuffer utils.ReadBuffer) (BACnetObjectType, error) {
+
+// Deprecated: use generic above
+func ReadObjectType(readBuffer utils.ReadBuffer) (interface{}, error) {
readValue, err := readBuffer.ReadUint16("objectType", 10)
if err != nil {
return 0, err
@@ -245,6 +324,7 @@ func ReadObjectType(readBuffer utils.ReadBuffer) (BACnetObjectType, error) {
return BACnetObjectType(readValue), nil
}
+// Deprecated: use generic above
func WriteObjectType(writeBuffer utils.WriteBuffer, value BACnetObjectType) error {
if value == BACnetObjectType_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -252,6 +332,7 @@ func WriteObjectType(writeBuffer utils.WriteBuffer, value BACnetObjectType) erro
return writeBuffer.WriteUint16("objectType", 10, uint16(value), utils.WithAdditionalStringRepresentation(value.name()))
}
+// Deprecated: use generic above
func WriteProprietaryObjectType(writeBuffer utils.WriteBuffer, baCnetObjectType BACnetObjectType, value uint16) error {
if baCnetObjectType != BACnetObjectType_VENDOR_PROPRIETARY_VALUE {
return nil
@@ -259,9 +340,10 @@ func WriteProprietaryObjectType(writeBuffer utils.WriteBuffer, baCnetObjectType
return writeBuffer.WriteUint16("proprietaryObjectType", 10, value, utils.WithAdditionalStringRepresentation(BACnetObjectType_VENDOR_PROPRIETARY_VALUE.name()))
}
-func ReadProprietaryObjectType(readBuffer utils.ReadBuffer, value BACnetObjectType) (uint16, error) {
+// Deprecated: use generic above
+func ReadProprietaryObjectType(readBuffer utils.ReadBuffer, value BACnetObjectType) (interface{}, error) {
if value != BACnetObjectType_VENDOR_PROPRIETARY_VALUE {
- return 0, nil
+ return uint16(0), nil
}
// We need to reset our reader to the position we read before
readBuffer.Reset(readBuffer.GetPos() - 2)
@@ -654,14 +736,17 @@ func requiredLength(value uint) uint32 {
return length
}
+// Deprecated: use generic above
func MapErrorClass(applicationTagEnumerated *BACnetApplicationTagEnumerated) ErrorClass {
return ErrorClassByValue(uint16(applicationTagEnumerated.GetActualValue()))
}
+// Deprecated: use generic above
func MapErrorCode(applicationTagEnumerated *BACnetApplicationTagEnumerated) ErrorCode {
return ErrorCodeByValue(uint16(applicationTagEnumerated.GetActualValue()))
}
+// Deprecated: use generic above
func MapAbortReason(rawAbortReason uint8, proprietary bool) AbortReason {
if proprietary {
return 0
@@ -669,6 +754,7 @@ func MapAbortReason(rawAbortReason uint8, proprietary bool) AbortReason {
return AbortReason(rawAbortReason)
}
+// Deprecated: use generic above
func MapRejectReason(rawRejectReason uint8, proprietary bool) RejectReason {
if proprietary {
return 0
@@ -676,6 +762,7 @@ func MapRejectReason(rawRejectReason uint8, proprietary bool) RejectReason {
return RejectReason(rawRejectReason)
}
+// Deprecated: use generic above
func MapBACnetLifeSafetyState(enumerated *BACnetApplicationTagEnumerated, proprietary bool) BACnetLifeSafetyState {
if proprietary {
return 0
@@ -683,6 +770,7 @@ func MapBACnetLifeSafetyState(enumerated *BACnetApplicationTagEnumerated, propri
return BACnetLifeSafetyState(enumerated.GetActualValue())
}
+// Deprecated: use generic above
func MapBACnetLifeSafetyMode(enumerated *BACnetApplicationTagEnumerated, proprietary bool) BACnetLifeSafetyMode {
if proprietary {
return 0
@@ -690,6 +778,7 @@ func MapBACnetLifeSafetyMode(enumerated *BACnetApplicationTagEnumerated, proprie
return BACnetLifeSafetyMode(enumerated.GetActualValue())
}
+// Deprecated: use generic above
func MapBACnetReliability(enumerated *BACnetApplicationTagEnumerated, proprietary bool) BACnetReliability {
if proprietary {
return 0
@@ -697,6 +786,7 @@ func MapBACnetReliability(enumerated *BACnetApplicationTagEnumerated, proprietar
return BACnetReliability(enumerated.GetActualValue())
}
+// Deprecated: use generic above
func MapBACnetObjectType(rawObjectType BACnetContextTagEnumerated) BACnetObjectType {
baCnetObjectType := BACnetObjectTypeByValue(uint16(rawObjectType.GetActualValue()))
if baCnetObjectType == 0 {
diff --git a/plc4go/internal/plc4go/s7/readwrite/model/AssociatedValueType.go b/plc4go/internal/plc4go/s7/readwrite/model/AssociatedValueType.go
index f50bdaa19b..ad178e457a 100644
--- a/plc4go/internal/plc4go/s7/readwrite/model/AssociatedValueType.go
+++ b/plc4go/internal/plc4go/s7/readwrite/model/AssociatedValueType.go
@@ -161,10 +161,11 @@ func AssociatedValueTypeParse(readBuffer utils.ReadBuffer) (*AssociatedValueType
}
// Manual Field (valueLength)
- valueLength, _valueLengthErr := RightShift3(readBuffer)
+ _valueLength, _valueLengthErr := RightShift3(readBuffer)
if _valueLengthErr != nil {
return nil, errors.Wrap(_valueLengthErr, "Error parsing 'valueLength' field")
}
+ valueLength := _valueLength.(uint16)
// Array field (data)
if pullErr := readBuffer.PullContext("data", utils.WithRenderAsList(true)); pullErr != nil {
diff --git a/plc4go/internal/plc4go/s7/readwrite/model/DateAndTime.go b/plc4go/internal/plc4go/s7/readwrite/model/DateAndTime.go
index aca397cf4d..8648c1fb6e 100644
--- a/plc4go/internal/plc4go/s7/readwrite/model/DateAndTime.go
+++ b/plc4go/internal/plc4go/s7/readwrite/model/DateAndTime.go
@@ -173,46 +173,53 @@ func DateAndTimeParse(readBuffer utils.ReadBuffer) (*DateAndTime, error) {
_ = currentPos
// Manual Field (year)
- year, _yearErr := BcdToInt(readBuffer)
+ _year, _yearErr := BcdToInt(readBuffer)
if _yearErr != nil {
return nil, errors.Wrap(_yearErr, "Error parsing 'year' field")
}
+ year := _year.(uint8)
// Manual Field (month)
- month, _monthErr := BcdToInt(readBuffer)
+ _month, _monthErr := BcdToInt(readBuffer)
if _monthErr != nil {
return nil, errors.Wrap(_monthErr, "Error parsing 'month' field")
}
+ month := _month.(uint8)
// Manual Field (day)
- day, _dayErr := BcdToInt(readBuffer)
+ _day, _dayErr := BcdToInt(readBuffer)
if _dayErr != nil {
return nil, errors.Wrap(_dayErr, "Error parsing 'day' field")
}
+ day := _day.(uint8)
// Manual Field (hour)
- hour, _hourErr := BcdToInt(readBuffer)
+ _hour, _hourErr := BcdToInt(readBuffer)
if _hourErr != nil {
return nil, errors.Wrap(_hourErr, "Error parsing 'hour' field")
}
+ hour := _hour.(uint8)
// Manual Field (minutes)
- minutes, _minutesErr := BcdToInt(readBuffer)
+ _minutes, _minutesErr := BcdToInt(readBuffer)
if _minutesErr != nil {
return nil, errors.Wrap(_minutesErr, "Error parsing 'minutes' field")
}
+ minutes := _minutes.(uint8)
// Manual Field (seconds)
- seconds, _secondsErr := BcdToInt(readBuffer)
+ _seconds, _secondsErr := BcdToInt(readBuffer)
if _secondsErr != nil {
return nil, errors.Wrap(_secondsErr, "Error parsing 'seconds' field")
}
+ seconds := _seconds.(uint8)
// Manual Field (msec)
- msec, _msecErr := S7msecToInt(readBuffer)
+ _msec, _msecErr := S7msecToInt(readBuffer)
if _msecErr != nil {
return nil, errors.Wrap(_msecErr, "Error parsing 'msec' field")
}
+ msec := _msec.(uint16)
// Simple Field (dow)
_dow, _dowErr := readBuffer.ReadUint8("dow", 4)
diff --git a/plc4go/internal/plc4go/s7/readwrite/model/StaticHelper.go b/plc4go/internal/plc4go/s7/readwrite/model/StaticHelper.go
index 225521c8aa..12caace72c 100644
--- a/plc4go/internal/plc4go/s7/readwrite/model/StaticHelper.go
+++ b/plc4go/internal/plc4go/s7/readwrite/model/StaticHelper.go
@@ -152,8 +152,8 @@ func SerializeS7Char(io utils.WriteBuffer, value values.PlcValue, encoding strin
return io.WriteUint8("", 8, value.GetUint8())
}
-func RightShift3(readBuffer utils.ReadBuffer) (uint16, error) {
- return 0, nil
+func RightShift3(readBuffer utils.ReadBuffer) (interface{}, error) {
+ return uint16(0), nil
}
func LeftShift3(writeBuffer utils.WriteBuffer, valueLength uint16) error {
@@ -164,16 +164,16 @@ func EventItemLength(readBuffer utils.ReadBuffer, valueLength uint16) uint16 {
return 0
}
-func BcdToInt(readBuffer utils.ReadBuffer) (uint8, error) {
- return 0, nil
+func BcdToInt(readBuffer utils.ReadBuffer) (interface{}, error) {
+ return uint8(0), nil
}
func ByteToBcd(writeBuffer utils.WriteBuffer, value uint8) error {
return nil
}
-func S7msecToInt(readBuffer utils.ReadBuffer) (uint16, error) {
- return 0, nil
+func S7msecToInt(readBuffer utils.ReadBuffer) (interface{}, error) {
+ return uint16(0), nil
}
func IntToS7msec(writeBuffer utils.WriteBuffer, value uint16) error {
diff --git a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/readwrite/utils/StaticHelper.java b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/readwrite/utils/StaticHelper.java
index e34b5b7b1e..82428edac7 100644
--- a/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/readwrite/utils/StaticHelper.java
+++ b/plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/readwrite/utils/StaticHelper.java
@@ -18,6 +18,7 @@
*/
package org.apache.plc4x.java.bacnetip.readwrite.utils;
+import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.plc4x.java.bacnetip.readwrite.*;
import org.apache.plc4x.java.spi.generation.ParseException;
@@ -27,9 +28,13 @@ import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import java.util.Optional;
import static org.apache.plc4x.java.spi.generation.WithReaderWriterArgs.WithAdditionalStringRepresentation;
@@ -37,6 +42,112 @@ public class StaticHelper {
public static final Logger LOGGER = LoggerFactory.getLogger(StaticHelper.class);
+ public static Object readEnumGeneric(ReadBuffer readBuffer, Long actualLength, Enum<?> template) throws ParseException {
+ int bitsToRead = (int) (actualLength * 8);
+ long rawValue = readBuffer.readUnsignedLong("value", bitsToRead);
+ // TODO: map types here for better performance which doesn't use reflection
+ if (template.getDeclaringClass() == BACnetPropertyIdentifier.class) {
+ BACnetPropertyIdentifier baCnetPropertyIdentifier = BACnetPropertyIdentifier.enumForValue(rawValue);
+ if (baCnetPropertyIdentifier == null) {
+ return BACnetPropertyIdentifier.VENDOR_PROPRIETARY_VALUE;
+ }
+ return baCnetPropertyIdentifier;
+ } else if (template.getDeclaringClass() == BACnetReliability.class) {
+ BACnetReliability baCnetReliability = BACnetReliability.enumForValue((int) rawValue);
+ if (baCnetReliability == null) {
+ return BACnetReliability.VENDOR_PROPRIETARY_VALUE;
+ }
+ return baCnetReliability;
+ } else {
+ LOGGER.warn("using reflection for {}", template.getDeclaringClass());
+ Optional<Method> enumForValue = Arrays.stream(template.getDeclaringClass().getDeclaredMethods())
+ .filter(method -> method.getName().equals("enumForValue"))
+ .findAny();
+ if (!enumForValue.isPresent()) {
+ throw new ParseException("No enumForValue available");
+ }
+ Method method = enumForValue.get();
+ try {
+ Class<?> parameterType = method.getParameterTypes()[0];
+ Object paramValue = null;
+ if (parameterType == byte.class || parameterType == Byte.class) {
+ paramValue = (byte) rawValue;
+ } else if (parameterType == short.class || parameterType == Short.class) {
+ paramValue = (short) rawValue;
+ } else if (parameterType == int.class || parameterType == Integer.class) {
+ paramValue = (int) rawValue;
+ }
+ Object result = method.invoke(null, paramValue);
+ if (result == null) {
+ return Enum.valueOf(template.getDeclaringClass(), "VENDOR_PROPRIETARY_VALUE");
+ }
+ return result;
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ throw new ParseException("error invoking method", e);
+ }
+ }
+ }
+
+ public static Long readProprietaryEnumGeneric(ReadBuffer readBuffer, Long actualLength, boolean shouldRead) throws ParseException {
+ if (!shouldRead) {
+ return 0L;
+ }
+ // We need to reset our reader to the position we read before
+ readBuffer.reset((int) (readBuffer.getPos() - actualLength));
+ int bitsToRead = (int) (actualLength * 8);
+ return readBuffer.readUnsignedLong("proprietaryValue", bitsToRead);
+ }
+
+ public static void writeEnumGeneric(WriteBuffer writeBuffer, Enum<?> value) throws SerializationException {
+ if (value == null) {
+ return;
+ }
+ int bitsToWrite;
+ long valueValue;
+ // TODO: map types here for better performance which doesn't use reflection
+ if (value.getDeclaringClass() == BACnetPropertyIdentifier.class) {
+ valueValue = ((BACnetPropertyIdentifier) value).getValue();
+ } else if (value.getDeclaringClass() == BACnetReliability.class) {
+ valueValue = ((BACnetReliability) value).getValue();
+ } else {
+ LOGGER.warn("using reflection for {}", value.getDeclaringClass());
+ try {
+ valueValue = ((Number) FieldUtils.getDeclaredField(value.getDeclaringClass(), "value", true).get(value)).longValue();
+ } catch (IllegalAccessException e) {
+ throw new SerializationException("error accessing value", e);
+ }
+ }
+
+ if (valueValue <= 0xffL) {
+ bitsToWrite = 8;
+ } else if (valueValue <= 0xffffL) {
+ bitsToWrite = 16;
+ } else if (valueValue <= 0xffffffffL) {
+ bitsToWrite = 32;
+ } else {
+ bitsToWrite = 32;
+ }
+ writeBuffer.writeUnsignedLong("value", bitsToWrite, valueValue, WithAdditionalStringRepresentation(value.name()));
+ }
+
+ public static void writeProprietaryEnumGeneric(WriteBuffer writeBuffer, long value, boolean shouldWrite) throws SerializationException {
+ if (!shouldWrite) {
+ return;
+ }
+ int bitsToWrite;
+ if (value <= 0xffL) {
+ bitsToWrite = 8;
+ } else if (value <= 0xffffL) {
+ bitsToWrite = 16;
+ } else if (value <= 0xffffffffL) {
+ bitsToWrite = 32;
+ } else {
+ bitsToWrite = 32;
+ }
+ writeBuffer.writeUnsignedLong("proprietaryValue", bitsToWrite, value, WithAdditionalStringRepresentation("VENDOR_PROPRIETARY_VALUE"));
+ }
+
+ @Deprecated
public static BACnetPropertyIdentifier readPropertyIdentifier(ReadBuffer readBuffer, Long actualLength) throws ParseException {
int bitsToRead = (int) (actualLength * 8);
long readUnsignedLong = readBuffer.readUnsignedLong("propertyIdentifier", bitsToRead);
@@ -46,6 +157,18 @@ public class StaticHelper {
return BACnetPropertyIdentifier.enumForValue(readUnsignedLong);
}
+ @Deprecated
+ public static Long readProprietaryPropertyIdentifier(ReadBuffer readBuffer, BACnetPropertyIdentifier value, Long actualLength) throws ParseException {
+ if (value != null && value != BACnetPropertyIdentifier.VENDOR_PROPRIETARY_VALUE) {
+ return 0L;
+ }
+ // We need to reset our reader to the position we read before
+ readBuffer.reset((int) (readBuffer.getPos() - actualLength));
+ int bitsToRead = (int) (actualLength * 8);
+ return readBuffer.readUnsignedLong("proprietaryPropertyIdentifier", bitsToRead);
+ }
+
+ @Deprecated
public static void writePropertyIdentifier(WriteBuffer writeBuffer, BACnetPropertyIdentifier value) throws SerializationException {
if (value == null || value == BACnetPropertyIdentifier.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -64,6 +187,7 @@ public class StaticHelper {
writeBuffer.writeUnsignedLong("propertyIdentifier", bitsToWrite, valueValue, WithAdditionalStringRepresentation(value.name()));
}
+ @Deprecated
public static void writeProprietaryPropertyIdentifier(WriteBuffer writeBuffer, BACnetPropertyIdentifier baCnetPropertyIdentifier, long value) throws SerializationException {
if (baCnetPropertyIdentifier != null && baCnetPropertyIdentifier != BACnetPropertyIdentifier.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -81,16 +205,7 @@ public class StaticHelper {
writeBuffer.writeUnsignedLong("proprietaryPropertyIdentifier", bitsToWrite, value, WithAdditionalStringRepresentation(BACnetPropertyIdentifier.VENDOR_PROPRIETARY_VALUE.name()));
}
- public static Long readProprietaryPropertyIdentifier(ReadBuffer readBuffer, BACnetPropertyIdentifier value, Long actualLength) throws ParseException {
- if (value != null && value != BACnetPropertyIdentifier.VENDOR_PROPRIETARY_VALUE) {
- return 0L;
- }
- // We need to reset our reader to the position we read before
- readBuffer.reset((int) (readBuffer.getPos() - actualLength));
- int bitsToRead = (int) (actualLength * 8);
- return readBuffer.readUnsignedLong("proprietaryPropertyIdentifier", bitsToRead);
- }
-
+ @Deprecated
public static BACnetEventType readEventType(ReadBuffer readBuffer, Long actualLength) throws ParseException {
int bitsToRead = (int) (actualLength * 8);
int readUnsignedLong = readBuffer.readUnsignedInt("eventType", bitsToRead);
@@ -100,6 +215,7 @@ public class StaticHelper {
return BACnetEventType.enumForValue(readUnsignedLong);
}
+ @Deprecated
public static void writeEventType(WriteBuffer writeBuffer, BACnetEventType value) throws SerializationException {
if (value == null || value == BACnetEventType.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -118,6 +234,7 @@ public class StaticHelper {
writeBuffer.writeUnsignedLong("eventType", bitsToWrite, valueValue, WithAdditionalStringRepresentation(value.name()));
}
+ @Deprecated
public static Long readProprietaryEventType(ReadBuffer readBuffer, BACnetEventType value, Long actualLength) throws ParseException {
if (value != null && value != BACnetEventType.VENDOR_PROPRIETARY_VALUE) {
return 0L;
@@ -128,6 +245,7 @@ public class StaticHelper {
return readBuffer.readUnsignedLong("proprietaryEventType", bitsToRead);
}
+ @Deprecated
public static void writeProprietaryEventType(WriteBuffer writeBuffer, BACnetEventType eventType, long value) throws SerializationException {
if (eventType != null && eventType != BACnetEventType.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -145,6 +263,7 @@ public class StaticHelper {
writeBuffer.writeUnsignedLong("proprietaryEventType", bitsToWrite, value, WithAdditionalStringRepresentation(BACnetEventType.VENDOR_PROPRIETARY_VALUE.name()));
}
+ @Deprecated
public static BACnetEventState readEventState(ReadBuffer readBuffer, Long actualLength) throws ParseException {
int bitsToRead = (int) (actualLength * 8);
int readUnsignedLong = readBuffer.readUnsignedInt("eventState", bitsToRead);
@@ -154,6 +273,7 @@ public class StaticHelper {
return BACnetEventState.enumForValue(readUnsignedLong);
}
+ @Deprecated
public static void writeEventState(WriteBuffer writeBuffer, BACnetEventState value) throws SerializationException {
if (value == null || value == BACnetEventState.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -172,6 +292,7 @@ public class StaticHelper {
writeBuffer.writeUnsignedLong("eventState", bitsToWrite, valueValue, WithAdditionalStringRepresentation(value.name()));
}
+ @Deprecated
public static Long readProprietaryEventState(ReadBuffer readBuffer, BACnetEventState value, Long actualLength) throws ParseException {
if (value != null && value != BACnetEventState.VENDOR_PROPRIETARY_VALUE) {
return 0L;
@@ -182,6 +303,7 @@ public class StaticHelper {
return readBuffer.readUnsignedLong("proprietaryEventState", bitsToRead);
}
+ @Deprecated
public static void writeProprietaryEventState(WriteBuffer writeBuffer, BACnetEventState eventState, long value) throws SerializationException {
if (eventState != null && eventState != BACnetEventState.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -199,6 +321,7 @@ public class StaticHelper {
writeBuffer.writeUnsignedLong("proprietaryEventState", bitsToWrite, value, WithAdditionalStringRepresentation(BACnetEventState.VENDOR_PROPRIETARY_VALUE.name()));
}
+ @Deprecated
public static BACnetObjectType readObjectType(ReadBuffer readBuffer) throws ParseException {
int readUnsignedLong = readBuffer.readUnsignedInt("objectType", 10);
if (!BACnetObjectType.isDefined(readUnsignedLong)) {
@@ -207,6 +330,7 @@ public class StaticHelper {
return BACnetObjectType.enumForValue(readUnsignedLong);
}
+ @Deprecated
public static void writeObjectType(WriteBuffer writeBuffer, BACnetObjectType value) throws SerializationException {
if (value == null || value == BACnetObjectType.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -214,6 +338,7 @@ public class StaticHelper {
writeBuffer.writeUnsignedLong("objectType", 10, value.getValue(), WithAdditionalStringRepresentation(value.name()));
}
+ @Deprecated
public static Integer readProprietaryObjectType(ReadBuffer readBuffer, BACnetObjectType value) throws ParseException {
if (value != null && value != BACnetObjectType.VENDOR_PROPRIETARY_VALUE) {
return 0;
@@ -226,6 +351,7 @@ public class StaticHelper {
return readBuffer.readUnsignedInt("proprietaryObjectType", 10);
}
+ @Deprecated
public static void writeProprietaryObjectType(WriteBuffer writeBuffer, BACnetObjectType objectType, int value) throws SerializationException {
if (objectType != null && objectType != BACnetObjectType.VENDOR_PROPRIETARY_VALUE) {
return;
@@ -1129,39 +1255,47 @@ public class StaticHelper {
return new BACnetContextTagPropertyIdentifier(null, BACnetPropertyIdentifier.VENDOR_PROPRIETARY_VALUE, 0L, (short) 0, true, 0L);
}
+ @Deprecated
public static ErrorClass mapErrorClass(BACnetApplicationTagEnumerated rawErrorClass) {
return ErrorClass.enumForValue((int) rawErrorClass.getActualValue());
}
+ @Deprecated
public static ErrorCode mapErrorCode(BACnetApplicationTagEnumerated rawErrorCode) {
return ErrorCode.enumForValue((int) rawErrorCode.getActualValue());
}
+ @Deprecated
public static AbortReason mapAbortReason(short rawAbortReason, boolean proprietary) {
if (proprietary) return null;
return AbortReason.enumForValue(rawAbortReason);
}
+ @Deprecated
public static RejectReason mapRejectReason(short rawRejectReason, boolean proprietary) {
if (proprietary) return null;
return RejectReason.enumForValue(rawRejectReason);
}
+ @Deprecated
public static BACnetLifeSafetyState mapBACnetLifeSafetyState(BACnetApplicationTagEnumerated rawData, boolean proprietary) {
if (proprietary) return null;
return BACnetLifeSafetyState.enumForValue((int) rawData.getActualValue());
}
+ @Deprecated
public static BACnetLifeSafetyMode mapBACnetLifeSafetyMode(BACnetApplicationTagEnumerated rawData, boolean proprietary) {
if (proprietary) return null;
return BACnetLifeSafetyMode.enumForValue((int) rawData.getActualValue());
}
+ @Deprecated
public static BACnetReliability mapBACnetReliability(BACnetApplicationTagEnumerated rawData, boolean proprietary) {
if (proprietary) return null;
return BACnetReliability.enumForValue((int) rawData.getActualValue());
}
+ @Deprecated
public static BACnetObjectType mapBACnetObjectType(BACnetContextTagEnumerated rawObjectType) {
if (rawObjectType == null) return null;
BACnetObjectType baCnetObjectType = BACnetObjectType.enumForValue((int) rawObjectType.getActualValue());
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 e5a60df95b..522eb7b912 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
@@ -1212,7 +1212,7 @@ public class RandomPackagesTest {
{
BACnetPropertyValue baCnetPropertyValue = baCnetNotificationParametersComplexEventType.getListOfValues().getData().get(4);
assertEquals(BACnetPropertyIdentifier.RELIABILITY, baCnetPropertyValue.getPropertyIdentifier().getPropertyIdentifier());
- BACnetReliability reliability = ((BACnetConstructedDataReliability) baCnetPropertyValue.getPropertyValue().getConstructedData()).getReliability().getReliability();
+ BACnetReliability reliability = ((BACnetConstructedDataReliability) baCnetPropertyValue.getPropertyValue().getConstructedData()).getReliability().getValue();
assertEquals(BACnetReliability.NO_FAULT_DETECTED, reliability);
}
{
diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
index a68d9ee253..8ca87fa1ec 100644
--- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
+++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
@@ -1842,7 +1842,8 @@
]
]
-// TODO: try with manual fields
+// TODO: migrate like BACnetReliabilityTagged
+// TODO: maybe we transfrom that to a tandem of ApplicationTag and enum with manual fields
[type BACnetConstructedDataAcceptedModesEntry
[simple BACnetApplicationTagEnumerated
rawData ]
@@ -1853,6 +1854,7 @@
[virtual uint 16 acceptedModeProprietary 'isAcceptedModeProprietary?rawData.actualValue:0' ]
]
+// Attention: 0-63 ASHRAE. 64-65535 proprietary
[enum uint 16 BACnetLifeSafetyMode
['0' OFF ]
['1' ON ]
@@ -1871,7 +1873,7 @@
['14' DEFAULT ]
]
-// TODO: try with manual fields
+// TODO: migrate like BACnetReliabilityTagged
[type BACnetConstructedDataLifeSafetyStateEntry
[simple BACnetApplicationTagEnumerated
rawData ]
@@ -1882,6 +1884,7 @@
[virtual uint 16 lifeSafetyStateProprietary 'isLifeSafetyStateProprietary?rawData.actualValue:0' ]
]
+// Attention: 0-63 ASHRAE. 64-65535 proprietary
[enum uint 16 BACnetLifeSafetyState
['0' QUIET]
['1' PRE_ALARM]
@@ -1909,17 +1912,7 @@
['23' TEST_SUPERVISORY]
]
-// TODO: try with manual fields
-[type BACnetConstructedDataReliabilityEntry
- [simple BACnetApplicationTagEnumerated
- rawData ]
- [virtual bit isBACnetReliabilityProprietary 'rawData.actualValue > 255' ]
- [virtual BACnetReliability
- reliability
- 'STATIC_CALL("mapBACnetReliability", rawData, isBACnetReliabilityProprietary)' ]
- [virtual uint 16 reliabilityProprietary 'isBACnetReliabilityProprietary?rawData.actualValue:0' ]
-]
-
+// Attention: 0-63 ASHRAE. 64-65535 proprietary
[enum uint 16 BACnetReliability
['0' NO_FAULT_DETECTED ]
['1' NO_SENSOR ]
@@ -1945,8 +1938,32 @@
['22' PROPRIETARY_COMMAND_FAILURE ]
['23' FAULTS_LISTED ]
['24' REFERENCED_OBJECT_FAULT ]
-]
+ // plc4x definition
+ ['0XFFFF' VENDOR_PROPRIETARY_VALUE ]
+]
+
+[type BACnetReliabilityTagged(TagClass tagClass, uint 8 tagNumber)
+ [simple BACnetTagHeader
+ header ]
+ [validation 'header.tagClass == tagClass' "tag doesn't match" ]
+ [validation '(header.tagClass == TagClass.APPLICATION_TAGS) || (header.actualTagNumber == tagNumber)'
+ "tagnumber doesn't match" shouldFail=false ]
+ [manual BACnetReliability
+ value
+ 'STATIC_CALL("readEnumGeneric", readBuffer, header.actualLength, BACnetReliability.VENDOR_PROPRIETARY_VALUE)'
+ 'STATIC_CALL("writeEnumGeneric", writeBuffer, value)'
+ 'header.actualLength * 8' ]
+ [virtual bit isProprietary
+ 'value == BACnetReliability.VENDOR_PROPRIETARY_VALUE' ]
+ [manual uint 32
+ proprietaryValue
+ 'STATIC_CALL("readProprietaryEnumGeneric", readBuffer, header.actualLength, isProprietary)'
+ 'STATIC_CALL("writeProprietaryEnumGeneric", writeBuffer, proprietaryValue, isProprietary)'
+ 'header.actualLength * 8' ]
+]
+
+// TODO: migrate like BACnetReliabilityTagged
// TODO: this is a enum so we should build a static call which maps a enum (could be solved by using only the tag header with a length validation and the enum itself)
[type BACnetStatusFlags(uint 8 tagNumber)
[simple BACnetContextTagBitString('tagNumber', 'BACnetDataType.BIT_STRING')
@@ -1958,6 +1975,8 @@
[virtual bit outOfService 'rawBits.payload.data[3]']
]
+// TODO: migrate like BACnetReliabilityTagged
+// TODO: fixme: convert to enum now as this is sometime a application tag, sometimes a context.tag
// TODO: this is a enum so we should build a static call which maps a enum (could be solved by using only the tag header with a length validation and the enum itself)
// TODO: fixme... this is only in context a context tag... otherwise it can be and application tag
[type BACnetAction(uint 8 tagNumber)
@@ -2037,6 +2056,10 @@
]
]
// TODO: add missing type
+ ['7' BACnetPropertyStatesReliability(uint 8 peekedTagNumber)
+ [simple BACnetReliabilityTagged('TagClass.CONTEXT_SPECIFIC_TAGS', '0') reliability]
+ ]
+ // TODO: add missing type
['16' BACnetPropertyStatesAction(uint 8 peekedTagNumber)
[optional BACnetAction('peekedTagNumber')
action
@@ -2908,7 +2931,7 @@
//[*, 'REFERENCE_PORT' BACnetConstructedDataReferencePort [validation '1 == 2' "TODO: implement me REFERENCE_PORT BACnetConstructedDataReferencePort"]]
//[*, 'REGISTERED_CAR_CALL' BACnetConstructedDataRegisteredCarCall [validation '1 == 2' "TODO: implement me REGISTERED_CAR_CALL BACnetConstructedDataRegisteredCarCall"]]
[*, 'RELIABILITY' BACnetConstructedDataReliability
- [simple BACnetConstructedDataReliabilityEntry reliability]
+ [simple BACnetReliabilityTagged('TagClass.APPLICATION_TAGS', '0') reliability]
]
//[*, 'RELIABILITY_EVALUATION_INHIBIT' BACnetConstructedDataReliabilityEvaluationInhibit [validation '1 == 2' "TODO: implement me RELIABILITY_EVALUATION_INHIBIT BACnetConstructedDataReliabilityEvaluationInhibit"]]
//[*, 'RELINQUISH_DEFAULT' BACnetConstructedDataRelinquishDefault [validation '1 == 2' "TODO: implement me RELINQUISH_DEFAULT BACnetConstructedDataRelinquishDefault"]]