From 862605723ce7de09a55db72c1d9dc4657e1090db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Fri, 3 Jun 2022 12:18:33 +0200 Subject: [PATCH] feat(bacnet): implemented unique properties for access credential object type - ABSENTEE_LIMIT - ACTIVATION_TIME - ASSIGNED_ACCESS_RIGHTS - AUTHENTICATION_FACTORS - AUTHORIZATION_EXEMPTIONS - BELONGS_TO - CREDENTIAL_DISABLE - DAYS_REMAINING - EXTENDED_TIME_ENABLE - LAST_ACCESS_EVENT - LAST_ACCESS_POINT - LAST_USE_TIME - REASON_FOR_DISABLE - THREAT_AUTHORITY - TRACE_FLAG - USES_REMAINING --- .../bacnetip/readwrite/ParserHelper.go | 16 ++ .../bacnetip/readwrite/XmlParserHelper.go | 17 ++ .../model/BACnetAccessThreatLevel.go | 160 +++++++++++ .../model/BACnetAssignedAccessRights.go | 195 +++++++++++++ .../model/BACnetAuthenticationFactor.go | 230 ++++++++++++++++ .../BACnetAuthenticationFactorEnclosed.go | 233 ++++++++++++++++ .../model/BACnetAuthenticationFactorFormat.go | 259 ++++++++++++++++++ .../readwrite/model/BACnetConstructedData.go | 34 +++ .../BACnetConstructedDataAbsenteeLimit.go | 211 ++++++++++++++ .../BACnetConstructedDataActivationTime.go | 211 ++++++++++++++ ...CnetConstructedDataAssignedAccessRights.go | 226 +++++++++++++++ ...netConstructedDataAuthenticationFactors.go | 226 +++++++++++++++ ...tConstructedDataAuthorizationExemptions.go | 226 +++++++++++++++ .../model/BACnetConstructedDataBelongsTo.go | 211 ++++++++++++++ .../BACnetConstructedDataCredentialDisable.go | 211 ++++++++++++++ .../BACnetConstructedDataCredentialStatus.go | 211 ++++++++++++++ .../BACnetConstructedDataDaysRemaining.go | 211 ++++++++++++++ ...BACnetConstructedDataExtendedTimeEnable.go | 211 ++++++++++++++ .../BACnetConstructedDataLastAccessEvent.go | 211 ++++++++++++++ .../BACnetConstructedDataLastAccessPoint.go | 211 ++++++++++++++ .../model/BACnetConstructedDataLastUseTime.go | 211 ++++++++++++++ .../BACnetConstructedDataReasonForDisable.go | 226 +++++++++++++++ .../BACnetConstructedDataThreatAuthority.go | 211 ++++++++++++++ .../model/BACnetConstructedDataTraceFlag.go | 211 ++++++++++++++ .../BACnetConstructedDataUsesRemaining.go | 211 ++++++++++++++ .../BACnetCredentialAuthenticationFactor.go | 195 +++++++++++++ .../protocols/bacnetip/bacnetip.mspec | 133 +++++++-- .../bacnetip/BACnetObjectsDefinitions.java | 10 +- .../ObjectPropertyDeDuplicationTest.java | 36 +-- 29 files changed, 5123 insertions(+), 42 deletions(-) create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetAccessThreatLevel.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedAccessRights.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactor.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorEnclosed.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorFormat.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAbsenteeLimit.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActivationTime.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAssignedAccessRights.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationFactors.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthorizationExemptions.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBelongsTo.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDisable.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialStatus.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaysRemaining.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExtendedTimeEnable.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessEvent.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessPoint.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastUseTime.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReasonForDisable.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataThreatAuthority.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTraceFlag.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUsesRemaining.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetCredentialAuthenticationFactor.go diff --git a/plc4go/protocols/bacnetip/readwrite/ParserHelper.go b/plc4go/protocols/bacnetip/readwrite/ParserHelper.go index ad1968bfe40..9926b019fe8 100644 --- a/plc4go/protocols/bacnetip/readwrite/ParserHelper.go +++ b/plc4go/protocols/bacnetip/readwrite/ParserHelper.go @@ -207,6 +207,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util return nil, errors.Wrap(err, "Error parsing") } return model.BACnetTimeStampEnclosedParse(io, tagNumber) + case "BACnetAccessThreatLevel": + return model.BACnetAccessThreatLevelParse(io) case "BACnetTimerStateTagged": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -498,6 +500,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetLogStatusTaggedParse(io, tagNumber, tagClass) + case "BACnetAssignedAccessRights": + return model.BACnetAssignedAccessRightsParse(io) case "BACnetAbortReasonTagged": actualLength, err := utils.StrToUint32(arguments[0]) if err != nil { @@ -585,6 +589,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetAccessRuleLocationSpecifierTaggedParse(io, tagNumber, tagClass) + case "BACnetAuthenticationFactorFormat": + return model.BACnetAuthenticationFactorFormatParse(io) case "BACnetMaintenanceTagged": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -765,6 +771,12 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util return model.BACnetOptionalREALParse(io) case "BACnetTagPayloadTime": return model.BACnetTagPayloadTimeParse(io) + case "BACnetAuthenticationFactorEnclosed": + tagNumber, err := utils.StrToUint8(arguments[0]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + return model.BACnetAuthenticationFactorEnclosedParse(io, tagNumber) case "BACnetEventSummary": return model.BACnetEventSummaryParse(io) case "BACnetAccessZoneOccupancyStateTagged": @@ -979,6 +991,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetProtocolLevelTaggedParse(io, tagNumber, tagClass) + case "BACnetCredentialAuthenticationFactor": + return model.BACnetCredentialAuthenticationFactorParse(io) case "BACnetPropertyValue": objectTypeArgument := model.BACnetObjectTypeByName(arguments[0]) return model.BACnetPropertyValueParse(io, objectTypeArgument) @@ -1001,6 +1015,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util return nil, errors.Wrap(err, "Error parsing") } return model.SubscribeCOVPropertyMultipleErrorFirstFailedSubscriptionParse(io, tagNumber) + case "BACnetAuthenticationFactor": + return model.BACnetAuthenticationFactorParse(io) case "MaxSegmentsAcceptedTagged": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { diff --git a/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go b/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go index b52264b7a92..7782a7765ab 100644 --- a/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go +++ b/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go @@ -241,6 +241,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser } tagNumber := uint8(parsedUint0) return model.BACnetTimeStampEnclosedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber) + case "BACnetAccessThreatLevel": + return model.BACnetAccessThreatLevelParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetTimerStateTagged": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -571,6 +573,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser tagNumber := uint8(parsedUint0) tagClass := model.TagClassByName(parserArguments[1]) return model.BACnetLogStatusTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) + case "BACnetAssignedAccessRights": + return model.BACnetAssignedAccessRightsParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetAbortReasonTagged": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 32) if err != nil { @@ -670,6 +674,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser tagNumber := uint8(parsedUint0) tagClass := model.TagClassByName(parserArguments[1]) return model.BACnetAccessRuleLocationSpecifierTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) + case "BACnetAuthenticationFactorFormat": + return model.BACnetAuthenticationFactorFormatParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetMaintenanceTagged": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -872,6 +878,13 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser return model.BACnetOptionalREALParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetTagPayloadTime": return model.BACnetTagPayloadTimeParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) + case "BACnetAuthenticationFactorEnclosed": + parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) + if err != nil { + return nil, err + } + tagNumber := uint8(parsedUint0) + return model.BACnetAuthenticationFactorEnclosedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber) case "BACnetEventSummary": return model.BACnetEventSummaryParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetAccessZoneOccupancyStateTagged": @@ -1114,6 +1127,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser tagNumber := uint8(parsedUint0) tagClass := model.TagClassByName(parserArguments[1]) return model.BACnetProtocolLevelTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) + case "BACnetCredentialAuthenticationFactor": + return model.BACnetCredentialAuthenticationFactorParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetPropertyValue": objectTypeArgument := model.BACnetObjectTypeByName(parserArguments[0]) return model.BACnetPropertyValueParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), objectTypeArgument) @@ -1138,6 +1153,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser } tagNumber := uint8(parsedUint0) return model.SubscribeCOVPropertyMultipleErrorFirstFailedSubscriptionParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber) + case "BACnetAuthenticationFactor": + return model.BACnetAuthenticationFactorParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "MaxSegmentsAcceptedTagged": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessThreatLevel.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessThreatLevel.go new file mode 100644 index 00000000000..f770505dd7a --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetAccessThreatLevel.go @@ -0,0 +1,160 @@ +/* + * 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. + +// BACnetAccessThreatLevel is the data-structure of this message +type BACnetAccessThreatLevel struct { + ThreatLevel *BACnetApplicationTagUnsignedInteger +} + +// IBACnetAccessThreatLevel is the corresponding interface of BACnetAccessThreatLevel +type IBACnetAccessThreatLevel interface { + // GetThreatLevel returns ThreatLevel (property field) + GetThreatLevel() *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 property fields. +/////////////////////// + +func (m *BACnetAccessThreatLevel) GetThreatLevel() *BACnetApplicationTagUnsignedInteger { + return m.ThreatLevel +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetAccessThreatLevel factory function for BACnetAccessThreatLevel +func NewBACnetAccessThreatLevel(threatLevel *BACnetApplicationTagUnsignedInteger) *BACnetAccessThreatLevel { + return &BACnetAccessThreatLevel{ThreatLevel: threatLevel} +} + +func CastBACnetAccessThreatLevel(structType interface{}) *BACnetAccessThreatLevel { + if casted, ok := structType.(BACnetAccessThreatLevel); ok { + return &casted + } + if casted, ok := structType.(*BACnetAccessThreatLevel); ok { + return casted + } + return nil +} + +func (m *BACnetAccessThreatLevel) GetTypeName() string { + return "BACnetAccessThreatLevel" +} + +func (m *BACnetAccessThreatLevel) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetAccessThreatLevel) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (threatLevel) + lengthInBits += m.ThreatLevel.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetAccessThreatLevel) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetAccessThreatLevelParse(readBuffer utils.ReadBuffer) (*BACnetAccessThreatLevel, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetAccessThreatLevel"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (threatLevel) + if pullErr := readBuffer.PullContext("threatLevel"); pullErr != nil { + return nil, pullErr + } + _threatLevel, _threatLevelErr := BACnetApplicationTagParse(readBuffer) + if _threatLevelErr != nil { + return nil, errors.Wrap(_threatLevelErr, "Error parsing 'threatLevel' field") + } + threatLevel := CastBACnetApplicationTagUnsignedInteger(_threatLevel) + if closeErr := readBuffer.CloseContext("threatLevel"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetAccessThreatLevel"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetAccessThreatLevel(threatLevel), nil +} + +func (m *BACnetAccessThreatLevel) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetAccessThreatLevel"); pushErr != nil { + return pushErr + } + + // Simple Field (threatLevel) + if pushErr := writeBuffer.PushContext("threatLevel"); pushErr != nil { + return pushErr + } + _threatLevelErr := m.ThreatLevel.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("threatLevel"); popErr != nil { + return popErr + } + if _threatLevelErr != nil { + return errors.Wrap(_threatLevelErr, "Error serializing 'threatLevel' field") + } + + if popErr := writeBuffer.PopContext("BACnetAccessThreatLevel"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetAccessThreatLevel) String() string { + if m == nil { + return "" + } + 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/BACnetAssignedAccessRights.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedAccessRights.go new file mode 100644 index 00000000000..8a6622f8ac5 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetAssignedAccessRights.go @@ -0,0 +1,195 @@ +/* + * 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. + +// BACnetAssignedAccessRights is the data-structure of this message +type BACnetAssignedAccessRights struct { + AssignedAccessRights *BACnetDeviceObjectReferenceEnclosed + Enable *BACnetContextTagBoolean +} + +// IBACnetAssignedAccessRights is the corresponding interface of BACnetAssignedAccessRights +type IBACnetAssignedAccessRights interface { + // GetAssignedAccessRights returns AssignedAccessRights (property field) + GetAssignedAccessRights() *BACnetDeviceObjectReferenceEnclosed + // GetEnable returns Enable (property field) + GetEnable() *BACnetContextTagBoolean + // 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 *BACnetAssignedAccessRights) GetAssignedAccessRights() *BACnetDeviceObjectReferenceEnclosed { + return m.AssignedAccessRights +} + +func (m *BACnetAssignedAccessRights) GetEnable() *BACnetContextTagBoolean { + return m.Enable +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetAssignedAccessRights factory function for BACnetAssignedAccessRights +func NewBACnetAssignedAccessRights(assignedAccessRights *BACnetDeviceObjectReferenceEnclosed, enable *BACnetContextTagBoolean) *BACnetAssignedAccessRights { + return &BACnetAssignedAccessRights{AssignedAccessRights: assignedAccessRights, Enable: enable} +} + +func CastBACnetAssignedAccessRights(structType interface{}) *BACnetAssignedAccessRights { + if casted, ok := structType.(BACnetAssignedAccessRights); ok { + return &casted + } + if casted, ok := structType.(*BACnetAssignedAccessRights); ok { + return casted + } + return nil +} + +func (m *BACnetAssignedAccessRights) GetTypeName() string { + return "BACnetAssignedAccessRights" +} + +func (m *BACnetAssignedAccessRights) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetAssignedAccessRights) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (assignedAccessRights) + lengthInBits += m.AssignedAccessRights.GetLengthInBits() + + // Simple field (enable) + lengthInBits += m.Enable.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetAssignedAccessRights) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetAssignedAccessRightsParse(readBuffer utils.ReadBuffer) (*BACnetAssignedAccessRights, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetAssignedAccessRights"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (assignedAccessRights) + if pullErr := readBuffer.PullContext("assignedAccessRights"); pullErr != nil { + return nil, pullErr + } + _assignedAccessRights, _assignedAccessRightsErr := BACnetDeviceObjectReferenceEnclosedParse(readBuffer, uint8(uint8(0))) + if _assignedAccessRightsErr != nil { + return nil, errors.Wrap(_assignedAccessRightsErr, "Error parsing 'assignedAccessRights' field") + } + assignedAccessRights := CastBACnetDeviceObjectReferenceEnclosed(_assignedAccessRights) + if closeErr := readBuffer.CloseContext("assignedAccessRights"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (enable) + if pullErr := readBuffer.PullContext("enable"); pullErr != nil { + return nil, pullErr + } + _enable, _enableErr := BACnetContextTagParse(readBuffer, uint8(uint8(1)), BACnetDataType(BACnetDataType_BOOLEAN)) + if _enableErr != nil { + return nil, errors.Wrap(_enableErr, "Error parsing 'enable' field") + } + enable := CastBACnetContextTagBoolean(_enable) + if closeErr := readBuffer.CloseContext("enable"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetAssignedAccessRights"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetAssignedAccessRights(assignedAccessRights, enable), nil +} + +func (m *BACnetAssignedAccessRights) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetAssignedAccessRights"); pushErr != nil { + return pushErr + } + + // Simple Field (assignedAccessRights) + if pushErr := writeBuffer.PushContext("assignedAccessRights"); pushErr != nil { + return pushErr + } + _assignedAccessRightsErr := m.AssignedAccessRights.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("assignedAccessRights"); popErr != nil { + return popErr + } + if _assignedAccessRightsErr != nil { + return errors.Wrap(_assignedAccessRightsErr, "Error serializing 'assignedAccessRights' field") + } + + // Simple Field (enable) + if pushErr := writeBuffer.PushContext("enable"); pushErr != nil { + return pushErr + } + _enableErr := m.Enable.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("enable"); popErr != nil { + return popErr + } + if _enableErr != nil { + return errors.Wrap(_enableErr, "Error serializing 'enable' field") + } + + if popErr := writeBuffer.PopContext("BACnetAssignedAccessRights"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetAssignedAccessRights) String() string { + if m == nil { + return "" + } + 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/BACnetAuthenticationFactor.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactor.go new file mode 100644 index 00000000000..acbdb7d0119 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactor.go @@ -0,0 +1,230 @@ +/* + * 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. + +// BACnetAuthenticationFactor is the data-structure of this message +type BACnetAuthenticationFactor struct { + FormatType *BACnetAuthenticationFactorTypeTagged + FormatClass *BACnetContextTagUnsignedInteger + Value *BACnetContextTagOctetString +} + +// IBACnetAuthenticationFactor is the corresponding interface of BACnetAuthenticationFactor +type IBACnetAuthenticationFactor interface { + // GetFormatType returns FormatType (property field) + GetFormatType() *BACnetAuthenticationFactorTypeTagged + // GetFormatClass returns FormatClass (property field) + GetFormatClass() *BACnetContextTagUnsignedInteger + // GetValue returns Value (property field) + GetValue() *BACnetContextTagOctetString + // 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 *BACnetAuthenticationFactor) GetFormatType() *BACnetAuthenticationFactorTypeTagged { + return m.FormatType +} + +func (m *BACnetAuthenticationFactor) GetFormatClass() *BACnetContextTagUnsignedInteger { + return m.FormatClass +} + +func (m *BACnetAuthenticationFactor) GetValue() *BACnetContextTagOctetString { + return m.Value +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetAuthenticationFactor factory function for BACnetAuthenticationFactor +func NewBACnetAuthenticationFactor(formatType *BACnetAuthenticationFactorTypeTagged, formatClass *BACnetContextTagUnsignedInteger, value *BACnetContextTagOctetString) *BACnetAuthenticationFactor { + return &BACnetAuthenticationFactor{FormatType: formatType, FormatClass: formatClass, Value: value} +} + +func CastBACnetAuthenticationFactor(structType interface{}) *BACnetAuthenticationFactor { + if casted, ok := structType.(BACnetAuthenticationFactor); ok { + return &casted + } + if casted, ok := structType.(*BACnetAuthenticationFactor); ok { + return casted + } + return nil +} + +func (m *BACnetAuthenticationFactor) GetTypeName() string { + return "BACnetAuthenticationFactor" +} + +func (m *BACnetAuthenticationFactor) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetAuthenticationFactor) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (formatType) + lengthInBits += m.FormatType.GetLengthInBits() + + // Simple field (formatClass) + lengthInBits += m.FormatClass.GetLengthInBits() + + // Simple field (value) + lengthInBits += m.Value.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetAuthenticationFactor) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetAuthenticationFactorParse(readBuffer utils.ReadBuffer) (*BACnetAuthenticationFactor, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetAuthenticationFactor"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (formatType) + if pullErr := readBuffer.PullContext("formatType"); pullErr != nil { + return nil, pullErr + } + _formatType, _formatTypeErr := BACnetAuthenticationFactorTypeTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_CONTEXT_SPECIFIC_TAGS)) + if _formatTypeErr != nil { + return nil, errors.Wrap(_formatTypeErr, "Error parsing 'formatType' field") + } + formatType := CastBACnetAuthenticationFactorTypeTagged(_formatType) + if closeErr := readBuffer.CloseContext("formatType"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (formatClass) + if pullErr := readBuffer.PullContext("formatClass"); pullErr != nil { + return nil, pullErr + } + _formatClass, _formatClassErr := BACnetContextTagParse(readBuffer, uint8(uint8(1)), BACnetDataType(BACnetDataType_UNSIGNED_INTEGER)) + if _formatClassErr != nil { + return nil, errors.Wrap(_formatClassErr, "Error parsing 'formatClass' field") + } + formatClass := CastBACnetContextTagUnsignedInteger(_formatClass) + if closeErr := readBuffer.CloseContext("formatClass"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (value) + if pullErr := readBuffer.PullContext("value"); pullErr != nil { + return nil, pullErr + } + _value, _valueErr := BACnetContextTagParse(readBuffer, uint8(uint8(2)), BACnetDataType(BACnetDataType_OCTET_STRING)) + if _valueErr != nil { + return nil, errors.Wrap(_valueErr, "Error parsing 'value' field") + } + value := CastBACnetContextTagOctetString(_value) + if closeErr := readBuffer.CloseContext("value"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetAuthenticationFactor"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetAuthenticationFactor(formatType, formatClass, value), nil +} + +func (m *BACnetAuthenticationFactor) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetAuthenticationFactor"); pushErr != nil { + return pushErr + } + + // Simple Field (formatType) + if pushErr := writeBuffer.PushContext("formatType"); pushErr != nil { + return pushErr + } + _formatTypeErr := m.FormatType.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("formatType"); popErr != nil { + return popErr + } + if _formatTypeErr != nil { + return errors.Wrap(_formatTypeErr, "Error serializing 'formatType' field") + } + + // Simple Field (formatClass) + if pushErr := writeBuffer.PushContext("formatClass"); pushErr != nil { + return pushErr + } + _formatClassErr := m.FormatClass.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("formatClass"); popErr != nil { + return popErr + } + if _formatClassErr != nil { + return errors.Wrap(_formatClassErr, "Error serializing 'formatClass' field") + } + + // Simple Field (value) + if pushErr := writeBuffer.PushContext("value"); pushErr != nil { + return pushErr + } + _valueErr := m.Value.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("value"); popErr != nil { + return popErr + } + if _valueErr != nil { + return errors.Wrap(_valueErr, "Error serializing 'value' field") + } + + if popErr := writeBuffer.PopContext("BACnetAuthenticationFactor"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetAuthenticationFactor) String() string { + if m == nil { + return "" + } + 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/BACnetAuthenticationFactorEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorEnclosed.go new file mode 100644 index 00000000000..648d9c4ec7d --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorEnclosed.go @@ -0,0 +1,233 @@ +/* + * 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. + +// BACnetAuthenticationFactorEnclosed is the data-structure of this message +type BACnetAuthenticationFactorEnclosed struct { + OpeningTag *BACnetOpeningTag + AuthenticationFactor *BACnetAuthenticationFactor + ClosingTag *BACnetClosingTag + + // Arguments. + TagNumber uint8 +} + +// IBACnetAuthenticationFactorEnclosed is the corresponding interface of BACnetAuthenticationFactorEnclosed +type IBACnetAuthenticationFactorEnclosed interface { + // GetOpeningTag returns OpeningTag (property field) + GetOpeningTag() *BACnetOpeningTag + // GetAuthenticationFactor returns AuthenticationFactor (property field) + GetAuthenticationFactor() *BACnetAuthenticationFactor + // GetClosingTag returns ClosingTag (property field) + GetClosingTag() *BACnetClosingTag + // 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 *BACnetAuthenticationFactorEnclosed) GetOpeningTag() *BACnetOpeningTag { + return m.OpeningTag +} + +func (m *BACnetAuthenticationFactorEnclosed) GetAuthenticationFactor() *BACnetAuthenticationFactor { + return m.AuthenticationFactor +} + +func (m *BACnetAuthenticationFactorEnclosed) GetClosingTag() *BACnetClosingTag { + return m.ClosingTag +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetAuthenticationFactorEnclosed factory function for BACnetAuthenticationFactorEnclosed +func NewBACnetAuthenticationFactorEnclosed(openingTag *BACnetOpeningTag, authenticationFactor *BACnetAuthenticationFactor, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetAuthenticationFactorEnclosed { + return &BACnetAuthenticationFactorEnclosed{OpeningTag: openingTag, AuthenticationFactor: authenticationFactor, ClosingTag: closingTag, TagNumber: tagNumber} +} + +func CastBACnetAuthenticationFactorEnclosed(structType interface{}) *BACnetAuthenticationFactorEnclosed { + if casted, ok := structType.(BACnetAuthenticationFactorEnclosed); ok { + return &casted + } + if casted, ok := structType.(*BACnetAuthenticationFactorEnclosed); ok { + return casted + } + return nil +} + +func (m *BACnetAuthenticationFactorEnclosed) GetTypeName() string { + return "BACnetAuthenticationFactorEnclosed" +} + +func (m *BACnetAuthenticationFactorEnclosed) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetAuthenticationFactorEnclosed) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (openingTag) + lengthInBits += m.OpeningTag.GetLengthInBits() + + // Simple field (authenticationFactor) + lengthInBits += m.AuthenticationFactor.GetLengthInBits() + + // Simple field (closingTag) + lengthInBits += m.ClosingTag.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetAuthenticationFactorEnclosed) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetAuthenticationFactorEnclosedParse(readBuffer utils.ReadBuffer, tagNumber uint8) (*BACnetAuthenticationFactorEnclosed, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetAuthenticationFactorEnclosed"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (openingTag) + if pullErr := readBuffer.PullContext("openingTag"); pullErr != nil { + return nil, pullErr + } + _openingTag, _openingTagErr := BACnetOpeningTagParse(readBuffer, uint8(tagNumber)) + if _openingTagErr != nil { + return nil, errors.Wrap(_openingTagErr, "Error parsing 'openingTag' field") + } + openingTag := CastBACnetOpeningTag(_openingTag) + if closeErr := readBuffer.CloseContext("openingTag"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (authenticationFactor) + if pullErr := readBuffer.PullContext("authenticationFactor"); pullErr != nil { + return nil, pullErr + } + _authenticationFactor, _authenticationFactorErr := BACnetAuthenticationFactorParse(readBuffer) + if _authenticationFactorErr != nil { + return nil, errors.Wrap(_authenticationFactorErr, "Error parsing 'authenticationFactor' field") + } + authenticationFactor := CastBACnetAuthenticationFactor(_authenticationFactor) + if closeErr := readBuffer.CloseContext("authenticationFactor"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (closingTag) + if pullErr := readBuffer.PullContext("closingTag"); pullErr != nil { + return nil, pullErr + } + _closingTag, _closingTagErr := BACnetClosingTagParse(readBuffer, uint8(tagNumber)) + if _closingTagErr != nil { + return nil, errors.Wrap(_closingTagErr, "Error parsing 'closingTag' field") + } + closingTag := CastBACnetClosingTag(_closingTag) + if closeErr := readBuffer.CloseContext("closingTag"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetAuthenticationFactorEnclosed"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetAuthenticationFactorEnclosed(openingTag, authenticationFactor, closingTag, tagNumber), nil +} + +func (m *BACnetAuthenticationFactorEnclosed) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetAuthenticationFactorEnclosed"); pushErr != nil { + return pushErr + } + + // Simple Field (openingTag) + if pushErr := writeBuffer.PushContext("openingTag"); pushErr != nil { + return pushErr + } + _openingTagErr := m.OpeningTag.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("openingTag"); popErr != nil { + return popErr + } + if _openingTagErr != nil { + return errors.Wrap(_openingTagErr, "Error serializing 'openingTag' field") + } + + // Simple Field (authenticationFactor) + if pushErr := writeBuffer.PushContext("authenticationFactor"); pushErr != nil { + return pushErr + } + _authenticationFactorErr := m.AuthenticationFactor.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("authenticationFactor"); popErr != nil { + return popErr + } + if _authenticationFactorErr != nil { + return errors.Wrap(_authenticationFactorErr, "Error serializing 'authenticationFactor' field") + } + + // Simple Field (closingTag) + if pushErr := writeBuffer.PushContext("closingTag"); pushErr != nil { + return pushErr + } + _closingTagErr := m.ClosingTag.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("closingTag"); popErr != nil { + return popErr + } + if _closingTagErr != nil { + return errors.Wrap(_closingTagErr, "Error serializing 'closingTag' field") + } + + if popErr := writeBuffer.PopContext("BACnetAuthenticationFactorEnclosed"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetAuthenticationFactorEnclosed) String() string { + if m == nil { + return "" + } + 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/BACnetAuthenticationFactorFormat.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorFormat.go new file mode 100644 index 00000000000..a21b91b05f6 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetAuthenticationFactorFormat.go @@ -0,0 +1,259 @@ +/* + * 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" + "io" +) + +// Code generated by code-generation. DO NOT EDIT. + +// BACnetAuthenticationFactorFormat is the data-structure of this message +type BACnetAuthenticationFactorFormat struct { + FormatType *BACnetAuthenticationFactorTypeTagged + VendorId *BACnetVendorIdTagged + VendorFormat *BACnetContextTagUnsignedInteger +} + +// IBACnetAuthenticationFactorFormat is the corresponding interface of BACnetAuthenticationFactorFormat +type IBACnetAuthenticationFactorFormat interface { + // GetFormatType returns FormatType (property field) + GetFormatType() *BACnetAuthenticationFactorTypeTagged + // GetVendorId returns VendorId (property field) + GetVendorId() *BACnetVendorIdTagged + // GetVendorFormat returns VendorFormat (property field) + GetVendorFormat() *BACnetContextTagUnsignedInteger + // 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 *BACnetAuthenticationFactorFormat) GetFormatType() *BACnetAuthenticationFactorTypeTagged { + return m.FormatType +} + +func (m *BACnetAuthenticationFactorFormat) GetVendorId() *BACnetVendorIdTagged { + return m.VendorId +} + +func (m *BACnetAuthenticationFactorFormat) GetVendorFormat() *BACnetContextTagUnsignedInteger { + return m.VendorFormat +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetAuthenticationFactorFormat factory function for BACnetAuthenticationFactorFormat +func NewBACnetAuthenticationFactorFormat(formatType *BACnetAuthenticationFactorTypeTagged, vendorId *BACnetVendorIdTagged, vendorFormat *BACnetContextTagUnsignedInteger) *BACnetAuthenticationFactorFormat { + return &BACnetAuthenticationFactorFormat{FormatType: formatType, VendorId: vendorId, VendorFormat: vendorFormat} +} + +func CastBACnetAuthenticationFactorFormat(structType interface{}) *BACnetAuthenticationFactorFormat { + if casted, ok := structType.(BACnetAuthenticationFactorFormat); ok { + return &casted + } + if casted, ok := structType.(*BACnetAuthenticationFactorFormat); ok { + return casted + } + return nil +} + +func (m *BACnetAuthenticationFactorFormat) GetTypeName() string { + return "BACnetAuthenticationFactorFormat" +} + +func (m *BACnetAuthenticationFactorFormat) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetAuthenticationFactorFormat) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (formatType) + lengthInBits += m.FormatType.GetLengthInBits() + + // Optional Field (vendorId) + if m.VendorId != nil { + lengthInBits += (*m.VendorId).GetLengthInBits() + } + + // Optional Field (vendorFormat) + if m.VendorFormat != nil { + lengthInBits += (*m.VendorFormat).GetLengthInBits() + } + + return lengthInBits +} + +func (m *BACnetAuthenticationFactorFormat) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetAuthenticationFactorFormatParse(readBuffer utils.ReadBuffer) (*BACnetAuthenticationFactorFormat, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetAuthenticationFactorFormat"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (formatType) + if pullErr := readBuffer.PullContext("formatType"); pullErr != nil { + return nil, pullErr + } + _formatType, _formatTypeErr := BACnetAuthenticationFactorTypeTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_CONTEXT_SPECIFIC_TAGS)) + if _formatTypeErr != nil { + return nil, errors.Wrap(_formatTypeErr, "Error parsing 'formatType' field") + } + formatType := CastBACnetAuthenticationFactorTypeTagged(_formatType) + if closeErr := readBuffer.CloseContext("formatType"); closeErr != nil { + return nil, closeErr + } + + // Optional Field (vendorId) (Can be skipped, if a given expression evaluates to false) + var vendorId *BACnetVendorIdTagged = nil + { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("vendorId"); pullErr != nil { + return nil, pullErr + } + _val, _err := BACnetVendorIdTaggedParse(readBuffer, uint8(1), TagClass_CONTEXT_SPECIFIC_TAGS) + switch { + case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): + readBuffer.Reset(currentPos) + case _err != nil: + return nil, errors.Wrap(_err, "Error parsing 'vendorId' field") + default: + vendorId = CastBACnetVendorIdTagged(_val) + if closeErr := readBuffer.CloseContext("vendorId"); closeErr != nil { + return nil, closeErr + } + } + } + + // Optional Field (vendorFormat) (Can be skipped, if a given expression evaluates to false) + var vendorFormat *BACnetContextTagUnsignedInteger = nil + { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("vendorFormat"); pullErr != nil { + return nil, pullErr + } + _val, _err := BACnetContextTagParse(readBuffer, uint8(2), BACnetDataType_UNSIGNED_INTEGER) + switch { + case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): + readBuffer.Reset(currentPos) + case _err != nil: + return nil, errors.Wrap(_err, "Error parsing 'vendorFormat' field") + default: + vendorFormat = CastBACnetContextTagUnsignedInteger(_val) + if closeErr := readBuffer.CloseContext("vendorFormat"); closeErr != nil { + return nil, closeErr + } + } + } + + if closeErr := readBuffer.CloseContext("BACnetAuthenticationFactorFormat"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetAuthenticationFactorFormat(formatType, vendorId, vendorFormat), nil +} + +func (m *BACnetAuthenticationFactorFormat) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetAuthenticationFactorFormat"); pushErr != nil { + return pushErr + } + + // Simple Field (formatType) + if pushErr := writeBuffer.PushContext("formatType"); pushErr != nil { + return pushErr + } + _formatTypeErr := m.FormatType.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("formatType"); popErr != nil { + return popErr + } + if _formatTypeErr != nil { + return errors.Wrap(_formatTypeErr, "Error serializing 'formatType' field") + } + + // Optional Field (vendorId) (Can be skipped, if the value is null) + var vendorId *BACnetVendorIdTagged = nil + if m.VendorId != nil { + if pushErr := writeBuffer.PushContext("vendorId"); pushErr != nil { + return pushErr + } + vendorId = m.VendorId + _vendorIdErr := vendorId.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("vendorId"); popErr != nil { + return popErr + } + if _vendorIdErr != nil { + return errors.Wrap(_vendorIdErr, "Error serializing 'vendorId' field") + } + } + + // Optional Field (vendorFormat) (Can be skipped, if the value is null) + var vendorFormat *BACnetContextTagUnsignedInteger = nil + if m.VendorFormat != nil { + if pushErr := writeBuffer.PushContext("vendorFormat"); pushErr != nil { + return pushErr + } + vendorFormat = m.VendorFormat + _vendorFormatErr := vendorFormat.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("vendorFormat"); popErr != nil { + return popErr + } + if _vendorFormatErr != nil { + return errors.Wrap(_vendorFormatErr, "Error serializing 'vendorFormat' field") + } + } + + if popErr := writeBuffer.PopContext("BACnetAuthenticationFactorFormat"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetAuthenticationFactorFormat) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go index 7067be52aa9..8f0fa9a7824 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go @@ -162,6 +162,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob var _child BACnetConstructedDataChild var typeSwitchError error switch { + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ABSENTEE_LIMIT: // BACnetConstructedDataAbsenteeLimit + _child, typeSwitchError = BACnetConstructedDataAbsenteeLimitParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACCEPTED_MODES: // BACnetConstructedDataAcceptedModes _child, typeSwitchError = BACnetConstructedDataAcceptedModesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACKED_TRANSITIONS: // BACnetConstructedDataAckedTransitions @@ -170,6 +172,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataLoopActionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTION: // BACnetConstructedDataAction _child, typeSwitchError = BACnetConstructedDataActionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTIVATION_TIME: // BACnetConstructedDataActivationTime + _child, typeSwitchError = BACnetConstructedDataActivationTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case objectTypeArgument == BACnetObjectType_LIFE_SAFETY_POINT && propertyIdentifierArgument == BACnetPropertyIdentifier_ALARM_VALUES: // BACnetConstructedDataLifeSafetyPointAlarmValues _child, typeSwitchError = BACnetConstructedDataLifeSafetyPointAlarmValuesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case objectTypeArgument == BACnetObjectType_ACCESS_CREDENTIAL && propertyIdentifierArgument == BACnetPropertyIdentifier_ALL: // BACnetConstructedDataAccessCredentialAl @@ -292,8 +296,16 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataTrendLogAllParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case objectTypeArgument == BACnetObjectType_TREND_LOG_MULTIPLE && propertyIdentifierArgument == BACnetPropertyIdentifier_ALL: // BACnetConstructedDataTrendLogMultipleAll _child, typeSwitchError = BACnetConstructedDataTrendLogMultipleAllParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ASSIGNED_ACCESS_RIGHTS: // BACnetConstructedDataAssignedAccessRights + _child, typeSwitchError = BACnetConstructedDataAssignedAccessRightsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_AUTHENTICATION_FACTORS: // BACnetConstructedDataAuthenticationFactors + _child, typeSwitchError = BACnetConstructedDataAuthenticationFactorsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_AUTHORIZATION_EXEMPTIONS: // BACnetConstructedDataAuthorizationExemptions + _child, typeSwitchError = BACnetConstructedDataAuthorizationExemptionsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_BBMD_ACCEPT_FD_REGISTRATIONS: // BACnetConstructedDataBBMDAcceptFDRegistrations _child, typeSwitchError = BACnetConstructedDataBBMDAcceptFDRegistrationsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_BELONGS_TO: // BACnetConstructedDataBelongsTo + _child, typeSwitchError = BACnetConstructedDataBelongsToParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CAR_LOAD_UNITS: // BACnetConstructedDataCarLoadUnits _child, typeSwitchError = BACnetConstructedDataCarLoadUnitsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CONTROLLED_VARIABLE_UNITS: // BACnetConstructedDataControlledVariableUnits @@ -302,6 +314,12 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataControlledVariableValueParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_COV_INCREMENT: // BACnetConstructedDataCOVIncrement _child, typeSwitchError = BACnetConstructedDataCOVIncrementParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CREDENTIAL_DISABLE: // BACnetConstructedDataCredentialDisable + _child, typeSwitchError = BACnetConstructedDataCredentialDisableParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CREDENTIAL_STATUS: // BACnetConstructedDataCredentialStatus + _child, typeSwitchError = BACnetConstructedDataCredentialStatusParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DAYS_REMAINING: // BACnetConstructedDataDaysRemaining + _child, typeSwitchError = BACnetConstructedDataDaysRemainingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DEADBAND: // BACnetConstructedDataDeadband _child, typeSwitchError = BACnetConstructedDataDeadbandParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DERIVATIVE_CONSTANT_UNITS: // BACnetConstructedDataDerivativeConstantUnits @@ -326,6 +344,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataEventStateParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_EVENT_TIME_STAMPS: // BACnetConstructedDataEventTimestamps _child, typeSwitchError = BACnetConstructedDataEventTimestampsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_EXTENDED_TIME_ENABLE: // BACnetConstructedDataExtendedTimeEnable + _child, typeSwitchError = BACnetConstructedDataExtendedTimeEnableParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_FAULT_HIGH_LIMIT: // BACnetConstructedDataFaultHighLimit _child, typeSwitchError = BACnetConstructedDataFaultHighLimitParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_FAULT_LOW_LIMIT: // BACnetConstructedDataFaultLowLimit @@ -344,6 +364,12 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataIPDHCPLeaseTimeRemainingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_IPV6_DHCP_LEASE_TIME_REMAINING: // BACnetConstructedDataIPv6DHCPLeaseTimeRemaining _child, typeSwitchError = BACnetConstructedDataIPv6DHCPLeaseTimeRemainingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_ACCESS_EVENT: // BACnetConstructedDataLastAccessEvent + _child, typeSwitchError = BACnetConstructedDataLastAccessEventParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_ACCESS_POINT: // BACnetConstructedDataLastAccessPoint + _child, typeSwitchError = BACnetConstructedDataLastAccessPointParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_USE_TIME: // BACnetConstructedDataLastUseTime + _child, typeSwitchError = BACnetConstructedDataLastUseTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LIFE_SAFETY_ALARM_VALUES: // BACnetConstructedDataLifeSafetyAlarmValues _child, typeSwitchError = BACnetConstructedDataLifeSafetyAlarmValuesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LIMIT_ENABLE: // BACnetConstructedDataLimitEnable @@ -396,6 +422,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataPropertyListParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PROPORTIONAL_CONSTANT_UNITS: // BACnetConstructedDataProportionalConstantUnits _child, typeSwitchError = BACnetConstructedDataProportionalConstantUnitsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_REASON_FOR_DISABLE: // BACnetConstructedDataReasonForDisable + _child, typeSwitchError = BACnetConstructedDataReasonForDisableParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_RELIABILITY: // BACnetConstructedDataReliability _child, typeSwitchError = BACnetConstructedDataReliabilityParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_RELIABILITY_EVALUATION_INHIBIT: // BACnetConstructedDataReliabilityEvaluationInhibit @@ -410,14 +438,20 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataSubordinateListParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TAGS: // BACnetConstructedDataTags _child, typeSwitchError = BACnetConstructedDataTagsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_THREAT_AUTHORITY: // BACnetConstructedDataThreatAuthority + _child, typeSwitchError = BACnetConstructedDataThreatAuthorityParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TIME_DELAY: // BACnetConstructedDataTimeDelay _child, typeSwitchError = BACnetConstructedDataTimeDelayParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TIME_DELAY_NORMAL: // BACnetConstructedDataTimeDelayNormal _child, typeSwitchError = BACnetConstructedDataTimeDelayNormalParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TRACE_FLAG: // BACnetConstructedDataTraceFlag + _child, typeSwitchError = BACnetConstructedDataTraceFlagParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_UNITS: // BACnetConstructedDataUnits _child, typeSwitchError = BACnetConstructedDataUnitsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_UPDATE_INTERVAL: // BACnetConstructedDataUpdateInterval _child, typeSwitchError = BACnetConstructedDataUpdateIntervalParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_USES_REMAINING: // BACnetConstructedDataUsesRemaining + _child, typeSwitchError = BACnetConstructedDataUsesRemainingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ZONE_MEMBERS: // BACnetConstructedDataZoneMembers _child, typeSwitchError = BACnetConstructedDataZoneMembersParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true: // BACnetConstructedDataUnspecified diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAbsenteeLimit.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAbsenteeLimit.go new file mode 100644 index 00000000000..ad82a38fb95 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAbsenteeLimit.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. + +// BACnetConstructedDataAbsenteeLimit is the data-structure of this message +type BACnetConstructedDataAbsenteeLimit struct { + *BACnetConstructedData + AbsenteeLimit *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataAbsenteeLimit is the corresponding interface of BACnetConstructedDataAbsenteeLimit +type IBACnetConstructedDataAbsenteeLimit interface { + IBACnetConstructedData + // GetAbsenteeLimit returns AbsenteeLimit (property field) + GetAbsenteeLimit() *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 *BACnetConstructedDataAbsenteeLimit) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataAbsenteeLimit) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_ABSENTEE_LIMIT +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataAbsenteeLimit) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataAbsenteeLimit) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataAbsenteeLimit) GetAbsenteeLimit() *BACnetApplicationTagUnsignedInteger { + return m.AbsenteeLimit +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataAbsenteeLimit factory function for BACnetConstructedDataAbsenteeLimit +func NewBACnetConstructedDataAbsenteeLimit(absenteeLimit *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataAbsenteeLimit { + _result := &BACnetConstructedDataAbsenteeLimit{ + AbsenteeLimit: absenteeLimit, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataAbsenteeLimit(structType interface{}) *BACnetConstructedDataAbsenteeLimit { + if casted, ok := structType.(BACnetConstructedDataAbsenteeLimit); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataAbsenteeLimit); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataAbsenteeLimit(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataAbsenteeLimit(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataAbsenteeLimit) GetTypeName() string { + return "BACnetConstructedDataAbsenteeLimit" +} + +func (m *BACnetConstructedDataAbsenteeLimit) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataAbsenteeLimit) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (absenteeLimit) + lengthInBits += m.AbsenteeLimit.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataAbsenteeLimit) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataAbsenteeLimitParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataAbsenteeLimit, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataAbsenteeLimit"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (absenteeLimit) + if pullErr := readBuffer.PullContext("absenteeLimit"); pullErr != nil { + return nil, pullErr + } + _absenteeLimit, _absenteeLimitErr := BACnetApplicationTagParse(readBuffer) + if _absenteeLimitErr != nil { + return nil, errors.Wrap(_absenteeLimitErr, "Error parsing 'absenteeLimit' field") + } + absenteeLimit := CastBACnetApplicationTagUnsignedInteger(_absenteeLimit) + if closeErr := readBuffer.CloseContext("absenteeLimit"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataAbsenteeLimit"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataAbsenteeLimit{ + AbsenteeLimit: CastBACnetApplicationTagUnsignedInteger(absenteeLimit), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataAbsenteeLimit) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataAbsenteeLimit"); pushErr != nil { + return pushErr + } + + // Simple Field (absenteeLimit) + if pushErr := writeBuffer.PushContext("absenteeLimit"); pushErr != nil { + return pushErr + } + _absenteeLimitErr := m.AbsenteeLimit.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("absenteeLimit"); popErr != nil { + return popErr + } + if _absenteeLimitErr != nil { + return errors.Wrap(_absenteeLimitErr, "Error serializing 'absenteeLimit' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataAbsenteeLimit"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataAbsenteeLimit) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataActivationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActivationTime.go new file mode 100644 index 00000000000..b87882a7817 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActivationTime.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. + +// BACnetConstructedDataActivationTime is the data-structure of this message +type BACnetConstructedDataActivationTime struct { + *BACnetConstructedData + ActivationTime *BACnetDateTime + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataActivationTime is the corresponding interface of BACnetConstructedDataActivationTime +type IBACnetConstructedDataActivationTime interface { + IBACnetConstructedData + // GetActivationTime returns ActivationTime (property field) + GetActivationTime() *BACnetDateTime + // 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 *BACnetConstructedDataActivationTime) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataActivationTime) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_ACTIVATION_TIME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataActivationTime) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataActivationTime) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataActivationTime) GetActivationTime() *BACnetDateTime { + return m.ActivationTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataActivationTime factory function for BACnetConstructedDataActivationTime +func NewBACnetConstructedDataActivationTime(activationTime *BACnetDateTime, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataActivationTime { + _result := &BACnetConstructedDataActivationTime{ + ActivationTime: activationTime, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataActivationTime(structType interface{}) *BACnetConstructedDataActivationTime { + if casted, ok := structType.(BACnetConstructedDataActivationTime); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataActivationTime); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataActivationTime(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataActivationTime(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataActivationTime) GetTypeName() string { + return "BACnetConstructedDataActivationTime" +} + +func (m *BACnetConstructedDataActivationTime) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataActivationTime) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (activationTime) + lengthInBits += m.ActivationTime.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataActivationTime) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataActivationTimeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataActivationTime, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataActivationTime"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (activationTime) + if pullErr := readBuffer.PullContext("activationTime"); pullErr != nil { + return nil, pullErr + } + _activationTime, _activationTimeErr := BACnetDateTimeParse(readBuffer) + if _activationTimeErr != nil { + return nil, errors.Wrap(_activationTimeErr, "Error parsing 'activationTime' field") + } + activationTime := CastBACnetDateTime(_activationTime) + if closeErr := readBuffer.CloseContext("activationTime"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataActivationTime"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataActivationTime{ + ActivationTime: CastBACnetDateTime(activationTime), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataActivationTime) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataActivationTime"); pushErr != nil { + return pushErr + } + + // Simple Field (activationTime) + if pushErr := writeBuffer.PushContext("activationTime"); pushErr != nil { + return pushErr + } + _activationTimeErr := m.ActivationTime.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("activationTime"); popErr != nil { + return popErr + } + if _activationTimeErr != nil { + return errors.Wrap(_activationTimeErr, "Error serializing 'activationTime' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataActivationTime"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataActivationTime) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataAssignedAccessRights.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAssignedAccessRights.go new file mode 100644 index 00000000000..57955e2ce26 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAssignedAccessRights.go @@ -0,0 +1,226 @@ +/* + * 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. + +// BACnetConstructedDataAssignedAccessRights is the data-structure of this message +type BACnetConstructedDataAssignedAccessRights struct { + *BACnetConstructedData + AssignedAccessRights []*BACnetAssignedAccessRights + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataAssignedAccessRights is the corresponding interface of BACnetConstructedDataAssignedAccessRights +type IBACnetConstructedDataAssignedAccessRights interface { + IBACnetConstructedData + // GetAssignedAccessRights returns AssignedAccessRights (property field) + GetAssignedAccessRights() []*BACnetAssignedAccessRights + // 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 *BACnetConstructedDataAssignedAccessRights) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataAssignedAccessRights) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_ASSIGNED_ACCESS_RIGHTS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataAssignedAccessRights) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataAssignedAccessRights) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataAssignedAccessRights) GetAssignedAccessRights() []*BACnetAssignedAccessRights { + return m.AssignedAccessRights +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataAssignedAccessRights factory function for BACnetConstructedDataAssignedAccessRights +func NewBACnetConstructedDataAssignedAccessRights(assignedAccessRights []*BACnetAssignedAccessRights, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataAssignedAccessRights { + _result := &BACnetConstructedDataAssignedAccessRights{ + AssignedAccessRights: assignedAccessRights, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataAssignedAccessRights(structType interface{}) *BACnetConstructedDataAssignedAccessRights { + if casted, ok := structType.(BACnetConstructedDataAssignedAccessRights); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataAssignedAccessRights); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataAssignedAccessRights(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataAssignedAccessRights(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataAssignedAccessRights) GetTypeName() string { + return "BACnetConstructedDataAssignedAccessRights" +} + +func (m *BACnetConstructedDataAssignedAccessRights) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataAssignedAccessRights) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.AssignedAccessRights) > 0 { + for _, element := range m.AssignedAccessRights { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataAssignedAccessRights) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataAssignedAccessRightsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataAssignedAccessRights, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataAssignedAccessRights"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (assignedAccessRights) + if pullErr := readBuffer.PullContext("assignedAccessRights", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + assignedAccessRights := make([]*BACnetAssignedAccessRights, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetAssignedAccessRightsParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'assignedAccessRights' field") + } + assignedAccessRights = append(assignedAccessRights, CastBACnetAssignedAccessRights(_item)) + + } + } + if closeErr := readBuffer.CloseContext("assignedAccessRights", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataAssignedAccessRights"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataAssignedAccessRights{ + AssignedAccessRights: assignedAccessRights, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataAssignedAccessRights) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataAssignedAccessRights"); pushErr != nil { + return pushErr + } + + // Array Field (assignedAccessRights) + if m.AssignedAccessRights != nil { + if pushErr := writeBuffer.PushContext("assignedAccessRights", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.AssignedAccessRights { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'assignedAccessRights' field") + } + } + if popErr := writeBuffer.PopContext("assignedAccessRights", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataAssignedAccessRights"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataAssignedAccessRights) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataAuthenticationFactors.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationFactors.go new file mode 100644 index 00000000000..9893f2bfccf --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthenticationFactors.go @@ -0,0 +1,226 @@ +/* + * 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. + +// BACnetConstructedDataAuthenticationFactors is the data-structure of this message +type BACnetConstructedDataAuthenticationFactors struct { + *BACnetConstructedData + AuthenticationFactors []*BACnetCredentialAuthenticationFactor + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataAuthenticationFactors is the corresponding interface of BACnetConstructedDataAuthenticationFactors +type IBACnetConstructedDataAuthenticationFactors interface { + IBACnetConstructedData + // GetAuthenticationFactors returns AuthenticationFactors (property field) + GetAuthenticationFactors() []*BACnetCredentialAuthenticationFactor + // 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 *BACnetConstructedDataAuthenticationFactors) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataAuthenticationFactors) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_AUTHENTICATION_FACTORS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataAuthenticationFactors) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataAuthenticationFactors) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataAuthenticationFactors) GetAuthenticationFactors() []*BACnetCredentialAuthenticationFactor { + return m.AuthenticationFactors +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataAuthenticationFactors factory function for BACnetConstructedDataAuthenticationFactors +func NewBACnetConstructedDataAuthenticationFactors(authenticationFactors []*BACnetCredentialAuthenticationFactor, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataAuthenticationFactors { + _result := &BACnetConstructedDataAuthenticationFactors{ + AuthenticationFactors: authenticationFactors, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataAuthenticationFactors(structType interface{}) *BACnetConstructedDataAuthenticationFactors { + if casted, ok := structType.(BACnetConstructedDataAuthenticationFactors); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataAuthenticationFactors); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataAuthenticationFactors(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataAuthenticationFactors(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataAuthenticationFactors) GetTypeName() string { + return "BACnetConstructedDataAuthenticationFactors" +} + +func (m *BACnetConstructedDataAuthenticationFactors) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataAuthenticationFactors) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.AuthenticationFactors) > 0 { + for _, element := range m.AuthenticationFactors { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataAuthenticationFactors) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataAuthenticationFactorsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataAuthenticationFactors, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataAuthenticationFactors"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (authenticationFactors) + if pullErr := readBuffer.PullContext("authenticationFactors", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + authenticationFactors := make([]*BACnetCredentialAuthenticationFactor, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetCredentialAuthenticationFactorParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'authenticationFactors' field") + } + authenticationFactors = append(authenticationFactors, CastBACnetCredentialAuthenticationFactor(_item)) + + } + } + if closeErr := readBuffer.CloseContext("authenticationFactors", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataAuthenticationFactors"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataAuthenticationFactors{ + AuthenticationFactors: authenticationFactors, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataAuthenticationFactors) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataAuthenticationFactors"); pushErr != nil { + return pushErr + } + + // Array Field (authenticationFactors) + if m.AuthenticationFactors != nil { + if pushErr := writeBuffer.PushContext("authenticationFactors", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.AuthenticationFactors { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'authenticationFactors' field") + } + } + if popErr := writeBuffer.PopContext("authenticationFactors", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataAuthenticationFactors"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataAuthenticationFactors) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataAuthorizationExemptions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthorizationExemptions.go new file mode 100644 index 00000000000..453f2e415e7 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAuthorizationExemptions.go @@ -0,0 +1,226 @@ +/* + * 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. + +// BACnetConstructedDataAuthorizationExemptions is the data-structure of this message +type BACnetConstructedDataAuthorizationExemptions struct { + *BACnetConstructedData + AuthorizationExemption []*BACnetAuthorizationExemptionTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataAuthorizationExemptions is the corresponding interface of BACnetConstructedDataAuthorizationExemptions +type IBACnetConstructedDataAuthorizationExemptions interface { + IBACnetConstructedData + // GetAuthorizationExemption returns AuthorizationExemption (property field) + GetAuthorizationExemption() []*BACnetAuthorizationExemptionTagged + // 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 *BACnetConstructedDataAuthorizationExemptions) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataAuthorizationExemptions) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_AUTHORIZATION_EXEMPTIONS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataAuthorizationExemptions) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataAuthorizationExemptions) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataAuthorizationExemptions) GetAuthorizationExemption() []*BACnetAuthorizationExemptionTagged { + return m.AuthorizationExemption +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataAuthorizationExemptions factory function for BACnetConstructedDataAuthorizationExemptions +func NewBACnetConstructedDataAuthorizationExemptions(authorizationExemption []*BACnetAuthorizationExemptionTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataAuthorizationExemptions { + _result := &BACnetConstructedDataAuthorizationExemptions{ + AuthorizationExemption: authorizationExemption, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataAuthorizationExemptions(structType interface{}) *BACnetConstructedDataAuthorizationExemptions { + if casted, ok := structType.(BACnetConstructedDataAuthorizationExemptions); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataAuthorizationExemptions); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataAuthorizationExemptions(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataAuthorizationExemptions(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataAuthorizationExemptions) GetTypeName() string { + return "BACnetConstructedDataAuthorizationExemptions" +} + +func (m *BACnetConstructedDataAuthorizationExemptions) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataAuthorizationExemptions) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.AuthorizationExemption) > 0 { + for _, element := range m.AuthorizationExemption { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataAuthorizationExemptions) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataAuthorizationExemptionsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataAuthorizationExemptions, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataAuthorizationExemptions"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (authorizationExemption) + if pullErr := readBuffer.PullContext("authorizationExemption", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + authorizationExemption := make([]*BACnetAuthorizationExemptionTagged, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetAuthorizationExemptionTaggedParse(readBuffer, uint8(0), TagClass_APPLICATION_TAGS) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'authorizationExemption' field") + } + authorizationExemption = append(authorizationExemption, CastBACnetAuthorizationExemptionTagged(_item)) + + } + } + if closeErr := readBuffer.CloseContext("authorizationExemption", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataAuthorizationExemptions"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataAuthorizationExemptions{ + AuthorizationExemption: authorizationExemption, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataAuthorizationExemptions) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataAuthorizationExemptions"); pushErr != nil { + return pushErr + } + + // Array Field (authorizationExemption) + if m.AuthorizationExemption != nil { + if pushErr := writeBuffer.PushContext("authorizationExemption", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.AuthorizationExemption { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'authorizationExemption' field") + } + } + if popErr := writeBuffer.PopContext("authorizationExemption", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataAuthorizationExemptions"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataAuthorizationExemptions) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataBelongsTo.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBelongsTo.go new file mode 100644 index 00000000000..eedce5bfac8 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBelongsTo.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. + +// BACnetConstructedDataBelongsTo is the data-structure of this message +type BACnetConstructedDataBelongsTo struct { + *BACnetConstructedData + BelongsTo *BACnetDeviceObjectReference + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataBelongsTo is the corresponding interface of BACnetConstructedDataBelongsTo +type IBACnetConstructedDataBelongsTo interface { + IBACnetConstructedData + // GetBelongsTo returns BelongsTo (property field) + GetBelongsTo() *BACnetDeviceObjectReference + // 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 *BACnetConstructedDataBelongsTo) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataBelongsTo) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_BELONGS_TO +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataBelongsTo) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataBelongsTo) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataBelongsTo) GetBelongsTo() *BACnetDeviceObjectReference { + return m.BelongsTo +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataBelongsTo factory function for BACnetConstructedDataBelongsTo +func NewBACnetConstructedDataBelongsTo(belongsTo *BACnetDeviceObjectReference, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataBelongsTo { + _result := &BACnetConstructedDataBelongsTo{ + BelongsTo: belongsTo, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataBelongsTo(structType interface{}) *BACnetConstructedDataBelongsTo { + if casted, ok := structType.(BACnetConstructedDataBelongsTo); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataBelongsTo); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataBelongsTo(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataBelongsTo(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataBelongsTo) GetTypeName() string { + return "BACnetConstructedDataBelongsTo" +} + +func (m *BACnetConstructedDataBelongsTo) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataBelongsTo) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (belongsTo) + lengthInBits += m.BelongsTo.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataBelongsTo) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataBelongsToParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataBelongsTo, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataBelongsTo"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (belongsTo) + if pullErr := readBuffer.PullContext("belongsTo"); pullErr != nil { + return nil, pullErr + } + _belongsTo, _belongsToErr := BACnetDeviceObjectReferenceParse(readBuffer) + if _belongsToErr != nil { + return nil, errors.Wrap(_belongsToErr, "Error parsing 'belongsTo' field") + } + belongsTo := CastBACnetDeviceObjectReference(_belongsTo) + if closeErr := readBuffer.CloseContext("belongsTo"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataBelongsTo"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataBelongsTo{ + BelongsTo: CastBACnetDeviceObjectReference(belongsTo), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataBelongsTo) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataBelongsTo"); pushErr != nil { + return pushErr + } + + // Simple Field (belongsTo) + if pushErr := writeBuffer.PushContext("belongsTo"); pushErr != nil { + return pushErr + } + _belongsToErr := m.BelongsTo.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("belongsTo"); popErr != nil { + return popErr + } + if _belongsToErr != nil { + return errors.Wrap(_belongsToErr, "Error serializing 'belongsTo' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataBelongsTo"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataBelongsTo) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataCredentialDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDisable.go new file mode 100644 index 00000000000..5bfb5be6511 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialDisable.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. + +// BACnetConstructedDataCredentialDisable is the data-structure of this message +type BACnetConstructedDataCredentialDisable struct { + *BACnetConstructedData + CredentialDisable *BACnetAccessCredentialDisableTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataCredentialDisable is the corresponding interface of BACnetConstructedDataCredentialDisable +type IBACnetConstructedDataCredentialDisable interface { + IBACnetConstructedData + // GetCredentialDisable returns CredentialDisable (property field) + GetCredentialDisable() *BACnetAccessCredentialDisableTagged + // 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 *BACnetConstructedDataCredentialDisable) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataCredentialDisable) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_CREDENTIAL_DISABLE +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataCredentialDisable) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataCredentialDisable) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataCredentialDisable) GetCredentialDisable() *BACnetAccessCredentialDisableTagged { + return m.CredentialDisable +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataCredentialDisable factory function for BACnetConstructedDataCredentialDisable +func NewBACnetConstructedDataCredentialDisable(credentialDisable *BACnetAccessCredentialDisableTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataCredentialDisable { + _result := &BACnetConstructedDataCredentialDisable{ + CredentialDisable: credentialDisable, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataCredentialDisable(structType interface{}) *BACnetConstructedDataCredentialDisable { + if casted, ok := structType.(BACnetConstructedDataCredentialDisable); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataCredentialDisable); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataCredentialDisable(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataCredentialDisable(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataCredentialDisable) GetTypeName() string { + return "BACnetConstructedDataCredentialDisable" +} + +func (m *BACnetConstructedDataCredentialDisable) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataCredentialDisable) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (credentialDisable) + lengthInBits += m.CredentialDisable.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataCredentialDisable) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataCredentialDisableParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataCredentialDisable, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataCredentialDisable"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (credentialDisable) + if pullErr := readBuffer.PullContext("credentialDisable"); pullErr != nil { + return nil, pullErr + } + _credentialDisable, _credentialDisableErr := BACnetAccessCredentialDisableTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _credentialDisableErr != nil { + return nil, errors.Wrap(_credentialDisableErr, "Error parsing 'credentialDisable' field") + } + credentialDisable := CastBACnetAccessCredentialDisableTagged(_credentialDisable) + if closeErr := readBuffer.CloseContext("credentialDisable"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataCredentialDisable"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataCredentialDisable{ + CredentialDisable: CastBACnetAccessCredentialDisableTagged(credentialDisable), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataCredentialDisable) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataCredentialDisable"); pushErr != nil { + return pushErr + } + + // Simple Field (credentialDisable) + if pushErr := writeBuffer.PushContext("credentialDisable"); pushErr != nil { + return pushErr + } + _credentialDisableErr := m.CredentialDisable.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("credentialDisable"); popErr != nil { + return popErr + } + if _credentialDisableErr != nil { + return errors.Wrap(_credentialDisableErr, "Error serializing 'credentialDisable' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataCredentialDisable"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataCredentialDisable) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataCredentialStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialStatus.go new file mode 100644 index 00000000000..ea0ea266076 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataCredentialStatus.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. + +// BACnetConstructedDataCredentialStatus is the data-structure of this message +type BACnetConstructedDataCredentialStatus struct { + *BACnetConstructedData + BinaryPv *BACnetBinaryPVTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataCredentialStatus is the corresponding interface of BACnetConstructedDataCredentialStatus +type IBACnetConstructedDataCredentialStatus interface { + IBACnetConstructedData + // GetBinaryPv returns BinaryPv (property field) + GetBinaryPv() *BACnetBinaryPVTagged + // 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 *BACnetConstructedDataCredentialStatus) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataCredentialStatus) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_CREDENTIAL_STATUS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataCredentialStatus) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataCredentialStatus) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataCredentialStatus) GetBinaryPv() *BACnetBinaryPVTagged { + return m.BinaryPv +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataCredentialStatus factory function for BACnetConstructedDataCredentialStatus +func NewBACnetConstructedDataCredentialStatus(binaryPv *BACnetBinaryPVTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataCredentialStatus { + _result := &BACnetConstructedDataCredentialStatus{ + BinaryPv: binaryPv, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataCredentialStatus(structType interface{}) *BACnetConstructedDataCredentialStatus { + if casted, ok := structType.(BACnetConstructedDataCredentialStatus); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataCredentialStatus); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataCredentialStatus(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataCredentialStatus(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataCredentialStatus) GetTypeName() string { + return "BACnetConstructedDataCredentialStatus" +} + +func (m *BACnetConstructedDataCredentialStatus) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataCredentialStatus) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (binaryPv) + lengthInBits += m.BinaryPv.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataCredentialStatus) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataCredentialStatusParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataCredentialStatus, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataCredentialStatus"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (binaryPv) + if pullErr := readBuffer.PullContext("binaryPv"); pullErr != nil { + return nil, pullErr + } + _binaryPv, _binaryPvErr := BACnetBinaryPVTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _binaryPvErr != nil { + return nil, errors.Wrap(_binaryPvErr, "Error parsing 'binaryPv' field") + } + binaryPv := CastBACnetBinaryPVTagged(_binaryPv) + if closeErr := readBuffer.CloseContext("binaryPv"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataCredentialStatus"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataCredentialStatus{ + BinaryPv: CastBACnetBinaryPVTagged(binaryPv), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataCredentialStatus) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataCredentialStatus"); pushErr != nil { + return pushErr + } + + // Simple Field (binaryPv) + if pushErr := writeBuffer.PushContext("binaryPv"); pushErr != nil { + return pushErr + } + _binaryPvErr := m.BinaryPv.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("binaryPv"); popErr != nil { + return popErr + } + if _binaryPvErr != nil { + return errors.Wrap(_binaryPvErr, "Error serializing 'binaryPv' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataCredentialStatus"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataCredentialStatus) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataDaysRemaining.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaysRemaining.go new file mode 100644 index 00000000000..cc92dcf97f8 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaysRemaining.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. + +// BACnetConstructedDataDaysRemaining is the data-structure of this message +type BACnetConstructedDataDaysRemaining struct { + *BACnetConstructedData + DaysRemaining *BACnetApplicationTagSignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataDaysRemaining is the corresponding interface of BACnetConstructedDataDaysRemaining +type IBACnetConstructedDataDaysRemaining interface { + IBACnetConstructedData + // GetDaysRemaining returns DaysRemaining (property field) + GetDaysRemaining() *BACnetApplicationTagSignedInteger + // 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 *BACnetConstructedDataDaysRemaining) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataDaysRemaining) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_DAYS_REMAINING +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataDaysRemaining) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataDaysRemaining) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataDaysRemaining) GetDaysRemaining() *BACnetApplicationTagSignedInteger { + return m.DaysRemaining +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataDaysRemaining factory function for BACnetConstructedDataDaysRemaining +func NewBACnetConstructedDataDaysRemaining(daysRemaining *BACnetApplicationTagSignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataDaysRemaining { + _result := &BACnetConstructedDataDaysRemaining{ + DaysRemaining: daysRemaining, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataDaysRemaining(structType interface{}) *BACnetConstructedDataDaysRemaining { + if casted, ok := structType.(BACnetConstructedDataDaysRemaining); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataDaysRemaining); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataDaysRemaining(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataDaysRemaining(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataDaysRemaining) GetTypeName() string { + return "BACnetConstructedDataDaysRemaining" +} + +func (m *BACnetConstructedDataDaysRemaining) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataDaysRemaining) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (daysRemaining) + lengthInBits += m.DaysRemaining.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataDaysRemaining) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataDaysRemainingParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataDaysRemaining, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataDaysRemaining"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (daysRemaining) + if pullErr := readBuffer.PullContext("daysRemaining"); pullErr != nil { + return nil, pullErr + } + _daysRemaining, _daysRemainingErr := BACnetApplicationTagParse(readBuffer) + if _daysRemainingErr != nil { + return nil, errors.Wrap(_daysRemainingErr, "Error parsing 'daysRemaining' field") + } + daysRemaining := CastBACnetApplicationTagSignedInteger(_daysRemaining) + if closeErr := readBuffer.CloseContext("daysRemaining"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataDaysRemaining"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataDaysRemaining{ + DaysRemaining: CastBACnetApplicationTagSignedInteger(daysRemaining), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataDaysRemaining) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataDaysRemaining"); pushErr != nil { + return pushErr + } + + // Simple Field (daysRemaining) + if pushErr := writeBuffer.PushContext("daysRemaining"); pushErr != nil { + return pushErr + } + _daysRemainingErr := m.DaysRemaining.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("daysRemaining"); popErr != nil { + return popErr + } + if _daysRemainingErr != nil { + return errors.Wrap(_daysRemainingErr, "Error serializing 'daysRemaining' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataDaysRemaining"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataDaysRemaining) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataExtendedTimeEnable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExtendedTimeEnable.go new file mode 100644 index 00000000000..5bb5d49a5a9 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataExtendedTimeEnable.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. + +// BACnetConstructedDataExtendedTimeEnable is the data-structure of this message +type BACnetConstructedDataExtendedTimeEnable struct { + *BACnetConstructedData + ExtendedTimeEnable *BACnetApplicationTagBoolean + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataExtendedTimeEnable is the corresponding interface of BACnetConstructedDataExtendedTimeEnable +type IBACnetConstructedDataExtendedTimeEnable interface { + IBACnetConstructedData + // GetExtendedTimeEnable returns ExtendedTimeEnable (property field) + GetExtendedTimeEnable() *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 *BACnetConstructedDataExtendedTimeEnable) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataExtendedTimeEnable) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_EXTENDED_TIME_ENABLE +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataExtendedTimeEnable) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataExtendedTimeEnable) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataExtendedTimeEnable) GetExtendedTimeEnable() *BACnetApplicationTagBoolean { + return m.ExtendedTimeEnable +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataExtendedTimeEnable factory function for BACnetConstructedDataExtendedTimeEnable +func NewBACnetConstructedDataExtendedTimeEnable(extendedTimeEnable *BACnetApplicationTagBoolean, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataExtendedTimeEnable { + _result := &BACnetConstructedDataExtendedTimeEnable{ + ExtendedTimeEnable: extendedTimeEnable, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataExtendedTimeEnable(structType interface{}) *BACnetConstructedDataExtendedTimeEnable { + if casted, ok := structType.(BACnetConstructedDataExtendedTimeEnable); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataExtendedTimeEnable); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataExtendedTimeEnable(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataExtendedTimeEnable(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataExtendedTimeEnable) GetTypeName() string { + return "BACnetConstructedDataExtendedTimeEnable" +} + +func (m *BACnetConstructedDataExtendedTimeEnable) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataExtendedTimeEnable) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (extendedTimeEnable) + lengthInBits += m.ExtendedTimeEnable.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataExtendedTimeEnable) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataExtendedTimeEnableParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataExtendedTimeEnable, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataExtendedTimeEnable"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (extendedTimeEnable) + if pullErr := readBuffer.PullContext("extendedTimeEnable"); pullErr != nil { + return nil, pullErr + } + _extendedTimeEnable, _extendedTimeEnableErr := BACnetApplicationTagParse(readBuffer) + if _extendedTimeEnableErr != nil { + return nil, errors.Wrap(_extendedTimeEnableErr, "Error parsing 'extendedTimeEnable' field") + } + extendedTimeEnable := CastBACnetApplicationTagBoolean(_extendedTimeEnable) + if closeErr := readBuffer.CloseContext("extendedTimeEnable"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataExtendedTimeEnable"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataExtendedTimeEnable{ + ExtendedTimeEnable: CastBACnetApplicationTagBoolean(extendedTimeEnable), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataExtendedTimeEnable) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataExtendedTimeEnable"); pushErr != nil { + return pushErr + } + + // Simple Field (extendedTimeEnable) + if pushErr := writeBuffer.PushContext("extendedTimeEnable"); pushErr != nil { + return pushErr + } + _extendedTimeEnableErr := m.ExtendedTimeEnable.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("extendedTimeEnable"); popErr != nil { + return popErr + } + if _extendedTimeEnableErr != nil { + return errors.Wrap(_extendedTimeEnableErr, "Error serializing 'extendedTimeEnable' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataExtendedTimeEnable"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataExtendedTimeEnable) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataLastAccessEvent.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessEvent.go new file mode 100644 index 00000000000..52a9ce6ff7c --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessEvent.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. + +// BACnetConstructedDataLastAccessEvent is the data-structure of this message +type BACnetConstructedDataLastAccessEvent struct { + *BACnetConstructedData + LastAccessEvent *BACnetAccessEventTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLastAccessEvent is the corresponding interface of BACnetConstructedDataLastAccessEvent +type IBACnetConstructedDataLastAccessEvent interface { + IBACnetConstructedData + // GetLastAccessEvent returns LastAccessEvent (property field) + GetLastAccessEvent() *BACnetAccessEventTagged + // 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 *BACnetConstructedDataLastAccessEvent) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLastAccessEvent) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LAST_ACCESS_EVENT +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLastAccessEvent) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLastAccessEvent) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLastAccessEvent) GetLastAccessEvent() *BACnetAccessEventTagged { + return m.LastAccessEvent +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLastAccessEvent factory function for BACnetConstructedDataLastAccessEvent +func NewBACnetConstructedDataLastAccessEvent(lastAccessEvent *BACnetAccessEventTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLastAccessEvent { + _result := &BACnetConstructedDataLastAccessEvent{ + LastAccessEvent: lastAccessEvent, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLastAccessEvent(structType interface{}) *BACnetConstructedDataLastAccessEvent { + if casted, ok := structType.(BACnetConstructedDataLastAccessEvent); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLastAccessEvent); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLastAccessEvent(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLastAccessEvent(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLastAccessEvent) GetTypeName() string { + return "BACnetConstructedDataLastAccessEvent" +} + +func (m *BACnetConstructedDataLastAccessEvent) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLastAccessEvent) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (lastAccessEvent) + lengthInBits += m.LastAccessEvent.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLastAccessEvent) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLastAccessEventParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLastAccessEvent, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLastAccessEvent"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (lastAccessEvent) + if pullErr := readBuffer.PullContext("lastAccessEvent"); pullErr != nil { + return nil, pullErr + } + _lastAccessEvent, _lastAccessEventErr := BACnetAccessEventTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _lastAccessEventErr != nil { + return nil, errors.Wrap(_lastAccessEventErr, "Error parsing 'lastAccessEvent' field") + } + lastAccessEvent := CastBACnetAccessEventTagged(_lastAccessEvent) + if closeErr := readBuffer.CloseContext("lastAccessEvent"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLastAccessEvent"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLastAccessEvent{ + LastAccessEvent: CastBACnetAccessEventTagged(lastAccessEvent), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLastAccessEvent) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLastAccessEvent"); pushErr != nil { + return pushErr + } + + // Simple Field (lastAccessEvent) + if pushErr := writeBuffer.PushContext("lastAccessEvent"); pushErr != nil { + return pushErr + } + _lastAccessEventErr := m.LastAccessEvent.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("lastAccessEvent"); popErr != nil { + return popErr + } + if _lastAccessEventErr != nil { + return errors.Wrap(_lastAccessEventErr, "Error serializing 'lastAccessEvent' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLastAccessEvent"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLastAccessEvent) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataLastAccessPoint.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessPoint.go new file mode 100644 index 00000000000..3e04355e587 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastAccessPoint.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. + +// BACnetConstructedDataLastAccessPoint is the data-structure of this message +type BACnetConstructedDataLastAccessPoint struct { + *BACnetConstructedData + LastAccessPoint *BACnetDeviceObjectReference + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLastAccessPoint is the corresponding interface of BACnetConstructedDataLastAccessPoint +type IBACnetConstructedDataLastAccessPoint interface { + IBACnetConstructedData + // GetLastAccessPoint returns LastAccessPoint (property field) + GetLastAccessPoint() *BACnetDeviceObjectReference + // 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 *BACnetConstructedDataLastAccessPoint) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLastAccessPoint) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LAST_ACCESS_POINT +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLastAccessPoint) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLastAccessPoint) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLastAccessPoint) GetLastAccessPoint() *BACnetDeviceObjectReference { + return m.LastAccessPoint +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLastAccessPoint factory function for BACnetConstructedDataLastAccessPoint +func NewBACnetConstructedDataLastAccessPoint(lastAccessPoint *BACnetDeviceObjectReference, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLastAccessPoint { + _result := &BACnetConstructedDataLastAccessPoint{ + LastAccessPoint: lastAccessPoint, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLastAccessPoint(structType interface{}) *BACnetConstructedDataLastAccessPoint { + if casted, ok := structType.(BACnetConstructedDataLastAccessPoint); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLastAccessPoint); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLastAccessPoint(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLastAccessPoint(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLastAccessPoint) GetTypeName() string { + return "BACnetConstructedDataLastAccessPoint" +} + +func (m *BACnetConstructedDataLastAccessPoint) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLastAccessPoint) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (lastAccessPoint) + lengthInBits += m.LastAccessPoint.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLastAccessPoint) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLastAccessPointParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLastAccessPoint, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLastAccessPoint"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (lastAccessPoint) + if pullErr := readBuffer.PullContext("lastAccessPoint"); pullErr != nil { + return nil, pullErr + } + _lastAccessPoint, _lastAccessPointErr := BACnetDeviceObjectReferenceParse(readBuffer) + if _lastAccessPointErr != nil { + return nil, errors.Wrap(_lastAccessPointErr, "Error parsing 'lastAccessPoint' field") + } + lastAccessPoint := CastBACnetDeviceObjectReference(_lastAccessPoint) + if closeErr := readBuffer.CloseContext("lastAccessPoint"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLastAccessPoint"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLastAccessPoint{ + LastAccessPoint: CastBACnetDeviceObjectReference(lastAccessPoint), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLastAccessPoint) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLastAccessPoint"); pushErr != nil { + return pushErr + } + + // Simple Field (lastAccessPoint) + if pushErr := writeBuffer.PushContext("lastAccessPoint"); pushErr != nil { + return pushErr + } + _lastAccessPointErr := m.LastAccessPoint.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("lastAccessPoint"); popErr != nil { + return popErr + } + if _lastAccessPointErr != nil { + return errors.Wrap(_lastAccessPointErr, "Error serializing 'lastAccessPoint' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLastAccessPoint"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLastAccessPoint) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataLastUseTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastUseTime.go new file mode 100644 index 00000000000..bdefe808fcd --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastUseTime.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. + +// BACnetConstructedDataLastUseTime is the data-structure of this message +type BACnetConstructedDataLastUseTime struct { + *BACnetConstructedData + LastUseTime *BACnetDateTime + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLastUseTime is the corresponding interface of BACnetConstructedDataLastUseTime +type IBACnetConstructedDataLastUseTime interface { + IBACnetConstructedData + // GetLastUseTime returns LastUseTime (property field) + GetLastUseTime() *BACnetDateTime + // 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 *BACnetConstructedDataLastUseTime) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLastUseTime) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LAST_USE_TIME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLastUseTime) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLastUseTime) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLastUseTime) GetLastUseTime() *BACnetDateTime { + return m.LastUseTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLastUseTime factory function for BACnetConstructedDataLastUseTime +func NewBACnetConstructedDataLastUseTime(lastUseTime *BACnetDateTime, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLastUseTime { + _result := &BACnetConstructedDataLastUseTime{ + LastUseTime: lastUseTime, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLastUseTime(structType interface{}) *BACnetConstructedDataLastUseTime { + if casted, ok := structType.(BACnetConstructedDataLastUseTime); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLastUseTime); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLastUseTime(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLastUseTime(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLastUseTime) GetTypeName() string { + return "BACnetConstructedDataLastUseTime" +} + +func (m *BACnetConstructedDataLastUseTime) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLastUseTime) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (lastUseTime) + lengthInBits += m.LastUseTime.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLastUseTime) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLastUseTimeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLastUseTime, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLastUseTime"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (lastUseTime) + if pullErr := readBuffer.PullContext("lastUseTime"); pullErr != nil { + return nil, pullErr + } + _lastUseTime, _lastUseTimeErr := BACnetDateTimeParse(readBuffer) + if _lastUseTimeErr != nil { + return nil, errors.Wrap(_lastUseTimeErr, "Error parsing 'lastUseTime' field") + } + lastUseTime := CastBACnetDateTime(_lastUseTime) + if closeErr := readBuffer.CloseContext("lastUseTime"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLastUseTime"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLastUseTime{ + LastUseTime: CastBACnetDateTime(lastUseTime), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLastUseTime) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLastUseTime"); pushErr != nil { + return pushErr + } + + // Simple Field (lastUseTime) + if pushErr := writeBuffer.PushContext("lastUseTime"); pushErr != nil { + return pushErr + } + _lastUseTimeErr := m.LastUseTime.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("lastUseTime"); popErr != nil { + return popErr + } + if _lastUseTimeErr != nil { + return errors.Wrap(_lastUseTimeErr, "Error serializing 'lastUseTime' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLastUseTime"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLastUseTime) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataReasonForDisable.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReasonForDisable.go new file mode 100644 index 00000000000..ba11d94ad2e --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataReasonForDisable.go @@ -0,0 +1,226 @@ +/* + * 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. + +// BACnetConstructedDataReasonForDisable is the data-structure of this message +type BACnetConstructedDataReasonForDisable struct { + *BACnetConstructedData + ReasonForDisable []*BACnetAccessCredentialDisableReasonTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataReasonForDisable is the corresponding interface of BACnetConstructedDataReasonForDisable +type IBACnetConstructedDataReasonForDisable interface { + IBACnetConstructedData + // GetReasonForDisable returns ReasonForDisable (property field) + GetReasonForDisable() []*BACnetAccessCredentialDisableReasonTagged + // 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 *BACnetConstructedDataReasonForDisable) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataReasonForDisable) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_REASON_FOR_DISABLE +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataReasonForDisable) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataReasonForDisable) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataReasonForDisable) GetReasonForDisable() []*BACnetAccessCredentialDisableReasonTagged { + return m.ReasonForDisable +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataReasonForDisable factory function for BACnetConstructedDataReasonForDisable +func NewBACnetConstructedDataReasonForDisable(reasonForDisable []*BACnetAccessCredentialDisableReasonTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataReasonForDisable { + _result := &BACnetConstructedDataReasonForDisable{ + ReasonForDisable: reasonForDisable, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataReasonForDisable(structType interface{}) *BACnetConstructedDataReasonForDisable { + if casted, ok := structType.(BACnetConstructedDataReasonForDisable); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataReasonForDisable); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataReasonForDisable(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataReasonForDisable(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataReasonForDisable) GetTypeName() string { + return "BACnetConstructedDataReasonForDisable" +} + +func (m *BACnetConstructedDataReasonForDisable) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataReasonForDisable) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.ReasonForDisable) > 0 { + for _, element := range m.ReasonForDisable { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataReasonForDisable) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataReasonForDisableParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataReasonForDisable, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataReasonForDisable"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (reasonForDisable) + if pullErr := readBuffer.PullContext("reasonForDisable", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + reasonForDisable := make([]*BACnetAccessCredentialDisableReasonTagged, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetAccessCredentialDisableReasonTaggedParse(readBuffer, uint8(0), TagClass_APPLICATION_TAGS) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reasonForDisable' field") + } + reasonForDisable = append(reasonForDisable, CastBACnetAccessCredentialDisableReasonTagged(_item)) + + } + } + if closeErr := readBuffer.CloseContext("reasonForDisable", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataReasonForDisable"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataReasonForDisable{ + ReasonForDisable: reasonForDisable, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataReasonForDisable) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataReasonForDisable"); pushErr != nil { + return pushErr + } + + // Array Field (reasonForDisable) + if m.ReasonForDisable != nil { + if pushErr := writeBuffer.PushContext("reasonForDisable", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ReasonForDisable { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'reasonForDisable' field") + } + } + if popErr := writeBuffer.PopContext("reasonForDisable", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataReasonForDisable"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataReasonForDisable) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataThreatAuthority.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataThreatAuthority.go new file mode 100644 index 00000000000..b2178dfdc81 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataThreatAuthority.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. + +// BACnetConstructedDataThreatAuthority is the data-structure of this message +type BACnetConstructedDataThreatAuthority struct { + *BACnetConstructedData + ThreatAuthority *BACnetAccessThreatLevel + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataThreatAuthority is the corresponding interface of BACnetConstructedDataThreatAuthority +type IBACnetConstructedDataThreatAuthority interface { + IBACnetConstructedData + // GetThreatAuthority returns ThreatAuthority (property field) + GetThreatAuthority() *BACnetAccessThreatLevel + // 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 *BACnetConstructedDataThreatAuthority) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataThreatAuthority) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_THREAT_AUTHORITY +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataThreatAuthority) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataThreatAuthority) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataThreatAuthority) GetThreatAuthority() *BACnetAccessThreatLevel { + return m.ThreatAuthority +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataThreatAuthority factory function for BACnetConstructedDataThreatAuthority +func NewBACnetConstructedDataThreatAuthority(threatAuthority *BACnetAccessThreatLevel, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataThreatAuthority { + _result := &BACnetConstructedDataThreatAuthority{ + ThreatAuthority: threatAuthority, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataThreatAuthority(structType interface{}) *BACnetConstructedDataThreatAuthority { + if casted, ok := structType.(BACnetConstructedDataThreatAuthority); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataThreatAuthority); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataThreatAuthority(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataThreatAuthority(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataThreatAuthority) GetTypeName() string { + return "BACnetConstructedDataThreatAuthority" +} + +func (m *BACnetConstructedDataThreatAuthority) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataThreatAuthority) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (threatAuthority) + lengthInBits += m.ThreatAuthority.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataThreatAuthority) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataThreatAuthorityParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataThreatAuthority, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataThreatAuthority"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (threatAuthority) + if pullErr := readBuffer.PullContext("threatAuthority"); pullErr != nil { + return nil, pullErr + } + _threatAuthority, _threatAuthorityErr := BACnetAccessThreatLevelParse(readBuffer) + if _threatAuthorityErr != nil { + return nil, errors.Wrap(_threatAuthorityErr, "Error parsing 'threatAuthority' field") + } + threatAuthority := CastBACnetAccessThreatLevel(_threatAuthority) + if closeErr := readBuffer.CloseContext("threatAuthority"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataThreatAuthority"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataThreatAuthority{ + ThreatAuthority: CastBACnetAccessThreatLevel(threatAuthority), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataThreatAuthority) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataThreatAuthority"); pushErr != nil { + return pushErr + } + + // Simple Field (threatAuthority) + if pushErr := writeBuffer.PushContext("threatAuthority"); pushErr != nil { + return pushErr + } + _threatAuthorityErr := m.ThreatAuthority.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("threatAuthority"); popErr != nil { + return popErr + } + if _threatAuthorityErr != nil { + return errors.Wrap(_threatAuthorityErr, "Error serializing 'threatAuthority' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataThreatAuthority"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataThreatAuthority) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataTraceFlag.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTraceFlag.go new file mode 100644 index 00000000000..646584962d3 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTraceFlag.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. + +// BACnetConstructedDataTraceFlag is the data-structure of this message +type BACnetConstructedDataTraceFlag struct { + *BACnetConstructedData + TraceFlag *BACnetApplicationTagBoolean + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataTraceFlag is the corresponding interface of BACnetConstructedDataTraceFlag +type IBACnetConstructedDataTraceFlag interface { + IBACnetConstructedData + // GetTraceFlag returns TraceFlag (property field) + GetTraceFlag() *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 *BACnetConstructedDataTraceFlag) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataTraceFlag) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_TRACE_FLAG +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataTraceFlag) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataTraceFlag) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataTraceFlag) GetTraceFlag() *BACnetApplicationTagBoolean { + return m.TraceFlag +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataTraceFlag factory function for BACnetConstructedDataTraceFlag +func NewBACnetConstructedDataTraceFlag(traceFlag *BACnetApplicationTagBoolean, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataTraceFlag { + _result := &BACnetConstructedDataTraceFlag{ + TraceFlag: traceFlag, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataTraceFlag(structType interface{}) *BACnetConstructedDataTraceFlag { + if casted, ok := structType.(BACnetConstructedDataTraceFlag); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataTraceFlag); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataTraceFlag(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataTraceFlag(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataTraceFlag) GetTypeName() string { + return "BACnetConstructedDataTraceFlag" +} + +func (m *BACnetConstructedDataTraceFlag) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataTraceFlag) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (traceFlag) + lengthInBits += m.TraceFlag.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataTraceFlag) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataTraceFlagParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataTraceFlag, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataTraceFlag"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (traceFlag) + if pullErr := readBuffer.PullContext("traceFlag"); pullErr != nil { + return nil, pullErr + } + _traceFlag, _traceFlagErr := BACnetApplicationTagParse(readBuffer) + if _traceFlagErr != nil { + return nil, errors.Wrap(_traceFlagErr, "Error parsing 'traceFlag' field") + } + traceFlag := CastBACnetApplicationTagBoolean(_traceFlag) + if closeErr := readBuffer.CloseContext("traceFlag"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataTraceFlag"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataTraceFlag{ + TraceFlag: CastBACnetApplicationTagBoolean(traceFlag), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataTraceFlag) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataTraceFlag"); pushErr != nil { + return pushErr + } + + // Simple Field (traceFlag) + if pushErr := writeBuffer.PushContext("traceFlag"); pushErr != nil { + return pushErr + } + _traceFlagErr := m.TraceFlag.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("traceFlag"); popErr != nil { + return popErr + } + if _traceFlagErr != nil { + return errors.Wrap(_traceFlagErr, "Error serializing 'traceFlag' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataTraceFlag"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataTraceFlag) String() string { + if m == nil { + return "" + } + 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/BACnetConstructedDataUsesRemaining.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUsesRemaining.go new file mode 100644 index 00000000000..21c4efe993e --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUsesRemaining.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. + +// BACnetConstructedDataUsesRemaining is the data-structure of this message +type BACnetConstructedDataUsesRemaining struct { + *BACnetConstructedData + UsesRemaining *BACnetApplicationTagSignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataUsesRemaining is the corresponding interface of BACnetConstructedDataUsesRemaining +type IBACnetConstructedDataUsesRemaining interface { + IBACnetConstructedData + // GetUsesRemaining returns UsesRemaining (property field) + GetUsesRemaining() *BACnetApplicationTagSignedInteger + // 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 *BACnetConstructedDataUsesRemaining) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataUsesRemaining) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_USES_REMAINING +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataUsesRemaining) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataUsesRemaining) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataUsesRemaining) GetUsesRemaining() *BACnetApplicationTagSignedInteger { + return m.UsesRemaining +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataUsesRemaining factory function for BACnetConstructedDataUsesRemaining +func NewBACnetConstructedDataUsesRemaining(usesRemaining *BACnetApplicationTagSignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataUsesRemaining { + _result := &BACnetConstructedDataUsesRemaining{ + UsesRemaining: usesRemaining, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataUsesRemaining(structType interface{}) *BACnetConstructedDataUsesRemaining { + if casted, ok := structType.(BACnetConstructedDataUsesRemaining); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataUsesRemaining); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataUsesRemaining(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataUsesRemaining(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataUsesRemaining) GetTypeName() string { + return "BACnetConstructedDataUsesRemaining" +} + +func (m *BACnetConstructedDataUsesRemaining) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataUsesRemaining) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (usesRemaining) + lengthInBits += m.UsesRemaining.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataUsesRemaining) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataUsesRemainingParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataUsesRemaining, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataUsesRemaining"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (usesRemaining) + if pullErr := readBuffer.PullContext("usesRemaining"); pullErr != nil { + return nil, pullErr + } + _usesRemaining, _usesRemainingErr := BACnetApplicationTagParse(readBuffer) + if _usesRemainingErr != nil { + return nil, errors.Wrap(_usesRemainingErr, "Error parsing 'usesRemaining' field") + } + usesRemaining := CastBACnetApplicationTagSignedInteger(_usesRemaining) + if closeErr := readBuffer.CloseContext("usesRemaining"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataUsesRemaining"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataUsesRemaining{ + UsesRemaining: CastBACnetApplicationTagSignedInteger(usesRemaining), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataUsesRemaining) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataUsesRemaining"); pushErr != nil { + return pushErr + } + + // Simple Field (usesRemaining) + if pushErr := writeBuffer.PushContext("usesRemaining"); pushErr != nil { + return pushErr + } + _usesRemainingErr := m.UsesRemaining.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("usesRemaining"); popErr != nil { + return popErr + } + if _usesRemainingErr != nil { + return errors.Wrap(_usesRemainingErr, "Error serializing 'usesRemaining' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataUsesRemaining"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataUsesRemaining) String() string { + if m == nil { + return "" + } + 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/BACnetCredentialAuthenticationFactor.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCredentialAuthenticationFactor.go new file mode 100644 index 00000000000..40227edfd28 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetCredentialAuthenticationFactor.go @@ -0,0 +1,195 @@ +/* + * 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. + +// BACnetCredentialAuthenticationFactor is the data-structure of this message +type BACnetCredentialAuthenticationFactor struct { + Disable *BACnetAccessAuthenticationFactorDisableTagged + AuthenticationFactor *BACnetAuthenticationFactorEnclosed +} + +// IBACnetCredentialAuthenticationFactor is the corresponding interface of BACnetCredentialAuthenticationFactor +type IBACnetCredentialAuthenticationFactor interface { + // GetDisable returns Disable (property field) + GetDisable() *BACnetAccessAuthenticationFactorDisableTagged + // GetAuthenticationFactor returns AuthenticationFactor (property field) + GetAuthenticationFactor() *BACnetAuthenticationFactorEnclosed + // 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 *BACnetCredentialAuthenticationFactor) GetDisable() *BACnetAccessAuthenticationFactorDisableTagged { + return m.Disable +} + +func (m *BACnetCredentialAuthenticationFactor) GetAuthenticationFactor() *BACnetAuthenticationFactorEnclosed { + return m.AuthenticationFactor +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetCredentialAuthenticationFactor factory function for BACnetCredentialAuthenticationFactor +func NewBACnetCredentialAuthenticationFactor(disable *BACnetAccessAuthenticationFactorDisableTagged, authenticationFactor *BACnetAuthenticationFactorEnclosed) *BACnetCredentialAuthenticationFactor { + return &BACnetCredentialAuthenticationFactor{Disable: disable, AuthenticationFactor: authenticationFactor} +} + +func CastBACnetCredentialAuthenticationFactor(structType interface{}) *BACnetCredentialAuthenticationFactor { + if casted, ok := structType.(BACnetCredentialAuthenticationFactor); ok { + return &casted + } + if casted, ok := structType.(*BACnetCredentialAuthenticationFactor); ok { + return casted + } + return nil +} + +func (m *BACnetCredentialAuthenticationFactor) GetTypeName() string { + return "BACnetCredentialAuthenticationFactor" +} + +func (m *BACnetCredentialAuthenticationFactor) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetCredentialAuthenticationFactor) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (disable) + lengthInBits += m.Disable.GetLengthInBits() + + // Simple field (authenticationFactor) + lengthInBits += m.AuthenticationFactor.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetCredentialAuthenticationFactor) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetCredentialAuthenticationFactorParse(readBuffer utils.ReadBuffer) (*BACnetCredentialAuthenticationFactor, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetCredentialAuthenticationFactor"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (disable) + if pullErr := readBuffer.PullContext("disable"); pullErr != nil { + return nil, pullErr + } + _disable, _disableErr := BACnetAccessAuthenticationFactorDisableTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_CONTEXT_SPECIFIC_TAGS)) + if _disableErr != nil { + return nil, errors.Wrap(_disableErr, "Error parsing 'disable' field") + } + disable := CastBACnetAccessAuthenticationFactorDisableTagged(_disable) + if closeErr := readBuffer.CloseContext("disable"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (authenticationFactor) + if pullErr := readBuffer.PullContext("authenticationFactor"); pullErr != nil { + return nil, pullErr + } + _authenticationFactor, _authenticationFactorErr := BACnetAuthenticationFactorEnclosedParse(readBuffer, uint8(uint8(1))) + if _authenticationFactorErr != nil { + return nil, errors.Wrap(_authenticationFactorErr, "Error parsing 'authenticationFactor' field") + } + authenticationFactor := CastBACnetAuthenticationFactorEnclosed(_authenticationFactor) + if closeErr := readBuffer.CloseContext("authenticationFactor"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetCredentialAuthenticationFactor"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetCredentialAuthenticationFactor(disable, authenticationFactor), nil +} + +func (m *BACnetCredentialAuthenticationFactor) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetCredentialAuthenticationFactor"); pushErr != nil { + return pushErr + } + + // Simple Field (disable) + if pushErr := writeBuffer.PushContext("disable"); pushErr != nil { + return pushErr + } + _disableErr := m.Disable.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("disable"); popErr != nil { + return popErr + } + if _disableErr != nil { + return errors.Wrap(_disableErr, "Error serializing 'disable' field") + } + + // Simple Field (authenticationFactor) + if pushErr := writeBuffer.PushContext("authenticationFactor"); pushErr != nil { + return pushErr + } + _authenticationFactorErr := m.AuthenticationFactor.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("authenticationFactor"); popErr != nil { + return popErr + } + if _authenticationFactorErr != nil { + return errors.Wrap(_authenticationFactorErr, "Error serializing 'authenticationFactor' field") + } + + if popErr := writeBuffer.PopContext("BACnetCredentialAuthenticationFactor"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetCredentialAuthenticationFactor) String() string { + if m == nil { + return "" + } + 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 9f608893c01..869438f4e84 100644 --- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec +++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec @@ -2294,7 +2294,9 @@ [simple BACnetOpeningTag('tagNumber') openingTag ] [typeSwitch objectTypeArgument, propertyIdentifierArgument - //[*, 'ABSENTEE_LIMIT' BACnetConstructedDataAbsenteeLimit [validation '1 == 2' "TODO: implement me ABSENTEE_LIMIT BACnetConstructedDataAbsenteeLimit"]] + [*, 'ABSENTEE_LIMIT' BACnetConstructedDataAbsenteeLimit + [simple BACnetApplicationTagUnsignedInteger absenteeLimit ] + ] [*, 'ACCEPTED_MODES' BACnetConstructedDataAcceptedModes [array BACnetLifeSafetyModeTagged('0', 'TagClass.APPLICATION_TAGS') acceptedModes terminated @@ -2324,7 +2326,9 @@ 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] ] //[*, 'ACTION_TEXT' BACnetConstructedDataActionText [validation '1 == 2' "TODO: implement me ACTION_TEXT BACnetConstructedDataActionText"]] - //[*, 'ACTIVATION_TIME' BACnetConstructedDataActivationTime [validation '1 == 2' "TODO: implement me ACTIVATION_TIME BACnetConstructedDataActivationTime"]] + [*, 'ACTIVATION_TIME' BACnetConstructedDataActivationTime + [simple BACnetDateTime activationTime ] + ] //[*, 'ACTIVE_AUTHENTICATION_POLICY' BACnetConstructedDataActiveAuthenticationPolicy [validation '1 == 2' "TODO: implement me ACTIVE_AUTHENTICATION_POLICY BACnetConstructedDataActiveAuthenticationPolicy"]] //[*, 'ACTIVE_COV_MULTIPLE_SUBSCRIPTIONS' BACnetConstructedDataActiveCOVMultipleSubscriptions [validation '1 == 2' "TODO: implement me ACTIVE_COV_MULTIPLE_SUBSCRIPTIONS BACnetConstructedDataActiveCOVMultipleSubscriptions"]] //[*, 'ACTIVE_COV_SUBSCRIPTIONS' BACnetConstructedDataActiveCOVSubscriptions [validation '1 == 2' "TODO: implement me ACTIVE_COV_SUBSCRIPTIONS BACnetConstructedDataActiveCOVSubscriptions"]] @@ -2534,14 +2538,29 @@ //[*, 'APDU_TIMEOUT' BACnetConstructedDataAPDUTimeout [validation '1 == 2' "TODO: implement me APDU_TIMEOUT BACnetConstructedDataAPDUTimeout"]] //[*, 'APPLICATION_SOFTWARE_VERSION' BACnetConstructedDataApplicationSoftwareVersion [validation '1 == 2' "TODO: implement me APPLICATION_SOFTWARE_VERSION BACnetConstructedDataApplicationSoftwareVersion"]] //[*, 'ARCHIVE' BACnetConstructedDataArchive [validation '1 == 2' "TODO: implement me ARCHIVE BACnetConstructedDataArchive"]] - //[*, 'ASSIGNED_ACCESS_RIGHTS' BACnetConstructedDataAssignedAccessRights [validation '1 == 2' "TODO: implement me ASSIGNED_ACCESS_RIGHTS BACnetConstructedDataAssignedAccessRights"]] + [*, 'ASSIGNED_ACCESS_RIGHTS' BACnetConstructedDataAssignedAccessRights + [array BACnetAssignedAccessRights + assignedAccessRights + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] //[*, 'ASSIGNED_LANDING_CALLS' BACnetConstructedDataAssignedLandingCalls [validation '1 == 2' "TODO: implement me ASSIGNED_LANDING_CALLS BACnetConstructedDataAssignedLandingCalls"]] //[*, 'ATTEMPTED_SAMPLES' BACnetConstructedDataAttemptedSamples [validation '1 == 2' "TODO: implement me ATTEMPTED_SAMPLES BACnetConstructedDataAttemptedSamples"]] - //[*, 'AUTHENTICATION_FACTORS' BACnetConstructedDataAuthenticationFactors [validation '1 == 2' "TODO: implement me AUTHENTICATION_FACTORS BACnetConstructedDataAuthenticationFactors"]] + [*, 'AUTHENTICATION_FACTORS' BACnetConstructedDataAuthenticationFactors + [array BACnetCredentialAuthenticationFactor + authenticationFactors + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] //[*, 'AUTHENTICATION_POLICY_LIST' BACnetConstructedDataAuthenticationPolicyList [validation '1 == 2' "TODO: implement me AUTHENTICATION_POLICY_LIST BACnetConstructedDataAuthenticationPolicyList"]] //[*, 'AUTHENTICATION_POLICY_NAMES' BACnetConstructedDataAuthenticationPolicyNames [validation '1 == 2' "TODO: implement me AUTHENTICATION_POLICY_NAMES BACnetConstructedDataAuthenticationPolicyNames"]] //[*, 'AUTHENTICATION_STATUS' BACnetConstructedDataAuthenticationStatus [validation '1 == 2' "TODO: implement me AUTHENTICATION_STATUS BACnetConstructedDataAuthenticationStatus"]] - //[*, 'AUTHORIZATION_EXEMPTIONS' BACnetConstructedDataAuthorizationExemptions [validation '1 == 2' "TODO: implement me AUTHORIZATION_EXEMPTIONS BACnetConstructedDataAuthorizationExemptions"]] + [*, 'AUTHORIZATION_EXEMPTIONS' BACnetConstructedDataAuthorizationExemptions + [array BACnetAuthorizationExemptionTagged('0', 'TagClass.APPLICATION_TAGS') + authorizationExemption + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] //[*, 'AUTHORIZATION_MODE' BACnetConstructedDataAuthorizationMode [validation '1 == 2' "TODO: implement me AUTHORIZATION_MODE BACnetConstructedDataAuthorizationMode"]] //[*, 'AUTO_SLAVE_DISCOVERY' BACnetConstructedDataAutoSlaveDiscovery [validation '1 == 2' "TODO: implement me AUTO_SLAVE_DISCOVERY BACnetConstructedDataAutoSlaveDiscovery"]] //[*, 'AVERAGE_VALUE' BACnetConstructedDataAverageValue [validation '1 == 2' "TODO: implement me AVERAGE_VALUE BACnetConstructedDataAverageValue"]] @@ -2562,7 +2581,9 @@ ] //[*, 'BBMD_BROADCAST_DISTRIBUTION_TABLE' BACnetConstructedDataBBMDBroadcastDistributionTable [validation '1 == 2' "TODO: implement me BBMD_BROADCAST_DISTRIBUTION_TABLE BACnetConstructedDataBBMDBroadcastDistributionTable"]] //[*, 'BBMD_FOREIGN_DEVICE_TABLE' BACnetConstructedDataBBMDForeignDeviceTable [validation '1 == 2' "TODO: implement me BBMD_FOREIGN_DEVICE_TABLE BACnetConstructedDataBBMDForeignDeviceTable"]] - //[*, 'BELONGS_TO' BACnetConstructedDataBelongsTo [validation '1 == 2' "TODO: implement me BELONGS_TO BACnetConstructedDataBelongsTo"]] + [*, 'BELONGS_TO' BACnetConstructedDataBelongsTo + [simple BACnetDeviceObjectReference belongsTo ] + ] //[*, 'BIAS' BACnetConstructedDataBias [validation '1 == 2' "TODO: implement me BIAS BACnetConstructedDataBias"]] //[*, 'BIT_MASK' BACnetConstructedDataBitMask [validation '1 == 2' "TODO: implement me BIT_MASK BACnetConstructedDataBitMask"]] //[*, 'BIT_TEXT' BACnetConstructedDataBitText [validation '1 == 2' "TODO: implement me BIT_TEXT BACnetConstructedDataBitText"]] @@ -2607,15 +2628,21 @@ //[*, 'COV_RESUBSCRIPTION_INTERVAL' BACnetConstructedDataCOVResubscriptionInterval [validation '1 == 2' "TODO: implement me COV_RESUBSCRIPTION_INTERVAL BACnetConstructedDataCOVResubscriptionInterval"]] //[*, 'COVU_PERIOD' BACnetConstructedDataCOVUPeriod [validation '1 == 2' "TODO: implement me COVU_PERIOD BACnetConstructedDataCOVUPeriod"]] //[*, 'COVU_RECIPIENTS' BACnetConstructedDataCOVURecipients [validation '1 == 2' "TODO: implement me COVU_RECIPIENTS BACnetConstructedDataCOVURecipients"]] - //[*, 'CREDENTIAL_DISABLE' BACnetConstructedDataCredentialDisable [validation '1 == 2' "TODO: implement me CREDENTIAL_DISABLE BACnetConstructedDataCredentialDisable"]] - //[*, 'CREDENTIAL_STATUS' BACnetConstructedDataCredentialStatus [validation '1 == 2' "TODO: implement me CREDENTIAL_STATUS BACnetConstructedDataCredentialStatus"]] + [*, 'CREDENTIAL_DISABLE' BACnetConstructedDataCredentialDisable + [simple BACnetAccessCredentialDisableTagged('0', 'TagClass.APPLICATION_TAGS') credentialDisable] + ] + [*, 'CREDENTIAL_STATUS' BACnetConstructedDataCredentialStatus + [simple BACnetBinaryPVTagged('0', 'TagClass.APPLICATION_TAGS') binaryPv ] + ] //[*, 'CREDENTIALS' BACnetConstructedDataCredentials [validation '1 == 2' "TODO: implement me CREDENTIALS BACnetConstructedDataCredentials"]] //[*, 'CREDENTIALS_IN_ZONE' BACnetConstructedDataCredentialsInZone [validation '1 == 2' "TODO: implement me CREDENTIALS_IN_ZONE BACnetConstructedDataCredentialsInZone"]] //[*, 'CURRENT_COMMAND_PRIORITY' BACnetConstructedDataCurrentCommandPriority [validation '1 == 2' "TODO: implement me CURRENT_COMMAND_PRIORITY BACnetConstructedDataCurrentCommandPriority"]] //[*, 'DATABASE_REVISION' BACnetConstructedDataDatabaseRevision [validation '1 == 2' "TODO: implement me DATABASE_REVISION BACnetConstructedDataDatabaseRevision"]] //[*, 'DATE_LIST' BACnetConstructedDataDateList [validation '1 == 2' "TODO: implement me DATE_LIST BACnetConstructedDataDateList"]] //[*, 'DAYLIGHT_SAVINGS_STATUS' BACnetConstructedDataDaylightSavingsStatus [validation '1 == 2' "TODO: implement me DAYLIGHT_SAVINGS_STATUS BACnetConstructedDataDaylightSavingsStatus"]] - //[*, 'DAYS_REMAINING' BACnetConstructedDataDaysRemaining [validation '1 == 2' "TODO: implement me DAYS_REMAINING BACnetConstructedDataDaysRemaining"]] + [*, 'DAYS_REMAINING' BACnetConstructedDataDaysRemaining + [simple BACnetApplicationTagSignedInteger daysRemaining ] + ] [*, 'DEADBAND' BACnetConstructedDataDeadband [simple BACnetApplicationTagReal deadband ] ] @@ -2690,7 +2717,9 @@ //[*, 'EXIT_POINTS' BACnetConstructedDataExitPoints [validation '1 == 2' "TODO: implement me EXIT_POINTS BACnetConstructedDataExitPoints"]] //[*, 'EXPECTED_SHED_LEVEL' BACnetConstructedDataExpectedShedLevel [validation '1 == 2' "TODO: implement me EXPECTED_SHED_LEVEL BACnetConstructedDataExpectedShedLevel"]] //[*, 'EXPIRATION_TIME' BACnetConstructedDataExpirationTime [validation '1 == 2' "TODO: implement me EXPIRATION_TIME BACnetConstructedDataExpirationTime"]] - //[*, 'EXTENDED_TIME_ENABLE' BACnetConstructedDataExtendedTimeEnable [validation '1 == 2' "TODO: implement me EXTENDED_TIME_ENABLE BACnetConstructedDataExtendedTimeEnable"]] + [*, 'EXTENDED_TIME_ENABLE' BACnetConstructedDataExtendedTimeEnable + [simple BACnetApplicationTagBoolean extendedTimeEnable ] + ] //[*, 'FAILED_ATTEMPT_EVENTS' BACnetConstructedDataFailedAttemptEvents [validation '1 == 2' "TODO: implement me FAILED_ATTEMPT_EVENTS BACnetConstructedDataFailedAttemptEvents"]] //[*, 'FAILED_ATTEMPTS' BACnetConstructedDataFailedAttempts [validation '1 == 2' "TODO: implement me FAILED_ATTEMPTS BACnetConstructedDataFailedAttempts"]] //[*, 'FAILED_ATTEMPTS_TIME' BACnetConstructedDataFailedAttemptsTime [validation '1 == 2' "TODO: implement me FAILED_ATTEMPTS_TIME BACnetConstructedDataFailedAttemptsTime"]] @@ -2774,8 +2803,12 @@ //[*, 'LANDING_CALL_CONTROL' BACnetConstructedDataLandingCallControl [validation '1 == 2' "TODO: implement me LANDING_CALL_CONTROL BACnetConstructedDataLandingCallControl"]] //[*, 'LANDING_CALLS' BACnetConstructedDataLandingCalls [validation '1 == 2' "TODO: implement me LANDING_CALLS BACnetConstructedDataLandingCalls"]] //[*, 'LANDING_DOOR_STATUS' BACnetConstructedDataLandingDoorStatus [validation '1 == 2' "TODO: implement me LANDING_DOOR_STATUS BACnetConstructedDataLandingDoorStatus"]] - //[*, 'LAST_ACCESS_EVENT' BACnetConstructedDataLastAccessEvent [validation '1 == 2' "TODO: implement me LAST_ACCESS_EVENT BACnetConstructedDataLastAccessEvent"]] - //[*, 'LAST_ACCESS_POINT' BACnetConstructedDataLastAccessPoint [validation '1 == 2' "TODO: implement me LAST_ACCESS_POINT BACnetConstructedDataLastAccessPoint"]] + [*, 'LAST_ACCESS_EVENT' BACnetConstructedDataLastAccessEvent + [simple BACnetAccessEventTagged('0', 'TagClass.APPLICATION_TAGS') lastAccessEvent ] + ] + [*, 'LAST_ACCESS_POINT' BACnetConstructedDataLastAccessPoint + [simple BACnetDeviceObjectReference lastAccessPoint ] + ] //[*, 'LAST_COMMAND_TIME' BACnetConstructedDataLastCommandTime [validation '1 == 2' "TODO: implement me LAST_COMMAND_TIME BACnetConstructedDataLastCommandTime"]] //[*, 'LAST_CREDENTIAL_ADDED' BACnetConstructedDataLastCredentialAdded [validation '1 == 2' "TODO: implement me LAST_CREDENTIAL_ADDED BACnetConstructedDataLastCredentialAdded"]] //[*, 'LAST_CREDENTIAL_ADDED_TIME' BACnetConstructedDataLastCredentialAddedTime [validation '1 == 2' "TODO: implement me LAST_CREDENTIAL_ADDED_TIME BACnetConstructedDataLastCredentialAddedTime"]] @@ -2787,7 +2820,9 @@ //[*, 'LAST_RESTART_REASON' BACnetConstructedDataLastRestartReason [validation '1 == 2' "TODO: implement me LAST_RESTART_REASON BACnetConstructedDataLastRestartReason"]] //[*, 'LAST_RESTORE_TIME' BACnetConstructedDataLastRestoreTime [validation '1 == 2' "TODO: implement me LAST_RESTORE_TIME BACnetConstructedDataLastRestoreTime"]] //[*, 'LAST_STATE_CHANGE' BACnetConstructedDataLastStateChange [validation '1 == 2' "TODO: implement me LAST_STATE_CHANGE BACnetConstructedDataLastStateChange"]] - //[*, 'LAST_USE_TIME' BACnetConstructedDataLastUseTime [validation '1 == 2' "TODO: implement me LAST_USE_TIME BACnetConstructedDataLastUseTime"]] + [*, 'LAST_USE_TIME' BACnetConstructedDataLastUseTime + [simple BACnetDateTime lastUseTime ] + ] [*, 'LIFE_SAFETY_ALARM_VALUES' BACnetConstructedDataLifeSafetyAlarmValues [array BACnetLifeSafetyStateTagged('0', 'TagClass.APPLICATION_TAGS') alarmValues terminated @@ -2982,7 +3017,12 @@ //[*, 'PROTOCOL_VERSION' BACnetConstructedDataProtocolVersion [validation '1 == 2' "TODO: implement me PROTOCOL_VERSION BACnetConstructedDataProtocolVersion"]] //[*, 'PULSE_RATE' BACnetConstructedDataPulseRate [validation '1 == 2' "TODO: implement me PULSE_RATE BACnetConstructedDataPulseRate"]] //[*, 'READ_ONLY' BACnetConstructedDataReadOnly [validation '1 == 2' "TODO: implement me READ_ONLY BACnetConstructedDataReadOnly"]] - //[*, 'REASON_FOR_DISABLE' BACnetConstructedDataReasonForDisable [validation '1 == 2' "TODO: implement me REASON_FOR_DISABLE BACnetConstructedDataReasonForDisable"]] + [*, 'REASON_FOR_DISABLE' BACnetConstructedDataReasonForDisable + [array BACnetAccessCredentialDisableReasonTagged('0', 'TagClass.APPLICATION_TAGS') + reasonForDisable + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] //[*, 'REASON_FOR_HALT' BACnetConstructedDataReasonForHalt [validation '1 == 2' "TODO: implement me REASON_FOR_HALT BACnetConstructedDataReasonForHalt"]] //[*, 'RECIPIENT_LIST' BACnetConstructedDataRecipientList [validation '1 == 2' "TODO: implement me RECIPIENT_LIST BACnetConstructedDataRecipientList"]] //[*, 'RECORD_COUNT' BACnetConstructedDataRecordCount [validation '1 == 2' "TODO: implement me RECORD_COUNT BACnetConstructedDataRecordCount"]] @@ -3058,13 +3098,15 @@ terminated 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] ] - //[*, 'THREAT_AUTHORITY' BACnetConstructedDataThreatAuthority [validation '1 == 2' "TODO: implement me THREAT_AUTHORITY BACnetConstructedDataThreatAuthority"]] + [*, 'THREAT_AUTHORITY' BACnetConstructedDataThreatAuthority + [simple BACnetAccessThreatLevel threatAuthority ] + ] //[*, 'THREAT_LEVEL' BACnetConstructedDataThreatLevel [validation '1 == 2' "TODO: implement me THREAT_LEVEL BACnetConstructedDataThreatLevel"]] [*, 'TIME_DELAY' BACnetConstructedDataTimeDelay - [simple BACnetApplicationTagUnsignedInteger timeDelay ] + [simple BACnetApplicationTagUnsignedInteger timeDelay ] ] [*, 'TIME_DELAY_NORMAL' BACnetConstructedDataTimeDelayNormal - [simple BACnetApplicationTagUnsignedInteger timeDelayNormal ] + [simple BACnetApplicationTagUnsignedInteger timeDelayNormal ] ] //[*, 'TIME_OF_ACTIVE_TIME_RESET' BACnetConstructedDataTimeOfActiveTimeReset [validation '1 == 2' "TODO: implement me TIME_OF_ACTIVE_TIME_RESET BACnetConstructedDataTimeOfActiveTimeReset"]] //[*, 'TIME_OF_DEVICE_RESTART' BACnetConstructedDataTimeOfDeviceRestart [validation '1 == 2' "TODO: implement me TIME_OF_DEVICE_RESTART BACnetConstructedDataTimeOfDeviceRestart"]] @@ -3075,7 +3117,9 @@ //[*, 'TIMER_RUNNING' BACnetConstructedDataTimerRunning [validation '1 == 2' "TODO: implement me TIMER_RUNNING BACnetConstructedDataTimerRunning"]] //[*, 'TIMER_STATE' BACnetConstructedDataTimerState [validation '1 == 2' "TODO: implement me TIMER_STATE BACnetConstructedDataTimerState"]] //[*, 'TOTAL_RECORD_COUNT' BACnetConstructedDataTotalRecordCount [validation '1 == 2' "TODO: implement me TOTAL_RECORD_COUNT BACnetConstructedDataTotalRecordCount"]] - //[*, 'TRACE_FLAG' BACnetConstructedDataTraceFlag [validation '1 == 2' "TODO: implement me TRACE_FLAG BACnetConstructedDataTraceFlag"]] + [*, 'TRACE_FLAG' BACnetConstructedDataTraceFlag + [simple BACnetApplicationTagBoolean traceFlag ] + ] //[*, 'TRACKING_VALUE' BACnetConstructedDataTrackingValue [validation '1 == 2' "TODO: implement me TRACKING_VALUE BACnetConstructedDataTrackingValue"]] //[*, 'TRANSACTION_NOTIFICATION_CLASS' BACnetConstructedDataTransactionNotificationClass [validation '1 == 2' "TODO: implement me TRANSACTION_NOTIFICATION_CLASS BACnetConstructedDataTransactionNotificationClass"]] //[*, 'TRANSITION' BACnetConstructedDataTransition [validation '1 == 2' "TODO: implement me TRANSITION BACnetConstructedDataTransition"]] @@ -3084,7 +3128,7 @@ [simple BACnetEngineeringUnitsTagged('0', 'TagClass.APPLICATION_TAGS') units ] ] [*, 'UPDATE_INTERVAL' BACnetConstructedDataUpdateInterval - [simple BACnetApplicationTagUnsignedInteger updateInterval ] + [simple BACnetApplicationTagUnsignedInteger updateInterval ] ] //[*, 'UPDATE_KEY_SET_TIMEOUT' BACnetConstructedDataUpdateKeySetTimeout [validation '1 == 2' "TODO: implement me UPDATE_KEY_SET_TIMEOUT BACnetConstructedDataUpdateKeySetTimeout"]] //[*, 'UPDATE_TIME' BACnetConstructedDataUpdateTime [validation '1 == 2' "TODO: implement me UPDATE_TIME BACnetConstructedDataUpdateTime"]] @@ -3092,7 +3136,9 @@ //[*, 'USER_INFORMATION_REFERENCE' BACnetConstructedDataUserInformationReference [validation '1 == 2' "TODO: implement me USER_INFORMATION_REFERENCE BACnetConstructedDataUserInformationReference"]] //[*, 'USER_NAME' BACnetConstructedDataUserName [validation '1 == 2' "TODO: implement me USER_NAME BACnetConstructedDataUserName"]] //[*, 'USER_TYPE' BACnetConstructedDataUserType [validation '1 == 2' "TODO: implement me USER_TYPE BACnetConstructedDataUserType"]] - //[*, 'USES_REMAINING' BACnetConstructedDataUsesRemaining [validation '1 == 2' "TODO: implement me USES_REMAINING BACnetConstructedDataUsesRemaining"]] + [*, 'USES_REMAINING' BACnetConstructedDataUsesRemaining + [simple BACnetApplicationTagSignedInteger usesRemaining ] + ] //[*, 'UTC_OFFSET' BACnetConstructedDataUtcOffset [validation '1 == 2' "TODO: implement me UTC_OFFSET BACnetConstructedDataUtcOffset"]] //[*, 'UTC_TIME_SYNCHRONIZATION_RECIPIENTS' BACnetConstructedDataUtcTimeSynchronizationRecipients [validation '1 == 2' "TODO: implement me UTC_TIME_SYNCHRONIZATION_RECIPIENTS BACnetConstructedDataUtcTimeSynchronizationRecipients"]] //[*, 'VALID_SAMPLES' BACnetConstructedDataValidSamples [validation '1 == 2' "TODO: implement me VALID_SAMPLES BACnetConstructedDataValidSamples"]] @@ -3277,3 +3323,50 @@ [simple BACnetContextTagBoolean('4', 'BACnetDataType.BOOLEAN') enable ] ] + +[type BACnetCredentialAuthenticationFactor + [simple BACnetAccessAuthenticationFactorDisableTagged('0', 'TagClass.CONTEXT_SPECIFIC_TAGS') + disable ] + [simple BACnetAuthenticationFactorEnclosed('1') + authenticationFactor ] +] + +[type BACnetAuthenticationFactor + [simple BACnetAuthenticationFactorTypeTagged('0', 'TagClass.CONTEXT_SPECIFIC_TAGS') + formatType ] + [simple BACnetContextTagUnsignedInteger('1', 'BACnetDataType.UNSIGNED_INTEGER') + formatClass ] + [simple BACnetContextTagOctetString('2', 'BACnetDataType.OCTET_STRING') + value ] +] + +[type BACnetAuthenticationFactorFormat + [simple BACnetAuthenticationFactorTypeTagged('0', 'TagClass.CONTEXT_SPECIFIC_TAGS') + formatType ] + [optional BACnetVendorIdTagged('1', 'TagClass.CONTEXT_SPECIFIC_TAGS') + vendorId ] + [optional BACnetContextTagUnsignedInteger('2', 'BACnetDataType.UNSIGNED_INTEGER') + vendorFormat ] +] + +[type BACnetAuthenticationFactorEnclosed(uint 8 tagNumber) + [simple BACnetOpeningTag('tagNumber') + openingTag ] + [simple BACnetAuthenticationFactor + authenticationFactor ] + [simple BACnetClosingTag('tagNumber') + closingTag ] +] + +[type BACnetAssignedAccessRights + [simple BACnetDeviceObjectReferenceEnclosed('0') + assignedAccessRights ] + [simple BACnetContextTagBoolean('1', 'BACnetDataType.BOOLEAN') + enable ] +] + +[type BACnetAccessThreatLevel + [simple BACnetApplicationTagUnsignedInteger + threatLevel ] +] + diff --git a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BACnetObjectsDefinitions.java b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BACnetObjectsDefinitions.java index 85a8d63fe79..ebf983937e4 100644 --- a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BACnetObjectsDefinitions.java +++ b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/BACnetObjectsDefinitions.java @@ -40,7 +40,7 @@ public class BACnetObjectsDefinitions { /** * a map which property is contained in which objects(name) */ - static Map> propertyToObjectNameMap; + static Map> propertyToObjectNamesMap; /** * a map which property-type-combinations is contained in which objects(name) @@ -2482,13 +2482,13 @@ static String mapObjectNameToEnumName(BacNetObject bacNetObject) { } private static void createPropertyToObjectNameMap() { - propertyToObjectNameMap = new HashMap<>(); + propertyToObjectNamesMap = new HashMap<>(); bacNetObjects.forEach(bacNetObject -> { String bacNetObjectName = bacNetObject.name; bacNetObject.properties.forEach(bacNetProperty -> { String propertyIdentifier = bacNetProperty.propertyIdentifier; - propertyToObjectNameMap.putIfAbsent(propertyIdentifier, new LinkedList<>()); - propertyToObjectNameMap.get(propertyIdentifier).add(bacNetObjectName); + propertyToObjectNamesMap.putIfAbsent(propertyIdentifier, new LinkedList<>()); + propertyToObjectNamesMap.get(propertyIdentifier).add(bacNetObjectName); }); }); } @@ -2507,7 +2507,7 @@ private static void createPropertyTypeCombinationToObjectNameMap() { static void createPropertyIdToPropertyNameMap() { propertyIdToPropertyNameMap = new HashMap<>(); - propertyToObjectNameMap.keySet().forEach(propertyName -> propertyIdToPropertyNameMap.put(mapPropertyNameToEnumName(propertyName), propertyName)); + propertyToObjectNamesMap.keySet().forEach(propertyName -> propertyIdToPropertyNameMap.put(mapPropertyNameToEnumName(propertyName), propertyName)); } static String mapPropertyNameToEnumName(String propertyName) { diff --git a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java index dfbcb6f97d5..3278b7e0c36 100644 --- a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java +++ b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java @@ -101,20 +101,22 @@ Collection testThatEveryPropertyIsUsed() { @TestFactory Collection testUniqueUsagesAreMappedGeneric() { List tests = new LinkedList<>(); - propertyToObjectNameMap.forEach((propertyIdentifier, bacNetObjectNames) -> { - if (bacNetObjectNames.size() > 1) { - return; - } - String bacNetObjectName = bacNetObjectNames.get(0); - tests.add( - DynamicTest.dynamicTest("Unique property " + propertyIdentifier + " for " + bacNetObjectName, - () -> { - String searchedTypeName = "BACnetConstructedData" + propertyIdentifier; - searchedTypeName = searchedTypeName.replaceAll("_", ""); - assertNotNull(typeDefinitions.get(searchedTypeName), searchedTypeName + " not found"); - }) - ); - }); + new LinkedList<>(propertyToObjectNamesMap.entrySet()) + .stream() + .filter(propertyToObjectNamesEntry -> propertyToObjectNamesEntry.getValue().size() == 1) + .sorted(Comparator.comparing(stringListEntry -> stringListEntry.getValue().get(0))) + .forEach(propertyToObjectNameEntry -> { + String propertyIdentifier = propertyToObjectNameEntry.getKey(); + String bacNetObjectName = propertyToObjectNameEntry.getValue().get(0); + tests.add( + DynamicTest.dynamicTest(bacNetObjectName + " uses property " + propertyIdentifier + " uniquely", + () -> { + String searchedTypeName = "BACnetConstructedData" + propertyIdentifier; + searchedTypeName = searchedTypeName.replaceAll("_", ""); + assertNotNull(typeDefinitions.get(searchedTypeName), searchedTypeName + " not found"); + }) + ); + }); return tests; } @@ -134,7 +136,7 @@ void outputObjectChapters() { @Test void outputPropertyUsage() { - propertyToObjectNameMap.forEach((propertyIdentifier, bacNetObjectNames) -> LOGGER.info("property {} is used by {}", propertyIdentifier, bacNetObjectNames)); + propertyToObjectNamesMap.forEach((propertyIdentifier, bacNetObjectNames) -> LOGGER.info("property {} is used by {}", propertyIdentifier, bacNetObjectNames)); } @Test @@ -155,7 +157,7 @@ void outputTypeCombinationsSorted() { @Test void outputUniqueProperties() { - propertyToObjectNameMap.forEach((propertyIdentifier, bacNetObjectNames) -> { + propertyToObjectNamesMap.forEach((propertyIdentifier, bacNetObjectNames) -> { if (bacNetObjectNames.size() > 1) { return; } @@ -165,7 +167,7 @@ void outputUniqueProperties() { @Test void outputNonUniqueProperties() { - propertyToObjectNameMap.forEach((propertyIdentifier, bacNetObjectNames) -> { + propertyToObjectNamesMap.forEach((propertyIdentifier, bacNetObjectNames) -> { if (bacNetObjectNames.size() == 1) { return; }