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/18 14:08:50 UTC
[plc4x] branch develop updated: feat(bacnet): implemented support for BACnetConstructedDataReliability
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 feb585b3f0 feat(bacnet): implemented support for BACnetConstructedDataReliability
feb585b3f0 is described below
commit feb585b3f0bbf376ea6c1d5ebe1117b25dc8e043
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed May 18 16:08:43 2022 +0200
feat(bacnet): implemented support for BACnetConstructedDataReliability
---
.../plc4go/bacnetip/readwrite/ParserHelper.go | 2 +
.../plc4go/bacnetip/readwrite/XmlParserHelper.go | 2 +
.../readwrite/model/BACnetConstructedData.go | 2 +
.../model/BACnetConstructedDataReliability.go | 208 +++++++++++++++
.../model/BACnetConstructedDataReliabilityEntry.go | 220 +++++++++++++++
.../bacnetip/readwrite/model/BACnetReliability.go | 297 +++++++++++++++++++++
.../bacnetip/readwrite/model/StaticHelper.go | 7 +
.../bacnetip/readwrite/utils/StaticHelper.java | 5 +
.../resources/protocols/bacnetip/bacnetip.mspec | 48 +++-
9 files changed, 787 insertions(+), 4 deletions(-)
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go b/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go
index 9a0d4e868e..101a2295d0 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/ParserHelper.go
@@ -203,6 +203,8 @@ 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 f12d9e0e24..fd82d0b74b 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/XmlParserHelper.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/XmlParserHelper.go
@@ -235,6 +235,8 @@ 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/BACnetConstructedData.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedData.go
index 2bf333c4ec..dbf14f2963 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedData.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedData.go
@@ -201,6 +201,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob
_child, typeSwitchError = BACnetConstructedDataListOfObjectPropertyReferencesParse(readBuffer, tagNumber, objectType, propertyIdentifierArgument)
case true && propertyIdentifierEnum == BACnetPropertyIdentifier_MEMBER_OF: // BACnetConstructedDataMemberOf
_child, typeSwitchError = BACnetConstructedDataMemberOfParse(readBuffer, tagNumber, objectType, propertyIdentifierArgument)
+ case true && propertyIdentifierEnum == BACnetPropertyIdentifier_RELIABILITY: // BACnetConstructedDataReliability
+ _child, typeSwitchError = BACnetConstructedDataReliabilityParse(readBuffer, tagNumber, objectType, propertyIdentifierArgument)
case true && propertyIdentifierEnum == BACnetPropertyIdentifier_ZONE_MEMBERS: // BACnetConstructedDataZoneMembers
_child, typeSwitchError = BACnetConstructedDataZoneMembersParse(readBuffer, tagNumber, objectType, propertyIdentifierArgument)
case true: // BACnetConstructedDataUnspecified
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go
new file mode 100644
index 0000000000..1303f4e4ff
--- /dev/null
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliability.go
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * 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.
+
+// BACnetConstructedDataReliability is the data-structure of this message
+type BACnetConstructedDataReliability struct {
+ *BACnetConstructedData
+ Reliability *BACnetConstructedDataReliabilityEntry
+
+ // Arguments.
+ TagNumber uint8
+ PropertyIdentifierArgument BACnetContextTagPropertyIdentifier
+}
+
+// IBACnetConstructedDataReliability is the corresponding interface of BACnetConstructedDataReliability
+type IBACnetConstructedDataReliability interface {
+ IBACnetConstructedData
+ // GetReliability returns Reliability (property field)
+ GetReliability() *BACnetConstructedDataReliabilityEntry
+ // 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 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 *BACnetConstructedDataReliability) GetParent() *BACnetConstructedData {
+ return m.BACnetConstructedData
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *BACnetConstructedDataReliability) GetReliability() *BACnetConstructedDataReliabilityEntry {
+ return m.Reliability
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// 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),
+ }
+ _result.Child = _result
+ return _result
+}
+
+func CastBACnetConstructedDataReliability(structType interface{}) *BACnetConstructedDataReliability {
+ if casted, ok := structType.(BACnetConstructedDataReliability); ok {
+ return &casted
+ }
+ if casted, ok := structType.(*BACnetConstructedDataReliability); ok {
+ return casted
+ }
+ if casted, ok := structType.(BACnetConstructedData); ok {
+ return CastBACnetConstructedDataReliability(casted.Child)
+ }
+ if casted, ok := structType.(*BACnetConstructedData); ok {
+ return CastBACnetConstructedDataReliability(casted.Child)
+ }
+ return nil
+}
+
+func (m *BACnetConstructedDataReliability) GetTypeName() string {
+ return "BACnetConstructedDataReliability"
+}
+
+func (m *BACnetConstructedDataReliability) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *BACnetConstructedDataReliability) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(m.GetParentLengthInBits())
+
+ // Simple field (reliability)
+ lengthInBits += m.Reliability.GetLengthInBits()
+
+ return lengthInBits
+}
+
+func (m *BACnetConstructedDataReliability) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetConstructedDataReliabilityParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectType BACnetObjectType, propertyIdentifierArgument *BACnetContextTagPropertyIdentifier) (*BACnetConstructedDataReliability, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("BACnetConstructedDataReliability"); pullErr != nil {
+ return nil, pullErr
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (reliability)
+ if pullErr := readBuffer.PullContext("reliability"); pullErr != nil {
+ return nil, pullErr
+ }
+ _reliability, _reliabilityErr := BACnetConstructedDataReliabilityEntryParse(readBuffer)
+ if _reliabilityErr != nil {
+ return nil, errors.Wrap(_reliabilityErr, "Error parsing 'reliability' field")
+ }
+ reliability := CastBACnetConstructedDataReliabilityEntry(_reliability)
+ if closeErr := readBuffer.CloseContext("reliability"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ if closeErr := readBuffer.CloseContext("BACnetConstructedDataReliability"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Create a partially initialized instance
+ _child := &BACnetConstructedDataReliability{
+ Reliability: CastBACnetConstructedDataReliabilityEntry(reliability),
+ BACnetConstructedData: &BACnetConstructedData{},
+ }
+ _child.BACnetConstructedData.Child = _child
+ return _child, nil
+}
+
+func (m *BACnetConstructedDataReliability) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ ser := func() error {
+ if pushErr := writeBuffer.PushContext("BACnetConstructedDataReliability"); pushErr != nil {
+ return pushErr
+ }
+
+ // Simple Field (reliability)
+ if pushErr := writeBuffer.PushContext("reliability"); pushErr != nil {
+ return pushErr
+ }
+ _reliabilityErr := m.Reliability.Serialize(writeBuffer)
+ if popErr := writeBuffer.PopContext("reliability"); popErr != nil {
+ return popErr
+ }
+ if _reliabilityErr != nil {
+ return errors.Wrap(_reliabilityErr, "Error serializing 'reliability' field")
+ }
+
+ if popErr := writeBuffer.PopContext("BACnetConstructedDataReliability"); popErr != nil {
+ return popErr
+ }
+ return nil
+ }
+ return m.SerializeParent(writeBuffer, m, ser)
+}
+
+func (m *BACnetConstructedDataReliability) 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/BACnetConstructedDataReliabilityEntry.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliabilityEntry.go
new file mode 100644
index 0000000000..ad22ebb210
--- /dev/null
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataReliabilityEntry.go
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.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/BACnetReliability.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliability.go
new file mode 100644
index 0000000000..34a16db1ae
--- /dev/null
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReliability.go
@@ -0,0 +1,297 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.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.
+
+type BACnetReliability uint16
+
+type IBACnetReliability interface {
+ Serialize(writeBuffer utils.WriteBuffer) error
+}
+
+const (
+ BACnetReliability_NO_FAULT_DETECTED BACnetReliability = 0
+ BACnetReliability_NO_SENSOR BACnetReliability = 1
+ BACnetReliability_OVER_RANGE BACnetReliability = 2
+ BACnetReliability_UNDER_RANGE BACnetReliability = 3
+ BACnetReliability_OPEN_LOOP BACnetReliability = 4
+ BACnetReliability_SHORTED_LOOP BACnetReliability = 5
+ BACnetReliability_NO_OUTPUT BACnetReliability = 6
+ BACnetReliability_UNRELIABLE_OTHER BACnetReliability = 7
+ BACnetReliability_PROCESS_ERROR BACnetReliability = 8
+ BACnetReliability_MULTI_STATE_FAULT BACnetReliability = 9
+ BACnetReliability_CONFIGURATION_ERROR BACnetReliability = 10
+ BACnetReliability_COMMUNICATION_FAILURE BACnetReliability = 12
+ BACnetReliability_MEMBER_FAULT BACnetReliability = 13
+ BACnetReliability_MONITORED_OBJECT_FAULT BACnetReliability = 14
+ BACnetReliability_TRIPPED BACnetReliability = 15
+ BACnetReliability_LAMP_FAILURE BACnetReliability = 16
+ BACnetReliability_ACTIVATION_FAILURE BACnetReliability = 17
+ BACnetReliability_RENEW_DHCP_FAILURE BACnetReliability = 18
+ BACnetReliability_RENEW_FD_REGISTRATION_FAILURE BACnetReliability = 19
+ BACnetReliability_RESTART_AUTO_NEGOTIATION_FAILURE BACnetReliability = 20
+ BACnetReliability_RESTART_FAILURE BACnetReliability = 21
+ BACnetReliability_PROPRIETARY_COMMAND_FAILURE BACnetReliability = 22
+ BACnetReliability_FAULTS_LISTED BACnetReliability = 23
+ BACnetReliability_REFERENCED_OBJECT_FAULT BACnetReliability = 24
+)
+
+var BACnetReliabilityValues []BACnetReliability
+
+func init() {
+ _ = errors.New
+ BACnetReliabilityValues = []BACnetReliability{
+ BACnetReliability_NO_FAULT_DETECTED,
+ BACnetReliability_NO_SENSOR,
+ BACnetReliability_OVER_RANGE,
+ BACnetReliability_UNDER_RANGE,
+ BACnetReliability_OPEN_LOOP,
+ BACnetReliability_SHORTED_LOOP,
+ BACnetReliability_NO_OUTPUT,
+ BACnetReliability_UNRELIABLE_OTHER,
+ BACnetReliability_PROCESS_ERROR,
+ BACnetReliability_MULTI_STATE_FAULT,
+ BACnetReliability_CONFIGURATION_ERROR,
+ BACnetReliability_COMMUNICATION_FAILURE,
+ BACnetReliability_MEMBER_FAULT,
+ BACnetReliability_MONITORED_OBJECT_FAULT,
+ BACnetReliability_TRIPPED,
+ BACnetReliability_LAMP_FAILURE,
+ BACnetReliability_ACTIVATION_FAILURE,
+ BACnetReliability_RENEW_DHCP_FAILURE,
+ BACnetReliability_RENEW_FD_REGISTRATION_FAILURE,
+ BACnetReliability_RESTART_AUTO_NEGOTIATION_FAILURE,
+ BACnetReliability_RESTART_FAILURE,
+ BACnetReliability_PROPRIETARY_COMMAND_FAILURE,
+ BACnetReliability_FAULTS_LISTED,
+ BACnetReliability_REFERENCED_OBJECT_FAULT,
+ }
+}
+
+func BACnetReliabilityByValue(value uint16) BACnetReliability {
+ switch value {
+ case 0:
+ return BACnetReliability_NO_FAULT_DETECTED
+ case 1:
+ return BACnetReliability_NO_SENSOR
+ case 10:
+ return BACnetReliability_CONFIGURATION_ERROR
+ case 12:
+ return BACnetReliability_COMMUNICATION_FAILURE
+ case 13:
+ return BACnetReliability_MEMBER_FAULT
+ case 14:
+ return BACnetReliability_MONITORED_OBJECT_FAULT
+ case 15:
+ return BACnetReliability_TRIPPED
+ case 16:
+ return BACnetReliability_LAMP_FAILURE
+ case 17:
+ return BACnetReliability_ACTIVATION_FAILURE
+ case 18:
+ return BACnetReliability_RENEW_DHCP_FAILURE
+ case 19:
+ return BACnetReliability_RENEW_FD_REGISTRATION_FAILURE
+ case 2:
+ return BACnetReliability_OVER_RANGE
+ case 20:
+ return BACnetReliability_RESTART_AUTO_NEGOTIATION_FAILURE
+ case 21:
+ return BACnetReliability_RESTART_FAILURE
+ case 22:
+ return BACnetReliability_PROPRIETARY_COMMAND_FAILURE
+ case 23:
+ return BACnetReliability_FAULTS_LISTED
+ case 24:
+ return BACnetReliability_REFERENCED_OBJECT_FAULT
+ case 3:
+ return BACnetReliability_UNDER_RANGE
+ case 4:
+ return BACnetReliability_OPEN_LOOP
+ case 5:
+ return BACnetReliability_SHORTED_LOOP
+ case 6:
+ return BACnetReliability_NO_OUTPUT
+ case 7:
+ return BACnetReliability_UNRELIABLE_OTHER
+ case 8:
+ return BACnetReliability_PROCESS_ERROR
+ case 9:
+ return BACnetReliability_MULTI_STATE_FAULT
+ }
+ return 0
+}
+
+func BACnetReliabilityByName(value string) BACnetReliability {
+ switch value {
+ case "NO_FAULT_DETECTED":
+ return BACnetReliability_NO_FAULT_DETECTED
+ case "NO_SENSOR":
+ return BACnetReliability_NO_SENSOR
+ case "CONFIGURATION_ERROR":
+ return BACnetReliability_CONFIGURATION_ERROR
+ case "COMMUNICATION_FAILURE":
+ return BACnetReliability_COMMUNICATION_FAILURE
+ case "MEMBER_FAULT":
+ return BACnetReliability_MEMBER_FAULT
+ case "MONITORED_OBJECT_FAULT":
+ return BACnetReliability_MONITORED_OBJECT_FAULT
+ case "TRIPPED":
+ return BACnetReliability_TRIPPED
+ case "LAMP_FAILURE":
+ return BACnetReliability_LAMP_FAILURE
+ case "ACTIVATION_FAILURE":
+ return BACnetReliability_ACTIVATION_FAILURE
+ case "RENEW_DHCP_FAILURE":
+ return BACnetReliability_RENEW_DHCP_FAILURE
+ case "RENEW_FD_REGISTRATION_FAILURE":
+ return BACnetReliability_RENEW_FD_REGISTRATION_FAILURE
+ case "OVER_RANGE":
+ return BACnetReliability_OVER_RANGE
+ case "RESTART_AUTO_NEGOTIATION_FAILURE":
+ return BACnetReliability_RESTART_AUTO_NEGOTIATION_FAILURE
+ case "RESTART_FAILURE":
+ return BACnetReliability_RESTART_FAILURE
+ case "PROPRIETARY_COMMAND_FAILURE":
+ return BACnetReliability_PROPRIETARY_COMMAND_FAILURE
+ case "FAULTS_LISTED":
+ return BACnetReliability_FAULTS_LISTED
+ case "REFERENCED_OBJECT_FAULT":
+ return BACnetReliability_REFERENCED_OBJECT_FAULT
+ case "UNDER_RANGE":
+ return BACnetReliability_UNDER_RANGE
+ case "OPEN_LOOP":
+ return BACnetReliability_OPEN_LOOP
+ case "SHORTED_LOOP":
+ return BACnetReliability_SHORTED_LOOP
+ case "NO_OUTPUT":
+ return BACnetReliability_NO_OUTPUT
+ case "UNRELIABLE_OTHER":
+ return BACnetReliability_UNRELIABLE_OTHER
+ case "PROCESS_ERROR":
+ return BACnetReliability_PROCESS_ERROR
+ case "MULTI_STATE_FAULT":
+ return BACnetReliability_MULTI_STATE_FAULT
+ }
+ return 0
+}
+
+func BACnetReliabilityKnows(value uint16) bool {
+ for _, typeValue := range BACnetReliabilityValues {
+ if uint16(typeValue) == value {
+ return true
+ }
+ }
+ return false
+}
+
+func CastBACnetReliability(structType interface{}) BACnetReliability {
+ castFunc := func(typ interface{}) BACnetReliability {
+ if sBACnetReliability, ok := typ.(BACnetReliability); ok {
+ return sBACnetReliability
+ }
+ return 0
+ }
+ return castFunc(structType)
+}
+
+func (m BACnetReliability) GetLengthInBits() uint16 {
+ return 16
+}
+
+func (m BACnetReliability) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetReliabilityParse(readBuffer utils.ReadBuffer) (BACnetReliability, error) {
+ val, err := readBuffer.ReadUint16("BACnetReliability", 16)
+ if err != nil {
+ return 0, nil
+ }
+ return BACnetReliabilityByValue(val), nil
+}
+
+func (e BACnetReliability) Serialize(writeBuffer utils.WriteBuffer) error {
+ return writeBuffer.WriteUint16("BACnetReliability", 16, uint16(e), utils.WithAdditionalStringRepresentation(e.name()))
+}
+
+func (e BACnetReliability) name() string {
+ switch e {
+ case BACnetReliability_NO_FAULT_DETECTED:
+ return "NO_FAULT_DETECTED"
+ case BACnetReliability_NO_SENSOR:
+ return "NO_SENSOR"
+ case BACnetReliability_CONFIGURATION_ERROR:
+ return "CONFIGURATION_ERROR"
+ case BACnetReliability_COMMUNICATION_FAILURE:
+ return "COMMUNICATION_FAILURE"
+ case BACnetReliability_MEMBER_FAULT:
+ return "MEMBER_FAULT"
+ case BACnetReliability_MONITORED_OBJECT_FAULT:
+ return "MONITORED_OBJECT_FAULT"
+ case BACnetReliability_TRIPPED:
+ return "TRIPPED"
+ case BACnetReliability_LAMP_FAILURE:
+ return "LAMP_FAILURE"
+ case BACnetReliability_ACTIVATION_FAILURE:
+ return "ACTIVATION_FAILURE"
+ case BACnetReliability_RENEW_DHCP_FAILURE:
+ return "RENEW_DHCP_FAILURE"
+ case BACnetReliability_RENEW_FD_REGISTRATION_FAILURE:
+ return "RENEW_FD_REGISTRATION_FAILURE"
+ case BACnetReliability_OVER_RANGE:
+ return "OVER_RANGE"
+ case BACnetReliability_RESTART_AUTO_NEGOTIATION_FAILURE:
+ return "RESTART_AUTO_NEGOTIATION_FAILURE"
+ case BACnetReliability_RESTART_FAILURE:
+ return "RESTART_FAILURE"
+ case BACnetReliability_PROPRIETARY_COMMAND_FAILURE:
+ return "PROPRIETARY_COMMAND_FAILURE"
+ case BACnetReliability_FAULTS_LISTED:
+ return "FAULTS_LISTED"
+ case BACnetReliability_REFERENCED_OBJECT_FAULT:
+ return "REFERENCED_OBJECT_FAULT"
+ case BACnetReliability_UNDER_RANGE:
+ return "UNDER_RANGE"
+ case BACnetReliability_OPEN_LOOP:
+ return "OPEN_LOOP"
+ case BACnetReliability_SHORTED_LOOP:
+ return "SHORTED_LOOP"
+ case BACnetReliability_NO_OUTPUT:
+ return "NO_OUTPUT"
+ case BACnetReliability_UNRELIABLE_OTHER:
+ return "UNRELIABLE_OTHER"
+ case BACnetReliability_PROCESS_ERROR:
+ return "PROCESS_ERROR"
+ case BACnetReliability_MULTI_STATE_FAULT:
+ return "MULTI_STATE_FAULT"
+ }
+ return ""
+}
+
+func (e BACnetReliability) String() string {
+ return e.name()
+}
diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go
index 4467b988a2..75ff642d6b 100644
--- a/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go
+++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/StaticHelper.go
@@ -690,6 +690,13 @@ func MapBACnetLifeSafetyMode(enumerated *BACnetApplicationTagEnumerated, proprie
return BACnetLifeSafetyMode(enumerated.GetActualValue())
}
+func MapBACnetReliability(enumerated *BACnetApplicationTagEnumerated, proprietary bool) BACnetReliability {
+ if proprietary {
+ return 0
+ }
+ return BACnetReliability(enumerated.GetActualValue())
+}
+
func MapBACnetObjectType(rawObjectType BACnetContextTagEnumerated) BACnetObjectType {
baCnetObjectType := BACnetObjectTypeByValue(uint16(rawObjectType.GetActualValue()))
if baCnetObjectType == 0 {
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 58ea7e3a84..e34b5b7b1e 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
@@ -1157,6 +1157,11 @@ public class StaticHelper {
return BACnetLifeSafetyMode.enumForValue((int) rawData.getActualValue());
}
+ public static BACnetReliability mapBACnetReliability(BACnetApplicationTagEnumerated rawData, boolean proprietary) {
+ if (proprietary) return null;
+ return BACnetReliability.enumForValue((int) rawData.getActualValue());
+ }
+
public static BACnetObjectType mapBACnetObjectType(BACnetContextTagEnumerated rawObjectType) {
if (rawObjectType == null) return null;
BACnetObjectType baCnetObjectType = BACnetObjectType.enumForValue((int) rawObjectType.getActualValue());
diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
index 475b3986c1..a68d9ee253 100644
--- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
+++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
@@ -1877,7 +1877,7 @@
rawData ]
[virtual bit isLifeSafetyStateProprietary 'rawData.actualValue > 255' ]
[virtual BACnetLifeSafetyState
- lifeSafetyState
+ lifeSafetyState
'STATIC_CALL("mapBACnetLifeSafetyState", rawData, isLifeSafetyStateProprietary)' ]
[virtual uint 16 lifeSafetyStateProprietary 'isLifeSafetyStateProprietary?rawData.actualValue:0' ]
]
@@ -1909,6 +1909,44 @@
['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' ]
+]
+
+[enum uint 16 BACnetReliability
+ ['0' NO_FAULT_DETECTED ]
+ ['1' NO_SENSOR ]
+ ['2' OVER_RANGE ]
+ ['3' UNDER_RANGE ]
+ ['4' OPEN_LOOP ]
+ ['5' SHORTED_LOOP ]
+ ['6' NO_OUTPUT ]
+ ['7' UNRELIABLE_OTHER ]
+ ['8' PROCESS_ERROR ]
+ ['9' MULTI_STATE_FAULT ]
+ ['10' CONFIGURATION_ERROR ]
+ ['12' COMMUNICATION_FAILURE ]
+ ['13' MEMBER_FAULT ]
+ ['14' MONITORED_OBJECT_FAULT ]
+ ['15' TRIPPED ]
+ ['16' LAMP_FAILURE ]
+ ['17' ACTIVATION_FAILURE ]
+ ['18' RENEW_DHCP_FAILURE ]
+ ['19' RENEW_FD_REGISTRATION_FAILURE ]
+ ['20' RESTART_AUTO_NEGOTIATION_FAILURE ]
+ ['21' RESTART_FAILURE ]
+ ['22' PROPRIETARY_COMMAND_FAILURE ]
+ ['23' FAULTS_LISTED ]
+ ['24' REFERENCED_OBJECT_FAULT ]
+]
+
// 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')
@@ -2869,7 +2907,9 @@
//[*, 'RECORDS_SINCE_NOTIFICATION' BACnetConstructedDataRecordsSinceNotification [validation '1 == 2' "TODO: implement me RECORDS_SINCE_NOTIFICATION BACnetConstructedDataRecordsSinceNotification"]]
//[*, '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 [validation '1 == 2' "TODO: implement me RELIABILITY BACnetConstructedDataReliability"]]
+ [*, 'RELIABILITY' BACnetConstructedDataReliability
+ [simple BACnetConstructedDataReliabilityEntry 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"]]
//[*, 'REPRESENTS' BACnetConstructedDataRepresents [validation '1 == 2' "TODO: implement me REPRESENTS BACnetConstructedDataRepresents"]]
@@ -3143,7 +3183,7 @@
['20' NONE ]
['21' CHANGE_OF_DISCRETE_VALUE ]
['22' CHANGE_OF_TIMER ]
-
+
// plc4x definition
['0xFFFF' VENDOR_PROPRIETARY_VALUE ]
]
@@ -3155,7 +3195,7 @@
['3' HIGH_LIMIT ]
['4' LOW_LIMIT ]
['5' LIFE_SAVETY_ALARM ]
-
+
// plc4x definition
['0xFFFF' VENDOR_PROPRIETARY_VALUE ]
]