You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/06/07 08:52:06 UTC
[plc4x] branch develop updated: feat(bacnet): implemented unique properties for notification class type
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 d679430d56 feat(bacnet): implemented unique properties for notification class type
d679430d56 is described below
commit d679430d565f7c92efd075d1a9756347e05671e5
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 7 10:51:59 2022 +0200
feat(bacnet): implemented unique properties for notification class type
- ACK_REQUIRED
- PRIORITY
---
.../readwrite/model/BACnetConstructedData.go | 4 +
.../model/BACnetConstructedDataAckRequired.go | 211 +++++++++++++++++++
.../model/BACnetConstructedDataPriority.go | 231 +++++++++++++++++++++
.../resources/protocols/bacnetip/bacnetip.mspec | 13 +-
4 files changed, 457 insertions(+), 2 deletions(-)
diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
index 162cc4a0f4..74c1a7a660 100644
--- a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
@@ -186,6 +186,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob
_child, typeSwitchError = BACnetConstructedDataAccompanimentParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACCOMPANIMENT_TIME: // BACnetConstructedDataAccompanimentTime
_child, typeSwitchError = BACnetConstructedDataAccompanimentTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
+ case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACK_REQUIRED: // BACnetConstructedDataAckRequired
+ _child, typeSwitchError = BACnetConstructedDataAckRequiredParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACKED_TRANSITIONS: // BACnetConstructedDataAckedTransitions
_child, typeSwitchError = BACnetConstructedDataAckedTransitionsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case objectTypeArgument == BACnetObjectType_LOOP && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTION: // BACnetConstructedDataLoopAction
@@ -526,6 +528,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob
_child, typeSwitchError = BACnetConstructedDataPositiveAccessRulesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case objectTypeArgument == BACnetObjectType_ANALOG_INPUT && propertyIdentifierArgument == BACnetPropertyIdentifier_PRESENT_VALUE: // BACnetConstructedDataAnalogInputPresentValue
_child, typeSwitchError = BACnetConstructedDataAnalogInputPresentValueParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
+ case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PRIORITY: // BACnetConstructedDataPriority
+ _child, typeSwitchError = BACnetConstructedDataPriorityParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PRIORITY_ARRAY: // BACnetConstructedDataPriorityArray
_child, typeSwitchError = BACnetConstructedDataPriorityArrayParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PROCESS_IDENTIFIER_FILTER: // BACnetConstructedDataProcessIdentifierFilter
diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAckRequired.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAckRequired.go
new file mode 100644
index 0000000000..cde574501e
--- /dev/null
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAckRequired.go
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package model
+
+import (
+ "github.com/apache/plc4x/plc4go/internal/spi/utils"
+ "github.com/pkg/errors"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// BACnetConstructedDataAckRequired is the data-structure of this message
+type BACnetConstructedDataAckRequired struct {
+ *BACnetConstructedData
+ AckRequired *BACnetEventTransitionBitsTagged
+
+ // Arguments.
+ TagNumber uint8
+}
+
+// IBACnetConstructedDataAckRequired is the corresponding interface of BACnetConstructedDataAckRequired
+type IBACnetConstructedDataAckRequired interface {
+ IBACnetConstructedData
+ // GetAckRequired returns AckRequired (property field)
+ GetAckRequired() *BACnetEventTransitionBitsTagged
+ // 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 *BACnetConstructedDataAckRequired) GetObjectTypeArgument() BACnetObjectType {
+ return 0
+}
+
+func (m *BACnetConstructedDataAckRequired) GetPropertyIdentifierArgument() BACnetPropertyIdentifier {
+ return BACnetPropertyIdentifier_ACK_REQUIRED
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+func (m *BACnetConstructedDataAckRequired) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) {
+ m.BACnetConstructedData.OpeningTag = openingTag
+ m.BACnetConstructedData.ClosingTag = closingTag
+}
+
+func (m *BACnetConstructedDataAckRequired) GetParent() *BACnetConstructedData {
+ return m.BACnetConstructedData
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *BACnetConstructedDataAckRequired) GetAckRequired() *BACnetEventTransitionBitsTagged {
+ return m.AckRequired
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewBACnetConstructedDataAckRequired factory function for BACnetConstructedDataAckRequired
+func NewBACnetConstructedDataAckRequired(ackRequired *BACnetEventTransitionBitsTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataAckRequired {
+ _result := &BACnetConstructedDataAckRequired{
+ AckRequired: ackRequired,
+ BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber),
+ }
+ _result.Child = _result
+ return _result
+}
+
+func CastBACnetConstructedDataAckRequired(structType interface{}) *BACnetConstructedDataAckRequired {
+ if casted, ok := structType.(BACnetConstructedDataAckRequired); ok {
+ return &casted
+ }
+ if casted, ok := structType.(*BACnetConstructedDataAckRequired); ok {
+ return casted
+ }
+ if casted, ok := structType.(BACnetConstructedData); ok {
+ return CastBACnetConstructedDataAckRequired(casted.Child)
+ }
+ if casted, ok := structType.(*BACnetConstructedData); ok {
+ return CastBACnetConstructedDataAckRequired(casted.Child)
+ }
+ return nil
+}
+
+func (m *BACnetConstructedDataAckRequired) GetTypeName() string {
+ return "BACnetConstructedDataAckRequired"
+}
+
+func (m *BACnetConstructedDataAckRequired) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *BACnetConstructedDataAckRequired) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(m.GetParentLengthInBits())
+
+ // Simple field (ackRequired)
+ lengthInBits += m.AckRequired.GetLengthInBits()
+
+ return lengthInBits
+}
+
+func (m *BACnetConstructedDataAckRequired) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetConstructedDataAckRequiredParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataAckRequired, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("BACnetConstructedDataAckRequired"); pullErr != nil {
+ return nil, pullErr
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (ackRequired)
+ if pullErr := readBuffer.PullContext("ackRequired"); pullErr != nil {
+ return nil, pullErr
+ }
+ _ackRequired, _ackRequiredErr := BACnetEventTransitionBitsTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS))
+ if _ackRequiredErr != nil {
+ return nil, errors.Wrap(_ackRequiredErr, "Error parsing 'ackRequired' field")
+ }
+ ackRequired := CastBACnetEventTransitionBitsTagged(_ackRequired)
+ if closeErr := readBuffer.CloseContext("ackRequired"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ if closeErr := readBuffer.CloseContext("BACnetConstructedDataAckRequired"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Create a partially initialized instance
+ _child := &BACnetConstructedDataAckRequired{
+ AckRequired: CastBACnetEventTransitionBitsTagged(ackRequired),
+ BACnetConstructedData: &BACnetConstructedData{},
+ }
+ _child.BACnetConstructedData.Child = _child
+ return _child, nil
+}
+
+func (m *BACnetConstructedDataAckRequired) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ ser := func() error {
+ if pushErr := writeBuffer.PushContext("BACnetConstructedDataAckRequired"); pushErr != nil {
+ return pushErr
+ }
+
+ // Simple Field (ackRequired)
+ if pushErr := writeBuffer.PushContext("ackRequired"); pushErr != nil {
+ return pushErr
+ }
+ _ackRequiredErr := m.AckRequired.Serialize(writeBuffer)
+ if popErr := writeBuffer.PopContext("ackRequired"); popErr != nil {
+ return popErr
+ }
+ if _ackRequiredErr != nil {
+ return errors.Wrap(_ackRequiredErr, "Error serializing 'ackRequired' field")
+ }
+
+ if popErr := writeBuffer.PopContext("BACnetConstructedDataAckRequired"); popErr != nil {
+ return popErr
+ }
+ return nil
+ }
+ return m.SerializeParent(writeBuffer, m, ser)
+}
+
+func (m *BACnetConstructedDataAckRequired) 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/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriority.go
new file mode 100644
index 0000000000..8220a732b5
--- /dev/null
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPriority.go
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package model
+
+import (
+ "github.com/apache/plc4x/plc4go/internal/spi/utils"
+ "github.com/pkg/errors"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// BACnetConstructedDataPriority is the data-structure of this message
+type BACnetConstructedDataPriority struct {
+ *BACnetConstructedData
+ Priority []*BACnetApplicationTagUnsignedInteger
+
+ // Arguments.
+ TagNumber uint8
+}
+
+// IBACnetConstructedDataPriority is the corresponding interface of BACnetConstructedDataPriority
+type IBACnetConstructedDataPriority interface {
+ IBACnetConstructedData
+ // GetPriority returns Priority (property field)
+ GetPriority() []*BACnetApplicationTagUnsignedInteger
+ // 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 *BACnetConstructedDataPriority) GetObjectTypeArgument() BACnetObjectType {
+ return 0
+}
+
+func (m *BACnetConstructedDataPriority) GetPropertyIdentifierArgument() BACnetPropertyIdentifier {
+ return BACnetPropertyIdentifier_PRIORITY
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+func (m *BACnetConstructedDataPriority) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) {
+ m.BACnetConstructedData.OpeningTag = openingTag
+ m.BACnetConstructedData.ClosingTag = closingTag
+}
+
+func (m *BACnetConstructedDataPriority) GetParent() *BACnetConstructedData {
+ return m.BACnetConstructedData
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *BACnetConstructedDataPriority) GetPriority() []*BACnetApplicationTagUnsignedInteger {
+ return m.Priority
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewBACnetConstructedDataPriority factory function for BACnetConstructedDataPriority
+func NewBACnetConstructedDataPriority(priority []*BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataPriority {
+ _result := &BACnetConstructedDataPriority{
+ Priority: priority,
+ BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber),
+ }
+ _result.Child = _result
+ return _result
+}
+
+func CastBACnetConstructedDataPriority(structType interface{}) *BACnetConstructedDataPriority {
+ if casted, ok := structType.(BACnetConstructedDataPriority); ok {
+ return &casted
+ }
+ if casted, ok := structType.(*BACnetConstructedDataPriority); ok {
+ return casted
+ }
+ if casted, ok := structType.(BACnetConstructedData); ok {
+ return CastBACnetConstructedDataPriority(casted.Child)
+ }
+ if casted, ok := structType.(*BACnetConstructedData); ok {
+ return CastBACnetConstructedDataPriority(casted.Child)
+ }
+ return nil
+}
+
+func (m *BACnetConstructedDataPriority) GetTypeName() string {
+ return "BACnetConstructedDataPriority"
+}
+
+func (m *BACnetConstructedDataPriority) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *BACnetConstructedDataPriority) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(m.GetParentLengthInBits())
+
+ // Array field
+ if len(m.Priority) > 0 {
+ for _, element := range m.Priority {
+ lengthInBits += element.GetLengthInBits()
+ }
+ }
+
+ return lengthInBits
+}
+
+func (m *BACnetConstructedDataPriority) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetConstructedDataPriorityParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataPriority, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("BACnetConstructedDataPriority"); pullErr != nil {
+ return nil, pullErr
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Array field (priority)
+ if pullErr := readBuffer.PullContext("priority", utils.WithRenderAsList(true)); pullErr != nil {
+ return nil, pullErr
+ }
+ // Terminated array
+ priority := make([]*BACnetApplicationTagUnsignedInteger, 0)
+ {
+ for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) {
+ _item, _err := BACnetApplicationTagParse(readBuffer)
+ if _err != nil {
+ return nil, errors.Wrap(_err, "Error parsing 'priority' field")
+ }
+ priority = append(priority, CastBACnetApplicationTagUnsignedInteger(_item))
+
+ }
+ }
+ if closeErr := readBuffer.CloseContext("priority", utils.WithRenderAsList(true)); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Validation
+ if !(bool((len(priority)) == (3))) {
+ return nil, utils.ParseValidationError{"priority should have exactly 3 values"}
+ }
+
+ if closeErr := readBuffer.CloseContext("BACnetConstructedDataPriority"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Create a partially initialized instance
+ _child := &BACnetConstructedDataPriority{
+ Priority: priority,
+ BACnetConstructedData: &BACnetConstructedData{},
+ }
+ _child.BACnetConstructedData.Child = _child
+ return _child, nil
+}
+
+func (m *BACnetConstructedDataPriority) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ ser := func() error {
+ if pushErr := writeBuffer.PushContext("BACnetConstructedDataPriority"); pushErr != nil {
+ return pushErr
+ }
+
+ // Array Field (priority)
+ if m.Priority != nil {
+ if pushErr := writeBuffer.PushContext("priority", utils.WithRenderAsList(true)); pushErr != nil {
+ return pushErr
+ }
+ for _, _element := range m.Priority {
+ _elementErr := _element.Serialize(writeBuffer)
+ if _elementErr != nil {
+ return errors.Wrap(_elementErr, "Error serializing 'priority' field")
+ }
+ }
+ if popErr := writeBuffer.PopContext("priority", utils.WithRenderAsList(true)); popErr != nil {
+ return popErr
+ }
+ }
+
+ if popErr := writeBuffer.PopContext("BACnetConstructedDataPriority"); popErr != nil {
+ return popErr
+ }
+ return nil
+ }
+ return m.SerializeParent(writeBuffer, m, ser)
+}
+
+func (m *BACnetConstructedDataPriority) 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/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
index 3fb4aa25e2..349cc101e9 100644
--- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
+++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
@@ -2341,7 +2341,10 @@
[*, 'ACCOMPANIMENT_TIME' BACnetConstructedDataAccompanimentTime
[simple BACnetApplicationTagUnsignedInteger accompanimentTime ]
]
- //[*, 'ACK_REQUIRED' BACnetConstructedDataAckRequired [validation '1 == 2' "TODO: implement me ACK_REQUIRED BACnetConstructedDataAckRequired"]]
+ [*, 'ACK_REQUIRED' BACnetConstructedDataAckRequired
+ [simple BACnetEventTransitionBitsTagged('0', 'TagClass.APPLICATION_TAGS')
+ ackRequired ]
+ ]
[*, 'ACKED_TRANSITIONS' BACnetConstructedDataAckedTransitions
[simple BACnetEventTransitionBitsTagged('0', 'TagClass.APPLICATION_TAGS') ackedTransitions ]
]
@@ -3141,7 +3144,13 @@
[simple BACnetApplicationTagReal presentValue ]
]
//[*, 'PRESENT_VALUE' BACnetConstructedDataPresentValue [validation '1 == 2' "TODO: implement me PRESENT_VALUE BACnetConstructedDataPresentValue"]]
- //[*, 'PRIORITY' BACnetConstructedDataPriority [validation '1 == 2' "TODO: implement me PRIORITY BACnetConstructedDataPriority"]]
+ [*, 'PRIORITY' BACnetConstructedDataPriority
+ [array BACnetApplicationTagUnsignedInteger
+ priority
+ terminated
+ 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ]
+ [validation 'COUNT(priority) == 3' "priority should have exactly 3 values" ]
+ ]
[*, 'PRIORITY_ARRAY' BACnetConstructedDataPriorityArray
[simple BACnetPriorityArray('objectTypeArgument', 'tagNumber') priorityArray ]
]