From 0be992d35b83cd054c527de93a5491414f30ae17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Tue, 7 Jun 2022 19:09:45 +0200 Subject: [PATCH] feat(bacnet): implemented unique properties for device type - ACTIVE_COV_MULTIPLE_SUBSCRIPTIONS - ACTIVE_COV_SUBSCRIPTIONS - ACTIVE_VT_SESSIONS - APDU_SEGMENT_TIMEOUT - APDU_TIMEOUT - APPLICATION_SOFTWARE_VERSION - BACKUP_AND_RESTORE_STATE - BACKUP_FAILURE_TIMEOUT - BACKUP_PREPARATION_TIME - CONFIGURATION_FILES - DATABASE_REVISION - DAYLIGHT_SAVINGS_STATUS - DEPLOYED_PROFILE_LOCATION - DEVICE_ADDRESS_BINDING - FIRMWARE_REVISION - LAST_RESTART_REASON - LAST_RESTORE_TIME - LOCAL_DATE - LOCAL_TIME - LOCATION - MAX_APDU_LENGTH_ACCEPTED - MAX_SEGMENTS_ACCEPTED - MODEL_NAME - NUMBER_OF_APDU_RETRIES - OBJECT_LIST - PROTOCOL_OBJECT_TYPES_SUPPORTED - PROTOCOL_REVISION - PROTOCOL_SERVICES_SUPPORTED - PROTOCOL_VERSION - RESTART_NOTIFICATION_RECIPIENTS - RESTORE_COMPLETION_TIME - RESTORE_PREPARATION_TIME - SEGMENTATION_SUPPORTED - SERIAL_NUMBER - STRUCTURED_OBJECT_LIST - SYSTEM_STATUS - TIME_OF_DEVICE_RESTART - TIME_SYNCHRONIZATION_INTERVAL - TIME_SYNCHRONIZATION_RECIPIENTS - UTC_OFFSET - UTC_TIME_SYNCHRONIZATION_RECIPIENTS - VENDOR_IDENTIFIER - VENDOR_NAME - VT_CLASSES_SUPPORTED --- .../bacnetip/readwrite/ParserHelper.go | 38 ++ .../bacnetip/readwrite/XmlParserHelper.go | 42 ++ .../readwrite/model/BACnetAddressEnclosed.go | 46 +-- .../model/BACnetCOVMultipleSubscription.go | 300 ++++++++++++++ ...ptionListOfCovSubscriptionSpecification.go | 248 +++++++++++ ...ListOfCovSubscriptionSpecificationEntry.go | 195 +++++++++ ...onSpecificationEntryListOfCovReferences.go | 248 +++++++++++ ...cificationEntryListOfCovReferencesEntry.go | 245 +++++++++++ .../readwrite/model/BACnetCOVSubscription.go | 315 ++++++++++++++ .../readwrite/model/BACnetConstructedData.go | 88 ++++ ...BACnetConstructedDataAPDUSegmentTimeout.go | 211 ++++++++++ .../model/BACnetConstructedDataAPDUTimeout.go | 211 ++++++++++ ...uctedDataActiveCOVMultipleSubscriptions.go | 226 ++++++++++ ...etConstructedDataActiveCOVSubscriptions.go | 226 ++++++++++ .../BACnetConstructedDataActiveVTSessions.go | 226 ++++++++++ ...nstructedDataApplicationSoftwareVersion.go | 211 ++++++++++ ...netConstructedDataBackupAndRestoreState.go | 211 ++++++++++ ...CnetConstructedDataBackupFailureTimeout.go | 211 ++++++++++ ...netConstructedDataBackupPreparationTime.go | 211 ++++++++++ ...BACnetConstructedDataConfigurationFiles.go | 226 ++++++++++ .../BACnetConstructedDataDatabaseRevision.go | 211 ++++++++++ ...netConstructedDataDaylightSavingsStatus.go | 211 ++++++++++ ...tConstructedDataDeployedProfileLocation.go | 211 ++++++++++ ...CnetConstructedDataDeviceAddressBinding.go | 226 ++++++++++ .../BACnetConstructedDataFirmwareRevision.go | 211 ++++++++++ .../BACnetConstructedDataLastRestartReason.go | 211 ++++++++++ .../BACnetConstructedDataLastRestoreTime.go | 211 ++++++++++ .../model/BACnetConstructedDataLocalDate.go | 211 ++++++++++ .../model/BACnetConstructedDataLocalTime.go | 211 ++++++++++ .../model/BACnetConstructedDataLocation.go | 211 ++++++++++ ...netConstructedDataMaxAPDULengthAccepted.go | 211 ++++++++++ ...ACnetConstructedDataMaxSegmentsAccepted.go | 211 ++++++++++ .../model/BACnetConstructedDataModelName.go | 211 ++++++++++ ...ACnetConstructedDataNumberOfAPDURetries.go | 211 ++++++++++ .../model/BACnetConstructedDataObjectList.go | 226 ++++++++++ ...tructedDataProtocolObjectTypesSupported.go | 211 ++++++++++ .../BACnetConstructedDataProtocolRevision.go | 211 ++++++++++ ...onstructedDataProtocolServicesSupported.go | 211 ++++++++++ .../BACnetConstructedDataProtocolVersion.go | 211 ++++++++++ ...ructedDataRestartNotificationRecipients.go | 226 ++++++++++ ...netConstructedDataRestoreCompletionTime.go | 211 ++++++++++ ...etConstructedDataRestorePreparationTime.go | 211 ++++++++++ ...netConstructedDataSegmentationSupported.go | 211 ++++++++++ .../BACnetConstructedDataSerialNumber.go | 211 ++++++++++ ...CnetConstructedDataStructuredObjectList.go | 226 ++++++++++ .../BACnetConstructedDataSystemStatus.go | 211 ++++++++++ ...ACnetConstructedDataTimeOfDeviceRestart.go | 211 ++++++++++ ...structedDataTimeSynchronizationInterval.go | 211 ++++++++++ ...ructedDataTimeSynchronizationRecipients.go | 226 ++++++++++ .../model/BACnetConstructedDataUTCOffset.go | 211 ++++++++++ ...tedDataUTCTimeSynchronizationRecipients.go | 226 ++++++++++ ...BACnetConstructedDataVTClassesSupported.go | 226 ++++++++++ .../BACnetConstructedDataVendorIdentifier.go | 211 ++++++++++ .../model/BACnetConstructedDataVendorName.go | 211 ++++++++++ ...BACnetObjectIdentifierOrUnsignedInteger.go | 320 +++++++++++++++ .../model/BACnetObjectTypesSupportedTagged.go | 388 ++++++++++++++++++ .../model/BACnetServicesSupportedTagged.go | 388 ++++++++++++++++++ .../readwrite/model/BACnetVTSession.go | 230 +++++++++++ .../java/bacnetip/RandomPackagesTest.java | 312 ++++++-------- .../bacnetip/bacnet-bit-strings.mspec | 120 +++--- .../protocols/bacnetip/bacnet-enums.mspec | 300 +++++++------- .../protocols/bacnetip/bacnetip.mspec | 318 +++++++++++--- .../script/produceTaggedBitStrings.groovy | 5 +- 63 files changed, 13129 insertions(+), 466 deletions(-) create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscription.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetCOVSubscription.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUSegmentTimeout.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUTimeout.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVMultipleSubscriptions.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVSubscriptions.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveVTSessions.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataApplicationSoftwareVersion.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupAndRestoreState.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupFailureTimeout.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupPreparationTime.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataConfigurationFiles.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatabaseRevision.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaylightSavingsStatus.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeployedProfileLocation.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceAddressBinding.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFirmwareRevision.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestartReason.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestoreTime.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalDate.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalTime.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocation.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxAPDULengthAccepted.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxSegmentsAccepted.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataModelName.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfAPDURetries.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectList.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolObjectTypesSupported.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolRevision.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolServicesSupported.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolVersion.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestartNotificationRecipients.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestoreCompletionTime.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestorePreparationTime.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSegmentationSupported.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSerialNumber.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStructuredObjectList.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSystemStatus.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfDeviceRestart.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationInterval.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationRecipients.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCOffset.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCTimeSynchronizationRecipients.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVTClassesSupported.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorIdentifier.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorName.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetObjectIdentifierOrUnsignedInteger.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypesSupportedTagged.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetServicesSupportedTagged.go create mode 100644 plc4go/protocols/bacnetip/readwrite/model/BACnetVTSession.go diff --git a/plc4go/protocols/bacnetip/readwrite/ParserHelper.go b/plc4go/protocols/bacnetip/readwrite/ParserHelper.go index 1b49121e693..31e7121f1d3 100644 --- a/plc4go/protocols/bacnetip/readwrite/ParserHelper.go +++ b/plc4go/protocols/bacnetip/readwrite/ParserHelper.go @@ -193,6 +193,13 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetAccessRuleTimeRangeSpecifierTaggedParse(io, tagNumber, tagClass) + case "BACnetObjectTypesSupportedTagged": + tagNumber, err := utils.StrToUint8(arguments[0]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + tagClass := model.TagClassByName(arguments[1]) + return model.BACnetObjectTypesSupportedTaggedParse(io, tagNumber, tagClass) case "BVLCBroadcastDistributionTableEntry": return model.BVLCBroadcastDistributionTableEntryParse(io) case "BACnetBackupStateTagged": @@ -208,6 +215,12 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util return nil, errors.Wrap(err, "Error parsing") } return model.BACnetEventParameterChangeOfLifeSavetyListOfLifeSavetyAlarmValuesParse(io, tagNumber) + case "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification": + tagNumber, err := utils.StrToUint8(arguments[0]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationParse(io, tagNumber) case "BACnetDeviceStatusTagged": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -267,6 +280,12 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util return nil, errors.Wrap(err, "Error parsing") } return model.BACnetConfirmedServiceRequestParse(io, serviceRequestLength) + case "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences": + tagNumber, err := utils.StrToUint8(arguments[0]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesParse(io, tagNumber) case "BACnetTagPayloadUnsignedInteger": actualLength, err := utils.StrToUint32(arguments[0]) if err != nil { @@ -422,6 +441,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetAccessRuleLocationSpecifierTaggedParse(io, tagNumber, tagClass) + case "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry": + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntryParse(io) case "BACnetAuthenticationFactorFormat": return model.BACnetAuthenticationFactorFormatParse(io) case "BACnetMaintenanceTagged": @@ -541,6 +562,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetLifeSafetyStateTaggedParse(io, tagNumber, tagClass) + case "BACnetVTSession": + return model.BACnetVTSessionParse(io) case "BACnetEventTimestampsEnclosed": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -601,6 +624,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.MaxApduLengthAcceptedTaggedParse(io, tagNumber, tagClass) + case "BACnetObjectIdentifierOrUnsignedInteger": + return model.BACnetObjectIdentifierOrUnsignedIntegerParse(io) case "BACnetPropertyStatesEnclosed": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -676,6 +701,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util case "BACnetPropertyValue": objectTypeArgument := model.BACnetObjectTypeByName(arguments[0]) return model.BACnetPropertyValueParse(io, objectTypeArgument) + case "BACnetCOVSubscription": + return model.BACnetCOVSubscriptionParse(io) case "BACnetFaultParameterFaultLifeSafetyListOfFaultValues": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -836,6 +863,13 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetDoorAlarmStateTaggedParse(io, tagNumber, tagClass) + case "BACnetServicesSupportedTagged": + tagNumber, err := utils.StrToUint8(arguments[0]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + tagClass := model.TagClassByName(arguments[1]) + return model.BACnetServicesSupportedTaggedParse(io, tagNumber, tagClass) case "BACnetWriteStatusTagged": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -1251,6 +1285,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util return nil, errors.Wrap(err, "Error parsing") } return model.BACnetTimeStampsEnclosedParse(io, tagNumber) + case "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry": + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryParse(io) case "BACnetHostAddressEnclosed": tagNumber, err := utils.StrToUint8(arguments[0]) if err != nil { @@ -1282,6 +1318,8 @@ func (m BacnetipParserHelper) Parse(typeName string, arguments []string, io util } tagClass := model.TagClassByName(arguments[1]) return model.BACnetProtocolLevelTaggedParse(io, tagNumber, tagClass) + case "BACnetCOVMultipleSubscription": + return model.BACnetCOVMultipleSubscriptionParse(io) case "BACnetActionList": return model.BACnetActionListParse(io) case "BACnetLightingCommand": diff --git a/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go b/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go index 63f4872c1cb..f9ec3a57748 100644 --- a/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go +++ b/plc4go/protocols/bacnetip/readwrite/XmlParserHelper.go @@ -226,6 +226,14 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser tagNumber := uint8(parsedUint0) tagClass := model.TagClassByName(parserArguments[1]) return model.BACnetAccessRuleTimeRangeSpecifierTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) + case "BACnetObjectTypesSupportedTagged": + parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) + if err != nil { + return nil, err + } + tagNumber := uint8(parsedUint0) + tagClass := model.TagClassByName(parserArguments[1]) + return model.BACnetObjectTypesSupportedTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) case "BVLCBroadcastDistributionTableEntry": return model.BVLCBroadcastDistributionTableEntryParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetBackupStateTagged": @@ -243,6 +251,13 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser } tagNumber := uint8(parsedUint0) return model.BACnetEventParameterChangeOfLifeSavetyListOfLifeSavetyAlarmValuesParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber) + case "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification": + parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) + if err != nil { + return nil, err + } + tagNumber := uint8(parsedUint0) + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber) case "BACnetDeviceStatusTagged": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -310,6 +325,13 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser } serviceRequestLength := uint16(parsedUint0) return model.BACnetConfirmedServiceRequestParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), serviceRequestLength) + case "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences": + parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) + if err != nil { + return nil, err + } + tagNumber := uint8(parsedUint0) + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber) case "BACnetTagPayloadUnsignedInteger": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 32) if err != nil { @@ -486,6 +508,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 "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry": + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntryParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetAuthenticationFactorFormat": return model.BACnetAuthenticationFactorFormatParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetMaintenanceTagged": @@ -620,6 +644,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser tagNumber := uint8(parsedUint0) tagClass := model.TagClassByName(parserArguments[1]) return model.BACnetLifeSafetyStateTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) + case "BACnetVTSession": + return model.BACnetVTSessionParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetEventTimestampsEnclosed": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -688,6 +714,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser tagNumber := uint8(parsedUint0) tagClass := model.TagClassByName(parserArguments[1]) return model.MaxApduLengthAcceptedTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) + case "BACnetObjectIdentifierOrUnsignedInteger": + return model.BACnetObjectIdentifierOrUnsignedIntegerParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetPropertyStatesEnclosed": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -772,6 +800,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser case "BACnetPropertyValue": objectTypeArgument := model.BACnetObjectTypeByName(parserArguments[0]) return model.BACnetPropertyValueParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), objectTypeArgument) + case "BACnetCOVSubscription": + return model.BACnetCOVSubscriptionParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetFaultParameterFaultLifeSafetyListOfFaultValues": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -954,6 +984,14 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser tagNumber := uint8(parsedUint0) tagClass := model.TagClassByName(parserArguments[1]) return model.BACnetDoorAlarmStateTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) + case "BACnetServicesSupportedTagged": + parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) + if err != nil { + return nil, err + } + tagNumber := uint8(parsedUint0) + tagClass := model.TagClassByName(parserArguments[1]) + return model.BACnetServicesSupportedTaggedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber, tagClass) case "BACnetWriteStatusTagged": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -1418,6 +1456,8 @@ func (m BacnetipXmlParserHelper) Parse(typeName string, xmlString string, parser } tagNumber := uint8(parsedUint0) return model.BACnetTimeStampsEnclosedParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), tagNumber) + case "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry": + return model.BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetHostAddressEnclosed": parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 8) if err != nil { @@ -1453,6 +1493,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 "BACnetCOVMultipleSubscription": + return model.BACnetCOVMultipleSubscriptionParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetActionList": return model.BACnetActionListParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BACnetLightingCommand": diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressEnclosed.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressEnclosed.go index 14144eca592..ddb2cc88901 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressEnclosed.go +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetAddressEnclosed.go @@ -29,7 +29,7 @@ import ( // BACnetAddressEnclosed is the data-structure of this message type BACnetAddressEnclosed struct { OpeningTag *BACnetOpeningTag - Recipient *BACnetRecipient + Address *BACnetAddress ClosingTag *BACnetClosingTag // Arguments. @@ -40,8 +40,8 @@ type BACnetAddressEnclosed struct { type IBACnetAddressEnclosed interface { // GetOpeningTag returns OpeningTag (property field) GetOpeningTag() *BACnetOpeningTag - // GetRecipient returns Recipient (property field) - GetRecipient() *BACnetRecipient + // GetAddress returns Address (property field) + GetAddress() *BACnetAddress // GetClosingTag returns ClosingTag (property field) GetClosingTag() *BACnetClosingTag // GetLengthInBytes returns the length in bytes @@ -61,8 +61,8 @@ func (m *BACnetAddressEnclosed) GetOpeningTag() *BACnetOpeningTag { return m.OpeningTag } -func (m *BACnetAddressEnclosed) GetRecipient() *BACnetRecipient { - return m.Recipient +func (m *BACnetAddressEnclosed) GetAddress() *BACnetAddress { + return m.Address } func (m *BACnetAddressEnclosed) GetClosingTag() *BACnetClosingTag { @@ -75,8 +75,8 @@ func (m *BACnetAddressEnclosed) GetClosingTag() *BACnetClosingTag { /////////////////////////////////////////////////////////// // NewBACnetAddressEnclosed factory function for BACnetAddressEnclosed -func NewBACnetAddressEnclosed(openingTag *BACnetOpeningTag, recipient *BACnetRecipient, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetAddressEnclosed { - return &BACnetAddressEnclosed{OpeningTag: openingTag, Recipient: recipient, ClosingTag: closingTag, TagNumber: tagNumber} +func NewBACnetAddressEnclosed(openingTag *BACnetOpeningTag, address *BACnetAddress, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetAddressEnclosed { + return &BACnetAddressEnclosed{OpeningTag: openingTag, Address: address, ClosingTag: closingTag, TagNumber: tagNumber} } func CastBACnetAddressEnclosed(structType interface{}) *BACnetAddressEnclosed { @@ -103,8 +103,8 @@ func (m *BACnetAddressEnclosed) GetLengthInBitsConditional(lastItem bool) uint16 // Simple field (openingTag) lengthInBits += m.OpeningTag.GetLengthInBits() - // Simple field (recipient) - lengthInBits += m.Recipient.GetLengthInBits() + // Simple field (address) + lengthInBits += m.Address.GetLengthInBits() // Simple field (closingTag) lengthInBits += m.ClosingTag.GetLengthInBits() @@ -138,16 +138,16 @@ func BACnetAddressEnclosedParse(readBuffer utils.ReadBuffer, tagNumber uint8) (* return nil, closeErr } - // Simple Field (recipient) - if pullErr := readBuffer.PullContext("recipient"); pullErr != nil { + // Simple Field (address) + if pullErr := readBuffer.PullContext("address"); pullErr != nil { return nil, pullErr } - _recipient, _recipientErr := BACnetRecipientParse(readBuffer) - if _recipientErr != nil { - return nil, errors.Wrap(_recipientErr, "Error parsing 'recipient' field") + _address, _addressErr := BACnetAddressParse(readBuffer) + if _addressErr != nil { + return nil, errors.Wrap(_addressErr, "Error parsing 'address' field") } - recipient := CastBACnetRecipient(_recipient) - if closeErr := readBuffer.CloseContext("recipient"); closeErr != nil { + address := CastBACnetAddress(_address) + if closeErr := readBuffer.CloseContext("address"); closeErr != nil { return nil, closeErr } @@ -169,7 +169,7 @@ func BACnetAddressEnclosedParse(readBuffer utils.ReadBuffer, tagNumber uint8) (* } // Create the instance - return NewBACnetAddressEnclosed(openingTag, recipient, closingTag, tagNumber), nil + return NewBACnetAddressEnclosed(openingTag, address, closingTag, tagNumber), nil } func (m *BACnetAddressEnclosed) Serialize(writeBuffer utils.WriteBuffer) error { @@ -191,16 +191,16 @@ func (m *BACnetAddressEnclosed) Serialize(writeBuffer utils.WriteBuffer) error { return errors.Wrap(_openingTagErr, "Error serializing 'openingTag' field") } - // Simple Field (recipient) - if pushErr := writeBuffer.PushContext("recipient"); pushErr != nil { + // Simple Field (address) + if pushErr := writeBuffer.PushContext("address"); pushErr != nil { return pushErr } - _recipientErr := m.Recipient.Serialize(writeBuffer) - if popErr := writeBuffer.PopContext("recipient"); popErr != nil { + _addressErr := m.Address.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("address"); popErr != nil { return popErr } - if _recipientErr != nil { - return errors.Wrap(_recipientErr, "Error serializing 'recipient' field") + if _addressErr != nil { + return errors.Wrap(_addressErr, "Error serializing 'address' field") } // Simple Field (closingTag) diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscription.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscription.go new file mode 100644 index 00000000000..4ce5d79be49 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscription.go @@ -0,0 +1,300 @@ +/* + * 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. + +// BACnetCOVMultipleSubscription is the data-structure of this message +type BACnetCOVMultipleSubscription struct { + Recipient *BACnetRecipientProcessEnclosed + IssueConfirmedNotifications *BACnetContextTagBoolean + TimeRemaining *BACnetContextTagUnsignedInteger + MaxNotificationDelay *BACnetContextTagUnsignedInteger + ListOfCovSubscriptionSpecification *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification +} + +// IBACnetCOVMultipleSubscription is the corresponding interface of BACnetCOVMultipleSubscription +type IBACnetCOVMultipleSubscription interface { + // GetRecipient returns Recipient (property field) + GetRecipient() *BACnetRecipientProcessEnclosed + // GetIssueConfirmedNotifications returns IssueConfirmedNotifications (property field) + GetIssueConfirmedNotifications() *BACnetContextTagBoolean + // GetTimeRemaining returns TimeRemaining (property field) + GetTimeRemaining() *BACnetContextTagUnsignedInteger + // GetMaxNotificationDelay returns MaxNotificationDelay (property field) + GetMaxNotificationDelay() *BACnetContextTagUnsignedInteger + // GetListOfCovSubscriptionSpecification returns ListOfCovSubscriptionSpecification (property field) + GetListOfCovSubscriptionSpecification() *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification + // 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 *BACnetCOVMultipleSubscription) GetRecipient() *BACnetRecipientProcessEnclosed { + return m.Recipient +} + +func (m *BACnetCOVMultipleSubscription) GetIssueConfirmedNotifications() *BACnetContextTagBoolean { + return m.IssueConfirmedNotifications +} + +func (m *BACnetCOVMultipleSubscription) GetTimeRemaining() *BACnetContextTagUnsignedInteger { + return m.TimeRemaining +} + +func (m *BACnetCOVMultipleSubscription) GetMaxNotificationDelay() *BACnetContextTagUnsignedInteger { + return m.MaxNotificationDelay +} + +func (m *BACnetCOVMultipleSubscription) GetListOfCovSubscriptionSpecification() *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification { + return m.ListOfCovSubscriptionSpecification +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetCOVMultipleSubscription factory function for BACnetCOVMultipleSubscription +func NewBACnetCOVMultipleSubscription(recipient *BACnetRecipientProcessEnclosed, issueConfirmedNotifications *BACnetContextTagBoolean, timeRemaining *BACnetContextTagUnsignedInteger, maxNotificationDelay *BACnetContextTagUnsignedInteger, listOfCovSubscriptionSpecification *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) *BACnetCOVMultipleSubscription { + return &BACnetCOVMultipleSubscription{Recipient: recipient, IssueConfirmedNotifications: issueConfirmedNotifications, TimeRemaining: timeRemaining, MaxNotificationDelay: maxNotificationDelay, ListOfCovSubscriptionSpecification: listOfCovSubscriptionSpecification} +} + +func CastBACnetCOVMultipleSubscription(structType interface{}) *BACnetCOVMultipleSubscription { + if casted, ok := structType.(BACnetCOVMultipleSubscription); ok { + return &casted + } + if casted, ok := structType.(*BACnetCOVMultipleSubscription); ok { + return casted + } + return nil +} + +func (m *BACnetCOVMultipleSubscription) GetTypeName() string { + return "BACnetCOVMultipleSubscription" +} + +func (m *BACnetCOVMultipleSubscription) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetCOVMultipleSubscription) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (recipient) + lengthInBits += m.Recipient.GetLengthInBits() + + // Simple field (issueConfirmedNotifications) + lengthInBits += m.IssueConfirmedNotifications.GetLengthInBits() + + // Simple field (timeRemaining) + lengthInBits += m.TimeRemaining.GetLengthInBits() + + // Simple field (maxNotificationDelay) + lengthInBits += m.MaxNotificationDelay.GetLengthInBits() + + // Simple field (listOfCovSubscriptionSpecification) + lengthInBits += m.ListOfCovSubscriptionSpecification.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetCOVMultipleSubscription) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetCOVMultipleSubscriptionParse(readBuffer utils.ReadBuffer) (*BACnetCOVMultipleSubscription, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetCOVMultipleSubscription"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (recipient) + if pullErr := readBuffer.PullContext("recipient"); pullErr != nil { + return nil, pullErr + } + _recipient, _recipientErr := BACnetRecipientProcessEnclosedParse(readBuffer, uint8(uint8(0))) + if _recipientErr != nil { + return nil, errors.Wrap(_recipientErr, "Error parsing 'recipient' field") + } + recipient := CastBACnetRecipientProcessEnclosed(_recipient) + if closeErr := readBuffer.CloseContext("recipient"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (issueConfirmedNotifications) + if pullErr := readBuffer.PullContext("issueConfirmedNotifications"); pullErr != nil { + return nil, pullErr + } + _issueConfirmedNotifications, _issueConfirmedNotificationsErr := BACnetContextTagParse(readBuffer, uint8(uint8(1)), BACnetDataType(BACnetDataType_BOOLEAN)) + if _issueConfirmedNotificationsErr != nil { + return nil, errors.Wrap(_issueConfirmedNotificationsErr, "Error parsing 'issueConfirmedNotifications' field") + } + issueConfirmedNotifications := CastBACnetContextTagBoolean(_issueConfirmedNotifications) + if closeErr := readBuffer.CloseContext("issueConfirmedNotifications"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (timeRemaining) + if pullErr := readBuffer.PullContext("timeRemaining"); pullErr != nil { + return nil, pullErr + } + _timeRemaining, _timeRemainingErr := BACnetContextTagParse(readBuffer, uint8(uint8(2)), BACnetDataType(BACnetDataType_UNSIGNED_INTEGER)) + if _timeRemainingErr != nil { + return nil, errors.Wrap(_timeRemainingErr, "Error parsing 'timeRemaining' field") + } + timeRemaining := CastBACnetContextTagUnsignedInteger(_timeRemaining) + if closeErr := readBuffer.CloseContext("timeRemaining"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (maxNotificationDelay) + if pullErr := readBuffer.PullContext("maxNotificationDelay"); pullErr != nil { + return nil, pullErr + } + _maxNotificationDelay, _maxNotificationDelayErr := BACnetContextTagParse(readBuffer, uint8(uint8(3)), BACnetDataType(BACnetDataType_UNSIGNED_INTEGER)) + if _maxNotificationDelayErr != nil { + return nil, errors.Wrap(_maxNotificationDelayErr, "Error parsing 'maxNotificationDelay' field") + } + maxNotificationDelay := CastBACnetContextTagUnsignedInteger(_maxNotificationDelay) + if closeErr := readBuffer.CloseContext("maxNotificationDelay"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (listOfCovSubscriptionSpecification) + if pullErr := readBuffer.PullContext("listOfCovSubscriptionSpecification"); pullErr != nil { + return nil, pullErr + } + _listOfCovSubscriptionSpecification, _listOfCovSubscriptionSpecificationErr := BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationParse(readBuffer, uint8(uint8(4))) + if _listOfCovSubscriptionSpecificationErr != nil { + return nil, errors.Wrap(_listOfCovSubscriptionSpecificationErr, "Error parsing 'listOfCovSubscriptionSpecification' field") + } + listOfCovSubscriptionSpecification := CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification(_listOfCovSubscriptionSpecification) + if closeErr := readBuffer.CloseContext("listOfCovSubscriptionSpecification"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetCOVMultipleSubscription"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetCOVMultipleSubscription(recipient, issueConfirmedNotifications, timeRemaining, maxNotificationDelay, listOfCovSubscriptionSpecification), nil +} + +func (m *BACnetCOVMultipleSubscription) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetCOVMultipleSubscription"); pushErr != nil { + return pushErr + } + + // Simple Field (recipient) + if pushErr := writeBuffer.PushContext("recipient"); pushErr != nil { + return pushErr + } + _recipientErr := m.Recipient.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("recipient"); popErr != nil { + return popErr + } + if _recipientErr != nil { + return errors.Wrap(_recipientErr, "Error serializing 'recipient' field") + } + + // Simple Field (issueConfirmedNotifications) + if pushErr := writeBuffer.PushContext("issueConfirmedNotifications"); pushErr != nil { + return pushErr + } + _issueConfirmedNotificationsErr := m.IssueConfirmedNotifications.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("issueConfirmedNotifications"); popErr != nil { + return popErr + } + if _issueConfirmedNotificationsErr != nil { + return errors.Wrap(_issueConfirmedNotificationsErr, "Error serializing 'issueConfirmedNotifications' field") + } + + // Simple Field (timeRemaining) + if pushErr := writeBuffer.PushContext("timeRemaining"); pushErr != nil { + return pushErr + } + _timeRemainingErr := m.TimeRemaining.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("timeRemaining"); popErr != nil { + return popErr + } + if _timeRemainingErr != nil { + return errors.Wrap(_timeRemainingErr, "Error serializing 'timeRemaining' field") + } + + // Simple Field (maxNotificationDelay) + if pushErr := writeBuffer.PushContext("maxNotificationDelay"); pushErr != nil { + return pushErr + } + _maxNotificationDelayErr := m.MaxNotificationDelay.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("maxNotificationDelay"); popErr != nil { + return popErr + } + if _maxNotificationDelayErr != nil { + return errors.Wrap(_maxNotificationDelayErr, "Error serializing 'maxNotificationDelay' field") + } + + // Simple Field (listOfCovSubscriptionSpecification) + if pushErr := writeBuffer.PushContext("listOfCovSubscriptionSpecification"); pushErr != nil { + return pushErr + } + _listOfCovSubscriptionSpecificationErr := m.ListOfCovSubscriptionSpecification.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("listOfCovSubscriptionSpecification"); popErr != nil { + return popErr + } + if _listOfCovSubscriptionSpecificationErr != nil { + return errors.Wrap(_listOfCovSubscriptionSpecificationErr, "Error serializing 'listOfCovSubscriptionSpecification' field") + } + + if popErr := writeBuffer.PopContext("BACnetCOVMultipleSubscription"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetCOVMultipleSubscription) 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/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification.go new file mode 100644 index 00000000000..9a730fe1adb --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification.go @@ -0,0 +1,248 @@ +/* + * 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. + +// BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification is the data-structure of this message +type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification struct { + OpeningTag *BACnetOpeningTag + ListOfCovSubscriptionSpecificationEntry []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry + ClosingTag *BACnetClosingTag + + // Arguments. + TagNumber uint8 +} + +// IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification is the corresponding interface of BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification +type IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification interface { + // GetOpeningTag returns OpeningTag (property field) + GetOpeningTag() *BACnetOpeningTag + // GetListOfCovSubscriptionSpecificationEntry returns ListOfCovSubscriptionSpecificationEntry (property field) + GetListOfCovSubscriptionSpecificationEntry() []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry + // 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 *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) GetOpeningTag() *BACnetOpeningTag { + return m.OpeningTag +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) GetListOfCovSubscriptionSpecificationEntry() []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry { + return m.ListOfCovSubscriptionSpecificationEntry +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) GetClosingTag() *BACnetClosingTag { + return m.ClosingTag +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification factory function for BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification +func NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification(openingTag *BACnetOpeningTag, listOfCovSubscriptionSpecificationEntry []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification { + return &BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification{OpeningTag: openingTag, ListOfCovSubscriptionSpecificationEntry: listOfCovSubscriptionSpecificationEntry, ClosingTag: closingTag, TagNumber: tagNumber} +} + +func CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification(structType interface{}) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification { + if casted, ok := structType.(BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification); ok { + return &casted + } + if casted, ok := structType.(*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification); ok { + return casted + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) GetTypeName() string { + return "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification" +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (openingTag) + lengthInBits += m.OpeningTag.GetLengthInBits() + + // Array field + if len(m.ListOfCovSubscriptionSpecificationEntry) > 0 { + for _, element := range m.ListOfCovSubscriptionSpecificationEntry { + lengthInBits += element.GetLengthInBits() + } + } + + // Simple field (closingTag) + lengthInBits += m.ClosingTag.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationParse(readBuffer utils.ReadBuffer, tagNumber uint8) (*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification"); 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 + } + + // Array field (listOfCovSubscriptionSpecificationEntry) + if pullErr := readBuffer.PullContext("listOfCovSubscriptionSpecificationEntry", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + listOfCovSubscriptionSpecificationEntry := make([]*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'listOfCovSubscriptionSpecificationEntry' field") + } + listOfCovSubscriptionSpecificationEntry = append(listOfCovSubscriptionSpecificationEntry, CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry(_item)) + + } + } + if closeErr := readBuffer.CloseContext("listOfCovSubscriptionSpecificationEntry", utils.WithRenderAsList(true)); 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("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification(openingTag, listOfCovSubscriptionSpecificationEntry, closingTag, tagNumber), nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification"); 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") + } + + // Array Field (listOfCovSubscriptionSpecificationEntry) + if m.ListOfCovSubscriptionSpecificationEntry != nil { + if pushErr := writeBuffer.PushContext("listOfCovSubscriptionSpecificationEntry", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ListOfCovSubscriptionSpecificationEntry { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'listOfCovSubscriptionSpecificationEntry' field") + } + } + if popErr := writeBuffer.PopContext("listOfCovSubscriptionSpecificationEntry", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // 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("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification) 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/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry.go new file mode 100644 index 00000000000..c643b124c3b --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry.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. + +// BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry is the data-structure of this message +type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry struct { + MonitoredObjectIdentifier *BACnetContextTagObjectIdentifier + ListOfCovReferences *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences +} + +// IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry is the corresponding interface of BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry +type IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry interface { + // GetMonitoredObjectIdentifier returns MonitoredObjectIdentifier (property field) + GetMonitoredObjectIdentifier() *BACnetContextTagObjectIdentifier + // GetListOfCovReferences returns ListOfCovReferences (property field) + GetListOfCovReferences() *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences + // 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 *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) GetMonitoredObjectIdentifier() *BACnetContextTagObjectIdentifier { + return m.MonitoredObjectIdentifier +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) GetListOfCovReferences() *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences { + return m.ListOfCovReferences +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry factory function for BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry +func NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry(monitoredObjectIdentifier *BACnetContextTagObjectIdentifier, listOfCovReferences *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry { + return &BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry{MonitoredObjectIdentifier: monitoredObjectIdentifier, ListOfCovReferences: listOfCovReferences} +} + +func CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry(structType interface{}) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry { + if casted, ok := structType.(BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry); ok { + return &casted + } + if casted, ok := structType.(*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry); ok { + return casted + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) GetTypeName() string { + return "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry" +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (monitoredObjectIdentifier) + lengthInBits += m.MonitoredObjectIdentifier.GetLengthInBits() + + // Simple field (listOfCovReferences) + lengthInBits += m.ListOfCovReferences.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryParse(readBuffer utils.ReadBuffer) (*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (monitoredObjectIdentifier) + if pullErr := readBuffer.PullContext("monitoredObjectIdentifier"); pullErr != nil { + return nil, pullErr + } + _monitoredObjectIdentifier, _monitoredObjectIdentifierErr := BACnetContextTagParse(readBuffer, uint8(uint8(0)), BACnetDataType(BACnetDataType_BACNET_OBJECT_IDENTIFIER)) + if _monitoredObjectIdentifierErr != nil { + return nil, errors.Wrap(_monitoredObjectIdentifierErr, "Error parsing 'monitoredObjectIdentifier' field") + } + monitoredObjectIdentifier := CastBACnetContextTagObjectIdentifier(_monitoredObjectIdentifier) + if closeErr := readBuffer.CloseContext("monitoredObjectIdentifier"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (listOfCovReferences) + if pullErr := readBuffer.PullContext("listOfCovReferences"); pullErr != nil { + return nil, pullErr + } + _listOfCovReferences, _listOfCovReferencesErr := BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesParse(readBuffer, uint8(uint8(1))) + if _listOfCovReferencesErr != nil { + return nil, errors.Wrap(_listOfCovReferencesErr, "Error parsing 'listOfCovReferences' field") + } + listOfCovReferences := CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences(_listOfCovReferences) + if closeErr := readBuffer.CloseContext("listOfCovReferences"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry(monitoredObjectIdentifier, listOfCovReferences), nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry"); pushErr != nil { + return pushErr + } + + // Simple Field (monitoredObjectIdentifier) + if pushErr := writeBuffer.PushContext("monitoredObjectIdentifier"); pushErr != nil { + return pushErr + } + _monitoredObjectIdentifierErr := m.MonitoredObjectIdentifier.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("monitoredObjectIdentifier"); popErr != nil { + return popErr + } + if _monitoredObjectIdentifierErr != nil { + return errors.Wrap(_monitoredObjectIdentifierErr, "Error serializing 'monitoredObjectIdentifier' field") + } + + // Simple Field (listOfCovReferences) + if pushErr := writeBuffer.PushContext("listOfCovReferences"); pushErr != nil { + return pushErr + } + _listOfCovReferencesErr := m.ListOfCovReferences.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("listOfCovReferences"); popErr != nil { + return popErr + } + if _listOfCovReferencesErr != nil { + return errors.Wrap(_listOfCovReferencesErr, "Error serializing 'listOfCovReferences' field") + } + + if popErr := writeBuffer.PopContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry) 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/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences.go new file mode 100644 index 00000000000..85f9cc32d0c --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences.go @@ -0,0 +1,248 @@ +/* + * 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. + +// BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences is the data-structure of this message +type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences struct { + OpeningTag *BACnetOpeningTag + ListOfCovReferences []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry + ClosingTag *BACnetClosingTag + + // Arguments. + TagNumber uint8 +} + +// IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences is the corresponding interface of BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences +type IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences interface { + // GetOpeningTag returns OpeningTag (property field) + GetOpeningTag() *BACnetOpeningTag + // GetListOfCovReferences returns ListOfCovReferences (property field) + GetListOfCovReferences() []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry + // 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 *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) GetOpeningTag() *BACnetOpeningTag { + return m.OpeningTag +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) GetListOfCovReferences() []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry { + return m.ListOfCovReferences +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) GetClosingTag() *BACnetClosingTag { + return m.ClosingTag +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences factory function for BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences +func NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences(openingTag *BACnetOpeningTag, listOfCovReferences []*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences { + return &BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences{OpeningTag: openingTag, ListOfCovReferences: listOfCovReferences, ClosingTag: closingTag, TagNumber: tagNumber} +} + +func CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences(structType interface{}) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences { + if casted, ok := structType.(BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences); ok { + return &casted + } + if casted, ok := structType.(*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences); ok { + return casted + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) GetTypeName() string { + return "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences" +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (openingTag) + lengthInBits += m.OpeningTag.GetLengthInBits() + + // Array field + if len(m.ListOfCovReferences) > 0 { + for _, element := range m.ListOfCovReferences { + lengthInBits += element.GetLengthInBits() + } + } + + // Simple field (closingTag) + lengthInBits += m.ClosingTag.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesParse(readBuffer utils.ReadBuffer, tagNumber uint8) (*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences"); 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 + } + + // Array field (listOfCovReferences) + if pullErr := readBuffer.PullContext("listOfCovReferences", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + listOfCovReferences := make([]*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntryParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'listOfCovReferences' field") + } + listOfCovReferences = append(listOfCovReferences, CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry(_item)) + + } + } + if closeErr := readBuffer.CloseContext("listOfCovReferences", utils.WithRenderAsList(true)); 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("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences(openingTag, listOfCovReferences, closingTag, tagNumber), nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences"); 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") + } + + // Array Field (listOfCovReferences) + if m.ListOfCovReferences != nil { + if pushErr := writeBuffer.PushContext("listOfCovReferences", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ListOfCovReferences { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'listOfCovReferences' field") + } + } + if popErr := writeBuffer.PopContext("listOfCovReferences", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + // 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("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences) 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/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry.go new file mode 100644 index 00000000000..7431d9656aa --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry.go @@ -0,0 +1,245 @@ +/* + * 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. + +// BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry is the data-structure of this message +type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry struct { + MonitoredProperty *BACnetPropertyReferenceEnclosed + CovIncrement *BACnetContextTagReal + Timestamped *BACnetContextTagBoolean +} + +// IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry is the corresponding interface of BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry +type IBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry interface { + // GetMonitoredProperty returns MonitoredProperty (property field) + GetMonitoredProperty() *BACnetPropertyReferenceEnclosed + // GetCovIncrement returns CovIncrement (property field) + GetCovIncrement() *BACnetContextTagReal + // GetTimestamped returns Timestamped (property field) + GetTimestamped() *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 *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) GetMonitoredProperty() *BACnetPropertyReferenceEnclosed { + return m.MonitoredProperty +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) GetCovIncrement() *BACnetContextTagReal { + return m.CovIncrement +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) GetTimestamped() *BACnetContextTagBoolean { + return m.Timestamped +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry factory function for BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry +func NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry(monitoredProperty *BACnetPropertyReferenceEnclosed, covIncrement *BACnetContextTagReal, timestamped *BACnetContextTagBoolean) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry { + return &BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry{MonitoredProperty: monitoredProperty, CovIncrement: covIncrement, Timestamped: timestamped} +} + +func CastBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry(structType interface{}) *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry { + if casted, ok := structType.(BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry); ok { + return &casted + } + if casted, ok := structType.(*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry); ok { + return casted + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) GetTypeName() string { + return "BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry" +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (monitoredProperty) + lengthInBits += m.MonitoredProperty.GetLengthInBits() + + // Optional Field (covIncrement) + if m.CovIncrement != nil { + lengthInBits += (*m.CovIncrement).GetLengthInBits() + } + + // Simple field (timestamped) + lengthInBits += m.Timestamped.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntryParse(readBuffer utils.ReadBuffer) (*BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (monitoredProperty) + if pullErr := readBuffer.PullContext("monitoredProperty"); pullErr != nil { + return nil, pullErr + } + _monitoredProperty, _monitoredPropertyErr := BACnetPropertyReferenceEnclosedParse(readBuffer, uint8(uint8(0))) + if _monitoredPropertyErr != nil { + return nil, errors.Wrap(_monitoredPropertyErr, "Error parsing 'monitoredProperty' field") + } + monitoredProperty := CastBACnetPropertyReferenceEnclosed(_monitoredProperty) + if closeErr := readBuffer.CloseContext("monitoredProperty"); closeErr != nil { + return nil, closeErr + } + + // Optional Field (covIncrement) (Can be skipped, if a given expression evaluates to false) + var covIncrement *BACnetContextTagReal = nil + { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("covIncrement"); pullErr != nil { + return nil, pullErr + } + _val, _err := BACnetContextTagParse(readBuffer, uint8(1), BACnetDataType_REAL) + 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 'covIncrement' field") + default: + covIncrement = CastBACnetContextTagReal(_val) + if closeErr := readBuffer.CloseContext("covIncrement"); closeErr != nil { + return nil, closeErr + } + } + } + + // Simple Field (timestamped) + if pullErr := readBuffer.PullContext("timestamped"); pullErr != nil { + return nil, pullErr + } + _timestamped, _timestampedErr := BACnetContextTagParse(readBuffer, uint8(uint8(1)), BACnetDataType(BACnetDataType_BOOLEAN)) + if _timestampedErr != nil { + return nil, errors.Wrap(_timestampedErr, "Error parsing 'timestamped' field") + } + timestamped := CastBACnetContextTagBoolean(_timestamped) + if closeErr := readBuffer.CloseContext("timestamped"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry(monitoredProperty, covIncrement, timestamped), nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry"); pushErr != nil { + return pushErr + } + + // Simple Field (monitoredProperty) + if pushErr := writeBuffer.PushContext("monitoredProperty"); pushErr != nil { + return pushErr + } + _monitoredPropertyErr := m.MonitoredProperty.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("monitoredProperty"); popErr != nil { + return popErr + } + if _monitoredPropertyErr != nil { + return errors.Wrap(_monitoredPropertyErr, "Error serializing 'monitoredProperty' field") + } + + // Optional Field (covIncrement) (Can be skipped, if the value is null) + var covIncrement *BACnetContextTagReal = nil + if m.CovIncrement != nil { + if pushErr := writeBuffer.PushContext("covIncrement"); pushErr != nil { + return pushErr + } + covIncrement = m.CovIncrement + _covIncrementErr := covIncrement.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("covIncrement"); popErr != nil { + return popErr + } + if _covIncrementErr != nil { + return errors.Wrap(_covIncrementErr, "Error serializing 'covIncrement' field") + } + } + + // Simple Field (timestamped) + if pushErr := writeBuffer.PushContext("timestamped"); pushErr != nil { + return pushErr + } + _timestampedErr := m.Timestamped.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("timestamped"); popErr != nil { + return popErr + } + if _timestampedErr != nil { + return errors.Wrap(_timestampedErr, "Error serializing 'timestamped' field") + } + + if popErr := writeBuffer.PopContext("BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry) 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/BACnetCOVSubscription.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVSubscription.go new file mode 100644 index 00000000000..a2fd7e9390d --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetCOVSubscription.go @@ -0,0 +1,315 @@ +/* + * 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. + +// BACnetCOVSubscription is the data-structure of this message +type BACnetCOVSubscription struct { + Recipient *BACnetRecipientProcessEnclosed + MonitoredPropertyReference *BACnetObjectPropertyReferenceEnclosed + IssueConfirmedNotifications *BACnetContextTagBoolean + TimeRemaining *BACnetContextTagUnsignedInteger + CovIncrement *BACnetContextTagReal +} + +// IBACnetCOVSubscription is the corresponding interface of BACnetCOVSubscription +type IBACnetCOVSubscription interface { + // GetRecipient returns Recipient (property field) + GetRecipient() *BACnetRecipientProcessEnclosed + // GetMonitoredPropertyReference returns MonitoredPropertyReference (property field) + GetMonitoredPropertyReference() *BACnetObjectPropertyReferenceEnclosed + // GetIssueConfirmedNotifications returns IssueConfirmedNotifications (property field) + GetIssueConfirmedNotifications() *BACnetContextTagBoolean + // GetTimeRemaining returns TimeRemaining (property field) + GetTimeRemaining() *BACnetContextTagUnsignedInteger + // GetCovIncrement returns CovIncrement (property field) + GetCovIncrement() *BACnetContextTagReal + // 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 *BACnetCOVSubscription) GetRecipient() *BACnetRecipientProcessEnclosed { + return m.Recipient +} + +func (m *BACnetCOVSubscription) GetMonitoredPropertyReference() *BACnetObjectPropertyReferenceEnclosed { + return m.MonitoredPropertyReference +} + +func (m *BACnetCOVSubscription) GetIssueConfirmedNotifications() *BACnetContextTagBoolean { + return m.IssueConfirmedNotifications +} + +func (m *BACnetCOVSubscription) GetTimeRemaining() *BACnetContextTagUnsignedInteger { + return m.TimeRemaining +} + +func (m *BACnetCOVSubscription) GetCovIncrement() *BACnetContextTagReal { + return m.CovIncrement +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetCOVSubscription factory function for BACnetCOVSubscription +func NewBACnetCOVSubscription(recipient *BACnetRecipientProcessEnclosed, monitoredPropertyReference *BACnetObjectPropertyReferenceEnclosed, issueConfirmedNotifications *BACnetContextTagBoolean, timeRemaining *BACnetContextTagUnsignedInteger, covIncrement *BACnetContextTagReal) *BACnetCOVSubscription { + return &BACnetCOVSubscription{Recipient: recipient, MonitoredPropertyReference: monitoredPropertyReference, IssueConfirmedNotifications: issueConfirmedNotifications, TimeRemaining: timeRemaining, CovIncrement: covIncrement} +} + +func CastBACnetCOVSubscription(structType interface{}) *BACnetCOVSubscription { + if casted, ok := structType.(BACnetCOVSubscription); ok { + return &casted + } + if casted, ok := structType.(*BACnetCOVSubscription); ok { + return casted + } + return nil +} + +func (m *BACnetCOVSubscription) GetTypeName() string { + return "BACnetCOVSubscription" +} + +func (m *BACnetCOVSubscription) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetCOVSubscription) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (recipient) + lengthInBits += m.Recipient.GetLengthInBits() + + // Simple field (monitoredPropertyReference) + lengthInBits += m.MonitoredPropertyReference.GetLengthInBits() + + // Simple field (issueConfirmedNotifications) + lengthInBits += m.IssueConfirmedNotifications.GetLengthInBits() + + // Simple field (timeRemaining) + lengthInBits += m.TimeRemaining.GetLengthInBits() + + // Optional Field (covIncrement) + if m.CovIncrement != nil { + lengthInBits += (*m.CovIncrement).GetLengthInBits() + } + + return lengthInBits +} + +func (m *BACnetCOVSubscription) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetCOVSubscriptionParse(readBuffer utils.ReadBuffer) (*BACnetCOVSubscription, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetCOVSubscription"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (recipient) + if pullErr := readBuffer.PullContext("recipient"); pullErr != nil { + return nil, pullErr + } + _recipient, _recipientErr := BACnetRecipientProcessEnclosedParse(readBuffer, uint8(uint8(0))) + if _recipientErr != nil { + return nil, errors.Wrap(_recipientErr, "Error parsing 'recipient' field") + } + recipient := CastBACnetRecipientProcessEnclosed(_recipient) + if closeErr := readBuffer.CloseContext("recipient"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (monitoredPropertyReference) + if pullErr := readBuffer.PullContext("monitoredPropertyReference"); pullErr != nil { + return nil, pullErr + } + _monitoredPropertyReference, _monitoredPropertyReferenceErr := BACnetObjectPropertyReferenceEnclosedParse(readBuffer, uint8(uint8(1))) + if _monitoredPropertyReferenceErr != nil { + return nil, errors.Wrap(_monitoredPropertyReferenceErr, "Error parsing 'monitoredPropertyReference' field") + } + monitoredPropertyReference := CastBACnetObjectPropertyReferenceEnclosed(_monitoredPropertyReference) + if closeErr := readBuffer.CloseContext("monitoredPropertyReference"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (issueConfirmedNotifications) + if pullErr := readBuffer.PullContext("issueConfirmedNotifications"); pullErr != nil { + return nil, pullErr + } + _issueConfirmedNotifications, _issueConfirmedNotificationsErr := BACnetContextTagParse(readBuffer, uint8(uint8(2)), BACnetDataType(BACnetDataType_BOOLEAN)) + if _issueConfirmedNotificationsErr != nil { + return nil, errors.Wrap(_issueConfirmedNotificationsErr, "Error parsing 'issueConfirmedNotifications' field") + } + issueConfirmedNotifications := CastBACnetContextTagBoolean(_issueConfirmedNotifications) + if closeErr := readBuffer.CloseContext("issueConfirmedNotifications"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (timeRemaining) + if pullErr := readBuffer.PullContext("timeRemaining"); pullErr != nil { + return nil, pullErr + } + _timeRemaining, _timeRemainingErr := BACnetContextTagParse(readBuffer, uint8(uint8(3)), BACnetDataType(BACnetDataType_UNSIGNED_INTEGER)) + if _timeRemainingErr != nil { + return nil, errors.Wrap(_timeRemainingErr, "Error parsing 'timeRemaining' field") + } + timeRemaining := CastBACnetContextTagUnsignedInteger(_timeRemaining) + if closeErr := readBuffer.CloseContext("timeRemaining"); closeErr != nil { + return nil, closeErr + } + + // Optional Field (covIncrement) (Can be skipped, if a given expression evaluates to false) + var covIncrement *BACnetContextTagReal = nil + { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("covIncrement"); pullErr != nil { + return nil, pullErr + } + _val, _err := BACnetContextTagParse(readBuffer, uint8(4), BACnetDataType_REAL) + 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 'covIncrement' field") + default: + covIncrement = CastBACnetContextTagReal(_val) + if closeErr := readBuffer.CloseContext("covIncrement"); closeErr != nil { + return nil, closeErr + } + } + } + + if closeErr := readBuffer.CloseContext("BACnetCOVSubscription"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetCOVSubscription(recipient, monitoredPropertyReference, issueConfirmedNotifications, timeRemaining, covIncrement), nil +} + +func (m *BACnetCOVSubscription) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetCOVSubscription"); pushErr != nil { + return pushErr + } + + // Simple Field (recipient) + if pushErr := writeBuffer.PushContext("recipient"); pushErr != nil { + return pushErr + } + _recipientErr := m.Recipient.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("recipient"); popErr != nil { + return popErr + } + if _recipientErr != nil { + return errors.Wrap(_recipientErr, "Error serializing 'recipient' field") + } + + // Simple Field (monitoredPropertyReference) + if pushErr := writeBuffer.PushContext("monitoredPropertyReference"); pushErr != nil { + return pushErr + } + _monitoredPropertyReferenceErr := m.MonitoredPropertyReference.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("monitoredPropertyReference"); popErr != nil { + return popErr + } + if _monitoredPropertyReferenceErr != nil { + return errors.Wrap(_monitoredPropertyReferenceErr, "Error serializing 'monitoredPropertyReference' field") + } + + // Simple Field (issueConfirmedNotifications) + if pushErr := writeBuffer.PushContext("issueConfirmedNotifications"); pushErr != nil { + return pushErr + } + _issueConfirmedNotificationsErr := m.IssueConfirmedNotifications.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("issueConfirmedNotifications"); popErr != nil { + return popErr + } + if _issueConfirmedNotificationsErr != nil { + return errors.Wrap(_issueConfirmedNotificationsErr, "Error serializing 'issueConfirmedNotifications' field") + } + + // Simple Field (timeRemaining) + if pushErr := writeBuffer.PushContext("timeRemaining"); pushErr != nil { + return pushErr + } + _timeRemainingErr := m.TimeRemaining.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("timeRemaining"); popErr != nil { + return popErr + } + if _timeRemainingErr != nil { + return errors.Wrap(_timeRemainingErr, "Error serializing 'timeRemaining' field") + } + + // Optional Field (covIncrement) (Can be skipped, if the value is null) + var covIncrement *BACnetContextTagReal = nil + if m.CovIncrement != nil { + if pushErr := writeBuffer.PushContext("covIncrement"); pushErr != nil { + return pushErr + } + covIncrement = m.CovIncrement + _covIncrementErr := covIncrement.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("covIncrement"); popErr != nil { + return popErr + } + if _covIncrementErr != nil { + return errors.Wrap(_covIncrementErr, "Error serializing 'covIncrement' field") + } + } + + if popErr := writeBuffer.PopContext("BACnetCOVSubscription"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetCOVSubscription) 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 e6400f92f6f..1019f35ed0e 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go @@ -198,6 +198,12 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataActivationTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTIVE_AUTHENTICATION_POLICY: // BACnetConstructedDataActiveAuthenticationPolicy _child, typeSwitchError = BACnetConstructedDataActiveAuthenticationPolicyParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTIVE_COV_MULTIPLE_SUBSCRIPTIONS: // BACnetConstructedDataActiveCOVMultipleSubscriptions + _child, typeSwitchError = BACnetConstructedDataActiveCOVMultipleSubscriptionsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTIVE_COV_SUBSCRIPTIONS: // BACnetConstructedDataActiveCOVSubscriptions + _child, typeSwitchError = BACnetConstructedDataActiveCOVSubscriptionsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTIVE_VT_SESSIONS: // BACnetConstructedDataActiveVTSessions + _child, typeSwitchError = BACnetConstructedDataActiveVTSessionsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ACTUAL_SHED_LEVEL: // BACnetConstructedDataActualShedLevel _child, typeSwitchError = BACnetConstructedDataActualShedLevelParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case objectTypeArgument == BACnetObjectType_LIFE_SAFETY_POINT && propertyIdentifierArgument == BACnetPropertyIdentifier_ALARM_VALUES: // BACnetConstructedDataLifeSafetyPointAlarmValues @@ -324,6 +330,12 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataTrendLogMultipleAllParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_APDU_LENGTH: // BACnetConstructedDataAPDULength _child, typeSwitchError = BACnetConstructedDataAPDULengthParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_APDU_SEGMENT_TIMEOUT: // BACnetConstructedDataAPDUSegmentTimeout + _child, typeSwitchError = BACnetConstructedDataAPDUSegmentTimeoutParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_APDU_TIMEOUT: // BACnetConstructedDataAPDUTimeout + _child, typeSwitchError = BACnetConstructedDataAPDUTimeoutParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_APPLICATION_SOFTWARE_VERSION: // BACnetConstructedDataApplicationSoftwareVersion + _child, typeSwitchError = BACnetConstructedDataApplicationSoftwareVersionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ARCHIVE: // BACnetConstructedDataArchive _child, typeSwitchError = BACnetConstructedDataArchiveParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ASSIGNED_ACCESS_RIGHTS: // BACnetConstructedDataAssignedAccessRights @@ -344,6 +356,12 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataAuthorizationModeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_AUTO_SLAVE_DISCOVERY: // BACnetConstructedDataAutoSlaveDiscovery _child, typeSwitchError = BACnetConstructedDataAutoSlaveDiscoveryParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_BACKUP_AND_RESTORE_STATE: // BACnetConstructedDataBackupAndRestoreState + _child, typeSwitchError = BACnetConstructedDataBackupAndRestoreStateParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_BACKUP_FAILURE_TIMEOUT: // BACnetConstructedDataBackupFailureTimeout + _child, typeSwitchError = BACnetConstructedDataBackupFailureTimeoutParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_BACKUP_PREPARATION_TIME: // BACnetConstructedDataBackupPreparationTime + _child, typeSwitchError = BACnetConstructedDataBackupPreparationTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_BACNET_IP_GLOBAL_ADDRESS: // BACnetConstructedDataBACnetIPGlobalAddress _child, typeSwitchError = BACnetConstructedDataBACnetIPGlobalAddressParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_BACNET_IP_MODE: // BACnetConstructedDataBACnetIPMode @@ -402,6 +420,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataChangesPendingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_COMMAND: // BACnetConstructedDataCommand _child, typeSwitchError = BACnetConstructedDataCommandParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CONFIGURATION_FILES: // BACnetConstructedDataConfigurationFiles + _child, typeSwitchError = BACnetConstructedDataConfigurationFilesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CONTROLLED_VARIABLE_REFERENCE: // BACnetConstructedDataControlledVariableReference _child, typeSwitchError = BACnetConstructedDataControlledVariableReferenceParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CONTROLLED_VARIABLE_UNITS: // BACnetConstructedDataControlledVariableUnits @@ -428,6 +448,10 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataCredentialStatusParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_CREDENTIALS: // BACnetConstructedDataCredentials _child, typeSwitchError = BACnetConstructedDataCredentialsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DATABASE_REVISION: // BACnetConstructedDataDatabaseRevision + _child, typeSwitchError = BACnetConstructedDataDatabaseRevisionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DAYLIGHT_SAVINGS_STATUS: // BACnetConstructedDataDaylightSavingsStatus + _child, typeSwitchError = BACnetConstructedDataDaylightSavingsStatusParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DAYS_REMAINING: // BACnetConstructedDataDaysRemaining _child, typeSwitchError = BACnetConstructedDataDaysRemainingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DEADBAND: // BACnetConstructedDataDeadband @@ -442,6 +466,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataDefaultSubordinateRelationshipParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DEFAULT_TIMEOUT: // BACnetConstructedDataDefaultTimeout _child, typeSwitchError = BACnetConstructedDataDefaultTimeoutParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DEPLOYED_PROFILE_LOCATION: // BACnetConstructedDataDeployedProfileLocation + _child, typeSwitchError = BACnetConstructedDataDeployedProfileLocationParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DERIVATIVE_CONSTANT: // BACnetConstructedDataDerivativeConstant _child, typeSwitchError = BACnetConstructedDataDerivativeConstantParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DERIVATIVE_CONSTANT_UNITS: // BACnetConstructedDataDerivativeConstantUnits @@ -450,6 +476,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataDescriptionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DESCRIPTION_OF_HALT: // BACnetConstructedDataDescriptionOfHalt _child, typeSwitchError = BACnetConstructedDataDescriptionOfHaltParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DEVICE_ADDRESS_BINDING: // BACnetConstructedDataDeviceAddressBinding + _child, typeSwitchError = BACnetConstructedDataDeviceAddressBindingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DEVICE_TYPE: // BACnetConstructedDataDeviceType _child, typeSwitchError = BACnetConstructedDataDeviceTypeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_DIRECT_READING: // BACnetConstructedDataDirectReading @@ -532,6 +560,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataFileSizeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_FILE_TYPE: // BACnetConstructedDataFileType _child, typeSwitchError = BACnetConstructedDataFileTypeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_FIRMWARE_REVISION: // BACnetConstructedDataFirmwareRevision + _child, typeSwitchError = BACnetConstructedDataFirmwareRevisionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_FLOOR_TEXT: // BACnetConstructedDataFloorText _child, typeSwitchError = BACnetConstructedDataFloorTextParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_FULL_DUTY_BASELINE: // BACnetConstructedDataFullDutyBaseline @@ -610,6 +640,10 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataLastAccessPointParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_KEY_SERVER: // BACnetConstructedDataLastKeyServer _child, typeSwitchError = BACnetConstructedDataLastKeyServerParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_RESTART_REASON: // BACnetConstructedDataLastRestartReason + _child, typeSwitchError = BACnetConstructedDataLastRestartReasonParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_RESTORE_TIME: // BACnetConstructedDataLastRestoreTime + _child, typeSwitchError = BACnetConstructedDataLastRestoreTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_STATE_CHANGE: // BACnetConstructedDataLastStateChange _child, typeSwitchError = BACnetConstructedDataLastStateChangeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LAST_USE_TIME: // BACnetConstructedDataLastUseTime @@ -632,8 +666,14 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataListOfGroupMembersParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LIST_OF_OBJECT_PROPERTY_REFERENCES: // BACnetConstructedDataListOfObjectPropertyReferences _child, typeSwitchError = BACnetConstructedDataListOfObjectPropertyReferencesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LOCAL_DATE: // BACnetConstructedDataLocalDate + _child, typeSwitchError = BACnetConstructedDataLocalDateParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LOCAL_FORWARDING_ONLY: // BACnetConstructedDataLocalForwardingOnly _child, typeSwitchError = BACnetConstructedDataLocalForwardingOnlyParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LOCAL_TIME: // BACnetConstructedDataLocalTime + _child, typeSwitchError = BACnetConstructedDataLocalTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LOCATION: // BACnetConstructedDataLocation + _child, typeSwitchError = BACnetConstructedDataLocationParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LOCK_STATUS: // BACnetConstructedDataLockStatus _child, typeSwitchError = BACnetConstructedDataLockStatusParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_LOCKOUT: // BACnetConstructedDataLockout @@ -662,12 +702,16 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataMaskedAlarmValuesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MAX_ACTUAL_VALUE: // BACnetConstructedDataMaxActualValue _child, typeSwitchError = BACnetConstructedDataMaxActualValueParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MAX_APDU_LENGTH_ACCEPTED: // BACnetConstructedDataMaxAPDULengthAccepted + _child, typeSwitchError = BACnetConstructedDataMaxAPDULengthAcceptedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MAX_FAILED_ATTEMPTS: // BACnetConstructedDataMaxFailedAttempts _child, typeSwitchError = BACnetConstructedDataMaxFailedAttemptsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case objectTypeArgument == BACnetObjectType_ACCUMULATOR && propertyIdentifierArgument == BACnetPropertyIdentifier_MAX_PRES_VALUE: // BACnetConstructedDataAccumulatorMaxPresValue _child, typeSwitchError = BACnetConstructedDataAccumulatorMaxPresValueParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MAX_PRES_VALUE: // BACnetConstructedDataMaxPresValue _child, typeSwitchError = BACnetConstructedDataMaxPresValueParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MAX_SEGMENTS_ACCEPTED: // BACnetConstructedDataMaxSegmentsAccepted + _child, typeSwitchError = BACnetConstructedDataMaxSegmentsAcceptedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MAXIMUM_OUTPUT: // BACnetConstructedDataMaximumOutput _child, typeSwitchError = BACnetConstructedDataMaximumOutputParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MEMBER_OF: // BACnetConstructedDataMemberOf @@ -686,6 +730,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataMinimumOutputParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MINIMUM_VALUE: // BACnetConstructedDataMinimumValue _child, typeSwitchError = BACnetConstructedDataMinimumValueParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MODEL_NAME: // BACnetConstructedDataModelName + _child, typeSwitchError = BACnetConstructedDataModelNameParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MODIFICATION_DATE: // BACnetConstructedDataModificationDate _child, typeSwitchError = BACnetConstructedDataModificationDateParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_MUSTER_POINT: // BACnetConstructedDataMusterPoint @@ -712,10 +758,14 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataNotificationClassParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_NOTIFY_TYPE: // BACnetConstructedDataNotifyType _child, typeSwitchError = BACnetConstructedDataNotifyTypeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_NUMBER_OF_APDU_RETRIES: // BACnetConstructedDataNumberOfAPDURetries + _child, typeSwitchError = BACnetConstructedDataNumberOfAPDURetriesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_NUMBER_OF_AUTHENTICATION_POLICIES: // BACnetConstructedDataNumberOfAuthenticationPolicies _child, typeSwitchError = BACnetConstructedDataNumberOfAuthenticationPoliciesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OBJECT_IDENTIFIER: // BACnetConstructedDataObjectIdentifier _child, typeSwitchError = BACnetConstructedDataObjectIdentifierParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OBJECT_LIST: // BACnetConstructedDataObjectList + _child, typeSwitchError = BACnetConstructedDataObjectListParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OBJECT_NAME: // BACnetConstructedDataObjectName _child, typeSwitchError = BACnetConstructedDataObjectNameParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_OBJECT_TYPE: // BACnetConstructedDataObjectType @@ -766,6 +816,14 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataProportionalConstantUnitsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PROTOCOL_LEVEL: // BACnetConstructedDataProtocolLevel _child, typeSwitchError = BACnetConstructedDataProtocolLevelParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PROTOCOL_OBJECT_TYPES_SUPPORTED: // BACnetConstructedDataProtocolObjectTypesSupported + _child, typeSwitchError = BACnetConstructedDataProtocolObjectTypesSupportedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PROTOCOL_REVISION: // BACnetConstructedDataProtocolRevision + _child, typeSwitchError = BACnetConstructedDataProtocolRevisionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PROTOCOL_SERVICES_SUPPORTED: // BACnetConstructedDataProtocolServicesSupported + _child, typeSwitchError = BACnetConstructedDataProtocolServicesSupportedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_PROTOCOL_VERSION: // BACnetConstructedDataProtocolVersion + _child, typeSwitchError = BACnetConstructedDataProtocolVersionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_READ_ONLY: // BACnetConstructedDataReadOnly _child, typeSwitchError = BACnetConstructedDataReadOnlyParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_REASON_FOR_DISABLE: // BACnetConstructedDataReasonForDisable @@ -788,6 +846,12 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataRequestedUpdateIntervalParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_RESOLUTION: // BACnetConstructedDataResolution _child, typeSwitchError = BACnetConstructedDataResolutionParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_RESTART_NOTIFICATION_RECIPIENTS: // BACnetConstructedDataRestartNotificationRecipients + _child, typeSwitchError = BACnetConstructedDataRestartNotificationRecipientsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_RESTORE_COMPLETION_TIME: // BACnetConstructedDataRestoreCompletionTime + _child, typeSwitchError = BACnetConstructedDataRestoreCompletionTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_RESTORE_PREPARATION_TIME: // BACnetConstructedDataRestorePreparationTime + _child, typeSwitchError = BACnetConstructedDataRestorePreparationTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ROUTING_TABLE: // BACnetConstructedDataRoutingTable _child, typeSwitchError = BACnetConstructedDataRoutingTableParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SCALE_FACTOR: // BACnetConstructedDataScaleFactor @@ -800,6 +864,10 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataSecurityPDUTimeoutParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SECURITY_TIME_WINDOW: // BACnetConstructedDataSecurityTimeWindow _child, typeSwitchError = BACnetConstructedDataSecurityTimeWindowParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SEGMENTATION_SUPPORTED: // BACnetConstructedDataSegmentationSupported + _child, typeSwitchError = BACnetConstructedDataSegmentationSupportedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SERIAL_NUMBER: // BACnetConstructedDataSerialNumber + _child, typeSwitchError = BACnetConstructedDataSerialNumberParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SETPOINT: // BACnetConstructedDataSetpoint _child, typeSwitchError = BACnetConstructedDataSetpointParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SETPOINT_REFERENCE: // BACnetConstructedDataSetpointReference @@ -824,6 +892,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataStatusFlagsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_STRIKE_COUNT: // BACnetConstructedDataStrikeCount _child, typeSwitchError = BACnetConstructedDataStrikeCountParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_STRUCTURED_OBJECT_LIST: // BACnetConstructedDataStructuredObjectList + _child, typeSwitchError = BACnetConstructedDataStructuredObjectListParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SUBORDINATE_ANNOTATIONS: // BACnetConstructedDataSubordinateAnnotations _child, typeSwitchError = BACnetConstructedDataSubordinateAnnotationsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SUBORDINATE_LIST: // BACnetConstructedDataSubordinateList @@ -838,6 +908,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataSubscribedRecipientsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SUPPORTED_SECURITY_ALGORITHMS: // BACnetConstructedDataSupportedSecurityAlgorithms _child, typeSwitchError = BACnetConstructedDataSupportedSecurityAlgorithmsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_SYSTEM_STATUS: // BACnetConstructedDataSystemStatus + _child, typeSwitchError = BACnetConstructedDataSystemStatusParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TAGS: // BACnetConstructedDataTags _child, typeSwitchError = BACnetConstructedDataTagsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_THREAT_AUTHORITY: // BACnetConstructedDataThreatAuthority @@ -848,8 +920,14 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _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_TIME_OF_DEVICE_RESTART: // BACnetConstructedDataTimeOfDeviceRestart + _child, typeSwitchError = BACnetConstructedDataTimeOfDeviceRestartParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TIME_OF_STRIKE_COUNT_RESET: // BACnetConstructedDataTimeOfStrikeCountReset _child, typeSwitchError = BACnetConstructedDataTimeOfStrikeCountResetParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TIME_SYNCHRONIZATION_INTERVAL: // BACnetConstructedDataTimeSynchronizationInterval + _child, typeSwitchError = BACnetConstructedDataTimeSynchronizationIntervalParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TIME_SYNCHRONIZATION_RECIPIENTS: // BACnetConstructedDataTimeSynchronizationRecipients + _child, typeSwitchError = BACnetConstructedDataTimeSynchronizationRecipientsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TIMER_RUNNING: // BACnetConstructedDataTimerRunning _child, typeSwitchError = BACnetConstructedDataTimerRunningParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_TIMER_STATE: // BACnetConstructedDataTimerState @@ -876,10 +954,20 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob _child, typeSwitchError = BACnetConstructedDataUserTypeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_USES_REMAINING: // BACnetConstructedDataUsesRemaining _child, typeSwitchError = BACnetConstructedDataUsesRemainingParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_UTC_OFFSET: // BACnetConstructedDataUTCOffset + _child, typeSwitchError = BACnetConstructedDataUTCOffsetParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_UTC_TIME_SYNCHRONIZATION_RECIPIENTS: // BACnetConstructedDataUTCTimeSynchronizationRecipients + _child, typeSwitchError = BACnetConstructedDataUTCTimeSynchronizationRecipientsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_VENDOR_IDENTIFIER: // BACnetConstructedDataVendorIdentifier + _child, typeSwitchError = BACnetConstructedDataVendorIdentifierParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_VENDOR_NAME: // BACnetConstructedDataVendorName + _child, typeSwitchError = BACnetConstructedDataVendorNameParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_VERIFICATION_TIME: // BACnetConstructedDataVerificationTime _child, typeSwitchError = BACnetConstructedDataVerificationTimeParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_VIRTUAL_MAC_ADDRESS_TABLE: // BACnetConstructedDataVirtualMACAddressTable _child, typeSwitchError = BACnetConstructedDataVirtualMACAddressTableParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) + case true && propertyIdentifierArgument == BACnetPropertyIdentifier_VT_CLASSES_SUPPORTED: // BACnetConstructedDataVTClassesSupported + _child, typeSwitchError = BACnetConstructedDataVTClassesSupportedParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_WEEKLY_SCHEDULE: // BACnetConstructedDataWeeklySchedule _child, typeSwitchError = BACnetConstructedDataWeeklyScheduleParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument) case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ZONE_FROM: // BACnetConstructedDataZoneFrom diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUSegmentTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUSegmentTimeout.go new file mode 100644 index 00000000000..c898819a433 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUSegmentTimeout.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. + +// BACnetConstructedDataAPDUSegmentTimeout is the data-structure of this message +type BACnetConstructedDataAPDUSegmentTimeout struct { + *BACnetConstructedData + ApduSegmentTimeout *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataAPDUSegmentTimeout is the corresponding interface of BACnetConstructedDataAPDUSegmentTimeout +type IBACnetConstructedDataAPDUSegmentTimeout interface { + IBACnetConstructedData + // GetApduSegmentTimeout returns ApduSegmentTimeout (property field) + GetApduSegmentTimeout() *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 *BACnetConstructedDataAPDUSegmentTimeout) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_APDU_SEGMENT_TIMEOUT +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataAPDUSegmentTimeout) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataAPDUSegmentTimeout) GetApduSegmentTimeout() *BACnetApplicationTagUnsignedInteger { + return m.ApduSegmentTimeout +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataAPDUSegmentTimeout factory function for BACnetConstructedDataAPDUSegmentTimeout +func NewBACnetConstructedDataAPDUSegmentTimeout(apduSegmentTimeout *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataAPDUSegmentTimeout { + _result := &BACnetConstructedDataAPDUSegmentTimeout{ + ApduSegmentTimeout: apduSegmentTimeout, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataAPDUSegmentTimeout(structType interface{}) *BACnetConstructedDataAPDUSegmentTimeout { + if casted, ok := structType.(BACnetConstructedDataAPDUSegmentTimeout); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataAPDUSegmentTimeout); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataAPDUSegmentTimeout(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataAPDUSegmentTimeout(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) GetTypeName() string { + return "BACnetConstructedDataAPDUSegmentTimeout" +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (apduSegmentTimeout) + lengthInBits += m.ApduSegmentTimeout.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataAPDUSegmentTimeoutParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataAPDUSegmentTimeout, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataAPDUSegmentTimeout"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (apduSegmentTimeout) + if pullErr := readBuffer.PullContext("apduSegmentTimeout"); pullErr != nil { + return nil, pullErr + } + _apduSegmentTimeout, _apduSegmentTimeoutErr := BACnetApplicationTagParse(readBuffer) + if _apduSegmentTimeoutErr != nil { + return nil, errors.Wrap(_apduSegmentTimeoutErr, "Error parsing 'apduSegmentTimeout' field") + } + apduSegmentTimeout := CastBACnetApplicationTagUnsignedInteger(_apduSegmentTimeout) + if closeErr := readBuffer.CloseContext("apduSegmentTimeout"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataAPDUSegmentTimeout"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataAPDUSegmentTimeout{ + ApduSegmentTimeout: CastBACnetApplicationTagUnsignedInteger(apduSegmentTimeout), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataAPDUSegmentTimeout"); pushErr != nil { + return pushErr + } + + // Simple Field (apduSegmentTimeout) + if pushErr := writeBuffer.PushContext("apduSegmentTimeout"); pushErr != nil { + return pushErr + } + _apduSegmentTimeoutErr := m.ApduSegmentTimeout.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("apduSegmentTimeout"); popErr != nil { + return popErr + } + if _apduSegmentTimeoutErr != nil { + return errors.Wrap(_apduSegmentTimeoutErr, "Error serializing 'apduSegmentTimeout' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataAPDUSegmentTimeout"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataAPDUSegmentTimeout) 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/BACnetConstructedDataAPDUTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUTimeout.go new file mode 100644 index 00000000000..a13d9fa5120 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAPDUTimeout.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. + +// BACnetConstructedDataAPDUTimeout is the data-structure of this message +type BACnetConstructedDataAPDUTimeout struct { + *BACnetConstructedData + ApduTimeout *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataAPDUTimeout is the corresponding interface of BACnetConstructedDataAPDUTimeout +type IBACnetConstructedDataAPDUTimeout interface { + IBACnetConstructedData + // GetApduTimeout returns ApduTimeout (property field) + GetApduTimeout() *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 *BACnetConstructedDataAPDUTimeout) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataAPDUTimeout) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_APDU_TIMEOUT +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataAPDUTimeout) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataAPDUTimeout) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataAPDUTimeout) GetApduTimeout() *BACnetApplicationTagUnsignedInteger { + return m.ApduTimeout +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataAPDUTimeout factory function for BACnetConstructedDataAPDUTimeout +func NewBACnetConstructedDataAPDUTimeout(apduTimeout *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataAPDUTimeout { + _result := &BACnetConstructedDataAPDUTimeout{ + ApduTimeout: apduTimeout, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataAPDUTimeout(structType interface{}) *BACnetConstructedDataAPDUTimeout { + if casted, ok := structType.(BACnetConstructedDataAPDUTimeout); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataAPDUTimeout); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataAPDUTimeout(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataAPDUTimeout(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataAPDUTimeout) GetTypeName() string { + return "BACnetConstructedDataAPDUTimeout" +} + +func (m *BACnetConstructedDataAPDUTimeout) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataAPDUTimeout) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (apduTimeout) + lengthInBits += m.ApduTimeout.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataAPDUTimeout) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataAPDUTimeoutParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataAPDUTimeout, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataAPDUTimeout"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (apduTimeout) + if pullErr := readBuffer.PullContext("apduTimeout"); pullErr != nil { + return nil, pullErr + } + _apduTimeout, _apduTimeoutErr := BACnetApplicationTagParse(readBuffer) + if _apduTimeoutErr != nil { + return nil, errors.Wrap(_apduTimeoutErr, "Error parsing 'apduTimeout' field") + } + apduTimeout := CastBACnetApplicationTagUnsignedInteger(_apduTimeout) + if closeErr := readBuffer.CloseContext("apduTimeout"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataAPDUTimeout"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataAPDUTimeout{ + ApduTimeout: CastBACnetApplicationTagUnsignedInteger(apduTimeout), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataAPDUTimeout) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataAPDUTimeout"); pushErr != nil { + return pushErr + } + + // Simple Field (apduTimeout) + if pushErr := writeBuffer.PushContext("apduTimeout"); pushErr != nil { + return pushErr + } + _apduTimeoutErr := m.ApduTimeout.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("apduTimeout"); popErr != nil { + return popErr + } + if _apduTimeoutErr != nil { + return errors.Wrap(_apduTimeoutErr, "Error serializing 'apduTimeout' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataAPDUTimeout"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataAPDUTimeout) 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/BACnetConstructedDataActiveCOVMultipleSubscriptions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVMultipleSubscriptions.go new file mode 100644 index 00000000000..afebdb91fad --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVMultipleSubscriptions.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. + +// BACnetConstructedDataActiveCOVMultipleSubscriptions is the data-structure of this message +type BACnetConstructedDataActiveCOVMultipleSubscriptions struct { + *BACnetConstructedData + ActiveCOVMultipleSubscriptions []*BACnetCOVMultipleSubscription + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataActiveCOVMultipleSubscriptions is the corresponding interface of BACnetConstructedDataActiveCOVMultipleSubscriptions +type IBACnetConstructedDataActiveCOVMultipleSubscriptions interface { + IBACnetConstructedData + // GetActiveCOVMultipleSubscriptions returns ActiveCOVMultipleSubscriptions (property field) + GetActiveCOVMultipleSubscriptions() []*BACnetCOVMultipleSubscription + // 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 *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_ACTIVE_COV_MULTIPLE_SUBSCRIPTIONS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetActiveCOVMultipleSubscriptions() []*BACnetCOVMultipleSubscription { + return m.ActiveCOVMultipleSubscriptions +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataActiveCOVMultipleSubscriptions factory function for BACnetConstructedDataActiveCOVMultipleSubscriptions +func NewBACnetConstructedDataActiveCOVMultipleSubscriptions(activeCOVMultipleSubscriptions []*BACnetCOVMultipleSubscription, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataActiveCOVMultipleSubscriptions { + _result := &BACnetConstructedDataActiveCOVMultipleSubscriptions{ + ActiveCOVMultipleSubscriptions: activeCOVMultipleSubscriptions, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataActiveCOVMultipleSubscriptions(structType interface{}) *BACnetConstructedDataActiveCOVMultipleSubscriptions { + if casted, ok := structType.(BACnetConstructedDataActiveCOVMultipleSubscriptions); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataActiveCOVMultipleSubscriptions); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataActiveCOVMultipleSubscriptions(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataActiveCOVMultipleSubscriptions(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetTypeName() string { + return "BACnetConstructedDataActiveCOVMultipleSubscriptions" +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.ActiveCOVMultipleSubscriptions) > 0 { + for _, element := range m.ActiveCOVMultipleSubscriptions { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataActiveCOVMultipleSubscriptionsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataActiveCOVMultipleSubscriptions, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataActiveCOVMultipleSubscriptions"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (activeCOVMultipleSubscriptions) + if pullErr := readBuffer.PullContext("activeCOVMultipleSubscriptions", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + activeCOVMultipleSubscriptions := make([]*BACnetCOVMultipleSubscription, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetCOVMultipleSubscriptionParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'activeCOVMultipleSubscriptions' field") + } + activeCOVMultipleSubscriptions = append(activeCOVMultipleSubscriptions, CastBACnetCOVMultipleSubscription(_item)) + + } + } + if closeErr := readBuffer.CloseContext("activeCOVMultipleSubscriptions", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataActiveCOVMultipleSubscriptions"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataActiveCOVMultipleSubscriptions{ + ActiveCOVMultipleSubscriptions: activeCOVMultipleSubscriptions, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataActiveCOVMultipleSubscriptions"); pushErr != nil { + return pushErr + } + + // Array Field (activeCOVMultipleSubscriptions) + if m.ActiveCOVMultipleSubscriptions != nil { + if pushErr := writeBuffer.PushContext("activeCOVMultipleSubscriptions", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ActiveCOVMultipleSubscriptions { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'activeCOVMultipleSubscriptions' field") + } + } + if popErr := writeBuffer.PopContext("activeCOVMultipleSubscriptions", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataActiveCOVMultipleSubscriptions"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataActiveCOVMultipleSubscriptions) 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/BACnetConstructedDataActiveCOVSubscriptions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVSubscriptions.go new file mode 100644 index 00000000000..0d8923ec80e --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveCOVSubscriptions.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. + +// BACnetConstructedDataActiveCOVSubscriptions is the data-structure of this message +type BACnetConstructedDataActiveCOVSubscriptions struct { + *BACnetConstructedData + ActiveCOVSubscriptions []*BACnetCOVSubscription + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataActiveCOVSubscriptions is the corresponding interface of BACnetConstructedDataActiveCOVSubscriptions +type IBACnetConstructedDataActiveCOVSubscriptions interface { + IBACnetConstructedData + // GetActiveCOVSubscriptions returns ActiveCOVSubscriptions (property field) + GetActiveCOVSubscriptions() []*BACnetCOVSubscription + // 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 *BACnetConstructedDataActiveCOVSubscriptions) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_ACTIVE_COV_SUBSCRIPTIONS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataActiveCOVSubscriptions) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataActiveCOVSubscriptions) GetActiveCOVSubscriptions() []*BACnetCOVSubscription { + return m.ActiveCOVSubscriptions +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataActiveCOVSubscriptions factory function for BACnetConstructedDataActiveCOVSubscriptions +func NewBACnetConstructedDataActiveCOVSubscriptions(activeCOVSubscriptions []*BACnetCOVSubscription, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataActiveCOVSubscriptions { + _result := &BACnetConstructedDataActiveCOVSubscriptions{ + ActiveCOVSubscriptions: activeCOVSubscriptions, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataActiveCOVSubscriptions(structType interface{}) *BACnetConstructedDataActiveCOVSubscriptions { + if casted, ok := structType.(BACnetConstructedDataActiveCOVSubscriptions); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataActiveCOVSubscriptions); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataActiveCOVSubscriptions(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataActiveCOVSubscriptions(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) GetTypeName() string { + return "BACnetConstructedDataActiveCOVSubscriptions" +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.ActiveCOVSubscriptions) > 0 { + for _, element := range m.ActiveCOVSubscriptions { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataActiveCOVSubscriptionsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataActiveCOVSubscriptions, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataActiveCOVSubscriptions"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (activeCOVSubscriptions) + if pullErr := readBuffer.PullContext("activeCOVSubscriptions", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + activeCOVSubscriptions := make([]*BACnetCOVSubscription, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetCOVSubscriptionParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'activeCOVSubscriptions' field") + } + activeCOVSubscriptions = append(activeCOVSubscriptions, CastBACnetCOVSubscription(_item)) + + } + } + if closeErr := readBuffer.CloseContext("activeCOVSubscriptions", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataActiveCOVSubscriptions"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataActiveCOVSubscriptions{ + ActiveCOVSubscriptions: activeCOVSubscriptions, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataActiveCOVSubscriptions"); pushErr != nil { + return pushErr + } + + // Array Field (activeCOVSubscriptions) + if m.ActiveCOVSubscriptions != nil { + if pushErr := writeBuffer.PushContext("activeCOVSubscriptions", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ActiveCOVSubscriptions { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'activeCOVSubscriptions' field") + } + } + if popErr := writeBuffer.PopContext("activeCOVSubscriptions", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataActiveCOVSubscriptions"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataActiveCOVSubscriptions) 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/BACnetConstructedDataActiveVTSessions.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveVTSessions.go new file mode 100644 index 00000000000..5d2f64e80e2 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataActiveVTSessions.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. + +// BACnetConstructedDataActiveVTSessions is the data-structure of this message +type BACnetConstructedDataActiveVTSessions struct { + *BACnetConstructedData + ActiveVTSession []*BACnetVTSession + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataActiveVTSessions is the corresponding interface of BACnetConstructedDataActiveVTSessions +type IBACnetConstructedDataActiveVTSessions interface { + IBACnetConstructedData + // GetActiveVTSession returns ActiveVTSession (property field) + GetActiveVTSession() []*BACnetVTSession + // 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 *BACnetConstructedDataActiveVTSessions) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataActiveVTSessions) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_ACTIVE_VT_SESSIONS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataActiveVTSessions) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataActiveVTSessions) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataActiveVTSessions) GetActiveVTSession() []*BACnetVTSession { + return m.ActiveVTSession +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataActiveVTSessions factory function for BACnetConstructedDataActiveVTSessions +func NewBACnetConstructedDataActiveVTSessions(activeVTSession []*BACnetVTSession, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataActiveVTSessions { + _result := &BACnetConstructedDataActiveVTSessions{ + ActiveVTSession: activeVTSession, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataActiveVTSessions(structType interface{}) *BACnetConstructedDataActiveVTSessions { + if casted, ok := structType.(BACnetConstructedDataActiveVTSessions); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataActiveVTSessions); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataActiveVTSessions(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataActiveVTSessions(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataActiveVTSessions) GetTypeName() string { + return "BACnetConstructedDataActiveVTSessions" +} + +func (m *BACnetConstructedDataActiveVTSessions) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataActiveVTSessions) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.ActiveVTSession) > 0 { + for _, element := range m.ActiveVTSession { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataActiveVTSessions) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataActiveVTSessionsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataActiveVTSessions, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataActiveVTSessions"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (activeVTSession) + if pullErr := readBuffer.PullContext("activeVTSession", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + activeVTSession := make([]*BACnetVTSession, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetVTSessionParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'activeVTSession' field") + } + activeVTSession = append(activeVTSession, CastBACnetVTSession(_item)) + + } + } + if closeErr := readBuffer.CloseContext("activeVTSession", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataActiveVTSessions"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataActiveVTSessions{ + ActiveVTSession: activeVTSession, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataActiveVTSessions) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataActiveVTSessions"); pushErr != nil { + return pushErr + } + + // Array Field (activeVTSession) + if m.ActiveVTSession != nil { + if pushErr := writeBuffer.PushContext("activeVTSession", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ActiveVTSession { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'activeVTSession' field") + } + } + if popErr := writeBuffer.PopContext("activeVTSession", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataActiveVTSessions"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataActiveVTSessions) 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/BACnetConstructedDataApplicationSoftwareVersion.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataApplicationSoftwareVersion.go new file mode 100644 index 00000000000..b44fcddbc58 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataApplicationSoftwareVersion.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. + +// BACnetConstructedDataApplicationSoftwareVersion is the data-structure of this message +type BACnetConstructedDataApplicationSoftwareVersion struct { + *BACnetConstructedData + ApplicationSoftwareVersion *BACnetApplicationTagCharacterString + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataApplicationSoftwareVersion is the corresponding interface of BACnetConstructedDataApplicationSoftwareVersion +type IBACnetConstructedDataApplicationSoftwareVersion interface { + IBACnetConstructedData + // GetApplicationSoftwareVersion returns ApplicationSoftwareVersion (property field) + GetApplicationSoftwareVersion() *BACnetApplicationTagCharacterString + // 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 *BACnetConstructedDataApplicationSoftwareVersion) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_APPLICATION_SOFTWARE_VERSION +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataApplicationSoftwareVersion) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataApplicationSoftwareVersion) GetApplicationSoftwareVersion() *BACnetApplicationTagCharacterString { + return m.ApplicationSoftwareVersion +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataApplicationSoftwareVersion factory function for BACnetConstructedDataApplicationSoftwareVersion +func NewBACnetConstructedDataApplicationSoftwareVersion(applicationSoftwareVersion *BACnetApplicationTagCharacterString, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataApplicationSoftwareVersion { + _result := &BACnetConstructedDataApplicationSoftwareVersion{ + ApplicationSoftwareVersion: applicationSoftwareVersion, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataApplicationSoftwareVersion(structType interface{}) *BACnetConstructedDataApplicationSoftwareVersion { + if casted, ok := structType.(BACnetConstructedDataApplicationSoftwareVersion); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataApplicationSoftwareVersion); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataApplicationSoftwareVersion(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataApplicationSoftwareVersion(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) GetTypeName() string { + return "BACnetConstructedDataApplicationSoftwareVersion" +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (applicationSoftwareVersion) + lengthInBits += m.ApplicationSoftwareVersion.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataApplicationSoftwareVersionParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataApplicationSoftwareVersion, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataApplicationSoftwareVersion"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (applicationSoftwareVersion) + if pullErr := readBuffer.PullContext("applicationSoftwareVersion"); pullErr != nil { + return nil, pullErr + } + _applicationSoftwareVersion, _applicationSoftwareVersionErr := BACnetApplicationTagParse(readBuffer) + if _applicationSoftwareVersionErr != nil { + return nil, errors.Wrap(_applicationSoftwareVersionErr, "Error parsing 'applicationSoftwareVersion' field") + } + applicationSoftwareVersion := CastBACnetApplicationTagCharacterString(_applicationSoftwareVersion) + if closeErr := readBuffer.CloseContext("applicationSoftwareVersion"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataApplicationSoftwareVersion"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataApplicationSoftwareVersion{ + ApplicationSoftwareVersion: CastBACnetApplicationTagCharacterString(applicationSoftwareVersion), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataApplicationSoftwareVersion"); pushErr != nil { + return pushErr + } + + // Simple Field (applicationSoftwareVersion) + if pushErr := writeBuffer.PushContext("applicationSoftwareVersion"); pushErr != nil { + return pushErr + } + _applicationSoftwareVersionErr := m.ApplicationSoftwareVersion.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("applicationSoftwareVersion"); popErr != nil { + return popErr + } + if _applicationSoftwareVersionErr != nil { + return errors.Wrap(_applicationSoftwareVersionErr, "Error serializing 'applicationSoftwareVersion' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataApplicationSoftwareVersion"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataApplicationSoftwareVersion) 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/BACnetConstructedDataBackupAndRestoreState.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupAndRestoreState.go new file mode 100644 index 00000000000..92acd9e6ef0 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupAndRestoreState.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. + +// BACnetConstructedDataBackupAndRestoreState is the data-structure of this message +type BACnetConstructedDataBackupAndRestoreState struct { + *BACnetConstructedData + BackupAndRestoreState *BACnetBackupStateTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataBackupAndRestoreState is the corresponding interface of BACnetConstructedDataBackupAndRestoreState +type IBACnetConstructedDataBackupAndRestoreState interface { + IBACnetConstructedData + // GetBackupAndRestoreState returns BackupAndRestoreState (property field) + GetBackupAndRestoreState() *BACnetBackupStateTagged + // 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 *BACnetConstructedDataBackupAndRestoreState) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataBackupAndRestoreState) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_BACKUP_AND_RESTORE_STATE +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataBackupAndRestoreState) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataBackupAndRestoreState) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataBackupAndRestoreState) GetBackupAndRestoreState() *BACnetBackupStateTagged { + return m.BackupAndRestoreState +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataBackupAndRestoreState factory function for BACnetConstructedDataBackupAndRestoreState +func NewBACnetConstructedDataBackupAndRestoreState(backupAndRestoreState *BACnetBackupStateTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataBackupAndRestoreState { + _result := &BACnetConstructedDataBackupAndRestoreState{ + BackupAndRestoreState: backupAndRestoreState, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataBackupAndRestoreState(structType interface{}) *BACnetConstructedDataBackupAndRestoreState { + if casted, ok := structType.(BACnetConstructedDataBackupAndRestoreState); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataBackupAndRestoreState); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataBackupAndRestoreState(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataBackupAndRestoreState(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataBackupAndRestoreState) GetTypeName() string { + return "BACnetConstructedDataBackupAndRestoreState" +} + +func (m *BACnetConstructedDataBackupAndRestoreState) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataBackupAndRestoreState) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (backupAndRestoreState) + lengthInBits += m.BackupAndRestoreState.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataBackupAndRestoreState) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataBackupAndRestoreStateParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataBackupAndRestoreState, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataBackupAndRestoreState"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (backupAndRestoreState) + if pullErr := readBuffer.PullContext("backupAndRestoreState"); pullErr != nil { + return nil, pullErr + } + _backupAndRestoreState, _backupAndRestoreStateErr := BACnetBackupStateTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _backupAndRestoreStateErr != nil { + return nil, errors.Wrap(_backupAndRestoreStateErr, "Error parsing 'backupAndRestoreState' field") + } + backupAndRestoreState := CastBACnetBackupStateTagged(_backupAndRestoreState) + if closeErr := readBuffer.CloseContext("backupAndRestoreState"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataBackupAndRestoreState"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataBackupAndRestoreState{ + BackupAndRestoreState: CastBACnetBackupStateTagged(backupAndRestoreState), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataBackupAndRestoreState) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataBackupAndRestoreState"); pushErr != nil { + return pushErr + } + + // Simple Field (backupAndRestoreState) + if pushErr := writeBuffer.PushContext("backupAndRestoreState"); pushErr != nil { + return pushErr + } + _backupAndRestoreStateErr := m.BackupAndRestoreState.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("backupAndRestoreState"); popErr != nil { + return popErr + } + if _backupAndRestoreStateErr != nil { + return errors.Wrap(_backupAndRestoreStateErr, "Error serializing 'backupAndRestoreState' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataBackupAndRestoreState"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataBackupAndRestoreState) 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/BACnetConstructedDataBackupFailureTimeout.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupFailureTimeout.go new file mode 100644 index 00000000000..ea6b2e13bee --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupFailureTimeout.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. + +// BACnetConstructedDataBackupFailureTimeout is the data-structure of this message +type BACnetConstructedDataBackupFailureTimeout struct { + *BACnetConstructedData + BackupFailureTimeout *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataBackupFailureTimeout is the corresponding interface of BACnetConstructedDataBackupFailureTimeout +type IBACnetConstructedDataBackupFailureTimeout interface { + IBACnetConstructedData + // GetBackupFailureTimeout returns BackupFailureTimeout (property field) + GetBackupFailureTimeout() *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 *BACnetConstructedDataBackupFailureTimeout) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataBackupFailureTimeout) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_BACKUP_FAILURE_TIMEOUT +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataBackupFailureTimeout) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataBackupFailureTimeout) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataBackupFailureTimeout) GetBackupFailureTimeout() *BACnetApplicationTagUnsignedInteger { + return m.BackupFailureTimeout +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataBackupFailureTimeout factory function for BACnetConstructedDataBackupFailureTimeout +func NewBACnetConstructedDataBackupFailureTimeout(backupFailureTimeout *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataBackupFailureTimeout { + _result := &BACnetConstructedDataBackupFailureTimeout{ + BackupFailureTimeout: backupFailureTimeout, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataBackupFailureTimeout(structType interface{}) *BACnetConstructedDataBackupFailureTimeout { + if casted, ok := structType.(BACnetConstructedDataBackupFailureTimeout); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataBackupFailureTimeout); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataBackupFailureTimeout(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataBackupFailureTimeout(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataBackupFailureTimeout) GetTypeName() string { + return "BACnetConstructedDataBackupFailureTimeout" +} + +func (m *BACnetConstructedDataBackupFailureTimeout) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataBackupFailureTimeout) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (backupFailureTimeout) + lengthInBits += m.BackupFailureTimeout.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataBackupFailureTimeout) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataBackupFailureTimeoutParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataBackupFailureTimeout, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataBackupFailureTimeout"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (backupFailureTimeout) + if pullErr := readBuffer.PullContext("backupFailureTimeout"); pullErr != nil { + return nil, pullErr + } + _backupFailureTimeout, _backupFailureTimeoutErr := BACnetApplicationTagParse(readBuffer) + if _backupFailureTimeoutErr != nil { + return nil, errors.Wrap(_backupFailureTimeoutErr, "Error parsing 'backupFailureTimeout' field") + } + backupFailureTimeout := CastBACnetApplicationTagUnsignedInteger(_backupFailureTimeout) + if closeErr := readBuffer.CloseContext("backupFailureTimeout"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataBackupFailureTimeout"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataBackupFailureTimeout{ + BackupFailureTimeout: CastBACnetApplicationTagUnsignedInteger(backupFailureTimeout), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataBackupFailureTimeout) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataBackupFailureTimeout"); pushErr != nil { + return pushErr + } + + // Simple Field (backupFailureTimeout) + if pushErr := writeBuffer.PushContext("backupFailureTimeout"); pushErr != nil { + return pushErr + } + _backupFailureTimeoutErr := m.BackupFailureTimeout.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("backupFailureTimeout"); popErr != nil { + return popErr + } + if _backupFailureTimeoutErr != nil { + return errors.Wrap(_backupFailureTimeoutErr, "Error serializing 'backupFailureTimeout' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataBackupFailureTimeout"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataBackupFailureTimeout) 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/BACnetConstructedDataBackupPreparationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupPreparationTime.go new file mode 100644 index 00000000000..a3458d55053 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataBackupPreparationTime.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. + +// BACnetConstructedDataBackupPreparationTime is the data-structure of this message +type BACnetConstructedDataBackupPreparationTime struct { + *BACnetConstructedData + BackupPreparationTime *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataBackupPreparationTime is the corresponding interface of BACnetConstructedDataBackupPreparationTime +type IBACnetConstructedDataBackupPreparationTime interface { + IBACnetConstructedData + // GetBackupPreparationTime returns BackupPreparationTime (property field) + GetBackupPreparationTime() *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 *BACnetConstructedDataBackupPreparationTime) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataBackupPreparationTime) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_BACKUP_PREPARATION_TIME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataBackupPreparationTime) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataBackupPreparationTime) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataBackupPreparationTime) GetBackupPreparationTime() *BACnetApplicationTagUnsignedInteger { + return m.BackupPreparationTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataBackupPreparationTime factory function for BACnetConstructedDataBackupPreparationTime +func NewBACnetConstructedDataBackupPreparationTime(backupPreparationTime *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataBackupPreparationTime { + _result := &BACnetConstructedDataBackupPreparationTime{ + BackupPreparationTime: backupPreparationTime, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataBackupPreparationTime(structType interface{}) *BACnetConstructedDataBackupPreparationTime { + if casted, ok := structType.(BACnetConstructedDataBackupPreparationTime); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataBackupPreparationTime); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataBackupPreparationTime(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataBackupPreparationTime(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataBackupPreparationTime) GetTypeName() string { + return "BACnetConstructedDataBackupPreparationTime" +} + +func (m *BACnetConstructedDataBackupPreparationTime) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataBackupPreparationTime) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (backupPreparationTime) + lengthInBits += m.BackupPreparationTime.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataBackupPreparationTime) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataBackupPreparationTimeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataBackupPreparationTime, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataBackupPreparationTime"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (backupPreparationTime) + if pullErr := readBuffer.PullContext("backupPreparationTime"); pullErr != nil { + return nil, pullErr + } + _backupPreparationTime, _backupPreparationTimeErr := BACnetApplicationTagParse(readBuffer) + if _backupPreparationTimeErr != nil { + return nil, errors.Wrap(_backupPreparationTimeErr, "Error parsing 'backupPreparationTime' field") + } + backupPreparationTime := CastBACnetApplicationTagUnsignedInteger(_backupPreparationTime) + if closeErr := readBuffer.CloseContext("backupPreparationTime"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataBackupPreparationTime"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataBackupPreparationTime{ + BackupPreparationTime: CastBACnetApplicationTagUnsignedInteger(backupPreparationTime), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataBackupPreparationTime) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataBackupPreparationTime"); pushErr != nil { + return pushErr + } + + // Simple Field (backupPreparationTime) + if pushErr := writeBuffer.PushContext("backupPreparationTime"); pushErr != nil { + return pushErr + } + _backupPreparationTimeErr := m.BackupPreparationTime.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("backupPreparationTime"); popErr != nil { + return popErr + } + if _backupPreparationTimeErr != nil { + return errors.Wrap(_backupPreparationTimeErr, "Error serializing 'backupPreparationTime' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataBackupPreparationTime"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataBackupPreparationTime) 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/BACnetConstructedDataConfigurationFiles.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataConfigurationFiles.go new file mode 100644 index 00000000000..cb10cb3711e --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataConfigurationFiles.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. + +// BACnetConstructedDataConfigurationFiles is the data-structure of this message +type BACnetConstructedDataConfigurationFiles struct { + *BACnetConstructedData + ConfigurationFiles []*BACnetApplicationTagObjectIdentifier + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataConfigurationFiles is the corresponding interface of BACnetConstructedDataConfigurationFiles +type IBACnetConstructedDataConfigurationFiles interface { + IBACnetConstructedData + // GetConfigurationFiles returns ConfigurationFiles (property field) + GetConfigurationFiles() []*BACnetApplicationTagObjectIdentifier + // 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 *BACnetConstructedDataConfigurationFiles) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataConfigurationFiles) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_CONFIGURATION_FILES +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataConfigurationFiles) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataConfigurationFiles) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataConfigurationFiles) GetConfigurationFiles() []*BACnetApplicationTagObjectIdentifier { + return m.ConfigurationFiles +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataConfigurationFiles factory function for BACnetConstructedDataConfigurationFiles +func NewBACnetConstructedDataConfigurationFiles(configurationFiles []*BACnetApplicationTagObjectIdentifier, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataConfigurationFiles { + _result := &BACnetConstructedDataConfigurationFiles{ + ConfigurationFiles: configurationFiles, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataConfigurationFiles(structType interface{}) *BACnetConstructedDataConfigurationFiles { + if casted, ok := structType.(BACnetConstructedDataConfigurationFiles); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataConfigurationFiles); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataConfigurationFiles(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataConfigurationFiles(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataConfigurationFiles) GetTypeName() string { + return "BACnetConstructedDataConfigurationFiles" +} + +func (m *BACnetConstructedDataConfigurationFiles) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataConfigurationFiles) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.ConfigurationFiles) > 0 { + for _, element := range m.ConfigurationFiles { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataConfigurationFiles) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataConfigurationFilesParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataConfigurationFiles, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataConfigurationFiles"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (configurationFiles) + if pullErr := readBuffer.PullContext("configurationFiles", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + configurationFiles := make([]*BACnetApplicationTagObjectIdentifier, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetApplicationTagParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'configurationFiles' field") + } + configurationFiles = append(configurationFiles, CastBACnetApplicationTagObjectIdentifier(_item)) + + } + } + if closeErr := readBuffer.CloseContext("configurationFiles", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataConfigurationFiles"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataConfigurationFiles{ + ConfigurationFiles: configurationFiles, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataConfigurationFiles) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataConfigurationFiles"); pushErr != nil { + return pushErr + } + + // Array Field (configurationFiles) + if m.ConfigurationFiles != nil { + if pushErr := writeBuffer.PushContext("configurationFiles", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ConfigurationFiles { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'configurationFiles' field") + } + } + if popErr := writeBuffer.PopContext("configurationFiles", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataConfigurationFiles"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataConfigurationFiles) 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/BACnetConstructedDataDatabaseRevision.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatabaseRevision.go new file mode 100644 index 00000000000..3e749b88e43 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDatabaseRevision.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. + +// BACnetConstructedDataDatabaseRevision is the data-structure of this message +type BACnetConstructedDataDatabaseRevision struct { + *BACnetConstructedData + DatabaseRevision *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataDatabaseRevision is the corresponding interface of BACnetConstructedDataDatabaseRevision +type IBACnetConstructedDataDatabaseRevision interface { + IBACnetConstructedData + // GetDatabaseRevision returns DatabaseRevision (property field) + GetDatabaseRevision() *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 *BACnetConstructedDataDatabaseRevision) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataDatabaseRevision) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_DATABASE_REVISION +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataDatabaseRevision) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataDatabaseRevision) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataDatabaseRevision) GetDatabaseRevision() *BACnetApplicationTagUnsignedInteger { + return m.DatabaseRevision +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataDatabaseRevision factory function for BACnetConstructedDataDatabaseRevision +func NewBACnetConstructedDataDatabaseRevision(databaseRevision *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataDatabaseRevision { + _result := &BACnetConstructedDataDatabaseRevision{ + DatabaseRevision: databaseRevision, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataDatabaseRevision(structType interface{}) *BACnetConstructedDataDatabaseRevision { + if casted, ok := structType.(BACnetConstructedDataDatabaseRevision); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataDatabaseRevision); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataDatabaseRevision(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataDatabaseRevision(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataDatabaseRevision) GetTypeName() string { + return "BACnetConstructedDataDatabaseRevision" +} + +func (m *BACnetConstructedDataDatabaseRevision) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataDatabaseRevision) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (databaseRevision) + lengthInBits += m.DatabaseRevision.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataDatabaseRevision) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataDatabaseRevisionParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataDatabaseRevision, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataDatabaseRevision"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (databaseRevision) + if pullErr := readBuffer.PullContext("databaseRevision"); pullErr != nil { + return nil, pullErr + } + _databaseRevision, _databaseRevisionErr := BACnetApplicationTagParse(readBuffer) + if _databaseRevisionErr != nil { + return nil, errors.Wrap(_databaseRevisionErr, "Error parsing 'databaseRevision' field") + } + databaseRevision := CastBACnetApplicationTagUnsignedInteger(_databaseRevision) + if closeErr := readBuffer.CloseContext("databaseRevision"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataDatabaseRevision"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataDatabaseRevision{ + DatabaseRevision: CastBACnetApplicationTagUnsignedInteger(databaseRevision), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataDatabaseRevision) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataDatabaseRevision"); pushErr != nil { + return pushErr + } + + // Simple Field (databaseRevision) + if pushErr := writeBuffer.PushContext("databaseRevision"); pushErr != nil { + return pushErr + } + _databaseRevisionErr := m.DatabaseRevision.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("databaseRevision"); popErr != nil { + return popErr + } + if _databaseRevisionErr != nil { + return errors.Wrap(_databaseRevisionErr, "Error serializing 'databaseRevision' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataDatabaseRevision"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataDatabaseRevision) 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/BACnetConstructedDataDaylightSavingsStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaylightSavingsStatus.go new file mode 100644 index 00000000000..f6052de5aae --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDaylightSavingsStatus.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. + +// BACnetConstructedDataDaylightSavingsStatus is the data-structure of this message +type BACnetConstructedDataDaylightSavingsStatus struct { + *BACnetConstructedData + DaylightSavingsStatus *BACnetApplicationTagBoolean + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataDaylightSavingsStatus is the corresponding interface of BACnetConstructedDataDaylightSavingsStatus +type IBACnetConstructedDataDaylightSavingsStatus interface { + IBACnetConstructedData + // GetDaylightSavingsStatus returns DaylightSavingsStatus (property field) + GetDaylightSavingsStatus() *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 *BACnetConstructedDataDaylightSavingsStatus) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_DAYLIGHT_SAVINGS_STATUS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataDaylightSavingsStatus) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataDaylightSavingsStatus) GetDaylightSavingsStatus() *BACnetApplicationTagBoolean { + return m.DaylightSavingsStatus +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataDaylightSavingsStatus factory function for BACnetConstructedDataDaylightSavingsStatus +func NewBACnetConstructedDataDaylightSavingsStatus(daylightSavingsStatus *BACnetApplicationTagBoolean, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataDaylightSavingsStatus { + _result := &BACnetConstructedDataDaylightSavingsStatus{ + DaylightSavingsStatus: daylightSavingsStatus, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataDaylightSavingsStatus(structType interface{}) *BACnetConstructedDataDaylightSavingsStatus { + if casted, ok := structType.(BACnetConstructedDataDaylightSavingsStatus); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataDaylightSavingsStatus); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataDaylightSavingsStatus(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataDaylightSavingsStatus(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) GetTypeName() string { + return "BACnetConstructedDataDaylightSavingsStatus" +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (daylightSavingsStatus) + lengthInBits += m.DaylightSavingsStatus.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataDaylightSavingsStatusParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataDaylightSavingsStatus, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataDaylightSavingsStatus"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (daylightSavingsStatus) + if pullErr := readBuffer.PullContext("daylightSavingsStatus"); pullErr != nil { + return nil, pullErr + } + _daylightSavingsStatus, _daylightSavingsStatusErr := BACnetApplicationTagParse(readBuffer) + if _daylightSavingsStatusErr != nil { + return nil, errors.Wrap(_daylightSavingsStatusErr, "Error parsing 'daylightSavingsStatus' field") + } + daylightSavingsStatus := CastBACnetApplicationTagBoolean(_daylightSavingsStatus) + if closeErr := readBuffer.CloseContext("daylightSavingsStatus"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataDaylightSavingsStatus"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataDaylightSavingsStatus{ + DaylightSavingsStatus: CastBACnetApplicationTagBoolean(daylightSavingsStatus), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataDaylightSavingsStatus"); pushErr != nil { + return pushErr + } + + // Simple Field (daylightSavingsStatus) + if pushErr := writeBuffer.PushContext("daylightSavingsStatus"); pushErr != nil { + return pushErr + } + _daylightSavingsStatusErr := m.DaylightSavingsStatus.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("daylightSavingsStatus"); popErr != nil { + return popErr + } + if _daylightSavingsStatusErr != nil { + return errors.Wrap(_daylightSavingsStatusErr, "Error serializing 'daylightSavingsStatus' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataDaylightSavingsStatus"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataDaylightSavingsStatus) 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/BACnetConstructedDataDeployedProfileLocation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeployedProfileLocation.go new file mode 100644 index 00000000000..2723ad3d3a8 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeployedProfileLocation.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. + +// BACnetConstructedDataDeployedProfileLocation is the data-structure of this message +type BACnetConstructedDataDeployedProfileLocation struct { + *BACnetConstructedData + DeployedProfileLocation *BACnetApplicationTagCharacterString + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataDeployedProfileLocation is the corresponding interface of BACnetConstructedDataDeployedProfileLocation +type IBACnetConstructedDataDeployedProfileLocation interface { + IBACnetConstructedData + // GetDeployedProfileLocation returns DeployedProfileLocation (property field) + GetDeployedProfileLocation() *BACnetApplicationTagCharacterString + // 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 *BACnetConstructedDataDeployedProfileLocation) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataDeployedProfileLocation) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_DEPLOYED_PROFILE_LOCATION +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataDeployedProfileLocation) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataDeployedProfileLocation) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataDeployedProfileLocation) GetDeployedProfileLocation() *BACnetApplicationTagCharacterString { + return m.DeployedProfileLocation +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataDeployedProfileLocation factory function for BACnetConstructedDataDeployedProfileLocation +func NewBACnetConstructedDataDeployedProfileLocation(deployedProfileLocation *BACnetApplicationTagCharacterString, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataDeployedProfileLocation { + _result := &BACnetConstructedDataDeployedProfileLocation{ + DeployedProfileLocation: deployedProfileLocation, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataDeployedProfileLocation(structType interface{}) *BACnetConstructedDataDeployedProfileLocation { + if casted, ok := structType.(BACnetConstructedDataDeployedProfileLocation); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataDeployedProfileLocation); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataDeployedProfileLocation(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataDeployedProfileLocation(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataDeployedProfileLocation) GetTypeName() string { + return "BACnetConstructedDataDeployedProfileLocation" +} + +func (m *BACnetConstructedDataDeployedProfileLocation) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataDeployedProfileLocation) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (deployedProfileLocation) + lengthInBits += m.DeployedProfileLocation.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataDeployedProfileLocation) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataDeployedProfileLocationParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataDeployedProfileLocation, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataDeployedProfileLocation"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (deployedProfileLocation) + if pullErr := readBuffer.PullContext("deployedProfileLocation"); pullErr != nil { + return nil, pullErr + } + _deployedProfileLocation, _deployedProfileLocationErr := BACnetApplicationTagParse(readBuffer) + if _deployedProfileLocationErr != nil { + return nil, errors.Wrap(_deployedProfileLocationErr, "Error parsing 'deployedProfileLocation' field") + } + deployedProfileLocation := CastBACnetApplicationTagCharacterString(_deployedProfileLocation) + if closeErr := readBuffer.CloseContext("deployedProfileLocation"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataDeployedProfileLocation"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataDeployedProfileLocation{ + DeployedProfileLocation: CastBACnetApplicationTagCharacterString(deployedProfileLocation), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataDeployedProfileLocation) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataDeployedProfileLocation"); pushErr != nil { + return pushErr + } + + // Simple Field (deployedProfileLocation) + if pushErr := writeBuffer.PushContext("deployedProfileLocation"); pushErr != nil { + return pushErr + } + _deployedProfileLocationErr := m.DeployedProfileLocation.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("deployedProfileLocation"); popErr != nil { + return popErr + } + if _deployedProfileLocationErr != nil { + return errors.Wrap(_deployedProfileLocationErr, "Error serializing 'deployedProfileLocation' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataDeployedProfileLocation"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataDeployedProfileLocation) 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/BACnetConstructedDataDeviceAddressBinding.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceAddressBinding.go new file mode 100644 index 00000000000..ed6594518dd --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataDeviceAddressBinding.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. + +// BACnetConstructedDataDeviceAddressBinding is the data-structure of this message +type BACnetConstructedDataDeviceAddressBinding struct { + *BACnetConstructedData + DeviceAddressBinding []*BACnetAddressBinding + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataDeviceAddressBinding is the corresponding interface of BACnetConstructedDataDeviceAddressBinding +type IBACnetConstructedDataDeviceAddressBinding interface { + IBACnetConstructedData + // GetDeviceAddressBinding returns DeviceAddressBinding (property field) + GetDeviceAddressBinding() []*BACnetAddressBinding + // 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 *BACnetConstructedDataDeviceAddressBinding) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataDeviceAddressBinding) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_DEVICE_ADDRESS_BINDING +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataDeviceAddressBinding) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataDeviceAddressBinding) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataDeviceAddressBinding) GetDeviceAddressBinding() []*BACnetAddressBinding { + return m.DeviceAddressBinding +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataDeviceAddressBinding factory function for BACnetConstructedDataDeviceAddressBinding +func NewBACnetConstructedDataDeviceAddressBinding(deviceAddressBinding []*BACnetAddressBinding, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataDeviceAddressBinding { + _result := &BACnetConstructedDataDeviceAddressBinding{ + DeviceAddressBinding: deviceAddressBinding, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataDeviceAddressBinding(structType interface{}) *BACnetConstructedDataDeviceAddressBinding { + if casted, ok := structType.(BACnetConstructedDataDeviceAddressBinding); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataDeviceAddressBinding); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataDeviceAddressBinding(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataDeviceAddressBinding(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataDeviceAddressBinding) GetTypeName() string { + return "BACnetConstructedDataDeviceAddressBinding" +} + +func (m *BACnetConstructedDataDeviceAddressBinding) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataDeviceAddressBinding) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.DeviceAddressBinding) > 0 { + for _, element := range m.DeviceAddressBinding { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataDeviceAddressBinding) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataDeviceAddressBindingParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataDeviceAddressBinding, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataDeviceAddressBinding"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (deviceAddressBinding) + if pullErr := readBuffer.PullContext("deviceAddressBinding", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + deviceAddressBinding := make([]*BACnetAddressBinding, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetAddressBindingParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'deviceAddressBinding' field") + } + deviceAddressBinding = append(deviceAddressBinding, CastBACnetAddressBinding(_item)) + + } + } + if closeErr := readBuffer.CloseContext("deviceAddressBinding", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataDeviceAddressBinding"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataDeviceAddressBinding{ + DeviceAddressBinding: deviceAddressBinding, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataDeviceAddressBinding) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataDeviceAddressBinding"); pushErr != nil { + return pushErr + } + + // Array Field (deviceAddressBinding) + if m.DeviceAddressBinding != nil { + if pushErr := writeBuffer.PushContext("deviceAddressBinding", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.DeviceAddressBinding { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'deviceAddressBinding' field") + } + } + if popErr := writeBuffer.PopContext("deviceAddressBinding", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataDeviceAddressBinding"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataDeviceAddressBinding) 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/BACnetConstructedDataFirmwareRevision.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFirmwareRevision.go new file mode 100644 index 00000000000..135be57f61d --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataFirmwareRevision.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. + +// BACnetConstructedDataFirmwareRevision is the data-structure of this message +type BACnetConstructedDataFirmwareRevision struct { + *BACnetConstructedData + FirmwareRevision *BACnetApplicationTagCharacterString + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataFirmwareRevision is the corresponding interface of BACnetConstructedDataFirmwareRevision +type IBACnetConstructedDataFirmwareRevision interface { + IBACnetConstructedData + // GetFirmwareRevision returns FirmwareRevision (property field) + GetFirmwareRevision() *BACnetApplicationTagCharacterString + // 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 *BACnetConstructedDataFirmwareRevision) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataFirmwareRevision) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_FIRMWARE_REVISION +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataFirmwareRevision) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataFirmwareRevision) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataFirmwareRevision) GetFirmwareRevision() *BACnetApplicationTagCharacterString { + return m.FirmwareRevision +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataFirmwareRevision factory function for BACnetConstructedDataFirmwareRevision +func NewBACnetConstructedDataFirmwareRevision(firmwareRevision *BACnetApplicationTagCharacterString, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataFirmwareRevision { + _result := &BACnetConstructedDataFirmwareRevision{ + FirmwareRevision: firmwareRevision, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataFirmwareRevision(structType interface{}) *BACnetConstructedDataFirmwareRevision { + if casted, ok := structType.(BACnetConstructedDataFirmwareRevision); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataFirmwareRevision); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataFirmwareRevision(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataFirmwareRevision(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataFirmwareRevision) GetTypeName() string { + return "BACnetConstructedDataFirmwareRevision" +} + +func (m *BACnetConstructedDataFirmwareRevision) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataFirmwareRevision) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (firmwareRevision) + lengthInBits += m.FirmwareRevision.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataFirmwareRevision) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataFirmwareRevisionParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataFirmwareRevision, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataFirmwareRevision"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (firmwareRevision) + if pullErr := readBuffer.PullContext("firmwareRevision"); pullErr != nil { + return nil, pullErr + } + _firmwareRevision, _firmwareRevisionErr := BACnetApplicationTagParse(readBuffer) + if _firmwareRevisionErr != nil { + return nil, errors.Wrap(_firmwareRevisionErr, "Error parsing 'firmwareRevision' field") + } + firmwareRevision := CastBACnetApplicationTagCharacterString(_firmwareRevision) + if closeErr := readBuffer.CloseContext("firmwareRevision"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataFirmwareRevision"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataFirmwareRevision{ + FirmwareRevision: CastBACnetApplicationTagCharacterString(firmwareRevision), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataFirmwareRevision) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataFirmwareRevision"); pushErr != nil { + return pushErr + } + + // Simple Field (firmwareRevision) + if pushErr := writeBuffer.PushContext("firmwareRevision"); pushErr != nil { + return pushErr + } + _firmwareRevisionErr := m.FirmwareRevision.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("firmwareRevision"); popErr != nil { + return popErr + } + if _firmwareRevisionErr != nil { + return errors.Wrap(_firmwareRevisionErr, "Error serializing 'firmwareRevision' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataFirmwareRevision"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataFirmwareRevision) 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/BACnetConstructedDataLastRestartReason.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestartReason.go new file mode 100644 index 00000000000..1ffd1d68334 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestartReason.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. + +// BACnetConstructedDataLastRestartReason is the data-structure of this message +type BACnetConstructedDataLastRestartReason struct { + *BACnetConstructedData + LastRestartReason *BACnetRestartReasonTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLastRestartReason is the corresponding interface of BACnetConstructedDataLastRestartReason +type IBACnetConstructedDataLastRestartReason interface { + IBACnetConstructedData + // GetLastRestartReason returns LastRestartReason (property field) + GetLastRestartReason() *BACnetRestartReasonTagged + // 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 *BACnetConstructedDataLastRestartReason) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLastRestartReason) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LAST_RESTART_REASON +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLastRestartReason) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLastRestartReason) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLastRestartReason) GetLastRestartReason() *BACnetRestartReasonTagged { + return m.LastRestartReason +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLastRestartReason factory function for BACnetConstructedDataLastRestartReason +func NewBACnetConstructedDataLastRestartReason(lastRestartReason *BACnetRestartReasonTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLastRestartReason { + _result := &BACnetConstructedDataLastRestartReason{ + LastRestartReason: lastRestartReason, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLastRestartReason(structType interface{}) *BACnetConstructedDataLastRestartReason { + if casted, ok := structType.(BACnetConstructedDataLastRestartReason); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLastRestartReason); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLastRestartReason(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLastRestartReason(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLastRestartReason) GetTypeName() string { + return "BACnetConstructedDataLastRestartReason" +} + +func (m *BACnetConstructedDataLastRestartReason) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLastRestartReason) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (lastRestartReason) + lengthInBits += m.LastRestartReason.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLastRestartReason) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLastRestartReasonParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLastRestartReason, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLastRestartReason"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (lastRestartReason) + if pullErr := readBuffer.PullContext("lastRestartReason"); pullErr != nil { + return nil, pullErr + } + _lastRestartReason, _lastRestartReasonErr := BACnetRestartReasonTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _lastRestartReasonErr != nil { + return nil, errors.Wrap(_lastRestartReasonErr, "Error parsing 'lastRestartReason' field") + } + lastRestartReason := CastBACnetRestartReasonTagged(_lastRestartReason) + if closeErr := readBuffer.CloseContext("lastRestartReason"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLastRestartReason"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLastRestartReason{ + LastRestartReason: CastBACnetRestartReasonTagged(lastRestartReason), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLastRestartReason) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLastRestartReason"); pushErr != nil { + return pushErr + } + + // Simple Field (lastRestartReason) + if pushErr := writeBuffer.PushContext("lastRestartReason"); pushErr != nil { + return pushErr + } + _lastRestartReasonErr := m.LastRestartReason.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("lastRestartReason"); popErr != nil { + return popErr + } + if _lastRestartReasonErr != nil { + return errors.Wrap(_lastRestartReasonErr, "Error serializing 'lastRestartReason' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLastRestartReason"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLastRestartReason) 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/BACnetConstructedDataLastRestoreTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestoreTime.go new file mode 100644 index 00000000000..b021ac1faa7 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLastRestoreTime.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. + +// BACnetConstructedDataLastRestoreTime is the data-structure of this message +type BACnetConstructedDataLastRestoreTime struct { + *BACnetConstructedData + LastRestoreTime *BACnetTimeStamp + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLastRestoreTime is the corresponding interface of BACnetConstructedDataLastRestoreTime +type IBACnetConstructedDataLastRestoreTime interface { + IBACnetConstructedData + // GetLastRestoreTime returns LastRestoreTime (property field) + GetLastRestoreTime() *BACnetTimeStamp + // 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 *BACnetConstructedDataLastRestoreTime) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLastRestoreTime) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LAST_RESTORE_TIME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLastRestoreTime) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLastRestoreTime) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLastRestoreTime) GetLastRestoreTime() *BACnetTimeStamp { + return m.LastRestoreTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLastRestoreTime factory function for BACnetConstructedDataLastRestoreTime +func NewBACnetConstructedDataLastRestoreTime(lastRestoreTime *BACnetTimeStamp, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLastRestoreTime { + _result := &BACnetConstructedDataLastRestoreTime{ + LastRestoreTime: lastRestoreTime, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLastRestoreTime(structType interface{}) *BACnetConstructedDataLastRestoreTime { + if casted, ok := structType.(BACnetConstructedDataLastRestoreTime); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLastRestoreTime); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLastRestoreTime(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLastRestoreTime(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLastRestoreTime) GetTypeName() string { + return "BACnetConstructedDataLastRestoreTime" +} + +func (m *BACnetConstructedDataLastRestoreTime) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLastRestoreTime) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (lastRestoreTime) + lengthInBits += m.LastRestoreTime.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLastRestoreTime) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLastRestoreTimeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLastRestoreTime, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLastRestoreTime"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (lastRestoreTime) + if pullErr := readBuffer.PullContext("lastRestoreTime"); pullErr != nil { + return nil, pullErr + } + _lastRestoreTime, _lastRestoreTimeErr := BACnetTimeStampParse(readBuffer) + if _lastRestoreTimeErr != nil { + return nil, errors.Wrap(_lastRestoreTimeErr, "Error parsing 'lastRestoreTime' field") + } + lastRestoreTime := CastBACnetTimeStamp(_lastRestoreTime) + if closeErr := readBuffer.CloseContext("lastRestoreTime"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLastRestoreTime"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLastRestoreTime{ + LastRestoreTime: CastBACnetTimeStamp(lastRestoreTime), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLastRestoreTime) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLastRestoreTime"); pushErr != nil { + return pushErr + } + + // Simple Field (lastRestoreTime) + if pushErr := writeBuffer.PushContext("lastRestoreTime"); pushErr != nil { + return pushErr + } + _lastRestoreTimeErr := m.LastRestoreTime.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("lastRestoreTime"); popErr != nil { + return popErr + } + if _lastRestoreTimeErr != nil { + return errors.Wrap(_lastRestoreTimeErr, "Error serializing 'lastRestoreTime' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLastRestoreTime"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLastRestoreTime) 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/BACnetConstructedDataLocalDate.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalDate.go new file mode 100644 index 00000000000..f45f7b1d616 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalDate.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. + +// BACnetConstructedDataLocalDate is the data-structure of this message +type BACnetConstructedDataLocalDate struct { + *BACnetConstructedData + LocalDate *BACnetApplicationTagDate + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLocalDate is the corresponding interface of BACnetConstructedDataLocalDate +type IBACnetConstructedDataLocalDate interface { + IBACnetConstructedData + // GetLocalDate returns LocalDate (property field) + GetLocalDate() *BACnetApplicationTagDate + // 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 *BACnetConstructedDataLocalDate) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLocalDate) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LOCAL_DATE +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLocalDate) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLocalDate) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLocalDate) GetLocalDate() *BACnetApplicationTagDate { + return m.LocalDate +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLocalDate factory function for BACnetConstructedDataLocalDate +func NewBACnetConstructedDataLocalDate(localDate *BACnetApplicationTagDate, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLocalDate { + _result := &BACnetConstructedDataLocalDate{ + LocalDate: localDate, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLocalDate(structType interface{}) *BACnetConstructedDataLocalDate { + if casted, ok := structType.(BACnetConstructedDataLocalDate); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLocalDate); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLocalDate(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLocalDate(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLocalDate) GetTypeName() string { + return "BACnetConstructedDataLocalDate" +} + +func (m *BACnetConstructedDataLocalDate) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLocalDate) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (localDate) + lengthInBits += m.LocalDate.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLocalDate) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLocalDateParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLocalDate, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLocalDate"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (localDate) + if pullErr := readBuffer.PullContext("localDate"); pullErr != nil { + return nil, pullErr + } + _localDate, _localDateErr := BACnetApplicationTagParse(readBuffer) + if _localDateErr != nil { + return nil, errors.Wrap(_localDateErr, "Error parsing 'localDate' field") + } + localDate := CastBACnetApplicationTagDate(_localDate) + if closeErr := readBuffer.CloseContext("localDate"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLocalDate"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLocalDate{ + LocalDate: CastBACnetApplicationTagDate(localDate), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLocalDate) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLocalDate"); pushErr != nil { + return pushErr + } + + // Simple Field (localDate) + if pushErr := writeBuffer.PushContext("localDate"); pushErr != nil { + return pushErr + } + _localDateErr := m.LocalDate.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("localDate"); popErr != nil { + return popErr + } + if _localDateErr != nil { + return errors.Wrap(_localDateErr, "Error serializing 'localDate' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLocalDate"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLocalDate) 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/BACnetConstructedDataLocalTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalTime.go new file mode 100644 index 00000000000..c44e2d7b051 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocalTime.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. + +// BACnetConstructedDataLocalTime is the data-structure of this message +type BACnetConstructedDataLocalTime struct { + *BACnetConstructedData + LocalTime *BACnetApplicationTagTime + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLocalTime is the corresponding interface of BACnetConstructedDataLocalTime +type IBACnetConstructedDataLocalTime interface { + IBACnetConstructedData + // GetLocalTime returns LocalTime (property field) + GetLocalTime() *BACnetApplicationTagTime + // 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 *BACnetConstructedDataLocalTime) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLocalTime) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LOCAL_TIME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLocalTime) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLocalTime) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLocalTime) GetLocalTime() *BACnetApplicationTagTime { + return m.LocalTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLocalTime factory function for BACnetConstructedDataLocalTime +func NewBACnetConstructedDataLocalTime(localTime *BACnetApplicationTagTime, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLocalTime { + _result := &BACnetConstructedDataLocalTime{ + LocalTime: localTime, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLocalTime(structType interface{}) *BACnetConstructedDataLocalTime { + if casted, ok := structType.(BACnetConstructedDataLocalTime); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLocalTime); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLocalTime(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLocalTime(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLocalTime) GetTypeName() string { + return "BACnetConstructedDataLocalTime" +} + +func (m *BACnetConstructedDataLocalTime) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLocalTime) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (localTime) + lengthInBits += m.LocalTime.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLocalTime) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLocalTimeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLocalTime, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLocalTime"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (localTime) + if pullErr := readBuffer.PullContext("localTime"); pullErr != nil { + return nil, pullErr + } + _localTime, _localTimeErr := BACnetApplicationTagParse(readBuffer) + if _localTimeErr != nil { + return nil, errors.Wrap(_localTimeErr, "Error parsing 'localTime' field") + } + localTime := CastBACnetApplicationTagTime(_localTime) + if closeErr := readBuffer.CloseContext("localTime"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLocalTime"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLocalTime{ + LocalTime: CastBACnetApplicationTagTime(localTime), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLocalTime) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLocalTime"); pushErr != nil { + return pushErr + } + + // Simple Field (localTime) + if pushErr := writeBuffer.PushContext("localTime"); pushErr != nil { + return pushErr + } + _localTimeErr := m.LocalTime.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("localTime"); popErr != nil { + return popErr + } + if _localTimeErr != nil { + return errors.Wrap(_localTimeErr, "Error serializing 'localTime' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLocalTime"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLocalTime) 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/BACnetConstructedDataLocation.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocation.go new file mode 100644 index 00000000000..049cdf75ca1 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataLocation.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. + +// BACnetConstructedDataLocation is the data-structure of this message +type BACnetConstructedDataLocation struct { + *BACnetConstructedData + Location *BACnetApplicationTagCharacterString + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataLocation is the corresponding interface of BACnetConstructedDataLocation +type IBACnetConstructedDataLocation interface { + IBACnetConstructedData + // GetLocation returns Location (property field) + GetLocation() *BACnetApplicationTagCharacterString + // 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 *BACnetConstructedDataLocation) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataLocation) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_LOCATION +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataLocation) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataLocation) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataLocation) GetLocation() *BACnetApplicationTagCharacterString { + return m.Location +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataLocation factory function for BACnetConstructedDataLocation +func NewBACnetConstructedDataLocation(location *BACnetApplicationTagCharacterString, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataLocation { + _result := &BACnetConstructedDataLocation{ + Location: location, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataLocation(structType interface{}) *BACnetConstructedDataLocation { + if casted, ok := structType.(BACnetConstructedDataLocation); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataLocation); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataLocation(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataLocation(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataLocation) GetTypeName() string { + return "BACnetConstructedDataLocation" +} + +func (m *BACnetConstructedDataLocation) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataLocation) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (location) + lengthInBits += m.Location.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataLocation) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataLocationParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataLocation, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataLocation"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (location) + if pullErr := readBuffer.PullContext("location"); pullErr != nil { + return nil, pullErr + } + _location, _locationErr := BACnetApplicationTagParse(readBuffer) + if _locationErr != nil { + return nil, errors.Wrap(_locationErr, "Error parsing 'location' field") + } + location := CastBACnetApplicationTagCharacterString(_location) + if closeErr := readBuffer.CloseContext("location"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataLocation"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataLocation{ + Location: CastBACnetApplicationTagCharacterString(location), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataLocation) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataLocation"); pushErr != nil { + return pushErr + } + + // Simple Field (location) + if pushErr := writeBuffer.PushContext("location"); pushErr != nil { + return pushErr + } + _locationErr := m.Location.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("location"); popErr != nil { + return popErr + } + if _locationErr != nil { + return errors.Wrap(_locationErr, "Error serializing 'location' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataLocation"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataLocation) 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/BACnetConstructedDataMaxAPDULengthAccepted.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxAPDULengthAccepted.go new file mode 100644 index 00000000000..345018044a6 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxAPDULengthAccepted.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. + +// BACnetConstructedDataMaxAPDULengthAccepted is the data-structure of this message +type BACnetConstructedDataMaxAPDULengthAccepted struct { + *BACnetConstructedData + MaxApduLengthAccepted *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataMaxAPDULengthAccepted is the corresponding interface of BACnetConstructedDataMaxAPDULengthAccepted +type IBACnetConstructedDataMaxAPDULengthAccepted interface { + IBACnetConstructedData + // GetMaxApduLengthAccepted returns MaxApduLengthAccepted (property field) + GetMaxApduLengthAccepted() *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 *BACnetConstructedDataMaxAPDULengthAccepted) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_MAX_APDU_LENGTH_ACCEPTED +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) GetMaxApduLengthAccepted() *BACnetApplicationTagUnsignedInteger { + return m.MaxApduLengthAccepted +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataMaxAPDULengthAccepted factory function for BACnetConstructedDataMaxAPDULengthAccepted +func NewBACnetConstructedDataMaxAPDULengthAccepted(maxApduLengthAccepted *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataMaxAPDULengthAccepted { + _result := &BACnetConstructedDataMaxAPDULengthAccepted{ + MaxApduLengthAccepted: maxApduLengthAccepted, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataMaxAPDULengthAccepted(structType interface{}) *BACnetConstructedDataMaxAPDULengthAccepted { + if casted, ok := structType.(BACnetConstructedDataMaxAPDULengthAccepted); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataMaxAPDULengthAccepted); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataMaxAPDULengthAccepted(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataMaxAPDULengthAccepted(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) GetTypeName() string { + return "BACnetConstructedDataMaxAPDULengthAccepted" +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (maxApduLengthAccepted) + lengthInBits += m.MaxApduLengthAccepted.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataMaxAPDULengthAcceptedParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataMaxAPDULengthAccepted, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataMaxAPDULengthAccepted"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (maxApduLengthAccepted) + if pullErr := readBuffer.PullContext("maxApduLengthAccepted"); pullErr != nil { + return nil, pullErr + } + _maxApduLengthAccepted, _maxApduLengthAcceptedErr := BACnetApplicationTagParse(readBuffer) + if _maxApduLengthAcceptedErr != nil { + return nil, errors.Wrap(_maxApduLengthAcceptedErr, "Error parsing 'maxApduLengthAccepted' field") + } + maxApduLengthAccepted := CastBACnetApplicationTagUnsignedInteger(_maxApduLengthAccepted) + if closeErr := readBuffer.CloseContext("maxApduLengthAccepted"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataMaxAPDULengthAccepted"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataMaxAPDULengthAccepted{ + MaxApduLengthAccepted: CastBACnetApplicationTagUnsignedInteger(maxApduLengthAccepted), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataMaxAPDULengthAccepted"); pushErr != nil { + return pushErr + } + + // Simple Field (maxApduLengthAccepted) + if pushErr := writeBuffer.PushContext("maxApduLengthAccepted"); pushErr != nil { + return pushErr + } + _maxApduLengthAcceptedErr := m.MaxApduLengthAccepted.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("maxApduLengthAccepted"); popErr != nil { + return popErr + } + if _maxApduLengthAcceptedErr != nil { + return errors.Wrap(_maxApduLengthAcceptedErr, "Error serializing 'maxApduLengthAccepted' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataMaxAPDULengthAccepted"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataMaxAPDULengthAccepted) 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/BACnetConstructedDataMaxSegmentsAccepted.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxSegmentsAccepted.go new file mode 100644 index 00000000000..eb207faa76b --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataMaxSegmentsAccepted.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. + +// BACnetConstructedDataMaxSegmentsAccepted is the data-structure of this message +type BACnetConstructedDataMaxSegmentsAccepted struct { + *BACnetConstructedData + MaxSegmentsAccepted *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataMaxSegmentsAccepted is the corresponding interface of BACnetConstructedDataMaxSegmentsAccepted +type IBACnetConstructedDataMaxSegmentsAccepted interface { + IBACnetConstructedData + // GetMaxSegmentsAccepted returns MaxSegmentsAccepted (property field) + GetMaxSegmentsAccepted() *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 *BACnetConstructedDataMaxSegmentsAccepted) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_MAX_SEGMENTS_ACCEPTED +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataMaxSegmentsAccepted) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataMaxSegmentsAccepted) GetMaxSegmentsAccepted() *BACnetApplicationTagUnsignedInteger { + return m.MaxSegmentsAccepted +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataMaxSegmentsAccepted factory function for BACnetConstructedDataMaxSegmentsAccepted +func NewBACnetConstructedDataMaxSegmentsAccepted(maxSegmentsAccepted *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataMaxSegmentsAccepted { + _result := &BACnetConstructedDataMaxSegmentsAccepted{ + MaxSegmentsAccepted: maxSegmentsAccepted, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataMaxSegmentsAccepted(structType interface{}) *BACnetConstructedDataMaxSegmentsAccepted { + if casted, ok := structType.(BACnetConstructedDataMaxSegmentsAccepted); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataMaxSegmentsAccepted); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataMaxSegmentsAccepted(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataMaxSegmentsAccepted(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) GetTypeName() string { + return "BACnetConstructedDataMaxSegmentsAccepted" +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (maxSegmentsAccepted) + lengthInBits += m.MaxSegmentsAccepted.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataMaxSegmentsAcceptedParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataMaxSegmentsAccepted, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataMaxSegmentsAccepted"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (maxSegmentsAccepted) + if pullErr := readBuffer.PullContext("maxSegmentsAccepted"); pullErr != nil { + return nil, pullErr + } + _maxSegmentsAccepted, _maxSegmentsAcceptedErr := BACnetApplicationTagParse(readBuffer) + if _maxSegmentsAcceptedErr != nil { + return nil, errors.Wrap(_maxSegmentsAcceptedErr, "Error parsing 'maxSegmentsAccepted' field") + } + maxSegmentsAccepted := CastBACnetApplicationTagUnsignedInteger(_maxSegmentsAccepted) + if closeErr := readBuffer.CloseContext("maxSegmentsAccepted"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataMaxSegmentsAccepted"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataMaxSegmentsAccepted{ + MaxSegmentsAccepted: CastBACnetApplicationTagUnsignedInteger(maxSegmentsAccepted), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataMaxSegmentsAccepted"); pushErr != nil { + return pushErr + } + + // Simple Field (maxSegmentsAccepted) + if pushErr := writeBuffer.PushContext("maxSegmentsAccepted"); pushErr != nil { + return pushErr + } + _maxSegmentsAcceptedErr := m.MaxSegmentsAccepted.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("maxSegmentsAccepted"); popErr != nil { + return popErr + } + if _maxSegmentsAcceptedErr != nil { + return errors.Wrap(_maxSegmentsAcceptedErr, "Error serializing 'maxSegmentsAccepted' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataMaxSegmentsAccepted"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataMaxSegmentsAccepted) 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/BACnetConstructedDataModelName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataModelName.go new file mode 100644 index 00000000000..b9779daf87c --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataModelName.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. + +// BACnetConstructedDataModelName is the data-structure of this message +type BACnetConstructedDataModelName struct { + *BACnetConstructedData + ModelName *BACnetApplicationTagCharacterString + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataModelName is the corresponding interface of BACnetConstructedDataModelName +type IBACnetConstructedDataModelName interface { + IBACnetConstructedData + // GetModelName returns ModelName (property field) + GetModelName() *BACnetApplicationTagCharacterString + // 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 *BACnetConstructedDataModelName) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataModelName) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_MODEL_NAME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataModelName) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataModelName) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataModelName) GetModelName() *BACnetApplicationTagCharacterString { + return m.ModelName +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataModelName factory function for BACnetConstructedDataModelName +func NewBACnetConstructedDataModelName(modelName *BACnetApplicationTagCharacterString, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataModelName { + _result := &BACnetConstructedDataModelName{ + ModelName: modelName, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataModelName(structType interface{}) *BACnetConstructedDataModelName { + if casted, ok := structType.(BACnetConstructedDataModelName); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataModelName); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataModelName(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataModelName(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataModelName) GetTypeName() string { + return "BACnetConstructedDataModelName" +} + +func (m *BACnetConstructedDataModelName) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataModelName) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (modelName) + lengthInBits += m.ModelName.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataModelName) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataModelNameParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataModelName, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataModelName"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (modelName) + if pullErr := readBuffer.PullContext("modelName"); pullErr != nil { + return nil, pullErr + } + _modelName, _modelNameErr := BACnetApplicationTagParse(readBuffer) + if _modelNameErr != nil { + return nil, errors.Wrap(_modelNameErr, "Error parsing 'modelName' field") + } + modelName := CastBACnetApplicationTagCharacterString(_modelName) + if closeErr := readBuffer.CloseContext("modelName"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataModelName"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataModelName{ + ModelName: CastBACnetApplicationTagCharacterString(modelName), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataModelName) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataModelName"); pushErr != nil { + return pushErr + } + + // Simple Field (modelName) + if pushErr := writeBuffer.PushContext("modelName"); pushErr != nil { + return pushErr + } + _modelNameErr := m.ModelName.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("modelName"); popErr != nil { + return popErr + } + if _modelNameErr != nil { + return errors.Wrap(_modelNameErr, "Error serializing 'modelName' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataModelName"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataModelName) 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/BACnetConstructedDataNumberOfAPDURetries.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfAPDURetries.go new file mode 100644 index 00000000000..04d3d32a48c --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataNumberOfAPDURetries.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. + +// BACnetConstructedDataNumberOfAPDURetries is the data-structure of this message +type BACnetConstructedDataNumberOfAPDURetries struct { + *BACnetConstructedData + NumberOfApduRetries *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataNumberOfAPDURetries is the corresponding interface of BACnetConstructedDataNumberOfAPDURetries +type IBACnetConstructedDataNumberOfAPDURetries interface { + IBACnetConstructedData + // GetNumberOfApduRetries returns NumberOfApduRetries (property field) + GetNumberOfApduRetries() *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 *BACnetConstructedDataNumberOfAPDURetries) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_NUMBER_OF_APDU_RETRIES +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataNumberOfAPDURetries) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataNumberOfAPDURetries) GetNumberOfApduRetries() *BACnetApplicationTagUnsignedInteger { + return m.NumberOfApduRetries +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataNumberOfAPDURetries factory function for BACnetConstructedDataNumberOfAPDURetries +func NewBACnetConstructedDataNumberOfAPDURetries(numberOfApduRetries *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataNumberOfAPDURetries { + _result := &BACnetConstructedDataNumberOfAPDURetries{ + NumberOfApduRetries: numberOfApduRetries, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataNumberOfAPDURetries(structType interface{}) *BACnetConstructedDataNumberOfAPDURetries { + if casted, ok := structType.(BACnetConstructedDataNumberOfAPDURetries); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataNumberOfAPDURetries); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataNumberOfAPDURetries(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataNumberOfAPDURetries(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) GetTypeName() string { + return "BACnetConstructedDataNumberOfAPDURetries" +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (numberOfApduRetries) + lengthInBits += m.NumberOfApduRetries.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataNumberOfAPDURetriesParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataNumberOfAPDURetries, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataNumberOfAPDURetries"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (numberOfApduRetries) + if pullErr := readBuffer.PullContext("numberOfApduRetries"); pullErr != nil { + return nil, pullErr + } + _numberOfApduRetries, _numberOfApduRetriesErr := BACnetApplicationTagParse(readBuffer) + if _numberOfApduRetriesErr != nil { + return nil, errors.Wrap(_numberOfApduRetriesErr, "Error parsing 'numberOfApduRetries' field") + } + numberOfApduRetries := CastBACnetApplicationTagUnsignedInteger(_numberOfApduRetries) + if closeErr := readBuffer.CloseContext("numberOfApduRetries"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataNumberOfAPDURetries"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataNumberOfAPDURetries{ + NumberOfApduRetries: CastBACnetApplicationTagUnsignedInteger(numberOfApduRetries), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataNumberOfAPDURetries"); pushErr != nil { + return pushErr + } + + // Simple Field (numberOfApduRetries) + if pushErr := writeBuffer.PushContext("numberOfApduRetries"); pushErr != nil { + return pushErr + } + _numberOfApduRetriesErr := m.NumberOfApduRetries.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("numberOfApduRetries"); popErr != nil { + return popErr + } + if _numberOfApduRetriesErr != nil { + return errors.Wrap(_numberOfApduRetriesErr, "Error serializing 'numberOfApduRetries' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataNumberOfAPDURetries"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataNumberOfAPDURetries) 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/BACnetConstructedDataObjectList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectList.go new file mode 100644 index 00000000000..97cd8ddde48 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataObjectList.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. + +// BACnetConstructedDataObjectList is the data-structure of this message +type BACnetConstructedDataObjectList struct { + *BACnetConstructedData + ObjectList []*BACnetObjectIdentifierOrUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataObjectList is the corresponding interface of BACnetConstructedDataObjectList +type IBACnetConstructedDataObjectList interface { + IBACnetConstructedData + // GetObjectList returns ObjectList (property field) + GetObjectList() []*BACnetObjectIdentifierOrUnsignedInteger + // 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 *BACnetConstructedDataObjectList) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataObjectList) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_OBJECT_LIST +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataObjectList) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataObjectList) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataObjectList) GetObjectList() []*BACnetObjectIdentifierOrUnsignedInteger { + return m.ObjectList +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataObjectList factory function for BACnetConstructedDataObjectList +func NewBACnetConstructedDataObjectList(objectList []*BACnetObjectIdentifierOrUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataObjectList { + _result := &BACnetConstructedDataObjectList{ + ObjectList: objectList, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataObjectList(structType interface{}) *BACnetConstructedDataObjectList { + if casted, ok := structType.(BACnetConstructedDataObjectList); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataObjectList); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataObjectList(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataObjectList(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataObjectList) GetTypeName() string { + return "BACnetConstructedDataObjectList" +} + +func (m *BACnetConstructedDataObjectList) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataObjectList) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.ObjectList) > 0 { + for _, element := range m.ObjectList { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataObjectList) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataObjectListParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataObjectList, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataObjectList"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (objectList) + if pullErr := readBuffer.PullContext("objectList", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + objectList := make([]*BACnetObjectIdentifierOrUnsignedInteger, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetObjectIdentifierOrUnsignedIntegerParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'objectList' field") + } + objectList = append(objectList, CastBACnetObjectIdentifierOrUnsignedInteger(_item)) + + } + } + if closeErr := readBuffer.CloseContext("objectList", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataObjectList"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataObjectList{ + ObjectList: objectList, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataObjectList) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataObjectList"); pushErr != nil { + return pushErr + } + + // Array Field (objectList) + if m.ObjectList != nil { + if pushErr := writeBuffer.PushContext("objectList", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.ObjectList { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'objectList' field") + } + } + if popErr := writeBuffer.PopContext("objectList", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataObjectList"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataObjectList) 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/BACnetConstructedDataProtocolObjectTypesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolObjectTypesSupported.go new file mode 100644 index 00000000000..7a375130648 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolObjectTypesSupported.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. + +// BACnetConstructedDataProtocolObjectTypesSupported is the data-structure of this message +type BACnetConstructedDataProtocolObjectTypesSupported struct { + *BACnetConstructedData + ProtocolObjectTypesSupported *BACnetObjectTypesSupportedTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataProtocolObjectTypesSupported is the corresponding interface of BACnetConstructedDataProtocolObjectTypesSupported +type IBACnetConstructedDataProtocolObjectTypesSupported interface { + IBACnetConstructedData + // GetProtocolObjectTypesSupported returns ProtocolObjectTypesSupported (property field) + GetProtocolObjectTypesSupported() *BACnetObjectTypesSupportedTagged + // 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 *BACnetConstructedDataProtocolObjectTypesSupported) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_PROTOCOL_OBJECT_TYPES_SUPPORTED +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) GetProtocolObjectTypesSupported() *BACnetObjectTypesSupportedTagged { + return m.ProtocolObjectTypesSupported +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataProtocolObjectTypesSupported factory function for BACnetConstructedDataProtocolObjectTypesSupported +func NewBACnetConstructedDataProtocolObjectTypesSupported(protocolObjectTypesSupported *BACnetObjectTypesSupportedTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataProtocolObjectTypesSupported { + _result := &BACnetConstructedDataProtocolObjectTypesSupported{ + ProtocolObjectTypesSupported: protocolObjectTypesSupported, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataProtocolObjectTypesSupported(structType interface{}) *BACnetConstructedDataProtocolObjectTypesSupported { + if casted, ok := structType.(BACnetConstructedDataProtocolObjectTypesSupported); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataProtocolObjectTypesSupported); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolObjectTypesSupported(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolObjectTypesSupported(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) GetTypeName() string { + return "BACnetConstructedDataProtocolObjectTypesSupported" +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (protocolObjectTypesSupported) + lengthInBits += m.ProtocolObjectTypesSupported.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataProtocolObjectTypesSupportedParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataProtocolObjectTypesSupported, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataProtocolObjectTypesSupported"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (protocolObjectTypesSupported) + if pullErr := readBuffer.PullContext("protocolObjectTypesSupported"); pullErr != nil { + return nil, pullErr + } + _protocolObjectTypesSupported, _protocolObjectTypesSupportedErr := BACnetObjectTypesSupportedTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _protocolObjectTypesSupportedErr != nil { + return nil, errors.Wrap(_protocolObjectTypesSupportedErr, "Error parsing 'protocolObjectTypesSupported' field") + } + protocolObjectTypesSupported := CastBACnetObjectTypesSupportedTagged(_protocolObjectTypesSupported) + if closeErr := readBuffer.CloseContext("protocolObjectTypesSupported"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataProtocolObjectTypesSupported"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataProtocolObjectTypesSupported{ + ProtocolObjectTypesSupported: CastBACnetObjectTypesSupportedTagged(protocolObjectTypesSupported), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataProtocolObjectTypesSupported"); pushErr != nil { + return pushErr + } + + // Simple Field (protocolObjectTypesSupported) + if pushErr := writeBuffer.PushContext("protocolObjectTypesSupported"); pushErr != nil { + return pushErr + } + _protocolObjectTypesSupportedErr := m.ProtocolObjectTypesSupported.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("protocolObjectTypesSupported"); popErr != nil { + return popErr + } + if _protocolObjectTypesSupportedErr != nil { + return errors.Wrap(_protocolObjectTypesSupportedErr, "Error serializing 'protocolObjectTypesSupported' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataProtocolObjectTypesSupported"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataProtocolObjectTypesSupported) 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/BACnetConstructedDataProtocolRevision.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolRevision.go new file mode 100644 index 00000000000..4cac0f10ee8 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolRevision.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. + +// BACnetConstructedDataProtocolRevision is the data-structure of this message +type BACnetConstructedDataProtocolRevision struct { + *BACnetConstructedData + ProtocolRevision *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataProtocolRevision is the corresponding interface of BACnetConstructedDataProtocolRevision +type IBACnetConstructedDataProtocolRevision interface { + IBACnetConstructedData + // GetProtocolRevision returns ProtocolRevision (property field) + GetProtocolRevision() *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 *BACnetConstructedDataProtocolRevision) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataProtocolRevision) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_PROTOCOL_REVISION +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataProtocolRevision) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataProtocolRevision) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataProtocolRevision) GetProtocolRevision() *BACnetApplicationTagUnsignedInteger { + return m.ProtocolRevision +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataProtocolRevision factory function for BACnetConstructedDataProtocolRevision +func NewBACnetConstructedDataProtocolRevision(protocolRevision *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataProtocolRevision { + _result := &BACnetConstructedDataProtocolRevision{ + ProtocolRevision: protocolRevision, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataProtocolRevision(structType interface{}) *BACnetConstructedDataProtocolRevision { + if casted, ok := structType.(BACnetConstructedDataProtocolRevision); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataProtocolRevision); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolRevision(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolRevision(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataProtocolRevision) GetTypeName() string { + return "BACnetConstructedDataProtocolRevision" +} + +func (m *BACnetConstructedDataProtocolRevision) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataProtocolRevision) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (protocolRevision) + lengthInBits += m.ProtocolRevision.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataProtocolRevision) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataProtocolRevisionParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataProtocolRevision, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataProtocolRevision"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (protocolRevision) + if pullErr := readBuffer.PullContext("protocolRevision"); pullErr != nil { + return nil, pullErr + } + _protocolRevision, _protocolRevisionErr := BACnetApplicationTagParse(readBuffer) + if _protocolRevisionErr != nil { + return nil, errors.Wrap(_protocolRevisionErr, "Error parsing 'protocolRevision' field") + } + protocolRevision := CastBACnetApplicationTagUnsignedInteger(_protocolRevision) + if closeErr := readBuffer.CloseContext("protocolRevision"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataProtocolRevision"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataProtocolRevision{ + ProtocolRevision: CastBACnetApplicationTagUnsignedInteger(protocolRevision), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataProtocolRevision) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataProtocolRevision"); pushErr != nil { + return pushErr + } + + // Simple Field (protocolRevision) + if pushErr := writeBuffer.PushContext("protocolRevision"); pushErr != nil { + return pushErr + } + _protocolRevisionErr := m.ProtocolRevision.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("protocolRevision"); popErr != nil { + return popErr + } + if _protocolRevisionErr != nil { + return errors.Wrap(_protocolRevisionErr, "Error serializing 'protocolRevision' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataProtocolRevision"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataProtocolRevision) 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/BACnetConstructedDataProtocolServicesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolServicesSupported.go new file mode 100644 index 00000000000..668cf386fb5 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolServicesSupported.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. + +// BACnetConstructedDataProtocolServicesSupported is the data-structure of this message +type BACnetConstructedDataProtocolServicesSupported struct { + *BACnetConstructedData + ProtocolServicesSupported *BACnetServicesSupportedTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataProtocolServicesSupported is the corresponding interface of BACnetConstructedDataProtocolServicesSupported +type IBACnetConstructedDataProtocolServicesSupported interface { + IBACnetConstructedData + // GetProtocolServicesSupported returns ProtocolServicesSupported (property field) + GetProtocolServicesSupported() *BACnetServicesSupportedTagged + // 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 *BACnetConstructedDataProtocolServicesSupported) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataProtocolServicesSupported) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_PROTOCOL_SERVICES_SUPPORTED +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataProtocolServicesSupported) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataProtocolServicesSupported) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataProtocolServicesSupported) GetProtocolServicesSupported() *BACnetServicesSupportedTagged { + return m.ProtocolServicesSupported +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataProtocolServicesSupported factory function for BACnetConstructedDataProtocolServicesSupported +func NewBACnetConstructedDataProtocolServicesSupported(protocolServicesSupported *BACnetServicesSupportedTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataProtocolServicesSupported { + _result := &BACnetConstructedDataProtocolServicesSupported{ + ProtocolServicesSupported: protocolServicesSupported, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataProtocolServicesSupported(structType interface{}) *BACnetConstructedDataProtocolServicesSupported { + if casted, ok := structType.(BACnetConstructedDataProtocolServicesSupported); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataProtocolServicesSupported); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolServicesSupported(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolServicesSupported(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataProtocolServicesSupported) GetTypeName() string { + return "BACnetConstructedDataProtocolServicesSupported" +} + +func (m *BACnetConstructedDataProtocolServicesSupported) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataProtocolServicesSupported) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (protocolServicesSupported) + lengthInBits += m.ProtocolServicesSupported.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataProtocolServicesSupported) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataProtocolServicesSupportedParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataProtocolServicesSupported, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataProtocolServicesSupported"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (protocolServicesSupported) + if pullErr := readBuffer.PullContext("protocolServicesSupported"); pullErr != nil { + return nil, pullErr + } + _protocolServicesSupported, _protocolServicesSupportedErr := BACnetServicesSupportedTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _protocolServicesSupportedErr != nil { + return nil, errors.Wrap(_protocolServicesSupportedErr, "Error parsing 'protocolServicesSupported' field") + } + protocolServicesSupported := CastBACnetServicesSupportedTagged(_protocolServicesSupported) + if closeErr := readBuffer.CloseContext("protocolServicesSupported"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataProtocolServicesSupported"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataProtocolServicesSupported{ + ProtocolServicesSupported: CastBACnetServicesSupportedTagged(protocolServicesSupported), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataProtocolServicesSupported) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataProtocolServicesSupported"); pushErr != nil { + return pushErr + } + + // Simple Field (protocolServicesSupported) + if pushErr := writeBuffer.PushContext("protocolServicesSupported"); pushErr != nil { + return pushErr + } + _protocolServicesSupportedErr := m.ProtocolServicesSupported.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("protocolServicesSupported"); popErr != nil { + return popErr + } + if _protocolServicesSupportedErr != nil { + return errors.Wrap(_protocolServicesSupportedErr, "Error serializing 'protocolServicesSupported' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataProtocolServicesSupported"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataProtocolServicesSupported) 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/BACnetConstructedDataProtocolVersion.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolVersion.go new file mode 100644 index 00000000000..34bfdfd15b0 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataProtocolVersion.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. + +// BACnetConstructedDataProtocolVersion is the data-structure of this message +type BACnetConstructedDataProtocolVersion struct { + *BACnetConstructedData + ProtocolVersion *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataProtocolVersion is the corresponding interface of BACnetConstructedDataProtocolVersion +type IBACnetConstructedDataProtocolVersion interface { + IBACnetConstructedData + // GetProtocolVersion returns ProtocolVersion (property field) + GetProtocolVersion() *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 *BACnetConstructedDataProtocolVersion) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataProtocolVersion) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_PROTOCOL_VERSION +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataProtocolVersion) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataProtocolVersion) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataProtocolVersion) GetProtocolVersion() *BACnetApplicationTagUnsignedInteger { + return m.ProtocolVersion +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataProtocolVersion factory function for BACnetConstructedDataProtocolVersion +func NewBACnetConstructedDataProtocolVersion(protocolVersion *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataProtocolVersion { + _result := &BACnetConstructedDataProtocolVersion{ + ProtocolVersion: protocolVersion, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataProtocolVersion(structType interface{}) *BACnetConstructedDataProtocolVersion { + if casted, ok := structType.(BACnetConstructedDataProtocolVersion); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataProtocolVersion); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolVersion(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataProtocolVersion(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataProtocolVersion) GetTypeName() string { + return "BACnetConstructedDataProtocolVersion" +} + +func (m *BACnetConstructedDataProtocolVersion) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataProtocolVersion) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (protocolVersion) + lengthInBits += m.ProtocolVersion.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataProtocolVersion) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataProtocolVersionParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataProtocolVersion, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataProtocolVersion"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (protocolVersion) + if pullErr := readBuffer.PullContext("protocolVersion"); pullErr != nil { + return nil, pullErr + } + _protocolVersion, _protocolVersionErr := BACnetApplicationTagParse(readBuffer) + if _protocolVersionErr != nil { + return nil, errors.Wrap(_protocolVersionErr, "Error parsing 'protocolVersion' field") + } + protocolVersion := CastBACnetApplicationTagUnsignedInteger(_protocolVersion) + if closeErr := readBuffer.CloseContext("protocolVersion"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataProtocolVersion"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataProtocolVersion{ + ProtocolVersion: CastBACnetApplicationTagUnsignedInteger(protocolVersion), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataProtocolVersion) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataProtocolVersion"); pushErr != nil { + return pushErr + } + + // Simple Field (protocolVersion) + if pushErr := writeBuffer.PushContext("protocolVersion"); pushErr != nil { + return pushErr + } + _protocolVersionErr := m.ProtocolVersion.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("protocolVersion"); popErr != nil { + return popErr + } + if _protocolVersionErr != nil { + return errors.Wrap(_protocolVersionErr, "Error serializing 'protocolVersion' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataProtocolVersion"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataProtocolVersion) 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/BACnetConstructedDataRestartNotificationRecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestartNotificationRecipients.go new file mode 100644 index 00000000000..b541e651c30 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestartNotificationRecipients.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. + +// BACnetConstructedDataRestartNotificationRecipients is the data-structure of this message +type BACnetConstructedDataRestartNotificationRecipients struct { + *BACnetConstructedData + RestartNotificationRecipients []*BACnetRecipient + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataRestartNotificationRecipients is the corresponding interface of BACnetConstructedDataRestartNotificationRecipients +type IBACnetConstructedDataRestartNotificationRecipients interface { + IBACnetConstructedData + // GetRestartNotificationRecipients returns RestartNotificationRecipients (property field) + GetRestartNotificationRecipients() []*BACnetRecipient + // 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 *BACnetConstructedDataRestartNotificationRecipients) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_RESTART_NOTIFICATION_RECIPIENTS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataRestartNotificationRecipients) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataRestartNotificationRecipients) GetRestartNotificationRecipients() []*BACnetRecipient { + return m.RestartNotificationRecipients +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataRestartNotificationRecipients factory function for BACnetConstructedDataRestartNotificationRecipients +func NewBACnetConstructedDataRestartNotificationRecipients(restartNotificationRecipients []*BACnetRecipient, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataRestartNotificationRecipients { + _result := &BACnetConstructedDataRestartNotificationRecipients{ + RestartNotificationRecipients: restartNotificationRecipients, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataRestartNotificationRecipients(structType interface{}) *BACnetConstructedDataRestartNotificationRecipients { + if casted, ok := structType.(BACnetConstructedDataRestartNotificationRecipients); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataRestartNotificationRecipients); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataRestartNotificationRecipients(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataRestartNotificationRecipients(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) GetTypeName() string { + return "BACnetConstructedDataRestartNotificationRecipients" +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.RestartNotificationRecipients) > 0 { + for _, element := range m.RestartNotificationRecipients { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataRestartNotificationRecipientsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataRestartNotificationRecipients, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataRestartNotificationRecipients"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (restartNotificationRecipients) + if pullErr := readBuffer.PullContext("restartNotificationRecipients", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + restartNotificationRecipients := make([]*BACnetRecipient, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetRecipientParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'restartNotificationRecipients' field") + } + restartNotificationRecipients = append(restartNotificationRecipients, CastBACnetRecipient(_item)) + + } + } + if closeErr := readBuffer.CloseContext("restartNotificationRecipients", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataRestartNotificationRecipients"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataRestartNotificationRecipients{ + RestartNotificationRecipients: restartNotificationRecipients, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataRestartNotificationRecipients"); pushErr != nil { + return pushErr + } + + // Array Field (restartNotificationRecipients) + if m.RestartNotificationRecipients != nil { + if pushErr := writeBuffer.PushContext("restartNotificationRecipients", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.RestartNotificationRecipients { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'restartNotificationRecipients' field") + } + } + if popErr := writeBuffer.PopContext("restartNotificationRecipients", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataRestartNotificationRecipients"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataRestartNotificationRecipients) 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/BACnetConstructedDataRestoreCompletionTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestoreCompletionTime.go new file mode 100644 index 00000000000..b8f472d72ae --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestoreCompletionTime.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. + +// BACnetConstructedDataRestoreCompletionTime is the data-structure of this message +type BACnetConstructedDataRestoreCompletionTime struct { + *BACnetConstructedData + CompletionTime *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataRestoreCompletionTime is the corresponding interface of BACnetConstructedDataRestoreCompletionTime +type IBACnetConstructedDataRestoreCompletionTime interface { + IBACnetConstructedData + // GetCompletionTime returns CompletionTime (property field) + GetCompletionTime() *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 *BACnetConstructedDataRestoreCompletionTime) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataRestoreCompletionTime) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_RESTORE_COMPLETION_TIME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataRestoreCompletionTime) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataRestoreCompletionTime) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataRestoreCompletionTime) GetCompletionTime() *BACnetApplicationTagUnsignedInteger { + return m.CompletionTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataRestoreCompletionTime factory function for BACnetConstructedDataRestoreCompletionTime +func NewBACnetConstructedDataRestoreCompletionTime(completionTime *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataRestoreCompletionTime { + _result := &BACnetConstructedDataRestoreCompletionTime{ + CompletionTime: completionTime, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataRestoreCompletionTime(structType interface{}) *BACnetConstructedDataRestoreCompletionTime { + if casted, ok := structType.(BACnetConstructedDataRestoreCompletionTime); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataRestoreCompletionTime); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataRestoreCompletionTime(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataRestoreCompletionTime(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataRestoreCompletionTime) GetTypeName() string { + return "BACnetConstructedDataRestoreCompletionTime" +} + +func (m *BACnetConstructedDataRestoreCompletionTime) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataRestoreCompletionTime) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (completionTime) + lengthInBits += m.CompletionTime.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataRestoreCompletionTime) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataRestoreCompletionTimeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataRestoreCompletionTime, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataRestoreCompletionTime"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (completionTime) + if pullErr := readBuffer.PullContext("completionTime"); pullErr != nil { + return nil, pullErr + } + _completionTime, _completionTimeErr := BACnetApplicationTagParse(readBuffer) + if _completionTimeErr != nil { + return nil, errors.Wrap(_completionTimeErr, "Error parsing 'completionTime' field") + } + completionTime := CastBACnetApplicationTagUnsignedInteger(_completionTime) + if closeErr := readBuffer.CloseContext("completionTime"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataRestoreCompletionTime"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataRestoreCompletionTime{ + CompletionTime: CastBACnetApplicationTagUnsignedInteger(completionTime), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataRestoreCompletionTime) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataRestoreCompletionTime"); pushErr != nil { + return pushErr + } + + // Simple Field (completionTime) + if pushErr := writeBuffer.PushContext("completionTime"); pushErr != nil { + return pushErr + } + _completionTimeErr := m.CompletionTime.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("completionTime"); popErr != nil { + return popErr + } + if _completionTimeErr != nil { + return errors.Wrap(_completionTimeErr, "Error serializing 'completionTime' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataRestoreCompletionTime"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataRestoreCompletionTime) 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/BACnetConstructedDataRestorePreparationTime.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestorePreparationTime.go new file mode 100644 index 00000000000..74b628080cd --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataRestorePreparationTime.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. + +// BACnetConstructedDataRestorePreparationTime is the data-structure of this message +type BACnetConstructedDataRestorePreparationTime struct { + *BACnetConstructedData + RestorePreparationTime *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataRestorePreparationTime is the corresponding interface of BACnetConstructedDataRestorePreparationTime +type IBACnetConstructedDataRestorePreparationTime interface { + IBACnetConstructedData + // GetRestorePreparationTime returns RestorePreparationTime (property field) + GetRestorePreparationTime() *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 *BACnetConstructedDataRestorePreparationTime) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataRestorePreparationTime) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_RESTORE_PREPARATION_TIME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataRestorePreparationTime) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataRestorePreparationTime) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataRestorePreparationTime) GetRestorePreparationTime() *BACnetApplicationTagUnsignedInteger { + return m.RestorePreparationTime +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataRestorePreparationTime factory function for BACnetConstructedDataRestorePreparationTime +func NewBACnetConstructedDataRestorePreparationTime(restorePreparationTime *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataRestorePreparationTime { + _result := &BACnetConstructedDataRestorePreparationTime{ + RestorePreparationTime: restorePreparationTime, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataRestorePreparationTime(structType interface{}) *BACnetConstructedDataRestorePreparationTime { + if casted, ok := structType.(BACnetConstructedDataRestorePreparationTime); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataRestorePreparationTime); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataRestorePreparationTime(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataRestorePreparationTime(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataRestorePreparationTime) GetTypeName() string { + return "BACnetConstructedDataRestorePreparationTime" +} + +func (m *BACnetConstructedDataRestorePreparationTime) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataRestorePreparationTime) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (restorePreparationTime) + lengthInBits += m.RestorePreparationTime.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataRestorePreparationTime) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataRestorePreparationTimeParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataRestorePreparationTime, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataRestorePreparationTime"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (restorePreparationTime) + if pullErr := readBuffer.PullContext("restorePreparationTime"); pullErr != nil { + return nil, pullErr + } + _restorePreparationTime, _restorePreparationTimeErr := BACnetApplicationTagParse(readBuffer) + if _restorePreparationTimeErr != nil { + return nil, errors.Wrap(_restorePreparationTimeErr, "Error parsing 'restorePreparationTime' field") + } + restorePreparationTime := CastBACnetApplicationTagUnsignedInteger(_restorePreparationTime) + if closeErr := readBuffer.CloseContext("restorePreparationTime"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataRestorePreparationTime"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataRestorePreparationTime{ + RestorePreparationTime: CastBACnetApplicationTagUnsignedInteger(restorePreparationTime), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataRestorePreparationTime) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataRestorePreparationTime"); pushErr != nil { + return pushErr + } + + // Simple Field (restorePreparationTime) + if pushErr := writeBuffer.PushContext("restorePreparationTime"); pushErr != nil { + return pushErr + } + _restorePreparationTimeErr := m.RestorePreparationTime.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("restorePreparationTime"); popErr != nil { + return popErr + } + if _restorePreparationTimeErr != nil { + return errors.Wrap(_restorePreparationTimeErr, "Error serializing 'restorePreparationTime' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataRestorePreparationTime"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataRestorePreparationTime) 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/BACnetConstructedDataSegmentationSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSegmentationSupported.go new file mode 100644 index 00000000000..e40f58fbd6d --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSegmentationSupported.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. + +// BACnetConstructedDataSegmentationSupported is the data-structure of this message +type BACnetConstructedDataSegmentationSupported struct { + *BACnetConstructedData + SegmentationSupported *BACnetSegmentationTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataSegmentationSupported is the corresponding interface of BACnetConstructedDataSegmentationSupported +type IBACnetConstructedDataSegmentationSupported interface { + IBACnetConstructedData + // GetSegmentationSupported returns SegmentationSupported (property field) + GetSegmentationSupported() *BACnetSegmentationTagged + // 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 *BACnetConstructedDataSegmentationSupported) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataSegmentationSupported) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_SEGMENTATION_SUPPORTED +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataSegmentationSupported) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataSegmentationSupported) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataSegmentationSupported) GetSegmentationSupported() *BACnetSegmentationTagged { + return m.SegmentationSupported +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataSegmentationSupported factory function for BACnetConstructedDataSegmentationSupported +func NewBACnetConstructedDataSegmentationSupported(segmentationSupported *BACnetSegmentationTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataSegmentationSupported { + _result := &BACnetConstructedDataSegmentationSupported{ + SegmentationSupported: segmentationSupported, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataSegmentationSupported(structType interface{}) *BACnetConstructedDataSegmentationSupported { + if casted, ok := structType.(BACnetConstructedDataSegmentationSupported); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataSegmentationSupported); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataSegmentationSupported(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataSegmentationSupported(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataSegmentationSupported) GetTypeName() string { + return "BACnetConstructedDataSegmentationSupported" +} + +func (m *BACnetConstructedDataSegmentationSupported) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataSegmentationSupported) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (segmentationSupported) + lengthInBits += m.SegmentationSupported.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataSegmentationSupported) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataSegmentationSupportedParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataSegmentationSupported, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataSegmentationSupported"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (segmentationSupported) + if pullErr := readBuffer.PullContext("segmentationSupported"); pullErr != nil { + return nil, pullErr + } + _segmentationSupported, _segmentationSupportedErr := BACnetSegmentationTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _segmentationSupportedErr != nil { + return nil, errors.Wrap(_segmentationSupportedErr, "Error parsing 'segmentationSupported' field") + } + segmentationSupported := CastBACnetSegmentationTagged(_segmentationSupported) + if closeErr := readBuffer.CloseContext("segmentationSupported"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataSegmentationSupported"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataSegmentationSupported{ + SegmentationSupported: CastBACnetSegmentationTagged(segmentationSupported), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataSegmentationSupported) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataSegmentationSupported"); pushErr != nil { + return pushErr + } + + // Simple Field (segmentationSupported) + if pushErr := writeBuffer.PushContext("segmentationSupported"); pushErr != nil { + return pushErr + } + _segmentationSupportedErr := m.SegmentationSupported.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("segmentationSupported"); popErr != nil { + return popErr + } + if _segmentationSupportedErr != nil { + return errors.Wrap(_segmentationSupportedErr, "Error serializing 'segmentationSupported' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataSegmentationSupported"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataSegmentationSupported) 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/BACnetConstructedDataSerialNumber.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSerialNumber.go new file mode 100644 index 00000000000..161f7257e60 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSerialNumber.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. + +// BACnetConstructedDataSerialNumber is the data-structure of this message +type BACnetConstructedDataSerialNumber struct { + *BACnetConstructedData + SerialNumber *BACnetApplicationTagCharacterString + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataSerialNumber is the corresponding interface of BACnetConstructedDataSerialNumber +type IBACnetConstructedDataSerialNumber interface { + IBACnetConstructedData + // GetSerialNumber returns SerialNumber (property field) + GetSerialNumber() *BACnetApplicationTagCharacterString + // 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 *BACnetConstructedDataSerialNumber) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataSerialNumber) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_SERIAL_NUMBER +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataSerialNumber) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataSerialNumber) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataSerialNumber) GetSerialNumber() *BACnetApplicationTagCharacterString { + return m.SerialNumber +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataSerialNumber factory function for BACnetConstructedDataSerialNumber +func NewBACnetConstructedDataSerialNumber(serialNumber *BACnetApplicationTagCharacterString, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataSerialNumber { + _result := &BACnetConstructedDataSerialNumber{ + SerialNumber: serialNumber, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataSerialNumber(structType interface{}) *BACnetConstructedDataSerialNumber { + if casted, ok := structType.(BACnetConstructedDataSerialNumber); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataSerialNumber); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataSerialNumber(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataSerialNumber(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataSerialNumber) GetTypeName() string { + return "BACnetConstructedDataSerialNumber" +} + +func (m *BACnetConstructedDataSerialNumber) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataSerialNumber) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (serialNumber) + lengthInBits += m.SerialNumber.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataSerialNumber) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataSerialNumberParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataSerialNumber, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataSerialNumber"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (serialNumber) + if pullErr := readBuffer.PullContext("serialNumber"); pullErr != nil { + return nil, pullErr + } + _serialNumber, _serialNumberErr := BACnetApplicationTagParse(readBuffer) + if _serialNumberErr != nil { + return nil, errors.Wrap(_serialNumberErr, "Error parsing 'serialNumber' field") + } + serialNumber := CastBACnetApplicationTagCharacterString(_serialNumber) + if closeErr := readBuffer.CloseContext("serialNumber"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataSerialNumber"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataSerialNumber{ + SerialNumber: CastBACnetApplicationTagCharacterString(serialNumber), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataSerialNumber) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataSerialNumber"); pushErr != nil { + return pushErr + } + + // Simple Field (serialNumber) + if pushErr := writeBuffer.PushContext("serialNumber"); pushErr != nil { + return pushErr + } + _serialNumberErr := m.SerialNumber.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("serialNumber"); popErr != nil { + return popErr + } + if _serialNumberErr != nil { + return errors.Wrap(_serialNumberErr, "Error serializing 'serialNumber' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataSerialNumber"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataSerialNumber) 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/BACnetConstructedDataStructuredObjectList.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStructuredObjectList.go new file mode 100644 index 00000000000..5617ac82af4 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataStructuredObjectList.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. + +// BACnetConstructedDataStructuredObjectList is the data-structure of this message +type BACnetConstructedDataStructuredObjectList struct { + *BACnetConstructedData + StructuredObjectList []*BACnetApplicationTagObjectIdentifier + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataStructuredObjectList is the corresponding interface of BACnetConstructedDataStructuredObjectList +type IBACnetConstructedDataStructuredObjectList interface { + IBACnetConstructedData + // GetStructuredObjectList returns StructuredObjectList (property field) + GetStructuredObjectList() []*BACnetApplicationTagObjectIdentifier + // 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 *BACnetConstructedDataStructuredObjectList) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataStructuredObjectList) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_STRUCTURED_OBJECT_LIST +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataStructuredObjectList) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataStructuredObjectList) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataStructuredObjectList) GetStructuredObjectList() []*BACnetApplicationTagObjectIdentifier { + return m.StructuredObjectList +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataStructuredObjectList factory function for BACnetConstructedDataStructuredObjectList +func NewBACnetConstructedDataStructuredObjectList(structuredObjectList []*BACnetApplicationTagObjectIdentifier, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataStructuredObjectList { + _result := &BACnetConstructedDataStructuredObjectList{ + StructuredObjectList: structuredObjectList, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataStructuredObjectList(structType interface{}) *BACnetConstructedDataStructuredObjectList { + if casted, ok := structType.(BACnetConstructedDataStructuredObjectList); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataStructuredObjectList); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataStructuredObjectList(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataStructuredObjectList(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataStructuredObjectList) GetTypeName() string { + return "BACnetConstructedDataStructuredObjectList" +} + +func (m *BACnetConstructedDataStructuredObjectList) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataStructuredObjectList) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.StructuredObjectList) > 0 { + for _, element := range m.StructuredObjectList { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataStructuredObjectList) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataStructuredObjectListParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataStructuredObjectList, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataStructuredObjectList"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (structuredObjectList) + if pullErr := readBuffer.PullContext("structuredObjectList", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + structuredObjectList := make([]*BACnetApplicationTagObjectIdentifier, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetApplicationTagParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'structuredObjectList' field") + } + structuredObjectList = append(structuredObjectList, CastBACnetApplicationTagObjectIdentifier(_item)) + + } + } + if closeErr := readBuffer.CloseContext("structuredObjectList", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataStructuredObjectList"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataStructuredObjectList{ + StructuredObjectList: structuredObjectList, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataStructuredObjectList) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataStructuredObjectList"); pushErr != nil { + return pushErr + } + + // Array Field (structuredObjectList) + if m.StructuredObjectList != nil { + if pushErr := writeBuffer.PushContext("structuredObjectList", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.StructuredObjectList { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'structuredObjectList' field") + } + } + if popErr := writeBuffer.PopContext("structuredObjectList", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataStructuredObjectList"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataStructuredObjectList) 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/BACnetConstructedDataSystemStatus.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSystemStatus.go new file mode 100644 index 00000000000..0fded119f9f --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataSystemStatus.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. + +// BACnetConstructedDataSystemStatus is the data-structure of this message +type BACnetConstructedDataSystemStatus struct { + *BACnetConstructedData + SystemStatus *BACnetDeviceStatusTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataSystemStatus is the corresponding interface of BACnetConstructedDataSystemStatus +type IBACnetConstructedDataSystemStatus interface { + IBACnetConstructedData + // GetSystemStatus returns SystemStatus (property field) + GetSystemStatus() *BACnetDeviceStatusTagged + // 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 *BACnetConstructedDataSystemStatus) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataSystemStatus) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_SYSTEM_STATUS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataSystemStatus) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataSystemStatus) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataSystemStatus) GetSystemStatus() *BACnetDeviceStatusTagged { + return m.SystemStatus +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataSystemStatus factory function for BACnetConstructedDataSystemStatus +func NewBACnetConstructedDataSystemStatus(systemStatus *BACnetDeviceStatusTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataSystemStatus { + _result := &BACnetConstructedDataSystemStatus{ + SystemStatus: systemStatus, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataSystemStatus(structType interface{}) *BACnetConstructedDataSystemStatus { + if casted, ok := structType.(BACnetConstructedDataSystemStatus); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataSystemStatus); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataSystemStatus(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataSystemStatus(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataSystemStatus) GetTypeName() string { + return "BACnetConstructedDataSystemStatus" +} + +func (m *BACnetConstructedDataSystemStatus) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataSystemStatus) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (systemStatus) + lengthInBits += m.SystemStatus.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataSystemStatus) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataSystemStatusParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataSystemStatus, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataSystemStatus"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (systemStatus) + if pullErr := readBuffer.PullContext("systemStatus"); pullErr != nil { + return nil, pullErr + } + _systemStatus, _systemStatusErr := BACnetDeviceStatusTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _systemStatusErr != nil { + return nil, errors.Wrap(_systemStatusErr, "Error parsing 'systemStatus' field") + } + systemStatus := CastBACnetDeviceStatusTagged(_systemStatus) + if closeErr := readBuffer.CloseContext("systemStatus"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataSystemStatus"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataSystemStatus{ + SystemStatus: CastBACnetDeviceStatusTagged(systemStatus), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataSystemStatus) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataSystemStatus"); pushErr != nil { + return pushErr + } + + // Simple Field (systemStatus) + if pushErr := writeBuffer.PushContext("systemStatus"); pushErr != nil { + return pushErr + } + _systemStatusErr := m.SystemStatus.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("systemStatus"); popErr != nil { + return popErr + } + if _systemStatusErr != nil { + return errors.Wrap(_systemStatusErr, "Error serializing 'systemStatus' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataSystemStatus"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataSystemStatus) 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/BACnetConstructedDataTimeOfDeviceRestart.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfDeviceRestart.go new file mode 100644 index 00000000000..7461d2f9044 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeOfDeviceRestart.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. + +// BACnetConstructedDataTimeOfDeviceRestart is the data-structure of this message +type BACnetConstructedDataTimeOfDeviceRestart struct { + *BACnetConstructedData + TimeOfDeviceRestart *BACnetTimeStamp + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataTimeOfDeviceRestart is the corresponding interface of BACnetConstructedDataTimeOfDeviceRestart +type IBACnetConstructedDataTimeOfDeviceRestart interface { + IBACnetConstructedData + // GetTimeOfDeviceRestart returns TimeOfDeviceRestart (property field) + GetTimeOfDeviceRestart() *BACnetTimeStamp + // 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 *BACnetConstructedDataTimeOfDeviceRestart) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_TIME_OF_DEVICE_RESTART +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataTimeOfDeviceRestart) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataTimeOfDeviceRestart) GetTimeOfDeviceRestart() *BACnetTimeStamp { + return m.TimeOfDeviceRestart +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataTimeOfDeviceRestart factory function for BACnetConstructedDataTimeOfDeviceRestart +func NewBACnetConstructedDataTimeOfDeviceRestart(timeOfDeviceRestart *BACnetTimeStamp, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataTimeOfDeviceRestart { + _result := &BACnetConstructedDataTimeOfDeviceRestart{ + TimeOfDeviceRestart: timeOfDeviceRestart, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataTimeOfDeviceRestart(structType interface{}) *BACnetConstructedDataTimeOfDeviceRestart { + if casted, ok := structType.(BACnetConstructedDataTimeOfDeviceRestart); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataTimeOfDeviceRestart); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataTimeOfDeviceRestart(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataTimeOfDeviceRestart(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) GetTypeName() string { + return "BACnetConstructedDataTimeOfDeviceRestart" +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (timeOfDeviceRestart) + lengthInBits += m.TimeOfDeviceRestart.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataTimeOfDeviceRestartParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataTimeOfDeviceRestart, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataTimeOfDeviceRestart"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (timeOfDeviceRestart) + if pullErr := readBuffer.PullContext("timeOfDeviceRestart"); pullErr != nil { + return nil, pullErr + } + _timeOfDeviceRestart, _timeOfDeviceRestartErr := BACnetTimeStampParse(readBuffer) + if _timeOfDeviceRestartErr != nil { + return nil, errors.Wrap(_timeOfDeviceRestartErr, "Error parsing 'timeOfDeviceRestart' field") + } + timeOfDeviceRestart := CastBACnetTimeStamp(_timeOfDeviceRestart) + if closeErr := readBuffer.CloseContext("timeOfDeviceRestart"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataTimeOfDeviceRestart"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataTimeOfDeviceRestart{ + TimeOfDeviceRestart: CastBACnetTimeStamp(timeOfDeviceRestart), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataTimeOfDeviceRestart"); pushErr != nil { + return pushErr + } + + // Simple Field (timeOfDeviceRestart) + if pushErr := writeBuffer.PushContext("timeOfDeviceRestart"); pushErr != nil { + return pushErr + } + _timeOfDeviceRestartErr := m.TimeOfDeviceRestart.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("timeOfDeviceRestart"); popErr != nil { + return popErr + } + if _timeOfDeviceRestartErr != nil { + return errors.Wrap(_timeOfDeviceRestartErr, "Error serializing 'timeOfDeviceRestart' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataTimeOfDeviceRestart"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataTimeOfDeviceRestart) 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/BACnetConstructedDataTimeSynchronizationInterval.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationInterval.go new file mode 100644 index 00000000000..9cad93336dc --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationInterval.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. + +// BACnetConstructedDataTimeSynchronizationInterval is the data-structure of this message +type BACnetConstructedDataTimeSynchronizationInterval struct { + *BACnetConstructedData + TimeSynchronization *BACnetApplicationTagUnsignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataTimeSynchronizationInterval is the corresponding interface of BACnetConstructedDataTimeSynchronizationInterval +type IBACnetConstructedDataTimeSynchronizationInterval interface { + IBACnetConstructedData + // GetTimeSynchronization returns TimeSynchronization (property field) + GetTimeSynchronization() *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 *BACnetConstructedDataTimeSynchronizationInterval) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_TIME_SYNCHRONIZATION_INTERVAL +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataTimeSynchronizationInterval) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataTimeSynchronizationInterval) GetTimeSynchronization() *BACnetApplicationTagUnsignedInteger { + return m.TimeSynchronization +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataTimeSynchronizationInterval factory function for BACnetConstructedDataTimeSynchronizationInterval +func NewBACnetConstructedDataTimeSynchronizationInterval(timeSynchronization *BACnetApplicationTagUnsignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataTimeSynchronizationInterval { + _result := &BACnetConstructedDataTimeSynchronizationInterval{ + TimeSynchronization: timeSynchronization, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataTimeSynchronizationInterval(structType interface{}) *BACnetConstructedDataTimeSynchronizationInterval { + if casted, ok := structType.(BACnetConstructedDataTimeSynchronizationInterval); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataTimeSynchronizationInterval); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataTimeSynchronizationInterval(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataTimeSynchronizationInterval(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) GetTypeName() string { + return "BACnetConstructedDataTimeSynchronizationInterval" +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (timeSynchronization) + lengthInBits += m.TimeSynchronization.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataTimeSynchronizationIntervalParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataTimeSynchronizationInterval, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataTimeSynchronizationInterval"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (timeSynchronization) + if pullErr := readBuffer.PullContext("timeSynchronization"); pullErr != nil { + return nil, pullErr + } + _timeSynchronization, _timeSynchronizationErr := BACnetApplicationTagParse(readBuffer) + if _timeSynchronizationErr != nil { + return nil, errors.Wrap(_timeSynchronizationErr, "Error parsing 'timeSynchronization' field") + } + timeSynchronization := CastBACnetApplicationTagUnsignedInteger(_timeSynchronization) + if closeErr := readBuffer.CloseContext("timeSynchronization"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataTimeSynchronizationInterval"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataTimeSynchronizationInterval{ + TimeSynchronization: CastBACnetApplicationTagUnsignedInteger(timeSynchronization), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataTimeSynchronizationInterval"); pushErr != nil { + return pushErr + } + + // Simple Field (timeSynchronization) + if pushErr := writeBuffer.PushContext("timeSynchronization"); pushErr != nil { + return pushErr + } + _timeSynchronizationErr := m.TimeSynchronization.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("timeSynchronization"); popErr != nil { + return popErr + } + if _timeSynchronizationErr != nil { + return errors.Wrap(_timeSynchronizationErr, "Error serializing 'timeSynchronization' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataTimeSynchronizationInterval"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataTimeSynchronizationInterval) 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/BACnetConstructedDataTimeSynchronizationRecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationRecipients.go new file mode 100644 index 00000000000..c14a13e37f3 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataTimeSynchronizationRecipients.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. + +// BACnetConstructedDataTimeSynchronizationRecipients is the data-structure of this message +type BACnetConstructedDataTimeSynchronizationRecipients struct { + *BACnetConstructedData + TimeSynchronizationRecipients []*BACnetRecipient + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataTimeSynchronizationRecipients is the corresponding interface of BACnetConstructedDataTimeSynchronizationRecipients +type IBACnetConstructedDataTimeSynchronizationRecipients interface { + IBACnetConstructedData + // GetTimeSynchronizationRecipients returns TimeSynchronizationRecipients (property field) + GetTimeSynchronizationRecipients() []*BACnetRecipient + // 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 *BACnetConstructedDataTimeSynchronizationRecipients) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_TIME_SYNCHRONIZATION_RECIPIENTS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) GetTimeSynchronizationRecipients() []*BACnetRecipient { + return m.TimeSynchronizationRecipients +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataTimeSynchronizationRecipients factory function for BACnetConstructedDataTimeSynchronizationRecipients +func NewBACnetConstructedDataTimeSynchronizationRecipients(timeSynchronizationRecipients []*BACnetRecipient, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataTimeSynchronizationRecipients { + _result := &BACnetConstructedDataTimeSynchronizationRecipients{ + TimeSynchronizationRecipients: timeSynchronizationRecipients, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataTimeSynchronizationRecipients(structType interface{}) *BACnetConstructedDataTimeSynchronizationRecipients { + if casted, ok := structType.(BACnetConstructedDataTimeSynchronizationRecipients); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataTimeSynchronizationRecipients); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataTimeSynchronizationRecipients(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataTimeSynchronizationRecipients(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) GetTypeName() string { + return "BACnetConstructedDataTimeSynchronizationRecipients" +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.TimeSynchronizationRecipients) > 0 { + for _, element := range m.TimeSynchronizationRecipients { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataTimeSynchronizationRecipientsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataTimeSynchronizationRecipients, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataTimeSynchronizationRecipients"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (timeSynchronizationRecipients) + if pullErr := readBuffer.PullContext("timeSynchronizationRecipients", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + timeSynchronizationRecipients := make([]*BACnetRecipient, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetRecipientParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'timeSynchronizationRecipients' field") + } + timeSynchronizationRecipients = append(timeSynchronizationRecipients, CastBACnetRecipient(_item)) + + } + } + if closeErr := readBuffer.CloseContext("timeSynchronizationRecipients", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataTimeSynchronizationRecipients"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataTimeSynchronizationRecipients{ + TimeSynchronizationRecipients: timeSynchronizationRecipients, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataTimeSynchronizationRecipients"); pushErr != nil { + return pushErr + } + + // Array Field (timeSynchronizationRecipients) + if m.TimeSynchronizationRecipients != nil { + if pushErr := writeBuffer.PushContext("timeSynchronizationRecipients", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.TimeSynchronizationRecipients { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'timeSynchronizationRecipients' field") + } + } + if popErr := writeBuffer.PopContext("timeSynchronizationRecipients", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataTimeSynchronizationRecipients"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataTimeSynchronizationRecipients) 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/BACnetConstructedDataUTCOffset.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCOffset.go new file mode 100644 index 00000000000..75fe57266c0 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCOffset.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. + +// BACnetConstructedDataUTCOffset is the data-structure of this message +type BACnetConstructedDataUTCOffset struct { + *BACnetConstructedData + UtcOffset *BACnetApplicationTagSignedInteger + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataUTCOffset is the corresponding interface of BACnetConstructedDataUTCOffset +type IBACnetConstructedDataUTCOffset interface { + IBACnetConstructedData + // GetUtcOffset returns UtcOffset (property field) + GetUtcOffset() *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 *BACnetConstructedDataUTCOffset) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataUTCOffset) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_UTC_OFFSET +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataUTCOffset) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataUTCOffset) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataUTCOffset) GetUtcOffset() *BACnetApplicationTagSignedInteger { + return m.UtcOffset +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataUTCOffset factory function for BACnetConstructedDataUTCOffset +func NewBACnetConstructedDataUTCOffset(utcOffset *BACnetApplicationTagSignedInteger, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataUTCOffset { + _result := &BACnetConstructedDataUTCOffset{ + UtcOffset: utcOffset, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataUTCOffset(structType interface{}) *BACnetConstructedDataUTCOffset { + if casted, ok := structType.(BACnetConstructedDataUTCOffset); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataUTCOffset); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataUTCOffset(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataUTCOffset(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataUTCOffset) GetTypeName() string { + return "BACnetConstructedDataUTCOffset" +} + +func (m *BACnetConstructedDataUTCOffset) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataUTCOffset) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (utcOffset) + lengthInBits += m.UtcOffset.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataUTCOffset) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataUTCOffsetParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataUTCOffset, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataUTCOffset"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (utcOffset) + if pullErr := readBuffer.PullContext("utcOffset"); pullErr != nil { + return nil, pullErr + } + _utcOffset, _utcOffsetErr := BACnetApplicationTagParse(readBuffer) + if _utcOffsetErr != nil { + return nil, errors.Wrap(_utcOffsetErr, "Error parsing 'utcOffset' field") + } + utcOffset := CastBACnetApplicationTagSignedInteger(_utcOffset) + if closeErr := readBuffer.CloseContext("utcOffset"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataUTCOffset"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataUTCOffset{ + UtcOffset: CastBACnetApplicationTagSignedInteger(utcOffset), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataUTCOffset) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataUTCOffset"); pushErr != nil { + return pushErr + } + + // Simple Field (utcOffset) + if pushErr := writeBuffer.PushContext("utcOffset"); pushErr != nil { + return pushErr + } + _utcOffsetErr := m.UtcOffset.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("utcOffset"); popErr != nil { + return popErr + } + if _utcOffsetErr != nil { + return errors.Wrap(_utcOffsetErr, "Error serializing 'utcOffset' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataUTCOffset"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataUTCOffset) 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/BACnetConstructedDataUTCTimeSynchronizationRecipients.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCTimeSynchronizationRecipients.go new file mode 100644 index 00000000000..195fccda962 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataUTCTimeSynchronizationRecipients.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. + +// BACnetConstructedDataUTCTimeSynchronizationRecipients is the data-structure of this message +type BACnetConstructedDataUTCTimeSynchronizationRecipients struct { + *BACnetConstructedData + UtcTimeSynchronizationRecipients []*BACnetRecipient + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataUTCTimeSynchronizationRecipients is the corresponding interface of BACnetConstructedDataUTCTimeSynchronizationRecipients +type IBACnetConstructedDataUTCTimeSynchronizationRecipients interface { + IBACnetConstructedData + // GetUtcTimeSynchronizationRecipients returns UtcTimeSynchronizationRecipients (property field) + GetUtcTimeSynchronizationRecipients() []*BACnetRecipient + // 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 *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_UTC_TIME_SYNCHRONIZATION_RECIPIENTS +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetUtcTimeSynchronizationRecipients() []*BACnetRecipient { + return m.UtcTimeSynchronizationRecipients +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataUTCTimeSynchronizationRecipients factory function for BACnetConstructedDataUTCTimeSynchronizationRecipients +func NewBACnetConstructedDataUTCTimeSynchronizationRecipients(utcTimeSynchronizationRecipients []*BACnetRecipient, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataUTCTimeSynchronizationRecipients { + _result := &BACnetConstructedDataUTCTimeSynchronizationRecipients{ + UtcTimeSynchronizationRecipients: utcTimeSynchronizationRecipients, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataUTCTimeSynchronizationRecipients(structType interface{}) *BACnetConstructedDataUTCTimeSynchronizationRecipients { + if casted, ok := structType.(BACnetConstructedDataUTCTimeSynchronizationRecipients); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataUTCTimeSynchronizationRecipients); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataUTCTimeSynchronizationRecipients(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataUTCTimeSynchronizationRecipients(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetTypeName() string { + return "BACnetConstructedDataUTCTimeSynchronizationRecipients" +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.UtcTimeSynchronizationRecipients) > 0 { + for _, element := range m.UtcTimeSynchronizationRecipients { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataUTCTimeSynchronizationRecipientsParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataUTCTimeSynchronizationRecipients, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataUTCTimeSynchronizationRecipients"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (utcTimeSynchronizationRecipients) + if pullErr := readBuffer.PullContext("utcTimeSynchronizationRecipients", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + utcTimeSynchronizationRecipients := make([]*BACnetRecipient, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetRecipientParse(readBuffer) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'utcTimeSynchronizationRecipients' field") + } + utcTimeSynchronizationRecipients = append(utcTimeSynchronizationRecipients, CastBACnetRecipient(_item)) + + } + } + if closeErr := readBuffer.CloseContext("utcTimeSynchronizationRecipients", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataUTCTimeSynchronizationRecipients"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataUTCTimeSynchronizationRecipients{ + UtcTimeSynchronizationRecipients: utcTimeSynchronizationRecipients, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataUTCTimeSynchronizationRecipients"); pushErr != nil { + return pushErr + } + + // Array Field (utcTimeSynchronizationRecipients) + if m.UtcTimeSynchronizationRecipients != nil { + if pushErr := writeBuffer.PushContext("utcTimeSynchronizationRecipients", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.UtcTimeSynchronizationRecipients { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'utcTimeSynchronizationRecipients' field") + } + } + if popErr := writeBuffer.PopContext("utcTimeSynchronizationRecipients", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataUTCTimeSynchronizationRecipients"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataUTCTimeSynchronizationRecipients) 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/BACnetConstructedDataVTClassesSupported.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVTClassesSupported.go new file mode 100644 index 00000000000..bf5fb30537d --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVTClassesSupported.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. + +// BACnetConstructedDataVTClassesSupported is the data-structure of this message +type BACnetConstructedDataVTClassesSupported struct { + *BACnetConstructedData + VtClassesSupported []*BACnetVTClassTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataVTClassesSupported is the corresponding interface of BACnetConstructedDataVTClassesSupported +type IBACnetConstructedDataVTClassesSupported interface { + IBACnetConstructedData + // GetVtClassesSupported returns VtClassesSupported (property field) + GetVtClassesSupported() []*BACnetVTClassTagged + // 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 *BACnetConstructedDataVTClassesSupported) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataVTClassesSupported) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_VT_CLASSES_SUPPORTED +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataVTClassesSupported) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataVTClassesSupported) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataVTClassesSupported) GetVtClassesSupported() []*BACnetVTClassTagged { + return m.VtClassesSupported +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataVTClassesSupported factory function for BACnetConstructedDataVTClassesSupported +func NewBACnetConstructedDataVTClassesSupported(vtClassesSupported []*BACnetVTClassTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataVTClassesSupported { + _result := &BACnetConstructedDataVTClassesSupported{ + VtClassesSupported: vtClassesSupported, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataVTClassesSupported(structType interface{}) *BACnetConstructedDataVTClassesSupported { + if casted, ok := structType.(BACnetConstructedDataVTClassesSupported); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataVTClassesSupported); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataVTClassesSupported(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataVTClassesSupported(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataVTClassesSupported) GetTypeName() string { + return "BACnetConstructedDataVTClassesSupported" +} + +func (m *BACnetConstructedDataVTClassesSupported) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataVTClassesSupported) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Array field + if len(m.VtClassesSupported) > 0 { + for _, element := range m.VtClassesSupported { + lengthInBits += element.GetLengthInBits() + } + } + + return lengthInBits +} + +func (m *BACnetConstructedDataVTClassesSupported) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataVTClassesSupportedParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataVTClassesSupported, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataVTClassesSupported"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Array field (vtClassesSupported) + if pullErr := readBuffer.PullContext("vtClassesSupported", utils.WithRenderAsList(true)); pullErr != nil { + return nil, pullErr + } + // Terminated array + vtClassesSupported := make([]*BACnetVTClassTagged, 0) + { + for !bool(IsBACnetConstructedDataClosingTag(readBuffer, false, tagNumber)) { + _item, _err := BACnetVTClassTaggedParse(readBuffer, uint8(0), TagClass_APPLICATION_TAGS) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'vtClassesSupported' field") + } + vtClassesSupported = append(vtClassesSupported, CastBACnetVTClassTagged(_item)) + + } + } + if closeErr := readBuffer.CloseContext("vtClassesSupported", utils.WithRenderAsList(true)); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataVTClassesSupported"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataVTClassesSupported{ + VtClassesSupported: vtClassesSupported, + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataVTClassesSupported) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataVTClassesSupported"); pushErr != nil { + return pushErr + } + + // Array Field (vtClassesSupported) + if m.VtClassesSupported != nil { + if pushErr := writeBuffer.PushContext("vtClassesSupported", utils.WithRenderAsList(true)); pushErr != nil { + return pushErr + } + for _, _element := range m.VtClassesSupported { + _elementErr := _element.Serialize(writeBuffer) + if _elementErr != nil { + return errors.Wrap(_elementErr, "Error serializing 'vtClassesSupported' field") + } + } + if popErr := writeBuffer.PopContext("vtClassesSupported", utils.WithRenderAsList(true)); popErr != nil { + return popErr + } + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataVTClassesSupported"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataVTClassesSupported) 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/BACnetConstructedDataVendorIdentifier.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorIdentifier.go new file mode 100644 index 00000000000..6aeb0c5b6cd --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorIdentifier.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. + +// BACnetConstructedDataVendorIdentifier is the data-structure of this message +type BACnetConstructedDataVendorIdentifier struct { + *BACnetConstructedData + VendorIdentifier *BACnetVendorIdTagged + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataVendorIdentifier is the corresponding interface of BACnetConstructedDataVendorIdentifier +type IBACnetConstructedDataVendorIdentifier interface { + IBACnetConstructedData + // GetVendorIdentifier returns VendorIdentifier (property field) + GetVendorIdentifier() *BACnetVendorIdTagged + // 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 *BACnetConstructedDataVendorIdentifier) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataVendorIdentifier) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_VENDOR_IDENTIFIER +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataVendorIdentifier) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataVendorIdentifier) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataVendorIdentifier) GetVendorIdentifier() *BACnetVendorIdTagged { + return m.VendorIdentifier +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataVendorIdentifier factory function for BACnetConstructedDataVendorIdentifier +func NewBACnetConstructedDataVendorIdentifier(vendorIdentifier *BACnetVendorIdTagged, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataVendorIdentifier { + _result := &BACnetConstructedDataVendorIdentifier{ + VendorIdentifier: vendorIdentifier, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataVendorIdentifier(structType interface{}) *BACnetConstructedDataVendorIdentifier { + if casted, ok := structType.(BACnetConstructedDataVendorIdentifier); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataVendorIdentifier); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataVendorIdentifier(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataVendorIdentifier(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataVendorIdentifier) GetTypeName() string { + return "BACnetConstructedDataVendorIdentifier" +} + +func (m *BACnetConstructedDataVendorIdentifier) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataVendorIdentifier) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (vendorIdentifier) + lengthInBits += m.VendorIdentifier.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataVendorIdentifier) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataVendorIdentifierParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataVendorIdentifier, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataVendorIdentifier"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (vendorIdentifier) + if pullErr := readBuffer.PullContext("vendorIdentifier"); pullErr != nil { + return nil, pullErr + } + _vendorIdentifier, _vendorIdentifierErr := BACnetVendorIdTaggedParse(readBuffer, uint8(uint8(0)), TagClass(TagClass_APPLICATION_TAGS)) + if _vendorIdentifierErr != nil { + return nil, errors.Wrap(_vendorIdentifierErr, "Error parsing 'vendorIdentifier' field") + } + vendorIdentifier := CastBACnetVendorIdTagged(_vendorIdentifier) + if closeErr := readBuffer.CloseContext("vendorIdentifier"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataVendorIdentifier"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataVendorIdentifier{ + VendorIdentifier: CastBACnetVendorIdTagged(vendorIdentifier), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataVendorIdentifier) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataVendorIdentifier"); pushErr != nil { + return pushErr + } + + // Simple Field (vendorIdentifier) + if pushErr := writeBuffer.PushContext("vendorIdentifier"); pushErr != nil { + return pushErr + } + _vendorIdentifierErr := m.VendorIdentifier.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("vendorIdentifier"); popErr != nil { + return popErr + } + if _vendorIdentifierErr != nil { + return errors.Wrap(_vendorIdentifierErr, "Error serializing 'vendorIdentifier' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataVendorIdentifier"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataVendorIdentifier) 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/BACnetConstructedDataVendorName.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorName.go new file mode 100644 index 00000000000..927ce42474e --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataVendorName.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. + +// BACnetConstructedDataVendorName is the data-structure of this message +type BACnetConstructedDataVendorName struct { + *BACnetConstructedData + VendorName *BACnetApplicationTagCharacterString + + // Arguments. + TagNumber uint8 +} + +// IBACnetConstructedDataVendorName is the corresponding interface of BACnetConstructedDataVendorName +type IBACnetConstructedDataVendorName interface { + IBACnetConstructedData + // GetVendorName returns VendorName (property field) + GetVendorName() *BACnetApplicationTagCharacterString + // 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 *BACnetConstructedDataVendorName) GetObjectTypeArgument() BACnetObjectType { + return 0 +} + +func (m *BACnetConstructedDataVendorName) GetPropertyIdentifierArgument() BACnetPropertyIdentifier { + return BACnetPropertyIdentifier_VENDOR_NAME +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *BACnetConstructedDataVendorName) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag) { + m.BACnetConstructedData.OpeningTag = openingTag + m.BACnetConstructedData.ClosingTag = closingTag +} + +func (m *BACnetConstructedDataVendorName) GetParent() *BACnetConstructedData { + return m.BACnetConstructedData +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetConstructedDataVendorName) GetVendorName() *BACnetApplicationTagCharacterString { + return m.VendorName +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetConstructedDataVendorName factory function for BACnetConstructedDataVendorName +func NewBACnetConstructedDataVendorName(vendorName *BACnetApplicationTagCharacterString, openingTag *BACnetOpeningTag, closingTag *BACnetClosingTag, tagNumber uint8) *BACnetConstructedDataVendorName { + _result := &BACnetConstructedDataVendorName{ + VendorName: vendorName, + BACnetConstructedData: NewBACnetConstructedData(openingTag, closingTag, tagNumber), + } + _result.Child = _result + return _result +} + +func CastBACnetConstructedDataVendorName(structType interface{}) *BACnetConstructedDataVendorName { + if casted, ok := structType.(BACnetConstructedDataVendorName); ok { + return &casted + } + if casted, ok := structType.(*BACnetConstructedDataVendorName); ok { + return casted + } + if casted, ok := structType.(BACnetConstructedData); ok { + return CastBACnetConstructedDataVendorName(casted.Child) + } + if casted, ok := structType.(*BACnetConstructedData); ok { + return CastBACnetConstructedDataVendorName(casted.Child) + } + return nil +} + +func (m *BACnetConstructedDataVendorName) GetTypeName() string { + return "BACnetConstructedDataVendorName" +} + +func (m *BACnetConstructedDataVendorName) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetConstructedDataVendorName) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (vendorName) + lengthInBits += m.VendorName.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetConstructedDataVendorName) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetConstructedDataVendorNameParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier) (*BACnetConstructedDataVendorName, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetConstructedDataVendorName"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (vendorName) + if pullErr := readBuffer.PullContext("vendorName"); pullErr != nil { + return nil, pullErr + } + _vendorName, _vendorNameErr := BACnetApplicationTagParse(readBuffer) + if _vendorNameErr != nil { + return nil, errors.Wrap(_vendorNameErr, "Error parsing 'vendorName' field") + } + vendorName := CastBACnetApplicationTagCharacterString(_vendorName) + if closeErr := readBuffer.CloseContext("vendorName"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetConstructedDataVendorName"); closeErr != nil { + return nil, closeErr + } + + // Create a partially initialized instance + _child := &BACnetConstructedDataVendorName{ + VendorName: CastBACnetApplicationTagCharacterString(vendorName), + BACnetConstructedData: &BACnetConstructedData{}, + } + _child.BACnetConstructedData.Child = _child + return _child, nil +} + +func (m *BACnetConstructedDataVendorName) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("BACnetConstructedDataVendorName"); pushErr != nil { + return pushErr + } + + // Simple Field (vendorName) + if pushErr := writeBuffer.PushContext("vendorName"); pushErr != nil { + return pushErr + } + _vendorNameErr := m.VendorName.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("vendorName"); popErr != nil { + return popErr + } + if _vendorNameErr != nil { + return errors.Wrap(_vendorNameErr, "Error serializing 'vendorName' field") + } + + if popErr := writeBuffer.PopContext("BACnetConstructedDataVendorName"); popErr != nil { + return popErr + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *BACnetConstructedDataVendorName) 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/BACnetObjectIdentifierOrUnsignedInteger.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectIdentifierOrUnsignedInteger.go new file mode 100644 index 00000000000..c481aeec2c8 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectIdentifierOrUnsignedInteger.go @@ -0,0 +1,320 @@ +/* + * 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. + +// BACnetObjectIdentifierOrUnsignedInteger is the data-structure of this message +type BACnetObjectIdentifierOrUnsignedInteger struct { + PeekedTagHeader *BACnetTagHeader + ObjectIdentifier *BACnetApplicationTagObjectIdentifier + FallbackIdentifier *BACnetApplicationTagUnsignedInteger + NullValue *BACnetApplicationTagNull +} + +// IBACnetObjectIdentifierOrUnsignedInteger is the corresponding interface of BACnetObjectIdentifierOrUnsignedInteger +type IBACnetObjectIdentifierOrUnsignedInteger interface { + // GetPeekedTagHeader returns PeekedTagHeader (property field) + GetPeekedTagHeader() *BACnetTagHeader + // GetObjectIdentifier returns ObjectIdentifier (property field) + GetObjectIdentifier() *BACnetApplicationTagObjectIdentifier + // GetFallbackIdentifier returns FallbackIdentifier (property field) + GetFallbackIdentifier() *BACnetApplicationTagUnsignedInteger + // GetNullValue returns NullValue (property field) + GetNullValue() *BACnetApplicationTagNull + // GetPeekedTagNumber returns PeekedTagNumber (virtual field) + GetPeekedTagNumber() uint8 + // 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 *BACnetObjectIdentifierOrUnsignedInteger) GetPeekedTagHeader() *BACnetTagHeader { + return m.PeekedTagHeader +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetObjectIdentifier() *BACnetApplicationTagObjectIdentifier { + return m.ObjectIdentifier +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetFallbackIdentifier() *BACnetApplicationTagUnsignedInteger { + return m.FallbackIdentifier +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetNullValue() *BACnetApplicationTagNull { + return m.NullValue +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for virtual fields. +/////////////////////// + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetPeekedTagNumber() uint8 { + objectIdentifier := m.ObjectIdentifier + _ = objectIdentifier + fallbackIdentifier := m.FallbackIdentifier + _ = fallbackIdentifier + nullValue := m.NullValue + _ = nullValue + return uint8(m.GetPeekedTagHeader().GetActualTagNumber()) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetObjectIdentifierOrUnsignedInteger factory function for BACnetObjectIdentifierOrUnsignedInteger +func NewBACnetObjectIdentifierOrUnsignedInteger(peekedTagHeader *BACnetTagHeader, objectIdentifier *BACnetApplicationTagObjectIdentifier, fallbackIdentifier *BACnetApplicationTagUnsignedInteger, nullValue *BACnetApplicationTagNull) *BACnetObjectIdentifierOrUnsignedInteger { + return &BACnetObjectIdentifierOrUnsignedInteger{PeekedTagHeader: peekedTagHeader, ObjectIdentifier: objectIdentifier, FallbackIdentifier: fallbackIdentifier, NullValue: nullValue} +} + +func CastBACnetObjectIdentifierOrUnsignedInteger(structType interface{}) *BACnetObjectIdentifierOrUnsignedInteger { + if casted, ok := structType.(BACnetObjectIdentifierOrUnsignedInteger); ok { + return &casted + } + if casted, ok := structType.(*BACnetObjectIdentifierOrUnsignedInteger); ok { + return casted + } + return nil +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetTypeName() string { + return "BACnetObjectIdentifierOrUnsignedInteger" +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // A virtual field doesn't have any in- or output. + + // Optional Field (objectIdentifier) + if m.ObjectIdentifier != nil { + lengthInBits += (*m.ObjectIdentifier).GetLengthInBits() + } + + // Optional Field (fallbackIdentifier) + if m.FallbackIdentifier != nil { + lengthInBits += (*m.FallbackIdentifier).GetLengthInBits() + } + + // Optional Field (nullValue) + if m.NullValue != nil { + lengthInBits += (*m.NullValue).GetLengthInBits() + } + + return lengthInBits +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetObjectIdentifierOrUnsignedIntegerParse(readBuffer utils.ReadBuffer) (*BACnetObjectIdentifierOrUnsignedInteger, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetObjectIdentifierOrUnsignedInteger"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Peek Field (peekedTagHeader) + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("peekedTagHeader"); pullErr != nil { + return nil, pullErr + } + peekedTagHeader, _ := BACnetTagHeaderParse(readBuffer) + readBuffer.Reset(currentPos) + + // Virtual field + _peekedTagNumber := peekedTagHeader.GetActualTagNumber() + peekedTagNumber := uint8(_peekedTagNumber) + _ = peekedTagNumber + + // Optional Field (objectIdentifier) (Can be skipped, if a given expression evaluates to false) + var objectIdentifier *BACnetApplicationTagObjectIdentifier = nil + if bool((peekedTagNumber) == (0xC)) { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("objectIdentifier"); pullErr != nil { + return nil, pullErr + } + _val, _err := BACnetApplicationTagParse(readBuffer) + 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 'objectIdentifier' field") + default: + objectIdentifier = CastBACnetApplicationTagObjectIdentifier(_val) + if closeErr := readBuffer.CloseContext("objectIdentifier"); closeErr != nil { + return nil, closeErr + } + } + } + + // Optional Field (fallbackIdentifier) (Can be skipped, if a given expression evaluates to false) + var fallbackIdentifier *BACnetApplicationTagUnsignedInteger = nil + if bool((peekedTagNumber) == (0x2)) { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("fallbackIdentifier"); pullErr != nil { + return nil, pullErr + } + _val, _err := BACnetApplicationTagParse(readBuffer) + 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 'fallbackIdentifier' field") + default: + fallbackIdentifier = CastBACnetApplicationTagUnsignedInteger(_val) + if closeErr := readBuffer.CloseContext("fallbackIdentifier"); closeErr != nil { + return nil, closeErr + } + } + } + + // Optional Field (nullValue) (Can be skipped, if a given expression evaluates to false) + var nullValue *BACnetApplicationTagNull = nil + if bool(bool((objectIdentifier) == (nil))) && bool(bool((fallbackIdentifier) == (nil))) { + currentPos = positionAware.GetPos() + if pullErr := readBuffer.PullContext("nullValue"); pullErr != nil { + return nil, pullErr + } + _val, _err := BACnetApplicationTagParse(readBuffer) + 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 'nullValue' field") + default: + nullValue = CastBACnetApplicationTagNull(_val) + if closeErr := readBuffer.CloseContext("nullValue"); closeErr != nil { + return nil, closeErr + } + } + } + + if closeErr := readBuffer.CloseContext("BACnetObjectIdentifierOrUnsignedInteger"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetObjectIdentifierOrUnsignedInteger(peekedTagHeader, objectIdentifier, fallbackIdentifier, nullValue), nil +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetObjectIdentifierOrUnsignedInteger"); pushErr != nil { + return pushErr + } + // Virtual field + if _peekedTagNumberErr := writeBuffer.WriteVirtual("peekedTagNumber", m.GetPeekedTagNumber()); _peekedTagNumberErr != nil { + return errors.Wrap(_peekedTagNumberErr, "Error serializing 'peekedTagNumber' field") + } + + // Optional Field (objectIdentifier) (Can be skipped, if the value is null) + var objectIdentifier *BACnetApplicationTagObjectIdentifier = nil + if m.ObjectIdentifier != nil { + if pushErr := writeBuffer.PushContext("objectIdentifier"); pushErr != nil { + return pushErr + } + objectIdentifier = m.ObjectIdentifier + _objectIdentifierErr := objectIdentifier.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("objectIdentifier"); popErr != nil { + return popErr + } + if _objectIdentifierErr != nil { + return errors.Wrap(_objectIdentifierErr, "Error serializing 'objectIdentifier' field") + } + } + + // Optional Field (fallbackIdentifier) (Can be skipped, if the value is null) + var fallbackIdentifier *BACnetApplicationTagUnsignedInteger = nil + if m.FallbackIdentifier != nil { + if pushErr := writeBuffer.PushContext("fallbackIdentifier"); pushErr != nil { + return pushErr + } + fallbackIdentifier = m.FallbackIdentifier + _fallbackIdentifierErr := fallbackIdentifier.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("fallbackIdentifier"); popErr != nil { + return popErr + } + if _fallbackIdentifierErr != nil { + return errors.Wrap(_fallbackIdentifierErr, "Error serializing 'fallbackIdentifier' field") + } + } + + // Optional Field (nullValue) (Can be skipped, if the value is null) + var nullValue *BACnetApplicationTagNull = nil + if m.NullValue != nil { + if pushErr := writeBuffer.PushContext("nullValue"); pushErr != nil { + return pushErr + } + nullValue = m.NullValue + _nullValueErr := nullValue.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("nullValue"); popErr != nil { + return popErr + } + if _nullValueErr != nil { + return errors.Wrap(_nullValueErr, "Error serializing 'nullValue' field") + } + } + + if popErr := writeBuffer.PopContext("BACnetObjectIdentifierOrUnsignedInteger"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetObjectIdentifierOrUnsignedInteger) 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/BACnetObjectTypesSupportedTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypesSupportedTagged.go new file mode 100644 index 00000000000..88559ab279a --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetObjectTypesSupportedTagged.go @@ -0,0 +1,388 @@ +/* + * 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. + +// BACnetObjectTypesSupportedTagged is the data-structure of this message +type BACnetObjectTypesSupportedTagged struct { + Header *BACnetTagHeader + Payload *BACnetTagPayloadBitString + + // Arguments. + TagNumber uint8 + TagClass TagClass +} + +// IBACnetObjectTypesSupportedTagged is the corresponding interface of BACnetObjectTypesSupportedTagged +type IBACnetObjectTypesSupportedTagged interface { + // GetHeader returns Header (property field) + GetHeader() *BACnetTagHeader + // GetPayload returns Payload (property field) + GetPayload() *BACnetTagPayloadBitString + // GetTimeValue returns TimeValue (virtual field) + GetTimeValue() bool + // GetNotificationForwarder returns NotificationForwarder (virtual field) + GetNotificationForwarder() bool + // GetAlertEnrollment returns AlertEnrollment (virtual field) + GetAlertEnrollment() bool + // GetChannel returns Channel (virtual field) + GetChannel() bool + // GetLightingOutput returns LightingOutput (virtual field) + GetLightingOutput() bool + // GetBinaryLightingOutput returns BinaryLightingOutput (virtual field) + GetBinaryLightingOutput() bool + // GetNetworkPort returns NetworkPort (virtual field) + GetNetworkPort() bool + // GetElevatorGroup returns ElevatorGroup (virtual field) + GetElevatorGroup() bool + // GetEscalator returns Escalator (virtual field) + GetEscalator() bool + // GetLift returns Lift (virtual field) + GetLift() bool + // GetLengthInBytes returns the length in bytes + GetLengthInBytes() uint16 + // GetLengthInBits returns the length in bits + GetLengthInBits() uint16 + // Serialize serializes this type + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetObjectTypesSupportedTagged) GetHeader() *BACnetTagHeader { + return m.Header +} + +func (m *BACnetObjectTypesSupportedTagged) GetPayload() *BACnetTagPayloadBitString { + return m.Payload +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for virtual fields. +/////////////////////// + +func (m *BACnetObjectTypesSupportedTagged) GetTimeValue() bool { + return bool(m.GetPayload().GetData()[0]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetNotificationForwarder() bool { + return bool(m.GetPayload().GetData()[1]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetAlertEnrollment() bool { + return bool(m.GetPayload().GetData()[2]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetChannel() bool { + return bool(m.GetPayload().GetData()[3]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetLightingOutput() bool { + return bool(m.GetPayload().GetData()[4]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetBinaryLightingOutput() bool { + return bool(m.GetPayload().GetData()[5]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetNetworkPort() bool { + return bool(m.GetPayload().GetData()[6]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetElevatorGroup() bool { + return bool(m.GetPayload().GetData()[7]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetEscalator() bool { + return bool(m.GetPayload().GetData()[8]) +} + +func (m *BACnetObjectTypesSupportedTagged) GetLift() bool { + return bool(m.GetPayload().GetData()[9]) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetObjectTypesSupportedTagged factory function for BACnetObjectTypesSupportedTagged +func NewBACnetObjectTypesSupportedTagged(header *BACnetTagHeader, payload *BACnetTagPayloadBitString, tagNumber uint8, tagClass TagClass) *BACnetObjectTypesSupportedTagged { + return &BACnetObjectTypesSupportedTagged{Header: header, Payload: payload, TagNumber: tagNumber, TagClass: tagClass} +} + +func CastBACnetObjectTypesSupportedTagged(structType interface{}) *BACnetObjectTypesSupportedTagged { + if casted, ok := structType.(BACnetObjectTypesSupportedTagged); ok { + return &casted + } + if casted, ok := structType.(*BACnetObjectTypesSupportedTagged); ok { + return casted + } + return nil +} + +func (m *BACnetObjectTypesSupportedTagged) GetTypeName() string { + return "BACnetObjectTypesSupportedTagged" +} + +func (m *BACnetObjectTypesSupportedTagged) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetObjectTypesSupportedTagged) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (header) + lengthInBits += m.Header.GetLengthInBits() + + // Simple field (payload) + lengthInBits += m.Payload.GetLengthInBits() + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + return lengthInBits +} + +func (m *BACnetObjectTypesSupportedTagged) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetObjectTypesSupportedTaggedParse(readBuffer utils.ReadBuffer, tagNumber uint8, tagClass TagClass) (*BACnetObjectTypesSupportedTagged, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetObjectTypesSupportedTagged"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (header) + if pullErr := readBuffer.PullContext("header"); pullErr != nil { + return nil, pullErr + } + _header, _headerErr := BACnetTagHeaderParse(readBuffer) + if _headerErr != nil { + return nil, errors.Wrap(_headerErr, "Error parsing 'header' field") + } + header := CastBACnetTagHeader(_header) + if closeErr := readBuffer.CloseContext("header"); closeErr != nil { + return nil, closeErr + } + + // Validation + if !(bool((header.GetTagClass()) == (tagClass))) { + return nil, utils.ParseValidationError{"tag class doesn't match"} + } + + // Validation + if !(bool(bool(bool((header.GetTagClass()) == (TagClass_APPLICATION_TAGS)))) || bool(bool(bool((header.GetActualTagNumber()) == (tagNumber))))) { + return nil, utils.ParseAssertError{"tagnumber doesn't match"} + } + + // Simple Field (payload) + if pullErr := readBuffer.PullContext("payload"); pullErr != nil { + return nil, pullErr + } + _payload, _payloadErr := BACnetTagPayloadBitStringParse(readBuffer, uint32(header.GetActualLength())) + if _payloadErr != nil { + return nil, errors.Wrap(_payloadErr, "Error parsing 'payload' field") + } + payload := CastBACnetTagPayloadBitString(_payload) + if closeErr := readBuffer.CloseContext("payload"); closeErr != nil { + return nil, closeErr + } + + // Virtual field + _timeValue := payload.GetData()[0] + timeValue := bool(_timeValue) + _ = timeValue + + // Virtual field + _notificationForwarder := payload.GetData()[1] + notificationForwarder := bool(_notificationForwarder) + _ = notificationForwarder + + // Virtual field + _alertEnrollment := payload.GetData()[2] + alertEnrollment := bool(_alertEnrollment) + _ = alertEnrollment + + // Virtual field + _channel := payload.GetData()[3] + channel := bool(_channel) + _ = channel + + // Virtual field + _lightingOutput := payload.GetData()[4] + lightingOutput := bool(_lightingOutput) + _ = lightingOutput + + // Virtual field + _binaryLightingOutput := payload.GetData()[5] + binaryLightingOutput := bool(_binaryLightingOutput) + _ = binaryLightingOutput + + // Virtual field + _networkPort := payload.GetData()[6] + networkPort := bool(_networkPort) + _ = networkPort + + // Virtual field + _elevatorGroup := payload.GetData()[7] + elevatorGroup := bool(_elevatorGroup) + _ = elevatorGroup + + // Virtual field + _escalator := payload.GetData()[8] + escalator := bool(_escalator) + _ = escalator + + // Virtual field + _lift := payload.GetData()[9] + lift := bool(_lift) + _ = lift + + if closeErr := readBuffer.CloseContext("BACnetObjectTypesSupportedTagged"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetObjectTypesSupportedTagged(header, payload, tagNumber, tagClass), nil +} + +func (m *BACnetObjectTypesSupportedTagged) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetObjectTypesSupportedTagged"); pushErr != nil { + return pushErr + } + + // Simple Field (header) + if pushErr := writeBuffer.PushContext("header"); pushErr != nil { + return pushErr + } + _headerErr := m.Header.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("header"); popErr != nil { + return popErr + } + if _headerErr != nil { + return errors.Wrap(_headerErr, "Error serializing 'header' field") + } + + // Simple Field (payload) + if pushErr := writeBuffer.PushContext("payload"); pushErr != nil { + return pushErr + } + _payloadErr := m.Payload.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("payload"); popErr != nil { + return popErr + } + if _payloadErr != nil { + return errors.Wrap(_payloadErr, "Error serializing 'payload' field") + } + // Virtual field + if _timeValueErr := writeBuffer.WriteVirtual("timeValue", m.GetTimeValue()); _timeValueErr != nil { + return errors.Wrap(_timeValueErr, "Error serializing 'timeValue' field") + } + // Virtual field + if _notificationForwarderErr := writeBuffer.WriteVirtual("notificationForwarder", m.GetNotificationForwarder()); _notificationForwarderErr != nil { + return errors.Wrap(_notificationForwarderErr, "Error serializing 'notificationForwarder' field") + } + // Virtual field + if _alertEnrollmentErr := writeBuffer.WriteVirtual("alertEnrollment", m.GetAlertEnrollment()); _alertEnrollmentErr != nil { + return errors.Wrap(_alertEnrollmentErr, "Error serializing 'alertEnrollment' field") + } + // Virtual field + if _channelErr := writeBuffer.WriteVirtual("channel", m.GetChannel()); _channelErr != nil { + return errors.Wrap(_channelErr, "Error serializing 'channel' field") + } + // Virtual field + if _lightingOutputErr := writeBuffer.WriteVirtual("lightingOutput", m.GetLightingOutput()); _lightingOutputErr != nil { + return errors.Wrap(_lightingOutputErr, "Error serializing 'lightingOutput' field") + } + // Virtual field + if _binaryLightingOutputErr := writeBuffer.WriteVirtual("binaryLightingOutput", m.GetBinaryLightingOutput()); _binaryLightingOutputErr != nil { + return errors.Wrap(_binaryLightingOutputErr, "Error serializing 'binaryLightingOutput' field") + } + // Virtual field + if _networkPortErr := writeBuffer.WriteVirtual("networkPort", m.GetNetworkPort()); _networkPortErr != nil { + return errors.Wrap(_networkPortErr, "Error serializing 'networkPort' field") + } + // Virtual field + if _elevatorGroupErr := writeBuffer.WriteVirtual("elevatorGroup", m.GetElevatorGroup()); _elevatorGroupErr != nil { + return errors.Wrap(_elevatorGroupErr, "Error serializing 'elevatorGroup' field") + } + // Virtual field + if _escalatorErr := writeBuffer.WriteVirtual("escalator", m.GetEscalator()); _escalatorErr != nil { + return errors.Wrap(_escalatorErr, "Error serializing 'escalator' field") + } + // Virtual field + if _liftErr := writeBuffer.WriteVirtual("lift", m.GetLift()); _liftErr != nil { + return errors.Wrap(_liftErr, "Error serializing 'lift' field") + } + + if popErr := writeBuffer.PopContext("BACnetObjectTypesSupportedTagged"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetObjectTypesSupportedTagged) 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/BACnetServicesSupportedTagged.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetServicesSupportedTagged.go new file mode 100644 index 00000000000..2790bee6c7f --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetServicesSupportedTagged.go @@ -0,0 +1,388 @@ +/* + * 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. + +// BACnetServicesSupportedTagged is the data-structure of this message +type BACnetServicesSupportedTagged struct { + Header *BACnetTagHeader + Payload *BACnetTagPayloadBitString + + // Arguments. + TagNumber uint8 + TagClass TagClass +} + +// IBACnetServicesSupportedTagged is the corresponding interface of BACnetServicesSupportedTagged +type IBACnetServicesSupportedTagged interface { + // GetHeader returns Header (property field) + GetHeader() *BACnetTagHeader + // GetPayload returns Payload (property field) + GetPayload() *BACnetTagPayloadBitString + // GetWriteGroup returns WriteGroup (virtual field) + GetWriteGroup() bool + // GetSubscribeCovPropertyMultiple returns SubscribeCovPropertyMultiple (virtual field) + GetSubscribeCovPropertyMultiple() bool + // GetConfirmedCovNotificationMultiple returns ConfirmedCovNotificationMultiple (virtual field) + GetConfirmedCovNotificationMultiple() bool + // GetUnconfirmedCovNotificationMultiple returns UnconfirmedCovNotificationMultiple (virtual field) + GetUnconfirmedCovNotificationMultiple() bool + // GetWhoIs returns WhoIs (virtual field) + GetWhoIs() bool + // GetReadRange returns ReadRange (virtual field) + GetReadRange() bool + // GetUtcTimeSynchronization returns UtcTimeSynchronization (virtual field) + GetUtcTimeSynchronization() bool + // GetLifeSafetyOperation returns LifeSafetyOperation (virtual field) + GetLifeSafetyOperation() bool + // GetSubscribeCovProperty returns SubscribeCovProperty (virtual field) + GetSubscribeCovProperty() bool + // GetGetEventInformation returns GetEventInformation (virtual field) + GetGetEventInformation() bool + // GetLengthInBytes returns the length in bytes + GetLengthInBytes() uint16 + // GetLengthInBits returns the length in bits + GetLengthInBits() uint16 + // Serialize serializes this type + Serialize(writeBuffer utils.WriteBuffer) error +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *BACnetServicesSupportedTagged) GetHeader() *BACnetTagHeader { + return m.Header +} + +func (m *BACnetServicesSupportedTagged) GetPayload() *BACnetTagPayloadBitString { + return m.Payload +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for virtual fields. +/////////////////////// + +func (m *BACnetServicesSupportedTagged) GetWriteGroup() bool { + return bool(m.GetPayload().GetData()[0]) +} + +func (m *BACnetServicesSupportedTagged) GetSubscribeCovPropertyMultiple() bool { + return bool(m.GetPayload().GetData()[1]) +} + +func (m *BACnetServicesSupportedTagged) GetConfirmedCovNotificationMultiple() bool { + return bool(m.GetPayload().GetData()[2]) +} + +func (m *BACnetServicesSupportedTagged) GetUnconfirmedCovNotificationMultiple() bool { + return bool(m.GetPayload().GetData()[3]) +} + +func (m *BACnetServicesSupportedTagged) GetWhoIs() bool { + return bool(m.GetPayload().GetData()[4]) +} + +func (m *BACnetServicesSupportedTagged) GetReadRange() bool { + return bool(m.GetPayload().GetData()[5]) +} + +func (m *BACnetServicesSupportedTagged) GetUtcTimeSynchronization() bool { + return bool(m.GetPayload().GetData()[6]) +} + +func (m *BACnetServicesSupportedTagged) GetLifeSafetyOperation() bool { + return bool(m.GetPayload().GetData()[7]) +} + +func (m *BACnetServicesSupportedTagged) GetSubscribeCovProperty() bool { + return bool(m.GetPayload().GetData()[8]) +} + +func (m *BACnetServicesSupportedTagged) GetGetEventInformation() bool { + return bool(m.GetPayload().GetData()[9]) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetServicesSupportedTagged factory function for BACnetServicesSupportedTagged +func NewBACnetServicesSupportedTagged(header *BACnetTagHeader, payload *BACnetTagPayloadBitString, tagNumber uint8, tagClass TagClass) *BACnetServicesSupportedTagged { + return &BACnetServicesSupportedTagged{Header: header, Payload: payload, TagNumber: tagNumber, TagClass: tagClass} +} + +func CastBACnetServicesSupportedTagged(structType interface{}) *BACnetServicesSupportedTagged { + if casted, ok := structType.(BACnetServicesSupportedTagged); ok { + return &casted + } + if casted, ok := structType.(*BACnetServicesSupportedTagged); ok { + return casted + } + return nil +} + +func (m *BACnetServicesSupportedTagged) GetTypeName() string { + return "BACnetServicesSupportedTagged" +} + +func (m *BACnetServicesSupportedTagged) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetServicesSupportedTagged) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (header) + lengthInBits += m.Header.GetLengthInBits() + + // Simple field (payload) + lengthInBits += m.Payload.GetLengthInBits() + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + // A virtual field doesn't have any in- or output. + + return lengthInBits +} + +func (m *BACnetServicesSupportedTagged) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetServicesSupportedTaggedParse(readBuffer utils.ReadBuffer, tagNumber uint8, tagClass TagClass) (*BACnetServicesSupportedTagged, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetServicesSupportedTagged"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (header) + if pullErr := readBuffer.PullContext("header"); pullErr != nil { + return nil, pullErr + } + _header, _headerErr := BACnetTagHeaderParse(readBuffer) + if _headerErr != nil { + return nil, errors.Wrap(_headerErr, "Error parsing 'header' field") + } + header := CastBACnetTagHeader(_header) + if closeErr := readBuffer.CloseContext("header"); closeErr != nil { + return nil, closeErr + } + + // Validation + if !(bool((header.GetTagClass()) == (tagClass))) { + return nil, utils.ParseValidationError{"tag class doesn't match"} + } + + // Validation + if !(bool(bool(bool((header.GetTagClass()) == (TagClass_APPLICATION_TAGS)))) || bool(bool(bool((header.GetActualTagNumber()) == (tagNumber))))) { + return nil, utils.ParseAssertError{"tagnumber doesn't match"} + } + + // Simple Field (payload) + if pullErr := readBuffer.PullContext("payload"); pullErr != nil { + return nil, pullErr + } + _payload, _payloadErr := BACnetTagPayloadBitStringParse(readBuffer, uint32(header.GetActualLength())) + if _payloadErr != nil { + return nil, errors.Wrap(_payloadErr, "Error parsing 'payload' field") + } + payload := CastBACnetTagPayloadBitString(_payload) + if closeErr := readBuffer.CloseContext("payload"); closeErr != nil { + return nil, closeErr + } + + // Virtual field + _writeGroup := payload.GetData()[0] + writeGroup := bool(_writeGroup) + _ = writeGroup + + // Virtual field + _subscribeCovPropertyMultiple := payload.GetData()[1] + subscribeCovPropertyMultiple := bool(_subscribeCovPropertyMultiple) + _ = subscribeCovPropertyMultiple + + // Virtual field + _confirmedCovNotificationMultiple := payload.GetData()[2] + confirmedCovNotificationMultiple := bool(_confirmedCovNotificationMultiple) + _ = confirmedCovNotificationMultiple + + // Virtual field + _unconfirmedCovNotificationMultiple := payload.GetData()[3] + unconfirmedCovNotificationMultiple := bool(_unconfirmedCovNotificationMultiple) + _ = unconfirmedCovNotificationMultiple + + // Virtual field + _whoIs := payload.GetData()[4] + whoIs := bool(_whoIs) + _ = whoIs + + // Virtual field + _readRange := payload.GetData()[5] + readRange := bool(_readRange) + _ = readRange + + // Virtual field + _utcTimeSynchronization := payload.GetData()[6] + utcTimeSynchronization := bool(_utcTimeSynchronization) + _ = utcTimeSynchronization + + // Virtual field + _lifeSafetyOperation := payload.GetData()[7] + lifeSafetyOperation := bool(_lifeSafetyOperation) + _ = lifeSafetyOperation + + // Virtual field + _subscribeCovProperty := payload.GetData()[8] + subscribeCovProperty := bool(_subscribeCovProperty) + _ = subscribeCovProperty + + // Virtual field + _getEventInformation := payload.GetData()[9] + getEventInformation := bool(_getEventInformation) + _ = getEventInformation + + if closeErr := readBuffer.CloseContext("BACnetServicesSupportedTagged"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetServicesSupportedTagged(header, payload, tagNumber, tagClass), nil +} + +func (m *BACnetServicesSupportedTagged) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetServicesSupportedTagged"); pushErr != nil { + return pushErr + } + + // Simple Field (header) + if pushErr := writeBuffer.PushContext("header"); pushErr != nil { + return pushErr + } + _headerErr := m.Header.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("header"); popErr != nil { + return popErr + } + if _headerErr != nil { + return errors.Wrap(_headerErr, "Error serializing 'header' field") + } + + // Simple Field (payload) + if pushErr := writeBuffer.PushContext("payload"); pushErr != nil { + return pushErr + } + _payloadErr := m.Payload.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("payload"); popErr != nil { + return popErr + } + if _payloadErr != nil { + return errors.Wrap(_payloadErr, "Error serializing 'payload' field") + } + // Virtual field + if _writeGroupErr := writeBuffer.WriteVirtual("writeGroup", m.GetWriteGroup()); _writeGroupErr != nil { + return errors.Wrap(_writeGroupErr, "Error serializing 'writeGroup' field") + } + // Virtual field + if _subscribeCovPropertyMultipleErr := writeBuffer.WriteVirtual("subscribeCovPropertyMultiple", m.GetSubscribeCovPropertyMultiple()); _subscribeCovPropertyMultipleErr != nil { + return errors.Wrap(_subscribeCovPropertyMultipleErr, "Error serializing 'subscribeCovPropertyMultiple' field") + } + // Virtual field + if _confirmedCovNotificationMultipleErr := writeBuffer.WriteVirtual("confirmedCovNotificationMultiple", m.GetConfirmedCovNotificationMultiple()); _confirmedCovNotificationMultipleErr != nil { + return errors.Wrap(_confirmedCovNotificationMultipleErr, "Error serializing 'confirmedCovNotificationMultiple' field") + } + // Virtual field + if _unconfirmedCovNotificationMultipleErr := writeBuffer.WriteVirtual("unconfirmedCovNotificationMultiple", m.GetUnconfirmedCovNotificationMultiple()); _unconfirmedCovNotificationMultipleErr != nil { + return errors.Wrap(_unconfirmedCovNotificationMultipleErr, "Error serializing 'unconfirmedCovNotificationMultiple' field") + } + // Virtual field + if _whoIsErr := writeBuffer.WriteVirtual("whoIs", m.GetWhoIs()); _whoIsErr != nil { + return errors.Wrap(_whoIsErr, "Error serializing 'whoIs' field") + } + // Virtual field + if _readRangeErr := writeBuffer.WriteVirtual("readRange", m.GetReadRange()); _readRangeErr != nil { + return errors.Wrap(_readRangeErr, "Error serializing 'readRange' field") + } + // Virtual field + if _utcTimeSynchronizationErr := writeBuffer.WriteVirtual("utcTimeSynchronization", m.GetUtcTimeSynchronization()); _utcTimeSynchronizationErr != nil { + return errors.Wrap(_utcTimeSynchronizationErr, "Error serializing 'utcTimeSynchronization' field") + } + // Virtual field + if _lifeSafetyOperationErr := writeBuffer.WriteVirtual("lifeSafetyOperation", m.GetLifeSafetyOperation()); _lifeSafetyOperationErr != nil { + return errors.Wrap(_lifeSafetyOperationErr, "Error serializing 'lifeSafetyOperation' field") + } + // Virtual field + if _subscribeCovPropertyErr := writeBuffer.WriteVirtual("subscribeCovProperty", m.GetSubscribeCovProperty()); _subscribeCovPropertyErr != nil { + return errors.Wrap(_subscribeCovPropertyErr, "Error serializing 'subscribeCovProperty' field") + } + // Virtual field + if _getEventInformationErr := writeBuffer.WriteVirtual("getEventInformation", m.GetGetEventInformation()); _getEventInformationErr != nil { + return errors.Wrap(_getEventInformationErr, "Error serializing 'getEventInformation' field") + } + + if popErr := writeBuffer.PopContext("BACnetServicesSupportedTagged"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetServicesSupportedTagged) 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/BACnetVTSession.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVTSession.go new file mode 100644 index 00000000000..120ba5e78c8 --- /dev/null +++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetVTSession.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. + +// BACnetVTSession is the data-structure of this message +type BACnetVTSession struct { + LocalVtSessionId *BACnetApplicationTagUnsignedInteger + RemoveVtSessionId *BACnetApplicationTagUnsignedInteger + RemoteVtAddress *BACnetAddress +} + +// IBACnetVTSession is the corresponding interface of BACnetVTSession +type IBACnetVTSession interface { + // GetLocalVtSessionId returns LocalVtSessionId (property field) + GetLocalVtSessionId() *BACnetApplicationTagUnsignedInteger + // GetRemoveVtSessionId returns RemoveVtSessionId (property field) + GetRemoveVtSessionId() *BACnetApplicationTagUnsignedInteger + // GetRemoteVtAddress returns RemoteVtAddress (property field) + GetRemoteVtAddress() *BACnetAddress + // 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 *BACnetVTSession) GetLocalVtSessionId() *BACnetApplicationTagUnsignedInteger { + return m.LocalVtSessionId +} + +func (m *BACnetVTSession) GetRemoveVtSessionId() *BACnetApplicationTagUnsignedInteger { + return m.RemoveVtSessionId +} + +func (m *BACnetVTSession) GetRemoteVtAddress() *BACnetAddress { + return m.RemoteVtAddress +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewBACnetVTSession factory function for BACnetVTSession +func NewBACnetVTSession(localVtSessionId *BACnetApplicationTagUnsignedInteger, removeVtSessionId *BACnetApplicationTagUnsignedInteger, remoteVtAddress *BACnetAddress) *BACnetVTSession { + return &BACnetVTSession{LocalVtSessionId: localVtSessionId, RemoveVtSessionId: removeVtSessionId, RemoteVtAddress: remoteVtAddress} +} + +func CastBACnetVTSession(structType interface{}) *BACnetVTSession { + if casted, ok := structType.(BACnetVTSession); ok { + return &casted + } + if casted, ok := structType.(*BACnetVTSession); ok { + return casted + } + return nil +} + +func (m *BACnetVTSession) GetTypeName() string { + return "BACnetVTSession" +} + +func (m *BACnetVTSession) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *BACnetVTSession) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Simple field (localVtSessionId) + lengthInBits += m.LocalVtSessionId.GetLengthInBits() + + // Simple field (removeVtSessionId) + lengthInBits += m.RemoveVtSessionId.GetLengthInBits() + + // Simple field (remoteVtAddress) + lengthInBits += m.RemoteVtAddress.GetLengthInBits() + + return lengthInBits +} + +func (m *BACnetVTSession) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func BACnetVTSessionParse(readBuffer utils.ReadBuffer) (*BACnetVTSession, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("BACnetVTSession"); pullErr != nil { + return nil, pullErr + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (localVtSessionId) + if pullErr := readBuffer.PullContext("localVtSessionId"); pullErr != nil { + return nil, pullErr + } + _localVtSessionId, _localVtSessionIdErr := BACnetApplicationTagParse(readBuffer) + if _localVtSessionIdErr != nil { + return nil, errors.Wrap(_localVtSessionIdErr, "Error parsing 'localVtSessionId' field") + } + localVtSessionId := CastBACnetApplicationTagUnsignedInteger(_localVtSessionId) + if closeErr := readBuffer.CloseContext("localVtSessionId"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (removeVtSessionId) + if pullErr := readBuffer.PullContext("removeVtSessionId"); pullErr != nil { + return nil, pullErr + } + _removeVtSessionId, _removeVtSessionIdErr := BACnetApplicationTagParse(readBuffer) + if _removeVtSessionIdErr != nil { + return nil, errors.Wrap(_removeVtSessionIdErr, "Error parsing 'removeVtSessionId' field") + } + removeVtSessionId := CastBACnetApplicationTagUnsignedInteger(_removeVtSessionId) + if closeErr := readBuffer.CloseContext("removeVtSessionId"); closeErr != nil { + return nil, closeErr + } + + // Simple Field (remoteVtAddress) + if pullErr := readBuffer.PullContext("remoteVtAddress"); pullErr != nil { + return nil, pullErr + } + _remoteVtAddress, _remoteVtAddressErr := BACnetAddressParse(readBuffer) + if _remoteVtAddressErr != nil { + return nil, errors.Wrap(_remoteVtAddressErr, "Error parsing 'remoteVtAddress' field") + } + remoteVtAddress := CastBACnetAddress(_remoteVtAddress) + if closeErr := readBuffer.CloseContext("remoteVtAddress"); closeErr != nil { + return nil, closeErr + } + + if closeErr := readBuffer.CloseContext("BACnetVTSession"); closeErr != nil { + return nil, closeErr + } + + // Create the instance + return NewBACnetVTSession(localVtSessionId, removeVtSessionId, remoteVtAddress), nil +} + +func (m *BACnetVTSession) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("BACnetVTSession"); pushErr != nil { + return pushErr + } + + // Simple Field (localVtSessionId) + if pushErr := writeBuffer.PushContext("localVtSessionId"); pushErr != nil { + return pushErr + } + _localVtSessionIdErr := m.LocalVtSessionId.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("localVtSessionId"); popErr != nil { + return popErr + } + if _localVtSessionIdErr != nil { + return errors.Wrap(_localVtSessionIdErr, "Error serializing 'localVtSessionId' field") + } + + // Simple Field (removeVtSessionId) + if pushErr := writeBuffer.PushContext("removeVtSessionId"); pushErr != nil { + return pushErr + } + _removeVtSessionIdErr := m.RemoveVtSessionId.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("removeVtSessionId"); popErr != nil { + return popErr + } + if _removeVtSessionIdErr != nil { + return errors.Wrap(_removeVtSessionIdErr, "Error serializing 'removeVtSessionId' field") + } + + // Simple Field (remoteVtAddress) + if pushErr := writeBuffer.PushContext("remoteVtAddress"); pushErr != nil { + return pushErr + } + _remoteVtAddressErr := m.RemoteVtAddress.Serialize(writeBuffer) + if popErr := writeBuffer.PopContext("remoteVtAddress"); popErr != nil { + return popErr + } + if _remoteVtAddressErr != nil { + return errors.Wrap(_remoteVtAddressErr, "Error serializing 'remoteVtAddress' field") + } + + if popErr := writeBuffer.PopContext("BACnetVTSession"); popErr != nil { + return popErr + } + return nil +} + +func (m *BACnetVTSession) 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/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java index 54d00cd1ab5..8c4b50127a3 100644 --- a/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java +++ b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/RandomPackagesTest.java @@ -1224,8 +1224,8 @@ Collection Ethereal_Misinterpreted_Packet() throws Exception { { BACnetPropertyValue baCnetPropertyValue = baCnetNotificationParametersComplexEventType.getListOfValues().getData().get(9); assertEquals(BACnetPropertyIdentifier.VENDOR_IDENTIFIER, baCnetPropertyValue.getPropertyIdentifier().getValue()); - BACnetApplicationTagUnsignedInteger baCnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) ((BACnetConstructedDataUnspecified) baCnetPropertyValue.getPropertyValue().getConstructedData()).getData().get(0).getApplicationTag(); - assertEquals(5, baCnetApplicationTagUnsignedInteger.getPayload().getActualValue().longValue()); + BACnetVendorIdTagged vendorId = (BACnetVendorIdTagged) ((BACnetConstructedDataVendorIdentifier) baCnetPropertyValue.getPropertyValue().getConstructedData()).getVendorIdentifier(); + assertEquals(BACnetVendorId.JOHNSON_CONTROLS_INC, vendorId.getValue()); } } }) @@ -1935,17 +1935,12 @@ Collection alerton_plugfest_2() throws Exception { .isNull(); assertThat(baCnetServiceAckReadProperty) .extracting(BACnetServiceAckReadProperty::getValues) - .asInstanceOf(InstanceOfAssertFactories.type(BACnetConstructedDataUnspecified.class)) - .extracting(BACnetConstructedDataUnspecified::getData) - .satisfies(baCnetConstructedDataElements -> - assertThat(baCnetConstructedDataElements) - .element(0) - .extracting(BACnetConstructedDataElement::getApplicationTag) - .asInstanceOf(InstanceOfAssertFactories.type(BACnetApplicationTagUnsignedInteger.class)) - .extracting(BACnetApplicationTagUnsignedInteger::getPayload) - .extracting(BACnetTagPayloadUnsignedInteger::getValueUint8) - .isEqualTo((short) 1) - ); + .asInstanceOf(InstanceOfAssertFactories.type(BACnetConstructedDataProtocolVersion.class)) + .extracting(BACnetConstructedDataProtocolVersion::getProtocolVersion) + .asInstanceOf(InstanceOfAssertFactories.type(BACnetApplicationTagUnsignedInteger.class)) + .extracting(BACnetApplicationTagUnsignedInteger::getPayload) + .extracting(BACnetTagPayloadUnsignedInteger::getValueUint8) + .isEqualTo((short) 1); })), pcapEvaluator.parseFrom(2) ); @@ -2102,53 +2097,53 @@ Collection bacapp_malform() throws Exception { TestPcapEvaluator pcapEvaluator = pcapEvaluator("bacapp-malform.cap", BACNET_BPF_FILTER_UDP); return List.of(pcapEvaluator.parseEmAll( IntStream.of( - 1, 5, 13, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, - 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, - 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, - 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, - 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, - 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, - 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, - 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, - 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, - 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, - 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, - 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, - 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, - 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, - 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, - 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, 670, 672, - 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, - 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 752, - 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, - 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, - 834, 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, 864, 866, 868, 870, 872, - 874, 876, 878, 880, 882, 884, 886, 888, 890, 892, 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, - 914, 916, 918, 920, 922, 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 952, - 954, 956, 958, 960, 962, 964, 966, 968, 970, 972, 974, 976, 978, 980, 982, 984, 986, 988, 990, 992, - 994, 996, 998, 1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, 1022, 1024, 1026, - 1028, 1030, 1032, 1034, 1036, 1038, 1040, 1042, 1044, 1046, 1048, 1050, 1052, 1054, 1056, 1058, 1060, - 1062, 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1078, 1080, 1082, 1084, 1086, 1088, 1090, 1092, 1094, - 1096, 1098, 1100, 1102, 1104, 1106, 1108, 1110, 1112, 1114, 1116, 1118, 1120, 1122, 1124, 1126, 1128, - 1130, 1132, 1134, 1136, 1138, 1140, 1142, 1144, 1146, 1148, 1150, 1152, 1154, 1156, 1158, 1160, 1162, - 1164, 1166, 1168, 1170, 1172, 1174, 1176, 1178, 1180, 1182, 1184, 1186, 1188, 1190, 1192, 1194, 1196, - 1198, 1200, 1202, 1204, 1206, 1208, 1210, 1212, 1214, 1216, 1218, 1220, 1222, 1224, 1226, 1228, 1230, - 1232, 1234, 1236, 1238, 1240, 1242, 1244, 1246, 1248, 1250, 1252, 1254, 1256, 1258, 1260, 1262, 1264, - 1266, 1268, 1270, 1272, 1274, 1276, 1278, 1280, 1282, 1284, 1286, 1288, 1290, 1292, 1294, 1296, 1298, - 1300, 1302, 1304, 1306, 1308, 1310, 1312, 1314, 1316, 1318, 1320, 1322, 1324, 1326, 1328, 1330, 1332, - 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, - 1368, 1370, 1372, 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, 1396, 1398, 1400, - 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1430, 1432, 1434, - 1436, 1438, 1440, 1442, 1444, 1446, 1448, 1450, 1452, 1454, 1456, 1458, 1460, 1462, 1464, 1466, 1468, - 1470, 1472, 1474, 1476, 1478, 1480, 1482, 1484, 1486, 1488, 1490, 1492, 1494, 1496, 1498, 1500, 1502, - 1504, 1506, 1508, 1510, 1512, 1514, 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1536, - 1538, 1540, 1542, 1544, 1546, 1548, 1550, 1552, 1554, 1556, 1558, 1560, 1562, 1564, 1566, 1568, 1570, - 1572, 1574, 1576, 1578, 1580, 1582, 1584, 1586, 1588, 1590, 1592, 1594, 1596, 1598, 1600, 1602, 1604, - 1606, 1608, 1610, 1612, 1614, 1616, 1618, 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636, 1638, - 1640, 1642, 1644, 1646, 1648, 1650, 1652, 1654, 1656, 1658, 1660, 1662, 1664, 1666, 1668, 1670, 1672, - 1674, 1676, 1678, 1680, 1682 - ) - .mapToObj(i -> skip(i, SkipInstruction.SkipType.SKIP_COMPARE, "most of those packages contain extra undefined bytes")) + 1, 5, 13, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, + 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, + 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, + 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, + 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, + 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, + 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, + 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, + 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, + 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, + 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, + 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, + 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, + 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, + 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, + 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, 670, 672, + 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, + 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 752, + 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, + 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, + 834, 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, 864, 866, 868, 870, 872, + 874, 876, 878, 880, 882, 884, 886, 888, 890, 892, 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, + 914, 916, 918, 920, 922, 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 952, + 954, 956, 958, 960, 962, 964, 966, 968, 970, 972, 974, 976, 978, 980, 982, 984, 986, 988, 990, 992, + 994, 996, 998, 1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, 1022, 1024, 1026, + 1028, 1030, 1032, 1034, 1036, 1038, 1040, 1042, 1044, 1046, 1048, 1050, 1052, 1054, 1056, 1058, 1060, + 1062, 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1078, 1080, 1082, 1084, 1086, 1088, 1090, 1092, 1094, + 1096, 1098, 1100, 1102, 1104, 1106, 1108, 1110, 1112, 1114, 1116, 1118, 1120, 1122, 1124, 1126, 1128, + 1130, 1132, 1134, 1136, 1138, 1140, 1142, 1144, 1146, 1148, 1150, 1152, 1154, 1156, 1158, 1160, 1162, + 1164, 1166, 1168, 1170, 1172, 1174, 1176, 1178, 1180, 1182, 1184, 1186, 1188, 1190, 1192, 1194, 1196, + 1198, 1200, 1202, 1204, 1206, 1208, 1210, 1212, 1214, 1216, 1218, 1220, 1222, 1224, 1226, 1228, 1230, + 1232, 1234, 1236, 1238, 1240, 1242, 1244, 1246, 1248, 1250, 1252, 1254, 1256, 1258, 1260, 1262, 1264, + 1266, 1268, 1270, 1272, 1274, 1276, 1278, 1280, 1282, 1284, 1286, 1288, 1290, 1292, 1294, 1296, 1298, + 1300, 1302, 1304, 1306, 1308, 1310, 1312, 1314, 1316, 1318, 1320, 1322, 1324, 1326, 1328, 1330, 1332, + 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, + 1368, 1370, 1372, 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, 1396, 1398, 1400, + 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1430, 1432, 1434, + 1436, 1438, 1440, 1442, 1444, 1446, 1448, 1450, 1452, 1454, 1456, 1458, 1460, 1462, 1464, 1466, 1468, + 1470, 1472, 1474, 1476, 1478, 1480, 1482, 1484, 1486, 1488, 1490, 1492, 1494, 1496, 1498, 1500, 1502, + 1504, 1506, 1508, 1510, 1512, 1514, 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1536, + 1538, 1540, 1542, 1544, 1546, 1548, 1550, 1552, 1554, 1556, 1558, 1560, 1562, 1564, 1566, 1568, 1570, + 1572, 1574, 1576, 1578, 1580, 1582, 1584, 1586, 1588, 1590, 1592, 1594, 1596, 1598, 1600, 1602, 1604, + 1606, 1608, 1610, 1612, 1614, 1616, 1618, 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636, 1638, + 1640, 1642, 1644, 1646, 1648, 1650, 1652, 1654, 1656, 1658, 1660, 1662, 1664, 1666, 1668, 1670, 1672, + 1674, 1676, 1678, 1680, 1682 + ) + .mapToObj(i -> skip(i, SkipInstruction.SkipType.SKIP_COMPARE, "most of those packages contain extra undefined bytes")) .toArray(SkipInstruction[]::new) )); } @@ -3847,9 +3842,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.SYSTEM_STATUS, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagEnumerated baCnetApplicationTagEnumerated = (BACnetApplicationTagEnumerated) value; - assertEquals(0x0, baCnetApplicationTagEnumerated.getActualValue()); + BACnetDeviceStatusTagged value = ((BACnetConstructedDataSystemStatus) baCnetServiceAckReadProperty.getValues()).getSystemStatus(); + assertEquals(BACnetDeviceStatus.OPERATIONAL, value.getValue()); }), DynamicTest.dynamicTest("No. 19 - Confirmed-REQ readProperty[ 33] device,201 vendor-name", () -> { @@ -3876,9 +3870,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.VENDOR_NAME, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("Alerton Technologies, Inc.", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataVendorName) baCnetServiceAckReadProperty.getValues()).getVendorName(); + assertEquals("Alerton Technologies, Inc.", value.getValue()); }), DynamicTest.dynamicTest("No. 21 - Confirmed-REQ readProperty[ 34] device,201 vendor-identifier", () -> { @@ -3931,9 +3924,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.MODEL_NAME, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("LSi Controller", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataModelName) baCnetServiceAckReadProperty.getValues()).getModelName(); + assertEquals("LSi Controller", value.getValue()); }), DynamicTest.dynamicTest("No. 25 - Confirmed-REQ readProperty[ 36] device,201 model-name", () -> { @@ -3960,9 +3952,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.FIRMWARE_REVISION, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("BACtalk LSi v3.10 A ", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataFirmwareRevision) baCnetServiceAckReadProperty.getValues()).getFirmwareRevision(); + assertEquals("BACtalk LSi v3.10 A ", value.getValue()); }), DynamicTest.dynamicTest("No. 27 - Confirmed-REQ readProperty[ 37] device,201 application-software-version", () -> { @@ -3989,9 +3980,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.APPLICATION_SOFTWARE_VERSION, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("LSi Controller v3.11 E", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataApplicationSoftwareVersion) baCnetServiceAckReadProperty.getValues()).getApplicationSoftwareVersion(); + assertEquals("LSi Controller v3.11 E", value.getValue()); }), DynamicTest.dynamicTest("No. 29 - Confirmed-REQ readProperty[ 38] device,201 protocol-version", () -> { @@ -4018,9 +4008,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.PROTOCOL_VERSION, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(1, BACnetApplicationTagUnsignedInteger.getPayload().getActualValue().longValue()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataProtocolVersion) baCnetServiceAckReadProperty.getValues()).getProtocolVersion(); + assertEquals(1, value.getActualValue().longValue()); }), DynamicTest.dynamicTest("No. 31 - Confirmed-REQ readProperty[ 39] device,201 protocol-conformance-class", () -> { @@ -4076,9 +4065,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.PROTOCOL_SERVICES_SUPPORTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagBitString BACnetApplicationTagBitString = (BACnetApplicationTagBitString) value; - assertEquals(Arrays.asList(true, false, true, true, false, true, true, true, false, false, true, true, true, false, true, true, true, true, true, false, true, false, false, false, false, false, true, true, false, false, true, false, true, true, true), BACnetApplicationTagBitString.getPayload().getData()); + BACnetServicesSupportedTagged value = ((BACnetConstructedDataProtocolServicesSupported) baCnetServiceAckReadProperty.getValues()).getProtocolServicesSupported(); + assertEquals(Arrays.asList(true, false, true, true, false, true, true, true, false, false, true, true, true, false, true, true, true, true, true, false, true, false, false, false, false, false, true, true, false, false, true, false, true, true, true), value.getPayload().getData()); }), DynamicTest.dynamicTest("No. 35 - Confirmed-REQ readProperty[ 41] device,201 protocol-object-types-supported", () -> { @@ -4105,9 +4093,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.PROTOCOL_OBJECT_TYPES_SUPPORTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagBitString BACnetApplicationTagBitString = (BACnetApplicationTagBitString) value; - assertEquals(Arrays.asList(false, false, true, false, false, true, true, false, true, true, true, false, false, false, false, true, true, true), BACnetApplicationTagBitString.getPayload().getData()); + BACnetObjectTypesSupportedTagged value = ((BACnetConstructedDataProtocolObjectTypesSupported) baCnetServiceAckReadProperty.getValues()).getProtocolObjectTypesSupported(); + assertEquals(Arrays.asList(false, false, true, false, false, true, true, false, true, true, true, false, false, false, false, true, true, true), value.getPayload().getData()); }), DynamicTest.dynamicTest("No. 37 - Confirmed-REQ readProperty[ 42] device,201 max-apdu-length-accepted", () -> { @@ -4134,9 +4121,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.MAX_APDU_LENGTH_ACCEPTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(1476, BACnetApplicationTagUnsignedInteger.getPayload().getActualValue().longValue()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataMaxAPDULengthAccepted) baCnetServiceAckReadProperty.getValues()).getMaxApduLengthAccepted(); + assertEquals(1476, value.getActualValue().longValue()); }), DynamicTest.dynamicTest("No. 39 - Confirmed-REQ readProperty[ 43] device,201 segmentation-supported", () -> { @@ -4163,9 +4149,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.SEGMENTATION_SUPPORTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagEnumerated BACnetApplicationTagEnumerated = (BACnetApplicationTagEnumerated) value; - assertEquals(0, BACnetApplicationTagEnumerated.getActualValue()); + BACnetSegmentationTagged value = ((BACnetConstructedDataSegmentationSupported) baCnetServiceAckReadProperty.getValues()).getSegmentationSupported(); + assertEquals(BACnetSegmentation.SEGMENTED_BOTH, value.getValue()); }), DynamicTest.dynamicTest("No. 41 - Confirmed-REQ readProperty[ 44] device,201 local-time", () -> { @@ -4192,11 +4177,10 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.LOCAL_TIME, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagTime BACnetApplicationTagTime = (BACnetApplicationTagTime) value; - assertEquals(15, BACnetApplicationTagTime.getPayload().getHour()); - assertEquals(28, BACnetApplicationTagTime.getPayload().getMinute()); - assertEquals(41, BACnetApplicationTagTime.getPayload().getSecond()); + BACnetApplicationTagTime value = ((BACnetConstructedDataLocalTime) baCnetServiceAckReadProperty.getValues()).getLocalTime(); + assertEquals(15, value.getPayload().getHour()); + assertEquals(28, value.getPayload().getMinute()); + assertEquals(41, value.getPayload().getSecond()); }), DynamicTest.dynamicTest("No. 43 - Confirmed-REQ readProperty[ 45] device,201 local-date", () -> { @@ -4223,12 +4207,11 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.LOCAL_DATE, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagDate BACnetApplicationTagDate = (BACnetApplicationTagDate) value; - assertEquals(2005, BACnetApplicationTagDate.getPayload().getYear()); - assertEquals(9, BACnetApplicationTagDate.getPayload().getMonth()); - assertEquals(1, BACnetApplicationTagDate.getPayload().getDayOfMonth()); - assertEquals(4, BACnetApplicationTagDate.getPayload().getDayOfWeek()); + BACnetApplicationTagDate value = ((BACnetConstructedDataLocalDate) baCnetServiceAckReadProperty.getValues()).getLocalDate(); + assertEquals(2005, value.getPayload().getYear()); + assertEquals(9, value.getPayload().getMonth()); + assertEquals(1, value.getPayload().getDayOfMonth()); + assertEquals(4, value.getPayload().getDayOfWeek()); }), DynamicTest.dynamicTest("No. 45 - Confirmed-REQ readProperty[ 46] device,201 utc-offset", () -> { @@ -4255,9 +4238,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.UTC_OFFSET, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagSignedInteger BACnetApplicationTagSignedInteger = (BACnetApplicationTagSignedInteger) value; - assertEquals(0, BACnetApplicationTagSignedInteger.getPayload().getActualValue().longValue()); + BACnetApplicationTagSignedInteger value = ((BACnetConstructedDataUTCOffset) baCnetServiceAckReadProperty.getValues()).getUtcOffset(); + assertEquals(0, value.getPayload().getActualValue().longValue()); }), DynamicTest.dynamicTest("No. 47 - Confirmed-REQ readProperty[ 47] device,201 daylights-savings-status", () -> { @@ -4284,9 +4266,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.DAYLIGHT_SAVINGS_STATUS, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagBoolean BACnetApplicationTagBoolean = (BACnetApplicationTagBoolean) value; - assertFalse(BACnetApplicationTagBoolean.getActualValue()); + BACnetApplicationTagBoolean value = ((BACnetConstructedDataDaylightSavingsStatus) baCnetServiceAckReadProperty.getValues()).getDaylightSavingsStatus(); + assertFalse(value.getActualValue()); }), DynamicTest.dynamicTest("No. 49 - Confirmed-REQ readProperty[ 48] device,201 apdu-segment-timeout", () -> { @@ -4313,9 +4294,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.APDU_SEGMENT_TIMEOUT, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(6000, BACnetApplicationTagUnsignedInteger.getPayload().getValueUint16()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataAPDUSegmentTimeout) baCnetServiceAckReadProperty.getValues()).getApduSegmentTimeout(); + assertEquals(6000, value.getPayload().getValueUint16()); }), DynamicTest.dynamicTest("No. 51 - Confirmed-REQ readProperty[ 49] device,201 apdu-timeout", () -> { @@ -4342,9 +4322,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.APDU_TIMEOUT, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(6000, BACnetApplicationTagUnsignedInteger.getPayload().getValueUint16()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataAPDUTimeout) baCnetServiceAckReadProperty.getValues()).getApduTimeout(); + assertEquals(6000, value.getPayload().getValueUint16()); }), DynamicTest.dynamicTest("No. 53 - Confirmed-REQ readProperty[ 50] device,201 number-of-APDU-retries", () -> { @@ -4371,9 +4350,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(201, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.NUMBER_OF_APDU_RETRIES, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals((short) 3, BACnetApplicationTagUnsignedInteger.getPayload().getValueUint8()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataNumberOfAPDURetries) baCnetServiceAckReadProperty.getValues()).getNumberOfApduRetries(); + assertEquals((short) 3, value.getPayload().getValueUint8()); }), DynamicTest.dynamicTest("No. 55 - Confirmed-REQ readProperty[ 51] device,201 time-synchronization-recipients", () -> { @@ -4644,9 +4622,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.SYSTEM_STATUS, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagEnumerated baCnetApplicationTagEnumerated = (BACnetApplicationTagEnumerated) value; - assertEquals(0, baCnetApplicationTagEnumerated.getActualValue()); + BACnetDeviceStatusTagged value = ((BACnetConstructedDataSystemStatus) baCnetServiceAckReadProperty.getValues()).getSystemStatus(); + assertEquals(BACnetDeviceStatus.OPERATIONAL, value.getValue()); }), DynamicTest.dynamicTest("No. 75 - Confirmed-REQ readProperty[ 61] device,61 vendor-name", () -> { @@ -4673,9 +4650,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.VENDOR_NAME, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("Lithonia Lighting, Inc.", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataVendorName) baCnetServiceAckReadProperty.getValues()).getVendorName(); + assertEquals("Lithonia Lighting, Inc.", value.getValue()); }), DynamicTest.dynamicTest("No. 77 - Confirmed-REQ readProperty[ 62] device,61 vendor-identifier", () -> { @@ -4728,9 +4704,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.MODEL_NAME, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("SYSC MLX", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataModelName) baCnetServiceAckReadProperty.getValues()).getModelName(); + assertEquals("SYSC MLX", value.getValue()); }), DynamicTest.dynamicTest("No. 81 - Confirmed-REQ readProperty[ 64] device,61 model-name", () -> { @@ -4757,9 +4732,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.FIRMWARE_REVISION, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("2x62i", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataFirmwareRevision) baCnetServiceAckReadProperty.getValues()).getFirmwareRevision(); + assertEquals("2x62i", value.getValue()); }), DynamicTest.dynamicTest("No. 83 - Confirmed-REQ readProperty[ 65] device,61 application-software-version", () -> { @@ -4786,9 +4760,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.APPLICATION_SOFTWARE_VERSION, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagCharacterString BACnetApplicationTagCharacterString = (BACnetApplicationTagCharacterString) value; - assertEquals("10-Nov-2004", BACnetApplicationTagCharacterString.getValue()); + BACnetApplicationTagCharacterString value = ((BACnetConstructedDataApplicationSoftwareVersion) baCnetServiceAckReadProperty.getValues()).getApplicationSoftwareVersion(); + assertEquals("10-Nov-2004", value.getValue()); }), DynamicTest.dynamicTest("No. 85 - Confirmed-REQ readProperty[ 66] device,61 protocol-version", () -> { @@ -4815,9 +4788,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.PROTOCOL_VERSION, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(1, BACnetApplicationTagUnsignedInteger.getPayload().getActualValue().longValue()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataProtocolVersion) baCnetServiceAckReadProperty.getValues()).getProtocolVersion(); + assertEquals(1, value.getPayload().getActualValue().longValue()); }), DynamicTest.dynamicTest("No. 87 - Confirmed-REQ readProperty[ 67] device,61 protocol-conformance-class", () -> { @@ -4873,9 +4845,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.PROTOCOL_SERVICES_SUPPORTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagBitString BACnetApplicationTagBitString = (BACnetApplicationTagBitString) value; - assertEquals(Arrays.asList(false, false, false, false, false, false, true, true, false, false, false, false, true, false, true, true, false, true, false, false, true, false, false, false, false, false, true, true, false, false, false, false, true, true, true), BACnetApplicationTagBitString.getPayload().getData()); + BACnetServicesSupportedTagged value = ((BACnetConstructedDataProtocolServicesSupported) baCnetServiceAckReadProperty.getValues()).getProtocolServicesSupported(); + assertEquals(Arrays.asList(false, false, false, false, false, false, true, true, false, false, false, false, true, false, true, true, false, true, false, false, true, false, false, false, false, false, true, true, false, false, false, false, true, true, true), value.getPayload().getData()); }), DynamicTest.dynamicTest("No. 91 - Confirmed-REQ readProperty[ 69] device,61 protocol-object-types-supported", () -> { @@ -4902,9 +4873,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.PROTOCOL_OBJECT_TYPES_SUPPORTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagBitString BACnetApplicationTagBitString = (BACnetApplicationTagBitString) value; - assertEquals(Arrays.asList(true, true, true, true, true, true, false, false, true, false, true, false, false, false, false, false, false, false, false, false, false), BACnetApplicationTagBitString.getPayload().getData()); + BACnetObjectTypesSupportedTagged value = ((BACnetConstructedDataProtocolObjectTypesSupported) baCnetServiceAckReadProperty.getValues()).getProtocolObjectTypesSupported(); + assertEquals(Arrays.asList(true, true, true, true, true, true, false, false, true, false, true, false, false, false, false, false, false, false, false, false, false), value.getPayload().getData()); }), DynamicTest.dynamicTest("No. 93 - Confirmed-REQ readProperty[ 70] device,61 max-apdu-length-accepted", () -> { @@ -4931,9 +4901,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.MAX_APDU_LENGTH_ACCEPTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(480, BACnetApplicationTagUnsignedInteger.getPayload().getActualValue().longValue()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataMaxAPDULengthAccepted) baCnetServiceAckReadProperty.getValues()).getMaxApduLengthAccepted(); + assertEquals(480, value.getPayload().getActualValue().longValue()); }), DynamicTest.dynamicTest("No. 95 - Confirmed-REQ readProperty[ 71] device,61 segmentation-supported", () -> { @@ -4960,9 +4929,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.SEGMENTATION_SUPPORTED, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagEnumerated BACnetApplicationTagEnumerated = (BACnetApplicationTagEnumerated) value; - assertEquals(0, BACnetApplicationTagEnumerated.getActualValue()); + BACnetSegmentationTagged value = ((BACnetConstructedDataSegmentationSupported) baCnetServiceAckReadProperty.getValues()).getSegmentationSupported(); + assertEquals(BACnetSegmentation.SEGMENTED_BOTH, value.getValue()); }), DynamicTest.dynamicTest("No. 97 - Confirmed-REQ readProperty[ 72] device,61 local-time", () -> { @@ -4989,11 +4957,10 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.LOCAL_TIME, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagTime BACnetApplicationTagTime = (BACnetApplicationTagTime) value; - assertEquals(15, BACnetApplicationTagTime.getPayload().getHour()); - assertEquals(26, BACnetApplicationTagTime.getPayload().getMinute()); - assertEquals(40, BACnetApplicationTagTime.getPayload().getSecond()); + BACnetApplicationTagTime value = ((BACnetConstructedDataLocalTime) baCnetServiceAckReadProperty.getValues()).getLocalTime(); + assertEquals(15, value.getPayload().getHour()); + assertEquals(26, value.getPayload().getMinute()); + assertEquals(40, value.getPayload().getSecond()); }), DynamicTest.dynamicTest("No. 99 - Confirmed-REQ readProperty[ 73] device,61 local-date", () -> { @@ -5020,12 +4987,11 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.LOCAL_DATE, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagDate BACnetApplicationTagDate = (BACnetApplicationTagDate) value; - assertEquals(2005, BACnetApplicationTagDate.getPayload().getYear()); - assertEquals(9, BACnetApplicationTagDate.getPayload().getMonth()); - assertEquals(1, BACnetApplicationTagDate.getPayload().getDayOfMonth()); - assertEquals(255, BACnetApplicationTagDate.getPayload().getDayOfWeek()); + BACnetApplicationTagDate value = ((BACnetConstructedDataLocalDate) baCnetServiceAckReadProperty.getValues()).getLocalDate(); + assertEquals(2005, value.getPayload().getYear()); + assertEquals(9, value.getPayload().getMonth()); + assertEquals(1, value.getPayload().getDayOfMonth()); + assertEquals(255, value.getPayload().getDayOfWeek()); }), DynamicTest.dynamicTest("No. 101 - Confirmed-REQ readProperty[ 74] device,61 utc-offset", () -> { @@ -5052,9 +5018,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.UTC_OFFSET, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagSignedInteger BACnetApplicationTagSignedInteger = (BACnetApplicationTagSignedInteger) value; - assertEquals(BigInteger.valueOf(-300), BACnetApplicationTagSignedInteger.getPayload().getActualValue()); + BACnetApplicationTagSignedInteger value = ((BACnetConstructedDataUTCOffset) baCnetServiceAckReadProperty.getValues()).getUtcOffset(); + assertEquals(BigInteger.valueOf(-300), value.getPayload().getActualValue()); }), DynamicTest.dynamicTest("No. 103 - Confirmed-REQ readProperty[ 75] device,61 daylights-savings-status", () -> { @@ -5081,9 +5046,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.DAYLIGHT_SAVINGS_STATUS, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagBoolean BACnetApplicationTagBoolean = (BACnetApplicationTagBoolean) value; - assertTrue(BACnetApplicationTagBoolean.getPayload().getIsTrue()); + BACnetApplicationTagBoolean value = ((BACnetConstructedDataDaylightSavingsStatus) baCnetServiceAckReadProperty.getValues()).getDaylightSavingsStatus(); + assertTrue(value.getPayload().getIsTrue()); }), DynamicTest.dynamicTest("No. 105 - Confirmed-REQ readProperty[ 76] device,61 apdu-segment-timeout", () -> { @@ -5110,9 +5074,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.APDU_SEGMENT_TIMEOUT, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(8000, BACnetApplicationTagUnsignedInteger.getPayload().getValueUint16()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataAPDUSegmentTimeout) baCnetServiceAckReadProperty.getValues()).getApduSegmentTimeout(); + assertEquals(8000, value.getPayload().getValueUint16()); }), DynamicTest.dynamicTest("No. 107 - Confirmed-REQ readProperty[ 77] device,61 apdu-timeout", () -> { @@ -5139,9 +5102,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.APDU_TIMEOUT, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals(8000, BACnetApplicationTagUnsignedInteger.getPayload().getValueUint16()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataAPDUTimeout) baCnetServiceAckReadProperty.getValues()).getApduTimeout(); + assertEquals(8000, value.getPayload().getValueUint16()); }), DynamicTest.dynamicTest("No. 109 - Confirmed-REQ readProperty[ 78] device,61 number-of-APDU-retries", () -> { @@ -5168,9 +5130,8 @@ Collection read_properties() throws Exception { assertEquals(BACnetObjectType.DEVICE, baCnetServiceAckReadProperty.getObjectIdentifier().getObjectType()); assertEquals(61, baCnetServiceAckReadProperty.getObjectIdentifier().getInstanceNumber()); assertEquals(BACnetPropertyIdentifier.NUMBER_OF_APDU_RETRIES, baCnetServiceAckReadProperty.getPropertyIdentifier().getValue()); - BACnetApplicationTag value = ((BACnetConstructedDataUnspecified) baCnetServiceAckReadProperty.getValues()).getData().get(0).getApplicationTag(); - BACnetApplicationTagUnsignedInteger BACnetApplicationTagUnsignedInteger = (BACnetApplicationTagUnsignedInteger) value; - assertEquals((short) 3, BACnetApplicationTagUnsignedInteger.getPayload().getValueUint8()); + BACnetApplicationTagUnsignedInteger value = ((BACnetConstructedDataNumberOfAPDURetries) baCnetServiceAckReadProperty.getValues()).getNumberOfApduRetries(); + assertEquals((short) 3, value.getPayload().getValueUint8()); }), DynamicTest.dynamicTest("No. 111 - Confirmed-REQ readProperty[ 79] device,61 time-synchronization-recipients", () -> { @@ -5874,10 +5835,7 @@ Collection write_property() throws Exception { @DisplayName("write-property2") Collection write_property2() throws Exception { TestPcapEvaluator pcapEvaluator = pcapEvaluator("write-property2.cap"); - return List.of(pcapEvaluator.parseEmAll( - //skip(10), // TODO: skiped why? - //skip(14) // TODO: skiped why? - )); + return List.of(pcapEvaluator.parseEmAll()); } private static void dump(Serializable serializable) throws SerializationException { @@ -5924,7 +5882,7 @@ public DynamicContainer parseTill(int packageNumber, SkipInstruction... skipInst } public DynamicContainer parseRange(int startPackageNumber, int endPackageNumber, SkipInstruction... skipInstructions) { - Map skipInstructionMap = Arrays.stream(skipInstructions).collect(Collectors.toMap(SkipInstruction::getPackageNumber, v -> v)); + Map skipInstructionMap = Arrays.stream(skipInstructions).collect(Collectors.toMap(SkipInstruction::getPackageNumber, v -> v, (s1, s2) -> s1.skipType.ordinal() < s1.skipType.ordinal() ? s1 : s2)); Set numbersToSkip = Arrays.stream(skipInstructions).filter(SkipInstruction::shouldSkipAll).map(SkipInstruction::getPackageNumber).collect(Collectors.toSet()); // This means we requested to skip no test number boolean hasNoSkipping = numbersToSkip.size() <= 0; diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-bit-strings.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-bit-strings.mspec index 14f24da7467..1dc4be30f8b 100644 --- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-bit-strings.mspec +++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-bit-strings.mspec @@ -45,66 +45,66 @@ ] [enum uint 8 BACnetObjectTypesSupported - ['0' ANALOG_INPUT ] - ['1' ANALOG_OUTPUT ] - ['2' ANALOG_VALUE ] - ['3' BINARY_INPUT ] - ['4' BINARY_OUTPUT ] - ['5' BINARY_VALUE ] - ['6' CALENDAR ] - ['7' COMMAND ] - ['8' DEVICE ] - ['9' EVENT_ENROLLMENT ] - ['10' FILE ] - ['11' GROUP ] - ['12' LOOP ] - ['13' MULTI_STATE_INPUT ] - ['14' MULTI_STATE_OUTPUT ] - ['15' NOTIFICATION_CLASS ] - ['16' PROGRAM ] - ['17' SCHEDULE ] - ['18' AVERAGING ] - ['19' MULTI_STATE_VALUE ] - ['20' TREND_LOG ] - ['21' LIFE_SAFETY_POINT ] - ['22' LIFE_SAFETY_ZONE ] - ['23' ACCUMULATOR ] - ['24' PULSE_CONVERTER ] - ['25' EVENT_LOG ] - ['26' GLOBAL_GROUP ] - ['27' TREND_LOG_MULTIPLE ] - ['28' LOAD_CONTROL ] - ['29' STRUCTURED_VIEW ] - ['30' ACCESS_DOOR ] - ['31' TIMER ] - ['32' ACCESS_CREDENTIAL ] - ['33' ACCESS_POINT ] - ['34' ACCESS_RIGHTS ] - ['35' ACCESS_USER ] - ['36' ACCESS_ZONE ] - ['37' CREDENTIAL_DATA_INPUT ] - ['38' NETWORK_SECURITY ] - ['39' BITSTRING_VALUE ] - ['40' CHARACTERSTRING_VALUE ] - ['41' DATEPATTERN_VALUE ] - ['42' DATE_VALUE ] - ['43' DATETIMEPATTERN_VALUE ] - ['44' DATETIME_VALUE ] - ['45' INTEGER_VALUE ] - ['46' LARGE_ANALOG_VALUE ] - ['47' OCTETSTRING_VALUE ] - ['48' POSITIVE_INTEGER_VALUE ] - ['49' TIMEPATTERN_VALUE ] - ['50' TIME_VALUE ] - ['51' NOTIFICATION_FORWARDER ] - ['52' ALERT_ENROLLMENT ] - ['53' CHANNEL ] - ['54' LIGHTING_OUTPUT ] - ['55' BINARY_LIGHTING_OUTPUT ] - ['56' NETWORK_PORT ] - ['57' ELEVATOR_GROUP ] - ['58' ESCALATOR ] - ['59' LIFT ] + ['0' ANALOG_INPUT ] + ['1' ANALOG_OUTPUT ] + ['2' ANALOG_VALUE ] + ['3' BINARY_INPUT ] + ['4' BINARY_OUTPUT ] + ['5' BINARY_VALUE ] + ['6' CALENDAR ] + ['7' COMMAND ] + ['8' DEVICE ] + ['9' EVENT_ENROLLMENT ] + ['10' FILE ] + ['11' GROUP ] + ['12' LOOP ] + ['13' MULTI_STATE_INPUT ] + ['14' MULTI_STATE_OUTPUT ] + ['15' NOTIFICATION_CLASS ] + ['16' PROGRAM ] + ['17' SCHEDULE ] + ['18' AVERAGING ] + ['19' MULTI_STATE_VALUE ] + ['20' TREND_LOG ] + ['21' LIFE_SAFETY_POINT ] + ['22' LIFE_SAFETY_ZONE ] + ['23' ACCUMULATOR ] + ['24' PULSE_CONVERTER ] + ['25' EVENT_LOG ] + ['26' GLOBAL_GROUP ] + ['27' TREND_LOG_MULTIPLE ] + ['28' LOAD_CONTROL ] + ['29' STRUCTURED_VIEW ] + ['30' ACCESS_DOOR ] + ['31' TIMER ] + ['32' ACCESS_CREDENTIAL ] + ['33' ACCESS_POINT ] + ['34' ACCESS_RIGHTS ] + ['35' ACCESS_USER ] + ['36' ACCESS_ZONE ] + ['37' CREDENTIAL_DATA_INPUT ] + ['38' NETWORK_SECURITY ] + ['39' BITSTRING_VALUE ] + ['40' CHARACTERSTRING_VALUE ] + ['41' DATEPATTERN_VALUE ] + ['42' DATE_VALUE ] + ['43' DATETIMEPATTERN_VALUE ] + ['44' DATETIME_VALUE ] + ['45' INTEGER_VALUE ] + ['46' LARGE_ANALOG_VALUE ] + ['47' OCTETSTRING_VALUE ] + ['48' POSITIVE_INTEGER_VALUE ] + ['49' TIMEPATTERN_VALUE ] + ['50' TIME_VALUE ] + ['51' NOTIFICATION_FORWARDER ] + ['52' ALERT_ENROLLMENT ] + ['53' CHANNEL ] + ['54' LIGHTING_OUTPUT ] + ['55' BINARY_LIGHTING_OUTPUT ] + ['56' NETWORK_PORT ] + ['57' ELEVATOR_GROUP ] + ['58' ESCALATOR ] + ['59' LIFT ] ] [enum uint 8 BACnetResultFlags diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-enums.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-enums.mspec index 4d552a2ee13..abcef73965a 100644 --- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-enums.mspec +++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnet-enums.mspec @@ -405,12 +405,12 @@ [enum uint 32 BACnetEngineeringUnits // Acceleration ['166' METERS_PER_SECOND_PER_SECOND ] -//Area +//Area ['0' SQUARE_METERS ] ['116' SQUARE_CENTIMETERS ] ['1' SQUARE_FEET ] ['115' SQUARE_INCHES ] -//Currency +//Currency ['105' CURRENCY1 ] ['106' CURRENCY2 ] ['107' CURRENCY3 ] @@ -422,8 +422,8 @@ ['113' CURRENCY9 ] ['114' CURRENCY10 ] //Electrical - ['2' MILLIAMPERES ] - ['3' AMPERES ] + ['2' MILLIAMPERES ] + ['3' AMPERES ] ['167' AMPERES_PER_METER ] ['168' AMPERES_PER_SQUARE_METER ] ['169' AMPERE_SQUARE_METERS ] @@ -432,8 +432,8 @@ ['201' DECIBELS_VOLT ] ['170' FARADS ] ['171' HENRYS ] - ['4' OHMS ] - ['237' OHM_METER_SQUARED_PER_METER ] + ['4' OHMS ] + ['237' OHM_METER_SQUARED_PER_METER ] ['172' OHM_METERS ] ['145' MILLIOHMS ] ['122' KILOHMS ] @@ -443,22 +443,22 @@ ['173' SIEMENS ] ['174' SIEMENS_PER_METER ] ['175' TESLAS ] - ['5' VOLTS ] + ['5' VOLTS ] ['124' MILLIVOLTS ] - ['6' KILOVOLTS ] - ['7' MEGAVOLTS ] - ['8' VOLT_AMPERES ] - ['9' KILOVOLT_AMPERES ] - ['10' MEGAVOLT_AMPERES ] - ['11' VOLT_AMPERES_REACTIVE ] - ['12' KILOVOLT_AMPERES_REACTIVE ] - ['13' MEGAVOLT_AMPERES_REACTIVE ] + ['6' KILOVOLTS ] + ['7' MEGAVOLTS ] + ['8' VOLT_AMPERES ] + ['9' KILOVOLT_AMPERES ] + ['10' MEGAVOLT_AMPERES ] + ['11' VOLT_AMPERES_REACTIVE ] + ['12' KILOVOLT_AMPERES_REACTIVE ] + ['13' MEGAVOLT_AMPERES_REACTIVE ] ['176' VOLTS_PER_DEGREE_KELVIN ] ['177' VOLTS_PER_METER ] - ['14' DEGREES_PHASE ] - ['15' POWER_FACTOR ] + ['14' DEGREES_PHASE ] + ['15' POWER_FACTOR ] ['178' WEBERS ] -//Energy +//Energy ['238' AMPERE_SECONDS ] ['239' VOLT_AMPERE_HOURS ] // i.e. VAh ['240' KILOVOLT_AMPERE_HOURS ] @@ -468,31 +468,31 @@ ['244' MEGAVOLT_AMPERE_HOURS_REACTIVE ] ['245' VOLT_SQUARE_HOURS ] ['246' AMPERE_SQUARE_HOURS ] - ['16' JOULES ] - ['17' KILOJOULES ] + ['16' JOULES ] + ['17' KILOJOULES ] ['125' KILOJOULES_PER_KILOGRAM ] ['126' MEGAJOULES ] - ['18' WATT_HOURS ] - ['19' KILOWATT_HOURS ] + ['18' WATT_HOURS ] + ['19' KILOWATT_HOURS ] ['146' MEGAWATT_HOURS ] ['203' WATT_HOURS_REACTIVE ] ['204' KILOWATT_HOURS_REACTIVE ] ['205' MEGAWATT_HOURS_REACTIVE ] - ['20' BTUS ] + ['20' BTUS ] ['147' KILO_BTUS ] ['148' MEGA_BTUS ] - ['21' THERMS ] - ['22' TON_HOURS ] -//Enthalpy + ['21' THERMS ] + ['22' TON_HOURS ] +//Enthalpy ['23' JOULES_PER_KILOGRAM_DRY_AIR ] ['149' KILOJOULES_PER_KILOGRAM_DRY_AIR ] ['150' MEGAJOULES_PER_KILOGRAM_DRY_AIR ] ['24' BTUS_PER_POUND_DRY_AIR ] ['117' BTUS_PER_POUND ] -//Humidity +//Humidity ['28' GRAMS_OF_WATER_PER_KILOGRAM_DRY_AIR ] ['29' PERCENT_RELATIVE_HUMIDITY ] -//Length +//Length ['194' MICROMETERS ] ['30' MILLIMETERS ] ['118' CENTIMETERS ] @@ -500,7 +500,7 @@ ['31' METERS ] ['32' INCHES ] ['33' FEET ] -//Light +//Light ['179' CANDELAS ] ['180' CANDELAS_PER_SQUARE_METER ] ['34' WATTS_PER_SQUARE_FOOT ] @@ -508,7 +508,7 @@ ['36' LUMENS ] ['37' LUXES ] ['38' FOOT_CANDLES ] -//Mass +//Mass ['196' MILLIGRAMS ] ['195' GRAMS ] ['39' KILOGRAMS ] @@ -533,7 +533,7 @@ ['247' JOULE_PER_HOURS ] ['51' HORSEPOWER ] ['52' TONS_REFRIGERATION ] -//Pressure +//Pressure ['53' PASCALS ] ['133' HECTOPASCALS ] ['54' KILOPASCALS ] @@ -556,7 +556,7 @@ ['66' DEGREE_DAYS_FAHRENHEIT ] ['120' DELTA_DEGREES_FAHRENHEIT ] ['121' DELTA_DEGREES_KELVIN ] -//Time +//Time ['67' YEARS ] ['68' MONTHS ] ['69' WEEKS ] @@ -566,9 +566,9 @@ ['73' SECONDS ] ['158' HUNDREDTHS_SECONDS ] ['159' MILLISECONDS ] -//Torque +//Torque ['160' NEWTON_METERS ] -//Velocity +//Velocity ['161' MILLIMETERS_PER_SECOND ] ['162' MILLIMETERS_PER_MINUTE ] ['74' METERS_PER_SECOND ] @@ -579,115 +579,115 @@ ['77' FEET_PER_MINUTE ] ['78' MILES_PER_HOUR ] //Volume - ['79' CUBIC_FEET ] - ['80' CUBIC_METERS ] - ['81' IMPERIAL_GALLONS ] - ['197' MILLILITERS ] - ['82' LITERS ] - ['83' US_GALLONS ] + ['79' CUBIC_FEET ] + ['80' CUBIC_METERS ] + ['81' IMPERIAL_GALLONS ] + ['197' MILLILITERS ] + ['82' LITERS ] + ['83' US_GALLONS ] //Volumetric FLOW - ['142' CUBIC_FEET_PER_SECOND ] - ['84' CUBIC_FEET_PER_MINUTE ] - ['254' MILLION_STANDARD_CUBIC_FEET_PER_MINUTE ] - ['191' CUBIC_FEET_PER_HOUR ] - ['248' CUBIC_FEET_PER_DAY ] + ['142' CUBIC_FEET_PER_SECOND ] + ['84' CUBIC_FEET_PER_MINUTE ] + ['254' MILLION_STANDARD_CUBIC_FEET_PER_MINUTE ] + ['191' CUBIC_FEET_PER_HOUR ] + ['248' CUBIC_FEET_PER_DAY ] ['47808' STANDARD_CUBIC_FEET_PER_DAY ] ['47809' MILLION_STANDARD_CUBIC_FEET_PER_DAY ] ['47810' THOUSAND_CUBIC_FEET_PER_DAY ] ['47811' THOUSAND_STANDARD_CUBIC_FEET_PER_DAY ] ['47812' POUNDS_MASS_PER_DAY ] - ['85' CUBIC_METERS_PER_SECOND ] - ['165' CUBIC_METERS_PER_MINUTE ] - ['135' CUBIC_METERS_PER_HOUR ] - ['249' CUBIC_METERS_PER_DAY ] - ['86' IMPERIAL_GALLONS_PER_MINUTE ] - ['198' MILLILITERS_PER_SECOND ] - ['87' LITERS_PER_SECOND ] - ['88' LITERS_PER_MINUTE ] - ['136' LITERS_PER_HOUR ] - ['89' US_GALLONS_PER_MINUTE ] - ['192' US_GALLONS_PER_HOUR ] + ['85' CUBIC_METERS_PER_SECOND ] + ['165' CUBIC_METERS_PER_MINUTE ] + ['135' CUBIC_METERS_PER_HOUR ] + ['249' CUBIC_METERS_PER_DAY ] + ['86' IMPERIAL_GALLONS_PER_MINUTE ] + ['198' MILLILITERS_PER_SECOND ] + ['87' LITERS_PER_SECOND ] + ['88' LITERS_PER_MINUTE ] + ['136' LITERS_PER_HOUR ] + ['89' US_GALLONS_PER_MINUTE ] + ['192' US_GALLONS_PER_HOUR ] //Other - ['90' DEGREES_ANGULAR ] - ['91' DEGREES_CELSIUS_PER_HOUR ] - ['92' DEGREES_CELSIUS_PER_MINUTE ] - ['93' DEGREES_FAHRENHEIT_PER_HOUR ] - ['94' DEGREES_FAHRENHEIT_PER_MINUTE ] - ['183' JOULE_SECONDS ] - ['186' KILOGRAMS_PER_CUBIC_METER ] - ['137' KILOWATT_HOURS_PER_SQUARE_METER ] - ['138' KILOWATT_HOURS_PER_SQUARE_FOOT ] - ['250' WATT_HOURS_PER_CUBIC_METER ] - ['251' JOULES_PER_CUBIC_METER ] - ['139' MEGAJOULES_PER_SQUARE_METER ] - ['140' MEGAJOULES_PER_SQUARE_FOOT ] - ['252' MOLE_PERCENT ] - ['95' NO_UNITS ] - ['187' NEWTON_SECONDS ] - ['188' NEWTONS_PER_METER ] - ['96' PARTS_PER_MILLION ] - ['97' PARTS_PER_BILLION ] - ['253' PASCAL_SECONDS ] - ['98' PERCENT ] - ['143' PERCENT_OBSCURATION_PER_FOOT ] - ['144' PERCENT_OBSCURATION_PER_METER ] - ['99' PERCENT_PER_SECOND ] - ['100' PER_MINUTE ] - ['101' PER_SECOND ] - ['102' PSI_PER_DEGREE_FAHRENHEIT ] - ['103' RADIANS ] - ['184' RADIANS_PER_SECOND ] - ['104' REVOLUTIONS_PER_MINUTE ] - ['185' SQUARE_METERS_PER_NEWTON ] - ['189' WATTS_PER_METER_PER_DEGREE_KELVIN ] - ['141' WATTS_PER_SQUARE_METER_DEGREE_KELVIN ] - ['207' PER_MILLE ] - ['208' GRAMS_PER_GRAM ] - ['209' KILOGRAMS_PER_KILOGRAM ] - ['210' GRAMS_PER_KILOGRAM ] - ['211' MILLIGRAMS_PER_GRAM ] - ['212' MILLIGRAMS_PER_KILOGRAM ] - ['213' GRAMS_PER_MILLILITER ] - ['214' GRAMS_PER_LITER ] - ['215' MILLIGRAMS_PER_LITER ] - ['216' MICROGRAMS_PER_LITER ] - ['217' GRAMS_PER_CUBIC_METER ] - ['218' MILLIGRAMS_PER_CUBIC_METER ] - ['219' MICROGRAMS_PER_CUBIC_METER ] - ['220' NANOGRAMS_PER_CUBIC_METER ] - ['221' GRAMS_PER_CUBIC_CENTIMETER ] - ['222' BECQUERELS ] - ['223' KILOBECQUERELS ] - ['224' MEGABECQUERELS ] - ['225' GRAY ] - ['226' MILLIGRAY ] - ['227' MICROGRAY ] - ['228' SIEVERTS ] - ['229' MILLISIEVERTS ] - ['230' MICROSIEVERTS ] - ['231' MICROSIEVERTS_PER_HOUR ] + ['90' DEGREES_ANGULAR ] + ['91' DEGREES_CELSIUS_PER_HOUR ] + ['92' DEGREES_CELSIUS_PER_MINUTE ] + ['93' DEGREES_FAHRENHEIT_PER_HOUR ] + ['94' DEGREES_FAHRENHEIT_PER_MINUTE ] + ['183' JOULE_SECONDS ] + ['186' KILOGRAMS_PER_CUBIC_METER ] + ['137' KILOWATT_HOURS_PER_SQUARE_METER ] + ['138' KILOWATT_HOURS_PER_SQUARE_FOOT ] + ['250' WATT_HOURS_PER_CUBIC_METER ] + ['251' JOULES_PER_CUBIC_METER ] + ['139' MEGAJOULES_PER_SQUARE_METER ] + ['140' MEGAJOULES_PER_SQUARE_FOOT ] + ['252' MOLE_PERCENT ] + ['95' NO_UNITS ] + ['187' NEWTON_SECONDS ] + ['188' NEWTONS_PER_METER ] + ['96' PARTS_PER_MILLION ] + ['97' PARTS_PER_BILLION ] + ['253' PASCAL_SECONDS ] + ['98' PERCENT ] + ['143' PERCENT_OBSCURATION_PER_FOOT ] + ['144' PERCENT_OBSCURATION_PER_METER ] + ['99' PERCENT_PER_SECOND ] + ['100' PER_MINUTE ] + ['101' PER_SECOND ] + ['102' PSI_PER_DEGREE_FAHRENHEIT ] + ['103' RADIANS ] + ['184' RADIANS_PER_SECOND ] + ['104' REVOLUTIONS_PER_MINUTE ] + ['185' SQUARE_METERS_PER_NEWTON ] + ['189' WATTS_PER_METER_PER_DEGREE_KELVIN ] + ['141' WATTS_PER_SQUARE_METER_DEGREE_KELVIN ] + ['207' PER_MILLE ] + ['208' GRAMS_PER_GRAM ] + ['209' KILOGRAMS_PER_KILOGRAM ] + ['210' GRAMS_PER_KILOGRAM ] + ['211' MILLIGRAMS_PER_GRAM ] + ['212' MILLIGRAMS_PER_KILOGRAM ] + ['213' GRAMS_PER_MILLILITER ] + ['214' GRAMS_PER_LITER ] + ['215' MILLIGRAMS_PER_LITER ] + ['216' MICROGRAMS_PER_LITER ] + ['217' GRAMS_PER_CUBIC_METER ] + ['218' MILLIGRAMS_PER_CUBIC_METER ] + ['219' MICROGRAMS_PER_CUBIC_METER ] + ['220' NANOGRAMS_PER_CUBIC_METER ] + ['221' GRAMS_PER_CUBIC_CENTIMETER ] + ['222' BECQUERELS ] + ['223' KILOBECQUERELS ] + ['224' MEGABECQUERELS ] + ['225' GRAY ] + ['226' MILLIGRAY ] + ['227' MICROGRAY ] + ['228' SIEVERTS ] + ['229' MILLISIEVERTS ] + ['230' MICROSIEVERTS ] + ['231' MICROSIEVERTS_PER_HOUR ] ['47814' MILLIREMS ] ['47815' MILLIREMS_PER_HOUR ] - ['232' DECIBELS_A ] - ['233' NEPHELOMETRIC_TURBIDITY_UNIT ] - ['234' P_H ] - ['235' GRAMS_PER_SQUARE_METER ] - ['236' MINUTES_PER_DEGREE_KELVIN ] + ['232' DECIBELS_A ] + ['233' NEPHELOMETRIC_TURBIDITY_UNIT ] + ['234' P_H ] + ['235' GRAMS_PER_SQUARE_METER ] + ['236' MINUTES_PER_DEGREE_KELVIN ] // plc4x definition ['0XFF' VENDOR_PROPRIETARY_VALUE ] ] // Attention: 0-1023 ASHRAE. 1024-65535 proprietary [enum uint 16 BACnetEscalatorFault - ['0' CONTROLLER_FAULT ] - ['1' DRIVE_AND_MOTOR_FAULT ] - ['2' MECHANICAL_COMPONENT_FAULT ] - ['3' OVERSPEED_FAULT ] - ['4' POWER_SUPPLY_FAULT ] - ['5' SAFETY_DEVICE_FAULT ] - ['6' CONTROLLER_SUPPLY_FAULT ] - ['7' DRIVE_TEMPERATURE_EXCEEDED ] - ['8' COMB_PLATE_FAULT ] + ['0' CONTROLLER_FAULT ] + ['1' DRIVE_AND_MOTOR_FAULT ] + ['2' MECHANICAL_COMPONENT_FAULT ] + ['3' OVERSPEED_FAULT ] + ['4' POWER_SUPPLY_FAULT ] + ['5' SAFETY_DEVICE_FAULT ] + ['6' CONTROLLER_SUPPLY_FAULT ] + ['7' DRIVE_TEMPERATURE_EXCEEDED ] + ['8' COMB_PLATE_FAULT ] // plc4x definition ['0XFFFF' VENDOR_PROPRIETARY_VALUE ] @@ -695,12 +695,12 @@ // Attention: 0-1023 ASHRAE. 1024-65535 proprietary [enum uint 16 BACnetEscalatorMode - ['0' UNKNOWN ] - ['1' STOP ] - ['2' UP ] - ['3' DOWN ] - ['4' INSPECTION ] - ['5' OUT_OF_SERVICE ] + ['0' UNKNOWN ] + ['1' STOP ] + ['2' UP ] + ['3' DOWN ] + ['4' INSPECTION ] + ['5' OUT_OF_SERVICE ] // plc4x definition ['0XFFFF' VENDOR_PROPRIETARY_VALUE ] @@ -708,12 +708,12 @@ // Attention: 0-1023 ASHRAE. 1024-65535 proprietary [enum uint 16 BACnetEscalatorOperationDirection - ['0' UNKNOWN ] - ['1' STOPPED ] - ['2' UP_RATED_SPEED ] - ['3' UP_REDUCED_SPEED ] - ['4' DOWN_RATED_SPEED ] - ['5' DOWN_REDUCED_SPEED ] + ['0' UNKNOWN ] + ['1' STOPPED ] + ['2' UP_RATED_SPEED ] + ['3' UP_REDUCED_SPEED ] + ['4' DOWN_RATED_SPEED ] + ['5' DOWN_REDUCED_SPEED ] // plc4x definition ['0XFFFF' VENDOR_PROPRIETARY_VALUE ] @@ -783,16 +783,16 @@ // Attention: 0-63 ASHRAE. 64-65535 proprietary [enum uint 16 BACnetLifeSafetyOperation - ['0' NONE ] - ['1' SILENCE ] - ['2' SILENCE_AUDIBLE ] - ['3' SILENCE_VISUAL ] - ['4' RESET ] - ['5' RESET_ALARM ] - ['6' RESET_FAULT ] - ['7' UNSILENCE ] - ['8' UNSILENCE_AUDIBLE ] - ['9' UNSILENCE_VISUAL ] + ['0' NONE ] + ['1' SILENCE ] + ['2' SILENCE_AUDIBLE ] + ['3' SILENCE_VISUAL ] + ['4' RESET ] + ['5' RESET_ALARM ] + ['6' RESET_FAULT ] + ['7' UNSILENCE ] + ['8' UNSILENCE_AUDIBLE ] + ['9' UNSILENCE_VISUAL ] // plc4x definition ['0XFFFF' VENDOR_PROPRIETARY_VALUE ] diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec index cc38843b123..1b869c90540 100644 --- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec +++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec @@ -2284,8 +2284,8 @@ [type BACnetAddressEnclosed(uint 8 tagNumber) [simple BACnetOpeningTag('tagNumber') openingTag ] - [simple BACnetRecipient - recipient ] + [simple BACnetAddress + address ] [simple BACnetClosingTag('tagNumber') closingTag ] ] @@ -2364,10 +2364,25 @@ [*, 'ACTIVE_AUTHENTICATION_POLICY' BACnetConstructedDataActiveAuthenticationPolicy [simple BACnetApplicationTagUnsignedInteger activeAuthenticationPolicy ] ] - //[*, '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"]] + [*, 'ACTIVE_COV_MULTIPLE_SUBSCRIPTIONS' BACnetConstructedDataActiveCOVMultipleSubscriptions + [array BACnetCOVMultipleSubscription + activeCOVMultipleSubscriptions + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] + [*, 'ACTIVE_COV_SUBSCRIPTIONS' BACnetConstructedDataActiveCOVSubscriptions + [array BACnetCOVSubscription + activeCOVSubscriptions + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] //[*, 'ACTIVE_TEXT' BACnetConstructedDataActiveText [validation '1 == 2' "TODO: implement me ACTIVE_TEXT BACnetConstructedDataActiveText"]] - //[*, 'ACTIVE_VT_SESSIONS' BACnetConstructedDataActiveVTSessions [validation '1 == 2' "TODO: implement me ACTIVE_VT_SESSIONS BACnetConstructedDataActiveVTSessions"]] + [*, 'ACTIVE_VT_SESSIONS' BACnetConstructedDataActiveVTSessions + [array BACnetVTSession + activeVTSession + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] [*, 'ACTUAL_SHED_LEVEL' BACnetConstructedDataActualShedLevel [simple BACnetShedLevel actualShedLevel ] ] @@ -2572,9 +2587,15 @@ [*, 'APDU_LENGTH' BACnetConstructedDataAPDULength [simple BACnetApplicationTagUnsignedInteger apduLength ] ] - //[*, 'APDU_SEGMENT_TIMEOUT' BACnetConstructedDataApduSegmentTimeout [validation '1 == 2' "TODO: implement me APDU_SEGMENT_TIMEOUT BACnetConstructedDataApduSegmentTimeout"]] - //[*, '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"]] + [*, 'APDU_SEGMENT_TIMEOUT' BACnetConstructedDataAPDUSegmentTimeout + [simple BACnetApplicationTagUnsignedInteger apduSegmentTimeout ] + ] + [*, 'APDU_TIMEOUT' BACnetConstructedDataAPDUTimeout + [simple BACnetApplicationTagUnsignedInteger apduTimeout ] + ] + [*, 'APPLICATION_SOFTWARE_VERSION' BACnetConstructedDataApplicationSoftwareVersion + [simple BACnetApplicationTagCharacterString applicationSoftwareVersion ] + ] [*, 'ARCHIVE' BACnetConstructedDataArchive [simple BACnetApplicationTagBoolean archive ] ] @@ -2625,9 +2646,15 @@ [simple BACnetApplicationTagBoolean autoSlaveDiscovery ] ] //[*, 'AVERAGE_VALUE' BACnetConstructedDataAverageValue [validation '1 == 2' "TODO: implement me AVERAGE_VALUE BACnetConstructedDataAverageValue"]] - //[*, 'BACKUP_AND_RESTORE_STATE' BACnetConstructedDataBackupAndRestoreState [validation '1 == 2' "TODO: implement me BACKUP_AND_RESTORE_STATE BACnetConstructedDataBackupAndRestoreState"]] - //[*, 'BACKUP_FAILURE_TIMEOUT' BACnetConstructedDataBackupFailureTimeout [validation '1 == 2' "TODO: implement me BACKUP_FAILURE_TIMEOUT BACnetConstructedDataBackupFailureTimeout"]] - //[*, 'BACKUP_PREPARATION_TIME' BACnetConstructedDataBackupPreparationTime [validation '1 == 2' "TODO: implement me BACKUP_PREPARATION_TIME BACnetConstructedDataBackupPreparationTime"]] + [*, 'BACKUP_AND_RESTORE_STATE' BACnetConstructedDataBackupAndRestoreState + [simple BACnetBackupStateTagged('0', 'TagClass.APPLICATION_TAGS') backupAndRestoreState ] + ] + [*, 'BACKUP_FAILURE_TIMEOUT' BACnetConstructedDataBackupFailureTimeout + [simple BACnetApplicationTagUnsignedInteger backupFailureTimeout ] + ] + [*, 'BACKUP_PREPARATION_TIME' BACnetConstructedDataBackupPreparationTime + [simple BACnetApplicationTagUnsignedInteger backupPreparationTime ] + ] [*, 'BACNET_IP_GLOBAL_ADDRESS' BACnetConstructedDataBACnetIPGlobalAddress [simple BACnetHostNPort bacnetIpGlobalAddress ] ] @@ -2740,7 +2767,12 @@ [simple BACnetNetworkPortCommandTagged('0', 'TagClass.APPLICATION_TAGS') command ] ] //[*, 'COMMAND_TIME_ARRAY' BACnetConstructedDataCommandTimeArray [validation '1 == 2' "TODO: implement me COMMAND_TIME_ARRAY BACnetConstructedDataCommandTimeArray"]] - //[*, 'CONFIGURATION_FILES' BACnetConstructedDataConfigurationFiles [validation '1 == 2' "TODO: implement me CONFIGURATION_FILES BACnetConstructedDataConfigurationFiles"]] + [*, 'CONFIGURATION_FILES' BACnetConstructedDataConfigurationFiles + [array BACnetApplicationTagObjectIdentifier + configurationFiles + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] + ] //[*, 'CONTROL_GROUPS' BACnetConstructedDataControlGroups [validation '1 == 2' "TODO: implement me CONTROL_GROUPS BACnetConstructedDataControlGroups"]] [*, 'CONTROLLED_VARIABLE_REFERENCE' BACnetConstructedDataControlledVariableReference [simple BACnetObjectPropertyReference controlledVariableReference ] @@ -2790,9 +2822,13 @@ ] //[*, '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"]] + [*, 'DATABASE_REVISION' BACnetConstructedDataDatabaseRevision + [simple BACnetApplicationTagUnsignedInteger databaseRevision ] + ] //[*, '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"]] + [*, 'DAYLIGHT_SAVINGS_STATUS' BACnetConstructedDataDaylightSavingsStatus + [simple BACnetApplicationTagBoolean daylightSavingsStatus ] + ] [*, 'DAYS_REMAINING' BACnetConstructedDataDaysRemaining [simple BACnetApplicationTagSignedInteger daysRemaining ] ] @@ -2800,7 +2836,7 @@ [simple BACnetApplicationTagReal deadband ] ] [*, 'DEFAULT_FADE_TIME' BACnetConstructedDataDefaultFadeTime - [simple BACnetApplicationTagUnsignedInteger defaultFadeTime ] + [simple BACnetApplicationTagUnsignedInteger defaultFadeTime ] ] [*, 'DEFAULT_RAMP_RATE' BACnetConstructedDataDefaultRampRate [simple BACnetApplicationTagReal defaultRampRate ] @@ -2814,7 +2850,9 @@ [*, 'DEFAULT_TIMEOUT' BACnetConstructedDataDefaultTimeout [simple BACnetApplicationTagUnsignedInteger defaultTimeout ] ] - //[*, 'DEPLOYED_PROFILE_LOCATION' BACnetConstructedDataDeployedProfileLocation [validation '1 == 2' "TODO: implement me DEPLOYED_PROFILE_LOCATION BACnetConstructedDataDeployedProfileLocation"]] + [*, 'DEPLOYED_PROFILE_LOCATION' BACnetConstructedDataDeployedProfileLocation + [simple BACnetApplicationTagCharacterString deployedProfileLocation ] + ] [*, 'DERIVATIVE_CONSTANT' BACnetConstructedDataDerivativeConstant [simple BACnetApplicationTagReal derivativeConstant ] ] @@ -2827,7 +2865,12 @@ [*, 'DESCRIPTION_OF_HALT' BACnetConstructedDataDescriptionOfHalt [simple BACnetApplicationTagCharacterString descriptionForHalt ] ] - //[*, 'DEVICE_ADDRESS_BINDING' BACnetConstructedDataDeviceAddressBinding [validation '1 == 2' "TODO: implement me DEVICE_ADDRESS_BINDING BACnetConstructedDataDeviceAddressBinding"]] + [*, 'DEVICE_ADDRESS_BINDING' BACnetConstructedDataDeviceAddressBinding + [array BACnetAddressBinding + deviceAddressBinding + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] [*, 'DEVICE_TYPE' BACnetConstructedDataDeviceType [simple BACnetApplicationTagCharacterString deviceType ] ] @@ -2979,7 +3022,9 @@ [*, 'FILE_TYPE' BACnetConstructedDataFileType [simple BACnetApplicationTagCharacterString fileType ] ] - //[*, 'FIRMWARE_REVISION' BACnetConstructedDataFirmwareRevision [validation '1 == 2' "TODO: implement me FIRMWARE_REVISION BACnetConstructedDataFirmwareRevision"]] + [*, 'FIRMWARE_REVISION' BACnetConstructedDataFirmwareRevision + [simple BACnetApplicationTagCharacterString firmwareRevision ] + ] [*, 'FLOOR_TEXT' BACnetConstructedDataFloorText [array BACnetApplicationTagCharacterString floorText @@ -3135,8 +3180,12 @@ ] //[*, 'LAST_NOTIFY_RECORD' BACnetConstructedDataLastNotifyRecord [validation '1 == 2' "TODO: implement me LAST_NOTIFY_RECORD BACnetConstructedDataLastNotifyRecord"]] //[*, 'LAST_PRIORITY' BACnetConstructedDataLastPriority [validation '1 == 2' "TODO: implement me LAST_PRIORITY BACnetConstructedDataLastPriority"]] - //[*, '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_RESTART_REASON' BACnetConstructedDataLastRestartReason + [simple BACnetRestartReasonTagged('0', 'TagClass.APPLICATION_TAGS') lastRestartReason ] + ] + [*, 'LAST_RESTORE_TIME' BACnetConstructedDataLastRestoreTime + [simple BACnetTimeStamp lastRestoreTime ] + ] [*, 'LAST_STATE_CHANGE' BACnetConstructedDataLastStateChange [simple BACnetTimerTransitionTagged('0', 'TagClass.APPLICATION_TAGS') lastStateChange ] ] @@ -3181,12 +3230,18 @@ references terminated 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] ] - //[*, 'LOCAL_DATE' BACnetConstructedDataLocalDate [validation '1 == 2' "TODO: implement me LOCAL_DATE BACnetConstructedDataLocalDate"]] + [*, 'LOCAL_DATE' BACnetConstructedDataLocalDate + [simple BACnetApplicationTagDate localDate ] + ] [*, 'LOCAL_FORWARDING_ONLY' BACnetConstructedDataLocalForwardingOnly [simple BACnetApplicationTagBoolean localForwardingOnly ] ] - //[*, 'LOCAL_TIME' BACnetConstructedDataLocalTime [validation '1 == 2' "TODO: implement me LOCAL_TIME BACnetConstructedDataLocalTime"]] - //[*, 'LOCATION' BACnetConstructedDataLocation [validation '1 == 2' "TODO: implement me LOCATION BACnetConstructedDataLocation"]] + [*, 'LOCAL_TIME' BACnetConstructedDataLocalTime + [simple BACnetApplicationTagTime localTime ] + ] + [*, 'LOCATION' BACnetConstructedDataLocation + [simple BACnetApplicationTagCharacterString location ] + ] [*, 'LOCK_STATUS' BACnetConstructedDataLockStatus [simple BACnetLockStatusTagged('0', 'TagClass.APPLICATION_TAGS') lockStatus ] ] @@ -3245,19 +3300,23 @@ [*, 'MAX_ACTUAL_VALUE' BACnetConstructedDataMaxActualValue [simple BACnetApplicationTagReal maxActualValue ] ] - //[*, 'MAX_APDU_LENGTH_ACCEPTED' BACnetConstructedDataMaxApduLengthAccepted [validation '1 == 2' "TODO: implement me MAX_APDU_LENGTH_ACCEPTED BACnetConstructedDataMaxApduLengthAccepted"]] + [*, 'MAX_APDU_LENGTH_ACCEPTED' BACnetConstructedDataMaxAPDULengthAccepted + [simple BACnetApplicationTagUnsignedInteger maxApduLengthAccepted ] + ] [*, 'MAX_FAILED_ATTEMPTS' BACnetConstructedDataMaxFailedAttempts [simple BACnetApplicationTagUnsignedInteger maxFailedAttempts ] ] //[*, 'MAX_INFO_FRAMES' BACnetConstructedDataMaxInfoFrames [validation '1 == 2' "TODO: implement me MAX_INFO_FRAMES BACnetConstructedDataMaxInfoFrames"]] //[*, 'MAX_MASTER' BACnetConstructedDataMaxMaster [validation '1 == 2' "TODO: implement me MAX_MASTER BACnetConstructedDataMaxMaster"]] ['ACCUMULATOR', 'MAX_PRES_VALUE' BACnetConstructedDataAccumulatorMaxPresValue - [simple BACnetApplicationTagUnsignedInteger maxPresValue ] + [simple BACnetApplicationTagUnsignedInteger maxPresValue ] ] [*, 'MAX_PRES_VALUE' BACnetConstructedDataMaxPresValue [simple BACnetApplicationTagReal maxPresValue ] ] - //[*, 'MAX_SEGMENTS_ACCEPTED' BACnetConstructedDataMaxSegmentsAccepted [validation '1 == 2' "TODO: implement me MAX_SEGMENTS_ACCEPTED BACnetConstructedDataMaxSegmentsAccepted"]] + [*, 'MAX_SEGMENTS_ACCEPTED' BACnetConstructedDataMaxSegmentsAccepted + [simple BACnetApplicationTagUnsignedInteger maxSegmentsAccepted ] + ] [*, 'MAXIMUM_OUTPUT' BACnetConstructedDataMaximumOutput [simple BACnetApplicationTagReal maximumOutput ] ] @@ -3297,7 +3356,9 @@ ] //[*, 'MINIMUM_VALUE_TIMESTAMP' BACnetConstructedDataMinimumValueTimestamp [validation '1 == 2' "TODO: implement me MINIMUM_VALUE_TIMESTAMP BACnetConstructedDataMinimumValueTimestamp"]] //[*, 'MODE' BACnetConstructedDataMode [validation '1 == 2' "TODO: implement me MODE BACnetConstructedDataMode"]] - //[*, 'MODEL_NAME' BACnetConstructedDataModelName [validation '1 == 2' "TODO: implement me MODEL_NAME BACnetConstructedDataModelName"]] + [*, 'MODEL_NAME' BACnetConstructedDataModelName + [simple BACnetApplicationTagCharacterString modelName ] + ] [*, 'MODIFICATION_DATE' BACnetConstructedDataModificationDate [simple BACnetDateTime modificationDate ] ] @@ -3344,7 +3405,9 @@ [*, 'NOTIFY_TYPE' BACnetConstructedDataNotifyType [simple BACnetNotifyTypeTagged('0', 'TagClass.APPLICATION_TAGS') notifyType ] ] - //[*, 'NUMBER_OF_APDU_RETRIES' BACnetConstructedDataNumberOfApduRetries [validation '1 == 2' "TODO: implement me NUMBER_OF_APDU_RETRIES BACnetConstructedDataNumberOfApduRetries"]] + [*, 'NUMBER_OF_APDU_RETRIES' BACnetConstructedDataNumberOfAPDURetries + [simple BACnetApplicationTagUnsignedInteger numberOfApduRetries ] + ] [*, 'NUMBER_OF_AUTHENTICATION_POLICIES' BACnetConstructedDataNumberOfAuthenticationPolicies [simple BACnetApplicationTagUnsignedInteger numberOfAuthenticationPolicies ] ] @@ -3352,7 +3415,13 @@ [*, 'OBJECT_IDENTIFIER' BACnetConstructedDataObjectIdentifier [simple BACnetApplicationTagObjectIdentifier objectIdentifier ] ] - //[*, 'OBJECT_LIST' BACnetConstructedDataObjectList [validation '1 == 2' "TODO: implement me OBJECT_LIST BACnetConstructedDataObjectList"]] + [*, 'OBJECT_LIST' BACnetConstructedDataObjectList + // TODO: we need property support + [array BACnetObjectIdentifierOrUnsignedInteger + objectList + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] + ] [*, 'OBJECT_NAME' BACnetConstructedDataObjectName [simple BACnetApplicationTagCharacterString objectName ] ] @@ -3459,10 +3528,18 @@ [simple BACnetProtocolLevelTagged('0', 'TagClass.APPLICATION_TAGS') protocolLevel ] ] //[*, 'PROTOCOL_CONFORMANCE_CLASS' BACnetConstructedDataProtocolConformanceClass [validation '1 == 2' "TODO: implement me PROTOCOL_CONFORMANCE_CLASS BACnetConstructedDataProtocolConformanceClass"]] - //[*, 'PROTOCOL_OBJECT_TYPES_SUPPORTED' BACnetConstructedDataProtocolObjectTypesSupported [validation '1 == 2' "TODO: implement me PROTOCOL_OBJECT_TYPES_SUPPORTED BACnetConstructedDataProtocolObjectTypesSupported"]] - //[*, 'PROTOCOL_REVISION' BACnetConstructedDataProtocolRevision [validation '1 == 2' "TODO: implement me PROTOCOL_REVISION BACnetConstructedDataProtocolRevision"]] - //[*, 'PROTOCOL_SERVICES_SUPPORTED' BACnetConstructedDataProtocolServicesSupported [validation '1 == 2' "TODO: implement me PROTOCOL_SERVICES_SUPPORTED BACnetConstructedDataProtocolServicesSupported"]] - //[*, 'PROTOCOL_VERSION' BACnetConstructedDataProtocolVersion [validation '1 == 2' "TODO: implement me PROTOCOL_VERSION BACnetConstructedDataProtocolVersion"]] + [*, 'PROTOCOL_OBJECT_TYPES_SUPPORTED' BACnetConstructedDataProtocolObjectTypesSupported + [simple BACnetObjectTypesSupportedTagged('0', 'TagClass.APPLICATION_TAGS') protocolObjectTypesSupported ] + ] + [*, 'PROTOCOL_REVISION' BACnetConstructedDataProtocolRevision + [simple BACnetApplicationTagUnsignedInteger protocolRevision ] + ] + [*, 'PROTOCOL_SERVICES_SUPPORTED' BACnetConstructedDataProtocolServicesSupported + [simple BACnetServicesSupportedTagged('0', 'TagClass.APPLICATION_TAGS') protocolServicesSupported ] + ] + [*, 'PROTOCOL_VERSION' BACnetConstructedDataProtocolVersion + [simple BACnetApplicationTagUnsignedInteger protocolVersion ] + ] //[*, 'PULSE_RATE' BACnetConstructedDataPulseRate [validation '1 == 2' "TODO: implement me PULSE_RATE BACnetConstructedDataPulseRate"]] [*, 'READ_ONLY' BACnetConstructedDataReadOnly [simple BACnetApplicationTagBoolean readOnly ] @@ -3508,14 +3585,23 @@ [*, 'RESOLUTION' BACnetConstructedDataResolution [simple BACnetApplicationTagReal resolution ] ] - //[*, 'RESTART_NOTIFICATION_RECIPIENTS' BACnetConstructedDataRestartNotificationRecipients [validation '1 == 2' "TODO: implement me RESTART_NOTIFICATION_RECIPIENTS BACnetConstructedDataRestartNotificationRecipients"]] - //[*, 'RESTORE_COMPLETION_TIME' BACnetConstructedDataRestoreCompletionTime [validation '1 == 2' "TODO: implement me RESTORE_COMPLETION_TIME BACnetConstructedDataRestoreCompletionTime"]] - //[*, 'RESTORE_PREPARATION_TIME' BACnetConstructedDataRestorePreparationTime [validation '1 == 2' "TODO: implement me RESTORE_PREPARATION_TIME BACnetConstructedDataRestorePreparationTime"]] + [*, 'RESTART_NOTIFICATION_RECIPIENTS' BACnetConstructedDataRestartNotificationRecipients + [array BACnetRecipient + restartNotificationRecipients + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] + ] + [*, 'RESTORE_COMPLETION_TIME' BACnetConstructedDataRestoreCompletionTime + [simple BACnetApplicationTagUnsignedInteger completionTime ] + ] + [*, 'RESTORE_PREPARATION_TIME' BACnetConstructedDataRestorePreparationTime + [simple BACnetApplicationTagUnsignedInteger restorePreparationTime ] + ] [*, 'ROUTING_TABLE' BACnetConstructedDataRoutingTable [array BACnetRouterEntry routingTable terminated - 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] ] //[*, 'SCALE' BACnetConstructedDataScale [validation '1 == 2' "TODO: implement me SCALE BACnetConstructedDataScale"]] [*, 'SCALE_FACTOR' BACnetConstructedDataScaleFactor @@ -3533,8 +3619,12 @@ [*, 'SECURITY_TIME_WINDOW' BACnetConstructedDataSecurityTimeWindow [simple BACnetApplicationTagUnsignedInteger securityTimeWindow ] ] - //[*, 'SEGMENTATION_SUPPORTED' BACnetConstructedDataSegmentationSupported [validation '1 == 2' "TODO: implement me SEGMENTATION_SUPPORTED BACnetConstructedDataSegmentationSupported"]] - //[*, 'SERIAL_NUMBER' BACnetConstructedDataSerialNumber [validation '1 == 2' "TODO: implement me SERIAL_NUMBER BACnetConstructedDataSerialNumber"]] + [*, 'SEGMENTATION_SUPPORTED' BACnetConstructedDataSegmentationSupported + [simple BACnetSegmentationTagged('0', 'TagClass.APPLICATION_TAGS') segmentationSupported ] + ] + [*, 'SERIAL_NUMBER' BACnetConstructedDataSerialNumber + [simple BACnetApplicationTagCharacterString serialNumber ] + ] [*, 'SETPOINT' BACnetConstructedDataSetpoint [simple BACnetApplicationTagReal setpoint ] ] @@ -3589,7 +3679,12 @@ [*, 'STRIKE_COUNT' BACnetConstructedDataStrikeCount [simple BACnetApplicationTagUnsignedInteger strikeCount ] ] - //[*, 'STRUCTURED_OBJECT_LIST' BACnetConstructedDataStructuredObjectList [validation '1 == 2' "TODO: implement me STRUCTURED_OBJECT_LIST BACnetConstructedDataStructuredObjectList"]] + [*, 'STRUCTURED_OBJECT_LIST' BACnetConstructedDataStructuredObjectList + [array BACnetApplicationTagObjectIdentifier + structuredObjectList + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] + ] [*, 'SUBORDINATE_ANNOTATIONS' BACnetConstructedDataSubordinateAnnotations [array BACnetApplicationTagCharacterString subordinateAnnotations @@ -3634,12 +3729,14 @@ terminated 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] ] - //[*, 'SYSTEM_STATUS' BACnetConstructedDataSystemStatus [validation '1 == 2' "TODO: implement me SYSTEM_STATUS BACnetConstructedDataSystemStatus"]] + [*, 'SYSTEM_STATUS' BACnetConstructedDataSystemStatus + [simple BACnetDeviceStatusTagged('0', 'TagClass.APPLICATION_TAGS') systemStatus ] + ] [*, 'TAGS' BACnetConstructedDataTags [array BACnetNameValue tags terminated - 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] ] [*, 'THREAT_AUTHORITY' BACnetConstructedDataThreatAuthority [simple BACnetAccessThreatLevel threatAuthority ] @@ -3654,15 +3751,24 @@ [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"]] + [*, 'TIME_OF_DEVICE_RESTART' BACnetConstructedDataTimeOfDeviceRestart + [simple BACnetTimeStamp timeOfDeviceRestart ] + ] //[*, 'TIME_OF_STATE_COUNT_RESET' BACnetConstructedDataTimeOfStateCountReset [validation '1 == 2' "TODO: implement me TIME_OF_STATE_COUNT_RESET BACnetConstructedDataTimeOfStateCountReset"]] [*, 'TIME_OF_STRIKE_COUNT_RESET' BACnetConstructedDataTimeOfStrikeCountReset [simple BACnetDateTime timeOfStrikeCountReset ] ] - //[*, 'TIME_SYNCHRONIZATION_INTERVAL' BACnetConstructedDataTimeSynchronizationInterval [validation '1 == 2' "TODO: implement me TIME_SYNCHRONIZATION_INTERVAL BACnetConstructedDataTimeSynchronizationInterval"]] - //[*, 'TIME_SYNCHRONIZATION_RECIPIENTS' BACnetConstructedDataTimeSynchronizationRecipients [validation '1 == 2' "TODO: implement me TIME_SYNCHRONIZATION_RECIPIENTS BACnetConstructedDataTimeSynchronizationRecipients"]] + [*, 'TIME_SYNCHRONIZATION_INTERVAL' BACnetConstructedDataTimeSynchronizationInterval + [simple BACnetApplicationTagUnsignedInteger timeSynchronization ] + ] + [*, 'TIME_SYNCHRONIZATION_RECIPIENTS' BACnetConstructedDataTimeSynchronizationRecipients + [array BACnetRecipient + timeSynchronizationRecipients + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + ] [*, 'TIMER_RUNNING' BACnetConstructedDataTimerRunning - [simple BACnetApplicationTagBoolean timerRunning ] + [simple BACnetApplicationTagBoolean timerRunning ] ] [*, 'TIMER_STATE' BACnetConstructedDataTimerState [simple BACnetTimerStateTagged('0', 'TagClass.APPLICATION_TAGS') timerState] @@ -3704,8 +3810,15 @@ [*, '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"]] + [*, 'UTC_OFFSET' BACnetConstructedDataUTCOffset + [simple BACnetApplicationTagSignedInteger utcOffset ] + ] + [*, 'UTC_TIME_SYNCHRONIZATION_RECIPIENTS' BACnetConstructedDataUTCTimeSynchronizationRecipients + [array BACnetRecipient + utcTimeSynchronizationRecipients + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] + ] //[*, 'VALID_SAMPLES' BACnetConstructedDataValidSamples [validation '1 == 2' "TODO: implement me VALID_SAMPLES BACnetConstructedDataValidSamples"]] //[*, 'VALUE_BEFORE_CHANGE' BACnetConstructedDataValueBeforeChange [validation '1 == 2' "TODO: implement me VALUE_BEFORE_CHANGE BACnetConstructedDataValueBeforeChange"]] //[*, 'VALUE_CHANGE_TIME' BACnetConstructedDataValueChangeTime [validation '1 == 2' "TODO: implement me VALUE_CHANGE_TIME BACnetConstructedDataValueChangeTime"]] @@ -3713,8 +3826,12 @@ //[*, 'VALUE_SOURCE' BACnetConstructedDataValueSource [validation '1 == 2' "TODO: implement me VALUE_SOURCE BACnetConstructedDataValueSource"]] //[*, 'VALUE_SOURCE_ARRAY' BACnetConstructedDataValueSourceArray [validation '1 == 2' "TODO: implement me VALUE_SOURCE_ARRAY BACnetConstructedDataValueSourceArray"]] //[*, 'VARIANCE_VALUE' BACnetConstructedDataVarianceValue [validation '1 == 2' "TODO: implement me VARIANCE_VALUE BACnetConstructedDataVarianceValue"]] - //[*, 'VENDOR_IDENTIFIER' BACnetConstructedDataVendorIdentifier [validation '1 == 2' "TODO: implement me VENDOR_IDENTIFIER BACnetConstructedDataVendorIdentifier"]] - //[*, 'VENDOR_NAME' BACnetConstructedDataVendorName [validation '1 == 2' "TODO: implement me VENDOR_NAME BACnetConstructedDataVendorName"]] + [*, 'VENDOR_IDENTIFIER' BACnetConstructedDataVendorIdentifier + [simple BACnetVendorIdTagged('0', 'TagClass.APPLICATION_TAGS') vendorIdentifier ] + ] + [*, 'VENDOR_NAME' BACnetConstructedDataVendorName + [simple BACnetApplicationTagCharacterString vendorName ] + ] [*, 'VERIFICATION_TIME' BACnetConstructedDataVerificationTime [simple BACnetApplicationTagSignedInteger verificationTime ] ] @@ -3724,7 +3841,12 @@ terminated 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] ] - //[*, 'VT_CLASSES_SUPPORTED' BACnetConstructedDataVtClassesSupported [validation '1 == 2' "TODO: implement me VT_CLASSES_SUPPORTED BACnetConstructedDataVtClassesSupported"]] + [*, 'VT_CLASSES_SUPPORTED' BACnetConstructedDataVTClassesSupported + [array BACnetVTClassTagged('0', 'TagClass.APPLICATION_TAGS') + vtClassesSupported + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)'] + ] [*, 'WEEKLY_SCHEDULE' BACnetConstructedDataWeeklySchedule [array BACnetDailySchedule weeklySchedule @@ -5035,14 +5157,14 @@ [type BACnetEventParameterChangeOfCharacterStringListOfAlarmValues(uint 8 tagNumber) - [simple BACnetOpeningTag('tagNumber') + [simple BACnetOpeningTag('tagNumber') openingTag ] - [array BACnetApplicationTagCharacterString + [array BACnetApplicationTagCharacterString listOfAlarmValues terminated 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] - [simple BACnetClosingTag('tagNumber') + [simple BACnetClosingTag('tagNumber') closingTag ] ] @@ -5083,3 +5205,91 @@ ] ] ] + +[type BACnetCOVMultipleSubscription + [simple BACnetRecipientProcessEnclosed('0') + recipient ] + [simple BACnetContextTagBoolean('1', 'BACnetDataType.BOOLEAN') + issueConfirmedNotifications ] + [simple BACnetContextTagUnsignedInteger('2', 'BACnetDataType.UNSIGNED_INTEGER') + timeRemaining ] + [simple BACnetContextTagUnsignedInteger('3', 'BACnetDataType.UNSIGNED_INTEGER') + maxNotificationDelay ] + [simple BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification('4') + listOfCovSubscriptionSpecification ] +] + +[type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecification(uint 8 tagNumber) + [simple BACnetOpeningTag('tagNumber') + openingTag ] + + [array BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry + listOfCovSubscriptionSpecificationEntry + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + [simple BACnetClosingTag('tagNumber') + closingTag ] +] + +[type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntry + [simple BACnetContextTagObjectIdentifier('0', 'BACnetDataType.BACNET_OBJECT_IDENTIFIER') + monitoredObjectIdentifier ] + [simple BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences('1') + listOfCovReferences ] +] + +[type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferences(uint 8 tagNumber) + [simple BACnetOpeningTag('tagNumber') + openingTag ] + + [array BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry + listOfCovReferences + terminated + 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] + [simple BACnetClosingTag('tagNumber') + closingTag ] +] + +[type BACnetCOVMultipleSubscriptionListOfCovSubscriptionSpecificationEntryListOfCovReferencesEntry + [simple BACnetPropertyReferenceEnclosed('0') + monitoredProperty ] + [optional BACnetContextTagReal('1', 'BACnetDataType.REAL') + covIncrement ] + [simple BACnetContextTagBoolean('1', 'BACnetDataType.BOOLEAN') + timestamped ] +] + +[type BACnetVTSession + [simple BACnetApplicationTagUnsignedInteger + localVtSessionId ] + [simple BACnetApplicationTagUnsignedInteger + removeVtSessionId ] + [simple BACnetAddress + remoteVtAddress ] +] + +[type BACnetCOVSubscription + [simple BACnetRecipientProcessEnclosed('0') + recipient ] + [simple BACnetObjectPropertyReferenceEnclosed('1') + monitoredPropertyReference ] + [simple BACnetContextTagBoolean('2', 'BACnetDataType.BOOLEAN') + issueConfirmedNotifications ] + [simple BACnetContextTagUnsignedInteger('3', 'BACnetDataType.UNSIGNED_INTEGER') + timeRemaining ] + [optional BACnetContextTagReal('4', 'BACnetDataType.REAL') + covIncrement ] +] + +// TODO: can be removed once we implement proper index support +[type BACnetObjectIdentifierOrUnsignedInteger + [peek BACnetTagHeader + peekedTagHeader ] + [virtual uint 8 peekedTagNumber 'peekedTagHeader.actualTagNumber' ] + [optional BACnetApplicationTagObjectIdentifier + objectIdentifier 'peekedTagNumber == 0xC' ] + [optional BACnetApplicationTagUnsignedInteger + fallbackIdentifier 'peekedTagNumber == 0x2 ' ] + [optional BACnetApplicationTagNull + nullValue 'objectIdentifier == null && fallbackIdentifier == null' ] +] diff --git a/protocols/bacnetip/src/main/script/produceTaggedBitStrings.groovy b/protocols/bacnetip/src/main/script/produceTaggedBitStrings.groovy index 3cbde17c9d2..b470274708a 100644 --- a/protocols/bacnetip/src/main/script/produceTaggedBitStrings.groovy +++ b/protocols/bacnetip/src/main/script/produceTaggedBitStrings.groovy @@ -22,10 +22,11 @@ import org.apache.maven.project.MavenProject project = (MavenProject) project def bacnetEnumsFile = new File(project.basedir, "src/main/resources/protocols/bacnetip/bacnet-bit-strings.mspec") +def bacnetEnumsFileContent = bacnetEnumsFile.text foundEnums = [] -enumPattern = ~/\[enum \w+ \d+ (\w+)\r?\n((?: *\[.*]\r?\n)*)]/ +enumPattern = ~/\[enum \w+ \d+ (\w+)\r?\n((?:(?:(?: *\[.*] *(?:\/\/.*)?)|(?: *\/\/.*))\r?\n)*)]/ enumEntryPattern = ~/ *\['(\d)+' *([\w_]+).*]/ -matcher = bacnetEnumsFile.text =~ enumPattern +matcher = bacnetEnumsFileContent =~ enumPattern if (matcher.find()) { matcher.each { def enumName = it[1]