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 14:25:37 UTC
[plc4x] 01/02: feat(bacnet): implemented unique properties for escalator 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
commit ef8f17b60b62db0af2feea3debf8002bd5e9f692
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 7 16:11:25 2022 +0200
feat(bacnet): implemented unique properties for escalator type
- ESCALATOR_MODE
- OPERATION_DIRECTION
- POWER_MODE
---
.../readwrite/model/BACnetConstructedData.go | 6 +
.../model/BACnetConstructedDataEscalatorMode.go | 211 +++++++++++++++++++++
.../BACnetConstructedDataOperationDirection.go | 211 +++++++++++++++++++++
.../model/BACnetConstructedDataPowerMode.go | 211 +++++++++++++++++++++
.../resources/protocols/bacnetip/bacnetip.mspec | 12 +-
5 files changed, 648 insertions(+), 3 deletions(-)
diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
index 8b4bf7615c..f3e986b31c 100644
--- a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
@@ -478,6 +478,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob
_child, typeSwitchError = BACnetConstructedDataEffectivePeriodParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ERROR_LIMIT: // BACnetConstructedDataErrorLimit
_child, typeSwitchError = BACnetConstructedDataErrorLimitParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
+ case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ESCALATOR_MODE: // BACnetConstructedDataEscalatorMode
+ _child, typeSwitchError = BACnetConstructedDataEscalatorModeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_EVENT_ALGORITHM_INHIBIT: // BACnetConstructedDataEventAlgorithmInhibit
_child, typeSwitchError = BACnetConstructedDataEventAlgorithmInhibitParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_EVENT_ALGORITHM_INHIBIT_REF: // BACnetConstructedDataEventAlgorithmInhibitRef
@@ -716,6 +718,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob
_child, typeSwitchError = BACnetConstructedDataOccupancyLowerLimitEnforcedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OCCUPANCY_UPPER_LIMIT_ENFORCED: // BACnetConstructedDataOccupancyUpperLimitEnforced
_child, typeSwitchError = BACnetConstructedDataOccupancyUpperLimitEnforcedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
+ case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OPERATION_DIRECTION: // BACnetConstructedDataOperationDirection
+ _child, typeSwitchError = BACnetConstructedDataOperationDirectionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OUT_OF_SERVICE: // BACnetConstructedDataOutOfService
_child, typeSwitchError = BACnetConstructedDataOutOfServiceParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OUTPUT_UNITS: // BACnetConstructedDataOutputUnits
@@ -726,6 +730,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob
_child, typeSwitchError = BACnetConstructedDataPortFilterParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_POSITIVE_ACCESS_RULES: // BACnetConstructedDataPositiveAccessRules
_child, typeSwitchError = BACnetConstructedDataPositiveAccessRulesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument)
+ case true && propertyIdentifierArgument == BACnetPropertyIdentifier_POWER_MODE: // BACnetConstructedDataPowerMode
+ _child, typeSwitchError = BACnetConstructedDataPowerModeParse(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
diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorMode.go
new file mode 100644
index 0000000000..6ae1b2e536
--- /dev/null
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataEscalatorMode.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.
+
+// BACnetConstructedDataEscalatorMode is the data-structure of this message
+type BACnetConstructedDataEscalatorMode struct {
+ *BACnetConstructedData
+ EscalatorMode *BACnetEscalatorModeTagged
+
+ // Arguments.
+ TagNumber uint8
+}
+
+// IBACnetConstructedDataEscalatorMode is the corresponding interface of BACnetConstructedDataEscalatorMode
+type IBACnetConstructedDataEscalatorMode interface {
+ IBACnetConstructedData
+ // GetEscalatorMode returns EscalatorMode (property field)
+ GetEscalatorMode() *BACnetEscalatorModeTagged
+ // 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 *BACnetConstructedDataEscalatorMode) GetObjectTypeArgument() BACnetObjectType {
+ return 0
+}
+
+func (m *BACnetConstructedDataEscalatorMode) GetPropertyIdentifierArgument() BACnetPropertyIdentifier {
+ return BACnetPropertyIdentifier_ESCALATOR_MODE
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+func (m *BACnetConstructedDataEscalatorMode) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) {
+ m.BACnetConstructedData.OpeningTag = openingTag
+ m.BACnetConstructedData.ClosingTag = closingTag
+}
+
+func (m *BACnetConstructedDataEscalatorMode) GetParent() *BACnetConstructedData {
+ return m.BACnetConstructedData
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *BACnetConstructedDataEscalatorMode) GetEscalatorMode() *BACnetEscalatorModeTagged {
+ return m.EscalatorMode
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewBACnetConstructedDataEscalatorMode factory function for BACnetConstructedDataEscalatorMode
+func NewBACnetConstructedDataEscalatorMode(escalatorMode *BACnetEscalatorModeTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataEscalatorMode {
+ _result := &BACnetConstructedDataEscalatorMode{
+ EscalatorMode: escalatorMode,
+ BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber),
+ }
+ _result.Child = _result
+ return _result
+}
+
+func CastBACnetConstructedDataEscalatorMode(structType interface{}) *BACnetConstructedDataEscalatorMode {
+ if casted, ok := structType.(BACnetConstructedDataEscalatorMode); ok {
+ return &casted
+ }
+ if casted, ok := structType.(*BACnetConstructedDataEscalatorMode); ok {
+ return casted
+ }
+ if casted, ok := structType.(BACnetConstructedData); ok {
+ return CastBACnetConstructedDataEscalatorMode(casted.Child)
+ }
+ if casted, ok := structType.(*BACnetConstructedData); ok {
+ return CastBACnetConstructedDataEscalatorMode(casted.Child)
+ }
+ return nil
+}
+
+func (m *BACnetConstructedDataEscalatorMode) GetTypeName() string {
+ return "BACnetConstructedDataEscalatorMode"
+}
+
+func (m *BACnetConstructedDataEscalatorMode) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *BACnetConstructedDataEscalatorMode) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(m.GetParentLengthInBits())
+
+ // Simple field (escalatorMode)
+ lengthInBits += m.EscalatorMode.GetLengthInBits()
+
+ return lengthInBits
+}
+
+func (m *BACnetConstructedDataEscalatorMode) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetConstructedDataEscalatorModeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataEscalatorMode, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("BACnetConstructedDataEscalatorMode"); pullErr != nil {
+ return nil, pullErr
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (escalatorMode)
+ if pullErr := readBuffer.PullContext("escalatorMode"); pullErr != nil {
+ return nil, pullErr
+ }
+ _escalatorMode, _escalatorModeErr := BACnetEscalatorModeTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS))
+ if _escalatorModeErr != nil {
+ return nil, errors.Wrap(_escalatorModeErr, "Error parsing 'escalatorMode' field")
+ }
+ escalatorMode := CastBACnetEscalatorModeTagged(_escalatorMode)
+ if closeErr := readBuffer.CloseContext("escalatorMode"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ if closeErr := readBuffer.CloseContext("BACnetConstructedDataEscalatorMode"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Create a partially initialized instance
+ _child := &BACnetConstructedDataEscalatorMode{
+ EscalatorMode: CastBACnetEscalatorModeTagged(escalatorMode),
+ BACnetConstructedData: &BACnetConstructedData{},
+ }
+ _child.BACnetConstructedData.Child = _child
+ return _child, nil
+}
+
+func (m *BACnetConstructedDataEscalatorMode) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ ser := func() error {
+ if pushErr := writeBuffer.PushContext("BACnetConstructedDataEscalatorMode"); pushErr != nil {
+ return pushErr
+ }
+
+ // Simple Field (escalatorMode)
+ if pushErr := writeBuffer.PushContext("escalatorMode"); pushErr != nil {
+ return pushErr
+ }
+ _escalatorModeErr := m.EscalatorMode.Serialize(writeBuffer)
+ if popErr := writeBuffer.PopContext("escalatorMode"); popErr != nil {
+ return popErr
+ }
+ if _escalatorModeErr != nil {
+ return errors.Wrap(_escalatorModeErr, "Error serializing 'escalatorMode' field")
+ }
+
+ if popErr := writeBuffer.PopContext("BACnetConstructedDataEscalatorMode"); popErr != nil {
+ return popErr
+ }
+ return nil
+ }
+ return m.SerializeParent(writeBuffer, m, ser)
+}
+
+func (m *BACnetConstructedDataEscalatorMode) 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/BACnetConstructedDataOperationDirection.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOperationDirection.go
new file mode 100644
index 0000000000..415a9caf71
--- /dev/null
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataOperationDirection.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.
+
+// BACnetConstructedDataOperationDirection is the data-structure of this message
+type BACnetConstructedDataOperationDirection struct {
+ *BACnetConstructedData
+ OperationDirection *BACnetEscalatorOperationDirectionTagged
+
+ // Arguments.
+ TagNumber uint8
+}
+
+// IBACnetConstructedDataOperationDirection is the corresponding interface of BACnetConstructedDataOperationDirection
+type IBACnetConstructedDataOperationDirection interface {
+ IBACnetConstructedData
+ // GetOperationDirection returns OperationDirection (property field)
+ GetOperationDirection() *BACnetEscalatorOperationDirectionTagged
+ // 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 *BACnetConstructedDataOperationDirection) GetObjectTypeArgument() BACnetObjectType {
+ return 0
+}
+
+func (m *BACnetConstructedDataOperationDirection) GetPropertyIdentifierArgument() BACnetPropertyIdentifier {
+ return BACnetPropertyIdentifier_OPERATION_DIRECTION
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+func (m *BACnetConstructedDataOperationDirection) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) {
+ m.BACnetConstructedData.OpeningTag = openingTag
+ m.BACnetConstructedData.ClosingTag = closingTag
+}
+
+func (m *BACnetConstructedDataOperationDirection) GetParent() *BACnetConstructedData {
+ return m.BACnetConstructedData
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *BACnetConstructedDataOperationDirection) GetOperationDirection() *BACnetEscalatorOperationDirectionTagged {
+ return m.OperationDirection
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewBACnetConstructedDataOperationDirection factory function for BACnetConstructedDataOperationDirection
+func NewBACnetConstructedDataOperationDirection(operationDirection *BACnetEscalatorOperationDirectionTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataOperationDirection {
+ _result := &BACnetConstructedDataOperationDirection{
+ OperationDirection: operationDirection,
+ BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber),
+ }
+ _result.Child = _result
+ return _result
+}
+
+func CastBACnetConstructedDataOperationDirection(structType interface{}) *BACnetConstructedDataOperationDirection {
+ if casted, ok := structType.(BACnetConstructedDataOperationDirection); ok {
+ return &casted
+ }
+ if casted, ok := structType.(*BACnetConstructedDataOperationDirection); ok {
+ return casted
+ }
+ if casted, ok := structType.(BACnetConstructedData); ok {
+ return CastBACnetConstructedDataOperationDirection(casted.Child)
+ }
+ if casted, ok := structType.(*BACnetConstructedData); ok {
+ return CastBACnetConstructedDataOperationDirection(casted.Child)
+ }
+ return nil
+}
+
+func (m *BACnetConstructedDataOperationDirection) GetTypeName() string {
+ return "BACnetConstructedDataOperationDirection"
+}
+
+func (m *BACnetConstructedDataOperationDirection) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *BACnetConstructedDataOperationDirection) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(m.GetParentLengthInBits())
+
+ // Simple field (operationDirection)
+ lengthInBits += m.OperationDirection.GetLengthInBits()
+
+ return lengthInBits
+}
+
+func (m *BACnetConstructedDataOperationDirection) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetConstructedDataOperationDirectionParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataOperationDirection, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("BACnetConstructedDataOperationDirection"); pullErr != nil {
+ return nil, pullErr
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (operationDirection)
+ if pullErr := readBuffer.PullContext("operationDirection"); pullErr != nil {
+ return nil, pullErr
+ }
+ _operationDirection, _operationDirectionErr := BACnetEscalatorOperationDirectionTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS))
+ if _operationDirectionErr != nil {
+ return nil, errors.Wrap(_operationDirectionErr, "Error parsing 'operationDirection' field")
+ }
+ operationDirection := CastBACnetEscalatorOperationDirectionTagged(_operationDirection)
+ if closeErr := readBuffer.CloseContext("operationDirection"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ if closeErr := readBuffer.CloseContext("BACnetConstructedDataOperationDirection"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Create a partially initialized instance
+ _child := &BACnetConstructedDataOperationDirection{
+ OperationDirection: CastBACnetEscalatorOperationDirectionTagged(operationDirection),
+ BACnetConstructedData: &BACnetConstructedData{},
+ }
+ _child.BACnetConstructedData.Child = _child
+ return _child, nil
+}
+
+func (m *BACnetConstructedDataOperationDirection) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ ser := func() error {
+ if pushErr := writeBuffer.PushContext("BACnetConstructedDataOperationDirection"); pushErr != nil {
+ return pushErr
+ }
+
+ // Simple Field (operationDirection)
+ if pushErr := writeBuffer.PushContext("operationDirection"); pushErr != nil {
+ return pushErr
+ }
+ _operationDirectionErr := m.OperationDirection.Serialize(writeBuffer)
+ if popErr := writeBuffer.PopContext("operationDirection"); popErr != nil {
+ return popErr
+ }
+ if _operationDirectionErr != nil {
+ return errors.Wrap(_operationDirectionErr, "Error serializing 'operationDirection' field")
+ }
+
+ if popErr := writeBuffer.PopContext("BACnetConstructedDataOperationDirection"); popErr != nil {
+ return popErr
+ }
+ return nil
+ }
+ return m.SerializeParent(writeBuffer, m, ser)
+}
+
+func (m *BACnetConstructedDataOperationDirection) 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/BACnetConstructedDataPowerMode.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPowerMode.go
new file mode 100644
index 0000000000..2ea62ded3d
--- /dev/null
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataPowerMode.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.
+
+// BACnetConstructedDataPowerMode is the data-structure of this message
+type BACnetConstructedDataPowerMode struct {
+ *BACnetConstructedData
+ PowerMode *BACnetApplicationTagBoolean
+
+ // Arguments.
+ TagNumber uint8
+}
+
+// IBACnetConstructedDataPowerMode is the corresponding interface of BACnetConstructedDataPowerMode
+type IBACnetConstructedDataPowerMode interface {
+ IBACnetConstructedData
+ // GetPowerMode returns PowerMode (property field)
+ GetPowerMode() *BACnetApplicationTagBoolean
+ // 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 *BACnetConstructedDataPowerMode) GetObjectTypeArgument() BACnetObjectType {
+ return 0
+}
+
+func (m *BACnetConstructedDataPowerMode) GetPropertyIdentifierArgument() BACnetPropertyIdentifier {
+ return BACnetPropertyIdentifier_POWER_MODE
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+func (m *BACnetConstructedDataPowerMode) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) {
+ m.BACnetConstructedData.OpeningTag = openingTag
+ m.BACnetConstructedData.ClosingTag = closingTag
+}
+
+func (m *BACnetConstructedDataPowerMode) GetParent() *BACnetConstructedData {
+ return m.BACnetConstructedData
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *BACnetConstructedDataPowerMode) GetPowerMode() *BACnetApplicationTagBoolean {
+ return m.PowerMode
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewBACnetConstructedDataPowerMode factory function for BACnetConstructedDataPowerMode
+func NewBACnetConstructedDataPowerMode(powerMode *BACnetApplicationTagBoolean, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataPowerMode {
+ _result := &BACnetConstructedDataPowerMode{
+ PowerMode: powerMode,
+ BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber),
+ }
+ _result.Child = _result
+ return _result
+}
+
+func CastBACnetConstructedDataPowerMode(structType interface{}) *BACnetConstructedDataPowerMode {
+ if casted, ok := structType.(BACnetConstructedDataPowerMode); ok {
+ return &casted
+ }
+ if casted, ok := structType.(*BACnetConstructedDataPowerMode); ok {
+ return casted
+ }
+ if casted, ok := structType.(BACnetConstructedData); ok {
+ return CastBACnetConstructedDataPowerMode(casted.Child)
+ }
+ if casted, ok := structType.(*BACnetConstructedData); ok {
+ return CastBACnetConstructedDataPowerMode(casted.Child)
+ }
+ return nil
+}
+
+func (m *BACnetConstructedDataPowerMode) GetTypeName() string {
+ return "BACnetConstructedDataPowerMode"
+}
+
+func (m *BACnetConstructedDataPowerMode) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *BACnetConstructedDataPowerMode) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(m.GetParentLengthInBits())
+
+ // Simple field (powerMode)
+ lengthInBits += m.PowerMode.GetLengthInBits()
+
+ return lengthInBits
+}
+
+func (m *BACnetConstructedDataPowerMode) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BACnetConstructedDataPowerModeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataPowerMode, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("BACnetConstructedDataPowerMode"); pullErr != nil {
+ return nil, pullErr
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (powerMode)
+ if pullErr := readBuffer.PullContext("powerMode"); pullErr != nil {
+ return nil, pullErr
+ }
+ _powerMode, _powerModeErr := BACnetApplicationTagParse(readBuffer)
+ if _powerModeErr != nil {
+ return nil, errors.Wrap(_powerModeErr, "Error parsing 'powerMode' field")
+ }
+ powerMode := CastBACnetApplicationTagBoolean(_powerMode)
+ if closeErr := readBuffer.CloseContext("powerMode"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ if closeErr := readBuffer.CloseContext("BACnetConstructedDataPowerMode"); closeErr != nil {
+ return nil, closeErr
+ }
+
+ // Create a partially initialized instance
+ _child := &BACnetConstructedDataPowerMode{
+ PowerMode: CastBACnetApplicationTagBoolean(powerMode),
+ BACnetConstructedData: &BACnetConstructedData{},
+ }
+ _child.BACnetConstructedData.Child = _child
+ return _child, nil
+}
+
+func (m *BACnetConstructedDataPowerMode) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ ser := func() error {
+ if pushErr := writeBuffer.PushContext("BACnetConstructedDataPowerMode"); pushErr != nil {
+ return pushErr
+ }
+
+ // Simple Field (powerMode)
+ if pushErr := writeBuffer.PushContext("powerMode"); pushErr != nil {
+ return pushErr
+ }
+ _powerModeErr := m.PowerMode.Serialize(writeBuffer)
+ if popErr := writeBuffer.PopContext("powerMode"); popErr != nil {
+ return popErr
+ }
+ if _powerModeErr != nil {
+ return errors.Wrap(_powerModeErr, "Error serializing 'powerMode' field")
+ }
+
+ if popErr := writeBuffer.PopContext("BACnetConstructedDataPowerMode"); popErr != nil {
+ return popErr
+ }
+ return nil
+ }
+ return m.SerializeParent(writeBuffer, m, ser)
+}
+
+func (m *BACnetConstructedDataPowerMode) 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 a1b58c45b8..cb83e8fe68 100644
--- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
+++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
@@ -2883,7 +2883,9 @@
[*, 'ERROR_LIMIT' BACnetConstructedDataErrorLimit
[simple BACnetApplicationTagReal errorLimit ]
]
- //[*, 'ESCALATOR_MODE' BACnetConstructedDataEscalatorMode [validation '1 == 2' "TODO: implement me ESCALATOR_MODE BACnetConstructedDataEscalatorMode"]]
+ [*, 'ESCALATOR_MODE' BACnetConstructedDataEscalatorMode
+ [simple BACnetEscalatorModeTagged('0', 'TagClass.APPLICATION_TAGS') escalatorMode ]
+ ]
[*, 'EVENT_ALGORITHM_INHIBIT' BACnetConstructedDataEventAlgorithmInhibit
[simple BACnetApplicationTagBoolean eventAlgorithmInhibit ]
]
@@ -3361,7 +3363,9 @@
[*, 'OCCUPANCY_UPPER_LIMIT_ENFORCED' BACnetConstructedDataOccupancyUpperLimitEnforced
[simple BACnetApplicationTagBoolean occupancyUpperLimitEnforced ]
]
- //[*, 'OPERATION_DIRECTION' BACnetConstructedDataOperationDirection [validation '1 == 2' "TODO: implement me OPERATION_DIRECTION BACnetConstructedDataOperationDirection"]]
+ [*, 'OPERATION_DIRECTION' BACnetConstructedDataOperationDirection
+ [simple BACnetEscalatorOperationDirectionTagged('0', 'TagClass.APPLICATION_TAGS') operationDirection ]
+ ]
//[*, 'OPERATION_EXPECTED' BACnetConstructedDataOperationExpected [validation '1 == 2' "TODO: implement me OPERATION_EXPECTED BACnetConstructedDataOperationExpected"]]
//[*, 'OPTIONAL' BACnetConstructedDataOptional [validation '1 == 2' "TODO: implement me OPTIONAL BACnetConstructedDataOptional"]]
[*, 'OUT_OF_SERVICE' BACnetConstructedDataOutOfService
@@ -3390,7 +3394,9 @@
'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ]
]
//[*, 'POWER' BACnetConstructedDataPower [validation '1 == 2' "TODO: implement me POWER BACnetConstructedDataPower"]]
- //[*, 'POWER_MODE' BACnetConstructedDataPowerMode [validation '1 == 2' "TODO: implement me POWER_MODE BACnetConstructedDataPowerMode"]]
+ [*, 'POWER_MODE' BACnetConstructedDataPowerMode
+ [simple BACnetApplicationTagBoolean powerMode ]
+ ]
//[*, 'PRESCALE' BACnetConstructedDataPrescale [validation '1 == 2' "TODO: implement me PRESCALE BACnetConstructedDataPrescale"]]
['ANALOG_INPUT', 'PRESENT_VALUE' BACnetConstructedDataAnalogInputPresentValue
[simple BACnetApplicationTagReal presentValue ]